Skip to content

Commit

Permalink
fix publishing workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
Nek-12 committed Jul 25, 2024
1 parent a33f43e commit e60e326
Showing 1 changed file with 40 additions and 47 deletions.
87 changes: 40 additions & 47 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import com.vanniktech.maven.publish.MavenPublishBaseExtension
import com.vanniktech.maven.publish.MavenPublishPlugin
import com.vanniktech.maven.publish.SonatypeHost
import nl.littlerobots.vcu.plugin.versionCatalogUpdate
import nl.littlerobots.vcu.plugin.versionSelector
Expand Down Expand Up @@ -26,13 +27,6 @@ plugins {
allprojects {
group = Config.artifactId
version = Config.versionName
tasks.withType<KotlinCompile>().configureEach {
compilerOptions {
jvmTarget.set(Config.jvmTarget)
freeCompilerArgs.apply { addAll(Config.jvmCompilerArgs) }
optIn.addAll(Config.optIns.map { "-opt-in=$it" })
}
}
}

subprojects {
Expand All @@ -49,33 +43,48 @@ subprojects {
}
}
}
extensions.findByType<MavenPublishBaseExtension>()?.apply {
val isReleaseBuild = properties["release"]?.toString().toBoolean()
publishToMavenCentral(SonatypeHost.CENTRAL_PORTAL, false)
if (isReleaseBuild) signAllPublications()
coordinates(Config.artifactId, name, Config.version(isReleaseBuild))
pom {
name = Config.name
description = Config.description
url = Config.url
licenses {
license {
name = Config.licenseName
url = Config.licenseUrl
distribution = Config.licenseUrl
plugins.withType<MavenPublishPlugin>().configureEach {
the<MavenPublishBaseExtension>().apply {
val isReleaseBuild = properties["release"]?.toString().toBoolean()
publishToMavenCentral(SonatypeHost.CENTRAL_PORTAL, false)
if (isReleaseBuild) signAllPublications()
coordinates(Config.artifactId, name, Config.version(isReleaseBuild))
pom {
name = Config.name
description = Config.description
url = Config.url
licenses {
license {
name = Config.licenseName
url = Config.licenseUrl
distribution = Config.licenseUrl
}
}
}
developers {
developer {
id = Config.vendorId
name = Config.vendorName
url = Config.developerUrl
email = Config.supportEmail
organizationUrl = Config.developerUrl
developers {
developer {
id = Config.vendorId
name = Config.vendorName
url = Config.developerUrl
email = Config.supportEmail
organizationUrl = Config.developerUrl
}
}
scm {
url = Config.scmUrl
}
}
scm {
url = Config.scmUrl
}
}
tasks {
withType<Test>().configureEach {
useJUnitPlatform()
filter { isFailOnNoMatchingTests = true }
}
withType<KotlinCompile>().configureEach {
compilerOptions {
jvmTarget.set(Config.jvmTarget)
freeCompilerArgs.apply { addAll(Config.jvmCompilerArgs) }
optIn.addAll(Config.optIns.map { "-opt-in=$it" })
}
}
}
Expand All @@ -87,22 +96,6 @@ subprojects {
dependencies {
dokkaPlugin(rootProject.libs.dokka.android)
}

tasks {
withType<Test>().configureEach {
useJUnitPlatform()
filter { isFailOnNoMatchingTests = true }
}
register<org.gradle.jvm.tasks.Jar>("dokkaJavadocJar") {
dependsOn(dokkaJavadoc)
from(dokkaJavadoc.flatMap { it.outputDirectory })
archiveClassifier.set("javadoc")
}

register<org.gradle.jvm.tasks.Jar>("emptyJavadocJar") {
archiveClassifier.set("javadoc")
}
}
}

doctor {
Expand Down

0 comments on commit e60e326

Please sign in to comment.