gradlew
author Da Risk <da_risk@geekorum.com>
Thu, 24 Apr 2025 18:10:07 -0400
changeset 51 d69bdf1ad491
parent 21 0c6a3ad6b052
permissions -rwxr-xr-x
ui:common: separate BrowserLauncher functionality from ViewModel
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
21
0c6a3ad6b052 build: update gradle
Da Risk <da_risk@geekorum.com>
parents: 0
diff changeset
     1
#!/bin/sh
0
0a13dcabf7d3 Initial commit
fbarthelery <darisk972@gmail.com>
parents:
diff changeset
     2
0a13dcabf7d3 Initial commit
fbarthelery <darisk972@gmail.com>
parents:
diff changeset
     3
#
21
0c6a3ad6b052 build: update gradle
Da Risk <da_risk@geekorum.com>
parents: 0
diff changeset
     4
# Copyright © 2015-2021 the original authors.
0
0a13dcabf7d3 Initial commit
fbarthelery <darisk972@gmail.com>
parents:
diff changeset
     5
#
0a13dcabf7d3 Initial commit
fbarthelery <darisk972@gmail.com>
parents:
diff changeset
     6
# Licensed under the Apache License, Version 2.0 (the "License");
0a13dcabf7d3 Initial commit
fbarthelery <darisk972@gmail.com>
parents:
diff changeset
     7
# you may not use this file except in compliance with the License.
0a13dcabf7d3 Initial commit
fbarthelery <darisk972@gmail.com>
parents:
diff changeset
     8
# You may obtain a copy of the License at
0a13dcabf7d3 Initial commit
fbarthelery <darisk972@gmail.com>
parents:
diff changeset
     9
#
0a13dcabf7d3 Initial commit
fbarthelery <darisk972@gmail.com>
parents:
diff changeset
    10
#      https://www.apache.org/licenses/LICENSE-2.0
0a13dcabf7d3 Initial commit
fbarthelery <darisk972@gmail.com>
parents:
diff changeset
    11
#
0a13dcabf7d3 Initial commit
fbarthelery <darisk972@gmail.com>
parents:
diff changeset
    12
# Unless required by applicable law or agreed to in writing, software
0a13dcabf7d3 Initial commit
fbarthelery <darisk972@gmail.com>
parents:
diff changeset
    13
# distributed under the License is distributed on an "AS IS" BASIS,
0a13dcabf7d3 Initial commit
fbarthelery <darisk972@gmail.com>
parents:
diff changeset
    14
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
0a13dcabf7d3 Initial commit
fbarthelery <darisk972@gmail.com>
parents:
diff changeset
    15
# See the License for the specific language governing permissions and
0a13dcabf7d3 Initial commit
fbarthelery <darisk972@gmail.com>
parents:
diff changeset
    16
# limitations under the License.
0a13dcabf7d3 Initial commit
fbarthelery <darisk972@gmail.com>
parents:
diff changeset
    17
#
21
0c6a3ad6b052 build: update gradle
Da Risk <da_risk@geekorum.com>
parents: 0
diff changeset
    18
# SPDX-License-Identifier: Apache-2.0
0c6a3ad6b052 build: update gradle
Da Risk <da_risk@geekorum.com>
parents: 0
diff changeset
    19
#
0
0a13dcabf7d3 Initial commit
fbarthelery <darisk972@gmail.com>
parents:
diff changeset
    20
0a13dcabf7d3 Initial commit
fbarthelery <darisk972@gmail.com>
parents:
diff changeset
    21
##############################################################################
21
0c6a3ad6b052 build: update gradle
Da Risk <da_risk@geekorum.com>
parents: 0
diff changeset
    22
#
0c6a3ad6b052 build: update gradle
Da Risk <da_risk@geekorum.com>
parents: 0
diff changeset
    23
#   Gradle start up script for POSIX generated by Gradle.
0c6a3ad6b052 build: update gradle
Da Risk <da_risk@geekorum.com>
parents: 0
diff changeset
    24
#
0c6a3ad6b052 build: update gradle
Da Risk <da_risk@geekorum.com>
parents: 0
diff changeset
    25
#   Important for running:
0c6a3ad6b052 build: update gradle
Da Risk <da_risk@geekorum.com>
parents: 0
diff changeset
    26
#
0c6a3ad6b052 build: update gradle
Da Risk <da_risk@geekorum.com>
parents: 0
diff changeset
    27
#   (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is
0c6a3ad6b052 build: update gradle
Da Risk <da_risk@geekorum.com>
parents: 0
diff changeset
    28
#       noncompliant, but you have some other compliant shell such as ksh or
0c6a3ad6b052 build: update gradle
Da Risk <da_risk@geekorum.com>
parents: 0
diff changeset
    29
#       bash, then to run this script, type that shell name before the whole
0c6a3ad6b052 build: update gradle
Da Risk <da_risk@geekorum.com>
parents: 0
diff changeset
    30
#       command line, like:
0c6a3ad6b052 build: update gradle
Da Risk <da_risk@geekorum.com>
parents: 0
diff changeset
    31
