1+ import org.jetbrains.kotlin.gradle.tasks.KaptGenerateStubs
2+
13// Top-level build file where you can add configuration options common to all sub-projects/modules.
24
35buildscript {
@@ -13,14 +15,16 @@ buildscript {
1315 classpath " org.jetbrains.kotlin:kotlin-serialization:$kotlin_version "
1416 classpath " org.jetbrains.dokka:dokka-gradle-plugin:$dokka_version "
1517 classpath ' com.google.protobuf:protobuf-gradle-plugin:0.9.5'
16- classpath " io.codearte.gradle.nexus:gradle-nexus-staging-plugin:0.30.0"
1718 classpath ' com.dicedmelon.gradle:jacoco-android:0.1.5'
1819 classpath " com.diffplug.spotless:spotless-plugin-gradle:6.23.3"
1920 // NOTE: Do not place your application dependencies here; they belong
2021 // in the individual module build.gradle files
2122 }
2223}
23- apply plugin : ' io.codearte.nexus-staging'
24+
25+ plugins {
26+ id(" io.github.gradle-nexus.publish-plugin" ) version " 2.0.0"
27+ }
2428
2529subprojects {
2630 // Ignore examples folder, it's not a module itself.
@@ -73,34 +77,38 @@ subprojects {
7377 // From Gradle 8 onwards, Kapt no longer automatically picks up jvmTarget
7478 // from normal KotlinOptions. Must be manually set.
7579 // JvmToolchain should not be used since it changes the actual JDK used.
76- tasks. withType(org.jetbrains.kotlin.gradle.tasks. KaptGenerateStubs ). configureEach {
80+ tasks. withType(KaptGenerateStubs ). configureEach {
7781 kotlinOptions {
7882 jvmTarget = java_version
7983 }
8084 }
8185
8286}
8387
84- task clean ( type : Delete ) {
88+ tasks . register( ' clean ' , Delete ) {
8589 delete rootProject. buildDir
8690}
8791
88- nexusStaging {
89- serverUrl = " https://s01.oss.sonatype.org/service/local/"
90- packageGroup = GROUP
91- stagingProfileId = STAGING_PROFILE_ID
92+ group = GROUP
93+ version = VERSION_NAME
94+
95+ def getRepositoryUsername () {
96+ return hasProperty(' nexusUsername' ) ? nexusUsername : " "
9297}
9398
94- afterEvaluate {
95- // These aren't supported for snapshots. From nexus staging plugin.
96- if (VERSION_NAME . contains(" SNAPSHOT" )) {
97- [" closeAndReleaseRepository" ,
98- " closeRepository" ,
99- " createRepository" ,
100- " getStagingProfile" ,
101- " releaseRepository" ]
102- .forEach { taskName ->
103- getTasksByName(taskName, false ). forEach { task -> task. enabled = false }
104- }
99+ def getRepositoryPassword () {
100+ return hasProperty(' nexusPassword' ) ? nexusPassword : " "
101+ }
102+
103+ nexusPublishing {
104+ packageGroup = GROUP
105+ repositories {
106+ maven {
107+ nexusUrl. set(uri(" https://ossrh-staging-api.central.sonatype.com/service/local/" ))
108+ snapshotRepositoryUrl. set(uri(" https://central.sonatype.com/repository/maven-snapshots/" ))
109+ username = getRepositoryUsername()
110+ password = getRepositoryPassword()
111+ stagingProfileId = STAGING_PROFILE_ID
112+ }
105113 }
106114}
0 commit comments