diff --git a/.github/workflows/gradle.yml b/.github/workflows/gradle.yml index 3c48f59..215cd2a 100644 --- a/.github/workflows/gradle.yml +++ b/.github/workflows/gradle.yml @@ -6,19 +6,25 @@ on: pull_request: branches: [ main ] +permissions: + contents: read + jobs: build: runs-on: ubuntu-latest strategy: matrix: - java: [ '11', '17', '21', '23' ] + java: [ '17', '21', '25' ] steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 - name: Setup Java - uses: actions/setup-java@v1 + uses: actions/setup-java@d1374f8ac74474200d16ef8ecee22c7ae7a51880 # v6.3.0 with: + distribution: temurin java-version: ${{ matrix.java }} + - name: Setup Gradle + uses: gradle/actions/setup-gradle@8da46b539cd8fe6ab27ca75128919a18d757604c # v6.4.1 - name: Build with Gradle run: ./gradlew build @@ -26,22 +32,26 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 - - uses: gradle/wrapper-validation-action@v1.0.4 + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + - uses: gradle/actions/wrapper-validation@8da46b539cd8fe6ab27ca75128919a18d757604c # v6.4.1 publishCoverage: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 - name: Setup Java - uses: actions/setup-java@v1 + uses: actions/setup-java@d1374f8ac74474200d16ef8ecee22c7ae7a51880 # v6.3.0 with: - java-version: 11 + distribution: temurin + java-version: '25' + - name: Setup Gradle + uses: gradle/actions/setup-gradle@8da46b539cd8fe6ab27ca75128919a18d757604c # v6.4.1 - name: Build with Gradle run: ./gradlew jacocoTestReport - name: Upload coverage to Codecov - uses: codecov/codecov-action@v1 + uses: codecov/codecov-action@303a32d7a59b442fa8d48b6a1cc6825c09c847a5 # v7.1.1 with: files: ./build/reports/jacoco/test/jacocoTestReport.xml name: codecov + token: ${{ secrets.CODECOV_TOKEN }} diff --git a/README.md b/README.md index b564d18..ef42273 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@ [![CI](https://github.com/bwaldvogel/liblinear-java/workflows/CI/badge.svg)](https://github.com/bwaldvogel/liblinear-java/actions) -[![Maven Central](https://maven-badges.herokuapp.com/maven-central/de.bwaldvogel/liblinear/badge.svg)](http://maven-badges.herokuapp.com/maven-central/de.bwaldvogel/liblinear) +[![Maven Central](https://img.shields.io/maven-central/v/de.bwaldvogel/liblinear)](https://central.sonatype.com/artifact/de.bwaldvogel/liblinear) [![codecov](https://codecov.io/gh/bwaldvogel/liblinear-java/branch/main/graph/badge.svg?token=Scy4yJzBf7)](https://codecov.io/gh/bwaldvogel/liblinear-java) [![BSD 3-Clause License](https://img.shields.io/github/license/bwaldvogel/liblinear-java.svg)](https://opensource.org/licenses/BSD-3-Clause) [![Donate](https://img.shields.io/badge/Donate-PayPal-green.svg)](https://www.paypal.me/BenediktWaldvogel) @@ -17,7 +17,7 @@ The upstream GitHub project can be found at ## Dependencies ## -The only requirement is Java 11 or later. +The only requirement is Java 17 or later. ## Usage ## diff --git a/build.gradle b/build.gradle index 6af5d77..ac8e6a7 100644 --- a/build.gradle +++ b/build.gradle @@ -13,36 +13,38 @@ plugins { id 'signing' id 'jacoco' id 'de.undercouch.download' version 'latest.release' - id 'me.champeau.gradle.jmh' version 'latest.release' + id 'me.champeau.jmh' version 'latest.release' } group = "de.bwaldvogel" version = '2.44' java { - sourceCompatibility = '11' - targetCompatibility = '11' + sourceCompatibility = '17' + targetCompatibility = '17' } -tasks.withType(JavaCompile) { +tasks.withType(JavaCompile).configureEach { + options.release = 17 options.encoding = 'UTF-8' options.compilerArgs.addAll(['-Xlint:all', '-Werror']) } jar { manifest { - attributes 'Implementation-Title': project.name, 'Implementation-Version': archiveVersion + attributes 'Implementation-Title': project.name, 'Implementation-Version': archiveVersion.get() } } -task sourceJar(type: Jar) { +tasks.register('sourceJar', Jar) { archiveClassifier = "sources" from sourceSets.main.allJava } -task javadocJar(type: Jar, dependsOn: javadoc) { +tasks.register('javadocJar', Jar) { + dependsOn tasks.named('javadoc') archiveClassifier = "javadoc" - from javadoc.destinationDir + from tasks.named('javadoc').map { it.destinationDir } } publishing { @@ -80,8 +82,8 @@ publishing { from components.java - artifact sourceJar - artifact javadocJar + artifact tasks.named('sourceJar') + artifact tasks.named('javadocJar') versionMapping { usage('java-api') { @@ -133,12 +135,12 @@ test { } wrapper { - gradleVersion = "8.12" + gradleVersion = "9.9.1" distributionType = Wrapper.DistributionType.ALL } jmh { - include = ['de\\.bwaldvogel\\.liblinear\\.LinearBenchmark.*'] + includes = ['de\\.bwaldvogel\\.liblinear\\.LinearBenchmark.*'] jvmArgs = ["-Ddataset.directory=" + projectDir + "/src/test/datasets"] } @@ -147,17 +149,19 @@ tasks.named('jmh').configure { } dependencies { - testImplementation group: 'org.junit.jupiter', name: 'junit-jupiter-api', version: 'latest.release' - testImplementation group: 'org.junit.jupiter', name: 'junit-jupiter-params', version: 'latest.release' - testRuntimeOnly group: 'org.junit.jupiter', name: 'junit-jupiter-engine', version: 'latest.release' - testImplementation group: 'org.slf4j', name: 'slf4j-api', version: 'latest.release' - testImplementation group: 'org.assertj', name: 'assertj-core', version: 'latest.release' - testImplementation group: 'org.mockito', name: 'mockito-core', version: 'latest.release' - testImplementation group: 'nl.jqno.equalsverifier', name: 'equalsverifier', version: 'latest.release' - - testRuntimeOnly group: 'ch.qos.logback', name: 'logback-classic', version: 'latest.release' - - jmh group: 'org.apache.commons', name: 'commons-compress', version: 'latest.release' + testImplementation platform('org.junit:junit-bom:latest.release') + testImplementation 'org.junit.jupiter:junit-jupiter-api' + testImplementation 'org.junit.jupiter:junit-jupiter-params' + testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine' + testRuntimeOnly 'org.junit.platform:junit-platform-launcher' + testImplementation 'org.slf4j:slf4j-api:latest.release' + testImplementation 'org.assertj:assertj-core:latest.release' + testImplementation 'org.mockito:mockito-core:latest.release' + testImplementation 'nl.jqno.equalsverifier:equalsverifier:latest.release' + + testRuntimeOnly 'ch.qos.logback:logback-classic:latest.release' + + jmh 'org.apache.commons:commons-compress:latest.release' jmh 'org.openjdk.jmh:jmh-generator-annprocess:latest.release' // for IntelliJ components.all { ComponentMetadataDetails details -> diff --git a/buildscript-gradle.lockfile b/buildscript-gradle.lockfile index b463142..d4fa82f 100644 --- a/buildscript-gradle.lockfile +++ b/buildscript-gradle.lockfile @@ -1,11 +1,11 @@ # This is a Gradle generated file for dependency locking. # Manual edits can break the build and are not advised. # This file is expected to be part of source control. -de.undercouch.download:de.undercouch.download.gradle.plugin:5.6.0=classpath -de.undercouch:gradle-download-task:5.6.0=classpath -me.champeau.gradle.jmh:me.champeau.gradle.jmh.gradle.plugin:0.5.3=classpath -me.champeau.gradle:jmh-gradle-plugin:0.5.3=classpath -net.sf.jopt-simple:jopt-simple:4.6=classpath -org.apache.commons:commons-math3:3.2=classpath -org.openjdk.jmh:jmh-core:1.27=classpath +de.undercouch.download:de.undercouch.download.gradle.plugin:5.7.0=classpath +de.undercouch:gradle-download-task:5.7.0=classpath +me.champeau.jmh:jmh-gradle-plugin:0.7.4=classpath +me.champeau.jmh:me.champeau.jmh.gradle.plugin:0.7.4=classpath +net.sf.jopt-simple:jopt-simple:5.0.4=classpath +org.apache.commons:commons-math3:3.6.1=classpath +org.openjdk.jmh:jmh-core:1.37=classpath empty= diff --git a/datasets.gradle b/datasets.gradle index 131ed88..1bc7dbd 100644 --- a/datasets.gradle +++ b/datasets.gradle @@ -1,4 +1,4 @@ -task downloadDatasetSplice(type: Download) { +tasks.register('downloadDatasetSplice', Download) { def baseUrl = 'https://www.csie.ntu.edu.tw/~cjlin/libsvmtools/datasets/binary' src([ "${baseUrl}/splice", @@ -8,19 +8,21 @@ task downloadDatasetSplice(type: Download) { overwrite false } -task verifyDatasetSpliceTrain(type: Verify, dependsOn: downloadDatasetSplice) { +tasks.register('verifyDatasetSpliceTrain', Verify) { + dependsOn 'downloadDatasetSplice' src 'src/test/datasets/splice/splice' algorithm 'SHA-256' checksum 'eee33566cfe8988ec26122460cc712d66c5c5b79b966b259408e803addaa584d' } -task verifyDatasetSpliceTest(type: Verify, dependsOn: downloadDatasetSplice) { +tasks.register('verifyDatasetSpliceTest', Verify) { + dependsOn 'downloadDatasetSplice' src 'src/test/datasets/splice/splice.t' algorithm 'SHA-256' checksum 'f40da7cfd17860f3f1a1bb7d118f8e86c306d232ca6ac6ddefbaaef266abaa03' } -task downloadDatasetDna(type: Download) { +tasks.register('downloadDatasetDna', Download) { def baseUrl = 'https://www.csie.ntu.edu.tw/~cjlin/libsvmtools/datasets/multiclass' src([ "${baseUrl}/dna.scale", @@ -30,19 +32,21 @@ task downloadDatasetDna(type: Download) { overwrite false } -task verifyDatasetDnaTrain(type: Verify, dependsOn: downloadDatasetDna) { +tasks.register('verifyDatasetDnaTrain', Verify) { + dependsOn 'downloadDatasetDna' src 'src/test/datasets/dna.scale/dna.scale' algorithm 'SHA-256' checksum '03d39477c5e48415e9cd18e006efc8f7a3b5c3deaee8289a72511c35070e3cfe' } -task verifyDatasetDnaTest(type: Verify, dependsOn: downloadDatasetDna) { +tasks.register('verifyDatasetDnaTest', Verify) { + dependsOn 'downloadDatasetDna' src 'src/test/datasets/dna.scale/dna.scale.t' algorithm 'SHA-256' checksum 'd2eeed170e4e38ae2aba6aa4cd27a8ca4ecceb01a7751e8e509bb4e1a6bcef39' } -task downloadDatasetRcv1(type: Download) { +tasks.register('downloadDatasetRcv1', Download) { def baseUrl = 'https://www.csie.ntu.edu.tw/~cjlin/libsvmtools/datasets/binary' src([ "${baseUrl}/rcv1_train.binary.bz2", @@ -52,24 +56,26 @@ task downloadDatasetRcv1(type: Download) { overwrite false } -task verifyDatasetRcv1Train(type: Verify, dependsOn: downloadDatasetRcv1) { +tasks.register('verifyDatasetRcv1Train', Verify) { + dependsOn 'downloadDatasetRcv1' src 'src/test/datasets/rcv1/rcv1_train.binary.bz2' algorithm 'SHA-256' checksum 'dda0c6381811484e284e70dd0641335917debce50948346416fde7fb32fad2e2' } -task verifyDatasetRcv1Test(type: Verify, dependsOn: downloadDatasetRcv1) { +tasks.register('verifyDatasetRcv1Test', Verify) { + dependsOn 'downloadDatasetRcv1' src 'src/test/datasets/rcv1/rcv1_test.binary.bz2' algorithm 'SHA-256' checksum '975ab6c4fd8ea2a88b82e7ba2659ef21bf980ac61b3d8f13d6991739ec0f7aa7' } -task downloadAndVerifyRcv1 { +tasks.register('downloadAndVerifyRcv1') { dependsOn 'verifyDatasetRcv1Train' dependsOn 'verifyDatasetRcv1Test' } -task downloadAndVerifyDatasets { +tasks.register('downloadAndVerifyDatasets') { dependsOn 'verifyDatasetSpliceTrain' dependsOn 'verifyDatasetSpliceTest' dependsOn 'verifyDatasetDnaTrain' diff --git a/gradle.lockfile b/gradle.lockfile index faf5ce3..82c5635 100644 --- a/gradle.lockfile +++ b/gradle.lockfile @@ -1,40 +1,43 @@ # This is a Gradle generated file for dependency locking. # Manual edits can break the build and are not advised. # This file is expected to be part of source control. -ch.qos.logback:logback-classic:1.5.15=jmhRuntimeClasspath,testRuntimeClasspath -ch.qos.logback:logback-core:1.5.15=jmhRuntimeClasspath,testRuntimeClasspath -commons-codec:commons-codec:1.17.1=jmh,jmhCompileClasspath,jmhRuntimeClasspath -commons-io:commons-io:2.16.1=jmh,jmhCompileClasspath,jmhRuntimeClasspath -net.bytebuddy:byte-buddy-agent:1.15.4=jmhRuntimeClasspath,testCompileClasspath,testRuntimeClasspath -net.bytebuddy:byte-buddy:1.15.11=jmhRuntimeClasspath,testCompileClasspath,testRuntimeClasspath +# To regenerate this file, run: ./gradlew :dependencies --write-locks +ch.qos.logback:logback-classic:1.6.6=jmhRuntimeClasspath,testRuntimeClasspath +ch.qos.logback:logback-core:1.6.6=jmhRuntimeClasspath,testRuntimeClasspath +commons-codec:commons-codec:1.19.0=jmh,jmhCompileClasspath,jmhRuntimeClasspath +commons-io:commons-io:2.20.0=jmh,jmhCompileClasspath,jmhRuntimeClasspath +net.bytebuddy:byte-buddy-agent:1.17.7=jmhRuntimeClasspath,testCompileClasspath,testRuntimeClasspath +net.bytebuddy:byte-buddy:1.18.5=jmhRuntimeClasspath,testCompileClasspath,testRuntimeClasspath net.sf.jopt-simple:jopt-simple:5.0.4=jmh,jmhCompileClasspath,jmhRuntimeClasspath -nl.jqno.equalsverifier:equalsverifier:3.18=jmhRuntimeClasspath,testCompileClasspath,testRuntimeClasspath -org.apache.commons:commons-compress:1.27.1=jmh,jmhCompileClasspath,jmhRuntimeClasspath -org.apache.commons:commons-lang3:3.16.0=jmh,jmhCompileClasspath,jmhRuntimeClasspath +nl.jqno.equalsverifier:equalsverifier:4.5.2=jmhRuntimeClasspath,testCompileClasspath,testRuntimeClasspath +org.apache.commons:commons-compress:1.28.0=jmh,jmhCompileClasspath,jmhRuntimeClasspath +org.apache.commons:commons-lang3:3.18.0=jmh,jmhCompileClasspath,jmhRuntimeClasspath org.apache.commons:commons-math3:3.6.1=jmh,jmhCompileClasspath,jmhRuntimeClasspath org.apiguardian:apiguardian-api:1.1.2=testCompileClasspath -org.assertj:assertj-core:3.27.0=jmhRuntimeClasspath,testCompileClasspath,testRuntimeClasspath -org.jacoco:org.jacoco.agent:0.8.12=jacocoAgent,jacocoAnt -org.jacoco:org.jacoco.ant:0.8.12=jacocoAnt -org.jacoco:org.jacoco.core:0.8.12=jacocoAnt -org.jacoco:org.jacoco.report:0.8.12=jacocoAnt -org.junit.jupiter:junit-jupiter-api:5.11.4=jmhRuntimeClasspath,testCompileClasspath,testRuntimeClasspath -org.junit.jupiter:junit-jupiter-engine:5.11.4=jmhRuntimeClasspath,testRuntimeClasspath -org.junit.jupiter:junit-jupiter-params:5.11.4=jmhRuntimeClasspath,testCompileClasspath,testRuntimeClasspath -org.junit.platform:junit-platform-commons:1.11.4=jmhRuntimeClasspath,testCompileClasspath,testRuntimeClasspath -org.junit.platform:junit-platform-engine:1.11.4=jmhRuntimeClasspath,testRuntimeClasspath -org.junit:junit-bom:5.11.4=jmhRuntimeClasspath,testCompileClasspath,testRuntimeClasspath -org.mockito:mockito-core:5.14.2=jmhRuntimeClasspath,testCompileClasspath,testRuntimeClasspath -org.objenesis:objenesis:3.4=jmhRuntimeClasspath,testCompileClasspath,testRuntimeClasspath +org.assertj:assertj-core:3.27.7=jmhRuntimeClasspath,testCompileClasspath,testRuntimeClasspath +org.jacoco:org.jacoco.agent:0.8.15=jacocoAgent,jacocoAnt +org.jacoco:org.jacoco.ant:0.8.15=jacocoAnt +org.jacoco:org.jacoco.core:0.8.15=jacocoAnt +org.jacoco:org.jacoco.report:0.8.15=jacocoAnt +org.jspecify:jspecify:1.0.0=testCompileClasspath +org.junit.jupiter:junit-jupiter-api:6.1.3=jmhRuntimeClasspath,testCompileClasspath,testRuntimeClasspath +org.junit.jupiter:junit-jupiter-engine:6.1.3=jmhRuntimeClasspath,testRuntimeClasspath +org.junit.jupiter:junit-jupiter-params:6.1.3=jmhRuntimeClasspath,testCompileClasspath,testRuntimeClasspath +org.junit.platform:junit-platform-commons:6.1.3=jmhRuntimeClasspath,testCompileClasspath,testRuntimeClasspath +org.junit.platform:junit-platform-engine:6.1.3=jmhRuntimeClasspath,testRuntimeClasspath +org.junit.platform:junit-platform-launcher:6.1.3=jmhRuntimeClasspath,testRuntimeClasspath +org.junit:junit-bom:6.1.3=jmhRuntimeClasspath,testCompileClasspath,testRuntimeClasspath +org.mockito:mockito-core:5.24.0=jmhRuntimeClasspath,testCompileClasspath,testRuntimeClasspath +org.objenesis:objenesis:3.6=jmhRuntimeClasspath,testCompileClasspath,testRuntimeClasspath org.openjdk.jmh:jmh-core:1.37=jmh,jmhCompileClasspath,jmhRuntimeClasspath org.openjdk.jmh:jmh-generator-annprocess:1.37=jmh,jmhCompileClasspath,jmhRuntimeClasspath -org.openjdk.jmh:jmh-generator-asm:1.25=jmh,jmhCompileClasspath,jmhRuntimeClasspath -org.openjdk.jmh:jmh-generator-bytecode:1.25=jmh,jmhCompileClasspath,jmhRuntimeClasspath -org.openjdk.jmh:jmh-generator-reflection:1.25=jmh,jmhCompileClasspath,jmhRuntimeClasspath +org.openjdk.jmh:jmh-generator-asm:1.37=jmh,jmhCompileClasspath,jmhRuntimeClasspath +org.openjdk.jmh:jmh-generator-bytecode:1.37=jmh,jmhCompileClasspath,jmhRuntimeClasspath +org.openjdk.jmh:jmh-generator-reflection:1.37=jmh,jmhCompileClasspath,jmhRuntimeClasspath org.opentest4j:opentest4j:1.3.0=jmhRuntimeClasspath,testCompileClasspath,testRuntimeClasspath -org.ow2.asm:asm-commons:9.7=jacocoAnt -org.ow2.asm:asm-tree:9.7=jacocoAnt -org.ow2.asm:asm:5.0.3=jmh,jmhCompileClasspath,jmhRuntimeClasspath -org.ow2.asm:asm:9.7=jacocoAnt -org.slf4j:slf4j-api:2.0.16=jmhRuntimeClasspath,testCompileClasspath,testRuntimeClasspath +org.ow2.asm:asm-commons:9.11.1=jacocoAnt +org.ow2.asm:asm-tree:9.11.1=jacocoAnt +org.ow2.asm:asm:9.0=jmh,jmhCompileClasspath,jmhRuntimeClasspath +org.ow2.asm:asm:9.11.1=jacocoAnt +org.slf4j:slf4j-api:2.0.20=jmhRuntimeClasspath,testCompileClasspath,testRuntimeClasspath empty=annotationProcessor,compileClasspath,jmhAnnotationProcessor,runtimeClasspath,signatures,testAnnotationProcessor diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar index a4b76b9..51cbd2a 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 e0fd020..ac5630f 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,7 +1,10 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-8.12-all.zip +distributionSha256Sum=f20c816177c0ff192881874852260771b462903aef3e794b0dac4759d1fda284 +distributionUrl=https\://services.gradle.org/distributions/gradle-9.9.1-all.zip networkTimeout=10000 +retries=0 +retryBackOffMs=500 validateDistributionUrl=true zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/gradlew b/gradlew index f3b75f3..249efbb 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. @@ -20,7 +20,7 @@ ############################################################################## # -# Gradle start up script for POSIX generated by Gradle. +# gradlew start up script for POSIX generated by Gradle. # # Important for running: # @@ -29,7 +29,7 @@ # bash, then to run this script, type that shell name before the whole # command line, like: # -# ksh Gradle +# ksh gradlew # # Busybox and similar reduced shells will NOT work, because this script # requires all of these POSIX shell features: @@ -57,7 +57,7 @@ # Darwin, MinGW, and NonStop. # # (3) This script is generated from the Groovy template -# https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt +# https://github.com/gradle/gradle/blob/3d91ce3b8caaf77ad09f381f43615b715b53f72c/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/. @@ -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. @@ -172,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" ) @@ -205,15 +203,14 @@ fi DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' # Collect all arguments for the java command: -# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments, +# * 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. diff --git a/gradlew.bat b/gradlew.bat index 9b42019..03754c4 100644 --- a/gradlew.bat +++ b/gradlew.bat @@ -19,12 +19,39 @@ @if "%DEBUG%"=="" @echo off @rem ########################################################################## @rem -@rem Gradle startup script for Windows +@rem gradlew startup script for Windows @rem @rem ########################################################################## -@rem Set local scope for the variables with windows NT shell -if "%OS%"=="Windows_NT" setlocal +@rem Set local scope for the variables, and ensure extensions are enabled +setlocal EnableExtensions + +@rem Catch executions from older scripts and ensure they exit cleanly. +@rem This can be removed once we can be reasonably confident that few people +@rem will be migrating directly to this new wrapper. +goto afterSafetyNet +:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +goto exitWithErrorLevel +:afterSafetyNet set DIRNAME=%~dp0 if "%DIRNAME%"=="" set DIRNAME=. @@ -45,13 +72,14 @@ set JAVA_EXE=java.exe %JAVA_EXE% -version >NUL 2>&1 if %ERRORLEVEL% equ 0 goto execute -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 +1>&2 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. -goto fail +"%COMSPEC%" /c exit 1 +goto exitWithErrorLevel :findJavaFromJavaHome set JAVA_HOME=%JAVA_HOME:"=% @@ -59,36 +87,26 @@ set JAVA_EXE=%JAVA_HOME%/bin/java.exe if exist "%JAVA_EXE%" goto execute -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 +1>&2 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. -goto fail +"%COMSPEC%" /c exit 1 +goto exitWithErrorLevel :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 %* +@rem Execute gradlew +@rem endlocal doesn't take effect until after the line is parsed and variables are expanded +@rem which allows us to clear the local environment before executing the java command +endlocal & "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -jar "%APP_HOME%\gradle\wrapper\gradle-wrapper.jar" %* & call :exitWithErrorLevel & goto exitWithErrorLevel -:end -@rem End local scope for the variables with windows NT shell -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! -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 - -:omega +@rem This label must not be changed. We rely on old scripts being able to jump to this point. +:exitWithErrorLevel +@rem Use "%COMSPEC%" /c exit to allow operators to work properly in scripts +"%COMSPEC%" /c exit %ERRORLEVEL%