--- a/core/src/androidMain/kotlin/com/geekorum/aboutoss/core/gms/OssLicenseParserExt.kt Sun May 04 21:05:24 2025 -0400
+++ b/core/src/androidMain/kotlin/com/geekorum/aboutoss/core/gms/OssLicenseParserExt.kt Mon May 05 02:56:41 2025 -0400
@@ -25,16 +25,25 @@
import android.content.Context
import java.io.InputStream
+/**
+ * Open the default third_party_licenses file stored in app resources
+ */
@SuppressLint("DiscouragedApi")
fun OssLicenseParser.Companion.openDefaultThirdPartyLicenses(context: Context): InputStream {
return openRawResourcesByName(context, "third_party_licenses")
}
+/**
+ * Open the default third_party_licenses_metadata file stored in app resources
+ */
@SuppressLint("DiscouragedApi")
fun OssLicenseParser.Companion.openDefaultThirdPartyLicensesMetadata(context: Context): InputStream {
return openRawResourcesByName(context, "third_party_license_metadata")
}
+/**
+ * Open the a raw resource file stored in app resources
+ */
@SuppressLint("DiscouragedApi")
fun OssLicenseParser.Companion.openRawResourcesByName(context: Context, name: String): InputStream {
val resourceId = context.resources.getIdentifier(name, "raw", context.packageName)
--- a/core/src/androidMain/kotlin/com/geekorum/aboutoss/core/licensee/LicenseeLicenseInfoRepository.android.kt Sun May 04 21:05:24 2025 -0400
+++ b/core/src/androidMain/kotlin/com/geekorum/aboutoss/core/licensee/LicenseeLicenseInfoRepository.android.kt Mon May 05 02:56:41 2025 -0400
@@ -26,6 +26,9 @@
import kotlinx.coroutines.Dispatchers
import okio.source
+/**
+ * Create a [com.geekorum.aboutoss.core.licensee.LicenseeLicenseInfoRepository]
+ */
fun LicenseeLicenseInfoRepository(
assetManager: AssetManager,
licenseeAssetsPath: String = "app/cash/licensee/artifacts.json",
--- a/core/src/commonMain/kotlin/licensee/LicenseeLicenseInfoRepository.kt Sun May 04 21:05:24 2025 -0400
+++ b/core/src/commonMain/kotlin/licensee/LicenseeLicenseInfoRepository.kt Mon May 05 02:56:41 2025 -0400
@@ -27,6 +27,9 @@
import kotlinx.serialization.ExperimentalSerializationApi
import okio.Source
+/**
+ * Retrieve license information produced by [licensee](https://github.com/cashapp/licensee)
+ */
class LicenseeLicenseInfoRepository(
private val produceInput: suspend () -> Source,
private val mainCoroutineDispatcher: CoroutineDispatcher,
--- a/core/src/commonMain/kotlin/licensee/LicenseeParser.kt Sun May 04 21:05:24 2025 -0400
+++ b/core/src/commonMain/kotlin/licensee/LicenseeParser.kt Mon May 05 02:56:41 2025 -0400
@@ -26,11 +26,19 @@
import okio.Source
import okio.buffer
+/**
+ * Parse licences data generated by the [licensee](https://github.com/cashapp/licensee) gradle plugin.
+ */
class LicenseeParser(
input: Source
): AutoCloseable {
private val buffered = input.buffer()
+ /**
+ * Read licensee data
+ *
+ * @return a map of dependency name to license
+ */
fun readLicensee(): Map<String, String> {
val json = Json {
ignoreUnknownKeys = true
--- a/core/src/desktopMain/kotlin/licensee/LicenseeLicenseInfoRepository.desktop.kt Sun May 04 21:05:24 2025 -0400
+++ b/core/src/desktopMain/kotlin/licensee/LicenseeLicenseInfoRepository.desktop.kt Mon May 05 02:56:41 2025 -0400
@@ -25,6 +25,9 @@
import kotlinx.coroutines.Dispatchers
import okio.Buffer
+/**
+ * Create a [com.geekorum.aboutoss.core.licensee.LicenseeLicenseInfoRepository]
+ */
fun LicenseeLicenseInfoRepository(
licenseeResourcePath: String = "app/cash/licensee/artifacts.json",
mainCoroutineDispatcher: CoroutineDispatcher = Dispatchers.Main,
--- a/core/src/iosMain/kotlin/licensee/LicenseeLicenseInfoRepository.ios.kt Sun May 04 21:05:24 2025 -0400
+++ b/core/src/iosMain/kotlin/licensee/LicenseeLicenseInfoRepository.ios.kt Mon May 05 02:56:41 2025 -0400
@@ -33,6 +33,9 @@
import platform.Foundation.NSFileManager
import platform.posix.memcpy
+/**
+ * Create a [com.geekorum.aboutoss.core.licensee.LicenseeLicenseInfoRepository]
+ */
fun LicenseeLicenseInfoRepository(
licenseeResourcePath: String = "compose-resources/app/cash/licensee/artifacts.json",
mainCoroutineDispatcher: CoroutineDispatcher = Dispatchers.Main,
--- a/core/src/iosMain/kotlin/licenseplist/LicensePlistLicenseInfoRepository.kt Sun May 04 21:05:24 2025 -0400
+++ b/core/src/iosMain/kotlin/licenseplist/LicensePlistLicenseInfoRepository.kt Mon May 05 02:56:41 2025 -0400
@@ -25,6 +25,9 @@
import kotlinx.coroutines.CoroutineDispatcher
import kotlinx.coroutines.withContext
+/**
+ * Retrieve license information produced by [LicensePlist](https://github.com/mono0926/LicensePlist)
+ */
class LicensePlistLicenseInfoRepository(
private val mainCoroutineDispatcher: CoroutineDispatcher,
private val ioCoroutineDispatcher: CoroutineDispatcher
--- a/core/src/iosMain/kotlin/licenseplist/LicensePlistParser.kt Sun May 04 21:05:24 2025 -0400
+++ b/core/src/iosMain/kotlin/licenseplist/LicensePlistParser.kt Mon May 05 02:56:41 2025 -0400
@@ -39,8 +39,17 @@
import kotlin.coroutines.resumeWithException
import kotlin.coroutines.suspendCoroutine
+/**
+ * Parse LicensePlist files
+ */
class LicensePlistParser {
+ /**
+ * Parse LicensePlist files
+ *
+ * @param licensePlistInput url of com.mono0926.LicensePlist.plist file
+ * @return a map of dependency name to license
+ */
@Suppress("UNCHECKED_CAST")
suspend fun parseLicenses(
licensePlistInput: NSURL
@@ -95,6 +104,9 @@
}
companion object {
+ /**
+ * Get url of the default LicensePlist file
+ */
fun getDefaultLicensePlistUrl(): NSURL {
val path = NSBundle.mainBundle.pathForResource(
"com.mono0926.LicensePlist",