diff --git a/.github/workflows/build-and-test.yml b/.github/workflows/build-and-test.yml index e0266407..bf6d9c76 100644 --- a/.github/workflows/build-and-test.yml +++ b/.github/workflows/build-and-test.yml @@ -9,7 +9,7 @@ jobs: - uses: actions/checkout@v4 - uses: actions/setup-java@v4 with: - java-version: '17' + java-version: '21' distribution: 'temurin' - name: Setup Gradle @@ -33,7 +33,7 @@ jobs: test-suite: strategy: matrix: - java: ['17', '11', '8'] + java: ['21', '17', '11', '8'] runs-on: ubuntu-latest name: Run test suite with Java ${{ matrix.java }} needs: build-and-check diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 1e0cdf2e..b5323ba9 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -30,7 +30,7 @@ jobs: persist-credentials: false - uses: actions/setup-java@v5 with: - java-version: "17" + java-version: "21" distribution: "temurin" cache: gradle - name: Setup node diff --git a/agent/bin/test_install b/agent/bin/test_install index 878aed58..7b246551 100755 --- a/agent/bin/test_install +++ b/agent/bin/test_install @@ -2,6 +2,8 @@ set -e +(cd ../annotation && ../gradlew jar) + . test/helper.bash for d in build/fixtures/*; do @@ -9,5 +11,3 @@ for d in build/fixtures/*; do ./mvnw package -quiet -DskipTests -Dcheckstyle.skip=true -Dspring-javaformat.skip=true cd - done - -../gradlew testClasses diff --git a/agent/bin/test_projects b/agent/bin/test_projects index 137147f1..0536da56 100755 --- a/agent/bin/test_projects +++ b/agent/bin/test_projects @@ -73,7 +73,7 @@ case "${JAVA_VERSION}" in 1.8*|11.*) install_petclinic "land-of-apps/spring-petclinic" old-java-support ;; - 17.*) + 17.*|21.*) # The spring-petclinic main branch now requires Java 25. This is the last commit that supports Java 17. install_petclinic "spring-projects/spring-petclinic" "3aa79e3944ab1b626288f5d0629e61643ab8fb4a" install_petclinic "spring-petclinic/spring-framework-petclinic" diff --git a/agent/build.gradle b/agent/build.gradle index 608bd024..28ac4476 100644 --- a/agent/build.gradle +++ b/agent/build.gradle @@ -14,7 +14,6 @@ plugins { } repositories { - jcenter() mavenCentral() } @@ -75,6 +74,7 @@ dependencies { testImplementation 'org.junit.jupiter:junit-jupiter' testImplementation 'org.junit.jupiter:junit-jupiter-params' testImplementation 'org.junit.vintage:junit-vintage-engine' + testRuntimeOnly 'org.junit.platform:junit-platform-launcher' testImplementation 'com.github.stefanbirkner:system-rules:1.19.0' testImplementation 'com.github.stefanbirkner:system-lambda:1.2.1' @@ -85,8 +85,7 @@ dependencies { } compileJava { - sourceCompatibility = '1.8' - targetCompatibility = '1.8' + options.release = 8 } jar { @@ -97,11 +96,11 @@ jar { } } -apply plugin: 'com.github.johnrengelman.shadow' +apply plugin: 'com.gradleup.shadow' shadowJar { - baseName = 'appmap' - classifier = '' + archiveBaseName = 'appmap' + archiveClassifier = '' minimize() { // tinylog computes the dependencies it needs at runtime, so don't exclude // anything. @@ -162,6 +161,7 @@ test { dependsOn cleanTest exclude 'com/appland/appmap/integration/**' // systemProperty "appmap.log.level", "debug" + jvmArgs '--add-opens', 'java.base/java.lang=ALL-UNNAMED' } task relocateShadowJar(type: ShadowRelocation) { @@ -179,16 +179,16 @@ tasks.shadowJar.dependsOn tasks.relocateShadowJar jacocoTestReport { reports { - xml.enabled false - csv.enabled false - html.enabled true + xml.required = false + csv.required = false + html.required = true } } // extra artifacts used in publishing task sourcesJar(type: Jar) { from sourceSets.main.allJava - classifier = 'sources' + archiveClassifier = 'sources' } // for some reason this block generates empty Javadoc @@ -198,7 +198,7 @@ javadoc { } task mockJavadocJar(type: Jar) { - classifier = 'javadoc' + archiveClassifier = 'javadoc' from javadoc.destinationDir } @@ -212,8 +212,8 @@ publishing { // 1. coordinates (parameterized) - groupId publishGroupId - artifactId publishArtifactId + groupId = publishGroupId + artifactId = publishArtifactId // version defined globally @@ -271,4 +271,4 @@ if (project.hasProperty("signingKey")) { } } -tasks.publishToMavenLocal.dependsOn(check, integrationTest) \ No newline at end of file +tasks.publishToMavenLocal.dependsOn(check, integrationTest) diff --git a/agent/test/access/MyClass.java b/agent/test/access/MyClass.java new file mode 100644 index 00000000..724fa061 --- /dev/null +++ b/agent/test/access/MyClass.java @@ -0,0 +1,20 @@ +package access; + +public class MyClass { + public void myMethod() { + // do nothing + } + + public void callNonPublic() { + myPackageMethod(); + myPrivateMethod(); + } + + String myPackageMethod() { + return "package method"; + } + + private String myPrivateMethod() { + return "private method"; + } +} diff --git a/agent/test/access/RecordPackage.java b/agent/test/access/RecordPackage.java index 5a9ec27e..ee14035d 100644 --- a/agent/test/access/RecordPackage.java +++ b/agent/test/access/RecordPackage.java @@ -1,9 +1,10 @@ +package access; + import java.io.IOException; import java.io.OutputStreamWriter; import com.appland.appmap.record.Recorder; import com.appland.appmap.record.Recording; -import com.appland.appmap.test.fixture.MyClass; public class RecordPackage { public static void main(String[] argv) { diff --git a/agent/test/access/access.bats b/agent/test/access/access.bats old mode 100644 new mode 100755 index abe6e730..779c0208 --- a/agent/test/access/access.bats +++ b/agent/test/access/access.bats @@ -4,14 +4,17 @@ load '../helper' sep="$JAVA_PATH_SEPARATOR" AGENT_JAR="$(find_agent_jar)" -wd=$(getcwd) -test_cp="${wd}/test/access${sep}${wd}/build/classes/java/test" + +# Resolves to .../agent/test +TEST_DIR="$(dirname "$BATS_TEST_DIRNAME")" + +# test_cp must include 'test' (for access package) and 'test/access' (for default package) +test_cp="${TEST_DIR}${sep}${TEST_DIR}/access" java_cmd="java -javaagent:'${AGENT_JAR}' -cp '${test_cp}'" setup() { - javac -cp "${AGENT_JAR}${sep}${test_cp}" test/access/*.java - - cd test/access + cd "$BATS_TEST_DIRNAME" || exit + javac -cp "${AGENT_JAR}" -sourcepath "$TEST_DIR" ./*.java _configure_logging } @@ -22,7 +25,7 @@ setup() { # functionaly it enables is pretty useless, though, so it seems harmless to # hijack it. @test "testProtected" { - local cmd="${java_cmd} RecordPackage" + local cmd="${java_cmd} access.RecordPackage" [[ $BATS_VERBOSE_RUN == 1 ]] && echo "cmd: $cmd" >&3 # Exactly 4 events means that MyClass.myPrivateMethod was not recorded @@ -31,7 +34,7 @@ setup() { } @test "testPrivate" { - local cmd="${java_cmd} -Dappmap.record.private=true RecordPackage" + local cmd="${java_cmd} -Dappmap.record.private=true access.RecordPackage" [[ $BATS_VERBOSE_RUN == 1 ]] && echo "cmd: $cmd" >&3 # 6 events means that both myPackageMethod and myPrivateMethod were recorded @@ -40,7 +43,7 @@ setup() { } @test "outside git repo" { - cp -v "$(_top_level)/agent/appmap.yml" "$BATS_TEST_TMPDIR"/. + cp -v "appmap.yml" "$BATS_TEST_TMPDIR"/. cd "$BATS_TEST_TMPDIR" # sanity check @@ -48,7 +51,7 @@ setup() { assert_output -p 'not a git repository' assert_failure - local cmd="${java_cmd} RecordPackage" + local cmd="${java_cmd} access.RecordPackage" [[ $BATS_VERBOSE_RUN == 1 ]] && echo "cmd: $cmd" >&3 run bash -c "eval \"$cmd\" 2>/dev/null" assert_success diff --git a/agent/test/access/appmap.yml b/agent/test/access/appmap.yml index e20bd71a..9c3ef4a1 100644 --- a/agent/test/access/appmap.yml +++ b/agent/test/access/appmap.yml @@ -1,4 +1,4 @@ name: test-access packages: -- path: com.appland.appmap.test.fixture +- path: access - path: HelloWorld \ No newline at end of file diff --git a/agent/test/event/DisabledValue.java b/agent/test/event/DisabledValue.java index ef50abce..44df87b5 100644 --- a/agent/test/event/DisabledValue.java +++ b/agent/test/event/DisabledValue.java @@ -1,11 +1,11 @@ +package event; + import java.io.IOException; import java.io.OutputStreamWriter; import com.appland.appmap.record.Recorder; import com.appland.appmap.record.Recording; -import com.appland.appmap.test.fixture.Example; - public class DisabledValue { public static void main(String[] argv) { diff --git a/agent/test/event/Example.java b/agent/test/event/Example.java new file mode 100644 index 00000000..6cad632f --- /dev/null +++ b/agent/test/event/Example.java @@ -0,0 +1,12 @@ +package event; + +public class Example { + @Override + public String toString() { + return "an Example"; + } + + public Example doSomething(Example other) { + return other; + } +} diff --git a/agent/test/event/appmap.yml b/agent/test/event/appmap.yml index 63c6f786..bbef530c 100644 --- a/agent/test/event/appmap.yml +++ b/agent/test/event/appmap.yml @@ -1,3 +1,3 @@ name: test-event packages: -- path: com.appland.appmap.test.fixture +- path: event diff --git a/agent/test/event/event.bats b/agent/test/event/event.bats old mode 100644 new mode 100755 index c5c501e7..af9ea103 --- a/agent/test/event/event.bats +++ b/agent/test/event/event.bats @@ -2,21 +2,20 @@ load '../helper' -sep="$JAVA_PATH_SEPARATOR" AGENT_JAR="$(find_agent_jar)" -wd=$(getcwd) -test_cp="${wd}/test/event${sep}${wd}/build/classes/java/test" -java_cmd="java -javaagent:'${AGENT_JAR}' -cp '${test_cp}'" -setup() { - javac -cp "${AGENT_JAR}${sep}${test_cp}" test/event/*.java +# Resolves to .../agent/test +TEST_DIR="$(dirname "$BATS_TEST_DIRNAME")" +java_cmd="java -javaagent:'${AGENT_JAR}' -cp '${TEST_DIR}'" - cd test/event +setup() { + cd "$BATS_TEST_DIRNAME" || exit + javac -cp "${AGENT_JAR}" -sourcepath "$TEST_DIR" ./*.java _configure_logging } @test "disabled value" { - local cmd="${java_cmd} -Dappmap.event.disableValue=true DisabledValue" + local cmd="${java_cmd} -Dappmap.event.disableValue=true event.DisabledValue" [[ $BATS_VERBOSE_RUN == 1 ]] && echo "cmd: $cmd" >&3 local output diff --git a/agent/test/httpcore/httpcore.bats b/agent/test/httpcore/httpcore.bats old mode 100644 new mode 100755 index 7a511d8c..8cd983c3 --- a/agent/test/httpcore/httpcore.bats +++ b/agent/test/httpcore/httpcore.bats @@ -8,12 +8,14 @@ load '../helper' setup_file() { -mkdir -p build/log + agent_root="$BATS_TEST_DIRNAME/../.." + mkdir -p "$agent_root/build/log" -export LOG="$(getcwd)/build/log/httpcore.log" -export SERVER_PORT=9090 -export WS_URL=${WS_URL:-http://localhost:9090} - cd test/httpcore + export LOG="$agent_root/build/log/httpcore.log" + export SERVER_PORT=46406 + export WS_URL=${WS_URL:-http://localhost:${SERVER_PORT}} + + cd "$BATS_TEST_DIRNAME" || exit _configure_logging printf 'getting set up' >&3 diff --git a/agent/test/jdbc/gradle/wrapper/gradle-wrapper.properties b/agent/test/jdbc/gradle/wrapper/gradle-wrapper.properties index aa991fce..1af9e093 100644 --- a/agent/test/jdbc/gradle/wrapper/gradle-wrapper.properties +++ b/agent/test/jdbc/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,7 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-7.4.2-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip +networkTimeout=10000 +validateDistributionUrl=true zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/agent/test/jdbc/gradlew.bat b/agent/test/jdbc/gradlew.bat deleted file mode 100644 index ac1b06f9..00000000 --- a/agent/test/jdbc/gradlew.bat +++ /dev/null @@ -1,89 +0,0 @@ -@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 -@rem Gradle startup script for Windows -@rem -@rem ########################################################################## - -@rem Set local scope for the variables with windows NT shell -if "%OS%"=="Windows_NT" setlocal - -set DIRNAME=%~dp0 -if "%DIRNAME%" == "" set DIRNAME=. -set APP_BASE_NAME=%~n0 -set APP_HOME=%DIRNAME% - -@rem Resolve any "." and ".." in APP_HOME to make it shorter. -for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi - -@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="-Xmx64m" "-Xms64m" - -@rem Find java.exe -if defined JAVA_HOME goto findJavaFromJavaHome - -set JAVA_EXE=java.exe -%JAVA_EXE% -version >NUL 2>&1 -if "%ERRORLEVEL%" == "0" goto execute - -echo. -echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. - -goto fail - -:findJavaFromJavaHome -set JAVA_HOME=%JAVA_HOME:"=% -set JAVA_EXE=%JAVA_HOME%/bin/java.exe - -if exist "%JAVA_EXE%" goto execute - -echo. -echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. - -goto fail - -:execute -@rem Setup the command line - -set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar - - -@rem Execute Gradle -"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* - -:end -@rem End local scope for the variables with windows NT shell -if "%ERRORLEVEL%"=="0" goto mainEnd - -:fail -rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of -rem the _cmd.exe /c_ return code! -if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 -exit /b 1 - -:mainEnd -if "%OS%"=="Windows_NT" endlocal - -:omega diff --git a/annotation/build.gradle b/annotation/build.gradle index 228bd7ba..45119a50 100644 --- a/annotation/build.gradle +++ b/annotation/build.gradle @@ -12,7 +12,7 @@ plugins { } repositories { - jcenter() + mavenCentral() } @@ -40,8 +40,7 @@ version = parameterizedVersion ?: ( travisVersionValid ? travisVersion : default group = publishGroupId compileJava { - sourceCompatibility = '1.8' - targetCompatibility = '1.8' + options.release = 8 } check { @@ -50,7 +49,7 @@ check { // extra artifacts used in publishing task sourcesJar(type: Jar) { from sourceSets.main.allJava - classifier = 'sources' + archiveClassifier = 'sources' } // for some reason this block generates empty Javadoc @@ -59,7 +58,7 @@ javadoc { exclude 'com/appland/**' } task mockJavadocJar(type: Jar) { - classifier = 'javadoc' + archiveClassifier = 'javadoc' from javadoc.destinationDir } @@ -74,8 +73,8 @@ publishing { // 1. coordinates (parameterized) - groupId publishGroupId - artifactId publishArtifactId + groupId = publishGroupId + artifactId = publishArtifactId // version defined globally diff --git a/bats-libs/bats-assert b/bats-libs/bats-assert new file mode 160000 index 00000000..697471b7 --- /dev/null +++ b/bats-libs/bats-assert @@ -0,0 +1 @@ +Subproject commit 697471b7a89d3ab38571f38c6c7c4b460d1f5e35 diff --git a/bats-libs/bats-support b/bats-libs/bats-support new file mode 160000 index 00000000..0954abb9 --- /dev/null +++ b/bats-libs/bats-support @@ -0,0 +1 @@ +Subproject commit 0954abb9925cad550424cebca2b99255d4eabe96 diff --git a/build.gradle b/build.gradle index da8cc324..8418b551 100644 --- a/build.gradle +++ b/build.gradle @@ -7,7 +7,7 @@ */ plugins { - id 'io.github.gradle-nexus.publish-plugin' version '1.1.0' + id 'io.github.gradle-nexus.publish-plugin' version '2.0.0' id "com.dorongold.task-tree" version "2.1.0" } @@ -49,4 +49,8 @@ subprojects { toolVersion = "9.3" configFile = rootProject.file("config/checkstyle/checkstyle.xml") } + + tasks.withType(JavaCompile) { + options.compilerArgs << "-Xlint:-options" + } } diff --git a/buildSrc/build.gradle b/buildSrc/build.gradle index 874a521b..3ed1e411 100644 --- a/buildSrc/build.gradle +++ b/buildSrc/build.gradle @@ -1,12 +1,12 @@ buildscript { repositories { - jcenter() + mavenCentral() maven { - url "https://plugins.gradle.org/m2/" + url = "https://plugins.gradle.org/m2/" } } dependencies { - classpath 'gradle.plugin.com.github.johnrengelman:shadow:7.1.2' + classpath 'com.gradleup.shadow:shadow-gradle-plugin:9.3.1' } } @@ -16,14 +16,14 @@ plugins { } repositories { - jcenter() + mavenCentral() maven { - url "https://plugins.gradle.org/m2/" + url = "https://plugins.gradle.org/m2/" } } dependencies { - implementation 'gradle.plugin.com.github.johnrengelman:shadow:7.1.2' + implementation 'com.gradleup.shadow:shadow-gradle-plugin:9.3.1' } diff --git a/buildSrc/src/main/groovy/com/appland/tasks/ShadowRelocation.groovy b/buildSrc/src/main/groovy/com/appland/tasks/ShadowRelocation.groovy index 7f93a9ec..2eb073f6 100644 --- a/buildSrc/src/main/groovy/com/appland/tasks/ShadowRelocation.groovy +++ b/buildSrc/src/main/groovy/com/appland/tasks/ShadowRelocation.groovy @@ -25,7 +25,7 @@ class ShadowRelocation extends DefaultTask { @InputFiles @Optional List getConfigurations() { - return target.configurations + return target.configurations.get().toList() } @TaskAction diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar index 41d9927a..f8e1ee31 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 aa991fce..23449a2b 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,7 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-7.4.2-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-9.2.1-bin.zip +networkTimeout=10000 +validateDistributionUrl=true zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/gradlew b/gradlew index 1b6c7873..adff685a 100755 --- a/gradlew +++ b/gradlew @@ -1,7 +1,7 @@ #!/bin/sh # -# Copyright © 2015-2021 the original authors. +# Copyright © 2015 the original authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -15,6 +15,8 @@ # See the License for the specific language governing permissions and # limitations under the License. # +# SPDX-License-Identifier: Apache-2.0 +# ############################################################################## # @@ -55,7 +57,7 @@ # Darwin, MinGW, and NonStop. # # (3) This script is generated from the Groovy template -# https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt +# https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt # within the Gradle project. # # You can find Gradle at https://github.com/gradle/gradle/. @@ -80,13 +82,11 @@ do esac done -APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit - -APP_NAME="Gradle" +# This is normally unused +# shellcheck disable=SC2034 APP_BASE_NAME=${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='"-Xmx64m" "-Xms64m"' +# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036) +APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s\n' "$PWD" ) || exit # Use the maximum available, or set MAX_FD != -1 to use that value. MAX_FD=maximum @@ -114,7 +114,6 @@ case "$( uname )" in #( NONSTOP* ) nonstop=true ;; esac -CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar # Determine the Java command to use to start the JVM. @@ -133,22 +132,29 @@ location of your Java installation." fi else JAVACMD=java - which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + if ! command -v java >/dev/null 2>&1 + then + die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. Please set the JAVA_HOME variable in your environment to match the location of your Java installation." + fi fi # Increase the maximum file descriptors if we can. if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then case $MAX_FD in #( max*) + # In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked. + # shellcheck disable=SC2039,SC3045 MAX_FD=$( ulimit -H -n ) || warn "Could not query maximum file descriptor limit" esac case $MAX_FD in #( '' | soft) :;; #( *) + # In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked. + # shellcheck disable=SC2039,SC3045 ulimit -n "$MAX_FD" || warn "Could not set maximum file descriptor limit to $MAX_FD" esac @@ -165,7 +171,6 @@ fi # For Cygwin or MSYS, switch paths to Windows format before running java if "$cygwin" || "$msys" ; then APP_HOME=$( cygpath --path --mixed "$APP_HOME" ) - CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" ) JAVACMD=$( cygpath --unix "$JAVACMD" ) @@ -193,18 +198,27 @@ if "$cygwin" || "$msys" ; then done fi -# Collect all arguments for the java command; -# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of -# shell script including quotes and variable substitutions, so put them in -# double quotes to make sure that they get re-expanded; and -# * put everything else in single quotes, so that it's not re-expanded. + +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' + +# Collect all arguments for the java command: +# * DEFAULT_JVM_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments, +# and any embedded shellness will be escaped. +# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be +# treated as '${Hostname}' itself on the command line. set -- \ "-Dorg.gradle.appname=$APP_BASE_NAME" \ - -classpath "$CLASSPATH" \ - org.gradle.wrapper.GradleWrapperMain \ + -jar "$APP_HOME/gradle/wrapper/gradle-wrapper.jar" \ "$@" +# Stop when "xargs" is not available. +if ! command -v xargs >/dev/null 2>&1 +then + die "xargs is not available" +fi + # Use "xargs" to parse quoted args. # # With -n1 it outputs one arg per line, with the quotes and backslashes removed. diff --git a/gradlew.bat b/gradlew.bat index ac1b06f9..e509b2dd 100644 --- a/gradlew.bat +++ b/gradlew.bat @@ -13,8 +13,10 @@ @rem See the License for the specific language governing permissions and @rem limitations under the License. @rem +@rem SPDX-License-Identifier: Apache-2.0 +@rem -@if "%DEBUG%" == "" @echo off +@if "%DEBUG%"=="" @echo off @rem ########################################################################## @rem @rem Gradle startup script for Windows @@ -25,7 +27,8 @@ if "%OS%"=="Windows_NT" setlocal set DIRNAME=%~dp0 -if "%DIRNAME%" == "" set DIRNAME=. +if "%DIRNAME%"=="" set DIRNAME=. +@rem This is normally unused set APP_BASE_NAME=%~n0 set APP_HOME=%DIRNAME% @@ -40,13 +43,13 @@ if defined JAVA_HOME goto findJavaFromJavaHome set JAVA_EXE=java.exe %JAVA_EXE% -version >NUL 2>&1 -if "%ERRORLEVEL%" == "0" goto execute +if %ERRORLEVEL% equ 0 goto execute -echo. -echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. +echo. 1>&2 +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2 +echo. 1>&2 +echo Please set the JAVA_HOME variable in your environment to match the 1>&2 +echo location of your Java installation. 1>&2 goto fail @@ -56,32 +59,33 @@ set JAVA_EXE=%JAVA_HOME%/bin/java.exe if exist "%JAVA_EXE%" goto execute -echo. -echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. +echo. 1>&2 +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2 +echo. 1>&2 +echo Please set the JAVA_HOME variable in your environment to match the 1>&2 +echo location of your Java installation. 1>&2 goto fail :execute @rem Setup the command line -set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar @rem Execute Gradle -"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -jar "%APP_HOME%\gradle\wrapper\gradle-wrapper.jar" %* :end @rem End local scope for the variables with windows NT shell -if "%ERRORLEVEL%"=="0" goto mainEnd +if %ERRORLEVEL% equ 0 goto mainEnd :fail rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of rem the _cmd.exe /c_ return code! -if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 -exit /b 1 +set EXIT_CODE=%ERRORLEVEL% +if %EXIT_CODE% equ 0 set EXIT_CODE=1 +if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE% +exit /b %EXIT_CODE% :mainEnd if "%OS%"=="Windows_NT" endlocal diff --git a/runtime/build.gradle b/runtime/build.gradle index b134b5dd..aaeac339 100644 --- a/runtime/build.gradle +++ b/runtime/build.gradle @@ -3,13 +3,11 @@ plugins { } repositories { - jcenter() mavenCentral() } compileJava { - sourceCompatibility = '1.8' - targetCompatibility = '1.8' + options.release = 8 } // Don't put dependencies here.