Skip to content

Commit 959b736

Browse files
committed
Set up dokka and publishing
1 parent 5f2a47f commit 959b736

File tree

7 files changed

+146
-5
lines changed

7 files changed

+146
-5
lines changed

buildSrc/build.gradle.kts

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
plugins {
2+
`kotlin-dsl`
3+
}
4+
5+
dependencies {
6+
implementation(plugin(libs.plugins.binary.compatibility.validator))
7+
implementation(plugin(libs.plugins.ktlint))
8+
implementation(plugin(libs.plugins.kotlin.multiplatform))
9+
implementation(plugin(libs.plugins.dokka))
10+
implementation(plugin(libs.plugins.vanniktech.maven.publish))
11+
}
12+
13+
/**
14+
* Helper function that transforms a Gradle Plugin alias from a Version Catalog into a valid
15+
* dependency notation for buildSrc. Taken from
16+
* https://docs.gradle.org/current/userguide/version_catalogs.html#sec:buildsrc-version-catalog
17+
*/
18+
private fun DependencyHandlerScope.plugin(plugin: Provider<PluginDependency>) =
19+
plugin.map { "${it.pluginId}:${it.pluginId}.gradle.plugin:${it.version}" }

buildSrc/gradle.properties

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# Enable the v2 syntax of the Dokka Gradle Plugin
2+
# https://kotlinlang.org/docs/dokka-migration.html
3+
org.jetbrains.dokka.experimental.gradle.pluginMode=V2Enabled
4+
org.jetbrains.dokka.experimental.gradle.pluginMode.noWarn=true

buildSrc/settings.gradle.kts

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
pluginManagement {
2+
repositories {
3+
google()
4+
mavenCentral()
5+
gradlePluginPortal()
6+
}
7+
}
8+
9+
dependencyResolutionManagement {
10+
repositories {
11+
google()
12+
mavenLocal()
13+
mavenCentral()
14+
gradlePluginPortal()
15+
}
16+
17+
versionCatalogs {
18+
create("libs") {
19+
from(files("../gradle/libs.versions.toml"))
20+
}
21+
}
22+
}
Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
import com.vanniktech.maven.publish.JavadocJar
2+
import com.vanniktech.maven.publish.KotlinMultiplatform
3+
4+
plugins {
5+
id("org.jetbrains.kotlin.multiplatform")
6+
id("org.jetbrains.kotlinx.binary-compatibility-validator")
7+
id("org.jlleitschuh.gradle.ktlint")
8+
id("com.vanniktech.maven.publish")
9+
id("org.jetbrains.dokka")
10+
}
11+
12+
// Configure Dokka for documentation
13+
dokka {
14+
dokkaPublications.html {
15+
suppressInheritedMembers.set(true)
16+
failOnWarning.set(true)
17+
}
18+
dokkaSourceSets.commonMain {
19+
sourceLink {
20+
localDirectory.set(file("src/"))
21+
remoteUrl("https://github.com/open-feature/kotlin-sdk/tree/main/kotlin-sdk/src")
22+
remoteLineSuffix.set("#L")
23+
}
24+
}
25+
}
26+
27+
mavenPublishing {
28+
configure(
29+
KotlinMultiplatform(
30+
javadocJar = JavadocJar.Dokka("dokkaGeneratePublicationHtml"),
31+
sourcesJar = true,
32+
androidVariantsToPublish = listOf("release")
33+
)
34+
)
35+
signAllPublications()
36+
coordinates(
37+
groupId = "dev.openfeature.kotlin.contrib.providers",
38+
version = findProperty("version").toString()
39+
)
40+
pom {
41+
name.set("OpenFeature Kotlin SDK")
42+
description.set(
43+
"This is the Kotlin implementation of OpenFeature, a vendor-agnostic abstraction library for evaluating feature flags."
44+
)
45+
url.set("https://openfeature.dev")
46+
licenses {
47+
license {
48+
name.set("The Apache License, Version 2.0")
49+
url.set("http://www.apache.org/licenses/LICENSE-2.0.txt")
50+
}
51+
}
52+
developers {
53+
developer {
54+
id.set("vahidlazio")
55+
name.set("Vahid Torkaman")
56+
email.set("[email protected]")
57+
}
58+
developer {
59+
id.set("fabriziodemaria")
60+
name.set("Fabrizio Demaria")
61+
email.set("[email protected]")
62+
}
63+
developer {
64+
id.set("nicklasl")
65+
name.set("Nicklas Lundin")
66+
email.set("[email protected]")
67+
}
68+
developer {
69+
id.set("nickybondarenko")
70+
name.set("Nicky Bondarenko")
71+
email.set("[email protected]")
72+
}
73+
developer {
74+
id.set("bencehornak")
75+
name.set("Bence Hornák")
76+
email.set("[email protected]")
77+
}
78+
}
79+
scm {
80+
connection.set(
81+
"scm:git:https://github.com/open-feature/kotlin-sdk-contrib.git"
82+
)
83+
developerConnection.set(
84+
"scm:git:ssh://open-feature/kotlin-sdk-contrib.git"
85+
)
86+
url.set("https://github.com/open-feature/kotlin-sdk-contrib")
87+
}
88+
}
89+
}
90+

