@screeb/react-native 2.1.18 → 2.2.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.
- package/README.md +24 -5
- package/{screeb-module.podspec → ScreebReactNative.podspec} +6 -4
- package/android/build.gradle +36 -86
- package/android/gradle.properties +5 -3
- package/android/src/main/AndroidManifest.xml +1 -3
- package/android/src/main/java/app/screeb/reactnative/ScreebReactNativeModule.kt +258 -0
- package/android/src/main/java/app/screeb/reactnative/ScreebReactNativePackage.kt +33 -0
- package/ios/ScreebReactNative.m +63 -0
- package/ios/{ScreebModule.swift → ScreebReactNative.swift} +116 -32
- package/lib/module/NativeScreebReactNative.js +10 -0
- package/lib/module/NativeScreebReactNative.js.map +1 -0
- package/lib/module/index.js +170 -88
- package/lib/module/index.js.map +1 -0
- package/lib/module/package.json +1 -0
- package/lib/typescript/package.json +1 -0
- package/lib/typescript/src/NativeScreebReactNative.d.ts +49 -0
- package/lib/typescript/src/NativeScreebReactNative.d.ts.map +1 -0
- package/lib/typescript/src/index.d.ts +25 -0
- package/lib/typescript/src/index.d.ts.map +1 -0
- package/package.json +153 -59
- package/src/NativeScreebReactNative.ts +81 -0
- package/src/index.tsx +251 -144
- package/android/gradle/wrapper/gradle-wrapper.jar +0 -0
- package/android/gradle/wrapper/gradle-wrapper.properties +0 -5
- package/android/gradlew +0 -185
- package/android/gradlew.bat +0 -89
- package/android/src/main/java/com/screebmodule/ScreebModuleModule.kt +0 -186
- package/android/src/main/java/com/screebmodule/ScreebModulePackage.kt +0 -17
- package/ios/ScreebModule-Bridging-Header.h +0 -3
- package/ios/ScreebModule.m +0 -24
- package/ios/ScreebModule.xcodeproj/project.pbxproj +0 -293
- package/lib/commonjs/index.js +0 -130
- package/lib/typescript/index.d.ts +0 -13
package/src/index.tsx
CHANGED
|
@@ -1,170 +1,277 @@
|
|
|
1
1
|
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
2
|
+
DeviceEventEmitter,
|
|
3
|
+
NativeEventEmitter,
|
|
4
|
+
NativeModules,
|
|
5
|
+
Platform,
|
|
6
6
|
} from "react-native";
|
|
7
|
+
import ScreebReactNative from "./NativeScreebReactNative";
|
|
7
8
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
Platform.select({ ios: "- You have run 'pod install'\n", default: "" }) +
|
|
11
|
-
"- You rebuilt the app after installing the package\n" +
|
|
12
|
-
"- You are not using Expo managed workflow\n";
|
|
13
|
-
|
|
14
|
-
const ScreebModule = NativeModules.ScreebModule
|
|
15
|
-
? NativeModules.ScreebModule
|
|
16
|
-
: new Proxy(
|
|
17
|
-
{},
|
|
18
|
-
{
|
|
19
|
-
get() {
|
|
20
|
-
throw new Error(LINKING_ERROR);
|
|
21
|
-
},
|
|
22
|
-
}
|
|
23
|
-
);
|
|
24
|
-
|
|
25
|
-
let hooksRegistry = new Map<string, any>();
|
|
9
|
+
// biome-ignore lint/suspicious/noExplicitAny: .
|
|
10
|
+
let emitter: any;
|
|
26
11
|
|
|
12
|
+
type HookFn = (payload: string) => unknown | Promise<unknown>;
|
|
13
|
+
type HookMap = {
|
|
14
|
+
version?: string;
|
|
15
|
+
[key: string]: unknown;
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
type HookIdsMap = { [key: string]: string };
|
|
19
|
+
type InitOptions = {
|
|
20
|
+
isDebugMode?: boolean;
|
|
21
|
+
disableMirror?: boolean;
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
// initSdk
|
|
27
25
|
export function initSdk(
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
language?: string
|
|
26
|
+
channelId: string,
|
|
27
|
+
userId?: string,
|
|
28
|
+
properties?: Record<string, unknown> | Map<string, unknown>,
|
|
29
|
+
hooks?: HookMap,
|
|
30
|
+
initOptions?: InitOptions,
|
|
31
|
+
language?: string,
|
|
35
32
|
) {
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
return ScreebModule.setIdentity(userId, properties);
|
|
76
|
-
}
|
|
77
|
-
export function setProperties(properties?: Map<string, any>) {
|
|
78
|
-
return ScreebModule.setProperties(properties);
|
|
33
|
+
// Use NativeEventEmitter on both platforms; pass the native module on iOS
|
|
34
|
+
// and rely on the default emitter on Android.
|
|
35
|
+
if (Platform.OS === "ios") {
|
|
36
|
+
emitter = new NativeEventEmitter(NativeModules.ScreebReactNative);
|
|
37
|
+
} else {
|
|
38
|
+
emitter = DeviceEventEmitter;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
emitter.addListener("ScreebEvent", handleEvent);
|
|
42
|
+
|
|
43
|
+
let mapHooksId: HookIdsMap | undefined;
|
|
44
|
+
if (hooks != null) {
|
|
45
|
+
mapHooksId = {};
|
|
46
|
+
Object.keys(hooks).map((key) => {
|
|
47
|
+
if (key === "version") {
|
|
48
|
+
const v = hooks.version ?? undefined;
|
|
49
|
+
if (v)
|
|
50
|
+
mapHooksId = { ...mapHooksId, version: v } as {
|
|
51
|
+
[key: string]: string;
|
|
52
|
+
};
|
|
53
|
+
} else {
|
|
54
|
+
const uuid = Date.now().toString() + Math.random().toString() + key;
|
|
55
|
+
const fn = (hooks as Record<string, unknown>)[key];
|
|
56
|
+
if (typeof fn === "function") {
|
|
57
|
+
hooksRegistry.set(uuid, fn as HookFn);
|
|
58
|
+
}
|
|
59
|
+
mapHooksId = { ...mapHooksId, [key]: uuid };
|
|
60
|
+
}
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
return ScreebReactNative.initSdk(
|
|
65
|
+
channelId,
|
|
66
|
+
userId,
|
|
67
|
+
toObject(properties),
|
|
68
|
+
mapHooksId,
|
|
69
|
+
initOptions,
|
|
70
|
+
language,
|
|
71
|
+
);
|
|
79
72
|
}
|
|
73
|
+
|
|
74
|
+
// setIdentity
|
|
75
|
+
export function setIdentity(
|
|
76
|
+
userId: string,
|
|
77
|
+
properties?: Record<string, unknown> | Map<string, unknown> | null,
|
|
78
|
+
) {
|
|
79
|
+
return ScreebReactNative.setIdentity(userId, toObject(properties));
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
// setProperties
|
|
83
|
+
export function setProperties(
|
|
84
|
+
properties?: Record<string, unknown> | Map<string, unknown> | null,
|
|
85
|
+
) {
|
|
86
|
+
return ScreebReactNative.setProperties(toObject(properties));
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
// assignGroup
|
|
80
90
|
export function assignGroup(
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
91
|
+
type: string | null,
|
|
92
|
+
name: string,
|
|
93
|
+
properties?: Record<string, unknown> | Map<string, unknown> | null,
|
|
84
94
|
) {
|
|
85
|
-
|
|
95
|
+
return ScreebReactNative.assignGroup(type, name, toObject(properties));
|
|
86
96
|
}
|
|
97
|
+
|
|
98
|
+
// unassignGroup
|
|
87
99
|
export function unassignGroup(
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
100
|
+
type: string | null,
|
|
101
|
+
name: string,
|
|
102
|
+
properties?: Record<string, unknown> | Map<string, unknown> | null,
|
|
91
103
|
) {
|
|
92
|
-
|
|
104
|
+
return ScreebReactNative.unassignGroup(type, name, toObject(properties));
|
|
93
105
|
}
|
|
94
|
-
|
|
95
|
-
|
|
106
|
+
|
|
107
|
+
// trackEvent
|
|
108
|
+
export function trackEvent(
|
|
109
|
+
name: string,
|
|
110
|
+
properties?: Record<string, unknown> | Map<string, unknown> | null,
|
|
111
|
+
) {
|
|
112
|
+
return ScreebReactNative.trackEvent(name, toObject(properties));
|
|
96
113
|
}
|
|
97
|
-
|
|
98
|
-
|
|
114
|
+
|
|
115
|
+
// trackScreen
|
|
116
|
+
export function trackScreen(
|
|
117
|
+
name: string,
|
|
118
|
+
properties?: Record<string, unknown> | Map<string, unknown> | null,
|
|
119
|
+
) {
|
|
120
|
+
return ScreebReactNative.trackScreen(name, toObject(properties));
|
|
99
121
|
}
|
|
122
|
+
|
|
123
|
+
// startSurvey
|
|
100
124
|
export function startSurvey(
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
125
|
+
surveyId: string,
|
|
126
|
+
allowMultipleResponses?: boolean,
|
|
127
|
+
hiddenFields?: Record<string, unknown> | Map<string, unknown> | null,
|
|
128
|
+
ignoreSurveyStatus?: boolean,
|
|
129
|
+
hooks?: HookMap,
|
|
130
|
+
language?: string,
|
|
131
|
+
distributionId?: string,
|
|
107
132
|
) {
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
133
|
+
let mapHooksId: HookIdsMap | undefined;
|
|
134
|
+
if (hooks !== undefined) {
|
|
135
|
+
mapHooksId = {};
|
|
136
|
+
Object.keys(hooks).map((key) => {
|
|
137
|
+
if (key === "version") {
|
|
138
|
+
const v = hooks.version ?? undefined;
|
|
139
|
+
if (v)
|
|
140
|
+
mapHooksId = { ...mapHooksId, version: v } as {
|
|
141
|
+
[key: string]: string;
|
|
142
|
+
};
|
|
143
|
+
} else {
|
|
144
|
+
const uuid = Date.now().toString() + Math.random().toString() + key;
|
|
145
|
+
const fn = (hooks as Record<string, unknown>)[key];
|
|
146
|
+
if (typeof fn === "function") {
|
|
147
|
+
hooksRegistry.set(uuid, fn as HookFn);
|
|
148
|
+
}
|
|
149
|
+
mapHooksId = { ...mapHooksId, [key]: uuid };
|
|
150
|
+
}
|
|
151
|
+
});
|
|
152
|
+
}
|
|
153
|
+
return ScreebReactNative.startSurvey(
|
|
154
|
+
surveyId,
|
|
155
|
+
allowMultipleResponses ?? true,
|
|
156
|
+
toObject(hiddenFields),
|
|
157
|
+
ignoreSurveyStatus ?? true,
|
|
158
|
+
mapHooksId,
|
|
159
|
+
language,
|
|
160
|
+
distributionId,
|
|
161
|
+
);
|
|
129
162
|
}
|
|
163
|
+
|
|
164
|
+
// startMessage
|
|
165
|
+
export function startMessage(
|
|
166
|
+
messageId: string,
|
|
167
|
+
allowMultipleResponses?: boolean,
|
|
168
|
+
hiddenFields?: Record<string, unknown> | Map<string, unknown> | null,
|
|
169
|
+
ignoreMessageStatus?: boolean,
|
|
170
|
+
hooks?: HookMap,
|
|
171
|
+
language?: string,
|
|
172
|
+
distributionId?: string,
|
|
173
|
+
) {
|
|
174
|
+
let mapHooksId: HookIdsMap | undefined;
|
|
175
|
+
if (hooks !== undefined) {
|
|
176
|
+
mapHooksId = {};
|
|
177
|
+
Object.keys(hooks).map((key) => {
|
|
178
|
+
if (key === "version") {
|
|
179
|
+
const v = hooks.version ?? undefined;
|
|
180
|
+
if (v)
|
|
181
|
+
mapHooksId = { ...mapHooksId, version: v } as {
|
|
182
|
+
[key: string]: string;
|
|
183
|
+
};
|
|
184
|
+
} else {
|
|
185
|
+
const uuid = Date.now().toString() + Math.random().toString() + key;
|
|
186
|
+
const fn = (hooks as Record<string, unknown>)[key];
|
|
187
|
+
if (typeof fn === "function") {
|
|
188
|
+
hooksRegistry.set(uuid, fn as HookFn);
|
|
189
|
+
}
|
|
190
|
+
mapHooksId = { ...mapHooksId, [key]: uuid };
|
|
191
|
+
}
|
|
192
|
+
});
|
|
193
|
+
}
|
|
194
|
+
return ScreebReactNative.startMessage(
|
|
195
|
+
messageId,
|
|
196
|
+
allowMultipleResponses ?? true,
|
|
197
|
+
toObject(hiddenFields),
|
|
198
|
+
ignoreMessageStatus ?? true,
|
|
199
|
+
mapHooksId,
|
|
200
|
+
language,
|
|
201
|
+
distributionId,
|
|
202
|
+
);
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
// debug
|
|
130
206
|
export function debug() {
|
|
131
|
-
|
|
207
|
+
return ScreebReactNative.debug();
|
|
132
208
|
}
|
|
209
|
+
|
|
210
|
+
// debugTargeting
|
|
133
211
|
export function debugTargeting() {
|
|
134
|
-
|
|
212
|
+
return ScreebReactNative.debugTargeting();
|
|
135
213
|
}
|
|
214
|
+
|
|
215
|
+
// resetIdentity
|
|
136
216
|
export function resetIdentity() {
|
|
137
|
-
|
|
217
|
+
return ScreebReactNative.resetIdentity();
|
|
138
218
|
}
|
|
219
|
+
|
|
220
|
+
// closeSdk
|
|
139
221
|
export function closeSdk() {
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
222
|
+
if (emitter) {
|
|
223
|
+
emitter.removeAllListeners("ScreebEvent");
|
|
224
|
+
emitter = undefined;
|
|
225
|
+
}
|
|
226
|
+
return ScreebReactNative.closeSdk();
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
// closeSurvey
|
|
230
|
+
export function closeSurvey(surveyId?: string) {
|
|
231
|
+
return ScreebReactNative.closeSurvey(surveyId);
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
// closeMessage
|
|
235
|
+
export function closeMessage(messageId?: string) {
|
|
236
|
+
return ScreebReactNative.closeMessage(messageId);
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
const hooksRegistry = new Map<
|
|
240
|
+
string,
|
|
241
|
+
(payload: string) => unknown | Promise<unknown>
|
|
242
|
+
>();
|
|
243
|
+
|
|
244
|
+
function handleEvent(event: { hookId?: string; payload?: string }) {
|
|
245
|
+
if (event?.hookId != null) {
|
|
246
|
+
const hook = hooksRegistry.get(event.hookId);
|
|
247
|
+
if (hook != null) {
|
|
248
|
+
const payload = event.payload ?? "{}";
|
|
249
|
+
const result = hook(payload);
|
|
250
|
+
const parsedPayload = JSON.parse(payload);
|
|
251
|
+
const originalHookId = parsedPayload?.hook_id;
|
|
252
|
+
if (originalHookId) {
|
|
253
|
+
if (result instanceof Promise) {
|
|
254
|
+
result
|
|
255
|
+
.then((result) => {
|
|
256
|
+
ScreebReactNative.onHookResult(originalHookId, { result });
|
|
257
|
+
})
|
|
258
|
+
.catch((error) => {
|
|
259
|
+
console.error(error);
|
|
260
|
+
});
|
|
261
|
+
} else {
|
|
262
|
+
ScreebReactNative.onHookResult(originalHookId, { result });
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
function toObject(
|
|
270
|
+
value?: Record<string, unknown> | Map<string, unknown> | null,
|
|
271
|
+
): { [key: string]: unknown } | undefined {
|
|
272
|
+
if (value == null) return undefined;
|
|
273
|
+
if (value instanceof Map) {
|
|
274
|
+
return Object.fromEntries(value as Map<string, unknown>);
|
|
275
|
+
}
|
|
276
|
+
return value as { [key: string]: unknown };
|
|
170
277
|
}
|
|
Binary file
|
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" "$@"
|