Skip to content

Commit 1508b5c

Browse files
authored
[build] update use of gradle deprecated features (#8295)
* gradle 8.11 Signed-off-by: Sally MacFarlane <macfarla.github@gmail.com> --------- Signed-off-by: Sally MacFarlane <macfarla.github@gmail.com>
1 parent 5bf7ae1 commit 1508b5c

File tree

3 files changed

+59
-52
lines changed

3 files changed

+59
-52
lines changed

build.gradle

Lines changed: 45 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -145,8 +145,11 @@ configure(allprojects - project(':platform')) {
145145
tasks.build {
146146
dependsOn 'javadoc'
147147
}
148-
sourceCompatibility = 21
149-
targetCompatibility = 21
148+
149+
java {
150+
sourceCompatibility = 21
151+
targetCompatibility = 21
152+
}
150153

151154
repositories {
152155
maven {
@@ -643,32 +646,34 @@ subprojects {
643646
jar { enabled = false }
644647

645648
apply plugin: 'application'
646-
mainClassName = 'org.hyperledger.besu.Besu'
647-
applicationDefaultJvmArgs = [
648-
'-Dvertx.disableFileCPResolving=true',
649-
// BESU_HOME is replaced by a doFirst block in the run task.
650-
'-Dbesu.home=BESU_HOME',
651-
// We shutdown log4j ourselves, as otherwise this shutdown hook runs before our own and whatever
652-
// happens during shutdown is not logged.
653-
'-Dlog4j.shutdownHookEnabled=false',
654-
// Disable JNI lookups in log4j messages to improve security
655-
'-Dlog4j2.formatMsgNoLookups=true',
656-
// Redirect java.util.logging loggers to use log4j2.
657-
'-Djava.util.logging.manager=org.apache.logging.log4j.jul.LogManager',
658-
// Suppress Java JPMS warnings. Document the reason for each suppression.
659-
// Bouncy Castle needs access to sun.security.provider, which is not open by default.
660-
'--add-opens',
661-
'java.base/sun.security.provider=ALL-UNNAMED',
662-
// Jackson likes to access java.util.OptionalLong's constructor
663-
'--add-opens',
664-
'java.base/java.util=ALL-UNNAMED',
665-
// suppress netty specific module warnings in debug
666-
"-Dio.netty.tryReflectionSetAccessible=true",
667-
"--add-exports",
668-
"java.base/jdk.internal.misc=ALL-UNNAMED",
669-
"--add-opens",
670-
"java.base/java.nio=ALL-UNNAMED"
671-
]
649+
application {
650+
mainClass = 'org.hyperledger.besu.Besu'
651+
applicationDefaultJvmArgs = [
652+
'-Dvertx.disableFileCPResolving=true',
653+
// BESU_HOME is replaced by a doFirst block in the run task.
654+
'-Dbesu.home=BESU_HOME',
655+
// We shutdown log4j ourselves, as otherwise this shutdown hook runs before our own and whatever
656+
// happens during shutdown is not logged.
657+
'-Dlog4j.shutdownHookEnabled=false',
658+
// Disable JNI lookups in log4j messages to improve security
659+
'-Dlog4j2.formatMsgNoLookups=true',
660+
// Redirect java.util.logging loggers to use log4j2.
661+
'-Djava.util.logging.manager=org.apache.logging.log4j.jul.LogManager',
662+
// Suppress Java JPMS warnings. Document the reason for each suppression.
663+
// Bouncy Castle needs access to sun.security.provider, which is not open by default.
664+
'--add-opens',
665+
'java.base/sun.security.provider=ALL-UNNAMED',
666+
// Jackson likes to access java.util.OptionalLong's constructor
667+
'--add-opens',
668+
'java.base/java.util=ALL-UNNAMED',
669+
// suppress netty specific module warnings in debug
670+
"-Dio.netty.tryReflectionSetAccessible=true",
671+
"--add-exports",
672+
"java.base/jdk.internal.misc=ALL-UNNAMED",
673+
"--add-opens",
674+
"java.base/java.nio=ALL-UNNAMED"
675+
]
676+
}
672677

673678
run {
674679
args project.hasProperty("besu.run.args") ? project.property("besu.run.args").toString().split("\\s+") : []
@@ -696,7 +701,7 @@ def tweakStartScript(createScriptTask) {
696701
}
697702

698703
startScripts {
699-
defaultJvmOpts = applicationDefaultJvmArgs + [
704+
defaultJvmOpts = application.applicationDefaultJvmArgs + [
700705
"-XX:G1ConcRefinementThreads=2",
701706
"-XX:G1HeapWastePercent=15",
702707
"-XX:MaxGCPauseMillis=100",
@@ -713,7 +718,6 @@ task untunedStartScripts(type: CreateStartScripts) {
713718
classpath = startScripts.classpath
714719
outputDir = startScripts.outputDir
715720
applicationName = 'besu-untuned'
716-
defaultJvmOpts = applicationDefaultJvmArgs
717721
unixStartScriptGenerator.template = resources.text.fromFile("${projectDir}/besu/src/main/scripts/unixStartScript.txt")
718722
windowsStartScriptGenerator.template = resources.text.fromFile("${projectDir}/besu/src/main/scripts/windowsStartScript.txt")
719723
doLast { tweakStartScript(untunedStartScripts) }
@@ -822,7 +826,7 @@ task distDocker {
822826
from file("${projectDir}/docker/Dockerfile")
823827
into(dockerBuildDir)
824828
}
825-
exec {
829+
providers.exec {
826830
def image = "${dockerImageName}:${dockerBuildVersion}"
827831
def dockerPlatform = ""
828832
if (project.hasProperty('docker-platform')){
@@ -846,7 +850,7 @@ task testDocker {
846850
}
847851

848852
doLast {
849-
exec {
853+
providers.exec {
850854
def image = project.hasProperty('release.releaseVersion') ? "${dockerImageName}:" + project.property('release.releaseVersion') : "${dockerImageName}:${project.version}"
851855
workingDir "${projectDir}/docker"
852856
executable shell
@@ -870,7 +874,7 @@ task dockerUpload {
870874
}
871875

872876
doLast {
873-
exec {
877+
providers.exec {
874878
def archVariantImage = "${image}-${architecture}"
875879
def cmd = "docker tag '${image}' '${archVariantImage}' && docker push '${archVariantImage}'"
876880
println "Executing '${cmd}'"
@@ -887,28 +891,28 @@ task dockerUploadRelease {
887891
doLast {
888892
for (def architecture in archs) {
889893

890-
exec {
894+
providers.exec {
891895
def cmd = "docker pull '${image}-${architecture}' && docker tag '${image}-${architecture}' '${dockerImageName}:latest-${architecture}'"
892896
println "Executing '${cmd}'"
893897
executable shell
894898
args "-c", cmd
895899
}
896-
exec {
900+
providers.exec {
897901
def cmd = "docker push '${dockerImageName}:latest-${architecture}'"
898902
println "Executing '${cmd}'"
899903
executable shell
900904
args "-c", cmd
901905
}
902906

903907

904-
exec {
908+
providers.exec {
905909
def archImage = "${image}-${architecture}"
906910
def cmd = "docker pull '${archImage}' && docker tag ${archImage} '${dockerImageName}:latest-${architecture}'"
907911
println "Executing '${cmd}'"
908912
executable shell
909913
args "-c", cmd
910914
}
911-
exec {
915+
providers.exec {
912916
def cmd = "docker push '${dockerImageName}:latest-${architecture}'"
913917
println "Executing '${cmd}'"
914918
executable shell
@@ -924,15 +928,15 @@ task manifestDocker {
924928
"arm64",
925929
"amd64"] //TODO: this assumes dockerUpload task has already been run on 2 different archs!
926930
doLast {
927-
exec {
931+
providers.exec {
928932
def targets = ""
929933
archs.forEach { arch -> targets += "'${image}-${arch}' " }
930934
def cmd = "docker manifest create '${image}' ${targets}"
931935
println "Executing '${cmd}'"
932936
executable shell
933937
args "-c", cmd
934938
}
935-
exec {
939+
providers.exec {
936940
def cmd = "docker manifest push '${image}'"
937941
println "Executing '${cmd}'"
938942
executable shell
@@ -947,15 +951,15 @@ task manifestDockerRelease {
947951

948952
doLast {
949953

950-
exec {
954+
providers.exec {
951955
def targets = ""
952956
archs.forEach { arch -> targets += "'${baseTag}-${arch}' " }
953957
def cmd = "docker manifest create '${baseTag}' ${targets} --amend"
954958
println "Executing '${cmd}'"
955959
executable shell
956960
args "-c", cmd
957961
}
958-
exec {
962+
providers.exec {
959963
def cmd = "docker manifest push '${baseTag}'"
960964
println "Executing '${cmd}'"
961965
executable shell

ethereum/evmtool/build.gradle

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,9 @@ dependencies {
6969
nativeImageClasspath 'org.slf4j:slf4j-nop'
7070
}
7171

72-
mainClassName = 'org.hyperledger.besu.evmtool.EvmTool'
72+
application {
73+
mainClass = 'org.hyperledger.besu.evmtool.EvmTool'
74+
}
7375

7476

7577
// rename the top level dir from besu-<version> to besu and this makes it really

ethereum/referencetests/build.gradle

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,6 @@
1313
* SPDX-License-Identifier: Apache-2.0
1414
*/
1515

16-
configurations {
17-
referenceTestAnnotationProcessor.extendsFrom testAnnotationProcessor
18-
// we need this because referenceTestImplementation defaults to 'canBeResolved=false'.
19-
tarConfig.extendsFrom referenceTestImplementation
20-
tarConfig {
21-
canBeResolved = true
22-
canBeConsumed = false
23-
}
24-
}
2516

2617
def blockchainReferenceTests = tasks.register("blockchainReferenceTests") {
2718
final referenceTestsPath = 'src/reference-test/external-resources/BlockchainTests'
@@ -238,7 +229,7 @@ tasks.register('validateReferenceTestSubmodule') {
238229
def expectedHash = '9201075490807f58811078e9bb5ec895b4ac01a5'
239230
def submodulePath = java.nio.file.Path.of("${rootProject.projectDir}", "ethereum/referencetests/src/reference-test/external-resources").toAbsolutePath()
240231
try {
241-
exec {
232+
providers.exec {
242233
commandLine 'git', 'submodule', 'status', submodulePath
243234
standardOutput = result
244235
errorOutput = result
@@ -304,3 +295,13 @@ def generateTestFiles(
304295
testFile.newWriter().withWriter { w -> w << testFileContents }
305296
}
306297
}
298+
299+
configurations {
300+
referenceTestAnnotationProcessor.extendsFrom testAnnotationProcessor
301+
// we need this because referenceTestImplementation defaults to 'canBeResolved=false'.
302+
tarConfig.extendsFrom referenceTestImplementation
303+
tarConfig {
304+
canBeResolved = true
305+
canBeConsumed = false
306+
}
307+
}

0 commit comments

Comments
 (0)