diff --git a/build.gradle.kts b/build.gradle.kts index cd67508..46288de 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -2,6 +2,7 @@ plugins { alias(libs.plugins.kotlin.jvm) apply false alias(libs.plugins.kotlin.multiplatform) apply false alias(libs.plugins.gradle.publish) apply false + alias(libs.plugins.kotlin.dokka) } buildscript { diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 8636aef..8f0fc60 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -5,6 +5,7 @@ ksp = "2.0.20-Beta1-1.0.22" kotlinCompose = "1.7.0-alpha01" kotlinxSerialization = "1.7.1" kotlinxSerializationPlugin = "2.0.0" +dokka = "1.9.20" gradlePublish = "1.2.1" junitImpl = "5.7.2" junitRuntime = "5.7.2" @@ -13,6 +14,7 @@ compileTesting = "1.6.0" [plugins] gradle-publish = { id = "com.gradle.plugin-publish", version.ref = "gradlePublish" } google-ksp = { id = "com.google.devtools.ksp", version.ref = "ksp" } +kotlin-dokka = { id = "org.jetbrains.dokka", version.ref = "dokka" } kotlin-jvm = { id = "org.jetbrains.kotlin.jvm", version.ref = "kotlin" } kotlin-multiplatform = { id = "org.jetbrains.kotlin.multiplatform", version.ref = "kotlin" } kotlin-compose = { id = "org.jetbrains.compose", version.ref = "kotlinCompose" } diff --git a/kmp-composeuiviewcontroller-annotations/build.gradle.kts b/kmp-composeuiviewcontroller-annotations/build.gradle.kts index ff0d3b9..6df6e55 100644 --- a/kmp-composeuiviewcontroller-annotations/build.gradle.kts +++ b/kmp-composeuiviewcontroller-annotations/build.gradle.kts @@ -3,6 +3,7 @@ import org.jetbrains.kotlin.gradle.targets.js.dsl.ExperimentalWasmDsl plugins { `kmp-composeuiviewcontroller-publish` alias(libs.plugins.kotlin.multiplatform) + alias(libs.plugins.kotlin.dokka) } kotlin { diff --git a/kmp-composeuiviewcontroller-annotations/src/commonMain/kotlin/com/github/guilhe/kmp/composeuiviewcontroller/Annotations.kt b/kmp-composeuiviewcontroller-annotations/src/commonMain/kotlin/com/github/guilhe/kmp/composeuiviewcontroller/Annotations.kt index 931d0ba..d95b584 100644 --- a/kmp-composeuiviewcontroller-annotations/src/commonMain/kotlin/com/github/guilhe/kmp/composeuiviewcontroller/Annotations.kt +++ b/kmp-composeuiviewcontroller-annotations/src/commonMain/kotlin/com/github/guilhe/kmp/composeuiviewcontroller/Annotations.kt @@ -3,15 +3,21 @@ package com.github.guilhe.kmp.composeuiviewcontroller import kotlin.experimental.ExperimentalObjCRefinement import kotlin.native.HidesFromObjC +/** + * Used to annotate the @Composable as a desired ComposeUIViewController to be used by the iOS app. While the plugin typically attempts to retrieve this name automatically, you can use this parameter to enforce a specific name if the automatic retrieval fails. + * [More here](https://github.com/GuilhE/KMP-ComposeUIViewController?tab=readme-ov-file#kmp-module) + * @param frameworkBaseName Kotlin Multiplatform library iOS targets framework base name + */ @Target(AnnotationTarget.FUNCTION) @Retention(AnnotationRetention.BINARY) @OptIn(ExperimentalObjCRefinement::class) @HidesFromObjC -/** - * @param frameworkBaseName: shared library framework's base name - */ public annotation class ComposeUIViewController(val frameworkBaseName: String = "") +/** + * Used to annotate the parameter as the composable state variable (for advanced use cases). Only 0 or 1 [ComposeUIViewControllerState] and an arbitrary number of parameter types (excluding [Composable] functions) are allowed in [ComposeUIViewController] functions. + * [More here](https://github.com/GuilhE/KMP-ComposeUIViewController?tab=readme-ov-file#kmp-module) + */ @Target(AnnotationTarget.VALUE_PARAMETER, AnnotationTarget.EXPRESSION) @Retention(AnnotationRetention.SOURCE) public annotation class ComposeUIViewControllerState \ No newline at end of file diff --git a/kmp-composeuiviewcontroller-gradle-plugin/build.gradle.kts b/kmp-composeuiviewcontroller-gradle-plugin/build.gradle.kts index 2ea01d2..4955f2b 100644 --- a/kmp-composeuiviewcontroller-gradle-plugin/build.gradle.kts +++ b/kmp-composeuiviewcontroller-gradle-plugin/build.gradle.kts @@ -6,6 +6,7 @@ plugins { alias(libs.plugins.kotlin.jvm) alias(libs.plugins.gradle.publish) alias(libs.plugins.kotlinx.serialization) + alias(libs.plugins.kotlin.dokka) } kotlin { diff --git a/kmp-composeuiviewcontroller-gradle-plugin/src/main/kotlin/com/github/guilhe/kmp/composeuiviewcontroller/gradle/ComposeUiViewControllerParameters.kt b/kmp-composeuiviewcontroller-gradle-plugin/src/main/kotlin/com/github/guilhe/kmp/composeuiviewcontroller/gradle/ComposeUiViewControllerParameters.kt index 618328e..c51a064 100644 --- a/kmp-composeuiviewcontroller-gradle-plugin/src/main/kotlin/com/github/guilhe/kmp/composeuiviewcontroller/gradle/ComposeUiViewControllerParameters.kt +++ b/kmp-composeuiviewcontroller-gradle-plugin/src/main/kotlin/com/github/guilhe/kmp/composeuiviewcontroller/gradle/ComposeUiViewControllerParameters.kt @@ -1,5 +1,13 @@ package com.github.guilhe.kmp.composeuiviewcontroller.gradle +/** + * Gradle extension to configure the plugin parameters + * @property iosAppFolderName Name of the folder containing the iosApp in the root's project tree + * @property iosAppName Name of the iOS project (name.xcodeproj) + * @property targetName Name of the iOS project's target + * @property exportFolderName Name of the destination folder inside iOS project ([iosAppFolderName]) where the Composable files will be copied to when [autoExport] is `true` + * @property autoExport Enables auto export generated files to Xcode project. If set to false, you will find the generated files under / build/ generated/ ksp/. Warning: avoid deleting [iosAppFolderName]/[exportFolderName] without first using Xcode to Remove references. + */ public open class ComposeUiViewControllerParameters { /** * Name of the folder containing the iosApp in the root's project tree @@ -22,10 +30,7 @@ public open class ComposeUiViewControllerParameters { public var exportFolderName: String = "Representables" /** - * Auto export generated files to Xcode project - * - * If set to `false`, you will find the generated files under `/build/generated/ksp/`. - * Warning: avoid deleting `[iosAppFolderName]/[exportFolderName]` without first using Xcode to Remove references. + * Auto export generated files to Xcode project. If set to `false`, you will find the generated files under `/build/generated/ksp/`. Warning: avoid deleting `[iosAppFolderName]/[exportFolderName]` without first using Xcode to Remove references. */ public var autoExport: Boolean = true } \ No newline at end of file diff --git a/kmp-composeuiviewcontroller-gradle-plugin/src/main/kotlin/com/github/guilhe/kmp/composeuiviewcontroller/gradle/KmpComposeUIViewControllerPlugin.kt b/kmp-composeuiviewcontroller-gradle-plugin/src/main/kotlin/com/github/guilhe/kmp/composeuiviewcontroller/gradle/KmpComposeUIViewControllerPlugin.kt index 876c766..0799795 100644 --- a/kmp-composeuiviewcontroller-gradle-plugin/src/main/kotlin/com/github/guilhe/kmp/composeuiviewcontroller/gradle/KmpComposeUIViewControllerPlugin.kt +++ b/kmp-composeuiviewcontroller-gradle-plugin/src/main/kotlin/com/github/guilhe/kmp/composeuiviewcontroller/gradle/KmpComposeUIViewControllerPlugin.kt @@ -19,6 +19,9 @@ import org.jetbrains.kotlin.konan.target.Family import java.io.BufferedReader import java.io.File +/** + * Heavy lifts gradle configurations when using [KMP-ComposeUIViewController](https://github.com/GuilhE/KMP-ComposeUIViewController) library. + */ public class KmpComposeUIViewControllerPlugin : Plugin { private fun KotlinTarget.fromIosFamily(): Boolean = this is KotlinNativeTarget && konanTarget.family == Family.IOS @@ -138,7 +141,7 @@ public class KmpComposeUIViewControllerPlugin : Plugin { } catch (e: Exception) { mutableSetOf() } - args.forEach { (key, value) -> moduleMetadata.add(ModuleMetadata(name = name.toString(), packageNames = value, frameworkBaseName = key)) } + args.forEach { (key, value) -> moduleMetadata.add(ModuleMetadata(name = name, packageNames = value, frameworkBaseName = key)) } file.writeText(Json.encodeToString(moduleMetadata)) }