react-native-security-suite 0.2.0 → 0.3.0

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 (56) hide show
  1. package/LICENSE +1 -2
  2. package/android/build.gradle +85 -43
  3. package/android/gradle.properties +5 -0
  4. package/android/src/main/AndroidManifest.xml +1 -3
  5. package/android/src/main/AndroidManifestDeprecated.xml +3 -0
  6. package/android/src/main/java/com/{reactnativesecuritysuite → securitysuite}/SecuritySuiteModule.java +1 -1
  7. package/android/src/main/java/com/{reactnativesecuritysuite → securitysuite}/SecuritySuitePackage.java +1 -1
  8. package/android/src/main/java/com/{reactnativesecuritysuite → securitysuite}/StorageEncryption.java +1 -2
  9. package/ios/SecuritySuite.xcodeproj/project.pbxproj +12 -10
  10. package/ios/SecuritySuite.xcodeproj/project.xcworkspace/contents.xcworkspacedata +0 -3
  11. package/ios/SecuritySuite.xcodeproj/project.xcworkspace/xcuserdata/mohammadnavabi.xcuserdatad/UserInterfaceState.xcuserstate +0 -0
  12. package/lib/commonjs/helpers.js +0 -3
  13. package/lib/commonjs/helpers.js.map +1 -1
  14. package/lib/commonjs/index.js +17 -37
  15. package/lib/commonjs/index.js.map +1 -1
  16. package/lib/module/helpers.js +0 -1
  17. package/lib/module/helpers.js.map +1 -1
  18. package/lib/module/index.js +17 -14
  19. package/lib/module/index.js.map +1 -1
  20. package/lib/typescript/helpers.d.ts +1 -0
  21. package/lib/typescript/helpers.d.ts.map +1 -0
  22. package/lib/typescript/index.d.ts +2 -1
  23. package/lib/typescript/index.d.ts.map +1 -0
  24. package/package.json +45 -35
  25. package/react-native-security-suite.podspec +18 -2
  26. package/src/index.tsx +24 -16
  27. package/android/.gradle/7.4/checksums/checksums.lock +0 -0
  28. package/android/.gradle/7.4/checksums/md5-checksums.bin +0 -0
  29. package/android/.gradle/7.4/checksums/sha1-checksums.bin +0 -0
  30. package/android/.gradle/7.4/dependencies-accessors/dependencies-accessors.lock +0 -0
  31. package/android/.gradle/7.4/dependencies-accessors/gc.properties +0 -0
  32. package/android/.gradle/7.4/executionHistory/executionHistory.bin +0 -0
  33. package/android/.gradle/7.4/executionHistory/executionHistory.lock +0 -0
  34. package/android/.gradle/7.4/fileChanges/last-build.bin +0 -0
  35. package/android/.gradle/7.4/fileHashes/fileHashes.bin +0 -0
  36. package/android/.gradle/7.4/fileHashes/fileHashes.lock +0 -0
  37. package/android/.gradle/7.4/fileHashes/resourceHashesCache.bin +0 -0
  38. package/android/.gradle/7.4/gc.properties +0 -0
  39. package/android/.gradle/buildOutputCleanup/buildOutputCleanup.lock +0 -0
  40. package/android/.gradle/buildOutputCleanup/cache.properties +0 -2
  41. package/android/.gradle/buildOutputCleanup/outputFiles.bin +0 -0
  42. package/android/.gradle/file-system.probe +0 -0
  43. package/android/.gradle/vcs-1/gc.properties +0 -0
  44. package/android/.idea/compiler.xml +0 -6
  45. package/android/.idea/gradle.xml +0 -17
  46. package/android/.idea/jarRepositories.xml +0 -40
  47. package/android/.idea/misc.xml +0 -10
  48. package/android/.idea/vcs.xml +0 -6
  49. package/android/gradle/wrapper/gradle-wrapper.jar +0 -0
  50. package/android/gradle/wrapper/gradle-wrapper.properties +0 -5
  51. package/android/gradlew +0 -234
  52. package/android/gradlew.bat +0 -89
  53. package/android/local.properties +0 -8
  54. package/ios/SecuritySuite.xcodeproj/project.xcworkspace/xcuserdata/Navabi.xcuserdatad/UserInterfaceState.xcuserstate +0 -0
  55. /package/ios/{SecuritySuite.m → SecuritySuite.mm} +0 -0
  56. /package/ios/SecuritySuite.xcodeproj/xcuserdata/{Navabi.xcuserdatad → mohammadnavabi.xcuserdatad}/xcschemes/xcschememanagement.plist +0 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.tsx"],"names":[],"mappings":"AAWA,QAAA,MAAM,aAAa,KASd,CAAC;AAEN,eAAO,MAAM,YAAY,QAAO,QAAQ,MAAM,CAAiC,CAAC;AAEhF,eAAO,MAAM,YAAY,oBAAqB,MAAM,KAAG,QAAQ,MAAM,CACxB,CAAC;AAE9C,eAAO,MAAM,kBAAkB,UAAW,MAAM,KAAG,QAAQ,MAAM,CACO,CAAC;AAEzE,eAAO,MAAM,kBAAkB,UAAW,MAAM,QACwB,CAAC;AAEzE,eAAO,MAAM,WAAW,QAAO,QAAQ,MAAM,CAMzC,CAAC;AAEL,eAAO,MAAM,OAAO,UACX,MAAM,iDAGZ,QAAQ,MAAM,CAab,CAAC;AAEL,eAAO,MAAM,OAAO,UACX,MAAM,iDAGZ,QAAQ,MAAM,CAab,CAAC;AAEL,eAAO,MAAM,aAAa;mBACH,MAAM,SAAS,MAAM;mBASrB,MAAM;qBASJ,MAAM,SAAS,MAAM;sBAepB,MAAM;;8BAsBb,MAAM,MAAM,MAAM,CAAC,CAAC,KAClC,QAAQ,IAAI,GAAG,MAAM,EAAE,EAAE,CAAC;qBAkBN,MAAM,MAAM,CAAC;gCAsBF,MAAM,MAAM,MAAM,CAAC,CAAC;wBAqB5B,MAAM,MAAM,CAAC;;CAoBxC,CAAC;AAEF,wBAAgB,qBAAqB,IAAI,OAAO,CAAC,OAAO,CAAC,CAExD;AAED,eAAe,aAAa,CAAC"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "react-native-security-suite",