#
0c6a3ad6b052 build: update gradle
Da Risk <da_risk@geekorum.com>
parents: 0
diff changeset
    32
#           ksh Gradle
0c6a3ad6b052 build: update gradle
Da Risk <da_risk@geekorum.com>
parents: 0
diff changeset
    33
#
0c6a3ad6b052 build: update gradle
Da Risk <da_risk@geekorum.com>
parents: 0
diff changeset
    34
#       Busybox and similar reduced shells will NOT work, because this script
0c6a3ad6b052 build: update gradle
Da Risk <da_risk@geekorum.com>
parents: 0
diff changeset
    35
#       requires all of these POSIX shell features:
0c6a3ad6b052 build: update gradle
Da Risk <da_risk@geekorum.com>
parents: 0
diff changeset
    36
#         * functions;
0c6a3ad6b052 build: update gradle
Da Risk <da_risk@geekorum.com>
parents: 0
diff changeset
    37
#         * expansions «$var», «${var}», «${var:-default}», «${var+SET}»,
0c6a3ad6b052 build: update gradle
Da Risk <da_risk@geekorum.com>
parents: 0
diff changeset
    38
#           «${var#prefix}», «${var%suffix}», and «$( cmd )»;
0c6a3ad6b052 build: update gradle
Da Risk <da_risk@geekorum.com>
parents: 0
diff changeset
    39
#         * compound commands having a testable exit status, especially «case»;
0c6a3ad6b052 build: update gradle
Da Risk <da_risk@geekorum.com>
parents: 0
diff changeset
    40
#         * various built-in commands including «command», «set», and «ulimit».
0c6a3ad6b052 build: update gradle
Da Risk <da_risk@geekorum.com>
parents: 0
diff changeset
    41
#
0c6a3ad6b052 build: update gradle
Da Risk <da_risk@geekorum.com>
parents: 0
diff changeset
    42
#   Important for patching:
0c6a3ad6b052 build: update gradle
Da Risk <da_risk@geekorum.com>
parents: 0
diff changeset
    43
#
0c6a3ad6b052 build: update gradle
Da Risk <da_risk@geekorum.com>
parents: 0
diff changeset
    44
#   (2) This script targets any POSIX shell, so it avoids extensions provided
0c6a3ad6b052 build: update gradle
Da Risk <da_risk@geekorum.com>
parents: 0
diff changeset
    45
#       by Bash, Ksh, etc; in particular arrays are avoided.
0c6a3ad6b052 build: update gradle
Da Risk <da_risk@geekorum.com>
parents: 0
diff changeset
    46
#
0c6a3ad6b052 build: update gradle
Da Risk <da_risk@geekorum.com>
parents: 0
diff changeset
    47
#       The "traditional" practice of packing multiple parameters into a
0c6a3ad6b052 build: update gradle
Da Risk <da_risk@geekorum.com>
parents: 0
diff changeset
    48
#       space-separated string is a well documented source of bugs and security
0c6a3ad6b052 build: update gradle
Da Risk <da_risk@geekorum.com>
parents: 0
diff changeset
    49
#       problems, so this is (mostly) avoided, by progressively accumulating
0c6a3ad6b052 build: update gradle
Da Risk <da_risk@geekorum.com>
parents: 0
diff changeset
    50
#       options in "$@", and eventually passing that to Java.
0c6a3ad6b052 build: update gradle
Da Risk <da_risk@geekorum.com>
parents: 0
diff changeset
    51
#
0c6a3ad6b052 build: update gradle
Da Risk <da_risk@geekorum.com>
parents: 0
diff changeset
    52
#       Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS,
0c6a3ad6b052 build: update gradle
Da Risk <da_risk@geekorum.com>
parents: 0
diff changeset
    53
#       and GRADLE_OPTS) rely on word-splitting, this is performed explicitly;
0c6a3ad6b052 build: update gradle
Da Risk <da_risk@geekorum.com>
parents: 0
diff changeset
    54
#       see the in-line comments for details.
0c6a3ad6b052 build: update gradle
Da Risk <da_risk@geekorum.com>
parents: 0
diff changeset
    55
#
0c6a3ad6b052 build: update gradle
Da Risk <da_risk@geekorum.com>
parents: 0
diff changeset
    56
#       There are tweaks for specific operating systems such as AIX, CygWin,
0c6a3ad6b052 build: update gradle
Da Risk <da_risk@geekorum.com>
parents: 0
diff changeset
    57
#       Darwin, MinGW, and NonStop.
0c6a3ad6b052 build: update gradle
Da Risk <da_risk@geekorum.com>
parents: 0
diff changeset
    58
#
0c6a3ad6b052 build: update gradle
Da Risk <da_risk@geekorum.com>
parents: 0
diff changeset
    59
#   (3) This script is generated from the Groovy template
0c6a3ad6b052 build: update gradle
Da Risk <da_risk@geekorum.com>
parents: 0
diff changeset
    60
