Skip to content

Commit 9732012

Browse files
josh-richardsoniikirilov
authored andcommitted
Makes everything work with Java 11/12, upgrades to Gradle 5.0 (LFDT-web3j#1086)
1 parent 92d8400 commit 9732012

8 files changed

+136
-105
lines changed

build.gradle

+13-13
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ buildscript {
1010
ext.picocliVersion = '3.0.0'
1111

1212
// test dependencies
13-
ext.equalsverifierVersion = '2.1.7'
13+
ext.equalsverifierVersion = '3.1.10'
1414
ext.junitVersion = '4.11'
1515
ext.junitBenchmarkVersion = '0.7.2'
1616
ext.logbackVersion = '1.2.3'
@@ -93,7 +93,7 @@ allprojects {
9393

9494
javadoc { options.encoding = 'UTF-8' }
9595

96-
jacoco { toolVersion = '0.7.7.201606060606' // See http://www.eclemma.org/jacoco/.
96+
jacoco { toolVersion = '0.8.4' // See http://www.eclemma.org/jacoco/.
9797
}
9898

9999
jacocoTestReport {
@@ -299,10 +299,10 @@ configure(subprojects.findAll { it.name != 'integration-tests' }) {
299299

300300
task jacocoRootTestReport(type: org.gradle.testing.jacoco.tasks.JacocoReport) {
301301
dependsOn = subprojects.test
302-
additionalSourceDirs = files(subprojects.sourceSets.main.allSource.srcDirs)
303-
sourceDirectories = files(subprojects.sourceSets.main.allSource.srcDirs)
304-
classDirectories = files(subprojects.sourceSets.main.output)
305-
executionData = files(subprojects.jacocoTestReport.executionData)
302+
getSourceDirectories().from(subprojects.sourceSets.main.allSource.srcDirs)
303+
getAdditionalSourceDirs().from(subprojects.sourceSets.main.allSource.srcDirs)
304+
getClassDirectories().from(subprojects.sourceSets.main.output)
305+
getExecutionData().from(subprojects.jacocoTestReport.executionData)
306306
reports { xml.enabled = true }
307307

308308
onlyIf = { true }
@@ -312,14 +312,14 @@ configure(subprojects.findAll { it.name != 'integration-tests' }) {
312312
}
313313

314314
afterEvaluate {
315-
classDirectories = files(classDirectories.files.collect {
315+
getClassDirectories().from(files(classDirectories.files.collect {
316316
fileTree(dir: it,
317-
exclude: [
318-
'org/web3j/abi/datatypes/generated/**',
319-
'org/web3j/tuples/generated/**',
320-
'org/web3j/ens/contracts/generated/**'
321-
])
322-
})
317+
exclude: [
318+
'org/web3j/abi/datatypes/generated/**',
319+
'org/web3j/tuples/generated/**',
320+
'org/web3j/ens/contracts/generated/**'
321+
])
322+
}))
323323
}
324324
}
325325
}

codegen/src/test/java/org/web3j/codegen/ContractJsonParseTest.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ static Contract parseContractJson(String baseDir, String contractName, String in
5353

5454
@Before
5555
public void setUp() throws Exception {
56-
URL url = SolidityFunctionWrapperGeneratorTest.class.getClass().getResource("/truffle");
56+
URL url = SolidityFunctionWrapperGeneratorTest.class.getResource("/truffle");
5757
contractBaseDir = url.getPath();
5858
}
5959

codegen/src/test/java/org/web3j/codegen/SolidityFunctionWrapperGeneratorTest.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ public class SolidityFunctionWrapperGeneratorTest extends TempFileProvider {
4747
public void setUp() throws Exception {
4848
super.setUp();
4949

50-
URL url = SolidityFunctionWrapperGeneratorTest.class.getClass().getResource("/solidity");
50+
URL url = SolidityFunctionWrapperGeneratorTest.class.getResource("/solidity");
5151
solidityBaseDir = url.getPath();
5252
}
5353

codegen/src/test/java/org/web3j/codegen/TruffleJsonFunctionWrapperGeneratorTest.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ private static void verifyGeneratedCode(String sourceFile) throws IOException {
5858
public void setUp() throws Exception {
5959
super.setUp();
6060

61-
URL url = SolidityFunctionWrapperGeneratorTest.class.getClass().getResource("/truffle");
61+
URL url = SolidityFunctionWrapperGeneratorTest.class.getResource("/truffle");
6262
contractBaseDir = url.getPath();
6363
}
6464

gradle/wrapper/gradle-wrapper.jar

889 Bytes
Binary file not shown.
+1-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
1-
#Wed Oct 24 07:39:50 AEDT 2018
21
distributionBase=GRADLE_USER_HOME
32
distributionPath=wrapper/dists
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-5.0-bin.zip
44
zipStoreBase=GRADLE_USER_HOME
55
zipStorePath=wrapper/dists
6-
distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.2-bin.zip

gradlew

+19-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,21 @@
11
#!/usr/bin/env sh
22

3+
#
4+
# Copyright 2015 the original author or authors.
5+
#
6+
# Licensed under the Apache License, Version 2.0 (the "License");
7+
# you may not use this file except in compliance with the License.
8+
# You may obtain a copy of the License at
9+
#
10+
# https://www.apache.org/licenses/LICENSE-2.0
11+
#
12+
# Unless required by applicable law or agreed to in writing, software
13+
# distributed under the License is distributed on an "AS IS" BASIS,
14+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
# See the License for the specific language governing permissions and
16+
# limitations under the License.
17+
#
18+
319
##############################################################################
420
##
521
## Gradle start up script for UN*X
@@ -28,7 +44,7 @@ APP_NAME="Gradle"
2844
APP_BASE_NAME=`basename "$0"`
2945

3046
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
31-
DEFAULT_JVM_OPTS=""
47+
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
3248

3349
# Use the maximum available, or set MAX_FD != -1 to use that value.
3450
MAX_FD="maximum"
@@ -109,8 +125,8 @@ if $darwin; then
109125
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
110126
fi
111127

112-
# For Cygwin, switch paths to Windows format before running java
113-
if $cygwin ; then
128+
# For Cygwin or MSYS, switch paths to Windows format before running java
129+
if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
114130
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
115131
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
116132
JAVACMD=`cygpath --unix "$JAVACMD"`

gradlew.bat

+100-84
Original file line numberDiff line numberDiff line change
@@ -1,84 +1,100 @@
1-
@if "%DEBUG%" == "" @echo off
2-
@rem ##########################################################################
3-
@rem
4-
@rem Gradle startup script for Windows
5-
@rem
6-
@rem ##########################################################################
7-
8-
@rem Set local scope for the variables with windows NT shell
9-
if "%OS%"=="Windows_NT" setlocal
10-
11-
set DIRNAME=%~dp0
12-
if "%DIRNAME%" == "" set DIRNAME=.
13-
set APP_BASE_NAME=%~n0
14-
set APP_HOME=%DIRNAME%
15-
16-
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
17-
set DEFAULT_JVM_OPTS=
18-
19-
@rem Find java.exe
20-
if defined JAVA_HOME goto findJavaFromJavaHome
21-
22-
set JAVA_EXE=java.exe
23-
%JAVA_EXE% -version >NUL 2>&1
24-
if "%ERRORLEVEL%" == "0" goto init
25-
26-
echo.
27-
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
28-
echo.
29-
echo Please set the JAVA_HOME variable in your environment to match the
30-
echo location of your Java installation.
31-
32-
goto fail
33-
34-
:findJavaFromJavaHome
35-
set JAVA_HOME=%JAVA_HOME:"=%
36-
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
37-
38-
if exist "%JAVA_EXE%" goto init
39-
40-
echo.
41-
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
42-
echo.
43-
echo Please set the JAVA_HOME variable in your environment to match the
44-
echo location of your Java installation.
45-
46-
goto fail
47-
48-
:init
49-
@rem Get command-line arguments, handling Windows variants
50-
51-
if not "%OS%" == "Windows_NT" goto win9xME_args
52-
53-
:win9xME_args
54-
@rem Slurp the command line arguments.
55-
set CMD_LINE_ARGS=
56-
set _SKIP=2
57-
58-
:win9xME_args_slurp
59-
if "x%~1" == "x" goto execute
60-
61-
set CMD_LINE_ARGS=%*
62-
63-
:execute
64-
@rem Setup the command line
65-
66-
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
67-
68-
@rem Execute Gradle
69-
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
70-
71-
:end
72-
@rem End local scope for the variables with windows NT shell
73-
if "%ERRORLEVEL%"=="0" goto mainEnd
74-
75-
:fail
76-
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
77-
rem the _cmd.exe /c_ return code!
78-
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
79-
exit /b 1
80-
81-
:mainEnd
82-
if "%OS%"=="Windows_NT" endlocal
83-
84-
:omega
1+
@rem
2+
@rem Copyright 2015 the original author or authors.
3+
@rem
4+
@rem Licensed under the Apache License, Version 2.0 (the "License");
5+
@rem you may not use this file except in compliance with the License.
6+
@rem You may obtain a copy of the License at
7+
@rem
8+
@rem https://www.apache.org/licenses/LICENSE-2.0
9+
@rem
10+
@rem Unless required by applicable law or agreed to in writing, software
11+
@rem distributed under the License is distributed on an "AS IS" BASIS,
12+
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
@rem See the License for the specific language governing permissions and
14+
@rem limitations under the License.
15+
@rem
16+
17+
@if "%DEBUG%" == "" @echo off
18+
@rem ##########################################################################
19+
@rem
20+
@rem Gradle startup script for Windows
21+
@rem
22+
@rem ##########################################################################
23+
24+
@rem Set local scope for the variables with windows NT shell
25+
if "%OS%"=="Windows_NT" setlocal
26+
27+
set DIRNAME=%~dp0
28+
if "%DIRNAME%" == "" set DIRNAME=.
29+
set APP_BASE_NAME=%~n0
30+
set APP_HOME=%DIRNAME%
31+
32+
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
33+
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
34+
35+
@rem Find java.exe
36+
if defined JAVA_HOME goto findJavaFromJavaHome
37+
38+
set JAVA_EXE=java.exe
39+
%JAVA_EXE% -version >NUL 2>&1
40+
if "%ERRORLEVEL%" == "0" goto init
41+
42+
echo.
43+
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
44+
echo.
45+
echo Please set the JAVA_HOME variable in your environment to match the
46+
echo location of your Java installation.
47+
48+
goto fail
49+
50+
:findJavaFromJavaHome
51+
set JAVA_HOME=%JAVA_HOME:"=%
52+
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
53+
54+
if exist "%JAVA_EXE%" goto init
55+
56+
echo.
57+
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
58+
echo.
59+
echo Please set the JAVA_HOME variable in your environment to match the
60+
echo location of your Java installation.
61+
62+
goto fail
63+
64+
:init
65+
@rem Get command-line arguments, handling Windows variants
66+
67+
if not "%OS%" == "Windows_NT" goto win9xME_args
68+
69+
:win9xME_args
70+
@rem Slurp the command line arguments.
71+
set CMD_LINE_ARGS=
72+
set _SKIP=2
73+
74+
:win9xME_args_slurp
75+
if "x%~1" == "x" goto execute
76+
77+
set CMD_LINE_ARGS=%*
78+
79+
:execute
80+
@rem Setup the command line
81+
82+
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
83+
84+
@rem Execute Gradle
85+
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
86+
87+
:end
88+
@rem End local scope for the variables with windows NT shell
89+
if "%ERRORLEVEL%"=="0" goto mainEnd
90+
91+
:fail
92+
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
93+
rem the _cmd.exe /c_ return code!
94+
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
95+
exit /b 1
96+
97+
:mainEnd
98+
if "%OS%"=="Windows_NT" endlocal
99+
100+
:omega

0 commit comments

Comments
 (0)