# HG changeset patch # User Da Risk # Date 1746428201 14400 # Node ID 79794afbbf95542d6e9634056ce5640d744eaeaf # Parent 9cf28ee2a8e9b61a181325e8f82956cde21825c8 core: add a few more kdocs diff -r 9cf28ee2a8e9 -r 79794afbbf95 core/src/androidMain/kotlin/com/geekorum/aboutoss/core/gms/OssLicenseParserExt.kt --- 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) diff -r 9cf28ee2a8e9 -r 79794afbbf95 core/src/androidMain/kotlin/com/geekorum/aboutoss/core/licensee/LicenseeLicenseInfoRepository.android.kt --- 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", diff -r 9cf28ee2a8e9 -r 79794afbbf95 core/src/commonMain/kotlin/licensee/LicenseeLicenseInfoRepository.kt --- 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, diff -r 9cf28ee2a8e9 -r 79794afbbf95 core/src/commonMain/kotlin/licensee/LicenseeParser.kt --- 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 { val json = Json { ignoreUnknownKeys = true diff -r 9cf28ee2a8e9 -r 79794afbbf95 core/src/desktopMain/kotlin/licensee/LicenseeLicenseInfoRepository.desktop.kt --- 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, diff -r 9cf28ee2a8e9 -r 79794afbbf95 core/src/iosMain/kotlin/licensee/LicenseeLicenseInfoRepository.ios.kt --- 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, diff -r 9cf28ee2a8e9 -r 79794afbbf95 core/src/iosMain/kotlin/licenseplist/LicensePlistLicenseInfoRepository.kt --- 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 diff -r 9cf28ee2a8e9 -r 79794afbbf95 core/src/iosMain/kotlin/licenseplist/LicensePlistParser.kt --- 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",