#       https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
0c6a3ad6b052 build: update gradle
Da Risk <da_risk@geekorum.com>
parents: 0
diff changeset
    61
#       within the Gradle project.
0c6a3ad6b052 build: update gradle
Da Risk <da_risk@geekorum.com>
parents: 0
diff changeset
    62
#
0c6a3ad6b052 build: update gradle
Da Risk <da_risk@geekorum.com>
parents: 0
diff changeset
    63
#       You can find Gradle at https://github.com/gradle/gradle/.
0c6a3ad6b052 build: update gradle
Da Risk <da_risk@geekorum.com>
parents: 0
diff changeset
    64
#
0
0a13dcabf7d3 Initial commit
fbarthelery <darisk972@gmail.com>
parents:
diff changeset
    65
##############################################################################
0a13dcabf7d3 Initial commit
fbarthelery <darisk972@gmail.com>
parents:
diff changeset
    66
0a13dcabf7d3 Initial commit
fbarthelery <darisk972@gmail.com>
parents:
diff changeset
    67
# Attempt to set APP_HOME
21
0c6a3ad6b052 build: update gradle
Da Risk <da_risk@geekorum.com>
parents: 0
diff changeset
    68
0
0a13dcabf7d3 Initial commit
fbarthelery <darisk972@gmail.com>
parents:
diff changeset
    69
# Resolve links: $0 may be a link
21
0c6a3ad6b052 build: update gradle
Da Risk <da_risk@geekorum.com>
parents: 0
diff changeset
    70
app_path=$0
0c6a3ad6b052 build: update gradle
Da Risk <da_risk@geekorum.com>
parents: 0
diff changeset
    71
0c6a3ad6b052 build: update gradle
Da Risk <da_risk@geekorum.com>
parents: 0
diff changeset
    72
# Need this for daisy-chained symlinks.
0c6a3ad6b052 build: update gradle
Da Risk <da_risk@geekorum.com>
parents: 0
diff changeset
    73
while
0c6a3ad6b052 build: update gradle
Da Risk <da_risk@geekorum.com>
parents: 0
diff changeset
    74
    APP_HOME=${app_path%"${app_path##*/}"}  # leaves a trailing /; empty if no leading path
0c6a3ad6b052 build: update gradle
Da Risk <da_risk@geekorum.com>
parents: 0
diff changeset
    75
    [ -h "$app_path" ]
0c6a3ad6b052 build: update gradle
Da Risk <da_risk@geekorum.com>
parents: 0
diff changeset
    76
do
0c6a3ad6b052 build: update gradle
Da Risk <da_risk@geekorum.com>
parents: 0
diff changeset
    77
    ls=$( ls -ld "$app_path" )
0c6a3ad6b052 build: update gradle
Da Risk <da_risk@geekorum.com>
parents: 0
diff changeset
    78
    link=${ls#*' -> '}
0c6a3ad6b052 build: update gradle
Da Risk <da_risk@geekorum.com>
parents: 0
diff changeset
    79
    case $link in             #(
0c6a3ad6b052 build: update gradle
Da Risk <da_risk@geekorum.com>
parents: 0
diff changeset
    80
      /*)   app_path=$link ;; #(
0c6a3ad6b052 build: update gradle
Da Risk <da_risk@geekorum.com>
parents: 0
diff changeset
    81
      *)    app_path=$APP_HOME$link ;;
0c6a3ad6b052 build: update gradle
Da Risk <da_risk@geekorum.com>
parents: 0
diff changeset
    82
    esac
0
0a13dcabf7d3 Initial commit
fbarthelery <darisk972@gmail.com>
parents:
diff changeset
    83
done
0a13dcabf7d3 Initial commit
fbarthelery <darisk972@gmail.com>
parents:
diff changeset
    84
21
0c6a3ad6b052 build: update gradle
Da Risk <da_risk@geekorum.com>
parents: 0
diff changeset
    85
# This is normally unused
0c6a3ad6b052 build: update gradle
Da Risk <da_risk@geekorum.com>
parents: 0
diff changeset
    86
# shellcheck disable=SC2034
0c6a3ad6b052 build: update gradle
Da Risk <da_risk@geekorum.com>
parents: 0
diff changeset
    87
APP_BASE_NAME=${0##*/}
0c6a3ad6b052 build: update gradle
Da Risk <da_risk@geekorum.com>
parents: 0
diff changeset
    88
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
0c6a3ad6b052 build: update gradle
Da Risk <da_risk@geekorum.com>
parents: 0
diff changeset
    89
APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s\n' "$PWD" ) || exit
0
0a13dcabf7d3 Initial commit
fbarthelery <darisk972@gmail.com>
parents:
diff changeset
    90
0a13dcabf7d3 Initial commit
fbarthelery <darisk972@gmail.com>
parents:
diff changeset
    91
# Use the maximum available, or set MAX_FD != -1 to use that value.
21
0c6a3ad6b052 build: update gradle
Da Risk <da_risk@geekorum.com>
parents: 0
diff changeset
    92
