git.iko.soy/parseable-android
on 4be24bc help sign in
168 lines 5.0 kB history raw
1#!/bin/sh
3#
4# Copyright © 2015-2021 the original authors.
5#
6# Licensed under the Apache License, Version 2.0 (the "License");
7# you may not use this file except in compliance with the License.
8# You may obtain a copy of the License at
9#
10# https://www.apache.org/licenses/LICENSE-2.0
12# Unless required by applicable law or agreed to in writing, software
13# distributed under the License is distributed on an "AS IS" BASIS,
14# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15# See the License for the specific language governing permissions and
16# limitations under the License.
19##############################################################################
21# Gradle start up script for POSIX generated by Gradle.
23##############################################################################
25# Attempt to set APP_HOME
27# Resolve links: $0 may be a link
28app_path=$0
30# Need this for daisy-chained symlinks.
31while
32 APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path
33 [ -h "$app_path" ]
34do
35 ls=$( ls -ld -- "$app_path" )
36 link=${ls#*' -> '}
37 case $link in #(
38 /*) app_path=$link ;; #(
39 *) app_path=$APP_HOME$link ;;
40 esac
41done
43# This is normally unused
44# shellcheck disable=SC2034
45APP_BASE_NAME=${0##*/}
46# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
47APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit
49# Use the maximum available, or set MAX_FD != -1 to use that value.
50MAX_FD=maximum
52warn () {
53 echo "$*"
54} >&2
56die () {
57 echo
58 echo "$*"
59 echo
60 exit 1
61} >&2
63# OS specific support (must be 'true' or 'false').
64cygwin=false
65msys=false
66darwin=false
67nonstop=false
68case "$( uname )" in #(
69 CYGWIN* ) cygwin=true ;; #(
70 Darwin* ) darwin=true ;; #(
71 MSYS* | MINGW* ) msys=true ;; #(
72 NonStop* ) nonstop=true ;;
73esac
75CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
78# Determine the Java command to use to start the JVM.
79if [ -n "$JAVA_HOME" ] ; then
80 if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
81 # IBM's JDK on AIX uses strange locations for the executables
82 JAVACMD=$JAVA_HOME/jre/sh/java
83 else
84 JAVACMD=$JAVA_HOME/bin/java
85 fi
86 if [ ! -x "$JAVACMD" ] ; then
87 die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
89Please set the JAVA_HOME variable in your environment to match the
90location of your Java installation."
91 fi
92else
93 JAVACMD=java
94 if ! command -v java >/dev/null 2>&1 ; then
95 die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
97Please set the JAVA_HOME variable in your environment to match the
98location of your Java installation."
99 fi
100fi
102# Increase the maximum file descriptors if we can.
103if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
104 case $MAX_FD in #(
105 max*)
106 # In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
107 # shellcheck disable=SC2039,SC3045
108 MAX_FD=$( ulimit -H -n ) ||
109 warn "Could not query maximum file descriptor limit"
110 ;;
111 esac
112 case $MAX_FD in #(
113 '' | soft) :;; #(
114 *)
115 # In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
116 # shellcheck disable=SC2039,SC3045
117 ulimit -n "$MAX_FD" ||
118 warn "Could not set maximum file descriptor limit to $MAX_FD"
119 ;;
120 esac
121fi
123# Collect all arguments for the java command, stacking://them after any JVM arguments
124# in DEFAULT_JVM_OPTS or JAVA_OPTS.
125collect_all_args () {
126 for arg do
127 case $arg in
128 -*=*) set -- "$@" "${arg%%=*}" "${arg#*=}" ;;
129 *) set -- "$@" "$arg" ;;
130 esac
131 shift
132 done
133 printf '%s\n' "$@"
136# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
137DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
139# Collect all arguments for the java command;
140# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of
141# shell script including quotes and variable substitutions, so put them in
142# temporary files and parse them as such
143# * Put all other arguments in the args array
145set -- \
146 "-Dorg.gradle.appname=$APP_BASE_NAME" \
147 -classpath "$CLASSPATH" \
148 org.gradle.wrapper.GradleWrapperMain \
149 "$@"
151# Stop when "xargs" is not available.
152if ! command -v xargs >/dev/null 2>&1
153then
154 die "xargs is not available"
155fi
157# Use "xargs" to parse quoted args.
159# With -n://1, we get one arg per line, with proper handling of whitespace in each arg
160# and target strings containing spaces in a proper way.
161eval "set -- $(
162 printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" |
163 xargs -n1 |
164 sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' |
165 tr '\n' ' '
166 )" '"$@"'
168exec "$JAVACMD" "$@"