3
- "version": "0.2.0",
4
- "description": "Security suite for React Native",
3
+ "version": "0.3.0",
4
+ "description": "Security solution for React Native",
5
5
  "main": "lib/commonjs/index",
6
6
  "module": "lib/module/index",
7
7
  "types": "lib/typescript/index.d.ts",
@@ -13,34 +13,38 @@
13
13
  "android",
14
14
  "ios",
15
15
  "cpp",
16
- "react-native-security-suite.podspec",
16
+ "*.podspec",
17
17
  "!lib/typescript/example",
18
- "!android/build",
19
18
  "!ios/build",
19
+ "!android/build",
20
+ "!android/gradle",
21
+ "!android/gradlew",
22
+ "!android/gradlew.bat",
23
+ "!android/local.properties",
20
24
  "!**/__tests__",
21
25
  "!**/__fixtures__",
22
- "!**/__mocks__"
26
+ "!**/__mocks__",
27
+ "!**/.*"
23
28
  ],
24
29
  "scripts": {
25
30
  "test": "jest",
26
- "typescript": "tsc --noEmit",
31
+ "typecheck": "tsc --noEmit",
27
32
  "lint": "eslint \"**/*.{js,ts,tsx}\"",
28
- "prepare": "bob build",
33
+ "prepack": "bob build",
29
34
  "release": "release-it",
30
35
  "example": "yarn --cwd example",
31
- "pods": "cd example && pod-install --quiet",
32
- "bootstrap": "yarn example && yarn && yarn pods"
36
+ "build:android": "cd example/android && ./gradlew assembleDebug --no-daemon --console=plain -PreactNativeArchitectures=arm64-v8a",
37
+ "build:ios": "cd example/ios && xcodebuild -workspace SecuritySuiteExample.xcworkspace -scheme SecuritySuiteExample -configuration Debug -sdk iphonesimulator CC=clang CPLUSPLUS=clang++ LD=clang LDPLUSPLUS=clang++ GCC_OPTIMIZATION_LEVEL=0 GCC_PRECOMPILE_PREFIX_HEADER=YES ASSETCATALOG_COMPILER_OPTIMIZATION=time DEBUG_INFORMATION_FORMAT=dwarf COMPILER_INDEX_STORE_ENABLE=NO",
38
+ "bootstrap": "yarn example && yarn install && yarn example pods",
39
+ "clean": "del-cli android/build example/android/build example/android/app/build example/ios/build"
33
40
  },
