nimbbl-mobile-react-native-sdk 1.0.0-alpha.10

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 (44) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +374 -0
  3. package/android/build.gradle +86 -0
  4. package/android/gradle/wrapper/gradle-wrapper.jar +0 -0
  5. package/android/gradle/wrapper/gradle-wrapper.properties +6 -0
  6. package/android/gradle.properties +4 -0
  7. package/android/gradlew +185 -0
  8. package/android/gradlew.bat +89 -0
  9. package/android/settings.gradle +1 -0
  10. package/android/src/main/AndroidManifest.xml +19 -0
  11. package/android/src/main/java/com/nimbbl/reactnative/NimbblCheckoutActivity.kt +224 -0
  12. package/android/src/main/java/com/nimbbl/reactnative/NimbblReactNativeSDKModule.kt +428 -0
  13. package/android/src/main/java/com/nimbbl/reactnative/NimbblReactNativeSDKPackage.kt +16 -0
  14. package/android/src/main/java/com/nimbbl/reactnative/TestActivity.kt +28 -0
  15. package/index.tsx +8 -0
  16. package/ios/NimbblReactNativeSDK.m +20 -0
  17. package/ios/NimbblReactNativeSDK.podspec +38 -0
  18. package/ios/NimbblReactNativeSDK.swift +199 -0
  19. package/lib/NimbblSDK.d.ts +91 -0
  20. package/lib/NimbblSDK.d.ts.map +1 -0
  21. package/lib/NimbblSDK.js +214 -0
  22. package/lib/NimbblSDK.js.map +1 -0
  23. package/lib/__tests__/__mocks__/react-native.d.ts +26 -0
  24. package/lib/__tests__/__mocks__/react-native.d.ts.map +1 -0
  25. package/lib/__tests__/__mocks__/react-native.js +23 -0
  26. package/lib/__tests__/__mocks__/react-native.js.map +1 -0
  27. package/lib/__tests__/setup.d.ts +1 -0
  28. package/lib/__tests__/setup.d.ts.map +1 -0
  29. package/lib/__tests__/setup.js +4 -0
  30. package/lib/__tests__/setup.js.map +1 -0
  31. package/lib/constants.d.ts +31 -0
  32. package/lib/constants.d.ts.map +1 -0
  33. package/lib/constants.js +40 -0
  34. package/lib/constants.js.map +1 -0
  35. package/lib/index.d.ts +14 -0
  36. package/lib/index.d.ts.map +1 -0
  37. package/lib/index.js +32 -0
  38. package/lib/index.js.map +1 -0
  39. package/lib/types.d.ts +48 -0
  40. package/lib/types.d.ts.map +1 -0
  41. package/lib/types.js +8 -0
  42. package/lib/types.js.map +1 -0
  43. package/nimbbl-mobile-react-native-sdk.podspec +27 -0
  44. package/package.json +90 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2024 Nimbbl Tech
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,374 @@
1
+ # Nimbbl React Native SDK
2
+
3
+ A comprehensive React Native SDK for integrating Nimbbl payment gateway into your mobile applications. This SDK provides a seamless bridge between React Native and native payment functionality.
4
+
5
+ ## Features
6
+
7
+ - 🚀 **Easy Integration** - Simple setup and initialization
8
+ - 💳 **Multiple Payment Methods** - Support for cards, UPI, netbanking, wallets, EMI, and cash
9
+ - 🌐 **WebView Integration** - Built-in payment webview with customization options
10
+ - 🔗 **Bridge Module** - Robust native bridge for communication
11
+ - 📱 **Cross Platform** - Support for both iOS and Android
12
+ - 🛡️ **Type Safety** - Comprehensive TypeScript definitions
13
+ - 📊 **Analytics** - Built-in analytics and logging
14
+ - 🔄 **Event Handling** - Real-time payment status updates
15
+
16
+ ## Installation
17
+
18
+ ### Option 1: Install from npm (Recommended for production)
19
+
20
+ ```bash
21
+ npm install nimbbl-mobile-react-native-sdk
22
+ # or
23
+ yarn add nimbbl-mobile-react-native-sdk
24
+ ```
25
+
26
+
27
+
28
+ ## Compatibility
29
+
30
+ ### NPM Version Support
31
+
32
+ The Nimbbl React Native SDK is compatible with the following npm versions:
33
+
34
+ | NPM Version | Support Status | Notes |
35
+ |-------------|----------------|-------|
36
+ | `^1.0.0-alpha.0` | ✅ Supported | Initial alpha release |
37
+ | `^1.0.0-alpha.1` | ✅ Supported | Bug fixes and improvements |
38
+ | `^1.0.0-alpha.2` | ✅ Supported | Enhanced error handling |
39
+ | `^1.0.0-alpha.3` | ✅ Supported | Latest alpha release |
40
+ | `^1.0.0` | 🔄 Coming Soon | Stable release |
41
+ | `^1.1.0` | 🔄 Coming Soon | Feature updates |
42
+ | `^2.0.0` | 🔄 Coming Soon | Major version with breaking changes |
43
+
44
+ ### React Native Version Support
45
+
46
+ | React Native Version | Support Status | Notes |
47
+ |----------------------|----------------|-------|
48
+ | `^0.70.0` | ✅ Supported | Minimum supported version |
49
+ | `^0.71.0` | ✅ Supported | Recommended version |
50
+ | `^0.72.0` | ✅ Supported | Recommended version |
51
+ | `^0.73.0` | ✅ Supported | Latest stable version |
52
+ | `^0.74.0` | ✅ Supported | Latest stable version |
53
+ | `^0.75.0` | ✅ Supported | Latest stable version |
54
+ | `^0.76.0` | ✅ Supported | Latest stable version |
55
+
56
+ ### Node.js Version Support
57
+
58
+ | Node.js Version | Support Status | Notes |
59
+ |-----------------|----------------|-------|
60
+ | `^16.0.0` | ✅ Supported | Minimum supported version |
61
+ | `^18.0.0` | ✅ Supported | Recommended version |
62
+ | `^20.0.0` | ✅ Supported | Latest LTS version |
63
+ | `^21.0.0` | ✅ Supported | Latest stable version |
64
+
65
+ ### Platform Support
66
+
67
+ | Platform | Support Status | Minimum Version |
68
+ |----------|----------------|-----------------|
69
+ | **Android** | ✅ Supported | API Level 21 (Android 5.0) |
70
+ | **iOS** | ✅ Supported | iOS 13.0+ |
71
+
72
+ ### Breaking Changes
73
+
74
+ - **Alpha Releases**: Alpha versions may contain breaking changes between releases
75
+ - **Stable Releases**: Breaking changes will be clearly documented in release notes
76
+ - **Migration Guide**: Migration guides will be provided for major version updates
77
+
78
+ ### Versioning Strategy
79
+
80
+ - **Alpha Releases** (`1.0.0-alpha.X`): For testing and early adoption
81
+ - **Beta Releases** (`1.0.0-beta.X`): For feature-complete testing
82
+ - **Release Candidates** (`1.0.0-rc.X`): For final testing before stable release
83
+ - **Stable Releases** (`1.0.0`, `1.1.0`, etc.): For production use
84
+
85
+ ## Quick Start
86
+
87
+ ### Import the SDK
88
+
89
+ The import statement depends on whether you're using the npm package or local development version:
90
+
91
+ **For npm package (production use):**
92
+ ```javascript
93
+ import { NimbblSDK } from 'nimbbl-mobile-react-native-sdk';
94
+ ```
95
+
96
+
97
+
98
+ ### 1. Initialize the SDK
99
+
100
+ ```javascript
101
+ import { NimbblSDK } from 'nimbbl-mobile-react-native-sdk';
102
+
103
+ const nimbblSDK = NimbblSDK.getSharedInstance();
104
+
105
+ // Initialize the SDK (no credentials required - matches iOS pattern)
106
+ await nimbblSDK.initialize({
107
+ environment: 'sandbox' // or 'production'
108
+ });
109
+ ```
110
+
111
+
112
+
113
+ ### 2. Process Payment
114
+
115
+ ```javascript
116
+ // Process payment using checkout method (matching iOS pattern)
117
+ const checkoutResult = await nimbblSDK.checkout({
118
+ orderToken: 'YOUR_ORDER_TOKEN', // Order token received from your server
119
+ paymentModeCode: '', // Leave empty for all payment modes
120
+ bankCode: '', // Leave empty for all banks
121
+ walletCode: '', // Leave empty for all wallets
122
+ paymentFlow: '' // Leave empty for default flow (or 'phonepe', 'collect', 'intent' for UPI)
123
+ });
124
+ ```
125
+
126
+ ### 3. Handle Payment Status
127
+
128
+ The SDK automatically handles payment status through event listeners. You don't need to manually check status.
129
+
130
+ ## API Reference
131
+
132
+ ### NimbblSDK
133
+
134
+ The main SDK class that provides all payment functionality.
135
+
136
+ #### Methods
137
+
138
+ - `getSharedInstance()` - Get shared SDK instance (singleton pattern)
139
+ - `initialize(config)` - Initialize the SDK with configuration
140
+ - `checkout(options)` - Process payment with order token
141
+ - `testNativeModule()` - Test native module availability
142
+ - `addEventListener(eventName, callback)` - Add event listener
143
+ - `removeEventListener(eventName, callback)` - Remove event listener
144
+ - `removeAllEventListeners()` - Remove all event listeners
145
+
146
+ ### Event Handling
147
+
148
+ ```javascript
149
+ import { NimbblSDK, EVENTS } from 'nimbbl-mobile-react-native-sdk';
150
+
151
+ const nimbblSDK = NimbblSDK.getSharedInstance();
152
+
153
+ // Listen for payment events
154
+ nimbblSDK.addEventListener(EVENTS.PAYMENT_SUCCESS, (data) => {
155
+ console.log('Payment successful:', data);
156
+ // Handle success - navigate to success screen
157
+ });
158
+
159
+ nimbblSDK.addEventListener(EVENTS.PAYMENT_FAILED, (data) => {
160
+ console.log('Payment failed:', data);
161
+ // Handle failure - show error message
162
+ });
163
+ ```
164
+
165
+ ## Configuration
166
+
167
+ ### SDK Configuration
168
+
169
+ ```javascript
170
+ const config = {
171
+ environment: 'sandbox', // 'sandbox' or 'production'
172
+ options: {
173
+ timeout: 30000,
174
+ enable_logging: true,
175
+ enable_analytics: true,
176
+ api_base_url: 'https://api.nimbbl.tech/' // Optional: override default URL
177
+ }
178
+ };
179
+ ```
180
+
181
+ ## Constants
182
+
183
+ The SDK provides various constants for better development experience:
184
+
185
+ ```javascript
186
+ import {
187
+ EVENTS,
188
+ ENVIRONMENTS,
189
+ ERROR_CODES,
190
+ ERROR_MESSAGES,
191
+ DEFAULT_CONFIG,
192
+ SDK_VERSION
193
+ } from 'nimbbl-mobile-react-native-sdk';
194
+ ```
195
+
196
+ ## Error Handling
197
+
198
+ ```javascript
199
+ try {
200
+ const checkoutResult = await nimbblSDK.checkout({
201
+ orderToken: 'YOUR_ORDER_TOKEN',
202
+ paymentModeCode: '',
203
+ bankCode: '',
204
+ walletCode: '',
205
+ paymentFlow: ''
206
+ });
207
+ } catch (error) {
208
+ console.error('Error processing payment:', error.message);
209
+
210
+ // Check error codes
211
+ if (error.code === ERROR_CODES.PAYMENT_FAILED) {
212
+ // Handle payment failure
213
+ }
214
+ }
215
+ ```
216
+
217
+ ## Platform Setup
218
+
219
+ ### iOS
220
+
221
+ 1. Install pods:
222
+ ```bash
223
+ cd ios && pod install
224
+ ```
225
+
226
+ 2. Add to your `Info.plist`:
227
+ ```xml
228
+ <key>NSAppTransportSecurity</key>
229
+ <dict>
230
+ <key>NSAllowsArbitraryLoads</key>
231
+ <true/>
232
+ </dict>
233
+ ```
234
+
235
+ **Note:** The iOS implementation is written in Swift for modern, type-safe development.
236
+
237
+ ### Android
238
+
239
+ 1. Add to your `android/app/build.gradle`:
240
+ ```gradle
241
+ android {
242
+ defaultConfig {
243
+ minSdkVersion 21
244
+ }
245
+ }
246
+ ```
247
+
248
+ 2. Add to your `android/app/src/main/AndroidManifest.xml`:
249
+ ```xml
250
+ <uses-permission android:name="android.permission.INTERNET" />
251
+ ```
252
+
253
+ **Note:** The Android implementation is written in Kotlin for modern, type-safe development.
254
+
255
+ ## Examples
256
+
257
+ ### Complete Payment Flow
258
+
259
+ ```javascript
260
+ import { NimbblSDK, EVENTS } from 'nimbbl-mobile-react-native-sdk';
261
+
262
+ class PaymentManager {
263
+ constructor() {
264
+ this.nimbblSDK = NimbblSDK.getSharedInstance();
265
+ }
266
+
267
+ async initialize() {
268
+ await this.nimbblSDK.initialize({
269
+ environment: 'sandbox'
270
+ });
271
+ }
272
+
273
+ setupEventListeners() {
274
+ this.nimbblSDK.addEventListener(EVENTS.PAYMENT_SUCCESS, (data) => {
275
+ console.log('Payment successful:', data);
276
+ // Navigate to success screen
277
+ });
278
+
279
+ this.nimbblSDK.addEventListener(EVENTS.PAYMENT_FAILED, (data) => {
280
+ console.log('Payment failed:', data);
281
+ // Show error message
282
+ });
283
+ }
284
+
285
+ async processPayment(orderToken) {
286
+ try {
287
+ // Process payment using the order token
288
+ const result = await this.nimbblSDK.checkout({
289
+ orderToken: orderToken,
290
+ paymentModeCode: '',
291
+ bankCode: '',
292
+ walletCode: '',
293
+ paymentFlow: ''
294
+ });
295
+
296
+ return { success: true, result };
297
+ } catch (error) {
298
+ return { success: false, error: error.message };
299
+ }
300
+ }
301
+ }
302
+ ```
303
+
304
+
305
+
306
+
307
+
308
+ ## License
309
+
310
+ This project is licensed under the MIT License - see the [LICENSE](./LICENSE) file for details.
311
+
312
+ ## Support
313
+
314
+ For support, email support@nimbbl.biz or join our Slack channel.
315
+
316
+ ## Version Migration
317
+
318
+ ### Upgrading Between Alpha Versions
319
+
320
+ When upgrading between alpha versions, check the changelog for breaking changes:
321
+
322
+ ```bash
323
+ # Check current version
324
+ npm list nimbbl-mobile-react-native-sdk
325
+
326
+ # Upgrade to latest alpha
327
+ npm install nimbbl-mobile-react-native-sdk@latest
328
+
329
+ # Or upgrade to specific version
330
+ npm install nimbbl-mobile-react-native-sdk@1.0.0-alpha.3
331
+ ```
332
+
333
+ ### Migration from Alpha to Stable
334
+
335
+ When the stable version is released:
336
+
337
+ ```bash
338
+ # Upgrade from alpha to stable
339
+ npm install nimbbl-mobile-react-native-sdk@^1.0.0
340
+
341
+ # Update your package.json
342
+ # Change from: "nimbbl-mobile-react-native-sdk": "^1.0.0-alpha.3"
343
+ # To: "nimbbl-mobile-react-native-sdk": "^1.0.0"
344
+ ```
345
+
346
+ ### Breaking Changes Migration
347
+
348
+ For major version updates (e.g., 1.x to 2.x):
349
+
350
+ 1. Check the migration guide in the release notes
351
+ 2. Update your code according to the breaking changes
352
+ 3. Test thoroughly before deploying to production
353
+
354
+ ### Version Locking
355
+
356
+ For production applications, consider locking to specific versions:
357
+
358
+ ```json
359
+ {
360
+ "dependencies": {
361
+ "nimbbl-mobile-react-native-sdk": "1.0.0-alpha.3"
362
+ }
363
+ }
364
+ ```
365
+
366
+ ### Deprecation Policy
367
+
368
+ - **Alpha versions**: Features may be deprecated without notice
369
+ - **Stable versions**: Deprecated features will be marked with warnings for at least one minor version
370
+ - **Major versions**: Breaking changes will be clearly documented
371
+
372
+ ## Changelog
373
+
374
+ *This section will be updated with future releases.*
@@ -0,0 +1,86 @@
1
+ buildscript {
2
+ repositories {
3
+ google()
4
+ mavenCentral()
5
+ }
6
+ dependencies {
7
+ classpath 'com.android.tools.build:gradle:8.1.0'
8
+ classpath 'org.jetbrains.kotlin:kotlin-gradle-plugin:1.9.0'
9
+ }
10
+ }
11
+
12
+ apply plugin: 'com.android.library'
13
+ apply plugin: 'org.jetbrains.kotlin.android'
14
+ apply plugin: 'maven-publish'
15
+
16
+ allprojects {
17
+ repositories {
18
+ google()
19
+ mavenCentral()
20
+ maven { url 'https://jitpack.io' }
21
+ maven { url 'https://oss.sonatype.org/content/repositories/snapshots/' }
22
+ maven { url "$rootDir/../node_modules/react-native/android" }
23
+ }
24
+ }
25
+
26
+ group = 'com.nimbbl.reactnative'
27
+ version = '1.0.0'
28
+
29
+ android {
30
+ namespace 'com.nimbbl.reactnative'
31
+ compileSdkVersion 36
32
+ buildToolsVersion "36.0.0"
33
+
34
+ defaultConfig {
35
+ minSdkVersion 24
36
+ targetSdkVersion 36
37
+ versionCode 1
38
+ versionName "1.0.0"
39
+ }
40
+
41
+ buildTypes {
42
+ release {
43
+ minifyEnabled false
44
+ proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
45
+ }
46
+ }
47
+
48
+ compileOptions {
49
+ sourceCompatibility JavaVersion.VERSION_17
50
+ targetCompatibility JavaVersion.VERSION_17
51
+ }
52
+
53
+ kotlinOptions {
54
+ jvmTarget = '17'
55
+ }
56
+
57
+ lintOptions {
58
+ abortOnError false
59
+ }
60
+ }
61
+
62
+ dependencies {
63
+ // React Native dependencies (required for bridge)
64
+ compileOnly 'com.facebook.react:react-native:+'
65
+ implementation 'androidx.appcompat:appcompat:1.6.1'
66
+
67
+ // Nimbbl WebView SDK dependency (includes all necessary dependencies)
68
+ implementation 'com.github.nimbbl-tech:nimbbl_mobile_kit_android_webview_sdk:3.0.12'
69
+
70
+ // Add Retrofit and Coroutines dependencies for Android SDK
71
+ implementation 'com.squareup.retrofit2:retrofit:2.9.0'
72
+ implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.6.4'
73
+ }
74
+
75
+ afterEvaluate {
76
+ publishing {
77
+ publications {
78
+ release(MavenPublication) {
79
+ from components.release
80
+ groupId = 'com.nimbbl.reactnative'
81
+ artifactId = 'nimbbl-react-native-sdk'
82
+ version = '1.0.0'
83
+ }
84
+ }
85
+ }
86
+ }
@@ -0,0 +1,6 @@
1
+ #Tue Aug 05 20:11:30 IST 2025
2
+ distributionBase=GRADLE_USER_HOME
3
+ distributionPath=wrapper/dists
4
+ distributionUrl=https\://services.gradle.org/distributions/gradle-8.11.1-bin.zip
5
+ zipStoreBase=GRADLE_USER_HOME
6
+ zipStorePath=wrapper/dists
@@ -0,0 +1,4 @@
1
+ org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8
2
+ android.useAndroidX=true
3
+ android.enableJetifier=true
4
+ android.suppressUnsupportedCompileSdk=36
@@ -0,0 +1,185 @@
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" "$@"