Skip to content

Commit

Permalink
Introduce pluginImplementation and pluginClasspath
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 Nov 29, 2024
1 parent 3a41006 commit b03d935
Show file tree
Hide file tree
Showing 4 changed files with 70 additions and 29 deletions.
23 changes: 7 additions & 16 deletions arithmetization/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,10 @@ apply from: rootProject.file("gradle/lint.gradle")
apply from: rootProject.file("gradle/trace-files.gradle")

dependencies {
pluginImplementation 'com.fasterxml.jackson.dataformat:jackson-dataformat-yaml'

// annotationProcessor generates the file META-INF/services/org.hyperledger.besu.plugin.BesuPlugin
annotationProcessor 'com.google.auto.service:auto-service'
implementation 'com.google.auto.service:auto-service'
implementation 'com.google.auto.service:auto-service-annotations'

implementation "${besuArtifactGroup}:besu-datatypes"
implementation "${besuArtifactGroup}:evm"
Expand All @@ -48,28 +48,19 @@ dependencies {
implementation "${besuArtifactGroup}.internal:core"
implementation "${besuArtifactGroup}.internal:rlp"

implementation 'info.picocli:picocli'

implementation 'io.vertx:vertx-core'
implementation 'io.vertx:vertx-web'
implementation 'com.google.auto.service:auto-service'

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

implementation 'io.tmio:tuweni-bytes'
implementation 'io.tmio:tuweni-units'
implementation 'io.tmio:tuweni-toml'
implementation 'org.bouncycastle:bcprov-jdk18on'
implementation 'org.hibernate.validator:hibernate-validator'

implementation 'io.vertx:vertx-web'

testImplementation project(path: ':testing')
testImplementation 'org.junit.platform:junit-platform-launcher'
}

configurations {
installedJars {
transitive = false
}
testImplementation 'org.junit.platform:junit-platform-launcher'
}

apply from: rootProject.file("gradle/dist.gradle")
Expand Down
12 changes: 9 additions & 3 deletions gradle/dependency-management.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,16 @@ repositories {
mavenLocal()
}

configurations.all {
resolutionStrategy {
cacheChangingModulesFor 0, 'seconds'
configurations {
pluginImplementation
resolvable('pluginClasspath') {
extendsFrom(pluginImplementation)
}
}

sourceSets.main.compileClasspath += configurations.pluginImplementation
sourceSets.main.runtimeClasspath += configurations.pluginImplementation

apply plugin: 'io.spring.dependency-management'

dependencyManagement {
Expand All @@ -54,6 +58,8 @@ dependencyManagement {
entry 'logback-classic'
}

dependency 'com.google.code.gson:gson:2.11.0'

dependency 'com.slack.api:slack-api-client:1.32.1'
}
}
49 changes: 49 additions & 0 deletions gradle/dist.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
*
* SPDX-License-Identifier: Apache-2.0
*/
import de.undercouch.gradle.tasks.download.Download

tasks.register('sourcesJar', Jar) {
dependsOn classes
Expand All @@ -27,7 +28,43 @@ tasks.register('javadocJar', Jar) {

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

def lineaBesuDistTar = new File(new File(buildDir, "tmp"), rootProject.besuFilename)
tasks.register('downloadLineaBesu', Download) {
src rootProject.besuUrl
dest lineaBesuDistTar
onlyIfModified true
}

tasks.register('copyLocalLineaBesu', Copy) {
onlyIf {
downloadLineaBesu.state.failure
}
def localLineaBesuDir =
project.hasProperty('useLocalLineaBesuDir')
? file("${findProperty('useLocalLineaBesuDir')}".replaceFirst('^~', System.getProperty('user.home')))
: new File(projectDir, "../../linea-besu")

def localLineaBesuFile = new File("${localLineaBesuDir.absoluteFile}/build/distributions/${rootProject.besuFilename}")
doFirst {
if (!file(localLineaBesuFile).exists()) {
throw new GradleException("Could not download Linea Besu distribution from: " + rootProject.besuUrl +
", and could not find it locally at ${localLineaBesuFile} either")
}
}
from localLineaBesuFile
into lineaBesuDistTar.parentFile
}

task unTarLineaBesu(type: Copy) {
dependsOn downloadLineaBesu
dependsOn copyLocalLineaBesu

from tarTree(lineaBesuDistTar)
into lineaBesuDistTar.parentFile
}

jar {
dependsOn unTarLineaBesu
archiveBaseName = distributionIdentifier

manifest {
Expand All @@ -38,6 +75,18 @@ jar {
'Implementation-Version': calculateVersion()
)
}

def lineaBesuLibDir = new File(lineaBesuDistTar.parentFile, rootProject.besuIdentifier + '/lib')

from {
configurations.pluginClasspath.filter(
{
def lineaBesuLib = new File(lineaBesuLibDir, it.name)
!lineaBesuLib.exists()
})
.collect {it.isDirectory() ? it : zipTree(it) }
}
duplicatesStrategy('exclude')
}

// Takes the version, and if -SNAPSHOT is part of it replaces SNAPSHOT
Expand Down
15 changes: 5 additions & 10 deletions testing/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,10 @@ apply from: rootProject.file("gradle/lint.gradle")

dependencies {
implementation project(path: ':arithmetization')

implementation "${besuArtifactGroup}:besu-datatypes"
implementation "${besuArtifactGroup}:evm"
implementation "${besuArtifactGroup}:plugin-api"
implementation "${besuArtifactGroup}.internal:clique"
implementation "${besuArtifactGroup}.internal:common"
implementation "${besuArtifactGroup}.internal:config"
Expand All @@ -28,19 +30,12 @@ dependencies {
implementation "${besuArtifactGroup}.internal:services"
implementation "${besuArtifactGroup}.internal:testutil"
implementation "${besuArtifactGroup}.internal:algorithms"
implementation "${besuArtifactGroup}:plugin-api"

implementation "com.google.guava:guava"
implementation 'com.google.code.gson:gson'
implementation 'com.google.guava:guava'

implementation 'org.junit.platform:junit-platform-launcher'
implementation 'org.junit.jupiter:junit-jupiter-api'
runtimeOnly 'org.junit.jupiter:junit-jupiter-engine'
implementation 'org.junit.jupiter:junit-jupiter-params'
runtimeOnly 'org.junit.vintage:junit-vintage-engine'

implementation 'org.mockito:mockito-core'
implementation 'org.mockito:mockito-junit-jupiter'
implementation 'org.assertj:assertj-core'
implementation 'org.junit.jupiter:junit-jupiter-api'
}

node {
Expand Down

0 comments on commit b03d935

Please sign in to comment.