Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bump Gradle and Dokka #143

Merged
merged 1 commit into from
Jul 22, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 9 additions & 5 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import org.jetbrains.kotlin.konan.target.HostManager

plugins {
kotlin("multiplatform") version "1.9.0"
id("org.jetbrains.dokka") version "0.9.18"
id("org.jetbrains.dokka") version "1.8.20"
id("maven-publish")
id("signing")
}
Expand All @@ -13,8 +13,12 @@ repositories {
mavenCentral()
}

tasks.dokka {
samples = listOf("src/commonTest/kotlin")
tasks.dokkaHtml {
dokkaSourceSets {
configureEach {
samples.from("src/commonTest/kotlin")
}
}
}

kotlin {
Expand Down Expand Up @@ -178,15 +182,15 @@ val ktlint by tasks.registering(JavaExec::class) {
group = "verification"
description = "Check Kotlin code style."
classpath = ktlintConfig
main = "com.pinterest.ktlint.Main"
mainClass.set("com.pinterest.ktlint.Main")
args = listOf("src/**/*.kt")
}

val ktlintformat by tasks.registering(JavaExec::class) {
group = "formatting"
description = "Fix Kotlin code style deviations."
classpath = ktlintConfig
main = "com.pinterest.ktlint.Main"
mainClass.set("com.pinterest.ktlint.Main")
args = listOf("-F", "src/**/*.kt", "*.kts")
}

Expand Down
2 changes: 2 additions & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,5 @@ POM_DESCRIPTION=A Kotlin multiplatform implementation of a v4 RFC4122 UUID


kotlin.mpp.enableCompatibilityMetadataVariant=true

org.gradle.jvmargs=-Xmx4g
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.8.3-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.2.1-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
65 changes: 3 additions & 62 deletions publish.gradle
Original file line number Diff line number Diff line change
@@ -1,65 +1,6 @@
group GROUP
version VERSION

dokka {
impliedPlatforms = ['Common'] // This will force platform tags for all non-common sources e.g. 'JVM'
kotlinTasks {
// dokka fails to retrieve sources from MPP-tasks so they must be set empty to avoid exception
// use sourceRoot instead (see below)
[]
}
packageOptions {
prefix = GROUP
}
sourceRoot {
// assuming there is only a single source dir...
path = kotlin.sourceSets.commonMain.kotlin.srcDirs[0]
platforms = ['Common']
}
if (kotlin.sourceSets.getNames().contains('jvmMain')) {
sourceRoot {
// assuming there is only a single source dir...
path = kotlin.sourceSets.jvmMain.kotlin.srcDirs[0]
platforms = ['JVM']
}
}
if (kotlin.sourceSets.getNames().contains('jsMain')) {
sourceRoot {
// assuming there is only a single source dir...
path = kotlin.sourceSets.jsMain.kotlin.srcDirs[0]
platforms = ['js']
}
}
if (kotlin.sourceSets.getNames().contains('nativeMain')) {
sourceRoot {
// assuming there is only a single source dir...
path = kotlin.sourceSets.nativeMain.kotlin.srcDirs[0]
platforms = ['native']
}
}
if (kotlin.sourceSets.getNames().contains('nix32Main')) {
sourceRoot {
// assuming there is only a single source dir...
path = kotlin.sourceSets.nix32Main.kotlin.srcDirs[0]
platforms = ['native']
}
}
if (kotlin.sourceSets.getNames().contains('nix64Main')) {
sourceRoot {
// assuming there is only a single source dir...
path = kotlin.sourceSets.nix64Main.kotlin.srcDirs[0]
platforms = ['native']
}
}
if (kotlin.sourceSets.getNames().contains('mingwMain')) {
sourceRoot {
// assuming there is only a single source dir...
path = kotlin.sourceSets.mingwMain.kotlin.srcDirs[0]
platforms = ['native']
}
}
Copy link
Contributor Author

@martinbonnin martinbonnin Jul 14, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not 100% sure if this is still needed. Since the Dokka version was quite old, I assumed the newer version maybe handle that part better but let me know if not the case.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not 100% sure here, but I'll take a look at the output!

}

def isReleaseBuild() {
return VERSION.contains('SNAPSHOT') == false
}
Expand All @@ -82,9 +23,9 @@ def getRepositoryPassword() {
return System.getenv('SONATYPE_PASSWORD') ?: ''
}

task javadocsJar(type: Jar, dependsOn: dokka) {
classifier = 'javadoc'
from dokka.outputDirectory
task javadocsJar(type: Jar, dependsOn: dokkaHtml) {
archiveClassifier = 'javadoc'
from dokkaHtml.outputDirectory
}

publishing {
Expand Down