MAX_FD=maximum
0
0a13dcabf7d3 Initial commit
fbarthelery <darisk972@gmail.com>
parents:
diff changeset
    93
0a13dcabf7d3 Initial commit
fbarthelery <darisk972@gmail.com>
parents:
diff changeset
    94
warn () {
0a13dcabf7d3 Initial commit
fbarthelery <darisk972@gmail.com>
parents:
diff changeset
    95
    echo "$*"
21
0c6a3ad6b052 build: update gradle
Da Risk <da_risk@geekorum.com>
parents: 0
diff changeset
    96
} >&2
0
0a13dcabf7d3 Initial commit
fbarthelery <darisk972@gmail.com>
parents:
diff changeset
    97
0a13dcabf7d3 Initial commit
fbarthelery <darisk972@gmail.com>
parents:
diff changeset
    98
die () {
0a13dcabf7d3 Initial commit
fbarthelery <darisk972@gmail.com>
parents:
diff changeset
    99
    echo
0a13dcabf7d3 Initial commit
fbarthelery <darisk972@gmail.com>
parents:
diff changeset
   100
    echo "$*"
0a13dcabf7d3 Initial commit
fbarthelery <darisk972@gmail.com>
parents:
diff changeset
   101
    echo
0a13dcabf7d3 Initial commit
fbarthelery <darisk972@gmail.com>
parents:
diff changeset
   102
    exit 1
21
0c6a3ad6b052 build: update gradle
Da Risk <da_risk@geekorum.com>
parents: 0
diff changeset
   103
} >&2
0
0a13dcabf7d3 Initial commit
fbarthelery <darisk972@gmail.com>
parents:
diff changeset
   104
0a13dcabf7d3 Initial commit
fbarthelery <darisk972@gmail.com>
parents:
diff changeset
   105
# OS specific support (must be 'true' or 'false').
0a13dcabf7d3 Initial commit
fbarthelery <darisk972@gmail.com>
parents:
diff changeset
   106
cygwin=false
0a13dcabf7d3 Initial commit
fbarthelery <darisk972@gmail.com>
parents:
diff changeset
   107
msys=false
0a13dcabf7d3 Initial commit
fbarthelery <darisk972@gmail.com>
parents:
diff changeset
   108
darwin=false
0a13dcabf7d3 Initial commit
fbarthelery <darisk972@gmail.com>
parents:
diff changeset
   109
nonstop=false
21
0c6a3ad6b052 build: update gradle
Da Risk <da_risk@geekorum.com>
parents: 0
diff changeset
   110
case "$( uname )" in                #(
0c6a3ad6b052 build: update gradle
Da Risk <da_risk@geekorum.com>
parents: 0
diff changeset
   111
  CYGWIN* )         cygwin=true  ;; #(
0c6a3ad6b052 build: update gradle
Da Risk <da_risk@geekorum.com>
parents: 0
diff changeset
   112
  Darwin* )         darwin=true  ;; #(
0c6a3ad6b052 build: update gradle
Da Risk <da_risk@geekorum.com>
parents: 0
diff changeset
   113
  MSYS* | MINGW* )  msys=true    ;; #(
0c6a3ad6b052 build: update gradle
Da Risk <da_risk@geekorum.com>
parents: 0
diff changeset
   114
  NONSTOP* )        nonstop=true ;;
0
0a13dcabf7d3 Initial commit
fbarthelery <darisk972@gmail.com>
parents:
diff changeset
   115
esac
0a13dcabf7d3 Initial commit
fbarthelery <darisk972@gmail.com>
parents:
diff changeset
   116
0a13dcabf7d3 Initial commit
fbarthelery <darisk972@gmail.com>
parents:
diff changeset
   117
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
0a13dcabf7d3 Initial commit
fbarthelery <darisk972@gmail.com>
parents:
diff changeset
   118
0a13dcabf7d3 Initial commit
fbarthelery <darisk972@gmail.com>
parents:
diff changeset
   119
0a13dcabf7d3 Initial commit
fbarthelery <darisk972@gmail.com>
parents:
diff changeset
   120
# Determine the Java command to use to start the JVM.
0a13dcabf7d3 Initial commit
fbarthelery <darisk972@gmail.com>
parents:
diff changeset
   121
if [ -n "$JAVA_HOME" ] ; then
0a13dcabf7d3 Initial commit
fbarthelery <darisk972@gmail.com>
parents:
diff changeset
   122
    if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
0a13dcabf7d3 Initial commit
fbarthelery <darisk972@gmail.com>
parents:
diff changeset
   123
        # IBM's JDK on AIX uses strange locations for the executables
21
0c6a3ad6b052 build: update gradle
Da Risk <da_risk@geekorum.com>
parents: 0
diff changeset
   124
        JAVACMD=$JAVA_HOME/jre/sh/java
0
0a13dcabf7d3 Initial commit
fbarthelery <darisk972@gmail.com>
parents:
diff changeset
   125
    else
