@chen834921478/react-native-select-contact 1.6.3
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/.github/workflows/npm-publish.yml +33 -0
- package/CHANGELOG.md +57 -0
- package/RCTSelectContact.podspec +23 -0
- package/README.md +177 -0
- package/android/build.gradle +52 -0
- package/android/gradle/wrapper/gradle-wrapper.jar +0 -0
- package/android/gradle/wrapper/gradle-wrapper.properties +5 -0
- package/android/gradlew +188 -0
- package/android/gradlew.bat +100 -0
- package/android/keystores/BUCK +8 -0
- package/android/keystores/debug.keystore.properties +4 -0
- package/android/src/main/AndroidManifest.xml +6 -0
- package/android/src/main/java/com/streem/selectcontact/SelectContactModule.java +271 -0
- package/android/src/main/java/com/streem/selectcontact/SelectContactPackage.java +25 -0
- package/android/src/main/res/mipmap-hdpi/ic_launcher.png +0 -0
- package/android/src/main/res/mipmap-mdpi/ic_launcher.png +0 -0
- package/android/src/main/res/mipmap-xhdpi/ic_launcher.png +0 -0
- package/android/src/main/res/mipmap-xxhdpi/ic_launcher.png +0 -0
- package/android/src/main/res/values/strings.xml +3 -0
- package/android/src/main/res/values/styles.xml +8 -0
- package/index.js +204 -0
- package/ios/RCTSelectContact/RCTSelectContact.h +13 -0
- package/ios/RCTSelectContact/RCTSelectContact.m +107 -0
- package/ios/SelectContact.xcodeproj/project.pbxproj +291 -0
- package/ios/SelectContact.xcodeproj/project.xcworkspace/contents.xcworkspacedata +7 -0
- package/ios/SelectContact.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +8 -0
- package/ios/SelectContact.xcodeproj/project.xcworkspace/xcuserdata/oliverjacobs.xcuserdatad/UserInterfaceState.xcuserstate +0 -0
- package/ios/SelectContact.xcodeproj/project.xcworkspace/xcuserdata/seanadkinson.xcuserdatad/UserInterfaceState.xcuserstate +0 -0
- package/ios/SelectContact.xcodeproj/xcshareddata/xcschemes/SelectContact.xcscheme +115 -0
- package/ios/SelectContact.xcodeproj/xcuserdata/oliverjacobs.xcuserdatad/xcschemes/RCTContactsWrapper.xcscheme +80 -0
- package/ios/SelectContact.xcodeproj/xcuserdata/oliverjacobs.xcuserdatad/xcschemes/xcschememanagement.plist +37 -0
- package/ios/SelectContact.xcodeproj/xcuserdata/seanadkinson.xcuserdatad/xcschemes/RCTSelectContact.xcscheme +80 -0
- package/ios/SelectContact.xcodeproj/xcuserdata/seanadkinson.xcuserdatad/xcschemes/xcschememanagement.plist +27 -0
- package/license.txt +21 -0
- package/package.json +44 -0
- package/react-native-select-contact.podspec +19 -0
- package/selectContact.d.ts +62 -0
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
# This workflow will run tests using node and then publish a package to GitHub Packages when a release is created
|
|
2
|
+
# For more information see: https://docs.github.com/en/actions/publishing-packages/publishing-nodejs-packages
|
|
3
|
+
|
|
4
|
+
name: Node.js Package
|
|
5
|
+
|
|
6
|
+
on:
|
|
7
|
+
release:
|
|
8
|
+
types: [created]
|
|
9
|
+
|
|
10
|
+
jobs:
|
|
11
|
+
build:
|
|
12
|
+
runs-on: ubuntu-latest
|
|
13
|
+
steps:
|
|
14
|
+
- uses: actions/checkout@v4
|
|
15
|
+
- uses: actions/setup-node@v4
|
|
16
|
+
with:
|
|
17
|
+
node-version: 20
|
|
18
|
+
- run: npm ci
|
|
19
|
+
- run: npm test
|
|
20
|
+
|
|
21
|
+
publish-npm:
|
|
22
|
+
needs: build
|
|
23
|
+
runs-on: ubuntu-latest
|
|
24
|
+
steps:
|
|
25
|
+
- uses: actions/checkout@v4
|
|
26
|
+
- uses: actions/setup-node@v4
|
|
27
|
+
with:
|
|
28
|
+
node-version: 20
|
|
29
|
+
registry-url: https://registry.npmjs.org/
|
|
30
|
+
- run: npm ci
|
|
31
|
+
- run: npm publish
|
|
32
|
+
env:
|
|
33
|
+
NODE_AUTH_TOKEN: ${{secrets.npm_token}}
|
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
### 1.6.3
|
|
2
|
+
* Fix iOS source files [#45]
|
|
3
|
+
|
|
4
|
+
### 1.6.2
|
|
5
|
+
* Actually fix podspec [#44]
|
|
6
|
+
|
|
7
|
+
### 1.6.1
|
|
8
|
+
* Fix podspec by adding a "summary" to `package.json` [#44]
|
|
9
|
+
|
|
10
|
+
### 1.6.0
|
|
11
|
+
* Various dependency updates from SecurityBot [#37] [#39] [#40] [#41]
|
|
12
|
+
* Remove `tintColor: blue`, so that iOS light/dark mode behave better [#43]
|
|
13
|
+
* Fix possible NPE on Android [#35]
|
|
14
|
+
|
|
15
|
+
### 1.5.0
|
|
16
|
+
* Support for RN 0.62 [#27] [#29]
|
|
17
|
+
|
|
18
|
+
### 1.4.0
|
|
19
|
+
* Multi-layer Modals [#30]
|
|
20
|
+
|
|
21
|
+
### 1.3.2
|
|
22
|
+
* Revert 1.3.1, picker on main thread... IOS build issues [#24]
|
|
23
|
+
|
|
24
|
+
### 1.3.1
|
|
25
|
+
* Using picker from main thread [#23]
|
|
26
|
+
|
|
27
|
+
### 1.3.0
|
|
28
|
+
|
|
29
|
+
* Loosen react-native version restriction to >= 0.51
|
|
30
|
+
* Update `react-native-action-sheet` dependency
|
|
31
|
+
* Updated `mixin-deep` dependency
|
|
32
|
+
* Android warnings fixes
|
|
33
|
+
* Instructions updates
|
|
34
|
+
|
|
35
|
+
### 1.2.1
|
|
36
|
+
|
|
37
|
+
* Add Podfile for RN 0.60+
|
|
38
|
+
|
|
39
|
+
### 1.2.0
|
|
40
|
+
|
|
41
|
+
* Add `recordId` to contacts [#5]
|
|
42
|
+
|
|
43
|
+
### 1.1.1
|
|
44
|
+
|
|
45
|
+
* Updated typescript typings with postal address fields
|
|
46
|
+
|
|
47
|
+
### 1.1.0
|
|
48
|
+
|
|
49
|
+
* Returning postal address data with contact's now
|
|
50
|
+
* New API call to select a contact's postal address
|
|
51
|
+
* Returning separate name elements for givenName, familyName, and middleName
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
### 1.0.0
|
|
55
|
+
|
|
56
|
+
* Initial release
|
|
57
|
+
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
require 'json'
|
|
2
|
+
|
|
3
|
+
package = JSON.parse(File.read(File.join(__dir__, 'package.json')))
|
|
4
|
+
|
|
5
|
+
Pod::Spec.new do |s|
|
|
6
|
+
s.name = "RCTSelectContact"
|
|
7
|
+
s.version = package['version']
|
|
8
|
+
s.summary = "Simple iOS contact picker"
|
|
9
|
+
s.homepage = "https://github.com/streem/react-native-select-contact"
|
|
10
|
+
s.license = package['license']
|
|
11
|
+
s.author = package['author']
|
|
12
|
+
s.source = { :git => 'https://github.com/streem/react-native-select-contact.git', :tag => "v#{s.version}" }
|
|
13
|
+
s.default_subspec = 'Core'
|
|
14
|
+
s.requires_arc = true
|
|
15
|
+
s.platform = :ios, "8.0"
|
|
16
|
+
|
|
17
|
+
s.dependency 'React'
|
|
18
|
+
|
|
19
|
+
s.subspec 'Core' do |ss|
|
|
20
|
+
ss.source_files = "ios/RCTSelectContact/*.{h,m}"
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
end
|
package/README.md
ADDED
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
# react-native-select-contact
|
|
2
|
+
|
|
3
|
+
Originally branched from [react-native-contacts-wrapper](https://github.com/LynxITDigital/react-native-contacts-wrapper)
|
|
4
|
+
|
|
5
|
+
This is a simple wrapper for the native iOS and Android Contact Picker UIs, with some optional help for selecting specific fields from the contact.
|
|
6
|
+
|
|
7
|
+
### Installation
|
|
8
|
+
|
|
9
|
+
```
|
|
10
|
+
yarn add react-native-select-contact@https://github.com/chen834921478/react-native-contact-select.git
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
```
|
|
14
|
+
or with NPM
|
|
15
|
+
```
|
|
16
|
+
npm install react-native-select-contact@https://github.com/chen834921478/react-native-contact-select.git
|
|
17
|
+
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
For React Native => 0.59 only:
|
|
21
|
+
```
|
|
22
|
+
react-native link react-native-select-contact
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
#### Android
|
|
26
|
+
For Android support, make sure your manifest file includes permission to read contacts along with a query intent for Android 11+:
|
|
27
|
+
```xml
|
|
28
|
+
<manifest>
|
|
29
|
+
<!-- Add this for overall Android support -->
|
|
30
|
+
<uses-permission android:name="android.permission.READ_CONTACTS" />
|
|
31
|
+
<application>
|
|
32
|
+
...
|
|
33
|
+
</application>
|
|
34
|
+
<!-- Also add this for Android 11+ support -->
|
|
35
|
+
<queries>
|
|
36
|
+
<intent>
|
|
37
|
+
<action android:name="android.intent.action.VIEW" />
|
|
38
|
+
<category android:name="android.intent.category.DEFAULT" />
|
|
39
|
+
<data android:mimeType="vnd.android.cursor.dir/contact" />
|
|
40
|
+
</intent>
|
|
41
|
+
</queries>
|
|
42
|
+
</manifest>
|
|
43
|
+
```
|
|
44
|
+
Also, in addition to declaring `READ_CONTACTS` permission in `AndroidManifest.xml`, you also need to explicitly request for the permission at runtime. So make sure `READ_CONTACT` permission is granted at runtime before calling API method(s).
|
|
45
|
+
|
|
46
|
+
#### iOS
|
|
47
|
+
For iOS support, make sure to include usage description for contacts in your `Info.plist` file
|
|
48
|
+
```xml
|
|
49
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
50
|
+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
|
51
|
+
<plist version="1.0">
|
|
52
|
+
<dict>
|
|
53
|
+
...
|
|
54
|
+
<key>NSContactsUsageDescription</key>
|
|
55
|
+
<string>THis app uses your contacts to....</string>
|
|
56
|
+
...
|
|
57
|
+
</dict>
|
|
58
|
+
</plist>
|
|
59
|
+
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
### API
|
|
63
|
+
|
|
64
|
+
#### Methods
|
|
65
|
+
|
|
66
|
+
```javascript
|
|
67
|
+
selectContact(): Promise<Contact | null>;
|
|
68
|
+
selectContactPhone(): Promise<ContactPhoneSelection | null>;
|
|
69
|
+
selectContactEmail(): Promise<ContactEmailSelection | null>;
|
|
70
|
+
selectContactPostalAddress(): Promise<ContactPostalAddressSelection | null>;
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
These methods all open up a separate ViewController (on IOS) or Activity (on Android) to select a contact. See Types below.
|
|
74
|
+
|
|
75
|
+
For `selectContactPhone`, `selectContactEmail`, or `selectContactPostalAddress`, if there are more than one phone or email, an `ActionSheetIOS` is
|
|
76
|
+
shown for IOS, and the first entry is returned for Android.
|
|
77
|
+
|
|
78
|
+
A return value `null` may be because the user cancelled the contact selection. You shouldn't need to worry about doing
|
|
79
|
+
anything if the promise resolves to `null`.
|
|
80
|
+
|
|
81
|
+
#### Optional Android ActionSheet
|
|
82
|
+
|
|
83
|
+
You can enable ActionSheet functionality for Android by installing an optional dependency:
|
|
84
|
+
|
|
85
|
+
```
|
|
86
|
+
yarn add react-native-action-sheet
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
For React Native => 0.59 only:
|
|
90
|
+
```
|
|
91
|
+
react-native link react-native-action-sheet
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
This will provide an `ActionSheetAndroid` native module that this library will pick up on and use
|
|
95
|
+
when there are more than one phone number or email on a selected contact.
|
|
96
|
+
|
|
97
|
+
#### Types
|
|
98
|
+
|
|
99
|
+
```typescript
|
|
100
|
+
interface PhoneEntry {
|
|
101
|
+
number: string,
|
|
102
|
+
type: string
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
interface EmailEntry {
|
|
106
|
+
address: string,
|
|
107
|
+
type: string
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
interface AddressEntry {
|
|
111
|
+
formattedAddress: string, // android only
|
|
112
|
+
type: string, // android only
|
|
113
|
+
street: string,
|
|
114
|
+
city: string,
|
|
115
|
+
state: string,
|
|
116
|
+
postalCode: string,
|
|
117
|
+
isoCountryCode: string
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
interface Contact {
|
|
121
|
+
name: string,
|
|
122
|
+
phones: PhoneEntry[],
|
|
123
|
+
emails: EmailEntry[],
|
|
124
|
+
postalAddresses: AddressEntry[]
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
interface ContactPhoneSelection {
|
|
128
|
+
contact: Contact,
|
|
129
|
+
selectedPhone: PhoneEntry
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
interface ContactEmailSelection {
|
|
133
|
+
contact: Contact,
|
|
134
|
+
selectedEmail: EmailEntry
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
interface ContactPostalAddressSelection {
|
|
138
|
+
contact: Contact,
|
|
139
|
+
selectedAddress: AddressEntry
|
|
140
|
+
}
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
### Example
|
|
144
|
+
|
|
145
|
+
```javascript
|
|
146
|
+
|
|
147
|
+
import { selectContactPhone } from 'react-native-select-contact';
|
|
148
|
+
import { PermissionsAndroid, Platform } from 'react-native';
|
|
149
|
+
|
|
150
|
+
async function getPhoneNumber() {
|
|
151
|
+
// on android we need to explicitly request for contacts permission and make sure it's granted
|
|
152
|
+
// before calling API methods
|
|
153
|
+
if (Platform.OS === 'android') {
|
|
154
|
+
const request = await PermissionsAndroid.request(
|
|
155
|
+
PermissionsAndroid.PERMISSIONS.READ_CONTACTS,
|
|
156
|
+
);
|
|
157
|
+
|
|
158
|
+
// denied permission
|
|
159
|
+
if (request === PermissionsAndroid.RESULTS.DENIED) throw Error("Permission Denied");
|
|
160
|
+
|
|
161
|
+
// user chose 'deny, don't ask again'
|
|
162
|
+
else if (request === PermissionsAndroid.RESULTS.NEVER_ASK_AGAIN) throw Error("Permission Denied");
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
// Here we are sure permission is granted for android or that platform is not android
|
|
166
|
+
const selection = await selectContactPhone();
|
|
167
|
+
if (!selection) {
|
|
168
|
+
return null;
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
let { contact, selectedPhone } = selection;
|
|
172
|
+
console.log(`Selected ${selectedPhone.type} phone number ${selectedPhone.number} from ${contact.name}`);
|
|
173
|
+
return selectedPhone.number;
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
|
|
177
|
+
```
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
def safeExtGet(prop, fallback) {
|
|
2
|
+
rootProject.ext.has(prop) ? rootProject.ext.get(prop) : fallback
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
buildscript {
|
|
6
|
+
// The Android Gradle plugin is only required when opening the android folder stand-alone.
|
|
7
|
+
// This avoids unnecessary downloads and potential conflicts when the library is included as a
|
|
8
|
+
// module dependency in an application project.
|
|
9
|
+
if (project == rootProject) {
|
|
10
|
+
repositories {
|
|
11
|
+
google()
|
|
12
|
+
mavencentral()
|
|
13
|
+
}
|
|
14
|
+
dependencies {
|
|
15
|
+
classpath 'com.android.tools.build:gradle:3.5.2'
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
apply plugin: 'com.android.library'
|
|
21
|
+
|
|
22
|
+
android {
|
|
23
|
+
compileSdkVersion safeExtGet('compileSdkVersion', 28)
|
|
24
|
+
buildToolsVersion safeExtGet('buildToolsVersion', '28.0.3')
|
|
25
|
+
defaultConfig {
|
|
26
|
+
minSdkVersion safeExtGet('minSdkVersion', 16)
|
|
27
|
+
targetSdkVersion safeExtGet('targetSdkVersion', 28)
|
|
28
|
+
}
|
|
29
|
+
lintOptions {
|
|
30
|
+
abortOnError false
|
|
31
|
+
warning 'InvalidPackage'
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
repositories {
|
|
36
|
+
mavenLocal()
|
|
37
|
+
maven {
|
|
38
|
+
// All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
|
|
39
|
+
url "$rootDir/../node_modules/react-native/android"
|
|
40
|
+
}
|
|
41
|
+
maven {
|
|
42
|
+
// Android JSC is installed from npm
|
|
43
|
+
url "$rootDir/../node_modules/jsc-android/dist"
|
|
44
|
+
}
|
|
45
|
+
google()
|
|
46
|
+
mavencentral()
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
dependencies {
|
|
50
|
+
//noinspection GradleDynamicVersion
|
|
51
|
+
implementation 'com.facebook.react:react-native:+' // From node_modules
|
|
52
|
+
}
|
|
Binary file
|
package/android/gradlew
ADDED
|
@@ -0,0 +1,188 @@
|
|
|
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
|
+
# Determine the Java command to use to start the JVM.
|
|
86
|
+
if [ -n "$JAVA_HOME" ] ; then
|
|
87
|
+
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
|
|
88
|
+
# IBM's JDK on AIX uses strange locations for the executables
|
|
89
|
+
JAVACMD="$JAVA_HOME/jre/sh/java"
|
|
90
|
+
else
|
|
91
|
+
JAVACMD="$JAVA_HOME/bin/java"
|
|
92
|
+
fi
|
|
93
|
+
if [ ! -x "$JAVACMD" ] ; then
|
|
94
|
+
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
|
|
95
|
+
|
|
96
|
+
Please set the JAVA_HOME variable in your environment to match the
|
|
97
|
+
location of your Java installation."
|
|
98
|
+
fi
|
|
99
|
+
else
|
|
100
|
+
JAVACMD="java"
|
|
101
|
+
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
|
102
|
+
|
|
103
|
+
Please set the JAVA_HOME variable in your environment to match the
|
|
104
|
+
location of your Java installation."
|
|
105
|
+
fi
|
|
106
|
+
|
|
107
|
+
# Increase the maximum file descriptors if we can.
|
|
108
|
+
if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
|
|
109
|
+
MAX_FD_LIMIT=`ulimit -H -n`
|
|
110
|
+
if [ $? -eq 0 ] ; then
|
|
111
|
+
if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
|
|
112
|
+
MAX_FD="$MAX_FD_LIMIT"
|
|
113
|
+
fi
|
|
114
|
+
ulimit -n $MAX_FD
|
|
115
|
+
if [ $? -ne 0 ] ; then
|
|
116
|
+
warn "Could not set maximum file descriptor limit: $MAX_FD"
|
|
117
|
+
fi
|
|
118
|
+
else
|
|
119
|
+
warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
|
|
120
|
+
fi
|
|
121
|
+
fi
|
|
122
|
+
|
|
123
|
+
# For Darwin, add options to specify how the application appears in the dock
|
|
124
|
+
if $darwin; then
|
|
125
|
+
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
|
|
126
|
+
fi
|
|
127
|
+
|
|
128
|
+
# For Cygwin or MSYS, switch paths to Windows format before running java
|
|
129
|
+
if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
|
|
130
|
+
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
|
|
131
|
+
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
|
|
132
|
+
JAVACMD=`cygpath --unix "$JAVACMD"`
|
|
133
|
+
|
|
134
|
+
# We build the pattern for arguments to be converted via cygpath
|
|
135
|
+
ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
|
|
136
|
+
SEP=""
|
|
137
|
+
for dir in $ROOTDIRSRAW ; do
|
|
138
|
+
ROOTDIRS="$ROOTDIRS$SEP$dir"
|
|
139
|
+
SEP="|"
|
|
140
|
+
done
|
|
141
|
+
OURCYGPATTERN="(^($ROOTDIRS))"
|
|
142
|
+
# Add a user-defined pattern to the cygpath arguments
|
|
143
|
+
if [ "$GRADLE_CYGPATTERN" != "" ] ; then
|
|
144
|
+
OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
|
|
145
|
+
fi
|
|
146
|
+
# Now convert the arguments - kludge to limit ourselves to /bin/sh
|
|
147
|
+
i=0
|
|
148
|
+
for arg in "$@" ; do
|
|
149
|
+
CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
|
|
150
|
+
CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
|
|
151
|
+
|
|
152
|
+
if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
|
|
153
|
+
eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
|
|
154
|
+
else
|
|
155
|
+
eval `echo args$i`="\"$arg\""
|
|
156
|
+
fi
|
|
157
|
+
i=$((i+1))
|
|
158
|
+
done
|
|
159
|
+
case $i in
|
|
160
|
+
(0) set -- ;;
|
|
161
|
+
(1) set -- "$args0" ;;
|
|
162
|
+
(2) set -- "$args0" "$args1" ;;
|
|
163
|
+
(3) set -- "$args0" "$args1" "$args2" ;;
|
|
164
|
+
(4) set -- "$args0" "$args1" "$args2" "$args3" ;;
|
|
165
|
+
(5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
|
|
166
|
+
(6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
|
|
167
|
+
(7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
|
|
168
|
+
(8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
|
|
169
|
+
(9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
|
|
170
|
+
esac
|
|
171
|
+
fi
|
|
172
|
+
|
|
173
|
+
# Escape application args
|
|
174
|
+
save () {
|
|
175
|
+
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
|
|
176
|
+
echo " "
|
|
177
|
+
}
|
|
178
|
+
APP_ARGS=$(save "$@")
|
|
179
|
+
|
|
180
|
+
# Collect all arguments for the java command, following the shell quoting and substitution rules
|
|
181
|
+
eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
|
|
182
|
+
|
|
183
|
+
# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong
|
|
184
|
+
if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then
|
|
185
|
+
cd "$(dirname "$0")"
|
|
186
|
+
fi
|
|
187
|
+
|
|
188
|
+
exec "$JAVACMD" "$@"
|
|
@@ -0,0 +1,100 @@
|
|
|
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 Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
|
33
|
+
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
|
|
34
|
+
|
|
35
|
+
@rem Find java.exe
|
|
36
|
+
if defined JAVA_HOME goto findJavaFromJavaHome
|
|
37
|
+
|
|
38
|
+
set JAVA_EXE=java.exe
|
|
39
|
+
%JAVA_EXE% -version >NUL 2>&1
|
|
40
|
+
if "%ERRORLEVEL%" == "0" goto init
|
|
41
|
+
|
|
42
|
+
echo.
|
|
43
|
+
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
|
44
|
+
echo.
|
|
45
|
+
echo Please set the JAVA_HOME variable in your environment to match the
|
|
46
|
+
echo location of your Java installation.
|
|
47
|
+
|
|
48
|
+
goto fail
|
|
49
|
+
|
|
50
|
+
:findJavaFromJavaHome
|
|
51
|
+
set JAVA_HOME=%JAVA_HOME:"=%
|
|
52
|
+
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
|
|
53
|
+
|
|
54
|
+
if exist "%JAVA_EXE%" goto init
|
|
55
|
+
|
|
56
|
+
echo.
|
|
57
|
+
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
|
|
58
|
+
echo.
|
|
59
|
+
echo Please set the JAVA_HOME variable in your environment to match the
|
|
60
|
+
echo location of your Java installation.
|
|
61
|
+
|
|
62
|
+
goto fail
|
|
63
|
+
|
|
64
|
+
:init
|
|
65
|
+
@rem Get command-line arguments, handling Windows variants
|
|
66
|
+
|
|
67
|
+
if not "%OS%" == "Windows_NT" goto win9xME_args
|
|
68
|
+
|
|
69
|
+
:win9xME_args
|
|
70
|
+
@rem Slurp the command line arguments.
|
|
71
|
+
set CMD_LINE_ARGS=
|
|
72
|
+
set _SKIP=2
|
|
73
|
+
|
|
74
|
+
:win9xME_args_slurp
|
|
75
|
+
if "x%~1" == "x" goto execute
|
|
76
|
+
|
|
77
|
+
set CMD_LINE_ARGS=%*
|
|
78
|
+
|
|
79
|
+
:execute
|
|
80
|
+
@rem Setup the command line
|
|
81
|
+
|
|
82
|
+
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
|
|
83
|
+
|
|
84
|
+
@rem Execute Gradle
|
|
85
|
+
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
|
|
86
|
+
|
|
87
|
+
:end
|
|
88
|
+
@rem End local scope for the variables with windows NT shell
|
|
89
|
+
if "%ERRORLEVEL%"=="0" goto mainEnd
|
|
90
|
+
|
|
91
|
+
:fail
|
|
92
|
+
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
|
|
93
|
+
rem the _cmd.exe /c_ return code!
|
|
94
|
+
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
|
|
95
|
+
exit /b 1
|
|
96
|
+
|
|
97
|
+
:mainEnd
|
|
98
|
+
if "%OS%"=="Windows_NT" endlocal
|
|
99
|
+
|
|
100
|
+
:omega
|