Fix publishing of the BOM artifact

Signed-off-by: Fabio Di Fabio <fabio.difabio@consensys.net>
This commit is contained in:
Fabio Di Fabio
2024-10-23 10:44:09 +02:00
parent 30ef0ac24b
commit e2516352c8
2 changed files with 43 additions and 30 deletions

View File

@@ -514,7 +514,14 @@ subprojects {
return result
}
if (sourceSetIsPopulated("main") || sourceSetIsPopulated("testSupport")) {
def hasPlugin = { pluginName ->
def result = project.getPluginManager().hasPlugin(pluginName)
def projectName = project.name
logger.info("Project = " + projectName + (result ? " has" : "has not") + " plugin " + pluginName)
return result
}
if (hasPlugin("java-platform") || sourceSetIsPopulated("main") || sourceSetIsPopulated("testSupport")) {
apply plugin: 'maven-publish'
publishing {
@@ -528,36 +535,42 @@ subprojects {
}
}
}
publications {
mavenJava(MavenPublication) {
groupId "io.consensys.linea-besu.internal"
version "${project.version}"
if (sourceSetIsPopulated("main")) {
from components.java
artifact sourcesJar
artifact javadocJar
}
if (sourceSetIsPopulated("testSupport")) {
artifact testSupportJar
}
versionMapping {
usage('java-api') { fromResolutionOf('runtimeClasspath') }
usage('java-runtime') { fromResolutionResult() }
}
pom {
name = "Linea Besu - ${project.name}"
url = 'https://github.com/ConsenSys/linea-besu'
licenses {
license {
name = 'The Apache License, Version 2.0'
url = 'http://www.apache.org/licenses/LICENSE-2.0.txt'
}
publications {
if(!hasPlugin("java-platform")) {
mavenJava(MavenPublication) {
groupId "io.consensys.linea-besu.internal"
version "${project.version}"
if (sourceSetIsPopulated("main")) {
from components.java
artifact sourcesJar
artifact javadocJar
}
scm {
connection = 'scm:git:git://github.com/ConsenSys/linea-besu.git'
developerConnection = 'scm:git:ssh://github.com/ConsenSys/linea-besu.git'
if (sourceSetIsPopulated("testSupport")) {
artifact testSupportJar
}
versionMapping {
usage('java-api') { fromResolutionOf('runtimeClasspath') }
usage('java-runtime') { fromResolutionResult() }
}
pom {
name = "Linea Besu - ${project.name}"
url = 'https://github.com/ConsenSys/linea-besu'
licenses {
license {
name = 'The Apache License, Version 2.0'
url = 'http://www.apache.org/licenses/LICENSE-2.0.txt'
}
}
scm {
connection = 'scm:git:git://github.com/ConsenSys/linea-besu.git'
developerConnection = 'scm:git:ssh://github.com/ConsenSys/linea-besu.git'
url = 'https://github.com/ConsenSys/linea-besu'
}
}
}
}
@@ -565,6 +578,7 @@ subprojects {
}
}
tasks.withType(Test) {
// If GRADLE_MAX_TEST_FORKS is not set, use half the available processors
maxParallelForks = (System.getenv('GRADLE_MAX_TEST_FORKS') ?: (Runtime.runtime.availableProcessors().intdiv(2) ?: 1)).toInteger()

View File

@@ -189,10 +189,9 @@ publishing {
publications {
mavenPlatform(MavenPublication) {
from components.javaPlatform
groupId "io.consensys.linea-besu"
groupId 'io.consensys.linea-besu'
artifactId 'bom'
version calculateVersion()
pom {
name = "Linea Besu BOM"
url = 'https://github.com/ConsenSys/linea-besu'