diff --git a/actuator/build.gradle b/actuator/build.gradle index 9b200064fb0..1143dc83618 100644 --- a/actuator/build.gradle +++ b/actuator/build.gradle @@ -1,9 +1,9 @@ description = "actuator – a series of transactions for blockchain." dependencies { - compile project(":chainbase") - compile project(":protocol") - compile project(":crypto") + api project(":chainbase") + api project(":protocol") + api project(":crypto") } test { diff --git a/build.gradle b/build.gradle index a56be97afa1..0bdbfe6199a 100644 --- a/build.gradle +++ b/build.gradle @@ -1,12 +1,10 @@ allprojects { version = "1.0.0" - apply plugin: "java" + apply plugin: "java-library" } subprojects { - apply plugin: "java" apply plugin: "jacoco" - apply plugin: "maven" apply plugin: "maven-publish" sourceCompatibility = JavaVersion.VERSION_1_8 @@ -36,18 +34,18 @@ subprojects { } dependencies { - compile group: 'org.slf4j', name: 'slf4j-api', version: '1.7.25' - compile group: 'org.slf4j', name: 'jcl-over-slf4j', version: '1.7.25' - compile group: 'ch.qos.logback', name: 'logback-classic', version: '1.2.9' - compile group: 'com.google.guava', name: 'guava', version: '30.1-jre' - compile "com.google.code.findbugs:jsr305:3.0.0" - compile group: 'org.springframework', name: 'spring-context', version: '5.3.18' - compile group: 'org.springframework', name: 'spring-tx', version: '5.3.18' - compile "org.apache.commons:commons-lang3:3.4" - compile group: 'org.apache.commons', name: 'commons-math', version: '2.2' - compile "org.apache.commons:commons-collections4:4.1" - compile group: 'joda-time', name: 'joda-time', version: '2.3' - compile group: 'org.bouncycastle', name: 'bcprov-jdk15on', version: '1.69' + implementation group: 'org.slf4j', name: 'slf4j-api', version: '1.7.25' + implementation group: 'org.slf4j', name: 'jcl-over-slf4j', version: '1.7.25' + implementation group: 'ch.qos.logback', name: 'logback-classic', version: '1.2.9' + implementation group: 'com.google.guava', name: 'guava', version: '30.1-jre' + implementation "com.google.code.findbugs:jsr305:3.0.0" + implementation group: 'org.springframework', name: 'spring-context', version: '5.3.18' + implementation group: 'org.springframework', name: 'spring-tx', version: '5.3.18' + implementation "org.apache.commons:commons-lang3:3.4" + implementation group: 'org.apache.commons', name: 'commons-math', version: '2.2' + implementation "org.apache.commons:commons-collections4:4.1" + implementation group: 'joda-time', name: 'joda-time', version: '2.3' + implementation group: 'org.bouncycastle', name: 'bcprov-jdk15on', version: '1.69' compileOnly 'org.projectlombok:lombok:1.18.12' annotationProcessor 'org.projectlombok:lombok:1.18.12' @@ -61,12 +59,14 @@ subprojects { task sourcesJar(type: Jar, dependsOn: classes) { classifier = "sources" from sourceSets.main.allSource + duplicatesStrategy = DuplicatesStrategy.INCLUDE // allow duplicates } tasks.withType(AbstractArchiveTask) { preserveFileTimestamps = false reproducibleFileOrder = true + duplicatesStrategy = DuplicatesStrategy.INCLUDE // allow duplicates } configurations.all { diff --git a/chainbase/build.gradle b/chainbase/build.gradle index 408fe56ba42..737ea77d1a4 100644 --- a/chainbase/build.gradle +++ b/chainbase/build.gradle @@ -7,12 +7,12 @@ def jansiVersion = "1.16" // -------------------------------------- dependencies { - compile project(":protocol") - compile project(":common") - compile project(":crypto") - compile "org.fusesource.jansi:jansi:$jansiVersion" - compile 'io.github.tronprotocol:zksnark-java-sdk:1.0.0' - compile 'org.reflections:reflections:0.9.11' + api project(":protocol") + api project(":common") + api project(":crypto") + api "org.fusesource.jansi:jansi:$jansiVersion" + api 'io.github.tronprotocol:zksnark-java-sdk:1.0.0' + api 'org.reflections:reflections:0.9.11' } @@ -46,6 +46,7 @@ jacoco { } jacocoTestReport { + dependsOn(processResources) // explicit_dependency reports { xml.enabled = true html.enabled = true diff --git a/common/build.gradle b/common/build.gradle index 6c1545e5d13..f84bf529f81 100644 --- a/common/build.gradle +++ b/common/build.gradle @@ -30,30 +30,38 @@ if (isWindows()) { } dependencies { - compile group: 'com.fasterxml.jackson.core', name: 'jackson-databind', version: '2.13.4.1' - compile "com.cedarsoftware:java-util:1.8.0" - compile group: 'org.apache.httpcomponents', name: 'httpasyncclient', version: '4.1.1' - compile group: 'commons-codec', name: 'commons-codec', version: '1.11' - compile group: 'com.beust', name: 'jcommander', version: '1.72' - compile group: 'com.typesafe', name: 'config', version: '1.3.2' - compile group: leveldbGroup, name: leveldbName, version: leveldbVersion - compile group: 'org.rocksdb', name: 'rocksdbjni', version: '5.15.10' + api group: 'com.fasterxml.jackson.core', name: 'jackson-databind', version: '2.13.4.2' // https://github.com/FasterXML/jackson-databind/issues/3627 + api "com.cedarsoftware:java-util:1.8.0" + api group: 'org.apache.httpcomponents', name: 'httpasyncclient', version: '4.1.1' + api group: 'commons-codec', name: 'commons-codec', version: '1.11' + api group: 'com.beust', name: 'jcommander', version: '1.72' + api group: 'com.typesafe', name: 'config', version: '1.3.2' + api group: leveldbGroup, name: leveldbName, version: leveldbVersion + api group: 'org.rocksdb', name: 'rocksdbjni', version: '5.15.10' // https://mvnrepository.com/artifact/org.quartz-scheduler/quartz - compile group: 'org.quartz-scheduler', name: 'quartz', version: '2.3.2' - compile group: 'io.prometheus', name: 'simpleclient', version: '0.15.0' - compile group: 'io.prometheus', name: 'simpleclient_httpserver', version: '0.15.0' - compile group: 'io.prometheus', name: 'simpleclient_hotspot', version: '0.15.0' - compile 'org.aspectj:aspectjrt:1.8.13' - compile 'org.aspectj:aspectjweaver:1.8.13' - compile 'org.aspectj:aspectjtools:1.8.13' - compile group: 'io.github.tronprotocol', name: 'libp2p', version: '2.2.1',{ + api group: 'org.quartz-scheduler', name: 'quartz', version: '2.3.2' + api group: 'io.prometheus', name: 'simpleclient', version: '0.15.0' + api group: 'io.prometheus', name: 'simpleclient_httpserver', version: '0.15.0' + api group: 'io.prometheus', name: 'simpleclient_hotspot', version: '0.15.0' + api 'org.aspectj:aspectjrt:1.8.13' + api 'org.aspectj:aspectjweaver:1.8.13' + api 'org.aspectj:aspectjtools:1.8.13' + api group: 'io.github.tronprotocol', name: 'libp2p', version: '2.2.1',{ exclude group: 'io.grpc', module: 'grpc-context' exclude group: 'io.grpc', module: 'grpc-core' exclude group: 'io.grpc', module: 'grpc-netty' exclude group: 'com.google.protobuf', module: 'protobuf-java' exclude group: 'com.google.protobuf', module: 'protobuf-java-util' + // https://github.com/dom4j/dom4j/pull/116 + // https://github.com/gradle/gradle/issues/13656 + // https://github.com/dom4j/dom4j/issues/99 + exclude group: 'jaxen', module: 'jaxen' + exclude group: 'javax.xml.stream', module: 'stax-api' + exclude group: 'net.java.dev.msv', module: 'xsdlib' + exclude group: 'pull-parser', module: 'pull-parser' + exclude group: 'xpp3', module: 'xpp3' } - compile project(":protocol") + api project(":protocol") } jacocoTestReport { diff --git a/consensus/build.gradle b/consensus/build.gradle index 4ecd7180d13..04cc24be5fd 100644 --- a/consensus/build.gradle +++ b/consensus/build.gradle @@ -1,8 +1,8 @@ description = "consensus – a distributed consensus arithmetic for blockchain." dependencies { - compile project(":chainbase") - compile project(":protocol") + api project(":chainbase") + api project(":protocol") } test { diff --git a/crypto/build.gradle b/crypto/build.gradle index b551471bf49..82814af49e6 100644 --- a/crypto/build.gradle +++ b/crypto/build.gradle @@ -11,7 +11,7 @@ repositories { } dependencies { - compile project(":common") + api project(":common") } jacocoTestReport { diff --git a/example/actuator-example/build.gradle b/example/actuator-example/build.gradle index d0130e11375..e17c75895a1 100644 --- a/example/actuator-example/build.gradle +++ b/example/actuator-example/build.gradle @@ -1,6 +1,6 @@ description = "actuator-example – a example of actuator." dependencies { - compile project(":actuator") + api project(":actuator") } diff --git a/framework/build.gradle b/framework/build.gradle index 8c4fbfc4583..24e3a6c2a56 100644 --- a/framework/build.gradle +++ b/framework/build.gradle @@ -38,38 +38,38 @@ task version(type: Exec) { dependencies { //local libraries - compile fileTree(dir: 'libs', include: '*.jar') + implementation fileTree(dir: 'libs', include: '*.jar') // end local libraries - testCompile group: 'org.hamcrest', name: 'hamcrest-junit', version: '1.0.0.1' - testCompile group: 'com.github.stefanbirkner', name: 'system-rules', version: '1.16.0' + testImplementation group: 'org.hamcrest', name: 'hamcrest-junit', version: '1.0.0.1' + testImplementation group: 'com.github.stefanbirkner', name: 'system-rules', version: '1.16.0' - compile group: 'com.google.inject', name: 'guice', version: '4.1.0' - compile group: 'io.dropwizard.metrics', name: 'metrics-core', version: '3.1.2' - compile group: 'com.github.davidb', name: 'metrics-influxdb', version: '0.8.2' - compile group: 'com.carrotsearch', name: 'java-sizeof', version: '0.0.5' + implementation group: 'com.google.inject', name: 'guice', version: '4.1.0' + implementation group: 'io.dropwizard.metrics', name: 'metrics-core', version: '3.1.2' + implementation group: 'com.github.davidb', name: 'metrics-influxdb', version: '0.8.2' + implementation group: 'com.carrotsearch', name: 'java-sizeof', version: '0.0.5' // http - compile 'org.eclipse.jetty:jetty-server:9.4.53.v20231009' - compile 'org.eclipse.jetty:jetty-servlet:9.4.53.v20231009' - compile 'com.alibaba:fastjson:1.2.83' + implementation 'org.eclipse.jetty:jetty-server:9.4.53.v20231009' + implementation 'org.eclipse.jetty:jetty-servlet:9.4.53.v20231009' + implementation 'com.alibaba:fastjson:1.2.83' // end http // https://mvnrepository.com/artifact/com.github.briandilley.jsonrpc4j/jsonrpc4j - compile group: 'com.github.briandilley.jsonrpc4j', name: 'jsonrpc4j', version: '1.6' + implementation group: 'com.github.briandilley.jsonrpc4j', name: 'jsonrpc4j', version: '1.6' // https://mvnrepository.com/artifact/javax.portlet/portlet-api compileOnly group: 'javax.portlet', name: 'portlet-api', version: '3.0.1' - compile "io.vavr:vavr:0.9.2" - compile group: 'org.pf4j', name: 'pf4j', version: '2.5.0' + implementation "io.vavr:vavr:0.9.2" + implementation group: 'org.pf4j', name: 'pf4j', version: '2.5.0' testImplementation group: 'org.springframework', name: 'spring-test', version: '5.2.0.RELEASE' testImplementation group: 'org.springframework', name: 'spring-web', version: '5.2.0.RELEASE' - compile group: 'org.zeromq', name: 'jeromq', version: '0.5.3' - compile project(":chainbase") - compile project(":protocol") - compile project(":actuator") - compile project(":consensus") + implementation group: 'org.zeromq', name: 'jeromq', version: '0.5.3' + api project(":chainbase") + api project(":protocol") + api project(":actuator") + api project(":consensus") } check.dependsOn 'lint' @@ -152,9 +152,11 @@ def binaryRelease(taskName, jarName, mainClass) { from(sourceSets.main.output) { include "/**" } - + // explicit_dependency + dependsOn (project(':actuator').jar, project(':consensus').jar, project(':chainbase').jar, + project(':crypto').jar, project(':common').jar, project(':protocol').jar) from { - configurations.compile.collect { + configurations.runtimeClasspath.collect { it.isDirectory() ? it : zipTree(it) } } @@ -179,7 +181,7 @@ def createScript(project, mainClass, name) { outputDir = new File(project.buildDir, 'scripts') mainClassName = mainClass applicationName = name - classpath = project.tasks[JavaPlugin.JAR_TASK_NAME].outputs.files + project.configurations.runtime + classpath = project.tasks[JavaPlugin.JAR_TASK_NAME].outputs.files + project.configurations.runtimeClasspath // defaultJvmOpts = ['-XX:+UseConcMarkSweepGC', // '-XX:+PrintGCDetails', // '-Xloggc:./gc.log', diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar index 28861d273a5..5c2d1cf016b 100644 Binary files a/gradle/wrapper/gradle-wrapper.jar and b/gradle/wrapper/gradle-wrapper.jar differ diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 1b00285c540..3994438e229 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,5 @@ -#Thu Aug 01 15:17:43 CST 2019 distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-7.6.4-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.4-all.zip diff --git a/gradlew b/gradlew index cccdd3d517f..83f2acfdc31 100755 --- a/gradlew +++ b/gradlew @@ -1,5 +1,21 @@ #!/usr/bin/env sh +# +# Copyright 2015 the original author or authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + ############################################################################## ## ## Gradle start up script for UN*X @@ -28,7 +44,7 @@ APP_NAME="Gradle" APP_BASE_NAME=`basename "$0"` # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -DEFAULT_JVM_OPTS="" +DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' # Use the maximum available, or set MAX_FD != -1 to use that value. MAX_FD="maximum" @@ -109,8 +125,8 @@ if $darwin; then GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" fi -# For Cygwin, switch paths to Windows format before running java -if $cygwin ; then +# For Cygwin or MSYS, switch paths to Windows format before running java +if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then APP_HOME=`cygpath --path --mixed "$APP_HOME"` CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` JAVACMD=`cygpath --unix "$JAVACMD"` diff --git a/gradlew.bat b/gradlew.bat index e95643d6a2c..24467a141f7 100644 --- a/gradlew.bat +++ b/gradlew.bat @@ -1,3 +1,19 @@ +@rem +@rem Copyright 2015 the original author or authors. +@rem +@rem Licensed under the Apache License, Version 2.0 (the "License"); +@rem you may not use this file except in compliance with the License. +@rem You may obtain a copy of the License at +@rem +@rem https://www.apache.org/licenses/LICENSE-2.0 +@rem +@rem Unless required by applicable law or agreed to in writing, software +@rem distributed under the License is distributed on an "AS IS" BASIS, +@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +@rem See the License for the specific language governing permissions and +@rem limitations under the License. +@rem + @if "%DEBUG%" == "" @echo off @rem ########################################################################## @rem @@ -14,7 +30,7 @@ set APP_BASE_NAME=%~n0 set APP_HOME=%DIRNAME% @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -set DEFAULT_JVM_OPTS= +set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" @rem Find java.exe if defined JAVA_HOME goto findJavaFromJavaHome diff --git a/plugins/build.gradle b/plugins/build.gradle index 7f226d7099c..741254912de 100644 --- a/plugins/build.gradle +++ b/plugins/build.gradle @@ -25,17 +25,17 @@ configurations.getByName('checkstyleConfig') { dependencies { //local libraries - compile fileTree(dir: 'libs', include: '*.jar') - testCompile project(":framework") - testCompile project(":framework").sourceSets.test.output - compile group: 'info.picocli', name: 'picocli', version: '4.6.3' - compile group: 'com.typesafe', name: 'config', version: '1.3.2' - compile group: 'me.tongfei', name: 'progressbar', version: '0.9.3' - compile group: 'org.bouncycastle', name: 'bcprov-jdk15on', version: '1.69' - compile group: 'org.rocksdb', name: 'rocksdbjni', version: '5.15.10' - compile 'io.github.tronprotocol:leveldbjni-all:1.18.2' - compile 'io.github.tronprotocol:leveldb:1.18.2' - compile project(":protocol") + implementation fileTree(dir: 'libs', include: '*.jar') + testImplementation project(":framework") + testImplementation project(":framework").sourceSets.test.output + implementation group: 'info.picocli', name: 'picocli', version: '4.6.3' + implementation group: 'com.typesafe', name: 'config', version: '1.3.2' + implementation group: 'me.tongfei', name: 'progressbar', version: '0.9.3' + implementation group: 'org.bouncycastle', name: 'bcprov-jdk15on', version: '1.69' + implementation group: 'org.rocksdb', name: 'rocksdbjni', version: '5.15.10' + implementation 'io.github.tronprotocol:leveldbjni-all:1.18.2' + implementation 'io.github.tronprotocol:leveldb:1.18.2' + implementation project(":protocol") } check.dependsOn 'lint' @@ -98,8 +98,10 @@ def binaryRelease(taskName, jarName, mainClass) { include "/**" } + dependsOn project(':protocol').jar // explicit_dependency + from { - configurations.compile.collect { + configurations.runtimeClasspath.collect { // https://docs.gradle.org/current/userguide/upgrading_version_6.html#changes_6.3 it.isDirectory() ? it : zipTree(it) } } @@ -120,7 +122,7 @@ def createScript(project, mainClass, name) { outputDir = new File(project.buildDir, 'scripts') mainClassName = mainClass applicationName = name - classpath = project.tasks[JavaPlugin.JAR_TASK_NAME].outputs.files + project.configurations.runtime + classpath = project.tasks[JavaPlugin.JAR_TASK_NAME].outputs.files + project.configurations.runtimeClasspath } project.tasks[name].dependsOn(project.jar) project.applicationDistribution.with { diff --git a/protocol/build.gradle b/protocol/build.gradle index 922d6d19859..615958e1b5f 100644 --- a/protocol/build.gradle +++ b/protocol/build.gradle @@ -4,20 +4,20 @@ def protobufVersion = '3.21.12' def grpcVersion = '1.52.1' dependencies { - compile group: 'com.google.protobuf', name: 'protobuf-java', version: protobufVersion - compile group: 'com.google.protobuf', name: 'protobuf-java-util', version: protobufVersion - compile group: 'net.jcip', name: 'jcip-annotations', version: '1.0' + api group: 'com.google.protobuf', name: 'protobuf-java', version: protobufVersion + api group: 'com.google.protobuf', name: 'protobuf-java-util', version: protobufVersion + api group: 'net.jcip', name: 'jcip-annotations', version: '1.0' // checkstyleConfig "com.puppycrawl.tools:checkstyle:${versions.checkstyle}" // google grpc - compile group: 'io.grpc', name: 'grpc-netty', version: grpcVersion - compile group: 'io.grpc', name: 'grpc-protobuf', version: grpcVersion - compile group: 'io.grpc', name: 'grpc-stub', version: grpcVersion - compile group: 'io.grpc', name: 'grpc-services', version: grpcVersion + api group: 'io.grpc', name: 'grpc-netty', version: grpcVersion + api group: 'io.grpc', name: 'grpc-protobuf', version: grpcVersion + api group: 'io.grpc', name: 'grpc-stub', version: grpcVersion + api group: 'io.grpc', name: 'grpc-services', version: grpcVersion // end google grpc - compile group: 'com.google.api.grpc', name: 'proto-google-common-protos', version: '2.15.0' + api group: 'com.google.api.grpc', name: 'proto-google-common-protos', version: '2.15.0' } tasks.matching { it instanceof Test }.all { @@ -66,3 +66,4 @@ clean.doFirst { delete "src/main/java" } +processResources.dependsOn(generateProto) // explicit_dependency diff --git a/protocol/gradle/wrapper/gradle-wrapper.jar b/protocol/gradle/wrapper/gradle-wrapper.jar deleted file mode 100644 index 28861d273a5..00000000000 Binary files a/protocol/gradle/wrapper/gradle-wrapper.jar and /dev/null differ diff --git a/protocol/gradle/wrapper/gradle-wrapper.properties b/protocol/gradle/wrapper/gradle-wrapper.properties deleted file mode 100644 index 1b0ff046d00..00000000000 --- a/protocol/gradle/wrapper/gradle-wrapper.properties +++ /dev/null @@ -1,6 +0,0 @@ -#Thu Aug 01 15:17:43 CST 2019 -distributionBase=GRADLE_USER_HOME -distributionPath=wrapper/dists -zipStoreBase=GRADLE_USER_HOME -zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-4.10-all.zip