Skip to content

Commit

Permalink
Allow to use local Linea Besu dist
Browse files Browse the repository at this point in the history
Signed-off-by: Fabio Di Fabio <[email protected]>
  • Loading branch information
fab-10 committed May 22, 2024
1 parent fc42749 commit e21dae8
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 4 deletions.
1 change: 1 addition & 0 deletions gradle/dependency-management.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ repositories {
content { includeGroupByRegex('com\\.splunk\\..*') }
}
mavenCentral()
mavenLocal()
}

configurations.all {
Expand Down
30 changes: 26 additions & 4 deletions gradle/dist.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -27,16 +27,37 @@ tasks.register('javadocJar', Jar) {
from javadoc.destinationDir
}

def lineaBesuDistTar = new File(buildDir, rootProject.besuFilename)

tasks.register('copyLocalLineaBesu', Copy) {
onlyIf {
project.hasProperty('useLocalLineaBesuDir')
}
def localLineaBesuDir = "${findProperty('useLocalLineaBesuDir')}".replaceFirst('^~', System.getProperty('user.home'))
doFirst {
if (!file(localLineaBesuDir).exists()) {
throw new GradleException("${localLineaBesuDir} not found")
}
}

from new File("${localLineaBesuDir}/build/distributions/${rootProject.besuFilename}")
into lineaBesuDistTar.parentFile
}

tasks.register('downloadLatestLineaBesu', Download) {
src rootProject.besuUrl
dest new File(buildDir, rootProject.besuFilename)
onlyIfModified true
onlyIf {
!project.hasProperty('useLocalLineaBesuDir')
}
src rootProject.besuUrl
dest lineaBesuDistTar
onlyIfModified true
}

version = project.hasProperty('releaseVersion') ? project.getProperty('releaseVersion') : 'snapshot'

jar {
dependsOn downloadLatestLineaBesu
dependsOn copyLocalLineaBesu

archiveBaseName = distributionIdentifier

Expand Down Expand Up @@ -76,8 +97,9 @@ static def getCheckedOutGitCommitHash() {
tasks.register('distTar', Tar) {
dependsOn jar
dependsOn downloadLatestLineaBesu
dependsOn copyLocalLineaBesu

from(tarTree(downloadLatestLineaBesu.dest), {
from(tarTree(lineaBesuDistTar), {
eachFile { path = path.replaceFirst(rootProject.besuIdentifier, '') }
includeEmptyDirs = false
exclude "**/LICENSE"
Expand Down

0 comments on commit e21dae8

Please sign in to comment.