21
0c6a3ad6b052 build: update gradle
Da Risk <da_risk@geekorum.com>
parents: 0
diff changeset
   126
        JAVACMD=$JAVA_HOME/bin/java
0
0a13dcabf7d3 Initial commit
fbarthelery <darisk972@gmail.com>
parents:
diff changeset
   127
    fi
0a13dcabf7d3 Initial commit
fbarthelery <darisk972@gmail.com>
parents:
diff changeset
   128
    if [ ! -x "$JAVACMD" ] ; then
0a13dcabf7d3 Initial commit
fbarthelery <darisk972@gmail.com>
parents:
diff changeset
   129
        die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
0a13dcabf7d3 Initial commit
fbarthelery <darisk972@gmail.com>
parents:
diff changeset
   130
0a13dcabf7d3 Initial commit
fbarthelery <darisk972@gmail.com>
parents:
diff changeset
   131
Please set the JAVA_HOME variable in your environment to match the
0a13dcabf7d3 Initial commit
fbarthelery <darisk972@gmail.com>
parents:
diff changeset
   132
location of your Java installation."
0a13dcabf7d3 Initial commit
fbarthelery <darisk972@gmail.com>
parents:
diff changeset
   133
    fi
0a13dcabf7d3 Initial commit
fbarthelery <darisk972@gmail.com>
parents:
diff changeset
   134
else
21
0c6a3ad6b052 build: update gradle
Da Risk <da_risk@geekorum.com>
parents: 0
diff changeset
   135
    JAVACMD=java
0c6a3ad6b052 build: update gradle
Da Risk <da_risk@geekorum.com>
parents: 0
diff changeset
   136
    if ! command -v java >/dev/null 2>&1
0c6a3ad6b052 build: update gradle
Da Risk <da_risk@geekorum.com>
parents: 0
diff changeset
   137
    then
0c6a3ad6b052 build: update gradle
Da Risk <da_risk@geekorum.com>
parents: 0
diff changeset
   138
        die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
0
0a13dcabf7d3 Initial commit
fbarthelery <darisk972@gmail.com>
parents:
diff changeset
   139
0a13dcabf7d3 Initial commit
fbarthelery <darisk972@gmail.com>
parents:
diff changeset
   140
Please set the JAVA_HOME variable in your environment to match the
0a13dcabf7d3 Initial commit
fbarthelery <darisk972@gmail.com>
parents:
diff changeset
   141
location of your Java installation."
0a13dcabf7d3 Initial commit
fbarthelery <darisk972@gmail.com>
parents:
diff changeset
   142
    fi
0a13dcabf7d3 Initial commit
fbarthelery <darisk972@gmail.com>
parents:
diff changeset
   143
fi
0a13dcabf7d3 Initial commit
fbarthelery <darisk972@gmail.com>
parents:
diff changeset
   144
21
0c6a3ad6b052 build: update gradle
Da Risk <da_risk@geekorum.com>
parents: 0
diff changeset
   145
# Increase the maximum file descriptors if we can.
0c6a3ad6b052 build: update gradle
Da Risk <da_risk@geekorum.com>
parents: 0
diff changeset
   146
if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
0c6a3ad6b052 build: update gradle
Da Risk <da_risk@geekorum.com>
parents: 0
diff changeset
   147
    case $MAX_FD in #(
0c6a3ad6b052 build: update gradle
Da Risk <da_risk@geekorum.com>
parents: 0
diff changeset
   148
      max*)
0c6a3ad6b052 build: update gradle
Da Risk <da_risk@geekorum.com>
parents: 0
diff changeset
   149
        # In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
0c6a3ad6b052 build: update gradle
Da Risk <da_risk@geekorum.com>
parents: 0
diff changeset
   150
        # shellcheck disable=SC2039,SC3045
0c6a3ad6b052 build: update gradle
Da Risk <da_risk@geekorum.com>
parents: 0
diff changeset
   151
        MAX_FD=$( ulimit -H -n ) ||
0c6a3ad6b052 build: update gradle
Da Risk <da_risk@geekorum.com>
parents: 0
diff changeset
   152
            warn "Could not query maximum file descriptor limit"
0c6a3ad6b052 build: update gradle
Da Risk <da_risk@geekorum.com>
parents: 0
diff changeset
   153
    esac
0c6a3ad6b052 build: update gradle
Da Risk <da_risk@geekorum.com>
parents: 0
diff changeset
   154
    case $MAX_FD in  #(
0c6a3ad6b052 build: update gradle
Da Risk <da_risk@geekorum.com>
parents: 0
diff changeset
   155
      '' | soft) :;; #(
0c6a3ad6b052 build: update gradle
Da Risk <da_risk@geekorum.com>
parents: 0
diff changeset
   156
      *)
0c6a3ad6b052 build: update gradle
Da Risk <da_risk@geekorum.com>
parents: 0
diff changeset
   157
        # In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
0c6a3ad6b052 build: update gradle
Da Risk <da_risk@geekorum.com>
parents: 0
diff changeset
   158
        # shellcheck disable=SC2039,SC3045