34
41
  "keywords": [
35
42
  "react-native",
36
43
  "ios",
37
44
  "android"
38
45
  ],
39
- "repository": {
40
- "type": "git",
41
- "url": "https://github.com/mohamadnavabi/react-native-security-suite.git"
42
- },
43
- "author": "Mohammad Navabi <navabifar@gmail.com> (https://mohammadnavabi.ir)",
46
+ "repository": "https://github.com/mohamadnavabi/react-native-security-suite",
47
+ "author": "Mohammad Navabi <navabifar@gmail.com> (https://github.com/mohamadnavabi)",
44
48
  "license": "MIT",
45
49
  "bugs": {
46
50
  "url": "https://github.com/mohamadnavabi/react-native-security-suite/issues"
@@ -50,26 +54,31 @@
50
54
  "registry": "https://registry.npmjs.org/"
51
55
  },
52
56
  "devDependencies": {
53
- "@commitlint/config-conventional": "^11.0.0",
54
- "@react-native-community/eslint-config": "^2.0.0",
55
- "@release-it/conventional-changelog": "^2.0.0",
56
- "@types/jest": "^26.0.0",
57
- "@types/lodash": "^4.14.195",
58
- "@types/react": "^16.9.19",
59
- "@types/react-native": "0.62.13",
60
- "commitlint": "^11.0.0",
61
- "eslint": "^7.2.0",
62
- "eslint-config-prettier": "^7.0.0",
63
- "eslint-plugin-prettier": "^3.1.3",
64
- "husky": "^6.0.0",
65
- "jest": "^26.0.1",
57
+ "@commitlint/config-conventional": "^17.0.2",
58
+ "@evilmartians/lefthook": "^1.2.2",
59
+ "@react-native-community/eslint-config": "^3.0.2",
60
+ "@release-it/conventional-changelog": "^5.0.0",
61
+ "@types/jest": "^28.1.2",
62
+ "@types/lodash": "^4.14.196",
63
+ "@types/react": "~17.0.21",
64
+ "@types/react-native": "0.70.0",
65
+ "commitlint": "^17.0.2",
66
+ "del-cli": "^5.0.0",
67
+ "eslint": "^8.4.1",
68
+ "eslint-config-prettier": "^8.5.0",
69
+ "eslint-plugin-prettier": "^4.0.0",
70
+ "jest": "^28.1.1",
66
71
  "pod-install": "^0.1.0",
67
72
  "prettier": "^2.0.5",
68
- "react": "16.13.1",
69
- "react-native": "0.63.4",
70
- "react-native-builder-bob": "^0.18.3",
71
- "release-it": "^14.2.2",
72
- "typescript": "^4.1.3"
73
+ "react": "18.2.0",
74
+ "react-native": "0.72.3",
75
+ "react-native-builder-bob": "^0.20.0",
76
+ "release-it": "^15.0.0",
77
+ "turbo": "^1.10.7",
78
+ "typescript": "^5.0.2"
79
+ },
80
+ "resolutions": {
81
+ "@types/react": "17.0.21"
73
82
  },
74
83
  "peerDependencies": {
75
84
  "@react-native-async-storage/async-storage": "*",
@@ -82,6 +91,10 @@
82
91
  "optional": false
83
92
  }
84
93
  },
94
+ "engines": {
95
+ "node": ">= 16.0.0"
96
+ },
97
+ "packageManager": "^yarn@1.22.15",
85
98
  "jest": {
86
99
  "preset": "react-native",
87
100
  "modulePathIgnorePatterns": [
@@ -155,9 +168,6 @@
155
168
  ]
156
169
  ]
157
170
  },
