@functionland/react-native-fula 1.0.0 → 1.1.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (84) hide show
  1. package/LICENSE +21 -21
  2. package/README.md +190 -133
  3. package/android/.gradle/7.5.1/checksums/checksums.lock +0 -0
  4. package/android/.gradle/7.5.1/checksums/md5-checksums.bin +0 -0
  5. package/android/.gradle/7.5.1/checksums/sha1-checksums.bin +0 -0
  6. package/android/.gradle/7.5.1/dependencies-accessors/dependencies-accessors.lock +0 -0
  7. package/android/.gradle/7.5.1/dependencies-accessors/gc.properties +0 -0
  8. package/android/.gradle/7.5.1/executionHistory/executionHistory.bin +0 -0
  9. package/android/.gradle/7.5.1/executionHistory/executionHistory.lock +0 -0
  10. package/android/.gradle/7.5.1/fileChanges/last-build.bin +0 -0
  11. package/android/.gradle/7.5.1/fileHashes/fileHashes.bin +0 -0
  12. package/android/.gradle/7.5.1/fileHashes/fileHashes.lock +0 -0
  13. package/android/.gradle/7.5.1/fileHashes/resourceHashesCache.bin +0 -0
  14. package/android/.gradle/7.5.1/gc.properties +0 -0
  15. package/android/.gradle/buildOutputCleanup/buildOutputCleanup.lock +0 -0
  16. package/android/.gradle/buildOutputCleanup/cache.properties +2 -2
  17. package/android/.gradle/buildOutputCleanup/outputFiles.bin +0 -0
  18. package/android/.gradle/file-system.probe +0 -0
  19. package/android/.gradle/vcs-1/gc.properties +0 -0
  20. package/android/.idea/compiler.xml +5 -5
  21. package/android/.idea/gradle.xml +18 -17
  22. package/android/.idea/jarRepositories.xml +49 -44
  23. package/android/.idea/misc.xml +9 -9
  24. package/android/.idea/sonarlint/issuestore/index.pb +0 -0
  25. package/android/.idea/vcs.xml +5 -5
  26. package/android/build.gradle +69 -69
  27. package/android/gradle/wrapper/gradle-wrapper.properties +7 -7
  28. package/android/gradle.properties +1 -1
  29. package/android/gradlew +291 -375
  30. package/android/local.properties +8 -8
  31. package/android/src/main/AndroidManifest.xml +4 -4
  32. package/android/src/main/java/land/fx/fula/ConfigRef.java +7 -7
  33. package/android/src/main/java/land/fx/fula/Cryptography.java +47 -47
  34. package/android/src/main/java/land/fx/fula/FulaModule.java +1248 -701
  35. package/android/src/main/java/land/fx/fula/FulaPackage.java +2 -2
  36. package/android/src/main/java/land/fx/fula/SharedPreferenceHelper.java +65 -65
  37. package/android/src/main/java/land/fx/fula/StaticHelper.java +13 -13
  38. package/android/src/main/java/land/fx/fula/ThreadUtils.java +42 -42
  39. package/ios/FulaModule.h +10 -10
  40. package/ios/FulaModule.m +149 -149
  41. package/lib/commonjs/index.js +5 -1
  42. package/lib/commonjs/index.js.map +1 -1
  43. package/lib/commonjs/interfaces/api-lookup.js +1653 -0
  44. package/lib/commonjs/interfaces/api-lookup.js.map +1 -0
  45. package/lib/commonjs/interfaces/fulaNativeModule.js +1 -1
  46. package/lib/commonjs/interfaces/fulaNativeModule.js.map +1 -1
  47. package/lib/commonjs/protocols/blockchain.js +404 -0
  48. package/lib/commonjs/protocols/blockchain.js.map +1 -0
  49. package/lib/commonjs/protocols/chain-api.js +87 -0
  50. package/lib/commonjs/protocols/chain-api.js.map +1 -0
  51. package/lib/commonjs/protocols/fula.js +138 -82
  52. package/lib/commonjs/protocols/fula.js.map +1 -1
  53. package/lib/commonjs/types/blockchain.js +2 -0
  54. package/lib/commonjs/types/blockchain.js.map +1 -0
  55. package/lib/module/index.js +4 -0
  56. package/lib/module/index.js.map +1 -1
  57. package/lib/module/interfaces/api-lookup.js +1648 -0
  58. package/lib/module/interfaces/api-lookup.js.map +1 -0
  59. package/lib/module/interfaces/fulaNativeModule.js +1 -1
  60. package/lib/module/interfaces/fulaNativeModule.js.map +1 -1
  61. package/lib/module/protocols/blockchain.js +383 -0
  62. package/lib/module/protocols/blockchain.js.map +1 -0
  63. package/lib/module/protocols/chain-api.js +76 -0
  64. package/lib/module/protocols/chain-api.js.map +1 -0
  65. package/lib/module/protocols/fula.js +133 -81
  66. package/lib/module/protocols/fula.js.map +1 -1
  67. package/lib/module/types/blockchain.js +2 -0
  68. package/lib/module/types/blockchain.js.map +1 -0
  69. package/lib/typescript/index.d.ts +3 -1
  70. package/lib/typescript/interfaces/api-lookup.d.ts +1643 -0
  71. package/lib/typescript/interfaces/fulaNativeModule.d.ts +57 -28
  72. package/lib/typescript/protocols/blockchain.d.ts +17 -0
  73. package/lib/typescript/protocols/chain-api.d.ts +6 -0
  74. package/lib/typescript/protocols/fula.d.ts +127 -99
  75. package/lib/typescript/types/blockchain.d.ts +68 -0
  76. package/package.json +157 -149
  77. package/react-native-fula.podspec +19 -19
  78. package/src/index.tsx +3 -1
  79. package/src/interfaces/api-lookup.ts +1647 -0
  80. package/src/interfaces/fulaNativeModule.ts +85 -52
  81. package/src/protocols/blockchain.ts +460 -0
  82. package/src/protocols/chain-api.ts +80 -0
  83. package/src/protocols/fula.ts +283 -212
  84. package/src/types/blockchain.ts +81 -0