0c6a3ad6b052 build: update gradle
Da Risk <da_risk@geekorum.com>
parents: 0
diff changeset
   159
        ulimit -n "$MAX_FD" ||
0c6a3ad6b052 build: update gradle
Da Risk <da_risk@geekorum.com>
parents: 0
diff changeset
   160
            warn "Could not set maximum file descriptor limit to $MAX_FD"
0
0a13dcabf7d3 Initial commit
fbarthelery <darisk972@gmail.com>
parents:
diff changeset
   161
    esac
0a13dcabf7d3 Initial commit
fbarthelery <darisk972@gmail.com>
parents:
diff changeset
   162
fi
0a13dcabf7d3 Initial commit
fbarthelery <darisk972@gmail.com>
parents:
diff changeset
   163
21
0c6a3ad6b052 build: update gradle
Da Risk <da_risk@geekorum.com>
parents: 0
diff changeset
   164
# Collect all arguments for the java command, stacking in reverse order:
0c6a3ad6b052 build: update gradle
Da Risk <da_risk@geekorum.com>
parents: 0
diff changeset
   165
#   * args from the command line
0c6a3ad6b052 build: update gradle
Da Risk <da_risk@geekorum.com>
parents: 0
diff changeset
   166
#   * the main class name
0c6a3ad6b052 build: update gradle
Da Risk <da_risk@geekorum.com>
parents: 0
diff changeset
   167
#   * -classpath
0c6a3ad6b052 build: update gradle
Da Risk <da_risk@geekorum.com>
parents: 0
diff changeset
   168
#   * -D...appname settings
0c6a3ad6b052 build: update gradle
Da Risk <da_risk@geekorum.com>
parents: 0
diff changeset
   169
#   * --module-path (only if needed)
0c6a3ad6b052 build: update gradle
Da Risk <da_risk@geekorum.com>
parents: 0
diff changeset
   170
#   * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables.
0c6a3ad6b052 build: update gradle
Da Risk <da_risk@geekorum.com>
parents: 0
diff changeset
   171
0c6a3ad6b052 build: update gradle
Da Risk <da_risk@geekorum.com>
parents: 0
diff changeset
   172
# For Cygwin or MSYS, switch paths to Windows format before running java
0c6a3ad6b052 build: update gradle
Da Risk <da_risk@geekorum.com>
parents: 0
diff changeset
   173
if "$cygwin" || "$msys" ; then
0c6a3ad6b052 build: update gradle
Da Risk <da_risk@geekorum.com>
parents: 0
diff changeset
   174
    APP_HOME=$( cygpath --path --mixed "$APP_HOME" )
0c6a3ad6b052 build: update gradle
Da Risk <da_risk@geekorum.com>
parents: 0
diff changeset
   175
    CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" )
0c6a3ad6b052 build: update gradle
Da Risk <da_risk@geekorum.com>
parents: 0
diff changeset
   176
0c6a3ad6b052 build: update gradle
Da Risk <da_risk@geekorum.com>
parents: 0
diff changeset
   177
    JAVACMD=$( cygpath --unix "$JAVACMD" )
0c6a3ad6b052 build: update gradle
Da Risk <da_risk@geekorum.com>
parents: 0
diff changeset
   178
0c6a3ad6b052 build: update gradle
Da Risk <da_risk@geekorum.com>
parents: 0
diff changeset
   179
    # Now convert the arguments - kludge to limit ourselves to /bin/sh
0c6a3ad6b052 build: update gradle
Da Risk <da_risk@geekorum.com>
parents: 0
diff changeset
   180
    for arg do
0c6a3ad6b052 build: update gradle
Da Risk <da_risk@geekorum.com>
parents: 0
diff changeset
   181
        if
0c6a3ad6b052 build: update gradle
Da Risk <da_risk@geekorum.com>
parents: 0
diff changeset
   182
            case $arg in                                #(
0c6a3ad6b052 build: update gradle
Da Risk <da_risk@geekorum.com>
parents: 0
diff changeset
   183
              -*)   false ;;                            # don't mess with options #(
0c6a3ad6b052 build: update gradle
Da Risk <da_risk@geekorum.com>
parents: 0
diff changeset
   184
              /?*)  t=${arg#/} t=/${t%%/*}              # looks like a POSIX filepath
0c6a3ad6b052 build: update gradle
Da Risk <da_risk@geekorum.com>
parents: 0
diff changeset
   185
                    [ -e "$t" ] ;;                      #(
0c6a3ad6b052 build: update gradle
Da Risk <da_risk@geekorum.com>
parents: 0
diff changeset
   186
              *)    false ;;
0c6a3ad6b052 build: update gradle
Da Risk <da_risk@geekorum.com>
parents: 0
diff changeset
   187
            esac
0c6a3ad6b052 build: update gradle
Da Risk <da_risk@geekorum.com>
parents: 0
diff changeset
   188
        then
