Skip to content
Snippets Groups Projects
Commit 49194f28 authored by Johannes Mey's avatar Johannes Mey
Browse files

Merge branch 'improvement/dependency-update' into 'dev'

Improvement/dependency update

See merge request !21
parents 699ebb7a a5692f18
No related branches found
No related tags found
1 merge request!21Improvement/dependency update
Pipeline #20711 passed
...@@ -12,7 +12,7 @@ cache: ...@@ -12,7 +12,7 @@ cache:
- .gradle/caches - .gradle/caches
build: build:
image: openjdk:8 image: eclipse-temurin:21
stage: build stage: build
script: script:
- ./gradlew --console=plain --no-daemon assemble fatJar - ./gradlew --console=plain --no-daemon assemble fatJar
...@@ -21,7 +21,7 @@ build: ...@@ -21,7 +21,7 @@ build:
- "/builds/jastadd/relational-rags/build/libs/relast-*.jar" - "/builds/jastadd/relational-rags/build/libs/relast-*.jar"
test: test:
image: openjdk:8 image: eclipse-temurin:21
stage: test stage: test
script: script:
- ./gradlew --console=plain --no-daemon --info test - ./gradlew --console=plain --no-daemon --info test
...@@ -36,22 +36,20 @@ pages: ...@@ -36,22 +36,20 @@ pages:
paths: paths:
- public - public
only: only:
- master
- main - main
publish: publish:
image: openjdk:8 image: eclipse-temurin:21
stage: deploy stage: deploy
needs: needs:
- test - test
script: script:
- "./gradlew publish" - "./gradlew publish"
only: only:
- master
- main - main
publish_dev: publish_dev:
image: openjdk:8 image: eclipse-temurin:21
stage: deploy stage: deploy
needs: needs:
- test - test
...@@ -59,5 +57,4 @@ publish_dev: ...@@ -59,5 +57,4 @@ publish_dev:
- "./gradlew setDevVersionForCI" - "./gradlew setDevVersionForCI"
- "./gradlew publish" - "./gradlew publish"
except: except:
- master
- main - main
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
To propose a new feature, or to report a bug, first [create an issue][create-issue] and add labels accordingly. To propose a new feature, or to report a bug, first [create an issue][create-issue] and add labels accordingly.
Working on such issues is done by creating a merge request from the issue page, which 1) creates a new branch to work on, and 2) creates a new WIP merge request for the new branch. Working on such issues is done by creating a merge request from the issue page, which 1) creates a new branch to work on, and 2) creates a new WIP merge request for the new branch.
Once done (and new tests are written to ensure, a bug is really fixed, and the feature does the right thing), the merge request will be accepted and merged into `develop`. Once done (and new tests are written to ensure, a bug is really fixed, and the feature does the right thing), the merge request will be accepted and merged into `dev`.
# Creating normal test cases # Creating normal test cases
...@@ -73,23 +73,23 @@ The test then ensures, that both output grammars are identical. ...@@ -73,23 +73,23 @@ The test then ensures, that both output grammars are identical.
Important information: Important information:
- Currently, we are publishing to a private Nexus Maven repository only. - Currently, we are publishing to a private Nexus Maven repository only.
- We are using [git-flow][git-flow], so only new merge requests are considered for releases to appear in the `master` branch. - We are using [git-flow][git-flow], so only new merge requests are considered for releases to appear in the `main` branch.
- The version is set in the configuration file [RelASTVersion.properties][RelASTVersion.properties]. - The version is set in the configuration file [RelASTVersion.properties][RelASTVersion.properties].
The workflow: The workflow:
1) Finish your work with the current feature(s) and merge those back in `develop`. 1) Finish your work with the current feature(s) and merge those back in `dev`.
1) Choose a new version number `$nextVersion` depending on the introduced changes **following [semantic versioning][semantic-versioning]**. 1) Choose a new version number `$nextVersion` depending on the introduced changes **following [semantic versioning][semantic-versioning]**.
1) Create a new release branch named `release/$nextVersion` and switch to this branch. 1) Create a new release branch named `release/$nextVersion` and switch to this branch.
1) Set the version number in the config file calling `./gradlew newVersion -Pvalue=$nextVersion` 1) Set the version number in the config file calling `./gradlew newVersion -Pvalue=$nextVersion`
1) Commit this change. 1) Commit this change.
1) (Optional) Build a new jar file calling `./gradlew jar` (this is automatically called in the publish step and only used to test the newly set version number) 1) (Optional) Build a new jar file calling `./gradlew jar` (this is automatically called in the publish step and only used to test the newly set version number)
1) Check, if everything works as planned, e.g., version number is picked up when running the application with `--version`, and all test succeed. 1) Check, if everything works as planned, e.g., version number is picked up when running the application with `--version`, and all test succeed.
1) Merge the release branch into `master` (using a merge request) and also back into `develop`. 1) Merge the release branch into `main` (using a merge request) and also back into `dev`.
1) Delete the release branch. 1) Delete the release branch.
1) [Create a new release][create-release]. Choose the following: 1) [Create a new release][create-release]. Choose the following:
- *Tag name*: the chosen version number - *Tag name*: the chosen version number
- *Create from*: leave the default `master` - *Create from*: leave the default `main`
- *Message*: "Version " and the chose version number - *Message*: "Version " and the chose version number
- *Release notes*: list the (important) changes compared to the last release, prepend a link to the built jar using the line `[:floppy_disk: publish-relast-poc-$nextVersion.jar](/../../../-/jobs/$jobNumber/artifacts/raw/build/libs/publish-relast-poc-$nextVersion.jar?inline=false)` replacing `$jobNumber` with the `jar` job of the pipeline run after the merge request, and `$nextVersion` - *Release notes*: list the (important) changes compared to the last release, prepend a link to the built jar using the line `[:floppy_disk: publish-relast-poc-$nextVersion.jar](/../../../-/jobs/$jobNumber/artifacts/raw/build/libs/publish-relast-poc-$nextVersion.jar?inline=false)` replacing `$jobNumber` with the `jar` job of the pipeline run after the merge request, and `$nextVersion`
1) Publish the built jar to the maven repository calling `./gradlew publish` 1) Publish the built jar to the maven repository calling `./gradlew publish`
......
...@@ -20,12 +20,12 @@ plugins { ...@@ -20,12 +20,12 @@ plugins {
id 'application' id 'application'
id 'idea' id 'idea'
id 'maven-publish' id 'maven-publish'
id 'org.jastadd' version '1.14.5' id 'org.jastadd' version '1.15.0'
} }
apply plugin: PreprocessorPlugin apply plugin: PreprocessorPlugin
java.toolchain.languageVersion = JavaLanguageVersion.of(8) java.toolchain.languageVersion = JavaLanguageVersion.of(21)
ext { ext {
mainClassName = 'org.jastadd.relast.compiler.Compiler' mainClassName = 'org.jastadd.relast.compiler.Compiler'
...@@ -45,12 +45,13 @@ group = 'org.jastadd' ...@@ -45,12 +45,13 @@ group = 'org.jastadd'
application.mainClass = "${mainClassName}" application.mainClass = "${mainClassName}"
dependencies { dependencies {
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.8.2' testImplementation 'org.junit.jupiter:junit-jupiter-api:5.11.3'
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.8.2' testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.11.3'
testImplementation 'org.assertj:assertj-core:3.22.0' testImplementation 'org.assertj:assertj-core:3.26.3'
testImplementation 'com.fasterxml.jackson.core:jackson-core:2.13.1' testImplementation 'com.fasterxml.jackson.core:jackson-core:2.18.2'
testImplementation 'com.fasterxml.jackson.core:jackson-databind:2.13.1' testImplementation 'com.fasterxml.jackson.core:jackson-databind:2.18.2'
api 'org.jastadd:jastadd:2.3.5' testRuntimeOnly 'org.junit.platform:junit-platform-launcher'
api 'org.jastadd:jastadd:2.3.6'
api 'net.sf.beaver:beaver-rt:0.9.11' api 'net.sf.beaver:beaver-rt:0.9.11'
} }
...@@ -73,7 +74,7 @@ try { ...@@ -73,7 +74,7 @@ try {
throw new GradleException("File ${versionFile} not found or unreadable. Aborting.") throw new GradleException("File ${versionFile} not found or unreadable. Aborting.")
} }
task newVersion() { tasks.register('newVersion') {
doFirst { doFirst {
def props = new Properties() def props = new Properties()
props['version'] = value props['version'] = value
...@@ -81,13 +82,13 @@ task newVersion() { ...@@ -81,13 +82,13 @@ task newVersion() {
} }
} }
task printVersion() { tasks.register('printVersion') {
doLast { doLast {
println(version) println(version)
} }
} }
task setDevVersionForCI() { tasks.register('setDevVersionForCI') {
doFirst { doFirst {
def props = new Properties() def props = new Properties()
props['version'] = version + "-$System.env.CI_PIPELINE_IID" props['version'] = version + "-$System.env.CI_PIPELINE_IID"
...@@ -97,7 +98,7 @@ task setDevVersionForCI() { ...@@ -97,7 +98,7 @@ task setDevVersionForCI() {
jar.archiveBaseName = 'relast' jar.archiveBaseName = 'relast'
task fatJar(type: Jar) { tasks.register('fatJar', Jar) {
dependsOn jar dependsOn jar
group = "build" group = "build"
archiveBaseName = 'relast' archiveBaseName = 'relast'
...@@ -179,7 +180,7 @@ publishing { ...@@ -179,7 +180,7 @@ publishing {
} }
} }
task firstRelationsRun(type: RelastTest) { tasks.register('firstRelationsRun', RelastTest) {
relast { relast {
inputFiles = [file('src/test/jastadd/relations/Relations.relast')] inputFiles = [file('src/test/jastadd/relations/Relations.relast')]
grammarName = 'src/test/jastadd/relations/Relations' grammarName = 'src/test/jastadd/relations/Relations'
...@@ -193,7 +194,10 @@ task firstRelationsRun(type: RelastTest) { ...@@ -193,7 +194,10 @@ task firstRelationsRun(type: RelastTest) {
} }
} }
task secondRelationsRun(type: RelastTest, dependsOn: firstRelationsRun) { tasks.register('secondRelationsRun', RelastTest) {
dependsOn firstRelationsRun
dependsOn compileJava
dependsOn processResources
relast { relast {
inputFiles = [file('src/test/jastadd/relations/Relations.ast')] inputFiles = [file('src/test/jastadd/relations/Relations.ast')]
grammarName = 'src/test/jastadd/relations/Relations2' grammarName = 'src/test/jastadd/relations/Relations2'
...@@ -211,7 +215,8 @@ task secondRelationsRun(type: RelastTest, dependsOn: firstRelationsRun) { ...@@ -211,7 +215,8 @@ task secondRelationsRun(type: RelastTest, dependsOn: firstRelationsRun) {
} }
} }
task compileConstructorTest(type: RelastTest) { tasks.register('compileConstructorTest', RelastTest) {
dependsOn secondRelationsRun
relast { relast {
inputFiles = [file('src/test/jastadd/constructors/Constructors.relast')] inputFiles = [file('src/test/jastadd/constructors/Constructors.relast')]
grammarName = 'src/test/jastadd/constructors/Constructors' grammarName = 'src/test/jastadd/constructors/Constructors'
...@@ -223,7 +228,8 @@ task compileConstructorTest(type: RelastTest) { ...@@ -223,7 +228,8 @@ task compileConstructorTest(type: RelastTest) {
} }
} }
task compileDefaultNamesTest(type: RelastTest) { tasks.register('compileDefaultNamesTest', RelastTest) {
dependsOn secondRelationsRun
relast { relast {
inputFiles = [file('src/test/jastadd/relations/Relations.relast')] inputFiles = [file('src/test/jastadd/relations/Relations.relast')]
grammarName = 'src/test/jastadd/relations/Relations3' grammarName = 'src/test/jastadd/relations/Relations3'
...@@ -237,7 +243,8 @@ task compileDefaultNamesTest(type: RelastTest) { ...@@ -237,7 +243,8 @@ task compileDefaultNamesTest(type: RelastTest) {
} }
} }
task compileDefaultNamesResolverTest(type: RelastTest) { tasks.register('compileDefaultNamesResolverTest', RelastTest) {
dependsOn secondRelationsRun
relast { relast {
inputFiles = [file('src/test/jastadd/resolver/Resolver.relast')] inputFiles = [file('src/test/jastadd/resolver/Resolver.relast')]
grammarName = 'src/test/jastadd/resolver/Resolver2' grammarName = 'src/test/jastadd/resolver/Resolver2'
...@@ -251,7 +258,8 @@ task compileDefaultNamesResolverTest(type: RelastTest) { ...@@ -251,7 +258,8 @@ task compileDefaultNamesResolverTest(type: RelastTest) {
} }
} }
task compileLowerBoundsTest(type: RelastTest) { tasks.register('compileLowerBoundsTest', RelastTest) {
dependsOn secondRelationsRun
relast { relast {
inputFiles = [file('src/test/jastadd/lowerbounds/LowerBounds.relast')] inputFiles = [file('src/test/jastadd/lowerbounds/LowerBounds.relast')]
grammarName = 'src/test/jastadd/lowerbounds/LowerBounds' grammarName = 'src/test/jastadd/lowerbounds/LowerBounds'
...@@ -264,7 +272,8 @@ task compileLowerBoundsTest(type: RelastTest) { ...@@ -264,7 +272,8 @@ task compileLowerBoundsTest(type: RelastTest) {
} }
} }
task compileMultipleTest(type: RelastTest) { tasks.register('compileMultipleTest', RelastTest) {
dependsOn secondRelationsRun
relast { relast {
inputFiles = [file('src/test/jastadd/multiple/Part1.relast'), inputFiles = [file('src/test/jastadd/multiple/Part1.relast'),
file('src/test/jastadd/multiple/Part2.relast'), file('src/test/jastadd/multiple/Part2.relast'),
...@@ -279,7 +288,8 @@ task compileMultipleTest(type: RelastTest) { ...@@ -279,7 +288,8 @@ task compileMultipleTest(type: RelastTest) {
} }
} }
task compileMultipleMixedTest(type: RelastTest) { tasks.register('compileMultipleMixedTest', RelastTest) {
dependsOn secondRelationsRun
relast { relast {
inputFiles = [file('src/test/jastadd/multiple-mixed/Part1.relast'), inputFiles = [file('src/test/jastadd/multiple-mixed/Part1.relast'),
file('src/test/jastadd/multiple-mixed/Part2.relast'), file('src/test/jastadd/multiple-mixed/Part2.relast'),
...@@ -294,7 +304,8 @@ task compileMultipleMixedTest(type: RelastTest) { ...@@ -294,7 +304,8 @@ task compileMultipleMixedTest(type: RelastTest) {
} }
} }
task compileResolverTest(type: RelastTest) { tasks.register('compileResolverTest', RelastTest) {
dependsOn secondRelationsRun
relast { relast {
inputFiles = [file('src/test/jastadd/resolver/Resolver.relast')] inputFiles = [file('src/test/jastadd/resolver/Resolver.relast')]
grammarName = 'src/test/jastadd/resolver/Resolver' grammarName = 'src/test/jastadd/resolver/Resolver'
...@@ -308,7 +319,8 @@ task compileResolverTest(type: RelastTest) { ...@@ -308,7 +319,8 @@ task compileResolverTest(type: RelastTest) {
} }
} }
task compileResolver2Test(type: RelastTest) { tasks.register('compileResolver2Test', RelastTest) {
dependsOn secondRelationsRun
relast { relast {
inputFiles = [file('src/test/jastadd/resolver2/Resolver.relast')] inputFiles = [file('src/test/jastadd/resolver2/Resolver.relast')]
grammarName = 'src/test/jastadd/resolver2/Resolver' grammarName = 'src/test/jastadd/resolver2/Resolver'
...@@ -322,7 +334,8 @@ task compileResolver2Test(type: RelastTest) { ...@@ -322,7 +334,8 @@ task compileResolver2Test(type: RelastTest) {
} }
} }
task compileListNamesTest(type: RelastTest) { tasks.register('compileListNamesTest', RelastTest) {
dependsOn secondRelationsRun
relast { relast {
inputFiles = [file('src/test/jastadd/listnames/ListNames.relast')] inputFiles = [file('src/test/jastadd/listnames/ListNames.relast')]
grammarName = 'src/test/jastadd/listnames/ListNames' grammarName = 'src/test/jastadd/listnames/ListNames'
...@@ -337,7 +350,8 @@ task compileListNamesTest(type: RelastTest) { ...@@ -337,7 +350,8 @@ task compileListNamesTest(type: RelastTest) {
} }
} }
task compileSerializerTest(type: RelastTest) { tasks.register('compileSerializerTest', RelastTest) {
dependsOn secondRelationsRun
relast { relast {
inputFiles = [file('src/test/jastadd/serializer/Serializer.relast')] inputFiles = [file('src/test/jastadd/serializer/Serializer.relast')]
grammarName = 'src/test/jastadd/serializer/Serializer' grammarName = 'src/test/jastadd/serializer/Serializer'
...@@ -351,7 +365,8 @@ task compileSerializerTest(type: RelastTest) { ...@@ -351,7 +365,8 @@ task compileSerializerTest(type: RelastTest) {
} }
} }
task compileSerializerDefaultNamesTest(type: RelastTest) { tasks.register('compileSerializerDefaultNamesTest', RelastTest) {
dependsOn secondRelationsRun
relast { relast {
inputFiles = [file('src/test/jastadd/serializer-names/Serializer.relast')] inputFiles = [file('src/test/jastadd/serializer-names/Serializer.relast')]
grammarName = 'src/test/jastadd/serializer-names/Serializer' grammarName = 'src/test/jastadd/serializer-names/Serializer'
...@@ -365,7 +380,8 @@ task compileSerializerDefaultNamesTest(type: RelastTest) { ...@@ -365,7 +380,8 @@ task compileSerializerDefaultNamesTest(type: RelastTest) {
} }
} }
task compileSerializerPointerTest(type: RelastTest) { tasks.register('compileSerializerPointerTest', RelastTest) {
dependsOn secondRelationsRun
relast { relast {
inputFiles = [file('src/test/jastadd/serializer-pointer/Serializer.relast')] inputFiles = [file('src/test/jastadd/serializer-pointer/Serializer.relast')]
grammarName = 'src/test/jastadd/serializer-pointer/Serializer' grammarName = 'src/test/jastadd/serializer-pointer/Serializer'
...@@ -378,7 +394,8 @@ task compileSerializerPointerTest(type: RelastTest) { ...@@ -378,7 +394,8 @@ task compileSerializerPointerTest(type: RelastTest) {
} }
} }
task compileSerializerManualTest(type: RelastTest) { tasks.register('compileSerializerManualTest', RelastTest) {
dependsOn secondRelationsRun
relast { relast {
inputFiles = [file('src/test/jastadd/serializer-manual/Serializer.relast')] inputFiles = [file('src/test/jastadd/serializer-manual/Serializer.relast')]
grammarName = 'src/test/jastadd/serializer-manual/Serializer' grammarName = 'src/test/jastadd/serializer-manual/Serializer'
...@@ -392,7 +409,8 @@ task compileSerializerManualTest(type: RelastTest) { ...@@ -392,7 +409,8 @@ task compileSerializerManualTest(type: RelastTest) {
} }
} }
task compileSerializerManualRelativeTest(type: RelastTest) { tasks.register('compileSerializerManualRelativeTest', RelastTest) {
dependsOn secondRelationsRun
relast { relast {
inputFiles = [file('src/test/jastadd/serializer-manual-relative/Serializer.relast')] inputFiles = [file('src/test/jastadd/serializer-manual-relative/Serializer.relast')]
grammarName = 'src/test/jastadd/serializer-manual-relative/Serializer' grammarName = 'src/test/jastadd/serializer-manual-relative/Serializer'
...@@ -406,7 +424,7 @@ task compileSerializerManualRelativeTest(type: RelastTest) { ...@@ -406,7 +424,7 @@ task compileSerializerManualRelativeTest(type: RelastTest) {
} }
} }
task cleanTestGen(type: Delete) { tasks.register('cleanTestGen', Delete) {
group 'verification' group 'verification'
description 'Cleans all generated test resources' description 'Cleans all generated test resources'
......
No preview for this file type
distributionBase=GRADLE_USER_HOME distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.4-bin.zip distributionUrl=https\://services.gradle.org/distributions/gradle-8.11.1-bin.zip
zipStoreBase=GRADLE_USER_HOME zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists zipStorePath=wrapper/dists
#!/usr/bin/env sh #!/bin/sh
# #
# Copyright 2015 the original author or authors. # Copyright © 2015-2021 the original authors.
# #
# Licensed under the Apache License, Version 2.0 (the "License"); # Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License. # you may not use this file except in compliance with the License.
...@@ -17,67 +17,101 @@ ...@@ -17,67 +17,101 @@
# #
############################################################################## ##############################################################################
## #
## Gradle start up script for UN*X # Gradle start up script for POSIX generated by Gradle.
## #
# Important for running:
#
# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is
# noncompliant, but you have some other compliant shell such as ksh or
# bash, then to run this script, type that shell name before the whole
# command line, like:
#
# ksh Gradle
#
# Busybox and similar reduced shells will NOT work, because this script
# requires all of these POSIX shell features:
# * functions;
# * expansions «$var», «${var}», «${var:-default}», «${var+SET}»,
# «${var#prefix}», «${var%suffix}», and «$( cmd )»;
# * compound commands having a testable exit status, especially «case»;
# * various built-in commands including «command», «set», and «ulimit».
#
# Important for patching:
#
# (2) This script targets any POSIX shell, so it avoids extensions provided
# by Bash, Ksh, etc; in particular arrays are avoided.
#
# The "traditional" practice of packing multiple parameters into a
# space-separated string is a well documented source of bugs and security
# problems, so this is (mostly) avoided, by progressively accumulating
# options in "$@", and eventually passing that to Java.
#
# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS,
# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly;
# see the in-line comments for details.
#
# There are tweaks for specific operating systems such as AIX, CygWin,
# 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
# within the Gradle project.
#
# You can find Gradle at https://github.com/gradle/gradle/.
#
############################################################################## ##############################################################################
# Attempt to set APP_HOME # Attempt to set APP_HOME
# Resolve links: $0 may be a link # Resolve links: $0 may be a link
PRG="$0" app_path=$0
# Need this for relative symlinks.
while [ -h "$PRG" ] ; do # Need this for daisy-chained symlinks.
ls=`ls -ld "$PRG"` while
link=`expr "$ls" : '.*-> \(.*\)$'` APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path
if expr "$link" : '/.*' > /dev/null; then [ -h "$app_path" ]
PRG="$link" do
else ls=$( ls -ld "$app_path" )
PRG=`dirname "$PRG"`"/$link" link=${ls#*' -> '}
fi case $link in #(
/*) app_path=$link ;; #(
*) app_path=$APP_HOME$link ;;
esac
done done
SAVED="`pwd`"
cd "`dirname \"$PRG\"`/" >/dev/null APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit
APP_HOME="`pwd -P`"
cd "$SAVED" >/dev/null
APP_NAME="Gradle" APP_NAME="Gradle"
APP_BASE_NAME=`basename "$0"` 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. # 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"' DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
# Use the maximum available, or set MAX_FD != -1 to use that value. # Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD="maximum" MAX_FD=maximum
warn () { warn () {
echo "$*" echo "$*"
} } >&2
die () { die () {
echo echo
echo "$*" echo "$*"
echo echo
exit 1 exit 1
} } >&2
# OS specific support (must be 'true' or 'false'). # OS specific support (must be 'true' or 'false').
cygwin=false cygwin=false
msys=false msys=false
darwin=false darwin=false
nonstop=false nonstop=false
case "`uname`" in case "$( uname )" in #(
CYGWIN* ) CYGWIN* ) cygwin=true ;; #(
cygwin=true Darwin* ) darwin=true ;; #(
;; MSYS* | MINGW* ) msys=true ;; #(
Darwin* ) NONSTOP* ) nonstop=true ;;
darwin=true
;;
MINGW* )
msys=true
;;
NONSTOP* )
nonstop=true
;;
esac esac
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
...@@ -87,9 +121,9 @@ CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar ...@@ -87,9 +121,9 @@ CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
if [ -n "$JAVA_HOME" ] ; then if [ -n "$JAVA_HOME" ] ; then
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
# IBM's JDK on AIX uses strange locations for the executables # IBM's JDK on AIX uses strange locations for the executables
JAVACMD="$JAVA_HOME/jre/sh/java" JAVACMD=$JAVA_HOME/jre/sh/java
else else
JAVACMD="$JAVA_HOME/bin/java" JAVACMD=$JAVA_HOME/bin/java
fi fi
if [ ! -x "$JAVACMD" ] ; then if [ ! -x "$JAVACMD" ] ; then
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
...@@ -98,7 +132,7 @@ Please set the JAVA_HOME variable in your environment to match the ...@@ -98,7 +132,7 @@ Please set the JAVA_HOME variable in your environment to match the
location of your Java installation." location of your Java installation."
fi fi
else else
JAVACMD="java" 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. which java >/dev/null 2>&1 || 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 Please set the JAVA_HOME variable in your environment to match the
...@@ -106,80 +140,95 @@ location of your Java installation." ...@@ -106,80 +140,95 @@ location of your Java installation."
fi fi
# Increase the maximum file descriptors if we can. # Increase the maximum file descriptors if we can.
if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
MAX_FD_LIMIT=`ulimit -H -n` case $MAX_FD in #(
if [ $? -eq 0 ] ; then max*)
if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then MAX_FD=$( ulimit -H -n ) ||
MAX_FD="$MAX_FD_LIMIT" warn "Could not query maximum file descriptor limit"
fi esac
ulimit -n $MAX_FD case $MAX_FD in #(
if [ $? -ne 0 ] ; then '' | soft) :;; #(
warn "Could not set maximum file descriptor limit: $MAX_FD" *)
fi ulimit -n "$MAX_FD" ||
else warn "Could not set maximum file descriptor limit to $MAX_FD"
warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" esac
fi
fi fi
# For Darwin, add options to specify how the application appears in the dock # Collect all arguments for the java command, stacking in reverse order:
if $darwin; then # * args from the command line
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" # * the main class name
fi # * -classpath
# * -D...appname settings
# * --module-path (only if needed)
# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables.
# For Cygwin or MSYS, switch paths to Windows format before running java # For Cygwin or MSYS, switch paths to Windows format before running java
if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then if "$cygwin" || "$msys" ; then
APP_HOME=`cygpath --path --mixed "$APP_HOME"` APP_HOME=$( cygpath --path --mixed "$APP_HOME" )
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" )
JAVACMD=`cygpath --unix "$JAVACMD"` JAVACMD=$( cygpath --unix "$JAVACMD" )
# We build the pattern for arguments to be converted via cygpath
ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
SEP=""
for dir in $ROOTDIRSRAW ; do
ROOTDIRS="$ROOTDIRS$SEP$dir"
SEP="|"
done
OURCYGPATTERN="(^($ROOTDIRS))"
# Add a user-defined pattern to the cygpath arguments
if [ "$GRADLE_CYGPATTERN" != "" ] ; then
OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
fi
# Now convert the arguments - kludge to limit ourselves to /bin/sh # Now convert the arguments - kludge to limit ourselves to /bin/sh
i=0 for arg do
for arg in "$@" ; do if
CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` case $arg in #(
CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option -*) false ;; # don't mess with options #(
/?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath
if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition [ -e "$t" ] ;; #(
eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` *) false ;;
else esac
eval `echo args$i`="\"$arg\"" then
arg=$( cygpath --path --ignore --mixed "$arg" )
fi fi
i=`expr $i + 1` # Roll the args list around exactly as many times as the number of
# args, so each arg winds up back in the position where it started, but
# possibly modified.
#
# NB: a `for` loop captures its iteration list before it begins, so
# changing the positional parameters here affects neither the number of
# iterations, nor the values presented in `arg`.
shift # remove old arg
set -- "$@" "$arg" # push replacement arg
done done
case $i in
0) set -- ;;
1) set -- "$args0" ;;
2) set -- "$args0" "$args1" ;;
3) set -- "$args0" "$args1" "$args2" ;;
4) set -- "$args0" "$args1" "$args2" "$args3" ;;
5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
esac
fi fi
# Escape application args # Collect all arguments for the java command;
save () { # * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done # shell script including quotes and variable substitutions, so put them in
echo " " # double quotes to make sure that they get re-expanded; and
} # * put everything else in single quotes, so that it's not re-expanded.
APP_ARGS=`save "$@"`
set -- \
"-Dorg.gradle.appname=$APP_BASE_NAME" \
-classpath "$CLASSPATH" \
org.gradle.wrapper.GradleWrapperMain \
"$@"
# Use "xargs" to parse quoted args.
#
# With -n1 it outputs one arg per line, with the quotes and backslashes removed.
#
# In Bash we could simply go:
#
# readarray ARGS < <( xargs -n1 <<<"$var" ) &&
# set -- "${ARGS[@]}" "$@"
#
# but POSIX shell has neither arrays nor command substitution, so instead we
# post-process each arg (as a line of input to sed) to backslash-escape any
# character that might be a shell metacharacter, then use eval to reverse
# that process (while maintaining the separation between arguments), and wrap
# the whole thing up as a single "set" statement.
#
# This will of course break if any of these variables contains a newline or
# an unmatched quote.
#
# Collect all arguments for the java command, following the shell quoting and substitution rules eval "set -- $(
eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" |
xargs -n1 |
sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' |
tr '\n' ' '
)" '"$@"'
exec "$JAVACMD" "$@" exec "$JAVACMD" "$@"
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment