diff --git a/build.gradle.kts b/build.gradle.kts index f1100ec..c7f6bee 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -4,9 +4,11 @@ plugins { id("com.android.application").version("8.10.0").apply(false) id("org.jetbrains.kotlin.multiplatform").version("2.1.21").apply(false) id("org.jetbrains.kotlin.plugin.compose").version("2.1.0").apply(false) + id("org.jetbrains.dokka").version("2.0.0").apply(false) id("org.jlleitschuh.gradle.ktlint").version("11.6.1").apply(true) id("io.github.gradle-nexus.publish-plugin").version("2.0.0").apply(true) id("org.jetbrains.kotlinx.binary-compatibility-validator").version("0.17.0").apply(false) + id("com.vanniktech.maven.publish").version("0.34.0").apply(false) } allprojects { extra["groupId"] = "dev.openfeature" diff --git a/gradle.properties b/gradle.properties index 3c5031e..dafa068 100644 --- a/gradle.properties +++ b/gradle.properties @@ -20,4 +20,8 @@ kotlin.code.style=official # Enables namespacing of each library's R class so that its R class includes only the # resources declared in the library itself and none from the library's dependencies, # thereby reducing the size of the R class for that library -android.nonTransitiveRClass=true \ No newline at end of file +android.nonTransitiveRClass=true +# Enable the v2 syntax of the Dokka Gradle Plugin +# https://kotlinlang.org/docs/dokka-migration.html +org.jetbrains.dokka.experimental.gradle.pluginMode=V2Enabled +org.jetbrains.dokka.experimental.gradle.pluginMode.noWarn=true \ No newline at end of file diff --git a/kotlin-sdk/build.gradle.kts b/kotlin-sdk/build.gradle.kts index 730d863..d544c24 100644 --- a/kotlin-sdk/build.gradle.kts +++ b/kotlin-sdk/build.gradle.kts @@ -1,11 +1,16 @@ +import com.vanniktech.maven.publish.JavadocJar +import com.vanniktech.maven.publish.KotlinMultiplatform import org.jetbrains.kotlin.gradle.dsl.JvmTarget + plugins { id("com.android.library") id("org.jetbrains.kotlin.multiplatform") + id("org.jetbrains.dokka") id("maven-publish") id("signing") id("org.jlleitschuh.gradle.ktlint") id("org.jetbrains.kotlinx.binary-compatibility-validator") + id("com.vanniktech.maven.publish") } val releaseVersion = project.extra["version"].toString() @@ -15,6 +20,8 @@ version = releaseVersion kotlin { androidTarget { + publishLibraryVariants("release") + compilations.all { compileTaskProvider.configure { compilerOptions { @@ -70,71 +77,75 @@ android { sourceCompatibility = JavaVersion.VERSION_11 targetCompatibility = JavaVersion.VERSION_11 } +} - publishing { - singleVariant("release") { - withJavadocJar() - withSourcesJar() +// Configure Dokka for documentation +dokka { + dokkaPublications.html { + suppressInheritedMembers.set(true) + failOnWarning.set(true) + } + dokkaSourceSets.commonMain { + sourceLink { + localDirectory.set(file("src/")) + remoteUrl("https://github.com/open-feature/kotlin-sdk/tree/main/kotlin-sdk/src") + remoteLineSuffix.set("#L") } } } -publishing { - publications { - register("release") { +mavenPublishing { + configure( + KotlinMultiplatform( + javadocJar = JavadocJar.Dokka("dokkaGeneratePublicationHtml"), + sourcesJar = true, + androidVariantsToPublish = listOf("release") + ) + ) + signAllPublications() - pom { - name.set("OpenFeature Android SDK") - description.set( - "This is the Android implementation of OpenFeature, a vendor-agnostic abstraction library for evaluating feature flags." - ) - url.set("https://openfeature.dev") - licenses { - license { - name.set("The Apache License, Version 2.0") - url.set("http://www.apache.org/licenses/LICENSE-2.0.txt") - } - } - developers { - developer { - id.set("vahidlazio") - name.set("Vahid Torkaman") - email.set("vahidt@spotify.com") - } - developer { - id.set("fabriziodemaria") - name.set("Fabrizio Demaria") - email.set("fdema@spotify.com") - } - developer { - id.set("nicklasl") - name.set("Nicklas Lundin") - email.set("nicklasl@spotify.com") - } - developer { - id.set("nickybondarenko") - name.set("Nicky Bondarenko") - email.set("nickyb@spotify.com") - } - } - scm { - connection.set( - "scm:git:https://github.com/open-feature/kotlin-sdk.git" - ) - developerConnection.set( - "scm:git:ssh://open-feature/kotlin-sdk.git" - ) - url.set("https://github.com/open-feature/kotlin-sdk") - } + pom { + name.set("OpenFeature Kotlin SDK") + description.set( + "This is the Kotlin implementation of OpenFeature, a vendor-agnostic abstraction library for evaluating feature flags." + ) + url.set("https://openfeature.dev") + licenses { + license { + name.set("The Apache License, Version 2.0") + url.set("http://www.apache.org/licenses/LICENSE-2.0.txt") } - - afterEvaluate { - from(components["release"]) + } + developers { + developer { + id.set("vahidlazio") + name.set("Vahid Torkaman") + email.set("vahidt@spotify.com") + } + developer { + id.set("fabriziodemaria") + name.set("Fabrizio Demaria") + email.set("fdema@spotify.com") + } + developer { + id.set("nicklasl") + name.set("Nicklas Lundin") + email.set("nicklasl@spotify.com") + } + developer { + id.set("nickybondarenko") + name.set("Nicky Bondarenko") + email.set("nickyb@spotify.com") } } + scm { + connection.set( + "scm:git:https://github.com/open-feature/kotlin-sdk.git" + ) + developerConnection.set( + "scm:git:ssh://open-feature/kotlin-sdk.git" + ) + url.set("https://github.com/open-feature/kotlin-sdk") + } } -} - -signing { - sign(publishing.publications["release"]) } \ No newline at end of file