react-native-ble-manager 9.1.0 → 10.0.1
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.
- package/README.md +2 -2
- package/android/src/main/java/it/innove/NotifyBufferContainer.java +19 -15
- package/android/src/main/java/it/innove/Peripheral.java +286 -272
- package/ios/BleManager.m +10 -10
- package/ios/CBPeripheral+Extensions.m +24 -22
- package/package.json +1 -1
- package/android/.gradle/7.4/checksums/checksums.lock +0 -0
- package/android/.gradle/7.4/dependencies-accessors/dependencies-accessors.lock +0 -0
- package/android/.gradle/7.4/dependencies-accessors/gc.properties +0 -0
- package/android/.gradle/7.4/executionHistory/executionHistory.bin +0 -0
- package/android/.gradle/7.4/executionHistory/executionHistory.lock +0 -0
- package/android/.gradle/7.4/fileChanges/last-build.bin +0 -0
- package/android/.gradle/7.4/fileHashes/fileHashes.bin +0 -0
- package/android/.gradle/7.4/fileHashes/fileHashes.lock +0 -0
- package/android/.gradle/7.4/fileHashes/resourceHashesCache.bin +0 -0
- package/android/.gradle/7.4/gc.properties +0 -0
- package/android/.gradle/buildOutputCleanup/buildOutputCleanup.lock +0 -0
- package/android/.gradle/buildOutputCleanup/cache.properties +0 -2
- package/android/.gradle/buildOutputCleanup/outputFiles.bin +0 -0
- package/android/.gradle/file-system.probe +0 -0
- package/android/.gradle/vcs-1/gc.properties +0 -0
- package/android/.idea/.name +0 -1
- package/android/.idea/compiler.xml +0 -6
- package/android/.idea/gradle.xml +0 -18
- package/android/.idea/jarRepositories.xml +0 -40
- package/android/.idea/misc.xml +0 -10
- package/android/.idea/vcs.xml +0 -6
- package/android/gradle/wrapper/gradle-wrapper.jar +0 -0
- package/android/gradle/wrapper/gradle-wrapper.properties +0 -5
- package/android/gradlew +0 -234
- package/android/gradlew.bat +0 -89
- package/android/local.properties +0 -8
package/ios/BleManager.m
CHANGED
|
@@ -96,7 +96,7 @@ bool hasListeners;
|
|
|
96
96
|
[self invokeAndClearDictionary:readCallbacks withKey:key usingParameters:@[[NSNull null], ([characteristic.value length] > 0) ? [characteristic.value toArray] : [NSNull null]]];
|
|
97
97
|
} else {
|
|
98
98
|
if (hasListeners) {
|
|
99
|
-
[self sendEventWithName:@"BleManagerDidUpdateValueForCharacteristic" body:@{@"peripheral": peripheral.uuidAsString, @"characteristic":characteristic.UUID.UUIDString, @"service":characteristic.service.UUID.UUIDString, @"value": ([characteristic.value length] > 0) ? [characteristic.value toArray] : [NSNull null]}];
|
|
99
|
+
[self sendEventWithName:@"BleManagerDidUpdateValueForCharacteristic" body:@{@"peripheral": peripheral.uuidAsString, @"characteristic":characteristic.UUID.UUIDString.lowercaseString, @"service":characteristic.service.UUID.UUIDString.lowercaseString, @"value": ([characteristic.value length] > 0) ? [characteristic.value toArray] : [NSNull null]}];
|
|
100
100
|
}
|
|
101
101
|
}
|
|
102
102
|
}
|
|
@@ -149,7 +149,7 @@ bool hasListeners;
|
|
|
149
149
|
return;
|
|
150
150
|
}
|
|
151
151
|
if (hasListeners) {
|
|
152
|
-
[self sendEventWithName:@"BleManagerDidUpdateNotificationStateFor" body:@{@"peripheral": peripheral.uuidAsString, @"characteristic": characteristic.UUID.UUIDString, @"isNotifying": @(false), @"domain": [error domain], @"code": @(error.code)}];
|
|
152
|
+
[self sendEventWithName:@"BleManagerDidUpdateNotificationStateFor" body:@{@"peripheral": peripheral.uuidAsString, @"characteristic": characteristic.UUID.UUIDString.lowercaseString, @"isNotifying": @(false), @"domain": [error domain], @"code": @(error.code)}];
|
|
153
153
|
}
|
|
154
154
|
}
|
|
155
155
|
|
|
@@ -178,7 +178,7 @@ bool hasListeners;
|
|
|
178
178
|
}
|
|
179
179
|
}
|
|
180
180
|
if (hasListeners) {
|
|
181
|
-
[self sendEventWithName:@"BleManagerDidUpdateNotificationStateFor" body:@{@"peripheral": peripheral.uuidAsString, @"characteristic": characteristic.UUID.UUIDString, @"isNotifying": @(characteristic.isNotifying)}];
|
|
181
|
+
[self sendEventWithName:@"BleManagerDidUpdateNotificationStateFor" body:@{@"peripheral": peripheral.uuidAsString, @"characteristic": characteristic.UUID.UUIDString.lowercaseString, @"isNotifying": @(characteristic.isNotifying)}];
|
|
182
182
|
}
|
|
183
183
|
}
|
|
184
184
|
|
|
@@ -253,7 +253,7 @@ bool hasListeners;
|
|
|
253
253
|
@synchronized(peripherals) {
|
|
254
254
|
for (CBPeripheral *p in peripherals) {
|
|
255
255
|
|
|
256
|
-
NSString* other = p.identifier.UUIDString;
|
|
256
|
+
NSString* other = p.identifier.UUIDString.lowercaseString;
|
|
257
257
|
|
|
258
258
|
if ([uuid isEqualToString:other]) {
|
|
259
259
|
peripheral = p;
|
|
@@ -981,7 +981,7 @@ RCT_EXPORT_METHOD(requestMTU:(NSString *)deviceUUID mtu:(NSInteger)mtu callback:
|
|
|
981
981
|
for(int i=0; i < service.characteristics.count; i++)
|
|
982
982
|
{
|
|
983
983
|
CBCharacteristic *c = [service.characteristics objectAtIndex:i];
|
|
984
|
-
if ((c.properties & prop) != 0x0 && [c.UUID.UUIDString isEqualToString: UUID.UUIDString]) {
|
|
984
|
+
if ((c.properties & prop) != 0x0 && [c.UUID.UUIDString.lowercaseString isEqualToString: UUID.UUIDString.lowercaseString]) {
|
|
985
985
|
NSLog(@"Found %@", UUID);
|
|
986
986
|
return c;
|
|
987
987
|
}
|
|
@@ -996,7 +996,7 @@ RCT_EXPORT_METHOD(requestMTU:(NSString *)deviceUUID mtu:(NSInteger)mtu callback:
|
|
|
996
996
|
for(int i=0; i < service.characteristics.count; i++)
|
|
997
997
|
{
|
|
998
998
|
CBCharacteristic *c = [service.characteristics objectAtIndex:i];
|
|
999
|
-
if ([c.UUID.UUIDString isEqualToString: UUID.UUIDString]) {
|
|
999
|
+
if ([c.UUID.UUIDString.lowercaseString isEqualToString: UUID.UUIDString.lowercaseString]) {
|
|
1000
1000
|
NSLog(@"Found %@", UUID);
|
|
1001
1001
|
return c;
|
|
1002
1002
|
}
|
|
@@ -1048,10 +1048,10 @@ RCT_EXPORT_METHOD(requestMTU:(NSString *)deviceUUID mtu:(NSInteger)mtu callback:
|
|
|
1048
1048
|
{
|
|
1049
1049
|
NSString* err = [NSString stringWithFormat:@"Could not find service with UUID %@ on peripheral with UUID %@",
|
|
1050
1050
|
serviceUUIDString,
|
|
1051
|
-
peripheral.identifier.UUIDString];
|
|
1051
|
+
peripheral.identifier.UUIDString.lowercaseString];
|
|
1052
1052
|
NSLog(@"Could not find service with UUID %@ on peripheral with UUID %@",
|
|
1053
1053
|
serviceUUIDString,
|
|
1054
|
-
peripheral.identifier.UUIDString);
|
|
1054
|
+
peripheral.identifier.UUIDString.lowercaseString);
|
|
1055
1055
|
callback(@[err]);
|
|
1056
1056
|
return nil;
|
|
1057
1057
|
}
|
|
@@ -1070,11 +1070,11 @@ RCT_EXPORT_METHOD(requestMTU:(NSString *)deviceUUID mtu:(NSInteger)mtu callback:
|
|
|
1070
1070
|
|
|
1071
1071
|
if (!characteristic)
|
|
1072
1072
|
{
|
|
1073
|
-
NSString* err = [NSString stringWithFormat:@"Could not find characteristic with UUID %@ on service with UUID %@ on peripheral with UUID %@", characteristicUUIDString,serviceUUIDString, peripheral.identifier.UUIDString];
|
|
1073
|
+
NSString* err = [NSString stringWithFormat:@"Could not find characteristic with UUID %@ on service with UUID %@ on peripheral with UUID %@", characteristicUUIDString,serviceUUIDString, peripheral.identifier.UUIDString.lowercaseString];
|
|
1074
1074
|
NSLog(@"Could not find characteristic with UUID %@ on service with UUID %@ on peripheral with UUID %@",
|
|
1075
1075
|
characteristicUUIDString,
|
|
1076
1076
|
serviceUUIDString,
|
|
1077
|
-
peripheral.identifier.UUIDString);
|
|
1077
|
+
peripheral.identifier.UUIDString.lowercaseString);
|
|
1078
1078
|
callback(@[err]);
|
|
1079
1079
|
return nil;
|
|
1080
1080
|
}
|
|
@@ -8,7 +8,7 @@ static char ADVERTISEMENT_RSSI_IDENTIFER;
|
|
|
8
8
|
|
|
9
9
|
-(NSString *)uuidAsString {
|
|
10
10
|
if (self.identifier.UUIDString) {
|
|
11
|
-
return self.identifier.UUIDString;
|
|
11
|
+
return [self.identifier.UUIDString lowercaseString];
|
|
12
12
|
} else {
|
|
13
13
|
return @"";
|
|
14
14
|
}
|
|
@@ -18,7 +18,7 @@ static char ADVERTISEMENT_RSSI_IDENTIFER;
|
|
|
18
18
|
-(NSDictionary *)asDictionary {
|
|
19
19
|
NSString *uuidString = NULL;
|
|
20
20
|
if (self.identifier.UUIDString) {
|
|
21
|
-
uuidString = self.identifier.UUIDString;
|
|
21
|
+
uuidString = [self.identifier.UUIDString lowercaseString];
|
|
22
22
|
} else {
|
|
23
23
|
uuidString = @"";
|
|
24
24
|
}
|
|
@@ -112,7 +112,7 @@ static char ADVERTISEMENT_RSSI_IDENTIFER;
|
|
|
112
112
|
|
|
113
113
|
for (CBUUID *key in [serviceData allKeys]) {
|
|
114
114
|
if ([serviceData objectForKey:key]) {
|
|
115
|
-
[serviceData setObject:dataToArrayBuffer([serviceData objectForKey:key]) forKey:[key UUIDString]];
|
|
115
|
+
[serviceData setObject:dataToArrayBuffer([serviceData objectForKey:key]) forKey:[[key UUIDString] lowercaseString]];
|
|
116
116
|
[serviceData removeObjectForKey:key];
|
|
117
117
|
}
|
|
118
118
|
}
|
|
@@ -129,7 +129,7 @@ static char ADVERTISEMENT_RSSI_IDENTIFER;
|
|
|
129
129
|
serviceUUIDStrings = [[NSMutableArray alloc] initWithCapacity:serviceUUIDs.count];
|
|
130
130
|
|
|
131
131
|
for (CBUUID *uuid in serviceUUIDs) {
|
|
132
|
-
[serviceUUIDStrings addObject:[uuid UUIDString]];
|
|
132
|
+
[serviceUUIDStrings addObject:[[uuid UUIDString] lowercaseString]];
|
|
133
133
|
}
|
|
134
134
|
|
|
135
135
|
// replace the UUID list with list of strings
|
|
@@ -145,7 +145,7 @@ static char ADVERTISEMENT_RSSI_IDENTIFER;
|
|
|
145
145
|
solicitiedServiceUUIDStrings = [[NSMutableArray alloc] initWithCapacity:solicitiedServiceUUIDs.count];
|
|
146
146
|
|
|
147
147
|
for (CBUUID *uuid in solicitiedServiceUUIDs) {
|
|
148
|
-
[solicitiedServiceUUIDStrings addObject:[uuid UUIDString]];
|
|
148
|
+
[solicitiedServiceUUIDStrings addObject:[[uuid UUIDString] lowercaseString]];
|
|
149
149
|
}
|
|
150
150
|
|
|
151
151
|
// replace the UUID list with list of strings
|
|
@@ -161,7 +161,7 @@ static char ADVERTISEMENT_RSSI_IDENTIFER;
|
|
|
161
161
|
overflowServiceUUIDStrings = [[NSMutableArray alloc] initWithCapacity:overflowServiceUUIDs.count];
|
|
162
162
|
|
|
163
163
|
for (CBUUID *uuid in overflowServiceUUIDs) {
|
|
164
|
-
[overflowServiceUUIDStrings addObject:[uuid UUIDString]];
|
|
164
|
+
[overflowServiceUUIDStrings addObject:[[uuid UUIDString] lowercaseString]];
|
|
165
165
|
}
|
|
166
166
|
|
|
167
167
|
// replace the UUID list with list of strings
|
|
@@ -188,11 +188,13 @@ static char ADVERTISEMENT_RSSI_IDENTIFER;
|
|
|
188
188
|
|
|
189
189
|
// This can move into the CBPeripherial Extension
|
|
190
190
|
for (CBService *service in [self services]) {
|
|
191
|
-
|
|
191
|
+
NSMutableDictionary *serviceDictionary = [NSMutableDictionary new];
|
|
192
|
+
[serviceDictionary setObject:[[[service UUID] UUIDString] lowercaseString] forKey:@"uuid"];
|
|
193
|
+
[serviceList addObject:serviceDictionary];
|
|
192
194
|
for (CBCharacteristic *characteristic in service.characteristics) {
|
|
193
195
|
NSMutableDictionary *characteristicDictionary = [NSMutableDictionary new];
|
|
194
|
-
[characteristicDictionary setObject:[[service UUID] UUIDString] forKey:@"service"];
|
|
195
|
-
[characteristicDictionary setObject:[[characteristic UUID] UUIDString] forKey:@"characteristic"];
|
|
196
|
+
[characteristicDictionary setObject:[[[service UUID] UUIDString] lowercaseString] forKey:@"service"];
|
|
197
|
+
[characteristicDictionary setObject:[[[characteristic UUID] UUIDString] lowercaseString] forKey:@"characteristic"];
|
|
196
198
|
|
|
197
199
|
if ([characteristic value] && [[characteristic value] length] > 0) {
|
|
198
200
|
[characteristicDictionary setObject:dataToArrayBuffer([characteristic value]) forKey:@"value"];
|
|
@@ -209,7 +211,7 @@ static char ADVERTISEMENT_RSSI_IDENTIFER;
|
|
|
209
211
|
NSMutableArray *descriptorList = [NSMutableArray new];
|
|
210
212
|
for (CBDescriptor *descriptor in characteristic.descriptors) {
|
|
211
213
|
NSMutableDictionary *descriptorDictionary = [NSMutableDictionary new];
|
|
212
|
-
[descriptorDictionary setObject:[[descriptor UUID] UUIDString] forKey:@"uuid"];
|
|
214
|
+
[descriptorDictionary setObject:[[[descriptor UUID] UUIDString] lowercaseString] forKey:@"uuid"];
|
|
213
215
|
if ([descriptor value]) { // should always have a value?
|
|
214
216
|
[descriptorDictionary setObject:[descriptor value] forKey:@"value"];
|
|
215
217
|
}
|
|
@@ -227,50 +229,50 @@ static char ADVERTISEMENT_RSSI_IDENTIFER;
|
|
|
227
229
|
|
|
228
230
|
}
|
|
229
231
|
|
|
230
|
-
-(
|
|
231
|
-
|
|
232
|
+
-(NSDictionary *) decodeCharacteristicProperties: (CBCharacteristic *) characteristic {
|
|
233
|
+
NSMutableDictionary *props = [NSMutableDictionary new];
|
|
232
234
|
|
|
233
235
|
CBCharacteristicProperties p = [characteristic properties];
|
|
234
236
|
|
|
235
237
|
// NOTE: props strings need to be consistent across iOS and Android
|
|
236
238
|
if ((p & CBCharacteristicPropertyBroadcast) != 0x0) {
|
|
237
|
-
[props
|
|
239
|
+
[props setValue:@"Broadcast" forKey:@"Broadcast"];
|
|
238
240
|
}
|
|
239
241
|
|
|
240
242
|
if ((p & CBCharacteristicPropertyRead) != 0x0) {
|
|
241
|
-
[props
|
|
243
|
+
[props setValue:@"Read" forKey:@"Read"];
|
|
242
244
|
}
|
|
243
245
|
|
|
244
246
|
if ((p & CBCharacteristicPropertyWriteWithoutResponse) != 0x0) {
|
|
245
|
-
[props
|
|
247
|
+
[props setValue:@"WriteWithoutResponse" forKey:@"WriteWithoutResponse"];
|
|
246
248
|
}
|
|
247
249
|
|
|
248
250
|
if ((p & CBCharacteristicPropertyWrite) != 0x0) {
|
|
249
|
-
[props
|
|
251
|
+
[props setValue:@"Write" forKey:@"Write"];
|
|
250
252
|
}
|
|
251
253
|
|
|
252
254
|
if ((p & CBCharacteristicPropertyNotify) != 0x0) {
|
|
253
|
-
[props
|
|
255
|
+
[props setValue:@"Notify" forKey:@"Notify"];
|
|
254
256
|
}
|
|
255
257
|
|
|
256
258
|
if ((p & CBCharacteristicPropertyIndicate) != 0x0) {
|
|
257
|
-
[props
|
|
259
|
+
[props setValue:@"Indicate" forKey:@"Indicate"];
|
|
258
260
|
}
|
|
259
261
|
|
|
260
262
|
if ((p & CBCharacteristicPropertyAuthenticatedSignedWrites) != 0x0) {
|
|
261
|
-
[props
|
|
263
|
+
[props setValue:@"AuthenticateSignedWrites" forKey:@"AuthenticateSignedWrites"];
|
|
262
264
|
}
|
|
263
265
|
|
|
264
266
|
if ((p & CBCharacteristicPropertyExtendedProperties) != 0x0) {
|
|
265
|
-
[props
|
|
267
|
+
[props setValue:@"ExtendedProperties" forKey:@"ExtendedProperties"];
|
|
266
268
|
}
|
|
267
269
|
|
|
268
270
|
if ((p & CBCharacteristicPropertyNotifyEncryptionRequired) != 0x0) {
|
|
269
|
-
[props
|
|
271
|
+
[props setValue:@"NotifyEncryptionRequired" forKey:@"NotifyEncryptionRequired"];
|
|
270
272
|
}
|
|
271
273
|
|
|
272
274
|
if ((p & CBCharacteristicPropertyIndicateEncryptionRequired) != 0x0) {
|
|
273
|
-
[props
|
|
275
|
+
[props setValue:@"IndicateEncryptionRequired" forKey:@"IndicateEncryptionRequired"];
|
|
274
276
|
}
|
|
275
277
|
|
|
276
278
|
return props;
|
package/package.json
CHANGED
|
Binary file
|
|
Binary file
|
|
File without changes
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
File without changes
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
File without changes
|
package/android/.idea/.name
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
react-native-ble-manager
|
package/android/.idea/gradle.xml
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
-
<project version="4">
|
|
3
|
-
<component name="GradleMigrationSettings" migrationVersion="1" />
|
|
4
|
-
<component name="GradleSettings">
|
|
5
|
-
<option name="linkedExternalProjectsSettings">
|
|
6
|
-
<GradleProjectSettings>
|
|
7
|
-
<option name="testRunner" value="GRADLE" />
|
|
8
|
-
<option name="distributionType" value="DEFAULT_WRAPPED" />
|
|
9
|
-
<option name="externalProjectPath" value="$PROJECT_DIR$" />
|
|
10
|
-
<option name="modules">
|
|
11
|
-
<set>
|
|
12
|
-
<option value="$PROJECT_DIR$" />
|
|
13
|
-
</set>
|
|
14
|
-
</option>
|
|
15
|
-
</GradleProjectSettings>
|
|
16
|
-
</option>
|
|
17
|
-
</component>
|
|
18
|
-
</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="maven" />
|
|
16
|
-
<option name="name" value="maven" />
|
|
17
|
-
<option name="url" value="file:$PROJECT_DIR$/../node_modules/react-native/android" />
|
|
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="BintrayJCenter" />
|
|
26
|
-
<option name="name" value="BintrayJCenter" />
|
|
27
|
-
<option name="url" value="https://jcenter.bintray.com/" />
|
|
28
|
-
</remote-repository>
|
|
29
|
-
<remote-repository>
|
|
30
|
-
<option name="id" value="Google" />
|
|
31
|
-
<option name="name" value="Google" />
|
|
32
|
-
<option name="url" value="https://dl.google.com/dl/android/maven2/" />
|
|
33
|
-
</remote-repository>
|
|
34
|
-
<remote-repository>
|
|
35
|
-
<option name="id" value="maven" />
|
|
36
|
-
<option name="name" value="maven" />
|
|
37
|
-
<option name="url" value="file:$PROJECT_DIR$/../example/node_modules/react-native/android" />
|
|
38
|
-
</remote-repository>
|
|
39
|
-
</component>
|
|
40
|
-
</project>
|
package/android/.idea/misc.xml
DELETED
|
@@ -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_1_8" 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>
|
package/android/.idea/vcs.xml
DELETED
|
Binary file
|
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" "$@"
|