Skip to content

Commit

Permalink
Fix publishing of the BOM artifact
Browse files Browse the repository at this point in the history
Signed-off-by: Fabio Di Fabio <fabio.difabio@consensys.net>
  • Loading branch information
fab-10 committed Oct 23, 2024
1 parent 30ef0ac commit e251635
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 29 deletions.
68 changes: 41 additions & 27 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -528,43 +535,50 @@ subprojects {
}
}
}

publications {
mavenJava(MavenPublication) {
groupId "io.consensys.linea-besu.internal"
version "${project.version}"
if (sourceSetIsPopulated("main")) {
from components.java
artifact sourcesJar
artifact javadocJar
}
if(!hasPlugin("java-platform")) {

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'
}
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() }
}
scm {
connection = 'scm:git:git://github.com/ConsenSys/linea-besu.git'
developerConnection = 'scm:git:ssh://github.com/ConsenSys/linea-besu.git'
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'
}
}
}
}
}
}
}


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()
Expand Down
3 changes: 1 addition & 2 deletions platform/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down

0 comments on commit e251635

Please sign in to comment.