diff --git a/build.gradle.kts b/build.gradle.kts index 1436050..b2dda1e 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -1,16 +1,16 @@ import com.vanniktech.maven.publish.MavenPublishBaseExtension -import com.vanniktech.maven.publish.MavenPublishPlugin +import com.vanniktech.maven.publish.MavenPublishBasePlugin import com.vanniktech.maven.publish.SonatypeHost import org.jetbrains.kotlin.gradle.tasks.KotlinCompile plugins { - alias(libs.plugins.multiplatform).apply(false) alias(libs.plugins.android.library).apply(false) + alias(libs.plugins.multiplatform).apply(false) alias(libs.plugins.kotlinx.serialization).apply(false) alias(libs.plugins.sqlDelight).apply(false) - alias(libs.plugins.maven.publish).apply(false) alias(libs.plugins.android.application) apply false alias(libs.plugins.kotlin.android) apply false + alias(libs.plugins.maven.publish).apply(false) } group = findProperty("GROUP").toString() @@ -23,13 +23,19 @@ allprojects { } subprojects { - plugins.withType().configureEach { - extensions.findByType()?.also { publishing -> + plugins.withType().configureEach { + extensions.configure { + logger.lifecycle("Configuring Maven Publishing for ${name}:${version}") + publishToMavenCentral(SonatypeHost.CENTRAL_PORTAL, automaticRelease = true) + // https://github.com/vanniktech/gradle-maven-publish-plugin/issues/865 + //signAllPublications() + } + extensions.configure { logger.lifecycle("Publishing ${project.name}:${version}") - publishing.publications.withType().configureEach { + publications.withType().configureEach { this.version = project.version.toString() } - publishing.repositories { + repositories { // GitHub Packages maven { name = "GitHubPackages" @@ -41,13 +47,6 @@ subprojects { } } } - extensions.findByType()?.also { mavenPublishing -> - mavenPublishing.publishToMavenCentral( - SonatypeHost.CENTRAL_PORTAL, - automaticRelease = true - ) - mavenPublishing.signAllPublications() - } } tasks.withType().configureEach { compilerOptions.freeCompilerArgs.add("-Xexpect-actual-classes") diff --git a/library/build.gradle.kts b/library/build.gradle.kts index f2dfc74..d5e64cf 100644 --- a/library/build.gradle.kts +++ b/library/build.gradle.kts @@ -90,3 +90,8 @@ androidComponents { (it as HasUnitTestBuilder).enableUnitTest = false } } + +// https://github.com/vanniktech/gradle-maven-publish-plugin/issues/865 +mavenPublishing { + signAllPublications() +}