@hawcx/react-native-sdk 1.0.7 → 1.1.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 (132) hide show
  1. package/CHANGELOG.md +3 -6
  2. package/HawcxReactNative.podspec +2 -2
  3. package/README.md +327 -109
  4. package/android/build.gradle +2 -2
  5. package/android/src/main/java/com/hawcx/reactnative/HawcxEventDispatcher.kt +4 -0
  6. package/android/src/main/java/com/hawcx/reactnative/HawcxReactNativeModule.kt +324 -1
  7. package/android/src/main/java/com/hawcx/reactnative/v6/HawcxV6Bridge.kt +402 -0
  8. package/ios/Frameworks/HawcxFramework.xcframework/ios-arm64/HawcxFramework.framework/HawcxFramework +0 -0
  9. package/ios/Frameworks/HawcxFramework.xcframework/ios-arm64/HawcxFramework.framework/Info.plist +0 -0
  10. package/ios/Frameworks/HawcxFramework.xcframework/ios-arm64/HawcxFramework.framework/Modules/HawcxFramework.swiftmodule/arm64-apple-ios.abi.json +22143 -0
  11. package/ios/Frameworks/HawcxFramework.xcframework/ios-arm64/HawcxFramework.framework/Modules/HawcxFramework.swiftmodule/arm64-apple-ios.private.swiftinterface +649 -21
  12. package/ios/Frameworks/HawcxFramework.xcframework/ios-arm64/HawcxFramework.framework/Modules/HawcxFramework.swiftmodule/arm64-apple-ios.swiftdoc +0 -0
  13. package/ios/Frameworks/HawcxFramework.xcframework/ios-arm64/HawcxFramework.framework/Modules/HawcxFramework.swiftmodule/arm64-apple-ios.swiftinterface +649 -21
  14. package/ios/Frameworks/HawcxFramework.xcframework/ios-arm64_x86_64-simulator/HawcxFramework.framework/HawcxFramework +0 -0
  15. package/ios/Frameworks/HawcxFramework.xcframework/ios-arm64_x86_64-simulator/HawcxFramework.framework/Info.plist +0 -0
  16. package/ios/Frameworks/HawcxFramework.xcframework/ios-arm64_x86_64-simulator/HawcxFramework.framework/Modules/HawcxFramework.swiftmodule/arm64-apple-ios-simulator.abi.json +22143 -0
  17. package/ios/Frameworks/HawcxFramework.xcframework/ios-arm64_x86_64-simulator/HawcxFramework.framework/Modules/HawcxFramework.swiftmodule/arm64-apple-ios-simulator.private.swiftinterface +649 -21
  18. package/ios/Frameworks/HawcxFramework.xcframework/ios-arm64_x86_64-simulator/HawcxFramework.framework/Modules/HawcxFramework.swiftmodule/arm64-apple-ios-simulator.swiftdoc +0 -0
  19. package/ios/Frameworks/HawcxFramework.xcframework/ios-arm64_x86_64-simulator/HawcxFramework.framework/Modules/HawcxFramework.swiftmodule/arm64-apple-ios-simulator.swiftinterface +649 -21
  20. package/ios/Frameworks/HawcxFramework.xcframework/ios-arm64_x86_64-simulator/HawcxFramework.framework/Modules/HawcxFramework.swiftmodule/x86_64-apple-ios-simulator.abi.json +22143 -0
  21. package/ios/Frameworks/HawcxFramework.xcframework/ios-arm64_x86_64-simulator/HawcxFramework.framework/Modules/HawcxFramework.swiftmodule/x86_64-apple-ios-simulator.private.swiftinterface +649 -21
  22. package/ios/Frameworks/HawcxFramework.xcframework/ios-arm64_x86_64-simulator/HawcxFramework.framework/Modules/HawcxFramework.swiftmodule/x86_64-apple-ios-simulator.swiftdoc +0 -0
  23. package/ios/Frameworks/HawcxFramework.xcframework/ios-arm64_x86_64-simulator/HawcxFramework.framework/Modules/HawcxFramework.swiftmodule/x86_64-apple-ios-simulator.swiftinterface +649 -21
  24. package/ios/Frameworks/HawcxFramework.xcframework/ios-arm64_x86_64-simulator/HawcxFramework.framework/_CodeSignature/CodeResources +21 -21
  25. package/ios/HawcxReactNative.m +56 -0
  26. package/ios/HawcxReactNative.swift +380 -1
  27. package/ios/HawcxV6BridgeSupport.swift +468 -0
  28. package/lib/commonjs/index.js +326 -3
  29. package/lib/commonjs/index.js.map +1 -1
  30. package/lib/commonjs/v6Normalization.js +325 -0
  31. package/lib/commonjs/v6Normalization.js.map +1 -0
  32. package/lib/commonjs/v6State.js +186 -0
  33. package/lib/commonjs/v6State.js.map +1 -0
  34. package/lib/commonjs/v6Types.js +2 -0
  35. package/lib/commonjs/v6Types.js.map +1 -0
  36. package/lib/commonjs/v6WebLogin.js +101 -0
  37. package/lib/commonjs/v6WebLogin.js.map +1 -0
  38. package/lib/module/index.js +287 -1
  39. package/lib/module/index.js.map +1 -1
  40. package/lib/module/v6Normalization.js +318 -0
  41. package/lib/module/v6Normalization.js.map +1 -0
  42. package/lib/module/v6State.js +173 -0
  43. package/lib/module/v6State.js.map +1 -0
  44. package/lib/module/v6Types.js +2 -0
  45. package/lib/module/v6Types.js.map +1 -0
  46. package/lib/module/v6WebLogin.js +92 -0
  47. package/lib/module/v6WebLogin.js.map +1 -0
  48. package/lib/typescript/index.d.ts +83 -0
  49. package/lib/typescript/index.d.ts.map +1 -1
  50. package/lib/typescript/v6Normalization.d.ts +3 -0
  51. package/lib/typescript/v6Normalization.d.ts.map +1 -0
  52. package/lib/typescript/v6State.d.ts +13 -0
  53. package/lib/typescript/v6State.d.ts.map +1 -0
  54. package/lib/typescript/v6Types.d.ts +157 -0
  55. package/lib/typescript/v6Types.d.ts.map +1 -0
  56. package/lib/typescript/v6WebLogin.d.ts +32 -0
  57. package/lib/typescript/v6WebLogin.d.ts.map +1 -0
  58. package/package.json +21 -9
  59. package/src/index.ts +477 -0
  60. package/src/v6Normalization.ts +356 -0
  61. package/src/v6State.ts +238 -0
  62. package/src/v6Types.ts +194 -0
  63. package/src/v6WebLogin.ts +154 -0
  64. package/android/gradle/wrapper/gradle-wrapper.jar +0 -0
  65. package/android/gradle/wrapper/gradle-wrapper.properties +0 -6
  66. package/android/gradlew +0 -185
  67. package/android/gradlew.bat +0 -89
  68. package/android/libs/hawcx-5.1.2.aar +0 -0
  69. package/docs/RELEASE.md +0 -129
  70. package/example/README.md +0 -59
  71. package/example/android/app/build.gradle +0 -126
  72. package/example/android/app/debug.keystore +0 -0
  73. package/example/android/app/proguard-rules.pro +0 -10
  74. package/example/android/app/src/debug/AndroidManifest.xml +0 -9
  75. package/example/android/app/src/main/AndroidManifest.xml +0 -27
  76. package/example/android/app/src/main/java/com/hawcx/example/MainActivity.kt +0 -22
  77. package/example/android/app/src/main/java/com/hawcx/example/MainApplication.kt +0 -45
  78. package/example/android/app/src/main/res/drawable/rn_edit_text_material.xml +0 -36
  79. package/example/android/app/src/main/res/mipmap-hdpi/ic_launcher.png +0 -0
  80. package/example/android/app/src/main/res/mipmap-hdpi/ic_launcher_round.png +0 -0
  81. package/example/android/app/src/main/res/mipmap-mdpi/ic_launcher.png +0 -0
  82. package/example/android/app/src/main/res/mipmap-mdpi/ic_launcher_round.png +0 -0
  83. package/example/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png +0 -0
  84. package/example/android/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png +0 -0
  85. package/example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png +0 -0
  86. package/example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png +0 -0
  87. package/example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png +0 -0
  88. package/example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png +0 -0
  89. package/example/android/app/src/main/res/values/strings.xml +0 -3
  90. package/example/android/app/src/main/res/values/styles.xml +0 -9
  91. package/example/android/build.gradle +0 -35
  92. package/example/android/gradle/wrapper/gradle-wrapper.jar +0 -0
  93. package/example/android/gradle/wrapper/gradle-wrapper.properties +0 -7
  94. package/example/android/gradle.properties +0 -41
  95. package/example/android/gradlew +0 -249
  96. package/example/android/gradlew.bat +0 -92
  97. package/example/android/local.properties +0 -2
  98. package/example/android/settings.gradle +0 -38
  99. package/example/app.json +0 -4
  100. package/example/babel.config.js +0 -3
  101. package/example/e2e/README.md +0 -17
  102. package/example/e2e/hawcx-login.yaml +0 -14
  103. package/example/index.js +0 -5
  104. package/example/ios/.xcode.env +0 -11
  105. package/example/ios/HawcxExampleApp/AppDelegate.h +0 -6
  106. package/example/ios/HawcxExampleApp/AppDelegate.mm +0 -31
  107. package/example/ios/HawcxExampleApp/Images.xcassets/AppIcon.appiconset/Contents.json +0 -53
  108. package/example/ios/HawcxExampleApp/Images.xcassets/Contents.json +0 -6
  109. package/example/ios/HawcxExampleApp/Info.plist +0 -55
  110. package/example/ios/HawcxExampleApp/LaunchScreen.storyboard +0 -47
  111. package/example/ios/HawcxExampleApp/PrivacyInfo.xcprivacy +0 -37
  112. package/example/ios/HawcxExampleApp/main.m +0 -10
  113. package/example/ios/HawcxExampleApp.xcodeproj/project.pbxproj +0 -704
  114. package/example/ios/HawcxExampleApp.xcodeproj/project.xcworkspace/xcuserdata/agambhullar.xcuserdatad/UserInterfaceState.xcuserstate +0 -0
  115. package/example/ios/HawcxExampleApp.xcodeproj/xcshareddata/xcschemes/HawcxExampleApp.xcscheme +0 -90
  116. package/example/ios/HawcxExampleApp.xcodeproj/xcuserdata/agambhullar.xcuserdatad/xcschemes/xcschememanagement.plist +0 -16
  117. package/example/ios/HawcxExampleApp.xcworkspace/contents.xcworkspacedata +0 -10
  118. package/example/ios/HawcxExampleAppTests/HawcxExampleAppTests.m +0 -66
  119. package/example/ios/HawcxExampleAppTests/Info.plist +0 -24
  120. package/example/ios/Podfile +0 -79
  121. package/example/ios/Podfile.lock +0 -1290
  122. package/example/metro.config.js +0 -16
  123. package/example/package-lock.json +0 -13220
  124. package/example/package.json +0 -30
  125. package/example/src/App.tsx +0 -755
  126. package/example/src/hawcx.config.ts +0 -25
  127. package/example/tsconfig.json +0 -8
  128. package/ios/Frameworks/.keep +0 -0
  129. package/lib/typescript/__tests__/index.test.d.ts +0 -2
  130. package/lib/typescript/__tests__/index.test.d.ts.map +0 -1
  131. package/react_mobile_sdk_plan.md +0 -242
  132. package/src/__tests__/index.test.ts +0 -206
