Skip to content

Commit

Permalink
Gradle cleanup and simplification (#63)
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 authored Aug 12, 2024
1 parent d52c581 commit 13c2ddd
Show file tree
Hide file tree
Showing 7 changed files with 37 additions and 254 deletions.
21 changes: 9 additions & 12 deletions acceptance-tests/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,6 @@ processTestResources.dependsOn(':acceptance-tests:generateTestContractWrappers')
tasks.register('acceptanceTests', Test) {
description = 'Runs acceptance tests.'

dependsOn(project(":native:compress").compileJava)
dependsOn(project(":sequencer").copyPluginJar)

inputs.property("integration.date", LocalTime.now()) // so it runs on every invocation

useJUnitPlatform {
Expand All @@ -56,16 +53,16 @@ tasks.register('acceptanceTests', Test) {
dependencies {
testImplementation project(":native:compress")
testImplementation project(":sequencer")
testImplementation "${besuArtifactGroup}.internal:dsl:$besuVersion"
testImplementation "${besuArtifactGroup}.internal:api:${besuVersion}"

testImplementation "${besuArtifactGroup}:besu-datatypes"
testImplementation "${besuArtifactGroup}:evm"
testImplementation "${besuArtifactGroup}:plugin-api"
testImplementation "${besuArtifactGroup}.internal:algorithms:${besuVersion}"
testImplementation "${besuArtifactGroup}:besu-datatypes:$besuVersion"
testImplementation "${besuArtifactGroup}.internal:eth:$besuVersion"
testImplementation "${besuArtifactGroup}.internal:eth:$besuVersion:test-support"
testImplementation "${besuArtifactGroup}.internal:core:$besuVersion"
testImplementation "${besuArtifactGroup}.internal:core:$besuVersion:test-support"
testImplementation "${besuArtifactGroup}:evm:$besuVersion"

testImplementation "${besuArtifactGroup}.internal:algorithms"
testImplementation "${besuArtifactGroup}.internal:api"
testImplementation "${besuArtifactGroup}.internal:core"
testImplementation "${besuArtifactGroup}.internal:dsl"
testImplementation "${besuArtifactGroup}.internal:eth"

testImplementation 'io.tmio:tuweni-bytes'
testImplementation 'io.tmio:tuweni-units'
Expand Down
27 changes: 0 additions & 27 deletions gradle/allprojects.gradle

This file was deleted.

12 changes: 10 additions & 2 deletions gradle/dependency-management.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -63,13 +63,21 @@ dependencyManagement {
entry "arithmetization"
}


// Besu dependencies
dependencySet(group: "${besuArtifactGroup}", version: "${besuVersion}") {
entry "besu-datatypes"
entry "evm"
entry "plugin-api"
entry "internal"
}

// Besu internal dependencies
dependencySet(group: "${besuArtifactGroup}.internal", version: "${besuVersion}") {
entry "algorithms"
entry "api"
entry "core"
entry "dsl"
entry "eth"
entry "rlp"
}

dependencySet(group: 'ch.qos.logback', version: '1.5.6') {
Expand Down
104 changes: 0 additions & 104 deletions gradle/dist.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import de.undercouch.gradle.tasks.download.Download

/*
* Copyright Consensys Software Inc.
*
Expand Down Expand Up @@ -27,38 +25,9 @@ tasks.register('javadocJar', Jar) {
from javadoc.destinationDir
}

def lineaBesuDistTar = new File(new File(buildDir, "tmp"), 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) {
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

manifest {
Expand Down Expand Up @@ -93,76 +62,3 @@ static def getCheckedOutGitCommitHash() {
def hashLength = 8
"git rev-parse HEAD".execute().text.take(hashLength)
}

tasks.register('distTar', Tar) {
dependsOn jar
dependsOn downloadLatestLineaBesu
dependsOn copyLocalLineaBesu

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

from(configurations.installedJars) {
into "plugins"
exclude "**/common*.jar"
}

into besuPluginsIdentifier
archiveBaseName = distributionIdentifier
compression = Compression.GZIP
archiveExtension = 'tar.gz'

exclude 'META-INF/*.RSA', 'META-INF/*.SF', 'META-INF/*.DSA'
duplicatesStrategy(DuplicatesStrategy.INCLUDE)
}

tasks.register('installDist', Copy) {
dependsOn distTar

from(tarTree(distTar.outputs.getFiles().getSingleFile()), {
eachFile { path = path.replaceFirst(besuPluginsIdentifier, distributionIdentifier) }
includeEmptyDirs = false
})
into "$buildDir/distributions/install"
duplicatesStrategy(DuplicatesStrategy.INCLUDE)
}

tasks.register('distZip', Zip) {
dependsOn installDist

archiveBaseName = distributionIdentifier
from installDist.outputs.getFiles()
archiveBaseName
setArchiveExtension 'zip'
duplicatesStrategy(DuplicatesStrategy.INCLUDE)
}

tasks.register("copyPluginJar") {
dependsOn installDist

doLast {
def copyInto = rootProject.besuPluginDir
def copyFrom = new File("${project(":sequencer").buildDir}/libs")

copy {
from copyFrom.toString()
into copyInto.toString()
include '*.jar'
}
}
}

tasks.register('deployPlugins', Copy) {
dependsOn jar
dependsOn installDist

from(configurations.installedJars) {
into new File(distributionIdentifier, "plugins")
exclude "**/common*.jar"
}

into installDist.destinationDir
}
95 changes: 0 additions & 95 deletions gradle/publishing.gradle

This file was deleted.

5 changes: 5 additions & 0 deletions gradle/tests.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,15 @@ import java.time.LocalTime
*/

apply plugin: 'jacoco'

jacoco {
toolVersion = '0.8.12'
}

configurations {
testSupportImplementation.extendsFrom implementation
}

test {
description = 'Runs unit tests.'

Expand Down
27 changes: 13 additions & 14 deletions sequencer/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ plugins {
id 'java'
id 'common-plugins'
id 'com.github.hierynomus.license'
id "de.undercouch.download"
}

group = 'net.consensys.linea.besu.plugin'
Expand All @@ -34,23 +33,24 @@ apply from: rootProject.file("gradle/lint.gradle")
dependencies {
// annotationProcessor generates the file META-INF/services/org.hyperledger.besu.plugin.BesuPlugin
annotationProcessor 'com.google.auto.service:auto-service'
compileOnly "${besuArtifactGroup}:evm"
compileOnly 'com.google.auto.service:auto-service'
compileOnly 'com.google.auto.service:auto-service-annotations'

compileOnly "${besuArtifactGroup}:besu-datatypes"
compileOnly "${besuArtifactGroup}:evm"
compileOnly "${besuArtifactGroup}:plugin-api"
compileOnly "${besuArtifactGroup}:besu-datatypes"
compileOnly "${besuArtifactGroup}.internal:api:${besuVersion}"
compileOnly "${besuArtifactGroup}.internal:core:${besuVersion}"
compileOnly "${besuArtifactGroup}.internal:rlp:${besuVersion}"
compileOnly "${besuArtifactGroup}.internal:algorithms:${besuVersion}"
implementation project(":native:compress")
compileOnly "${besuArtifactGroup}.internal:algorithms"
compileOnly "${besuArtifactGroup}.internal:api"
compileOnly "${besuArtifactGroup}.internal:core"
compileOnly "${besuArtifactGroup}.internal:rlp"

compileOnly 'com.google.auto.service:auto-service'
compileOnly 'com.google.auto.service:auto-service-annotations'

compileOnly 'info.picocli:picocli'

compileOnly 'io.vertx:vertx-core'

implementation project(":native:compress")

implementation 'com.fasterxml.jackson.core:jackson-databind'
implementation 'com.fasterxml.jackson.dataformat:jackson-dataformat-yaml'

Expand All @@ -67,9 +67,9 @@ dependencies {

testImplementation "${besuArtifactGroup}:evm"
testImplementation "${besuArtifactGroup}:besu-datatypes"
testImplementation "${besuArtifactGroup}.internal:core:${besuVersion}"
testImplementation "${besuArtifactGroup}.internal:rlp:${besuVersion}"
testImplementation "${besuArtifactGroup}.internal:core:${besuVersion}"
testImplementation "${besuArtifactGroup}.internal:core"
testImplementation "${besuArtifactGroup}.internal:rlp"
testImplementation "${besuArtifactGroup}.internal:core"

// workaround for bug https://github.com/dnsjava/dnsjava/issues/329, remove when upgraded upstream
testImplementation 'dnsjava:dnsjava:3.6.1'
Expand All @@ -82,7 +82,6 @@ configurations {
}

apply from: rootProject.file("gradle/dist.gradle")
apply from: rootProject.file("gradle/publishing.gradle")

jar {
zip64=true
Expand Down

0 comments on commit 13c2ddd

Please sign in to comment.