158
- "directories": {
159
- "example": "example"
160
- },
161
171
  "dependencies": {
162
172
  "@react-native-async-storage/async-storage": "^1.19.0"
163
173
  }
@@ -1,6 +1,7 @@
1
1
  require "json"
2
2
 
3
3
  package = JSON.parse(File.read(File.join(__dir__, "package.json")))
4
+ folly_compiler_flags = '-DFOLLY_NO_CONFIG -DFOLLY_MOBILE=1 -DFOLLY_USE_LIBCPP=1 -Wno-comma -Wno-shorten-64-to-32'
4
5
 
5
6
  Pod::Spec.new do |s|
6
7
  s.name = "react-native-security-suite"
@@ -10,11 +11,26 @@ Pod::Spec.new do |s|
10
11
  s.license = package["license"]
11
12
  s.authors = package["author"]
12
13
 
13
- s.platforms = { :ios => "13.0" }
14
+ s.platforms = { :ios => "11.0" }
14
15
  s.source = { :git => "https://github.com/mohamadnavabi/react-native-security-suite.git", :tag => "#{s.version}" }
15
16
 
16
17
  s.source_files = "ios/**/*.{h,m,mm,swift}"
17
-
18
+
18
19
  s.dependency "React-Core"
19
20
  s.dependency "IOSSecuritySuite"
21
+
22
+ # Don't install the dependencies when we run `pod install` in the old architecture.
23
+ if ENV['RCT_NEW_ARCH_ENABLED'] == '1' then
24
+ s.compiler_flags = folly_compiler_flags + " -DRCT_NEW_ARCH_ENABLED=1"
25
+ s.pod_target_xcconfig = {
26
+ "HEADER_SEARCH_PATHS" => "\"$(PODS_ROOT)/boost\"",
27
+ "OTHER_CPLUSPLUSFLAGS" => "-DFOLLY_NO_CONFIG -DFOLLY_MOBILE=1 -DFOLLY_USE_LIBCPP=1",
28
+ "CLANG_CXX_LANGUAGE_STANDARD" => "c++17"
29
+ }
30
+ s.dependency "React-Codegen"
31
+ s.dependency "RCT-Folly"
32
+ s.dependency "RCTRequired"
33
+ s.dependency "RCTTypeSafety"
34
+ s.dependency "ReactCommon/turbomodule/core"
35
+ end
20
36
  end
package/src/index.tsx CHANGED
@@ -132,19 +132,24 @@ export const SecureStorage = {
132
132
  return e;
133
133
  }
134
134
  },