0c6a3ad6b052 build: update gradle
Da Risk <da_risk@geekorum.com>
parents: 0
diff changeset
   189
            arg=$( cygpath --path --ignore --mixed "$arg" )
0c6a3ad6b052 build: update gradle
Da Risk <da_risk@geekorum.com>
parents: 0
diff changeset
   190
        fi
0c6a3ad6b052 build: update gradle
Da Risk <da_risk@geekorum.com>
parents: 0
diff changeset
   191
        # Roll the args list around exactly as many times as the number of
0c6a3ad6b052 build: update gradle
Da Risk <da_risk@geekorum.com>
parents: 0
diff changeset
   192
        # args, so each arg winds up back in the position where it started, but
0c6a3ad6b052 build: update gradle
Da Risk <da_risk@geekorum.com>
parents: 0
diff changeset
   193
        # possibly modified.
0c6a3ad6b052 build: update gradle
Da Risk <da_risk@geekorum.com>
parents: 0
diff changeset
   194
        #
0c6a3ad6b052 build: update gradle
Da Risk <da_risk@geekorum.com>
parents: 0
diff changeset
   195
        # NB: a `for` loop captures its iteration list before it begins, so
0c6a3ad6b052 build: update gradle
Da Risk <da_risk@geekorum.com>
parents: 0
diff changeset
   196
        # changing the positional parameters here affects neither the number of
0c6a3ad6b052 build: update gradle
Da Risk <da_risk@geekorum.com>
parents: 0
diff changeset
   197
        # iterations, nor the values presented in `arg`.
0c6a3ad6b052 build: update gradle
Da Risk <da_risk@geekorum.com>
parents: 0
diff changeset
   198
        shift                   # remove old arg
0c6a3ad6b052 build: update gradle
Da Risk <da_risk@geekorum.com>
parents: 0
diff changeset
   199
        set -- "$@" "$arg"      # push replacement arg
0c6a3ad6b052 build: update gradle
Da Risk <da_risk@geekorum.com>
parents: 0
diff changeset
   200
    done
0c6a3ad6b052 build: update gradle
Da Risk <da_risk@geekorum.com>
parents: 0
diff changeset
   201
fi
0c6a3ad6b052 build: update gradle
Da Risk <da_risk@geekorum.com>
parents: 0
diff changeset
   202
0c6a3ad6b052 build: update gradle
Da Risk <da_risk@geekorum.com>
parents: 0
diff changeset
   203
0c6a3ad6b052 build: update gradle
Da Risk <da_risk@geekorum.com>
parents: 0
diff changeset
   204
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
0c6a3ad6b052 build: update gradle
Da Risk <da_risk@geekorum.com>
parents: 0
diff changeset
   205
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
0
0a13dcabf7d3 Initial commit
fbarthelery <darisk972@gmail.com>
parents:
diff changeset
   206
21
0c6a3ad6b052 build: update gradle
Da Risk <da_risk@geekorum.com>
parents: 0
diff changeset
   207
# Collect all arguments for the java command:
0c6a3ad6b052 build: update gradle
Da Risk <da_risk@geekorum.com>
parents: 0
diff changeset
   208
#   * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
0c6a3ad6b052 build: update gradle
Da Risk <da_risk@geekorum.com>
parents: 0
diff changeset
   209
#     and any embedded shellness will be escaped.
0c6a3ad6b052 build: update gradle
Da Risk <da_risk@geekorum.com>
parents: 0
diff changeset
   210
#   * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be
0c6a3ad6b052 build: update gradle
Da Risk <da_risk@geekorum.com>
parents: 0
diff changeset
   211
#     treated as '${Hostname}' itself on the command line.
0c6a3ad6b052 build: update gradle
Da Risk <da_risk@geekorum.com>
parents: 0
diff changeset
   212
0c6a3ad6b052 build: update gradle
Da Risk <da_risk@geekorum.com>
parents: 0
diff changeset
   213
set -- \
0c6a3ad6b052 build: update gradle
Da Risk <da_risk@geekorum.com>
parents: 0
diff changeset
   214
        "-Dorg.gradle.appname=$APP_BASE_NAME" \
0c6a3ad6b052 build: update gradle
Da Risk <da_risk@geekorum.com>
parents: 0
diff changeset
   215
        -classpath "$CLASSPATH" \
0c6a3ad6b052 build: update gradle
Da Risk <da_risk@geekorum.com>
parents: 0
diff changeset
   216
        org.gradle.wrapper.GradleWrapperMain \
0c6a3ad6b052 build: update gradle
Da Risk <da_risk@geekorum.com>
parents: 0
diff changeset
   217
        "$@"
0c6a3ad6b052 build: update gradle
Da Risk <da_risk@geekorum.com>
parents: 0
diff changeset
   218
0c6a3ad6b052 build: update gradle
Da Risk <da_risk@geekorum.com>
parents: 0
diff changeset
   219
# Stop when "xargs" is not available.
0c6a3ad6b052 build: update gradle
Da Risk <da_risk@geekorum.com>
parents: 0
diff changeset
   220