gradle.properties

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
1+
version=0.1.0
12
org.gradle.configuration-cache=true
23

34
# This seems to be necessary for Coroutines to work on JS. Otherwise getting the following error:
45
# > Task :providers:env-var:compileTestDevelopmentExecutableKotlinJs FAILED
56
# e: java.lang.IllegalStateException: IC internal error: can not find library org.jetbrains.kotlin:kotlinx-atomicfu-runtime
6-
kotlinx.atomicfu.enableJsIrTransformation=true
7+
kotlinx.atomicfu.enableJsIrTransformation=true
8+
9+
# Enable the v2 syntax of the Dokka Gradle Plugin
10+
# https://kotlinlang.org/docs/dokka-migration.html
11+
org.jetbrains.dokka.experimental.gradle.pluginMode=V2Enabled
12+
org.jetbrains.dokka.experimental.gradle.pluginMode.noWarn=true

gradle/libs.versions.toml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,10 @@ kotlinx-coroutines-core = { group="org.jetbrains.kotlinx", name="kotlinx-corouti
1010
kotlinx-coroutines-test = { group="org.jetbrains.kotlinx", name="kotlinx-coroutines-test", version.ref="kotlinx-coroutines" }
1111

1212
[plugins]
13+
dokka = { id="org.jetbrains.dokka", version="2.0.0" }
1314
kotlin-multiplatform = { id="org.jetbrains.kotlin.multiplatform", version.ref="kotlin" }
1415
kotlinx-atomicfu = { id="org.jetbrains.kotlinx.atomicfu", version="0.27.0" }
1516
ktlint = { id="org.jlleitschuh.gradle.ktlint", version="12.3.0" }
1617
nexus-publish = { id="io.github.gradle-nexus.publish-plugin", version="2.0.0" }
17-
binary-compatibility-validator = { id="org.jetbrains.kotlinx.binary-compatibility-validator", version="0.17.0" }
18+
binary-compatibility-validator = { id="org.jetbrains.kotlinx.binary-compatibility-validator", version="0.17.0" }
19+
vanniktech-maven-publish = { id="com.vanniktech.maven.publish", version="0.34.0" }

providers/env-var/build.gradle.kts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,7 @@ import org.jetbrains.kotlin.gradle.targets.js.testing.KotlinJsTest
33
import org.jetbrains.kotlin.gradle.targets.native.tasks.KotlinNativeTest
44

55
plugins {
6-
alias(libs.plugins.kotlin.multiplatform)
7-
alias(libs.plugins.binary.compatibility.validator)
8-
alias(libs.plugins.ktlint)
6+
id("dev.openfeature.provider-conventions")
97
// Needed for the JS coroutine support for the tests
108
alias(libs.plugins.kotlinx.atomicfu)
119
}

0 commit comments

Comments
 (0)