package/android/gradlew CHANGED
@@ -1,375 +1,291 @@
1
- #!/bin/sh
2
- #!/bin/sh
3
-
4
- #
5
- # Copyright © 2015-2021 the original authors.
6
- # Copyright © 2015-2021 the original authors.
7
- #
8
- # Licensed under the Apache License, Version 2.0 (the "License");
9
- # you may not use this file except in compliance with the License.
10
- # You may obtain a copy of the License at
11
- #
12
- # https://www.apache.org/licenses/LICENSE-2.0
13
- #
14
- # Unless required by applicable law or agreed to in writing, software
15
- # distributed under the License is distributed on an "AS IS" BASIS,
16
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17
- # See the License for the specific language governing permissions and
18
- # limitations under the License.
19
- #
20
-
21
- ##############################################################################
22
- #
23
- # Gradle start up script for POSIX generated by Gradle.
24
- #
25
- # Important for running:
26
- #
27
- # (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is
28
- # noncompliant, but you have some other compliant shell such as ksh or
29
- # bash, then to run this script, type that shell name before the whole
30
- # command line, like:
31
- #
32
- # ksh Gradle
33
- #
34
- # Busybox and similar reduced shells will NOT work, because this script
35
- # requires all of these POSIX shell features:
36
- # * functions;
37
- # * expansions «$var», «${var}», «${var:-default}», «${var+SET}»,
38
- # «${var#prefix}», «${var%suffix}», and «$( cmd )»;
39
- # * compound commands having a testable exit status, especially «case»;
40
- # * various built-in commands including «command», «set», and «ulimit».
41
- #
42
- # Important for patching:
43
- #
44
- # (2) This script targets any POSIX shell, so it avoids extensions provided
45
- # by Bash, Ksh, etc; in particular arrays are avoided.
46
- #
47
- # The "traditional" practice of packing multiple parameters into a
48
- # space-separated string is a well documented source of bugs and security
49
- # problems, so this is (mostly) avoided, by progressively accumulating
50
- # options in "$@", and eventually passing that to Java.
51
- #
52
- # Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS,
53
- # and GRADLE_OPTS) rely on word-splitting, this is performed explicitly;
54
- # see the in-line comments for details.
55
- #
56
- # There are tweaks for specific operating systems such as AIX, CygWin,
57
- # Darwin, MinGW, and NonStop.
58
- #
59
- # (3) This script is generated from the Groovy template
60
- # https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
61
- # within the Gradle project.
62
- #
63
- # You can find Gradle at https://github.com/gradle/gradle/.
64
- #
65
- #
66
- # Gradle start up script for POSIX generated by Gradle.
67
- #
68
- # Important for running:
69
- #
70
- # (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is
71
- # noncompliant, but you have some other compliant shell such as ksh or
72
- # bash, then to run this script, type that shell name before the whole
73
- # command line, like:
74
- #
75
- # ksh Gradle
76
- #
77
- # Busybox and similar reduced shells will NOT work, because this script
78
- # requires all of these POSIX shell features:
79
- # * functions;
80
- # * expansions «$var», «${var}», «${var:-default}», «${var+SET}»,
81
- # «${var#prefix}», «${var%suffix}», and «$( cmd )»;
82
- # * compound commands having a testable exit status, especially «case»;
83
- # * various built-in commands including «command», «set», and «ulimit».
84
- #
85
- # Important for patching:
86
- #
87
- # (2) This script targets any POSIX shell, so it avoids extensions provided
88
- # by Bash, Ksh, etc; in particular arrays are avoided.
89
- #
90
- # The "traditional" practice of packing multiple parameters into a
91
- # space-separated string is a well documented source of bugs and security
92
- # problems, so this is (mostly) avoided, by progressively accumulating
93
- # options in "$@", and eventually passing that to Java.
94
- #
95
- # Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS,
96
- # and GRADLE_OPTS) rely on word-splitting, this is performed explicitly;
97
- # see the in-line comments for details.
98
- #
99
- # There are tweaks for specific operating systems such as AIX, CygWin,
100
- # Darwin, MinGW, and NonStop.
101
- #
102
- # (3) This script is generated from the Groovy template
103
- # https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
104
- # within the Gradle project.
105
- #
106
- # You can find Gradle at https://github.com/gradle/gradle/.
107
- #
108
- ##############################################################################
109
-
110
- # Attempt to set APP_HOME
111
-
112
-
113
- # Resolve links: $0 may be a link
114
- app_path=$0
115
-
116
- # Need this for daisy-chained symlinks.
117
- while
118
- APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path
119
- [ -h "$app_path" ]
120
- do
121
- ls=$( ls -ld "$app_path" )
122
- link=${ls#*' -> '}
123
- case $link in #(
124
- /*) app_path=$link ;; #(
125
- *) app_path=$APP_HOME$link ;;
126
- esac
127
- app_path=$0
128
-
129
- # Need this for daisy-chained symlinks.
130
- while
131
- APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path
132
- [ -h "$app_path" ]
133
- do
134
- ls=$( ls -ld "$app_path" )
135
- link=${ls#*' -> '}
136
- case $link in #(
137
- /*) app_path=$link ;; #(
138
- *) app_path=$APP_HOME$link ;;
139
- esac
140
- done
141
-
142
- APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit
143
-
144
- APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit
145
-
146
- APP_NAME="Gradle"
147
- APP_BASE_NAME=${0##*/}
148
- APP_BASE_NAME=${0##*/}
149
-
150
- # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
151
- DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
152
-
153
- # Use the maximum available, or set MAX_FD != -1 to use that value.
154
- MAX_FD=maximum
155
- MAX_FD=maximum
156
-
157
- warn () {
158
- echo "$*"
159
- } >&2
160
- } >&2
161
-
162
- die () {
163
- echo
164
- echo "$*"
165
- echo
166
- exit 1
167
- } >&2
168
- } >&2
169
-
170
- # OS specific support (must be 'true' or 'false').
171
- cygwin=false
172
- msys=false
173
- darwin=false
174
- nonstop=false
175
- case "$( uname )" in #(
176
- CYGWIN* ) cygwin=true ;; #(
177
- Darwin* ) darwin=true ;; #(
178
- MSYS* | MINGW* ) msys=true ;; #(
179
- NONSTOP* ) nonstop=true ;;
180
- case "$( uname )" in #(
181
- CYGWIN* ) cygwin=true ;; #(
182
- Darwin* ) darwin=true ;; #(
183
- MSYS* | MINGW* ) msys=true ;; #(
184
- NONSTOP* ) nonstop=true ;;
185
- esac
186
-
187
- CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
188
-
189
-
190
-
191
- # Determine the Java command to use to start the JVM.
192
- if [ -n "$JAVA_HOME" ] ; then
193
- if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
194
- # IBM's JDK on AIX uses strange locations for the executables
195
- JAVACMD=$JAVA_HOME/jre/sh/java
196
- JAVACMD=$JAVA_HOME/jre/sh/java
197
- else
198
- JAVACMD=$JAVA_HOME/bin/java
199
- JAVACMD=$JAVA_HOME/bin/java
200
- fi
201
- if [ ! -x "$JAVACMD" ] ; then
202
- die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
203
-
204
- Please set the JAVA_HOME variable in your environment to match the
205
- location of your Java installation."
206
- fi
207
- else
208
- JAVACMD=java
209
- JAVACMD=java
210
- which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
211
-
212
- Please set the JAVA_HOME variable in your environment to match the
213
- location of your Java installation."
214
- fi
215
-
216
- # Increase the maximum file descriptors if we can.
217
- if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
218
- case $MAX_FD in #(
219
- max*)
220
- MAX_FD=$( ulimit -H -n ) ||
221
- warn "Could not query maximum file descriptor limit"
222
- esac
223
- case $MAX_FD in #(
224
- '' | soft) :;; #(
225
- *)
226
- ulimit -n "$MAX_FD" ||
227
- warn "Could not set maximum file descriptor limit to $MAX_FD"
228
- esac
229
- if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
230
- case $MAX_FD in #(
231
- max*)
232
- MAX_FD=$( ulimit -H -n ) ||
233
- warn "Could not query maximum file descriptor limit"
234
- esac
235
- case $MAX_FD in #(
236
- '' | soft) :;; #(
237
- *)
238
- ulimit -n "$MAX_FD" ||
239
- warn "Could not set maximum file descriptor limit to $MAX_FD"
240
- esac
241
- fi
242
-
243
- # Collect all arguments for the java command, stacking in reverse order:
244
- # * args from the command line
245
- # * the main class name
246
- # * -classpath
247
- # * -D...appname settings
248
- # * --module-path (only if needed)
249
- # * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables.
250
- # Collect all arguments for the java command, stacking in reverse order:
251
- # * args from the command line
252
- # * the main class name
253
- # * -classpath
254
- # * -D...appname settings
255
- # * --module-path (only if needed)
256
- # * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables.
257
-
258
- # For Cygwin or MSYS, switch paths to Windows format before running java
259
- if "$cygwin" || "$msys" ; then
260
- APP_HOME=$( cygpath --path --mixed "$APP_HOME" )
261
- CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" )
262
-
263
- JAVACMD=$( cygpath --unix "$JAVACMD" )
264
- if "$cygwin" || "$msys" ; then
265
- APP_HOME=$( cygpath --path --mixed "$APP_HOME" )
266
- CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" )
267
-
268
- JAVACMD=$( cygpath --unix "$JAVACMD" )
269
-
270
- # Now convert the arguments - kludge to limit ourselves to /bin/sh
271
- for arg do
272
- if
273
- case $arg in #(
274
- -*) false ;; # don't mess with options #(
275
- /?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath
276
- [ -e "$t" ] ;; #(
277
- *) false ;;
278
- esac
279
- then
280
- arg=$( cygpath --path --ignore --mixed "$arg" )
281
- for arg do
282
- if
283
- case $arg in #(
284
- -*) false ;; # don't mess with options #(
285
- /?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath
286
- [ -e "$t" ] ;; #(
287
- *) false ;;
288
- esac
289
- then
290
- arg=$( cygpath --path --ignore --mixed "$arg" )
291
- fi
292
- # Roll the args list around exactly as many times as the number of
293
- # args, so each arg winds up back in the position where it started, but
294
- # possibly modified.
295
- #
296
- # NB: a `for` loop captures its iteration list before it begins, so
297
- # changing the positional parameters here affects neither the number of
298
- # iterations, nor the values presented in `arg`.
299
- shift # remove old arg
300
- set -- "$@" "$arg" # push replacement arg
301
- # Roll the args list around exactly as many times as the number of
302
- # args, so each arg winds up back in the position where it started, but
303
- # possibly modified.
304
- #
305
- # NB: a `for` loop captures its iteration list before it begins, so
306
- # changing the positional parameters here affects neither the number of
307
- # iterations, nor the values presented in `arg`.
308
- shift # remove old arg
309
- set -- "$@" "$arg" # push replacement arg
310
- done
311
- fi
312
-
313
- # Collect all arguments for the java command;
314
- # * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of
315
- # shell script including quotes and variable substitutions, so put them in
316
- # double quotes to make sure that they get re-expanded; and
317
- # * put everything else in single quotes, so that it's not re-expanded.
318
-
319
- set -- \
320
- "-Dorg.gradle.appname=$APP_BASE_NAME" \
321
- -classpath "$CLASSPATH" \
322
- org.gradle.wrapper.GradleWrapperMain \
323
- "$@"
324
-
325
- # Stop when "xargs" is not available.
326
- if ! command -v xargs >/dev/null 2>&1
327
- then
328
- die "xargs is not available"
329
- fi
330
-
331
- # Collect all arguments for the java command;
332
- # * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of
333
- # shell script including quotes and variable substitutions, so put them in
334
- # double quotes to make sure that they get re-expanded; and
335
- # * put everything else in single quotes, so that it's not re-expanded.
336
-
337
- set -- \
338
- "-Dorg.gradle.appname=$APP_BASE_NAME" \
339
- -classpath "$CLASSPATH" \
340
- org.gradle.wrapper.GradleWrapperMain \
341
- "$@"
342
-
343
- # Use "xargs" to parse quoted args.
344
- #
345
- # With -n1 it outputs one arg per line, with the quotes and backslashes removed.
346
- #
347
- # In Bash we could simply go:
348
- #
349
- # readarray ARGS < <( xargs -n1 <<<"$var" ) &&
350
- # set -- "${ARGS[@]}" "$@"
351
- #
352
- # but POSIX shell has neither arrays nor command substitution, so instead we
353
- # post-process each arg (as a line of input to sed) to backslash-escape any
354
- # character that might be a shell metacharacter, then use eval to reverse
355
- # that process (while maintaining the separation between arguments), and wrap
356
- # the whole thing up as a single "set" statement.
357
- #
358
- # This will of course break if any of these variables contains a newline or
359
- # an unmatched quote.
360
- #
361
-
362
- eval "set -- $(
363
- printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" |
364
- xargs -n1 |
365
- sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' |
366
- tr '\n' ' '
367
- )" '"$@"'
368
- eval "set -- $(
369
- printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" |
370
- xargs -n1 |
371
- sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' |
372
- tr '\n' ' '
373
- )" '"$@"'
374
-
375
- exec "$JAVACMD" "$@"
1
+ #!/bin/sh
2
+
3
+ #
4
+ # Copyright © 2015-2021 the original authors.
5
+ # Copyright © 2015-2021 the original authors.
6
+ #
7
+ # Licensed under the Apache License, Version 2.0 (the "License");
8
+ # you may not use this file except in compliance with the License.
9
+ # You may obtain a copy of the License at
10
+ #
11
+ # https://www.apache.org/licenses/LICENSE-2.0
12
+ #
13
+ # Unless required by applicable law or agreed to in writing, software
14
+ # distributed under the License is distributed on an "AS IS" BASIS,
15
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
+ # See the License for the specific language governing permissions and
17
+ # limitations under the License.
18
+ #
19
+
20
+ ##############################################################################
21
+ #
22
+ # Gradle start up script for POSIX generated by Gradle.
23
+ #
24
+ # Important for running:
25
+ #
26
+ # (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is
27
+ # noncompliant, but you have some other compliant shell such as ksh or
28
+ # bash, then to run this script, type that shell name before the whole
29
+ # command line, like:
30
+ #
31
+ # ksh Gradle
32
+ #
33
+ # Busybox and similar reduced shells will NOT work, because this script
34
+ # requires all of these POSIX shell features:
35
+ # * functions;
36
+ # * expansions «$var», «${var}», «${var:-default}», «${var+SET}»,
37
+ # «${var#prefix}», «${var%suffix}», and «$( cmd )»;
38
+ # * compound commands having a testable exit status, especially «case»;
39
+ # * various built-in commands including «command», «set», and «ulimit».
40
+ #
41
+ # Important for patching:
42
+ #
43
+ # (2) This script targets any POSIX shell, so it avoids extensions provided
44
+ # by Bash, Ksh, etc; in particular arrays are avoided.
45
+ #
46
+ # The "traditional" practice of packing multiple parameters into a
47
+ # space-separated string is a well documented source of bugs and security
48
+ # problems, so this is (mostly) avoided, by progressively accumulating
49
+ # options in "$@", and eventually passing that to Java.
50
+ #
51
+ # Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS,
52
+ # and GRADLE_OPTS) rely on word-splitting, this is performed explicitly;
53
+ # see the in-line comments for details.
54
+ #
55
+ # There are tweaks for specific operating systems such as AIX, CygWin,
56
+ # Darwin, MinGW, and NonStop.
57
+ #
58
+ # (3) This script is generated from the Groovy template
59
+ # https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
60
+ # within the Gradle project.
61
+ #
62
+ # You can find Gradle at https://github.com/gradle/gradle/.
63
+ #
64
+ #
65
+ # Gradle start up script for POSIX generated by Gradle.
66
+ #
67
+ # Important for running:
68
+ #
69
+ # (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is
70
+ # noncompliant, but you have some other compliant shell such as ksh or
71
+ # bash, then to run this script, type that shell name before the whole
72
+ # command line, like:
73
+ #
74
+ # ksh Gradle
75
+ #
76
+ # Busybox and similar reduced shells will NOT work, because this script
77
+ # requires all of these POSIX shell features:
78
+ # * functions;
79
+ # * expansions «$var», «${var}», «${var:-default}», «${var+SET}»,
80
+ # «${var#prefix}», «${var%suffix}», and «$( cmd )»;
81
+ # * compound commands having a testable exit status, especially «case»;
82
+ # * various built-in commands including «command», «set», and «ulimit».
83
+ #
84
+ # Important for patching:
85
+ #
86
+ # (2) This script targets any POSIX shell, so it avoids extensions provided
87
+ # by Bash, Ksh, etc; in particular arrays are avoided.
88
+ #
89
+ # The "traditional" practice of packing multiple parameters into a
90
+ # space-separated string is a well documented source of bugs and security
91
+ # problems, so this is (mostly) avoided, by progressively accumulating
92
+ # options in "$@", and eventually passing that to Java.
93
+ #
94
+ # Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS,
95
+ # and GRADLE_OPTS) rely on word-splitting, this is performed explicitly;
96
+ # see the in-line comments for details.
97
+ #
98
+ # There are tweaks for specific operating systems such as AIX, CygWin,
99
+ # Darwin, MinGW, and NonStop.
100
+ #
101
+ # (3) This script is generated from the Groovy template
102
+ # https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
103
+ # within the Gradle project.
104
+ #
105
+ # You can find Gradle at https://github.com/gradle/gradle/.
106
+ #
107
+ ##############################################################################
108
+
109
+ # Attempt to set APP_HOME
110
+
111
+
112
+ # Resolve links: $0 may be a link
113
+ app_path=$0
114
+
115
+ # Need this for daisy-chained symlinks.
116
+ while
117
+ APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path
118
+ [ -h "$app_path" ]
119
+ do
120
+ ls=$( ls -ld "$app_path" )
121
+ link=${ls#*' -> '}
122
+ case $link in #(
123
+ /*) app_path=$link ;; #(
124
+ *) app_path=$APP_HOME$link ;;
125
+ esac
126
+ done
127
+ app_path=$0
128
+
129
+
130
+ APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit
131
+
132
+ APP_NAME="Gradle"
133
+ APP_BASE_NAME=${0##*/}
134
+
135
+ # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
136
+ DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
137
+
138
+ # Use the maximum available, or set MAX_FD != -1 to use that value.
139
+ MAX_FD=maximum
140
+ MAX_FD=maximum
141
+
142
+ warn () {
143
+ echo "$*"
144
+ } >&2
145
+
146
+ die () {
147
+ echo
148
+ echo "$*"
149
+ echo
150
+ exit 1
151
+ } >&2
152
+
153
+ # OS specific support (must be 'true' or 'false').
154
+ cygwin=false
155
+ msys=false
156
+ darwin=false
157
+ nonstop=false
158
+ case "$( uname )" in #(
159
+ CYGWIN* ) cygwin=true ;; #(
160
+ Darwin* ) darwin=true ;; #(
161
+ MSYS* | MINGW* ) msys=true ;; #(
162
+ NONSTOP* ) nonstop=true ;;
163
+ esac
164
+
165
+ CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
166
+
167
+
168
+
169
+ # Determine the Java command to use to start the JVM.
170
+ if [ -n "$JAVA_HOME" ] ; then
171
+ if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
172
+ # IBM's JDK on AIX uses strange locations for the executables
173
+ JAVACMD=$JAVA_HOME/jre/sh/java
174
+ JAVACMD=$JAVA_HOME/jre/sh/java
175
+ else
176
+ JAVACMD=$JAVA_HOME/bin/java
177
+ JAVACMD=$JAVA_HOME/bin/java
178
+ fi
179
+ if [ ! -x "$JAVACMD" ] ; then
180
+ die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
181
+
182
+ Please set the JAVA_HOME variable in your environment to match the
183
+ location of your Java installation."
184
+ fi
185
+ else
186
+ JAVACMD=java
187
+ which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
188
+
189
+ Please set the JAVA_HOME variable in your environment to match the
190
+ location of your Java installation."
191
+ fi
192
+
193
+ # Increase the maximum file descriptors if we can.
194
+ if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
195
+ case $MAX_FD in #(
196
+ max*)
197
+ MAX_FD=$( ulimit -H -n ) ||
198
+ warn "Could not query maximum file descriptor limit"
199
+ esac
200
+ case $MAX_FD in #(
201
+ '' | soft) :;; #(
202
+ *)
203
+ ulimit -n "$MAX_FD" ||
204
+ warn "Could not set maximum file descriptor limit to $MAX_FD"
205
+ esac
206
+ fi
207
+
208
+ # Collect all arguments for the java command, stacking in reverse order:
209
+ # * args from the command line
210
+ # * the main class name
211
+ # * -classpath
212
+ # * -D...appname settings
213
+ # * --module-path (only if needed)
214
+ # * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables.
215
+
216
+ # For Cygwin or MSYS, switch paths to Windows format before running java
217
+ if "$cygwin" || "$msys" ; then
218
+ APP_HOME=$( cygpath --path --mixed "$APP_HOME" )
219
+ CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" )
220
+
221
+ JAVACMD=$( cygpath --unix "$JAVACMD" )
222
+
223
+ # Now convert the arguments - kludge to limit ourselves to /bin/sh
224
+ for arg do
225
+ if
226
+ case $arg in #(
227
+ -*) false ;; # don't mess with options #(
228
+ /?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath
229
+ [ -e "$t" ] ;; #(
230
+ *) false ;;
231
+ esac
232
+ then
233
+ arg=$( cygpath --path --ignore --mixed "$arg" )
234
+ fi
235
+ # Roll the args list around exactly as many times as the number of
236
+ # args, so each arg winds up back in the position where it started, but
237
+ # possibly modified.
238
+ #
239
+ # NB: a `for` loop captures its iteration list before it begins, so
240
+ # changing the positional parameters here affects neither the number of
241
+ # iterations, nor the values presented in `arg`.
242
+ shift # remove old arg
243
+ set -- "$@" "$arg" # push replacement arg
244
+ done
245
+ fi
246
+
247
+ # Collect all arguments for the java command;
248
+ # * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of
249
+ # shell script including quotes and variable substitutions, so put them in
250
+ # double quotes to make sure that they get re-expanded; and
251
+ # * put everything else in single quotes, so that it's not re-expanded.
252
+
253
+ set -- \
254
+ "-Dorg.gradle.appname=$APP_BASE_NAME" \
255
+ -classpath "$CLASSPATH" \
256
+ org.gradle.wrapper.GradleWrapperMain \
257
+ "$@"
258
+
259
+ # Stop when "xargs" is not available.
260
+ if ! command -v xargs >/dev/null 2>&1
261
+ then
262
+ die "xargs is not available"
263
+ fi
264
+
265
+
266
+ # Use "xargs" to parse quoted args.
267
+ #
268
+ # With -n1 it outputs one arg per line, with the quotes and backslashes removed.
269
+ #
270
+ # In Bash we could simply go:
271
+ #
272
+ # readarray ARGS < <( xargs -n1 <<<"$var" ) &&
273
+ # set -- "${ARGS[@]}" "$@"
274
+ #
275
+ # but POSIX shell has neither arrays nor command substitution, so instead we
276
+ # post-process each arg (as a line of input to sed) to backslash-escape any
277
+ # character that might be a shell metacharacter, then use eval to reverse
278
+ # that process (while maintaining the separation between arguments), and wrap
279
+ # the whole thing up as a single "set" statement.
280
+ #
281
+ # This will of course break if any of these variables contains a newline or
282
+ # an unmatched quote.
283
+ #
284
+
285
+ eval "set -- $(
286
+ printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" |
287
+ xargs -n1 |
288
+ sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' |
289
+ tr '\n' ' '
290
+ )" '"$@"'
291
+ exec "$JAVACMD" "$@"