package/src/v6Types.ts ADDED
@@ -0,0 +1,194 @@
1
+ export type HawcxV6FlowType = 'signin' | 'signup' | 'account_manage';
2
+
3
+ export type HawcxV6AuthStatus =
4
+ | 'identifier'
5
+ | 'loading'
6
+ | 'select_method'
7
+ | 'enter_code'
8
+ | 'setup_sms'
9
+ | 'setup_totp'
10
+ | 'enter_totp'
11
+ | 'redirect'
12
+ | 'await_approval'
13
+ | 'completed'
14
+ | 'error';
15
+
16
+ export type HawcxV6Method = {
17
+ id: string;
18
+ label: string;
19
+ icon?: string;
20
+ };
21
+
22
+ export type HawcxV6StepInfo = {
23
+ id: string;
24
+ label?: string;
25
+ };
26
+
27
+ export type HawcxV6RiskLocation = {
28
+ city?: string;
29
+ country?: string;
30
+ };
31
+
32
+ export type HawcxV6RiskInfo = {
33
+ detected: boolean;
34
+ reasons: string[];
35
+ message?: string;
36
+ location?: HawcxV6RiskLocation;
37
+ riskScore?: number;
38
+ };
39
+
40
+ export type HawcxV6FieldError = {
41
+ field: string;
42
+ message: string;
43
+ };
44
+
45
+ export type HawcxV6ErrorDetails = {
46
+ retryAfterSeconds?: number;
47
+ retryAt?: string;
48
+ attemptsRemaining?: number;
49
+ errors?: HawcxV6FieldError[];
50
+ };
51
+
52
+ export type HawcxV6PromptBase = {
53
+ session: string;
54
+ traceId: string;
55
+ expiresAt: string;
56
+ step?: HawcxV6StepInfo;
57
+ risk?: HawcxV6RiskInfo;
58
+ codeChannel?: string;
59
+ };
60
+
61
+ export type HawcxV6SelectMethodPrompt = HawcxV6PromptBase & {
62
+ prompt: {
63
+ type: 'select_method';
64
+ methods: HawcxV6Method[];
65
+ phase?: string;
66
+ };
67
+ };
68
+
69
+ export type HawcxV6EnterCodePrompt = HawcxV6PromptBase & {
70
+ prompt: {
71
+ type: 'enter_code';
72
+ destination: string;
73
+ codeLength?: number;
74
+ codeFormat?: string;
75
+ codeExpiresAt?: string;
76
+ resendAt?: string;
77
+ };
78
+ };
79
+
80
+ export type HawcxV6EnterTotpPrompt = HawcxV6PromptBase & {
81
+ prompt: {
82
+ type: 'enter_totp';
83
+ };
84
+ };
85
+
86
+ export type HawcxV6SetupTotpPrompt = HawcxV6PromptBase & {
87
+ prompt: {
88
+ type: 'setup_totp';
89
+ secret: string;
90
+ otpauthUrl: string;
91
+ period?: number;
92
+ };
93
+ };
94
+
95
+ export type HawcxV6SetupSmsPrompt = HawcxV6PromptBase & {
96
+ prompt: {
97
+ type: 'setup_sms';
98
+ existingPhone?: string;
99
+ };
100
+ };
101
+
102
+ export type HawcxV6RedirectPrompt = HawcxV6PromptBase & {
103
+ prompt: {
104
+ type: 'redirect';
105
+ url: string;
106
+ returnScheme?: string;
107
+ };
108
+ };
109
+
110
+ export type HawcxV6AwaitApprovalPrompt = HawcxV6PromptBase & {
111
+ prompt: {
112
+ type: 'await_approval';
113
+ qrData?: string;
114
+ expiresAt: string;
115
+ pollInterval: number;
116
+ };
117
+ };
118
+
119
+ export type HawcxV6PromptPayload =
120
+ | HawcxV6SelectMethodPrompt
121
+ | HawcxV6EnterCodePrompt
122
+ | HawcxV6EnterTotpPrompt
123
+ | HawcxV6SetupTotpPrompt
124
+ | HawcxV6SetupSmsPrompt
125
+ | HawcxV6RedirectPrompt
126
+ | HawcxV6AwaitApprovalPrompt;
127
+
128
+ export type HawcxV6CompletedPayload = {
129
+ session: string;
130
+ authCode: string;
131
+ expiresAt: string;
132
+ codeVerifier?: string;
133
+ traceId: string;
134
+ };
135
+
136
+ export type HawcxV6ErrorAction =
137
+ | 'retry_input'
138
+ | 'restart_flow'
139
+ | 'wait'
140
+ | 'retry_request'
141
+ | 'abort'
142
+ | 'resend_code'
143
+ | 'select_method'
144
+ | string;
145
+
146
+ export type HawcxV6ErrorPayload = {
147
+ session?: string;
148
+ code: string;
149
+ action?: HawcxV6ErrorAction;
150
+ message: string;
151
+ retryable: boolean;
152
+ details?: HawcxV6ErrorDetails;
153
+ traceId?: string;
154
+ };
155
+
156
+ export type HawcxV6FlowEvent =
157
+ | { type: 'idle' }
158
+ | { type: 'loading'; payload: { session?: string } }
159
+ | { type: 'prompt'; payload: HawcxV6PromptPayload }
160
+ | { type: 'completed'; payload: HawcxV6CompletedPayload }
161
+ | { type: 'error'; payload: HawcxV6ErrorPayload };
162
+
163
+ export type HawcxV6ResendAvailability = {
164
+ canResend: boolean;
165
+ resendAt?: string;
166
+ secondsUntilResend?: number;
167
+ };
168
+
169
+ export type HawcxV6AuthState = {
170
+ status: HawcxV6AuthStatus;
171
+ flowType: HawcxV6FlowType;
172
+ identifier?: string;
173
+ session?: string;
174
+ traceId?: string;
175
+ expiresAt?: string;
176
+ step?: HawcxV6StepInfo;
177
+ risk?: HawcxV6RiskInfo;
178
+ codeChannel?: string;
179
+ prompt?: HawcxV6PromptPayload;
180
+ completed?: HawcxV6CompletedPayload;
181
+ error?: HawcxV6ErrorPayload;
182
+ resend: HawcxV6ResendAvailability;
183
+ isLoading: boolean;
184
+ requiresRedirect: boolean;
185
+ awaitingApproval: boolean;
186
+ };
187
+
188
+ export type HawcxV6StartOptions = {
189
+ identifier: string;
190
+ flowType?: HawcxV6FlowType;
191
+ startToken?: string;
192
+ inviteCode?: string;
193
+ codeChallenge?: string;
194
+ };
@@ -0,0 +1,154 @@
1
+ export type HawcxV6QrPayloadType = 'qr_auth' | 'qr_login';
2
+
3
+ export type HawcxV6QrPayload = {
4
+ type: HawcxV6QrPayloadType;
5
+ sessionId: string;
6
+ nonce: string;
7
+ phoneActionToken?: string;
8
+ token?: string;
9
+ projectId?: string;
10
+ version?: string;
11
+ raw: string;
12
+ };
13
+
14
+ export type HawcxV6QrApprovalResult =
15
+ | {
16
+ outcome: 'approved';
17
+ payloadType: HawcxV6QrPayloadType;
18
+ }
19
+ | {
20
+ outcome: 'bound';
21
+ payloadType: HawcxV6QrPayloadType;
22
+ userId?: string;
23
+ };
24
+
25
+ export type HawcxWebLoginScanRoute =
26
+ | {
27
+ kind: 'protocol_qr';
28
+ payload: HawcxV6QrPayload;
29
+ }
30
+ | {
31
+ kind: 'legacy_pin';
32
+ pin: string;
33
+ }
34
+ | {
35
+ kind: 'invalid';
36
+ };
37
+
38
+ const LEGACY_PIN_PATTERNS = [
39
+ /pin=([0-9]{7})/,
40
+ /PIN=([0-9]{7})/,
41
+ /code=([0-9]{7})/,
42
+ /CODE=([0-9]{7})/,
43
+ /token=([0-9]{7})/,
44
+ /TOKEN=([0-9]{7})/,
45
+ /\b([0-9]{7})\b/,
46
+ ];
47
+
48
+ const isRecord = (value: unknown): value is Record<string, unknown> =>
49
+ typeof value === 'object' && value !== null && !Array.isArray(value);
50
+
51
+ const asString = (value: unknown): string | undefined => {
52
+ if (typeof value !== 'string') {
53
+ return undefined;
54
+ }
55
+ const trimmed = value.trim();
56
+ return trimmed.length > 0 ? trimmed : undefined;
57
+ };
58
+
59
+ export const parseHawcxV6QrPayload = (raw: string): HawcxV6QrPayload | null => {
60
+ const trimmed = raw.trim();
61
+ if (!trimmed) {
62
+ return null;
63
+ }
64
+
65
+ try {
66
+ const parsed = JSON.parse(trimmed) as unknown;
67
+ if (!isRecord(parsed)) {
68
+ return null;
69
+ }
70
+
71
+ const sessionId = asString(parsed.session_id) ?? asString(parsed.sessionId);
72
+ const nonce = asString(parsed.nonce);
73
+ if (!sessionId || !nonce) {
74
+ return null;
75
+ }
76
+
77
+ const typeValue = asString(parsed.type)?.toLowerCase();
78
+ const phoneActionToken =
79
+ asString(parsed.phone_action_token) ?? asString(parsed.phoneActionToken);
80
+ const token = asString(parsed.token);
81
+ const projectId = asString(parsed.project_id) ?? asString(parsed.projectId);
82
+ const version = asString(parsed.v) ?? asString(parsed.version);
83
+
84
+ let type: HawcxV6QrPayloadType | undefined;
85
+ if (typeValue === 'qr_login') {
86
+ type = 'qr_login';
87
+ } else if (typeValue === 'qr_auth') {
88
+ type = 'qr_auth';
89
+ } else if (phoneActionToken) {
90
+ type = 'qr_auth';
91
+ } else if (token) {
92
+ type = 'qr_login';
93
+ }
94
+
95
+ if (!type) {
96
+ return null;
97
+ }
98
+
99
+ return {
100
+ type,
101
+ sessionId,
102
+ nonce,
103
+ phoneActionToken,
104
+ token,
105
+ projectId,
106
+ version,
107
+ raw: trimmed,
108
+ };
109
+ } catch {
110
+ return null;
111
+ }
112
+ };
113
+
114
+ export const extractLegacyWebLoginPin = (raw: string): string | null => {
115
+ const trimmed = raw.trim();
116
+ if (!trimmed) {
117
+ return null;
118
+ }
119
+
120
+ if (trimmed.length === 7 && /^[0-9]{7}$/.test(trimmed)) {
121
+ return trimmed;
122
+ }
123
+
124
+ for (const pattern of LEGACY_PIN_PATTERNS) {
125
+ const match = pattern.exec(trimmed);
126
+ if (match?.[1]) {
127
+ return match[1];
128
+ }
129
+ }
130
+
131
+ return null;
132
+ };
133
+
134
+ export const routeWebLoginScan = (raw: string): HawcxWebLoginScanRoute => {
135
+ const protocolPayload = parseHawcxV6QrPayload(raw);
136
+ if (protocolPayload) {
137
+ return {
138
+ kind: 'protocol_qr',
139
+ payload: protocolPayload,
140
+ };
141
+ }
142
+
143
+ const pin = extractLegacyWebLoginPin(raw);
144
+ if (pin) {
145
+ return {
146
+ kind: 'legacy_pin',
147
+ pin,
148
+ };
149
+ }
150
+
151
+ return {
152
+ kind: 'invalid',
153
+ };
154
+ };
@@ -1,6 +0,0 @@
1
- #Thu Jun 20 01:28:42 IST 2024
2
- distributionBase=GRADLE_USER_HOME
3
- distributionPath=wrapper/dists
4
- distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-all.zip
5
- zipStoreBase=GRADLE_USER_HOME
6
- zipStorePath=wrapper/dists
package/android/gradlew DELETED
@@ -1,185 +0,0 @@
1
- #!/usr/bin/env sh
2
-
3
- #
4
- # Copyright 2015 the original author or 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 UN*X
22
- ##
23
- ##############################################################################
24
-
25
- # Attempt to set APP_HOME
26
- # Resolve links: $0 may be a link
27
- PRG="$0"
28
- # Need this for relative symlinks.
29
- while [ -h "$PRG" ] ; do
30
- ls=`ls -ld "$PRG"`
31
- link=`expr "$ls" : '.*-> \(.*\)$'`
32
- if expr "$link" : '/.*' > /dev/null; then
33
- PRG="$link"
34
- else
35
- PRG=`dirname "$PRG"`"/$link"
36
- fi
37
- done
38
- SAVED="`pwd`"
39
- cd "`dirname \"$PRG\"`/" >/dev/null
40
- APP_HOME="`pwd -P`"
41
- cd "$SAVED" >/dev/null
42
-
43
- APP_NAME="Gradle"
44
- APP_BASE_NAME=`basename "$0"`
45
-
46
- # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
47
- DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
48
-
49
- # Use the maximum available, or set MAX_FD != -1 to use that value.
50
- MAX_FD="maximum"
51
-
52
- warn () {
53
- echo "$*"
54
- }
55
-
56
- die () {
57
- echo
58
- echo "$*"
59
- echo
60
- exit 1
61
- }
62
-
63
- # OS specific support (must be 'true' or 'false').
64
- cygwin=false
65
- msys=false
66
- darwin=false
67
- nonstop=false
68
- case "`uname`" in
69
- CYGWIN* )
70
- cygwin=true
71
- ;;
72
- Darwin* )
73
- darwin=true
74
- ;;
75
- MINGW* )
76
- msys=true
77
- ;;
78
- NONSTOP* )
79
- nonstop=true
80
- ;;
81
- esac
82
-
83
- CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
84
-
85
-
86
- # Determine the Java command to use to start the JVM.
87
- if [ -n "$JAVA_HOME" ] ; then
88
- if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
89
- # IBM's JDK on AIX uses strange locations for the executables
90
- JAVACMD="$JAVA_HOME/jre/sh/java"
91
- else
92
- JAVACMD="$JAVA_HOME/bin/java"
93
- fi
94
- if [ ! -x "$JAVACMD" ] ; then
95
- die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
96
-
97
- Please set the JAVA_HOME variable in your environment to match the
98
- location of your Java installation."
99
- fi
100
- else
101
- JAVACMD="java"
102
- which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
103
-
104
- Please set the JAVA_HOME variable in your environment to match the
105
- location of your Java installation."
106
- fi
107
-
108
- # Increase the maximum file descriptors if we can.
109
- if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
110
- MAX_FD_LIMIT=`ulimit -H -n`
111
- if [ $? -eq 0 ] ; then
112
- if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
113
- MAX_FD="$MAX_FD_LIMIT"
114
- fi
115
- ulimit -n $MAX_FD
116
- if [ $? -ne 0 ] ; then
117
- warn "Could not set maximum file descriptor limit: $MAX_FD"
118
- fi
119
- else
120
- warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
121
- fi
122
- fi
123
-
124
- # For Darwin, add options to specify how the application appears in the dock
125
- if $darwin; then
126
- GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
127
- fi
128
-
129
- # For Cygwin or MSYS, switch paths to Windows format before running java
130
- if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
131
- APP_HOME=`cygpath --path --mixed "$APP_HOME"`
132
- CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
133
-
134
- JAVACMD=`cygpath --unix "$JAVACMD"`
135
-
136
- # We build the pattern for arguments to be converted via cygpath
137
- ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
138
- SEP=""
139
- for dir in $ROOTDIRSRAW ; do
140
- ROOTDIRS="$ROOTDIRS$SEP$dir"
141
- SEP="|"
142
- done
143
- OURCYGPATTERN="(^($ROOTDIRS))"
144
- # Add a user-defined pattern to the cygpath arguments
145
- if [ "$GRADLE_CYGPATTERN" != "" ] ; then
146
- OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
147
- fi
148
- # Now convert the arguments - kludge to limit ourselves to /bin/sh
149
- i=0
150
- for arg in "$@" ; do
151
- CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
152
- CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
153
-
154
- if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
155
- eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
156
- else
157
- eval `echo args$i`="\"$arg\""
158
- fi
159
- i=`expr $i + 1`
160
- done
161
- case $i in
162
- 0) set -- ;;
163
- 1) set -- "$args0" ;;
164
- 2) set -- "$args0" "$args1" ;;
165
- 3) set -- "$args0" "$args1" "$args2" ;;
166
- 4) set -- "$args0" "$args1" "$args2" "$args3" ;;
167
- 5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
168
- 6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
169
- 7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
170
- 8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
171
- 9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
172
- esac
173
- fi
174
-
175
- # Escape application args
176
- save () {
177
- for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
178
- echo " "
179
- }
180
- APP_ARGS=`save "$@"`
181
-
182
- # Collect all arguments for the java command, following the shell quoting and substitution rules
183
- eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
184
-
185
- exec "$JAVACMD" "$@"
@@ -1,89 +0,0 @@
1
- @rem
2
- @rem Copyright 2015 the original author or authors.
3
- @rem
4
- @rem Licensed under the Apache License, Version 2.0 (the "License");
5
- @rem you may not use this file except in compliance with the License.
6
- @rem You may obtain a copy of the License at
7
- @rem
8
- @rem https://www.apache.org/licenses/LICENSE-2.0
9
- @rem
10
- @rem Unless required by applicable law or agreed to in writing, software
11
- @rem distributed under the License is distributed on an "AS IS" BASIS,
12
- @rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
- @rem See the License for the specific language governing permissions and
14
- @rem limitations under the License.
15
- @rem
16
-
17
- @if "%DEBUG%" == "" @echo off
18
- @rem ##########################################################################
19
- @rem
20
- @rem Gradle startup script for Windows
21
- @rem
22
- @rem ##########################################################################
23
-
24
- @rem Set local scope for the variables with windows NT shell
25
- if "%OS%"=="Windows_NT" setlocal
26
-
27
- set DIRNAME=%~dp0
28
- if "%DIRNAME%" == "" set DIRNAME=.
29
- set APP_BASE_NAME=%~n0
30
- set APP_HOME=%DIRNAME%
31
-
32
- @rem Resolve any "." and ".." in APP_HOME to make it shorter.
33
- for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
34
-
35
- @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
36
- set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
37
-
38
- @rem Find java.exe
39
- if defined JAVA_HOME goto findJavaFromJavaHome
40
-
41
- set JAVA_EXE=java.exe
42
- %JAVA_EXE% -version >NUL 2>&1
43
- if "%ERRORLEVEL%" == "0" goto execute
44
-
45
- echo.
46
- echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
47
- echo.
48
- echo Please set the JAVA_HOME variable in your environment to match the
49
- echo location of your Java installation.
50
-
51
- goto fail
52
-
53
- :findJavaFromJavaHome
54
- set JAVA_HOME=%JAVA_HOME:"=%
55
- set JAVA_EXE=%JAVA_HOME%/bin/java.exe
56
-
57
- if exist "%JAVA_EXE%" goto execute
58
-
59
- echo.
60
- echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
61
- echo.
62
- echo Please set the JAVA_HOME variable in your environment to match the
63
- echo location of your Java installation.
64
-
65
- goto fail
66
-
67
- :execute
68
- @rem Setup the command line
69
-
70
- set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
71
-
72
-
73
- @rem Execute Gradle
74
- "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
75
-
76
- :end
77
- @rem End local scope for the variables with windows NT shell
78
- if "%ERRORLEVEL%"=="0" goto mainEnd
79
-
80
- :fail
81
- rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
82
- rem the _cmd.exe /c_ return code!
83
- if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
84
- exit /b 1
85
-
86
- :mainEnd
87
- if "%OS%"=="Windows_NT" endlocal
88
-
89
- :omega
Binary file