diff --git a/.sdkmanrc b/.sdkmanrc index 57274d6..814d7dc 100644 --- a/.sdkmanrc +++ b/.sdkmanrc @@ -1,5 +1,5 @@ # Enable auto-env through the sdkman_auto_env config # Add key=value pairs of SDKs to use below -java=17.0.1-tem -gradle=7.3.3 -groovy=3.0.9 +java=17.0.6-tem +gradle=8.2 +groovy=3.0.17 diff --git a/NOTICE b/NOTICE index 0195d56..952ef46 100644 --- a/NOTICE +++ b/NOTICE @@ -1,4 +1,4 @@ -Copyright 2020-2023 University of Oxford and NHS England +Copyright 2020-2024 University of Oxford and NHS England Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/build.gradle b/build.gradle index bec06eb..ad50109 100644 --- a/build.gradle +++ b/build.gradle @@ -3,15 +3,21 @@ import java.nio.file.Files buildscript { repositories { mavenLocal() - maven {url 'https://jenkins.cs.ox.ac.uk/artifactory/plugins-snapshot'} - maven {url 'https://jenkins.cs.ox.ac.uk/artifactory/plugins-release'} - mavenCentral() + maven { url "https://plugins.gradle.org/m2/" } + //mavenCentral() + maven { url "https://mauro-repository.com/libs-release-local" } + maven { + url "https://mauro-repository.com/plugins-release-local" + } + } dependencies { - classpath "uk.ac.ox.softeng.maurodatamapper.gradle:mdm-gradle-plugin:$mdmGradlePluginVersion" + classpath "org.maurodata:mdm-gradle-plugin:1.4.0" } + } + plugins { id 'groovy' id 'java-library' @@ -20,6 +26,14 @@ plugins { apply plugin: 'uk.ac.ox.softeng.maurodatamapper.gradle.mdm-gradle' +repositories { + mavenLocal() + maven { url "https://plugins.gradle.org/m2/" } + mavenCentral() + maven { url "https://mauro-repository.com/libs-release-local" } + +} + // Define new "generation" sourceset for generating the dita library sourceSets { // Source is the generation code and the antlr generated source @@ -61,6 +75,8 @@ license { ]) } + + // Customise the antlr grammer source to output to the "generation/antlr" directory // Standard format of src dirs is "sourcesetname/codetype" generateGrammarSource { @@ -95,22 +111,44 @@ tasks.compileGenerationJava.dependsOn 'generateGrammarSource','replaceTabsWithSp tasks.generateDitaSource.dependsOn 'generationClasses' tasks.compileJava.dependsOn 'generateDitaSource' tasks.sourcesJar.dependsOn 'generateDitaSource' +tasks.licenseGeneration.dependsOn "generateGrammarSource", "generateGenerationGrammarSource", "generateDitaSource" +tasks.licenseTest.dependsOn "generateGrammarSource", "generateGenerationGrammarSource", "generateDitaSource", "generateTestGrammarSource" +tasks.licenseMain.dependsOn "generateDitaSource" +tasks.cpdCheck.dependsOn "generateGrammarSource", "generateGenerationGrammarSource", "generateDitaSource", "generateTestGrammarSource" + checkstyleGeneration{ // Dont bother scanning the generated antlr code exclude '**/ebnf/parser/**' } +codenarc { + configFile = rootProject.file("config/codenarc/codenarc.groovy") + +} + codenarcGeneration { compilationClasspath = sourceSets.generation.compileClasspath + sourceSets.generation.output + // Dont bother scanning the generated code, we've cleaned up most of the issues, the ones remaining are impossible to fix due to the source they're generated from + exclude '**/dita/elements/langref/**' + exclude '**/parser/**' } codenarcMain { compilationClasspath = sourceSets.main.compileClasspath + sourceSets.main.output // Dont bother scanning the generated code, we've cleaned up most of the issues, the ones remaining are impossible to fix due to the source they're generated from exclude '**/dita/elements/langref/**' + exclude '**/parser/**' } +tasks.cpdCheck { + exclude '**/EbnfLexer.java' + exclude '**/EbnfParser.java' + ignoreFailures true +} + + + tasks.spotbugsGeneration{ onlyAnalyze.add('uk.ac.ox.softeng.maurodatamapper.dita.*') } diff --git a/config/codenarc/codenarc.groovy b/config/codenarc/codenarc.groovy new file mode 100644 index 0000000..0b25690 --- /dev/null +++ b/config/codenarc/codenarc.groovy @@ -0,0 +1,452 @@ +ruleset { + + description ''' + A Sample Groovy RuleSet containing all CodeNarc Rules, grouped by category. + You can use this as a template for your own custom RuleSet. + Just delete the rules that you don't want to include. + ''' + + // rulesets/basic.xml + AssertWithinFinallyBlock + AssignmentInConditional + BigDecimalInstantiation + BitwiseOperatorInConditional + BooleanGetBoolean + BrokenNullCheck + BrokenOddnessCheck + ClassForName + ComparisonOfTwoConstants + ComparisonWithSelf + ConstantAssertExpression + ConstantIfExpression + ConstantTernaryExpression + DeadCode + DoubleNegative + DuplicateCaseStatement + DuplicateMapKey + DuplicateSetValue + EmptyCatchBlock + EmptyClass + EmptyElseBlock + EmptyFinallyBlock + EmptyForStatement + EmptyIfStatement + EmptyInstanceInitializer + EmptyMethod + EmptyStaticInitializer + EmptySwitchStatement + EmptySynchronizedStatement + EmptyTryBlock + EmptyWhileStatement + EqualsAndHashCode + EqualsOverloaded + ExplicitGarbageCollection + ForLoopShouldBeWhileLoop + HardCodedWindowsFileSeparator + HardCodedWindowsRootDirectory + IntegerGetInteger + MultipleUnaryOperators + ParameterAssignmentInFilterClosure + RandomDoubleCoercedToZero + RemoveAllOnSelf + ReturnFromFinallyBlock + ThrowExceptionFromFinallyBlock + + // rulesets/braces.xml + ElseBlockBraces + ForStatementBraces + IfStatementBraces + WhileStatementBraces + + // rulesets/comments.xml + ClassJavadoc + JavadocConsecutiveEmptyLines + JavadocEmptyAuthorTag + JavadocEmptyExceptionTag + JavadocEmptyFirstLine + JavadocEmptyLastLine + JavadocEmptyParamTag + JavadocEmptyReturnTag + JavadocEmptySeeTag + JavadocEmptySinceTag + JavadocEmptyThrowsTag + JavadocEmptyVersionTag + JavadocMissingExceptionDescription + JavadocMissingParamDescription + JavadocMissingThrowsDescription + // SpaceAfterCommentDelimiter -- No such rule? + // SpaceBeforeCommentDelimiter -- No such rule? + + // rulesets/concurrency.xml + BusyWait + DoubleCheckedLocking + InconsistentPropertyLocking + InconsistentPropertySynchronization + NestedSynchronization + // NoScriptBindings -- No such rule? + StaticCalendarField + StaticConnection + StaticDateFormatField + StaticMatcherField + StaticSimpleDateFormatField + SynchronizedMethod + SynchronizedOnBoxedPrimitive + SynchronizedOnGetClass + SynchronizedOnReentrantLock + SynchronizedOnString + SynchronizedOnThis + SynchronizedReadObjectMethod + SystemRunFinalizersOnExit + ThisReferenceEscapesConstructor + ThreadGroup + ThreadLocalNotStaticFinal + ThreadYield + UseOfNotifyMethod + VolatileArrayField + VolatileLongOrDoubleField + WaitOutsideOfWhileLoop + + // rulesets/convention.xml + CompileStatic + ConfusingTernary + CouldBeElvis + CouldBeSwitchStatement + FieldTypeRequired + HashtableIsObsolete + IfStatementCouldBeTernary + //ImplicitClosureParameter - use of 'it' can be cleaner than inventing a new parameter name + //ImplicitReturnStatement - we might do this occasionally + InvertedCondition + InvertedIfElse + LongLiteralWithLowerCaseL + MethodParameterTypeRequired + MethodReturnTypeRequired + NoDef + NoDouble + NoFloat + NoJavaUtilDate + NoTabCharacter + ParameterReassignment + PublicMethodsBeforeNonPublicMethods + StaticFieldsBeforeInstanceFields + //StaticMethodsBeforeInstanceMethods - DSL methods may appear in a block after the otherwise useful methods + TernaryCouldBeElvis + TrailingComma + VariableTypeRequired + VectorIsObsolete + + // rulesets/design.xml + AbstractClassWithPublicConstructor + // AbstractClassWithoutAbstractMethod - TODO: commented out because I think abstract is more explicit than a protected constructor + AssignmentToStaticFieldFromInstanceMethod + BooleanMethodReturnsNull + BuilderMethodWithSideEffects + CloneableWithoutClone + CloseWithoutCloseable + CompareToWithoutComparable + ConstantsOnlyInterface + EmptyMethodInAbstractClass + FinalClassWithProtectedMember + ImplementationAsType + Instanceof + LocaleSetDefault + NestedForLoop + OptionalCollectionReturnType + OptionalField + OptionalMethodParameter + PrivateFieldCouldBeFinal + PublicInstanceField + ReturnsNullInsteadOfEmptyArray + ReturnsNullInsteadOfEmptyCollection + SimpleDateFormatMissingLocale + StatelessSingleton + ToStringReturnsNull + + // rulesets/dry.xml + DuplicateListLiteral + DuplicateMapLiteral + DuplicateNumberLiteral + DuplicateStringLiteral + + // rulesets/enhanced.xml + // CloneWithoutCloneable + // JUnitAssertEqualsConstantActualValue + // MissingOverrideAnnotation + // UnsafeImplementationAsMap + + // rulesets/exceptions.xml + CatchArrayIndexOutOfBoundsException + CatchError + CatchException + CatchIllegalMonitorStateException + CatchIndexOutOfBoundsException + CatchNullPointerException + CatchRuntimeException + CatchThrowable + ConfusingClassNamedException + ExceptionExtendsError + ExceptionExtendsThrowable + ExceptionNotThrown + MissingNewInThrowStatement + ReturnNullFromCatchBlock + SwallowThreadDeath + ThrowError + ThrowException + ThrowNullPointerException + ThrowRuntimeException + ThrowThrowable + + // rulesets/formatting.xml + BlankLineBeforePackage + BlockEndsWithBlankLine + BlockStartsWithBlankLine + BracesForClass + BracesForForLoop + BracesForIfElse + BracesForMethod + BracesForTryCatchFinally + //ClassEndsWithBlankLine + //ClassStartsWithBlankLine + ClosureStatementOnOpeningLineOfMultipleLineClosure + ConsecutiveBlankLines + //FileEndsWithoutNewline + Indentation + LineLength + MissingBlankLineAfterImports + MissingBlankLineAfterPackage + MissingBlankLineBeforeAnnotatedField + SpaceAfterCatch + SpaceAfterClosingBrace + SpaceAfterComma + SpaceAfterFor + SpaceAfterIf + SpaceAfterMethodCallName + SpaceAfterMethodDeclarationName + SpaceAfterNotOperator + SpaceAfterOpeningBrace + SpaceAfterSemicolon + SpaceAfterSwitch + SpaceAfterWhile + SpaceAroundClosureArrow + // SpaceAroundMapEntryColon - Not sure I agree with this one + SpaceAroundOperator + SpaceBeforeClosingBrace + SpaceBeforeOpeningBrace + SpaceInsideParentheses + TrailingWhitespace + + // rulesets/generic.xml + IllegalClassMember + IllegalClassReference + IllegalPackageReference + IllegalRegex + IllegalString + IllegalSubclass + RequiredRegex + RequiredString + StatelessClass + + // rulesets/grails.xml + GrailsDomainGormMethods + GrailsDomainHasEquals + GrailsDomainHasToString + GrailsDomainReservedSqlKeywordName + GrailsDomainStringPropertyMaxSize + GrailsDomainWithServiceReference + GrailsDuplicateConstraint + GrailsDuplicateMapping + GrailsMassAssignment + GrailsPublicControllerMethod + GrailsServletContextReference + GrailsStatelessService + + // rulesets/groovyism.xml + AssignCollectionSort + AssignCollectionUnique + ClosureAsLastMethodParameter + CollectAllIsDeprecated + ConfusingMultipleReturns + ExplicitArrayListInstantiation + ExplicitCallToAndMethod + ExplicitCallToCompareToMethod + ExplicitCallToDivMethod + ExplicitCallToEqualsMethod + ExplicitCallToGetAtMethod + ExplicitCallToLeftShiftMethod + ExplicitCallToMinusMethod + ExplicitCallToModMethod + ExplicitCallToMultiplyMethod + ExplicitCallToOrMethod + ExplicitCallToPlusMethod + ExplicitCallToPowerMethod + ExplicitCallToPutAtMethod + ExplicitCallToRightShiftMethod + ExplicitCallToXorMethod + ExplicitHashMapInstantiation + ExplicitHashSetInstantiation + ExplicitLinkedHashMapInstantiation + ExplicitLinkedListInstantiation + ExplicitStackInstantiation + ExplicitTreeSetInstantiation + GStringAsMapKey + GStringExpressionWithinString + GetterMethodCouldBeProperty + GroovyLangImmutable + UseCollectMany + UseCollectNested + + // rulesets/imports.xml + DuplicateImport + ImportFromSamePackage + ImportFromSunPackages + MisorderedStaticImports + NoWildcardImports + UnnecessaryGroovyImport + UnusedImport + + // rulesets/jdbc.xml + DirectConnectionManagement + JdbcConnectionReference + JdbcResultSetReference + JdbcStatementReference + + // rulesets/junit.xml + ChainedTest + CoupledTestCase + JUnitAssertAlwaysFails + JUnitAssertAlwaysSucceeds + JUnitFailWithoutMessage + JUnitLostTest + JUnitPublicField + JUnitPublicNonTestMethod + JUnitPublicProperty + JUnitSetUpCallsSuper + JUnitStyleAssertions + JUnitTearDownCallsSuper + JUnitTestMethodWithoutAssert + JUnitUnnecessarySetUp + JUnitUnnecessaryTearDown + JUnitUnnecessaryThrowsException + SpockIgnoreRestUsed + // SpockMissingAssert -- No such rule? + UnnecessaryFail + UseAssertEqualsInsteadOfAssertTrue + UseAssertFalseInsteadOfNegation + UseAssertNullInsteadOfAssertEquals + UseAssertSameInsteadOfAssertTrue + UseAssertTrueInsteadOfAssertEquals + UseAssertTrueInsteadOfNegation + + // rulesets/logging.xml + LoggerForDifferentClass + LoggerWithWrongModifiers + LoggingSwallowsStacktrace + MultipleLoggers + PrintStackTrace + Println + SystemErrPrint + SystemOutPrint + + // rulesets/naming.xml + AbstractClassName + ClassName + ClassNameSameAsFilename + ClassNameSameAsSuperclass + // ConfusingMethodName - DSL methods are deliberately named the same as properties + // FactoryMethodName - We use "createdBy" as a property name all over the place + FieldName + InterfaceName + InterfaceNameSameAsSuperInterface + MethodName + ObjectOverrideMisspelledMethodName + PackageName + PackageNameMatchesFilePath + ParameterName + PropertyName + VariableName + + // rulesets/security.xml + FileCreateTempFile + InsecureRandom + JavaIoPackageAccess + NonFinalPublicField + NonFinalSubclassOfSensitiveInterface + ObjectFinalize + PublicFinalizeMethod + SystemExit + UnsafeArrayDeclaration + + // rulesets/serialization.xml + EnumCustomSerializationIgnored + SerialPersistentFields + SerialVersionUID + SerializableClassMustDefineSerialVersionUID + + // rulesets/size.xml + // AbcMetric // Requires the GMetrics jar - TODO: commented out for now because it's not currently helpful. + ClassSize + CrapMetric // Requires the GMetrics jar and a Cobertura coverage file + CyclomaticComplexity // Requires the GMetrics jar + MethodCount + MethodSize + NestedBlockDepth + ParameterCount + + // rulesets/unnecessary.xml + AddEmptyString + ConsecutiveLiteralAppends + ConsecutiveStringConcatenation + UnnecessaryBigDecimalInstantiation + UnnecessaryBigIntegerInstantiation + UnnecessaryBooleanExpression + UnnecessaryBooleanInstantiation + UnnecessaryCallForLastElement + UnnecessaryCallToSubstring + UnnecessaryCast + UnnecessaryCatchBlock + // UnnecessaryCollectCall - Not sure * is always easier to read. + UnnecessaryCollectionCall + UnnecessaryConstructor + UnnecessaryDefInFieldDeclaration + UnnecessaryDefInMethodDeclaration + UnnecessaryDefInVariableDeclaration + UnnecessaryDotClass + UnnecessaryDoubleInstantiation + UnnecessaryElseStatement + UnnecessaryFinalOnPrivateMethod + UnnecessaryFloatInstantiation + UnnecessaryGString + UnnecessaryGetter + UnnecessaryIfStatement + UnnecessaryInstanceOfCheck + UnnecessaryInstantiationToGetClass + UnnecessaryIntegerInstantiation + UnnecessaryLongInstantiation + UnnecessaryModOne + UnnecessaryNullCheck + UnnecessaryNullCheckBeforeInstanceOf + UnnecessaryObjectReferences + UnnecessaryOverridingMethod + UnnecessaryPackageReference + UnnecessaryParenthesesForMethodCallWithClosure + UnnecessaryPublicModifier + // UnnecessaryReturnKeyword - We might do this occasionally + UnnecessarySafeNavigationOperator + UnnecessarySelfAssignment + UnnecessarySemicolon + UnnecessarySetter + UnnecessaryStringInstantiation + UnnecessaryTernaryExpression + UnnecessaryToString + UnnecessaryTransientModifier + + // rulesets/unused.xml + UnusedArray + UnusedMethodParameter + UnusedObject + UnusedPrivateField + UnusedPrivateMethod + UnusedPrivateMethodParameter + UnusedVariable + +} \ No newline at end of file diff --git a/dependencies.gradle b/dependencies.gradle index f7bd2a0..5b548cf 100644 --- a/dependencies.gradle +++ b/dependencies.gradle @@ -1,15 +1,15 @@ dependencies { - api platform(group: 'uk.ac.ox.softeng.maurodatamapper', name: 'mdm-bom', version: mdmCoreVersion) +// api platform(group: 'uk.ac.ox.softeng.maurodatamapper', name: 'mdm-bom', version: mdmCoreVersion) antlr group: 'org.antlr', name: 'antlr4', version: antlr4Version api group: 'org.codehaus.groovy', name: 'groovy-all', version: groovyVersion - implementation group: 'org.slf4j', name: 'slf4j-api' + implementation group: 'org.slf4j', name: 'slf4j-api', version: '2.0.14' runtimeOnly group: 'ch.qos.logback', name: 'logback-classic' - api group: 'org.apache.commons', name: 'commons-lang3' + api group: 'org.apache.commons', name: 'commons-lang3', version: '3.15.0' api group: 'commons-io', name: 'commons-io', version: '2.11.0' // Dita dost @@ -102,7 +102,7 @@ dependencies { // For the generation code generationImplementation group: 'org.ccil.cowan.tagsoup', name: 'tagsoup', version: '1.2.1' - testImplementation group: 'org.spockframework', name: 'spock-core' - testImplementation group: 'org.xmlunit', name: 'xmlunit-core' - testImplementation group: 'org.xmlunit', name: 'xmlunit-matchers' + testImplementation group: 'org.spockframework', name: 'spock-core', version: '2.3-groovy-3.0' + testImplementation group: 'org.xmlunit', name: 'xmlunit-core', version: '2.10.0' + testImplementation group: 'org.xmlunit', name: 'xmlunit-matchers', version: '2.10.0' } diff --git a/gradle.properties b/gradle.properties index 62432c4..ac7289f 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,8 +1,8 @@ # Core Info -version=1.0.0-SNAPSHOT -group=uk.ac.ox.softeng.maurodatamapper +version=1.0.0 +group=org.maurodata # Gradle -gradleVersion=7.3.3 +gradleVersion=8.2 org.gradle.jvmargs=-Dfile.encoding=UTF-8 -Xmx2g org.gradle.parallel=true org.gradle.caching=true @@ -10,20 +10,12 @@ org.gradle.caching=true sourceCompatibility=17 targetCompatibility=17 # Deployment & Build -artifactory_contextUrl=https://jenkins.cs.ox.ac.uk/artifactory -mdmGradlePluginVersion=1.3.0 +mdmCoreVersion=5.4.0-SNAPSHOT +mdmGradlePluginVersion=1.4.0 licenseGradlePluginVersion=0.16.1 # Mauro Data Mapper -mdmCoreVersion=5.4.0-SNAPSHOT -# Grails -grailsVersion=5.1.7 -grailsGradlePluginVersion=5.1.4 -groovyVersion=3.0.10 -grailsHibernate5Version=7.2.2 -grailsViewsVersion=2.2.0 -assetPipelineVersion=3.4.6 -jaxbApiVersion=2.3.1 -springBootVersion=2.6.7 +groovyVersion=3.0.17 +oxbrcinformaticsGradlePluginsVersion=8.0 # Addtl batikVersion=1.14 antlr4Version=4.10.1 \ No newline at end of file diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar index 7454180..033e24c 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 2e6e589..bf01c4d 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.3.3-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.2-all.zip +networkTimeout=10000 +validateDistributionUrl=true zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/gradlew b/gradlew index 1b6c787..fcb6fca 100755 --- a/gradlew +++ b/gradlew @@ -55,7 +55,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/subprojects/plugins/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 +80,10 @@ 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"' +APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit # Use the maximum available, or set MAX_FD != -1 to use that value. MAX_FD=maximum @@ -133,22 +130,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=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=SC3045 ulimit -n "$MAX_FD" || warn "Could not set maximum file descriptor limit to $MAX_FD" esac @@ -193,6 +197,10 @@ if "$cygwin" || "$msys" ; then done fi + +# 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 $GRADLE_OPTS can contain fragments of # shell script including quotes and variable substitutions, so put them in @@ -205,6 +213,12 @@ set -- \ org.gradle.wrapper.GradleWrapperMain \ "$@" +# 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 107acd3..93e3f59 100644 --- a/gradlew.bat +++ b/gradlew.bat @@ -14,7 +14,7 @@ @rem limitations under the License. @rem -@if "%DEBUG%" == "" @echo off +@if "%DEBUG%"=="" @echo off @rem ########################################################################## @rem @rem Gradle startup script for Windows @@ -25,7 +25,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,7 +41,7 @@ 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. @@ -75,13 +76,15 @@ set CLASSPATH=%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