Skip to content

Commit

Permalink
fix publications
Browse files Browse the repository at this point in the history
  • Loading branch information
baev committed Jul 30, 2024
1 parent 654a674 commit f9d9d34
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 22 deletions.
46 changes: 31 additions & 15 deletions allure-scalatest/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
import org.gradle.jvm.tasks.Jar

// inspired on
// https://github.com/Jolanrensen/gradle-crossbuild-sample
// https://github.com/gabrieljones/crossbuild-hello
// https://github.com/newrelic/newrelic-java-agent/blob/scala3-cross-build/newrelic-scala-api/build.gradle.kts
description = "Allure ScalaTest Integration"

plugins {
Expand Down Expand Up @@ -31,13 +27,40 @@ crossBuild {
val crossBuildScala_212Jar by tasks.getting
val crossBuildScala_213Jar by tasks.getting

val scaladocJar by tasks.creating(Jar::class) {
from(tasks.getByName("scaladoc"))
archiveClassifier.set("scaladoc")
}

tasks.withType<PublishToMavenLocal>().configureEach {
val predicate = provider {
publication != publishing.publications["maven"]
}
onlyIf("disable default maven publication") {
predicate.get()
}
}

tasks.withType<PublishToMavenRepository>().configureEach {
val predicate = provider {
publication != publishing.publications["maven"]
}
onlyIf("disable default maven publication") {
predicate.get()
}
}

publishing {
publications {
register("crossBuildScala_212", MavenPublication::class) {
artifact(crossBuildScala_212Jar)
create<MavenPublication>("crossBuildScala_212") {
from(components["crossBuildScala_212"])
artifact(scaladocJar)
artifact(tasks.sourcesJar)
}
register("crossBuildScala_213", MavenPublication::class) {
artifact(crossBuildScala_213Jar)
create<MavenPublication>("crossBuildScala_213") {
from(components["crossBuildScala_213"])
artifact(scaladocJar)
artifact(tasks.sourcesJar)
}
}
}
Expand All @@ -58,13 +81,6 @@ dependencies {
testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine")
}

val scaladocJar by tasks.creating(Jar::class) {
from(tasks.getByName("scaladoc"))
archiveClassifier.set("scaladoc")
}

artifacts.add("archives", scaladocJar)

tasks.jar {
manifest {
attributes(mapOf(
Expand Down
16 changes: 9 additions & 7 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -56,13 +56,7 @@ configure(subprojects) {

publishing {
publications {
create<MavenPublication>("maven") {
suppressAllPomMetadataWarnings()
versionMapping {
allVariants {
fromResolutionResult()
}
}
withType<MavenPublication>().configureEach {
pom {
name.set(project.name)
description.set("Module ${project.name} of Allure Framework.")
Expand Down Expand Up @@ -106,6 +100,14 @@ configure(subprojects) {
}
}
}
create<MavenPublication>("maven") {
suppressAllPomMetadataWarnings()
versionMapping {
allVariants {
fromResolutionResult()
}
}
}
}
}

Expand Down

0 comments on commit f9d9d34

Please sign in to comment.