if ! command -v xargs >/dev/null 2>&1
0c6a3ad6b052 build: update gradle
Da Risk <da_risk@geekorum.com>
parents: 0
diff changeset
   221
then
0c6a3ad6b052 build: update gradle
Da Risk <da_risk@geekorum.com>
parents: 0
diff changeset
   222
    die "xargs is not available"
0c6a3ad6b052 build: update gradle
Da Risk <da_risk@geekorum.com>
parents: 0
diff changeset
   223
fi
0c6a3ad6b052 build: update gradle
Da Risk <da_risk@geekorum.com>
parents: 0
diff changeset
   224
0c6a3ad6b052 build: update gradle
Da Risk <da_risk@geekorum.com>
parents: 0
diff changeset
   225
# Use "xargs" to parse quoted args.
0c6a3ad6b052 build: update gradle
Da Risk <da_risk@geekorum.com>
parents: 0
diff changeset
   226
#
0c6a3ad6b052 build: update gradle
Da Risk <da_risk@geekorum.com>
parents: 0
diff changeset
   227
# With -n1 it outputs one arg per line, with the quotes and backslashes removed.
0c6a3ad6b052 build: update gradle
Da Risk <da_risk@geekorum.com>
parents: 0
diff changeset
   228
#
0c6a3ad6b052 build: update gradle
Da Risk <da_risk@geekorum.com>
parents: 0
diff changeset
   229
# In Bash we could simply go:
0c6a3ad6b052 build: update gradle
Da Risk <da_risk@geekorum.com>
parents: 0
diff changeset
   230
#
0c6a3ad6b052 build: update gradle
Da Risk <da_risk@geekorum.com>
parents: 0
diff changeset
   231
#   readarray ARGS < <( xargs -n1 <<<"$var" ) &&
0c6a3ad6b052 build: update gradle
Da Risk <da_risk@geekorum.com>
parents: 0
diff changeset
   232
#   set -- "${ARGS[@]}" "$@"
0c6a3ad6b052 build: update gradle
Da Risk <da_risk@geekorum.com>
parents: 0
diff changeset
   233
#
0c6a3ad6b052 build: update gradle
Da Risk <da_risk@geekorum.com>
parents: 0
diff changeset
   234
# but POSIX shell has neither arrays nor command substitution, so instead we
0c6a3ad6b052 build: update gradle
Da Risk <da_risk@geekorum.com>
parents: 0
diff changeset
   235
# post-process each arg (as a line of input to sed) to backslash-escape any
0c6a3ad6b052 build: update gradle
Da Risk <da_risk@geekorum.com>
parents: 0
diff changeset
   236
# character that might be a shell metacharacter, then use eval to reverse
0c6a3ad6b052 build: update gradle
Da Risk <da_risk@geekorum.com>
parents: 0
diff changeset
   237
# that process (while maintaining the separation between arguments), and wrap
0c6a3ad6b052 build: update gradle
Da Risk <da_risk@geekorum.com>
parents: 0
diff changeset
   238
# the whole thing up as a single "set" statement.
0c6a3ad6b052 build: update gradle
Da Risk <da_risk@geekorum.com>
parents: 0
diff changeset
   239
#
0c6a3ad6b052 build: update gradle
Da Risk <da_risk@geekorum.com>
parents: 0
diff changeset
   240
# This will of course break if any of these variables contains a newline or
0c6a3ad6b052 build: update gradle
Da Risk <da_risk@geekorum.com>
parents: 0
diff changeset
   241
# an unmatched quote.
0c6a3ad6b052 build: update gradle
Da Risk <da_risk@geekorum.com>
parents: 0
diff changeset
   242
#
0c6a3ad6b052 build: update gradle
Da Risk <da_risk@geekorum.com>
parents: 0
diff changeset
   243
0c6a3ad6b052 build: update gradle
Da Risk <da_risk@geekorum.com>
parents: 0
diff changeset
   244
eval "set -- $(
0c6a3ad6b052 build: update gradle
Da Risk <da_risk@geekorum.com>
parents: 0
diff changeset
   245
        printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" |
0c6a3ad6b052 build: update gradle
Da Risk <da_risk@geekorum.com>
parents: 0
diff changeset
   246
        xargs -n1 |
0c6a3ad6b052 build: update gradle
Da Risk <da_risk@geekorum.com>
parents: 0
diff changeset
   247
        sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' |
0c6a3ad6b052 build: update gradle
Da Risk <da_risk@geekorum.com>
parents: 0
diff changeset
   248
        tr '\n' ' '
0c6a3ad6b052 build: update gradle
Da Risk <da_risk@geekorum.com>
parents: 0
diff changeset
   249
    )" '"$@"'
0
0a13dcabf7d3 Initial commit
fbarthelery <darisk972@gmail.com>
parents:
diff changeset
   250
0a13dcabf7d3 Initial commit
fbarthelery <darisk972@gmail.com>
parents:
diff changeset
   251
exec "$JAVACMD" "$@"