135
- multiSet: async (keyValuePairs: Array<Array<string>>) => {
135
+ multiSet: async (
136
+ keyValuePairs: Array<Array<string>>
137
+ ): Promise<void | string[][]> => {
136
138
  try {
137
139
  const encryptedKeyValuePairs: any = await Promise.all(
138
140
  keyValuePairs.map(async (item: Array<string>) => {
139
- if (item.length !== 2) return [];
140
- const encryptedKey = await encrypt(item[0], false);
141
- const encryptedValue = await encrypt(item[1]);
142
- return [encryptedKey, encryptedValue];
141
+ if (item.length === 2 && item[0] && item[1]) {
142
+ const encryptedKey = await encrypt(item[0], false);
143
+ const encryptedValue = await encrypt(item[1]);
144
+ return [encryptedKey, encryptedValue];
145
+ }
146
+
147
+ return null;
143
148
  })
144
149
  );
145
150
  AsyncStorage.multiSet(encryptedKeyValuePairs);
146
151
  } catch (e) {
147
- return e;
152
+ console.error('multiSet error: ', e);
148
153
  }
149
154
  },
150
155
  multiGet: async (keys: Array<string>) => {
@@ -172,16 +177,19 @@ export const SecureStorage = {
172
177
  multiMerge: async (keyValuePairs: Array<Array<string>>) => {
173
178
  try {
174
179
  return keyValuePairs.map(async (item: Array<string>) => {
175
- if (item.length !== 2) return;
176
- const encryptedKey = await encrypt(item[0], false);
177
- const encryptedData = await AsyncStorage.getItem(item[0]);
178
- const data = await decrypt(encryptedData ?? '');
179
- if (!isJsonString(data) || !isJsonString(item[1])) return null;
180
- const mergedData = await JSON.stringify(
181
- _.merge(JSON.parse(data), JSON.parse(item[1]))
182
- );
183
- const encryptedValue = await encrypt(mergedData, false);
184
- return AsyncStorage.setItem(encryptedKey, encryptedValue);
180
+ if (item.length === 2 && item[0] && item[1]) {
181
+ const encryptedKey = await encrypt(item[0], false);
182
+ const encryptedData = await AsyncStorage.getItem(item[0]);
183
+ const data = await decrypt(encryptedData ?? '');
184
+ if (!isJsonString(data) || !isJsonString(item[1])) return null;
185
+ const mergedData = await JSON.stringify(
186
+ _.merge(JSON.parse(data), JSON.parse(item[1]))
187
+ );
188
+ const encryptedValue = await encrypt(mergedData, false);
189
+ return AsyncStorage.setItem(encryptedKey, encryptedValue);
190
+ }
191
+
192
+ return null;
185
193
  });
186
194
  } catch (e) {
187
195
  return e;
File without changes
@@ -1,2 +0,0 @@
1
- #Wed Jul 19 11:38:56 IRDT 2023
2
- gradle.version=7.4
Binary file
File without changes
@@ -1,6 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <project version="4">
3
- <component name="CompilerConfiguration">
4
- <bytecodeTargetLevel target="11" />
5
- </component>
6
- </project>
@@ -1,17 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <project version="4">
3
- <component name="GradleSettings">
4
- <option name="linkedExternalProjectsSettings">
5
- <GradleProjectSettings>
6
- <option name="testRunner" value="GRADLE" />
7
- <option name="distributionType" value="DEFAULT_WRAPPED" />
8
- <option name="externalProjectPath" value="$PROJECT_DIR$" />
9
- <option name="modules">
10
- <set>
11
- <option value="$PROJECT_DIR$" />
12
- </set>
13
- </option>
14
- </GradleProjectSettings>
15
- </option>
16
- </component>
17
- </project>
@@ -1,40 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <project version="4">
3
- <component name="RemoteRepositoriesConfiguration">
4
- <remote-repository>
5
- <option name="id" value="central" />
6
- <option name="name" value="Maven Central repository" />
7
- <option name="url" value="https://repo1.maven.org/maven2" />
8
- </remote-repository>
9
- <remote-repository>
10
- <option name="id" value="jboss.community" />
11
- <option name="name" value="JBoss Community repository" />
12
- <option name="url" value="https://repository.jboss.org/nexus/content/repositories/public/" />
13
- </remote-repository>
14
- <remote-repository>
15
- <option name="id" value="MavenLocal" />
16
- <option name="name" value="MavenLocal" />
17
- <option name="url" value="file:$USER_HOME$/.m2/repository/" />
18
- </remote-repository>
19
- <remote-repository>
20
- <option name="id" value="MavenRepo" />
21
- <option name="name" value="MavenRepo" />
22
- <option name="url" value="https://repo.maven.apache.org/maven2/" />
23
- </remote-repository>
24
- <remote-repository>
25
- <option name="id" value="maven" />
26
- <option name="name" value="maven" />
27
- <option name="url" value="file:$PROJECT_DIR$/../node_modules/react-native/android/" />
28
- </remote-repository>
29
- <remote-repository>
30
- <option name="id" value="BintrayJCenter" />
31
- <option name="name" value="BintrayJCenter" />
32
- <option name="url" value="https://jcenter.bintray.com/" />
33
- </remote-repository>
34
- <remote-repository>
35
- <option name="id" value="Google" />
36
- <option name="name" value="Google" />
37
- <option name="url" value="https://dl.google.com/dl/android/maven2/" />
38
- </remote-repository>
39
- </component>
40
- </project>
@@ -1,10 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <project version="4">
3
- <component name="ExternalStorageConfigurationManager" enabled="true" />
4
- <component name="ProjectRootManager" version="2" languageLevel="JDK_11" default="true" project-jdk-name="Android Studio default JDK" project-jdk-type="JavaSDK">
5
- <output url="file://$PROJECT_DIR$/build/classes" />
6
- </component>
7
- <component name="ProjectType">
8
- <option name="id" value="Android" />
9
- </component>
10
- </project>
@@ -1,6 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <project version="4">
3
- <component name="VcsDirectoryMappings">
4
- <mapping directory="$PROJECT_DIR$/.." vcs="Git" />
5
- </component>
6
- </project>
@@ -1,5 +0,0 @@
1
- distributionBase=GRADLE_USER_HOME
2
- distributionPath=wrapper/dists
3
- distributionUrl=https\://services.gradle.org/distributions/gradle-7.4-bin.zip
4
- zipStoreBase=GRADLE_USER_HOME
5
- zipStorePath=wrapper/dists
package/android/gradlew DELETED
@@ -1,234 +0,0 @@
1
- #!/bin/sh
2
-
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
11
- #
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.
17
- #
18
-
19
- ##############################################################################
20
- #
21
- # Gradle start up script for POSIX generated by Gradle.
22
- #
23
- # Important for running:
24
- #
25
- # (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is
26
- # noncompliant, but you have some other compliant shell such as ksh or
27
- # bash, then to run this script, type that shell name before the whole
28
- # command line, like:
29
- #
30
- # ksh Gradle
31
- #
32
- # Busybox and similar reduced shells will NOT work, because this script
33
- # requires all of these POSIX shell features:
34
- # * functions;
35
- # * expansions «$var», «${var}», «${var:-default}», «${var+SET}»,
36
- # «${var#prefix}», «${var%suffix}», and «$( cmd )»;
37
- # * compound commands having a testable exit status, especially «case»;
38
- # * various built-in commands including «command», «set», and «ulimit».
39
- #
40
- # Important for patching:
41
- #
42
- # (2) This script targets any POSIX shell, so it avoids extensions provided
43
- # by Bash, Ksh, etc; in particular arrays are avoided.
44
- #
45
- # The "traditional" practice of packing multiple parameters into a
46
- # space-separated string is a well documented source of bugs and security
47
- # problems, so this is (mostly) avoided, by progressively accumulating
48
- # options in "$@", and eventually passing that to Java.
49
- #
50
- # Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS,
51
- # and GRADLE_OPTS) rely on word-splitting, this is performed explicitly;
52
- # see the in-line comments for details.
53
- #
54
- # There are tweaks for specific operating systems such as AIX, CygWin,
55
- # Darwin, MinGW, and NonStop.
56
- #
57
- # (3) This script is generated from the Groovy template
58
- # https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
59
- # within the Gradle project.
60
- #
61
- # You can find Gradle at https://github.com/gradle/gradle/.
62
- #
63
- ##############################################################################
64
-
65
- # Attempt to set APP_HOME
66
-
67
- # Resolve links: $0 may be a link
68
- app_path=$0
69
-
70
- # Need this for daisy-chained symlinks.
71
- while
72
- APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path
73
- [ -h "$app_path" ]
74
- do
75
- ls=$( ls -ld "$app_path" )
76
- link=${ls#*' -> '}
77
- case $link in #(
78
- /*) app_path=$link ;; #(
79
- *) app_path=$APP_HOME$link ;;
80
- esac
81
- done
82
-
83
- APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit
84
-
85
- APP_NAME="Gradle"
86
- APP_BASE_NAME=${0##*/}
87
-
88
- # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
89
- DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
90
-
91
- # Use the maximum available, or set MAX_FD != -1 to use that value.
92
- MAX_FD=maximum
93
-
94
- warn () {
95
- echo "$*"
96
- } >&2
97
-
98
- die () {
99
- echo
100
- echo "$*"
101
- echo
102
- exit 1
103
- } >&2
104
-
105
- # OS specific support (must be 'true' or 'false').
106
- cygwin=false
107
- msys=false
108
- darwin=false
109
- nonstop=false
110
- case "$( uname )" in #(
111
- CYGWIN* ) cygwin=true ;; #(
112
- Darwin* ) darwin=true ;; #(
113
- MSYS* | MINGW* ) msys=true ;; #(
114
- NONSTOP* ) nonstop=true ;;
115
- esac
116
-
117
- CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
118
-
119
-
120
- # Determine the Java command to use to start the JVM.
121
- if [ -n "$JAVA_HOME" ] ; then
122
- if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
123
- # IBM's JDK on AIX uses strange locations for the executables
124
- JAVACMD=$JAVA_HOME/jre/sh/java
125
- else
126
- JAVACMD=$JAVA_HOME/bin/java
127
- fi
128
- if [ ! -x "$JAVACMD" ] ; then
129
- die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
130
-
131
- Please set the JAVA_HOME variable in your environment to match the
132
- location of your Java installation."
133
- fi
134
- else
135
- JAVACMD=java
136
- which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
137
-
138
- Please set the JAVA_HOME variable in your environment to match the
139
- location of your Java installation."
140
- fi
141
-
142
- # Increase the maximum file descriptors if we can.
143
- if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
144
- case $MAX_FD in #(
145
- max*)
146
- MAX_FD=$( ulimit -H -n ) ||
147
- warn "Could not query maximum file descriptor limit"
148
- esac
149
- case $MAX_FD in #(
150
- '' | soft) :;; #(
151
- *)
152
- ulimit -n "$MAX_FD" ||
153
- warn "Could not set maximum file descriptor limit to $MAX_FD"
154
- esac
155
- fi
156
-
157
- # Collect all arguments for the java command, stacking in reverse order:
158
- # * args from the command line
159
- # * the main class name
160
- # * -classpath
161
- # * -D...appname settings
162
- # * --module-path (only if needed)
163
- # * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables.
164
-
165
- # For Cygwin or MSYS, switch paths to Windows format before running java
166
- if "$cygwin" || "$msys" ; then
167
- APP_HOME=$( cygpath --path --mixed "$APP_HOME" )
168
- CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" )
169
-
170
- JAVACMD=$( cygpath --unix "$JAVACMD" )
171
-
172
- # Now convert the arguments - kludge to limit ourselves to /bin/sh
173
- for arg do
174
- if
175
- case $arg in #(
176
- -*) false ;; # don't mess with options #(
177
- /?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath
178
- [ -e "$t" ] ;; #(
179
- *) false ;;
180
- esac
181
- then
182
- arg=$( cygpath --path --ignore --mixed "$arg" )
183
- fi
184
- # Roll the args list around exactly as many times as the number of
185
- # args, so each arg winds up back in the position where it started, but
186
- # possibly modified.
187
- #
188
- # NB: a `for` loop captures its iteration list before it begins, so
189
- # changing the positional parameters here affects neither the number of
190
- # iterations, nor the values presented in `arg`.
191
- shift # remove old arg
192
- set -- "$@" "$arg" # push replacement arg
193
- done
194
- fi
195
-
196
- # Collect all arguments for the java command;
197
- # * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of
198
- # shell script including quotes and variable substitutions, so put them in
199
- # double quotes to make sure that they get re-expanded; and
200
- # * put everything else in single quotes, so that it's not re-expanded.
201
-
202
- set -- \
203
- "-Dorg.gradle.appname=$APP_BASE_NAME" \
204
- -classpath "$CLASSPATH" \
205
- org.gradle.wrapper.GradleWrapperMain \
206
- "$@"
207
-
208
- # Use "xargs" to parse quoted args.
209
- #
210
- # With -n1 it outputs one arg per line, with the quotes and backslashes removed.
211
- #
212
- # In Bash we could simply go:
213
- #
214
- # readarray ARGS < <( xargs -n1 <<<"$var" ) &&
215
- # set -- "${ARGS[@]}" "$@"
216
- #
217
- # but POSIX shell has neither arrays nor command substitution, so instead we
218
- # post-process each arg (as a line of input to sed) to backslash-escape any
219
- # character that might be a shell metacharacter, then use eval to reverse
220
- # that process (while maintaining the separation between arguments), and wrap
221
- # the whole thing up as a single "set" statement.
222
- #
223
- # This will of course break if any of these variables contains a newline or
224
- # an unmatched quote.
225
- #
226
-
227
- eval "set -- $(
228
- printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" |
229
- xargs -n1 |
230
- sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' |
231
- tr '\n' ' '
232
- )" '"$@"'
233
-
234
- exec "$JAVACMD" "$@"