diff options
author | Kamil Doległo <9080183+kamildoleglo@users.noreply.github.com> | 2021-06-23 12:33:19 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-06-23 12:33:19 +0200 |
commit | c2182b766a65619c859c0fc871a8a6334d66f199 (patch) | |
tree | 41624b51bcdb79f7f48fc436878b35120d77197d /build.gradle.kts | |
parent | 522775119b1f31d5f478662402eb29a5de9e0f12 (diff) | |
download | dokka-c2182b766a65619c859c0fc871a8a6334d66f199.tar.gz dokka-c2182b766a65619c859c0fc871a8a6334d66f199.tar.bz2 dokka-c2182b766a65619c859c0fc871a8a6334d66f199.zip |
Add maven central publication (#1688)
* Add OSSRH repositories
* Rewrite Gradle plugin publication
* Add publication version assertion
* Use Nexus publish plugin for publishing to Sonatype
* Remove explicit publishing from s3 tests
* Don't document Dokka for local publication
* Fix a bug with closing Sonatype repository
* Bump internal Dokka version
* Move publication version check to the validate task
* Fix Gradle plugin publication
* Bump Dokka and gradle plugin-publish versions
* Do not run Dokka for test tasks
* Do not fail all runs in a workflow
* Reduce JVM memory limit
Diffstat (limited to 'build.gradle.kts')
-rw-r--r-- | build.gradle.kts | 28 |
1 files changed, 20 insertions, 8 deletions
diff --git a/build.gradle.kts b/build.gradle.kts index dca6b9d9..b7026693 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -1,11 +1,11 @@ -import org.jetbrains.ValidatePublications -import org.jetbrains.configureDokkaVersion +import org.jetbrains.* import org.jetbrains.kotlin.gradle.tasks.KotlinCompile plugins { kotlin("jvm") apply false id("java") - id("org.jetbrains.dokka") version "1.4.10.2" + id("org.jetbrains.dokka") version "1.4.32" + id("io.github.gradle-nexus.publish-plugin") } val dokka_version: String by project @@ -55,16 +55,13 @@ subprojects { val dokkaOutputDir = "$buildDir/dokka" dokkaHtml { + onlyIf { !isLocalPublication } outputDirectory.set(file(dokkaOutputDir)) } - val deleteDokkaOutputDir by registering(Delete::class) { - delete(dokkaOutputDir) - } - register<Jar>("javadocJar") { - dependsOn(deleteDokkaOutputDir, dokkaHtml) archiveClassifier.set("javadoc") + dependsOn(dokkaHtml) from(dokkaOutputDir) } } @@ -80,3 +77,18 @@ tasks.whenTaskAdded { println("Publication version: $dokka_version") tasks.register<ValidatePublications>("validatePublications") + +nexusPublishing { + repositories { + sonatype { + username.set(System.getenv("SONATYPE_USER")) + password.set(System.getenv("SONATYPE_PASSWORD")) + } + } +} + +tasks.maybeCreate("dokkaPublish").run { + if (publicationChannels.any { it.isMavenRepository }) { + finalizedBy(tasks.named("closeAndReleaseSonatypeStagingRepository")) + } +} |