Compare commits
172 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c0df73c3c1 | ||
|
|
211a7fc6a8 | ||
|
|
ce67804b65 | ||
|
|
f3ded26e35 | ||
|
|
4b688f8715 | ||
|
|
e3b3bcd75f | ||
|
|
5a7590397d | ||
|
|
af31c83ec1 | ||
|
|
bd94735ba2 | ||
|
|
46e47a3c5c | ||
|
|
814aca2b68 | ||
|
|
cf159c1ae3 | ||
|
|
4868d5e59e | ||
|
|
34c7e8a534 | ||
|
|
d36cfeafa2 | ||
|
|
d2c71e7d75 | ||
|
|
fc8cd37495 | ||
|
|
3f1113ed8f | ||
|
|
4d55fdb3e5 | ||
|
|
b175d611bd | ||
|
|
6d084428a8 | ||
|
|
312efc3878 | ||
|
|
301faebfcc | ||
|
|
a8af103ff4 | ||
|
|
0df50c3f33 | ||
|
|
08c80f77a9 | ||
|
|
ea8d65d7fc | ||
|
|
e3198b0f6b | ||
|
|
19220de388 | ||
|
|
52878d6c5b | ||
|
|
abfece70c1 | ||
|
|
33da6e9eb8 | ||
|
|
4919a2d2a8 | ||
|
|
2f2e8a560d | ||
|
|
884818934f | ||
|
|
1d8e6f53a1 | ||
|
|
3554267adf | ||
|
|
f7687a2567 | ||
|
|
ebd4a02d2c | ||
|
|
4a354bba86 | ||
|
|
d40c22441f | ||
|
|
6395eda0c8 | ||
|
|
eb6ada8091 | ||
|
|
a7ef686a27 | ||
|
|
e2af492a63 | ||
|
|
84de9ee0da | ||
|
|
e182e669f0 | ||
|
|
a9a28d3e77 | ||
|
|
6a77acdbf2 | ||
|
|
028725468a | ||
|
|
9dbffa6ee8 | ||
|
|
2d3f3cae13 | ||
|
|
fb9f0f3ee8 | ||
|
|
ab276504fd | ||
|
|
3cc4e5b440 | ||
|
|
b2664bc469 | ||
|
|
7d5afdebe1 | ||
|
|
3bbc7fb328 | ||
|
|
ac6ad2dea1 | ||
|
|
0b116f1b5c | ||
|
|
acdb934ef9 | ||
|
|
5591a1a4e8 | ||
|
|
124574bb3a | ||
|
|
a2cfaab7f4 | ||
|
|
6355425a6f | ||
|
|
2d96995801 | ||
|
|
3fc4daa447 | ||
|
|
c7ff24b983 | ||
|
|
3f674faf30 | ||
|
|
b9ad1b6b26 | ||
|
|
676f0ddc2e | ||
|
|
6c60dc5dc8 | ||
|
|
1af5ade39a | ||
|
|
ad40d33400 | ||
|
|
5017e2302b | ||
|
|
3bfeda4a3b | ||
|
|
348b1b4dda | ||
|
|
0fd7e7f040 | ||
|
|
cfa0fa7243 | ||
|
|
6a63d9df0a | ||
|
|
36646eb527 | ||
|
|
48940bf4c0 | ||
|
|
5346a386f7 | ||
|
|
b3201ad073 | ||
|
|
35b0ba6d07 | ||
|
|
3c087c6716 | ||
|
|
854946e313 | ||
|
|
d6a1d7a913 | ||
|
|
700b425774 | ||
|
|
e31634b0fb | ||
|
|
1f06176149 | ||
|
|
e628026cf0 | ||
|
|
3a512c300e | ||
|
|
7f9e7c73ab | ||
|
|
3e7be6cc0f | ||
|
|
81dfe96355 | ||
|
|
efa23bd39b | ||
|
|
6aa4b1b301 | ||
|
|
304cbef5ed | ||
|
|
263968e019 | ||
|
|
c05521e55a | ||
|
|
2f3c71feaa | ||
|
|
0b710a86a9 | ||
|
|
2e37d2c253 | ||
|
|
d7c1dc5517 | ||
|
|
77b9fd62a7 | ||
|
|
f838db4e18 | ||
|
|
b2d7124424 | ||
|
|
2532c4a39e | ||
|
|
be19585c68 | ||
|
|
ca0cbad1c7 | ||
|
|
fb53452d37 | ||
|
|
b5246f3f09 | ||
|
|
4be413af79 | ||
|
|
5db2de95f5 | ||
|
|
6418add83d | ||
|
|
7d26c51da6 | ||
|
|
dcada79e06 | ||
|
|
37384c583d | ||
|
|
9544783b5e | ||
|
|
eaf9b319ca | ||
|
|
47abde2f8d | ||
|
|
30325e4f32 | ||
|
|
9cf38f8705 | ||
|
|
7de4803e21 | ||
|
|
9586a7ddcd | ||
|
|
a4f6c8bf7b | ||
|
|
f5ab6fc602 | ||
|
|
222fb1c0e7 | ||
|
|
511fe7c51e | ||
|
|
acb3cc80b7 | ||
|
|
23fd0982b0 | ||
|
|
d2a159d2dc | ||
|
|
dc0bfeb0cc | ||
|
|
deea0f7e4f | ||
|
|
3a33f4c0a6 | ||
|
|
312872adaf | ||
|
|
ba5e3a81e0 | ||
|
|
bf5c32d780 | ||
|
|
d3cb38de29 | ||
|
|
047ed52d60 | ||
|
|
bb96bb9a88 | ||
|
|
0ee672d2b0 | ||
|
|
2a8a6b3970 | ||
|
|
5dbc51da59 | ||
|
|
f1a6d938cd | ||
|
|
991a2b1873 | ||
|
|
172c01561b | ||
|
|
b2f061cbaf | ||
|
|
1f1b2977a4 | ||
|
|
4a0a7bc424 | ||
|
|
8fbb6d7c62 | ||
|
|
0299467831 | ||
|
|
2efe240617 | ||
|
|
ed543dc648 | ||
|
|
db6295c917 | ||
|
|
d54a42f0f0 | ||
|
|
74ae6651c8 | ||
|
|
f33f352501 | ||
|
|
39c17e71ef | ||
|
|
081637134f | ||
|
|
39165a8694 | ||
|
|
ad163ce244 | ||
|
|
a7176d39f0 | ||
|
|
f1c185b771 | ||
|
|
103e1e8d24 | ||
|
|
30198c4bdd | ||
|
|
841f02f43f | ||
|
|
a5e9861440 | ||
|
|
d69698c23f | ||
|
|
d763f14ffe | ||
|
|
2cefb42559 |
22
.github/PULL_REQUEST_TEMPLATE.md
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
<!--
|
||||
Please make sure the checklist boxes are all checked before submitting the PR. The checklist
|
||||
is intended as a quick reference, for complete details please see our Contributor Guidelines:
|
||||
|
||||
http://cordova.apache.org/contribute/contribute_guidelines.html
|
||||
|
||||
Thanks!
|
||||
-->
|
||||
|
||||
### Platforms affected
|
||||
|
||||
|
||||
### What does this PR do?
|
||||
|
||||
|
||||
### What testing has been done on this change?
|
||||
|
||||
|
||||
### Checklist
|
||||
- [ ] [Reported an issue](http://cordova.apache.org/contribute/issues.html) in the JIRA database
|
||||
- [ ] Commit message follows the format: "CB-3232: (android) Fix bug with resolving file paths", where CB-xxxx is the JIRA ID & "android" is the platform affected.
|
||||
- [ ] Added automated test coverage as appropriate for this change.
|
||||
7
.gitignore
vendored
@@ -40,10 +40,9 @@ Desktop.ini
|
||||
*.iml
|
||||
.idea
|
||||
npm-debug.log
|
||||
/framework/build
|
||||
node_modules/jshint
|
||||
node_modules/promise-matchers
|
||||
node_modules/jasmine-node
|
||||
node_modules/jasmine
|
||||
node_modules/rewire
|
||||
node_modules/istanbul
|
||||
node_modules/.bin/cake
|
||||
@@ -54,7 +53,7 @@ node_modules/.bin/esparse
|
||||
node_modules/.bin/esvalidate
|
||||
node_modules/.bin/handlebars
|
||||
node_modules/.bin/istanbul
|
||||
node_modules/.bin/jasmine-node
|
||||
node_modules/.bin/jasmine
|
||||
node_modules/.bin/js-yaml
|
||||
node_modules/.bin/jshint
|
||||
node_modules/.bin/mkdirp
|
||||
@@ -129,4 +128,6 @@ node_modules/which/
|
||||
node_modules/window-size/
|
||||
node_modules/wordwrap/
|
||||
node_modules/yargs/
|
||||
node_modules/jasmine-core/
|
||||
node_modules/fs.realpath/
|
||||
/coverage
|
||||
|
||||
@@ -4,3 +4,5 @@ gen
|
||||
proguard-project.txt
|
||||
spec
|
||||
appveyor.yml
|
||||
framework/build
|
||||
ic_launcher.png
|
||||
|
||||
12
.travis.yml
@@ -1,9 +1,19 @@
|
||||
language: android
|
||||
sudo: false
|
||||
jdk:
|
||||
- oraclejdk8
|
||||
before_install:
|
||||
- nvm install 6
|
||||
- node --version
|
||||
- gradle --version
|
||||
install:
|
||||
- npm install
|
||||
- npm install -g codecov
|
||||
- echo y | android update sdk -u --filter android-22,android-23
|
||||
- echo y | android update sdk -u --filter android-22,android-23,android-24,android-25
|
||||
android:
|
||||
components:
|
||||
- tools
|
||||
- tools
|
||||
script:
|
||||
- npm run jshint
|
||||
- npm run cover
|
||||
|
||||
111
RELEASENOTES.md
@@ -20,6 +20,117 @@
|
||||
-->
|
||||
## Release Notes for Cordova (Android) ##
|
||||
|
||||
### 6.2.3 (May 2, 2017)
|
||||
* [CB-12640](https://issues.apache.org/jira/browse/CB-12640) better handling of unrecognized Android SDK commands on **Windows**.
|
||||
* [CB-12640](https://issues.apache.org/jira/browse/CB-12640) flipped avd parsing logic so that it always tries to use avdmanager to retrieve avds first, then falls back to android command if avdmanager cannot be found (and errors with ENOENT). updated tests - and added explicit tests to ensure to shell out to singular forms of sub-commands when executing `android`
|
||||
* [CB-12640](https://issues.apache.org/jira/browse/CB-12640) support for android sdk tools 26.0.1.
|
||||
|
||||
### 6.2.2 (Apr 24, 2017)
|
||||
* [CB-12697](https://issues.apache.org/jira/browse/CB-12697) Updated checked-in `node_modules`
|
||||
|
||||
### 6.2.1 (Apr 02, 2017)
|
||||
* [CB-12621](https://issues.apache.org/jira/browse/CB-12621) reverted elementtree dep to 0.1.6
|
||||
|
||||
### 6.2.0 (Mar 28, 2017)
|
||||
* [CB-12614](https://issues.apache.org/jira/browse/CB-12614) Adding headers to tests
|
||||
* [CB-8978](https://issues.apache.org/jira/browse/CB-8978) Prepare copy `resource-files` from `config.xml`
|
||||
* [CB-12605](https://issues.apache.org/jira/browse/CB-12605) Fix a requirements check failure on **Windows**
|
||||
* [CB-12595](https://issues.apache.org/jira/browse/CB-12595) This should find an **Android Studio** installation and use the sweet gradle center found inside
|
||||
* [CB-12546](https://issues.apache.org/jira/browse/CB-12546) leverage `avdmanager` if `android` warns it is no longer useful, which happens in **Android SDK Tools 25.3.1**. Explicitly set the `CWD` of the spawned emulator process to workaround a recent google android sdk bug. Rename `android_sdk_version.js` to `android_sdk.js`, to better reflect its contents. Have `create.js` copy over the `android_sdk_version` batch file.
|
||||
* [CB-12524](https://issues.apache.org/jira/browse/CB-12524) Fix for missing gradle template error. This now fetches the template from inside of the **Android Studio** directory, and falls back to a locally installed Gradle instance
|
||||
* [CB-12465](https://issues.apache.org/jira/browse/CB-12465) Writing new JUnit Test Instrumentation to replace tests and retire problmatic tests
|
||||
|
||||
### 6.1.2 (Jan 26, 2017)
|
||||
* **Security** Change to `https` by default
|
||||
* [CB-12018](https://issues.apache.org/jira/browse/CB-12018): updated tests to work with jasmine (promise matcher tests commented out for now)
|
||||
* created directories and corresponding images for `xxhdpi` and `xxxhdpi`, both drawables and `mipmaps`
|
||||
|
||||
### 6.1.1 (Jan 03, 2017)
|
||||
* [CB-12159](https://issues.apache.org/jira/browse/CB-12159) **Android** Keystore password prompt won't show up
|
||||
* [CB-12169](https://issues.apache.org/jira/browse/CB-12169) Check for build directory before running a clean
|
||||
* Fixed `AndroidStudio` tests to actually run, removed `app/src/main/assets/` as a requirement and added `app/src/main/res` instead, added placeholder for `build/` folder, Removed dupe `gitignore`
|
||||
|
||||
### 6.1.0 (Nov 02, 2016)
|
||||
* [CB-12108](https://issues.apache.org/jira/browse/CB-12108) Updating gradle files to work with the latest version of Android Studio
|
||||
* [CB-12102](https://issues.apache.org/jira/browse/CB-12102) Bump travis to build to API 25
|
||||
* Bumping up the version
|
||||
* [CB-12101](https://issues.apache.org/jira/browse/CB-12101) Fix so that CLI builds don't conflict with Android Studio builds
|
||||
* [CB-12077](https://issues.apache.org/jira/browse/CB-12077) Fix paths for Android icons/splashscreens
|
||||
* added framework/build to .ratignore
|
||||
* Fix for broken testUrl test
|
||||
* Last minute change of test targets
|
||||
* Update JS snapshot to version 6.1.0-dev (via coho)
|
||||
* Set VERSION to 6.1.0-dev (via coho)
|
||||
|
||||
### 6.0.0 (Oct 20, 2016)
|
||||
|
||||
This release adds significant functionality, and also introduces a number
|
||||
of breaking changes. Some of the changes to the code base will be of
|
||||
particular interest to third party webview plugin developers.
|
||||
|
||||
#### Major Changes ####
|
||||
* Primary bridge is the EVAL_BRIDGE, which tells the WebView to execute JS directly. This is more stable than the ONLINE_EVENT bridge
|
||||
* Full Support for Android Nougat (API 24)
|
||||
* Ice Cream Sandwich Support has been deprecated. Minimum Supported Android Version is Jellybean (API 16/ Android 4.1)
|
||||
* Plugin Installation now CLEANS the build directory, this speeds up gradle build times and allows for CLI develoment to be more predictable
|
||||
|
||||
Changes For Third-Party WebView Developers:
|
||||
* executeJavascript method added and is an abstract method that must be implemented
|
||||
* the EVAL_BRIDGE must be added to the WebView
|
||||
|
||||
|
||||
#### Curated Changes from the Git Commit Logs ####
|
||||
* Updating the gradle build for test to use the latest
|
||||
* [CB-11083](https://issues.apache.org/jira/browse/CB-11083) Fixing syncronous file check and future-proofing the JS for Travis
|
||||
* [CB-11083](https://issues.apache.org/jira/browse/CB-11083) Reading files to check for CordovaLib dependency, if so, we exclude CordovaLib to be safe
|
||||
* [CB-11083](https://issues.apache.org/jira/browse/CB-11083) Plugin build script for dependencies without a gradle file
|
||||
* [CB-11083](https://issues.apache.org/jira/browse/CB-11083) The GradleBuidler can tell the difference between a Cordova Plugin Framework and a regular framework based on the name
|
||||
* [CB-11083](https://issues.apache.org/jira/browse/CB-11083) Fix to deal with custom frameworks with their own Gradle configuration
|
||||
* [CB-12003](https://issues.apache.org/jira/browse/CB-12003) updated node_modules
|
||||
* [CB-11771](https://issues.apache.org/jira/browse/CB-11771) Deep symlink directories to target project instead of linking the directory itself
|
||||
* [CB-11880](https://issues.apache.org/jira/browse/CB-11880) android: Fail-safe for cordova.exec()
|
||||
* [CB-11999](https://issues.apache.org/jira/browse/CB-11999) add message, catch exception if require fails
|
||||
* fix issue with app_name containing apostrophes
|
||||
* [CB-8722](https://issues.apache.org/jira/browse/CB-8722) - Move icons from drawable to mipmap
|
||||
* [CB-11964](https://issues.apache.org/jira/browse/CB-11964) Call clean after plugin install and mock it in tests
|
||||
* Did a try/catch to deal with the unit tests vs actual project environment, code duplication is needed because of builderEnv
|
||||
* [CB-11964](https://issues.apache.org/jira/browse/CB-11964) Do a clean when installing a plugin to et around the bug
|
||||
* [CB-11921](https://issues.apache.org/jira/browse/CB-11921) - Add github pull request template
|
||||
* [CB-11935](https://issues.apache.org/jira/browse/CB-11935) Does a best-effort attempt to pause any processing that can be paused safely, such as animations and geolocation.
|
||||
* [CB-11640](https://issues.apache.org/jira/browse/CB-11640) Fixing check_reqs.js so it actually works
|
||||
* [CB-11640](https://issues.apache.org/jira/browse/CB-11640) Changing requirements check to ask for Java 8
|
||||
* [CB-11869](https://issues.apache.org/jira/browse/CB-11869) Fix cordova-js android exec tests
|
||||
* [CB-11907](https://issues.apache.org/jira/browse/CB-11907) Bumping Gradle to work with Android Studio 2.2 and the Android Gradle Plugin
|
||||
* Enable background start of Cordova Android apps
|
||||
* fixing jshint issues
|
||||
* replace Integer.parseInt with BigInteger so that you can use longer Android version codes
|
||||
* [CB-11828](https://issues.apache.org/jira/browse/CB-11828) Adding dirty userAgent checking to see if we're running Jellybean or not for bridge modes
|
||||
* [CB-11828](https://issues.apache.org/jira/browse/CB-11828) Switching default bridge back to ONLINE_BRIDGE
|
||||
* Add gradle build flag to enable dex in process for large projects
|
||||
* added ability for cordova activity to be viewed in a real full screen regardless of android version (as was the case in previous cordova versions)
|
||||
* Updating travis
|
||||
* Adding Static Method to CoreAndroid Plugin so we can get the BuildConfig data from other plugins
|
||||
* Bump Target and Min API levels
|
||||
* Make evaluateJavaScript brige default
|
||||
* Creating an evaluateJavascript branch
|
||||
* [CB-11727](https://issues.apache.org/jira/browse/CB-11727) - travis ci setup is still using 0.10.32 node
|
||||
* [CB-11726](https://issues.apache.org/jira/browse/CB-11726) - Update appveyor node versions to 4 and 6, so they will always use the latest versions
|
||||
* Close invalid PRs
|
||||
* [CB-11683](https://issues.apache.org/jira/browse/CB-11683) Fixed linking to directories during plugin installation.
|
||||
* fixed [CB-11078](https://issues.apache.org/jira/browse/CB-11078) Empty string for BackgroundColor preference crashes application This closes #316
|
||||
* Update JS snapshot to version 5.3.0-dev (via coho)
|
||||
* Set VERSION to 5.3.0-dev (via coho)
|
||||
* [CB-11626](https://issues.apache.org/jira/browse/CB-11626) Updated RELEASENOTES and Version for release 5.2.2
|
||||
* updated cordoova-common to 1.4.0
|
||||
* This closes #195
|
||||
* Updaing the gradle for the tests to the latest
|
||||
* [CB-11550](https://issues.apache.org/jira/browse/CB-11550) Updated RELEASENOTES for release 5.2.1
|
||||
* [CB-9489](https://issues.apache.org/jira/browse/CB-9489) Fixed "endless waiting for emulator" issue
|
||||
* Update JS snapshot to version 5.3.0-dev (via coho)
|
||||
* Set VERSION to 5.3.0-dev (via coho)
|
||||
* [CB-11444](https://issues.apache.org/jira/browse/CB-11444) Updated RELEASENOTES and Version for release 5.2.0
|
||||
* [CB-11481](https://issues.apache.org/jira/browse/CB-11481) android-library is deprecated use com.android.library instead
|
||||
|
||||
### 5.2.2 (Jul 26, 2016)
|
||||
* [CB-11615](https://issues.apache.org/jira/browse/CB-11615) updated `cordoova-common` to `1.4.0`
|
||||
|
||||
|
||||
@@ -2,7 +2,8 @@ environment:
|
||||
matrix:
|
||||
- nodejs_version: "0.10"
|
||||
- nodejs_version: "0.12"
|
||||
- nodejs_version: "4.2"
|
||||
- nodejs_version: "4"
|
||||
- nodejs_version: "6"
|
||||
|
||||
install:
|
||||
# - cinst android-sdk
|
||||
|
||||
@@ -19,10 +19,10 @@
|
||||
under the License.
|
||||
*/
|
||||
|
||||
var android_sdk_version = require('./lib/android_sdk_version');
|
||||
var android_sdk = require('./templates/cordova/lib/android_sdk');
|
||||
|
||||
android_sdk_version.run().done(null, function(err) {
|
||||
console.log(err);
|
||||
android_sdk.print_newest_available_sdk_target().done(null, function(err) {
|
||||
console.error(err);
|
||||
process.exit(2);
|
||||
});
|
||||
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
under the License.
|
||||
*/
|
||||
|
||||
var check_reqs = require('./lib/check_reqs');
|
||||
var check_reqs = require('./templates/cordova/lib/check_reqs');
|
||||
|
||||
check_reqs.run().done(
|
||||
function success() {
|
||||
|
||||
@@ -1,64 +0,0 @@
|
||||
#!/usr/bin/env node
|
||||
|
||||
/*
|
||||
Licensed to the Apache Software Foundation (ASF) under one
|
||||
or more contributor license agreements. See the NOTICE file
|
||||
distributed with this work for additional information
|
||||
regarding copyright ownership. The ASF licenses this file
|
||||
to you under the Apache License, Version 2.0 (the
|
||||
"License"); you may not use this file except in compliance
|
||||
with the License. You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing,
|
||||
software distributed under the License is distributed on an
|
||||
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
KIND, either express or implied. See the License for the
|
||||
specific language governing permissions and limitations
|
||||
under the License.
|
||||
*/
|
||||
|
||||
var child_process = require('child_process'),
|
||||
Q = require('q');
|
||||
|
||||
var get_highest_sdk = function(results){
|
||||
var reg = /\d+/;
|
||||
var apiLevels = [];
|
||||
for(var i=0;i<results.length;i++){
|
||||
apiLevels[i] = parseInt(results[i].match(reg)[0]);
|
||||
}
|
||||
apiLevels.sort(function(a,b){return b-a;});
|
||||
console.log(apiLevels[0]);
|
||||
};
|
||||
|
||||
var get_sdks = function() {
|
||||
var d = Q.defer();
|
||||
child_process.exec('android list targets', function(err, stdout, stderr) {
|
||||
if (err) d.reject(stderr);
|
||||
else d.resolve(stdout);
|
||||
});
|
||||
|
||||
return d.promise.then(function(output) {
|
||||
var reg = /android-\d+/gi;
|
||||
var results = output.match(reg);
|
||||
if(results.length===0){
|
||||
return Q.reject(new Error('No android sdks installed.'));
|
||||
}else{
|
||||
get_highest_sdk(results);
|
||||
}
|
||||
|
||||
return Q();
|
||||
}, function(stderr) {
|
||||
if (stderr.match(/command\snot\sfound/) || stderr.match(/'android' is not recognized/)) {
|
||||
return Q.reject(new Error('The command \"android\" failed. Make sure you have the latest Android SDK installed, and the \"android\" command (inside the tools/ folder) is added to your path.'));
|
||||
} else {
|
||||
return Q.reject(new Error('An error occurred while listing Android targets'));
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
module.exports.run = function() {
|
||||
return Q.all([get_sdks()]);
|
||||
};
|
||||
|
||||
@@ -23,10 +23,10 @@ var shell = require('shelljs'),
|
||||
Q = require('q'),
|
||||
path = require('path'),
|
||||
fs = require('fs'),
|
||||
check_reqs = require('./check_reqs'),
|
||||
check_reqs = require('./../templates/cordova/lib/check_reqs'),
|
||||
ROOT = path.join(__dirname, '..', '..');
|
||||
|
||||
var MIN_SDK_VERSION = 14;
|
||||
var MIN_SDK_VERSION = 16;
|
||||
|
||||
var CordovaError = require('cordova-common').CordovaError;
|
||||
var AndroidManifest = require('../templates/cordova/lib/AndroidManifest');
|
||||
@@ -134,20 +134,29 @@ function copyBuildRules(projectPath) {
|
||||
var srcDir = path.join(ROOT, 'bin', 'templates', 'project');
|
||||
|
||||
shell.cp('-f', path.join(srcDir, 'build.gradle'), projectPath);
|
||||
shell.cp('-f', path.join(srcDir, 'wrapper.gradle'), projectPath);
|
||||
}
|
||||
|
||||
function copyScripts(projectPath) {
|
||||
var srcScriptsDir = path.join(ROOT, 'bin', 'templates', 'cordova');
|
||||
var bin = path.join(ROOT, 'bin');
|
||||
var srcScriptsDir = path.join(bin, 'templates', 'cordova');
|
||||
var destScriptsDir = path.join(projectPath, 'cordova');
|
||||
// Delete old scripts directory if this is an update.
|
||||
shell.rm('-rf', destScriptsDir);
|
||||
// Copy in the new ones.
|
||||
shell.cp('-r', srcScriptsDir, projectPath);
|
||||
shell.cp('-r', path.join(ROOT, 'node_modules'), destScriptsDir);
|
||||
shell.cp(path.join(ROOT, 'bin', 'check_reqs*'), destScriptsDir);
|
||||
shell.cp(path.join(ROOT, 'bin', 'lib', 'check_reqs.js'), path.join(projectPath, 'cordova', 'lib', 'check_reqs.js'));
|
||||
shell.cp(path.join(ROOT, 'bin', 'android_sdk_version'), path.join(destScriptsDir, 'android_sdk_version'));
|
||||
shell.cp(path.join(ROOT, 'bin', 'lib', 'android_sdk_version.js'), path.join(projectPath, 'cordova', 'lib', 'android_sdk_version.js'));
|
||||
shell.cp(path.join(bin, 'check_reqs*'), destScriptsDir);
|
||||
shell.cp(path.join(bin, 'android_sdk_version*'), destScriptsDir);
|
||||
var check_reqs = path.join(destScriptsDir, 'check_reqs');
|
||||
var android_sdk_version = path.join(destScriptsDir, 'android_sdk_version');
|
||||
// TODO: the two files being edited on-the-fly here are shared between
|
||||
// platform and project-level commands. the below `sed` is updating the
|
||||
// `require` path for the two libraries. if there's a better way to share
|
||||
// modules across both the repo and generated projects, we should make sure
|
||||
// to remove/update this.
|
||||
shell.sed('-i', /templates\/cordova\//, '', android_sdk_version);
|
||||
shell.sed('-i', /templates\/cordova\//, '', check_reqs);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
116
bin/templates/cordova/Api.js
vendored
@@ -18,8 +18,10 @@
|
||||
*/
|
||||
|
||||
var path = require('path');
|
||||
var Q = require('q');
|
||||
|
||||
var AndroidProject = require('./lib/AndroidProject');
|
||||
var AndroidStudio = require('./lib/AndroidStudio');
|
||||
var PluginManager = require('cordova-common').PluginManager;
|
||||
|
||||
var CordovaLogger = require('cordova-common').CordovaLogger;
|
||||
@@ -27,6 +29,7 @@ var selfEvents = require('cordova-common').events;
|
||||
|
||||
var PLATFORM = 'android';
|
||||
|
||||
|
||||
function setupEvents(externalEventEmitter) {
|
||||
if (externalEventEmitter) {
|
||||
// This will make the platform internal events visible outside
|
||||
@@ -40,6 +43,7 @@ function setupEvents(externalEventEmitter) {
|
||||
return selfEvents;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Class, that acts as abstraction over particular platform. Encapsulates the
|
||||
* platform's properties and methods.
|
||||
@@ -62,15 +66,28 @@ function Api(platform, platformRootDir, events) {
|
||||
this.locations = {
|
||||
root: self.root,
|
||||
www: path.join(self.root, 'assets/www'),
|
||||
res: path.join(self.root, 'res'),
|
||||
platformWww: path.join(self.root, 'platform_www'),
|
||||
configXml: path.join(self.root, 'res/xml/config.xml'),
|
||||
defaultConfigXml: path.join(self.root, 'cordova/defaults.xml'),
|
||||
strings: path.join(self.root, 'res/values/strings.xml'),
|
||||
manifest: path.join(self.root, 'AndroidManifest.xml'),
|
||||
build: path.join(self.root, 'build'),
|
||||
// NOTE: Due to platformApi spec we need to return relative paths here
|
||||
cordovaJs: 'bin/templates/project/assets/www/cordova.js',
|
||||
cordovaJsSrc: 'cordova-js-src'
|
||||
};
|
||||
|
||||
// XXX Override some locations for Android Studio projects
|
||||
if(AndroidStudio.isAndroidStudioProject(self.root) === true) {
|
||||
selfEvents.emit('log', 'Android Studio project detected');
|
||||
this.android_studio = true;
|
||||
this.locations.configXml = path.join(self.root, 'app/src/main/res/xml/config.xml');
|
||||
this.locations.strings = path.join(self.root, 'app/src/main/res/xml/strings.xml');
|
||||
this.locations.manifest = path.join(self.root, 'app/src/main/AndroidManifest.xml');
|
||||
this.locations.www = path.join(self.root, 'app/src/main/assets/www');
|
||||
this.locations.res = path.join(self.root, 'app/src/main/res');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -93,13 +110,20 @@ function Api(platform, platformRootDir, events) {
|
||||
*/
|
||||
Api.createPlatform = function (destination, config, options, events) {
|
||||
events = setupEvents(events);
|
||||
|
||||
return require('../../lib/create')
|
||||
.create(destination, config, options, events)
|
||||
.then(function (destination) {
|
||||
var PlatformApi = require(path.resolve(destination, 'cordova/Api'));
|
||||
return new PlatformApi(PLATFORM, destination, events);
|
||||
});
|
||||
var result;
|
||||
try {
|
||||
result = require('../../lib/create')
|
||||
.create(destination, config, options, events)
|
||||
.then(function (destination) {
|
||||
var PlatformApi = require(path.resolve(destination, 'cordova/Api'));
|
||||
return new PlatformApi(PLATFORM, destination, events);
|
||||
});
|
||||
}
|
||||
catch (e) {
|
||||
events.emit('error','createPlatform is not callable from the android project API.');
|
||||
throw(e);
|
||||
}
|
||||
return result;
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -120,13 +144,20 @@ Api.createPlatform = function (destination, config, options, events) {
|
||||
*/
|
||||
Api.updatePlatform = function (destination, options, events) {
|
||||
events = setupEvents(events);
|
||||
|
||||
return require('../../lib/create')
|
||||
.update(destination, options, events)
|
||||
.then(function (destination) {
|
||||
var PlatformApi = require(path.resolve(destination, 'cordova/Api'));
|
||||
return new PlatformApi('android', destination, events);
|
||||
});
|
||||
var result;
|
||||
try {
|
||||
result = require('../../lib/create')
|
||||
.update(destination, options, events)
|
||||
.then(function (destination) {
|
||||
var PlatformApi = require(path.resolve(destination, 'cordova/Api'));
|
||||
return new PlatformApi('android', destination, events);
|
||||
});
|
||||
}
|
||||
catch (e) {
|
||||
events.emit('error','updatePlatform is not callable from the android project API, you will need to do this manually.');
|
||||
throw(e);
|
||||
}
|
||||
return result;
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -186,6 +217,7 @@ Api.prototype.prepare = function (cordovaProject, prepareOptions) {
|
||||
*/
|
||||
Api.prototype.addPlugin = function (plugin, installOptions) {
|
||||
var project = AndroidProject.getProjectFile(this.root);
|
||||
var self = this;
|
||||
|
||||
installOptions = installOptions || {};
|
||||
installOptions.variables = installOptions.variables || {};
|
||||
@@ -194,15 +226,40 @@ Api.prototype.addPlugin = function (plugin, installOptions) {
|
||||
installOptions.variables.PACKAGE_NAME = project.getPackageName();
|
||||
}
|
||||
|
||||
return PluginManager.get(this.platform, this.locations, project)
|
||||
.addPlugin(plugin, installOptions)
|
||||
.then(function () {
|
||||
if(this.android_studio === true) {
|
||||
installOptions.android_studio = true;
|
||||
}
|
||||
|
||||
return Q()
|
||||
.then(function () {
|
||||
//CB-11964: Do a clean when installing the plugin code to get around
|
||||
//the Gradle bug introduced by the Android Gradle Plugin Version 2.2
|
||||
//TODO: Delete when the next version of Android Gradle plugin comes out
|
||||
|
||||
// Since clean doesn't just clean the build, it also wipes out www, we need
|
||||
// to pass additional options.
|
||||
|
||||
// Do some basic argument parsing
|
||||
var opts = {};
|
||||
|
||||
// Skip cleaning prepared files when not invoking via cordova CLI.
|
||||
opts.noPrepare = true;
|
||||
|
||||
if(!AndroidStudio.isAndroidStudioProject(self.root) && !project.isClean()) {
|
||||
return self.clean(opts);
|
||||
}
|
||||
})
|
||||
.then(function () {
|
||||
return PluginManager.get(self.platform, self.locations, project)
|
||||
.addPlugin(plugin, installOptions);
|
||||
})
|
||||
.then(function () {
|
||||
if (plugin.getFrameworks(this.platform).length === 0) return;
|
||||
|
||||
selfEvents.emit('verbose', 'Updating build files since android plugin contained <framework>');
|
||||
require('./lib/builders/builders').getBuilder('gradle').prepBuildFiles();
|
||||
}.bind(this))
|
||||
// CB-11022 Return truthy value to prevent running prepare after
|
||||
// CB-11022 Return truthy value to prevent running prepare after
|
||||
.thenResolve(true);
|
||||
};
|
||||
|
||||
@@ -221,6 +278,12 @@ Api.prototype.addPlugin = function (plugin, installOptions) {
|
||||
*/
|
||||
Api.prototype.removePlugin = function (plugin, uninstallOptions) {
|
||||
var project = AndroidProject.getProjectFile(this.root);
|
||||
|
||||
if(uninstallOptions && uninstallOptions.usePlatformWww === true && this.android_studio === true) {
|
||||
uninstallOptions.usePlatformWww = false;
|
||||
uninstallOptions.android_studio = true;
|
||||
}
|
||||
|
||||
return PluginManager.get(this.platform, this.locations, project)
|
||||
.removePlugin(plugin, uninstallOptions)
|
||||
.then(function () {
|
||||
@@ -318,7 +381,8 @@ Api.prototype.run = function(runOptions) {
|
||||
};
|
||||
|
||||
/**
|
||||
* Cleans out the build artifacts from platform's directory.
|
||||
* Cleans out the build artifacts from platform's directory, and also
|
||||
* cleans out the platform www directory if called without options specified.
|
||||
*
|
||||
* @return {Promise} Return a promise either fulfilled, or rejected with
|
||||
* CordovaError.
|
||||
@@ -326,14 +390,16 @@ Api.prototype.run = function(runOptions) {
|
||||
Api.prototype.clean = function(cleanOptions) {
|
||||
var self = this;
|
||||
return require('./lib/check_reqs').run()
|
||||
.then(function () {
|
||||
return require('./lib/build').runClean.call(self, cleanOptions);
|
||||
})
|
||||
.then(function () {
|
||||
return require('./lib/prepare').clean.call(self, cleanOptions);
|
||||
});
|
||||
.then(function () {
|
||||
return require('./lib/build').runClean.call(self, cleanOptions);
|
||||
})
|
||||
.then(function () {
|
||||
return require('./lib/prepare').clean.call(self, cleanOptions);
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Performs a requirements check for current platform. Each platform defines its
|
||||
* own set of requirements, which should be resolved before platform can be
|
||||
|
||||
19
bin/templates/cordova/lib/AndroidProject.js
vendored
@@ -21,6 +21,7 @@ var fs = require('fs');
|
||||
var path = require('path');
|
||||
var properties_parser = require('properties-parser');
|
||||
var AndroidManifest = require('./AndroidManifest');
|
||||
var AndroidStudio = require('./AndroidStudio');
|
||||
var pluginHandlers = require('./pluginHandlers');
|
||||
|
||||
var projectFileCache = {};
|
||||
@@ -63,6 +64,9 @@ function AndroidProject(projectDir) {
|
||||
this.projectDir = projectDir;
|
||||
this.platformWww = path.join(this.projectDir, 'platform_www');
|
||||
this.www = path.join(this.projectDir, 'assets/www');
|
||||
if(AndroidStudio.isAndroidStudioProject(projectDir) === true) {
|
||||
this.www = path.join(this.projectDir, 'app/src/main/assets/www');
|
||||
}
|
||||
}
|
||||
|
||||
AndroidProject.getProjectFile = function (projectDir) {
|
||||
@@ -89,7 +93,11 @@ AndroidProject.purgeCache = function (projectDir) {
|
||||
* @return {String} The name of the package
|
||||
*/
|
||||
AndroidProject.prototype.getPackageName = function() {
|
||||
return new AndroidManifest(path.join(this.projectDir, 'AndroidManifest.xml')).getPackageId();
|
||||
var manifestPath = path.join(this.projectDir, 'AndroidManifest.xml');
|
||||
if(AndroidStudio.isAndroidStudioProject(this.projectDir) === true) {
|
||||
manifestPath = path.join(this.projectDir, 'app/src/main/AndroidManifest.xml');
|
||||
}
|
||||
return new AndroidManifest(manifestPath).getPackageId();
|
||||
};
|
||||
|
||||
AndroidProject.prototype.getCustomSubprojectRelativeDir = function(plugin_id, src) {
|
||||
@@ -189,5 +197,14 @@ AndroidProject.prototype.getUninstaller = function (type) {
|
||||
return pluginHandlers.getUninstaller(type);
|
||||
};
|
||||
|
||||
/*
|
||||
* This checks if an Android project is clean or has old build artifacts
|
||||
*/
|
||||
|
||||
AndroidProject.prototype.isClean = function() {
|
||||
var build_path = path.join(this.projectDir, 'build');
|
||||
//If the build directory doesn't exist, it's clean
|
||||
return !(fs.existsSync(build_path));
|
||||
};
|
||||
|
||||
module.exports = AndroidProject;
|
||||
|
||||
42
bin/templates/cordova/lib/AndroidStudio.js
vendored
Normal file
@@ -0,0 +1,42 @@
|
||||
/*
|
||||
* This is a simple routine that checks if project is an Android Studio Project
|
||||
*
|
||||
* @param {String} root Root folder of the project
|
||||
*/
|
||||
|
||||
/*jshint esnext: false */
|
||||
|
||||
var path = require('path');
|
||||
var fs = require('fs');
|
||||
var CordovaError = require('cordova-common').CordovaError;
|
||||
|
||||
module.exports.isAndroidStudioProject = function isAndroidStudioProject(root) {
|
||||
var eclipseFiles = ['AndroidManifest.xml', 'libs', 'res', 'project.properties', 'platform_www'];
|
||||
var androidStudioFiles = ['app', 'gradle', 'app/src/main/res'];
|
||||
|
||||
// assume it is an AS project and not an Eclipse project
|
||||
var isEclipse = false;
|
||||
var isAS = true;
|
||||
|
||||
if(!fs.existsSync(root)) {
|
||||
throw new CordovaError('AndroidStudio.js:inAndroidStudioProject root does not exist: ' + root);
|
||||
}
|
||||
|
||||
// if any of the following exists, then we are not an ASProj
|
||||
eclipseFiles.forEach(function(file) {
|
||||
if(fs.existsSync(path.join(root, file))) {
|
||||
isEclipse = true;
|
||||
}
|
||||
});
|
||||
|
||||
// if it is NOT an eclipse project, check that all required files exist
|
||||
if(!isEclipse) {
|
||||
androidStudioFiles.forEach(function(file){
|
||||
if(!fs.existsSync(path.join(root, file))) {
|
||||
console.log('missing file :: ' + file);
|
||||
isAS = false;
|
||||
}
|
||||
});
|
||||
}
|
||||
return (!isEclipse && isAS);
|
||||
};
|
||||
106
bin/templates/cordova/lib/android_sdk.js
vendored
Executable file
@@ -0,0 +1,106 @@
|
||||
/*
|
||||
Licensed to the Apache Software Foundation (ASF) under one
|
||||
or more contributor license agreements. See the NOTICE file
|
||||
distributed with this work for additional information
|
||||
regarding copyright ownership. The ASF licenses this file
|
||||
to you under the Apache License, Version 2.0 (the
|
||||
"License"); you may not use this file except in compliance
|
||||
with the License. You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing,
|
||||
software distributed under the License is distributed on an
|
||||
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
KIND, either express or implied. See the License for the
|
||||
specific language governing permissions and limitations
|
||||
under the License.
|
||||
*/
|
||||
|
||||
var Q = require('q'),
|
||||
superspawn = require('cordova-common').superspawn;
|
||||
|
||||
var suffix_number_regex = /(\d+)$/;
|
||||
// Used for sorting Android targets, example strings to sort:
|
||||
// android-19
|
||||
// android-L
|
||||
// Google Inc.:Google APIs:20
|
||||
// Google Inc.:Glass Development Kit Preview:20
|
||||
// The idea is to sort based on largest "suffix" number - meaning the bigger
|
||||
// the number at the end, the more recent the target, the closer to the
|
||||
// start of the array.
|
||||
function sort_by_largest_numerical_suffix(a, b) {
|
||||
var suffix_a = a.match(suffix_number_regex);
|
||||
var suffix_b = b.match(suffix_number_regex);
|
||||
if (suffix_a && suffix_b) {
|
||||
// If the two targets being compared have suffixes, return less than
|
||||
// zero, or greater than zero, based on which suffix is larger.
|
||||
return (parseInt(suffix_a[1]) > parseInt(suffix_b[1]) ? -1 : 1);
|
||||
} else {
|
||||
// If no suffix numbers were detected, leave the order as-is between
|
||||
// elements a and b.
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
module.exports.print_newest_available_sdk_target = function() {
|
||||
return module.exports.list_targets()
|
||||
.then(function(targets) {
|
||||
targets.sort(sort_by_largest_numerical_suffix);
|
||||
console.log(targets[0]);
|
||||
});
|
||||
};
|
||||
|
||||
module.exports.version_string_to_api_level = {
|
||||
'4.0': 14,
|
||||
'4.0.3': 15,
|
||||
'4.1': 16,
|
||||
'4.2': 17,
|
||||
'4.3': 18,
|
||||
'4.4': 19,
|
||||
'4.4W': 20,
|
||||
'5.0': 21,
|
||||
'5.1': 22,
|
||||
'6.0': 23,
|
||||
'7.0': 24,
|
||||
'7.1.1': 25
|
||||
};
|
||||
|
||||
function parse_targets(output) {
|
||||
var target_out = output.split('\n');
|
||||
var targets = [];
|
||||
for (var i = target_out.length - 1; i >= 0; i--) {
|
||||
if(target_out[i].match(/id:/)) { // if "id:" is in the line...
|
||||
targets.push(target_out[i].match(/"(.+)"/)[1]); //.. match whatever is in quotes.
|
||||
}
|
||||
}
|
||||
return targets;
|
||||
}
|
||||
|
||||
module.exports.list_targets_with_android = function() {
|
||||
return superspawn.spawn('android', ['list', 'target'])
|
||||
.then(parse_targets);
|
||||
};
|
||||
|
||||
module.exports.list_targets_with_avdmanager = function() {
|
||||
return superspawn.spawn('avdmanager', ['list', 'target'])
|
||||
.then(parse_targets);
|
||||
};
|
||||
|
||||
module.exports.list_targets = function() {
|
||||
return module.exports.list_targets_with_avdmanager()
|
||||
.catch(function(err) {
|
||||
// If there's an error, like avdmanager could not be found, we can try
|
||||
// as a last resort, to run `android`, in case this is a super old
|
||||
// SDK installation.
|
||||
if (err && (err.code == 'ENOENT' || (err.stderr && err.stderr.match(/not recognized/)))) {
|
||||
return module.exports.list_targets_with_android();
|
||||
} else throw err;
|
||||
})
|
||||
.then(function(targets) {
|
||||
if (targets.length === 0) {
|
||||
return Q.reject(new Error('No android targets (SDKs) installed!'));
|
||||
}
|
||||
return targets;
|
||||
});
|
||||
};
|
||||
@@ -55,6 +55,8 @@ GradleBuilder.prototype.getArgs = function(cmd, opts) {
|
||||
|
||||
// 10 seconds -> 6 seconds
|
||||
args.push('-Dorg.gradle.daemon=true');
|
||||
// to allow dex in process
|
||||
args.push('-Dorg.gradle.jvmargs=-Xmx2048m');
|
||||
// allow NDK to be used - required by Gradle 1.5 plugin
|
||||
args.push('-Pandroid.useDeprecatedNdk=true');
|
||||
args.push.apply(args, opts.extraArgs);
|
||||
@@ -63,18 +65,42 @@ GradleBuilder.prototype.getArgs = function(cmd, opts) {
|
||||
return args;
|
||||
};
|
||||
|
||||
/*
|
||||
* This returns a promise
|
||||
*/
|
||||
|
||||
GradleBuilder.prototype.runGradleWrapper = function(gradle_cmd) {
|
||||
var gradlePath = path.join(this.root, 'gradlew');
|
||||
var wrapperGradle = path.join(this.root, 'wrapper.gradle');
|
||||
if(fs.existsSync(gradlePath)) {
|
||||
//Literally do nothing, for some reason this works, while !fs.existsSync didn't on Windows
|
||||
} else {
|
||||
return spawn(gradle_cmd, ['-p', this.root, 'wrapper', '-b', wrapperGradle], {stdio: 'inherit'});
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
// Makes the project buildable, minus the gradle wrapper.
|
||||
GradleBuilder.prototype.prepBuildFiles = function() {
|
||||
// Update the version of build.gradle in each dependent library.
|
||||
var pluginBuildGradle = path.join(this.root, 'cordova', 'lib', 'plugin-build.gradle');
|
||||
var propertiesObj = this.readProjectProperties();
|
||||
var subProjects = propertiesObj.libs;
|
||||
var checkAndCopy = function(subProject, root) {
|
||||
var subProjectGradle = path.join(root, subProject, 'build.gradle');
|
||||
// This is the future-proof way of checking if a file exists
|
||||
// This must be synchronous to satisfy a Travis test
|
||||
try {
|
||||
fs.accessSync(subProjectGradle, fs.F_OK);
|
||||
} catch (e) {
|
||||
shell.cp('-f', pluginBuildGradle, subProjectGradle);
|
||||
}
|
||||
};
|
||||
for (var i = 0; i < subProjects.length; ++i) {
|
||||
if (subProjects[i] !== 'CordovaLib') {
|
||||
shell.cp('-f', pluginBuildGradle, path.join(this.root, subProjects[i], 'build.gradle'));
|
||||
checkAndCopy(subProjects[i], this.root);
|
||||
}
|
||||
}
|
||||
|
||||
var name = this.extractRealProjectNameFromManifest();
|
||||
//Remove the proj.id/name- prefix from projects: https://issues.apache.org/jira/browse/CB-9149
|
||||
var settingsGradlePaths = subProjects.map(function(p){
|
||||
@@ -93,10 +119,24 @@ GradleBuilder.prototype.prepBuildFiles = function() {
|
||||
// Update dependencies within build.gradle.
|
||||
var buildGradle = fs.readFileSync(path.join(this.root, 'build.gradle'), 'utf8');
|
||||
var depsList = '';
|
||||
var root = this.root;
|
||||
var insertExclude = function(p) {
|
||||
var gradlePath = path.join(root, p, 'build.gradle');
|
||||
var projectGradleFile = fs.readFileSync(gradlePath, 'utf-8');
|
||||
if(projectGradleFile.indexOf('CordovaLib') != -1) {
|
||||
depsList += '{\n exclude module:("CordovaLib")\n }\n';
|
||||
}
|
||||
else {
|
||||
depsList +='\n';
|
||||
}
|
||||
};
|
||||
subProjects.forEach(function(p) {
|
||||
console.log('Subproject Path: ' + p);
|
||||
var libName=p.replace(/[/\\]/g, ':').replace(name+'-','');
|
||||
depsList += ' debugCompile project(path: "' + libName + '", configuration: "debug")\n';
|
||||
depsList += ' releaseCompile project(path: "' + libName + '", configuration: "release")\n';
|
||||
depsList += ' debugCompile(project(path: "' + libName + '", configuration: "debug"))';
|
||||
insertExclude(p);
|
||||
depsList += ' releaseCompile(project(path: "' + libName + '", configuration: "release"))';
|
||||
insertExclude(p);
|
||||
});
|
||||
// For why we do this mapping: https://issues.apache.org/jira/browse/CB-8390
|
||||
var SYSTEM_LIBRARY_MAPPINGS = [
|
||||
@@ -134,17 +174,15 @@ GradleBuilder.prototype.prepBuildFiles = function() {
|
||||
GradleBuilder.prototype.prepEnv = function(opts) {
|
||||
var self = this;
|
||||
return check_reqs.check_gradle()
|
||||
.then(function() {
|
||||
return self.prepBuildFiles();
|
||||
}).then(function() {
|
||||
// Copy the gradle wrapper on each build so that:
|
||||
// A) we don't require the Android SDK at project creation time, and
|
||||
// B) we always use the SDK's latest version of it.
|
||||
// check_reqs ensures that this is set.
|
||||
/*jshint -W069 */
|
||||
var sdkDir = process.env['ANDROID_HOME'];
|
||||
/*jshint +W069 */
|
||||
var wrapperDir = path.join(sdkDir, 'tools', 'templates', 'gradle', 'wrapper');
|
||||
.then(function(gradlePath) {
|
||||
return self.runGradleWrapper(gradlePath);
|
||||
}).then(function() {
|
||||
return self.prepBuildFiles();
|
||||
}).then(function() {
|
||||
// We now copy the gradle out of the framework
|
||||
// This is a dirty patch to get the build working
|
||||
/*
|
||||
var wrapperDir = path.join(self.root, 'CordovaLib');
|
||||
if (process.platform == 'win32') {
|
||||
shell.rm('-f', path.join(self.root, 'gradlew.bat'));
|
||||
shell.cp(path.join(wrapperDir, 'gradlew.bat'), self.root);
|
||||
@@ -155,13 +193,13 @@ GradleBuilder.prototype.prepEnv = function(opts) {
|
||||
shell.rm('-rf', path.join(self.root, 'gradle', 'wrapper'));
|
||||
shell.mkdir('-p', path.join(self.root, 'gradle'));
|
||||
shell.cp('-r', path.join(wrapperDir, 'gradle', 'wrapper'), path.join(self.root, 'gradle'));
|
||||
|
||||
*/
|
||||
// If the gradle distribution URL is set, make sure it points to version we want.
|
||||
// If it's not set, do nothing, assuming that we're using a future version of gradle that we don't want to mess with.
|
||||
// For some reason, using ^ and $ don't work. This does the job, though.
|
||||
var distributionUrlRegex = /distributionUrl.*zip/;
|
||||
/*jshint -W069 */
|
||||
var distributionUrl = process.env['CORDOVA_ANDROID_GRADLE_DISTRIBUTION_URL'] || 'http\\://services.gradle.org/distributions/gradle-2.13-all.zip';
|
||||
var distributionUrl = process.env['CORDOVA_ANDROID_GRADLE_DISTRIBUTION_URL'] || 'https\\://services.gradle.org/distributions/gradle-3.3-all.zip';
|
||||
/*jshint +W069 */
|
||||
var gradleWrapperPropertiesPath = path.join(self.root, 'gradle', 'wrapper', 'gradle-wrapper.properties');
|
||||
shell.chmod('u+w', gradleWrapperPropertiesPath);
|
||||
@@ -189,7 +227,7 @@ GradleBuilder.prototype.build = function(opts) {
|
||||
.progress(function (stdio){
|
||||
if (stdio.stderr) {
|
||||
/*
|
||||
* Workaround for the issue with Java printing some unwanted information to
|
||||
* Workaround for the issue with Java printing some unwanted information to
|
||||
* stderr instead of stdout.
|
||||
* This function suppresses 'Picked up _JAVA_OPTIONS' message from being
|
||||
* printed to stderr. See https://issues.apache.org/jira/browse/CB-9971 for
|
||||
|
||||
@@ -26,10 +26,12 @@ var shelljs = require('shelljs'),
|
||||
Q = require('q'),
|
||||
path = require('path'),
|
||||
fs = require('fs'),
|
||||
ROOT = path.join(__dirname, '..', '..');
|
||||
os = require('os'),
|
||||
REPO_ROOT = path.join(__dirname, '..', '..', '..', '..'),
|
||||
PROJECT_ROOT = path.join(__dirname, '..', '..');
|
||||
var CordovaError = require('cordova-common').CordovaError;
|
||||
|
||||
var isWindows = process.platform == 'win32';
|
||||
var superspawn = require('cordova-common').superspawn;
|
||||
var android_sdk = require('./android_sdk');
|
||||
|
||||
function forgivingWhichSync(cmd) {
|
||||
try {
|
||||
@@ -50,7 +52,16 @@ function tryCommand(cmd, errMsg, catchStderr) {
|
||||
return d.promise;
|
||||
}
|
||||
|
||||
// Get valid target from framework/project.properties
|
||||
module.exports.isWindows = function() {
|
||||
return (os.platform() == 'win32');
|
||||
};
|
||||
|
||||
module.exports.isDarwin = function() {
|
||||
return (os.platform() == 'darwin');
|
||||
};
|
||||
|
||||
// Get valid target from framework/project.properties if run from this repo
|
||||
// Otherwise get target from project.properties file within a generated cordova-android project
|
||||
module.exports.get_target = function() {
|
||||
function extractFromFile(filePath) {
|
||||
var target = shelljs.grep(/\btarget=/, filePath);
|
||||
@@ -59,38 +70,83 @@ module.exports.get_target = function() {
|
||||
}
|
||||
return target.split('=')[1].trim();
|
||||
}
|
||||
if (fs.existsSync(path.join(ROOT, 'framework', 'project.properties'))) {
|
||||
return extractFromFile(path.join(ROOT, 'framework', 'project.properties'));
|
||||
var repo_file = path.join(REPO_ROOT, 'framework', 'project.properties');
|
||||
if (fs.existsSync(repo_file)) {
|
||||
return extractFromFile(repo_file);
|
||||
}
|
||||
if (fs.existsSync(path.join(ROOT, 'project.properties'))) {
|
||||
// if no target found, we're probably in a project and project.properties is in ROOT.
|
||||
return extractFromFile(path.join(ROOT, 'project.properties'));
|
||||
var project_file = path.join(PROJECT_ROOT, 'project.properties');
|
||||
if (fs.existsSync(project_file)) {
|
||||
// if no target found, we're probably in a project and project.properties is in PROJECT_ROOT.
|
||||
return extractFromFile(project_file);
|
||||
}
|
||||
throw new Error('Could not find android target. File missing: ' + path.join(ROOT, 'project.properties'));
|
||||
throw new Error('Could not find android target in either ' + repo_file + ' nor ' + project_file);
|
||||
};
|
||||
|
||||
// Returns a promise. Called only by build and clean commands.
|
||||
module.exports.check_ant = function() {
|
||||
return tryCommand('ant -version', 'Failed to run "ant -version", make sure you have ant installed and added to your PATH.')
|
||||
.then(function (output) {
|
||||
return superspawn.spawn('ant', ['-version'])
|
||||
.then(function(output) {
|
||||
// Parse Ant version from command output
|
||||
return /version ((?:\d+\.)+(?:\d+))/i.exec(output)[1];
|
||||
}).catch(function(err) {
|
||||
throw new CordovaError('Failed to run `ant -version`. Make sure you have `ant` on your $PATH.');
|
||||
});
|
||||
};
|
||||
|
||||
module.exports.get_gradle_wrapper = function() {
|
||||
var androidStudioPath;
|
||||
var i = 0;
|
||||
var foundStudio = false;
|
||||
var program_dir;
|
||||
if (module.exports.isDarwin()) {
|
||||
program_dir = fs.readdirSync('/Applications');
|
||||
while (i < program_dir.length && !foundStudio) {
|
||||
if (program_dir[i].startsWith('Android Studio')) {
|
||||
//TODO: Check for a specific Android Studio version, make sure it's not Canary
|
||||
androidStudioPath = path.join('/Applications', program_dir[i], 'Contents', 'gradle');
|
||||
foundStudio = true;
|
||||
} else { ++i; }
|
||||
}
|
||||
} else if (module.exports.isWindows()) {
|
||||
var androidPath = path.join(process.env['ProgramFiles'], 'Android') + '/';
|
||||
if (fs.existsSync(androidPath)) {
|
||||
program_dir = fs.readdirSync(androidPath);
|
||||
while (i < program_dir.length && !foundStudio) {
|
||||
if (program_dir[i].startsWith('Android Studio')) {
|
||||
foundStudio = true;
|
||||
androidStudioPath = path.join(process.env['ProgramFiles'], 'Android', program_dir[i], 'gradle');
|
||||
} else { ++i; }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (androidStudioPath !== null && fs.existsSync(androidStudioPath)) {
|
||||
var dirs = fs.readdirSync(androidStudioPath);
|
||||
if(dirs[0].split('-')[0] == 'gradle') {
|
||||
return path.join(androidStudioPath, dirs[0], 'bin', 'gradle');
|
||||
}
|
||||
} else {
|
||||
//OK, let's try to check for Gradle!
|
||||
return forgivingWhichSync('gradle');
|
||||
}
|
||||
};
|
||||
|
||||
// Returns a promise. Called only by build and clean commands.
|
||||
module.exports.check_gradle = function() {
|
||||
var sdkDir = process.env['ANDROID_HOME'];
|
||||
var d = Q.defer();
|
||||
if (!sdkDir)
|
||||
return Q.reject(new CordovaError('Could not find gradle wrapper within Android SDK. Could not find Android SDK directory.\n' +
|
||||
'Might need to install Android SDK or set up \'ANDROID_HOME\' env variable.'));
|
||||
|
||||
var wrapperDir = path.join(sdkDir, 'tools', 'templates', 'gradle', 'wrapper');
|
||||
if (!fs.existsSync(wrapperDir)) {
|
||||
return Q.reject(new CordovaError('Could not find gradle wrapper within Android SDK. Might need to update your Android SDK.\n' +
|
||||
'Looked here: ' + wrapperDir));
|
||||
}
|
||||
return Q.when();
|
||||
var gradlePath = module.exports.get_gradle_wrapper();
|
||||
if (gradlePath.length !== 0)
|
||||
d.resolve(gradlePath);
|
||||
else
|
||||
d.reject(new CordovaError('Could not find an installed version of Gradle either in Android Studio,\n' +
|
||||
'or on your system to install the gradle wrapper. Please include gradle \n' +
|
||||
'in your path, or install Android Studio'));
|
||||
return d.promise;
|
||||
};
|
||||
|
||||
// Returns a promise.
|
||||
@@ -105,12 +161,15 @@ module.exports.check_java = function() {
|
||||
}
|
||||
} else {
|
||||
if (javacPath) {
|
||||
var msg = 'Failed to find \'JAVA_HOME\' environment variable. Try setting setting it manually.';
|
||||
// OS X has a command for finding JAVA_HOME.
|
||||
if (fs.existsSync('/usr/libexec/java_home')) {
|
||||
return tryCommand('/usr/libexec/java_home', msg)
|
||||
var find_java = '/usr/libexec/java_home';
|
||||
var default_java_error_msg = 'Failed to find \'JAVA_HOME\' environment variable. Try setting setting it manually.';
|
||||
if (fs.existsSync(find_java)) {
|
||||
return superspawn.spawn(find_java)
|
||||
.then(function(stdout) {
|
||||
process.env['JAVA_HOME'] = stdout.trim();
|
||||
}).catch(function(err) {
|
||||
throw new CordovaError(default_java_error_msg);
|
||||
});
|
||||
} else {
|
||||
// See if we can derive it from javac's location.
|
||||
@@ -119,10 +178,10 @@ module.exports.check_java = function() {
|
||||
if (fs.existsSync(path.join(maybeJavaHome, 'lib', 'tools.jar'))) {
|
||||
process.env['JAVA_HOME'] = maybeJavaHome;
|
||||
} else {
|
||||
throw new CordovaError(msg);
|
||||
throw new CordovaError(default_java_error_msg);
|
||||
}
|
||||
}
|
||||
} else if (isWindows) {
|
||||
} else if (module.exports.isWindows()) {
|
||||
// Try to auto-detect java in the default install paths.
|
||||
var oldSilent = shelljs.config.silent;
|
||||
shelljs.config.silent = true;
|
||||
@@ -142,27 +201,29 @@ module.exports.check_java = function() {
|
||||
}
|
||||
}
|
||||
}).then(function() {
|
||||
var msg =
|
||||
'Failed to run "javac -version", make sure that you have a JDK installed.\n' +
|
||||
'You can get it from: http://www.oracle.com/technetwork/java/javase/downloads.\n';
|
||||
if (process.env['JAVA_HOME']) {
|
||||
msg += 'Your JAVA_HOME is invalid: ' + process.env['JAVA_HOME'] + '\n';
|
||||
}
|
||||
// We use tryCommand with catchStderr = true, because
|
||||
// javac writes version info to stderr instead of stdout
|
||||
return tryCommand('javac -version', msg, true)
|
||||
.then(function (output) {
|
||||
var match = /javac ((?:\d+\.)+(?:\d+))/i.exec(output);
|
||||
return match && match[1];
|
||||
});
|
||||
var msg =
|
||||
'Failed to run "javac -version", make sure that you have a JDK installed.\n' +
|
||||
'You can get it from: http://www.oracle.com/technetwork/java/javase/downloads.\n';
|
||||
if (process.env['JAVA_HOME']) {
|
||||
msg += 'Your JAVA_HOME is invalid: ' + process.env['JAVA_HOME'] + '\n';
|
||||
}
|
||||
// We use tryCommand with catchStderr = true, because
|
||||
// javac writes version info to stderr instead of stdout
|
||||
return tryCommand('javac -version', msg, true)
|
||||
.then(function (output) {
|
||||
//Let's check for at least Java 8, and keep it future proof so we can support Java 10
|
||||
var match = /javac ((?:1\.)(?:[8-9]\.)(?:\d+))|((?:1\.)(?:[1-9]\d+\.)(?:\d+))/i.exec(output);
|
||||
return match && match[1];
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
// Returns a promise.
|
||||
module.exports.check_android = function() {
|
||||
return Q().then(function() {
|
||||
var androidCmdPath = forgivingWhichSync('android');
|
||||
var adbInPath = !!forgivingWhichSync('adb');
|
||||
var adbInPath = forgivingWhichSync('adb');
|
||||
var avdmanagerInPath = forgivingWhichSync('avdmanager');
|
||||
var hasAndroidHome = !!process.env['ANDROID_HOME'] && fs.existsSync(process.env['ANDROID_HOME']);
|
||||
function maybeSetAndroidHome(value) {
|
||||
if (!hasAndroidHome && fs.existsSync(value)) {
|
||||
@@ -170,8 +231,10 @@ module.exports.check_android = function() {
|
||||
process.env['ANDROID_HOME'] = value;
|
||||
}
|
||||
}
|
||||
if (!hasAndroidHome && !androidCmdPath) {
|
||||
if (isWindows) {
|
||||
// First ensure ANDROID_HOME is set
|
||||
// If we have no hints (nothing in PATH), try a few default locations
|
||||
if (!hasAndroidHome && !androidCmdPath && !adbInPath && !avdmanagerInPath) {
|
||||
if (module.exports.isWindows()) {
|
||||
// Android Studio 1.0 installer
|
||||
maybeSetAndroidHome(path.join(process.env['LOCALAPPDATA'], 'Android', 'sdk'));
|
||||
maybeSetAndroidHome(path.join(process.env['ProgramFiles'], 'Android', 'sdk'));
|
||||
@@ -181,7 +244,7 @@ module.exports.check_android = function() {
|
||||
// Stand-alone installer
|
||||
maybeSetAndroidHome(path.join(process.env['LOCALAPPDATA'], 'Android', 'android-sdk'));
|
||||
maybeSetAndroidHome(path.join(process.env['ProgramFiles'], 'Android', 'android-sdk'));
|
||||
} else if (process.platform == 'darwin') {
|
||||
} else if (module.exports.isDarwin()) {
|
||||
// Android Studio 1.0 installer
|
||||
maybeSetAndroidHome(path.join(process.env['HOME'], 'Library', 'Android', 'sdk'));
|
||||
// Android Studio pre-1.0 installer
|
||||
@@ -196,26 +259,42 @@ module.exports.check_android = function() {
|
||||
maybeSetAndroidHome(path.join(process.env['HOME'], 'android-sdk'));
|
||||
}
|
||||
}
|
||||
if (hasAndroidHome && !androidCmdPath) {
|
||||
process.env['PATH'] += path.delimiter + path.join(process.env['ANDROID_HOME'], 'tools');
|
||||
}
|
||||
if (androidCmdPath && !hasAndroidHome) {
|
||||
var parentDir = path.dirname(androidCmdPath);
|
||||
var grandParentDir = path.dirname(parentDir);
|
||||
if (path.basename(parentDir) == 'tools') {
|
||||
process.env['ANDROID_HOME'] = path.dirname(parentDir);
|
||||
hasAndroidHome = true;
|
||||
} else if (fs.existsSync(path.join(grandParentDir, 'tools', 'android'))) {
|
||||
process.env['ANDROID_HOME'] = grandParentDir;
|
||||
hasAndroidHome = true;
|
||||
} else {
|
||||
throw new CordovaError('Failed to find \'ANDROID_HOME\' environment variable. Try setting setting it manually.\n' +
|
||||
'Detected \'android\' command at ' + parentDir + ' but no \'tools\' directory found near.\n' +
|
||||
'Try reinstall Android SDK or update your PATH to include path to valid SDK directory.');
|
||||
if (!hasAndroidHome) {
|
||||
// If we dont have ANDROID_HOME, but we do have some tools on the PATH, try to infer from the tooling PATH.
|
||||
var parentDir, grandParentDir;
|
||||
if (androidCmdPath) {
|
||||
parentDir = path.dirname(androidCmdPath);
|
||||
grandParentDir = path.dirname(parentDir);
|
||||
if (path.basename(parentDir) == 'tools' || fs.existsSync(path.join(grandParentDir, 'tools', 'android'))) {
|
||||
maybeSetAndroidHome(grandParentDir);
|
||||
} else {
|
||||
throw new CordovaError('Failed to find \'ANDROID_HOME\' environment variable. Try setting setting it manually.\n' +
|
||||
'Detected \'android\' command at ' + parentDir + ' but no \'tools\' directory found near.\n' +
|
||||
'Try reinstall Android SDK or update your PATH to include valid path to SDK' + path.sep + 'tools directory.');
|
||||
}
|
||||
}
|
||||
if (adbInPath) {
|
||||
parentDir = path.dirname(adbInPath);
|
||||
grandParentDir = path.dirname(parentDir);
|
||||
if (path.basename(parentDir) == 'platform-tools') {
|
||||
maybeSetAndroidHome(grandParentDir);
|
||||
} else {
|
||||
throw new CordovaError('Failed to find \'ANDROID_HOME\' environment variable. Try setting setting it manually.\n' +
|
||||
'Detected \'adb\' command at ' + parentDir + ' but no \'platform-tools\' directory found near.\n' +
|
||||
'Try reinstall Android SDK or update your PATH to include valid path to SDK' + path.sep + 'platform-tools directory.');
|
||||
}
|
||||
}
|
||||
if (avdmanagerInPath) {
|
||||
parentDir = path.dirname(avdmanagerInPath);
|
||||
grandParentDir = path.dirname(parentDir);
|
||||
if (path.basename(parentDir) == 'bin' && path.basename(grandParentDir) == 'tools') {
|
||||
maybeSetAndroidHome(path.dirname(grandParentDir));
|
||||
} else {
|
||||
throw new CordovaError('Failed to find \'ANDROID_HOME\' environment variable. Try setting setting it manually.\n' +
|
||||
'Detected \'avdmanager\' command at ' + parentDir + ' but no \'tools' + path.sep + 'bin\' directory found near.\n' +
|
||||
'Try reinstall Android SDK or update your PATH to include valid path to SDK' + path.sep + 'tools' + path.sep + 'bin directory.');
|
||||
}
|
||||
}
|
||||
}
|
||||
if (hasAndroidHome && !adbInPath) {
|
||||
process.env['PATH'] += path.delimiter + path.join(process.env['ANDROID_HOME'], 'platform-tools');
|
||||
}
|
||||
if (!process.env['ANDROID_HOME']) {
|
||||
throw new CordovaError('Failed to find \'ANDROID_HOME\' environment variable. Try setting setting it manually.\n' +
|
||||
@@ -225,12 +304,27 @@ module.exports.check_android = function() {
|
||||
throw new CordovaError('\'ANDROID_HOME\' environment variable is set to non-existent path: ' + process.env['ANDROID_HOME'] +
|
||||
'\nTry update it manually to point to valid SDK directory.');
|
||||
}
|
||||
// Next let's make sure relevant parts of the SDK tooling is in our PATH
|
||||
if (hasAndroidHome && !androidCmdPath) {
|
||||
process.env['PATH'] += path.delimiter + path.join(process.env['ANDROID_HOME'], 'tools');
|
||||
}
|
||||
if (hasAndroidHome && !adbInPath) {
|
||||
process.env['PATH'] += path.delimiter + path.join(process.env['ANDROID_HOME'], 'platform-tools');
|
||||
}
|
||||
if (hasAndroidHome && !avdmanagerInPath) {
|
||||
process.env['PATH'] += path.delimiter + path.join(process.env['ANDROID_HOME'], 'tools', 'bin');
|
||||
}
|
||||
return hasAndroidHome;
|
||||
});
|
||||
};
|
||||
|
||||
// TODO: is this actually needed?
|
||||
module.exports.getAbsoluteAndroidCmd = function () {
|
||||
var cmd = forgivingWhichSync('android');
|
||||
if (process.platform === 'win32') {
|
||||
if (cmd.length === 0) {
|
||||
cmd = forgivingWhichSync('sdkmanager');
|
||||
}
|
||||
if (module.exports.isWindows()) {
|
||||
return '"' + cmd + '"';
|
||||
}
|
||||
return cmd.replace(/(\s)/g, '\\$1');
|
||||
@@ -242,20 +336,17 @@ module.exports.check_android_target = function(originalError) {
|
||||
// android-L
|
||||
// Google Inc.:Google APIs:20
|
||||
// Google Inc.:Glass Development Kit Preview:20
|
||||
var valid_target = module.exports.get_target();
|
||||
var msg = 'Android SDK not found. Make sure that it is installed. If it is not at the default location, set the ANDROID_HOME environment variable.';
|
||||
return tryCommand('android list targets --compact', msg)
|
||||
.then(function(output) {
|
||||
var targets = output.split('\n');
|
||||
if (targets.indexOf(valid_target) >= 0) {
|
||||
var desired_api_level = module.exports.get_target();
|
||||
return android_sdk.list_targets()
|
||||
.then(function(targets) {
|
||||
if (targets.indexOf(desired_api_level) >= 0) {
|
||||
return targets;
|
||||
}
|
||||
|
||||
var androidCmd = module.exports.getAbsoluteAndroidCmd();
|
||||
var msg = 'Please install Android target: "' + valid_target + '".\n\n' +
|
||||
var msg = 'Please install Android target / API level: "' + desired_api_level + '".\n\n' +
|
||||
'Hint: Open the SDK manager by running: ' + androidCmd + '\n' +
|
||||
'You will require:\n' +
|
||||
'1. "SDK Platform" for ' + valid_target + '\n' +
|
||||
'1. "SDK Platform" for API level ' + desired_api_level + '\n' +
|
||||
'2. "Android SDK Platform-tools (latest)\n' +
|
||||
'3. "Android SDK Build-tools" (latest)';
|
||||
if (originalError) {
|
||||
@@ -267,13 +358,22 @@ module.exports.check_android_target = function(originalError) {
|
||||
|
||||
// Returns a promise.
|
||||
module.exports.run = function() {
|
||||
return Q.all([this.check_java(), this.check_android()])
|
||||
.then(function() {
|
||||
console.log('ANDROID_HOME=' + process.env['ANDROID_HOME']);
|
||||
console.log('JAVA_HOME=' + process.env['JAVA_HOME']);
|
||||
});
|
||||
return Q.all([this.check_java(), this.check_android()])
|
||||
.then(function(values) {
|
||||
console.log('ANDROID_HOME=' + process.env['ANDROID_HOME']);
|
||||
console.log('JAVA_HOME=' + process.env['JAVA_HOME']);
|
||||
|
||||
if (!values[0]) {
|
||||
throw new CordovaError('Requirements check failed for JDK 1.8 or greater');
|
||||
}
|
||||
|
||||
if (!values[1]) {
|
||||
throw new CordovaError('Requirements check failed for Android SDK');
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Object thar represents one of requirements for current platform.
|
||||
* @param {String} id The unique identifier for this requirements.
|
||||
131
bin/templates/cordova/lib/emulator.js
vendored
@@ -27,11 +27,15 @@ var path = require('path');
|
||||
var Adb = require('./Adb');
|
||||
var AndroidManifest = require('./AndroidManifest');
|
||||
var events = require('cordova-common').events;
|
||||
var spawn = require('cordova-common').superspawn.spawn;
|
||||
var superspawn = require('cordova-common').superspawn;
|
||||
var CordovaError = require('cordova-common').CordovaError;
|
||||
var shelljs = require('shelljs');
|
||||
var android_sdk = require('./android_sdk');
|
||||
var check_reqs = require('./check_reqs');
|
||||
|
||||
var Q = require('q');
|
||||
var os = require('os');
|
||||
var fs = require('fs');
|
||||
var child_process = require('child_process');
|
||||
|
||||
// constants
|
||||
@@ -42,18 +46,77 @@ var NUM_INSTALL_RETRIES = 3;
|
||||
var CHECK_BOOTED_INTERVAL = 3 * ONE_SECOND; // in milliseconds
|
||||
var EXEC_KILL_SIGNAL = 'SIGKILL';
|
||||
|
||||
/**
|
||||
* Returns a Promise for a list of emulator images in the form of objects
|
||||
* {
|
||||
name : <emulator_name>,
|
||||
path : <path_to_emulator_image>,
|
||||
target : <api_target>,
|
||||
abi : <cpu>,
|
||||
skin : <skin>
|
||||
}
|
||||
*/
|
||||
module.exports.list_images = function() {
|
||||
return spawn('android', ['list', 'avds'])
|
||||
function forgivingWhichSync(cmd) {
|
||||
try {
|
||||
return fs.realpathSync(shelljs.which(cmd));
|
||||
} catch (e) {
|
||||
return '';
|
||||
}
|
||||
}
|
||||
|
||||
module.exports.list_images_using_avdmanager = function () {
|
||||
return superspawn.spawn('avdmanager', ['list', 'avd'])
|
||||
.then(function(output) {
|
||||
var response = output.split('\n');
|
||||
var emulator_list = [];
|
||||
for (var i = 1; i < response.length; i++) {
|
||||
// To return more detailed information use img_obj
|
||||
var img_obj = {};
|
||||
if (response[i].match(/Name:\s/)) {
|
||||
img_obj['name'] = response[i].split('Name: ')[1].replace('\r', '');
|
||||
if (response[i + 1].match(/Device:\s/)) {
|
||||
i++;
|
||||
img_obj['device'] = response[i].split('Device: ')[1].replace('\r', '');
|
||||
}
|
||||
if (response[i + 1].match(/Path:\s/)) {
|
||||
i++;
|
||||
img_obj['path'] = response[i].split('Path: ')[1].replace('\r', '');
|
||||
}
|
||||
if (response[i + 1].match(/Target:\s/)) {
|
||||
i++;
|
||||
if (response[i + 1].match(/ABI:\s/)) {
|
||||
img_obj['abi'] = response[i + 1].split('ABI: ')[1].replace('\r', '');
|
||||
}
|
||||
// This next conditional just aims to match the old output of `android list avd`
|
||||
// We do so so that we don't have to change the logic when parsing for the
|
||||
// best emulator target to spawn (see below in `best_image`)
|
||||
// This allows us to transitionally support both `android` and `avdmanager` binaries,
|
||||
// depending on what SDK version the user has
|
||||
if (response[i + 1].match(/Based\son:\s/)) {
|
||||
img_obj['target'] = response[i + 1].split('Based on:')[1];
|
||||
if (img_obj['target'].match(/Tag\/ABI:\s/)) {
|
||||
img_obj['target'] = img_obj['target'].split('Tag/ABI:')[0].replace('\r', '').trim();
|
||||
if (img_obj['target'].indexOf('(') > -1) {
|
||||
img_obj['target'] = img_obj['target'].substr(0, img_obj['target'].indexOf('(') - 1).trim();
|
||||
}
|
||||
}
|
||||
var version_string = img_obj['target'].replace(/Android\s+/, '');
|
||||
|
||||
var api_level = android_sdk.version_string_to_api_level[version_string];
|
||||
if (api_level) {
|
||||
img_obj['target'] += ' (API level ' + api_level + ')';
|
||||
}
|
||||
}
|
||||
}
|
||||
if (response[i + 1].match(/Skin:\s/)) {
|
||||
i++;
|
||||
img_obj['skin'] = response[i].split('Skin: ')[1].replace('\r', '');
|
||||
}
|
||||
|
||||
emulator_list.push(img_obj);
|
||||
}
|
||||
/* To just return a list of names use this
|
||||
if (response[i].match(/Name:\s/)) {
|
||||
emulator_list.push(response[i].split('Name: ')[1].replace('\r', '');
|
||||
}*/
|
||||
|
||||
}
|
||||
return emulator_list;
|
||||
});
|
||||
};
|
||||
|
||||
module.exports.list_images_using_android = function() {
|
||||
return superspawn.spawn('android', ['list', 'avd'])
|
||||
.then(function(output) {
|
||||
var response = output.split('\n');
|
||||
var emulator_list = [];
|
||||
@@ -96,6 +159,29 @@ module.exports.list_images = function() {
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* Returns a Promise for a list of emulator images in the form of objects
|
||||
* {
|
||||
name : <emulator_name>,
|
||||
device : <device>,
|
||||
path : <path_to_emulator_image>,
|
||||
target : <api_target>,
|
||||
abi : <cpu>,
|
||||
skin : <skin>
|
||||
}
|
||||
*/
|
||||
module.exports.list_images = function() {
|
||||
if (forgivingWhichSync('avdmanager')) {
|
||||
return module.exports.list_images_using_avdmanager();
|
||||
} else if (forgivingWhichSync('android')) {
|
||||
return module.exports.list_images_using_android();
|
||||
} else {
|
||||
return Q().then(function() {
|
||||
throw new CordovaError('Could not find either `android` or `avdmanager` on your $PATH! Are you sure the Android SDK is installed and available?');
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Will return the closest avd to the projects target
|
||||
* or undefined if no avds exist.
|
||||
@@ -109,8 +195,7 @@ module.exports.best_image = function() {
|
||||
|
||||
var closest = 9999;
|
||||
var best = images[0];
|
||||
// Loading check_reqs at run-time to avoid test-time vs run-time directory structure difference issue
|
||||
var project_target = require('./check_reqs').get_target().replace('android-', '');
|
||||
var project_target = check_reqs.get_target().replace('android-', '');
|
||||
for (var i in images) {
|
||||
var target = images[i].target;
|
||||
if(target) {
|
||||
@@ -133,8 +218,9 @@ module.exports.list_started = function() {
|
||||
};
|
||||
|
||||
// Returns a promise.
|
||||
// TODO: we should remove this, there's a more robust method under android_sdk.js
|
||||
module.exports.list_targets = function() {
|
||||
return spawn('android', ['list', 'targets'], {cwd: os.tmpdir()})
|
||||
return superspawn.spawn('android', ['list', 'targets'], {cwd: os.tmpdir()})
|
||||
.then(function(output) {
|
||||
var target_out = output.split('\n');
|
||||
var targets = [];
|
||||
@@ -189,8 +275,7 @@ module.exports.start = function(emulator_ID, boot_timeout) {
|
||||
return best.name;
|
||||
}
|
||||
|
||||
// Loading check_reqs at run-time to avoid test-time vs run-time directory structure difference issue
|
||||
var androidCmd = require('./check_reqs').getAbsoluteAndroidCmd();
|
||||
var androidCmd = check_reqs.getAbsoluteAndroidCmd();
|
||||
return Q.reject(new CordovaError('No emulator images (avds) found.\n' +
|
||||
'1. Download desired System Image by running: ' + androidCmd + ' sdk\n' +
|
||||
'2. Create an AVD by running: ' + androidCmd + ' avd\n' +
|
||||
@@ -199,10 +284,13 @@ module.exports.start = function(emulator_ID, boot_timeout) {
|
||||
}).then(function(emulatorId) {
|
||||
return self.get_available_port()
|
||||
.then(function (port) {
|
||||
// Figure out the directory the emulator binary runs in, and set the cwd to that directory.
|
||||
// Workaround for https://code.google.com/p/android/issues/detail?id=235461
|
||||
var emulator_dir = path.dirname(shelljs.which('emulator'));
|
||||
var args = ['-avd', emulatorId, '-port', port];
|
||||
// Don't wait for it to finish, since the emulator will probably keep running for a long time.
|
||||
child_process
|
||||
.spawn('emulator', args, { stdio: 'inherit', detached: true })
|
||||
.spawn('emulator', args, { stdio: 'inherit', detached: true, cwd: emulator_dir })
|
||||
.unref();
|
||||
|
||||
// wait for emulator to start
|
||||
@@ -294,7 +382,7 @@ module.exports.wait_for_boot = function(emulator_id, time_remaining) {
|
||||
module.exports.create_image = function(name, target) {
|
||||
console.log('Creating new avd named ' + name);
|
||||
if (target) {
|
||||
return spawn('android', ['create', 'avd', '--name', name, '--target', target])
|
||||
return superspawn.spawn('android', ['create', 'avd', '--name', name, '--target', target])
|
||||
.then(null, function(error) {
|
||||
console.error('ERROR : Failed to create emulator image : ');
|
||||
console.error(' Do you have the latest android targets including ' + target + '?');
|
||||
@@ -302,7 +390,8 @@ module.exports.create_image = function(name, target) {
|
||||
});
|
||||
} else {
|
||||
console.log('WARNING : Project target not found, creating avd with a different target but the project may fail to install.');
|
||||
return spawn('android', ['create', 'avd', '--name', name, '--target', this.list_targets()[0]])
|
||||
// TODO: there's a more robust method for finding targets in android_sdk.js
|
||||
return superspawn.spawn('android', ['create', 'avd', '--name', name, '--target', this.list_targets()[0]])
|
||||
.then(function() {
|
||||
// TODO: This seems like another error case, even though it always happens.
|
||||
console.error('ERROR : Unable to create an avd emulator, no targets found.');
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
var devices = require('./device');
|
||||
|
||||
// Usage support for when args are given
|
||||
require('../lib/check_reqs').check_android().then(function() {
|
||||
require('./check_reqs').check_android().then(function() {
|
||||
devices.list().done(function(device_list) {
|
||||
device_list && device_list.forEach(function(dev) {
|
||||
console.log(dev);
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
var emulators = require('./emulator');
|
||||
|
||||
// Usage support for when args are given
|
||||
require('../lib/check_reqs').check_android().then(function() {
|
||||
require('./check_reqs').check_android().then(function() {
|
||||
emulators.list_images().done(function(emulator_list) {
|
||||
emulator_list && emulator_list.forEach(function(emu) {
|
||||
console.log(emu.name);
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
var emulators = require('./emulator');
|
||||
|
||||
// Usage support for when args are given
|
||||
require('../lib/check_reqs').check_android().then(function() {
|
||||
require('./check_reqs').check_android().then(function() {
|
||||
emulators.list_started().done(function(emulator_list) {
|
||||
emulator_list && emulator_list.forEach(function(emu) {
|
||||
console.log(emu);
|
||||
|
||||
@@ -21,24 +21,15 @@
|
||||
buildscript {
|
||||
repositories {
|
||||
mavenCentral()
|
||||
jcenter()
|
||||
}
|
||||
|
||||
// Switch the Android Gradle plugin version requirement depending on the
|
||||
// installed version of Gradle. This dependency is documented at
|
||||
// http://tools.android.com/tech-docs/new-build-system/version-compatibility
|
||||
// and https://issues.apache.org/jira/browse/CB-8143
|
||||
if (gradle.gradleVersion >= "2.2") {
|
||||
dependencies {
|
||||
classpath 'com.android.tools.build:gradle:1.0.0+'
|
||||
}
|
||||
} else if (gradle.gradleVersion >= "2.1") {
|
||||
dependencies {
|
||||
classpath 'com.android.tools.build:gradle:0.14.0+'
|
||||
}
|
||||
} else {
|
||||
dependencies {
|
||||
classpath 'com.android.tools.build:gradle:0.12.0+'
|
||||
}
|
||||
dependencies {
|
||||
classpath 'com.android.tools.build:gradle:1.0.0+'
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
36
bin/templates/cordova/lib/pluginHandlers.js
vendored
@@ -30,7 +30,13 @@ var handlers = {
|
||||
install:function(obj, plugin, project, options) {
|
||||
if (!obj.src) throw new CordovaError(generateAttributeError('src', 'source-file', plugin.id));
|
||||
if (!obj.targetDir) throw new CordovaError(generateAttributeError('target-dir', 'source-file', plugin.id));
|
||||
|
||||
var dest = path.join(obj.targetDir, path.basename(obj.src));
|
||||
|
||||
if(options && options.android_studio === true) {
|
||||
dest = path.join('app/src/main/java', obj.targetDir.substring(4), path.basename(obj.src));
|
||||
}
|
||||
|
||||
if (options && options.force) {
|
||||
copyFile(plugin.dir, obj.src, project.projectDir, dest, !!(options && options.link));
|
||||
} else {
|
||||
@@ -39,16 +45,27 @@ var handlers = {
|
||||
},
|
||||
uninstall:function(obj, plugin, project, options) {
|
||||
var dest = path.join(obj.targetDir, path.basename(obj.src));
|
||||
|
||||
if(options && options.android_studio === true) {
|
||||
dest = path.join('app/src/main/java', obj.targetDir.substring(4), path.basename(obj.src));
|
||||
}
|
||||
|
||||
deleteJava(project.projectDir, dest);
|
||||
}
|
||||
},
|
||||
'lib-file':{
|
||||
install:function(obj, plugin, project, options) {
|
||||
var dest = path.join('libs', path.basename(obj.src));
|
||||
if(options && options.android_studio === true) {
|
||||
dest = path.join('app/libs', path.basename(obj.src));
|
||||
}
|
||||
copyFile(plugin.dir, obj.src, project.projectDir, dest, !!(options && options.link));
|
||||
},
|
||||
uninstall:function(obj, plugin, project, options) {
|
||||
var dest = path.join('libs', path.basename(obj.src));
|
||||
if(options && options.android_studio === true) {
|
||||
dest = path.join('app/libs', path.basename(obj.src));
|
||||
}
|
||||
removeFile(project.projectDir, dest);
|
||||
}
|
||||
},
|
||||
@@ -214,9 +231,8 @@ function copyFile (plugin_dir, src, project_dir, dest, link) {
|
||||
throw new CordovaError('Destination "' + dest + '" for source file "' + src + '" is located outside the project');
|
||||
|
||||
shell.mkdir('-p', path.dirname(dest));
|
||||
|
||||
if (link) {
|
||||
fs.symlinkSync(path.relative(path.dirname(dest), src), dest);
|
||||
symlinkFileOrDirTree(src, dest);
|
||||
} else if (fs.statSync(src).isDirectory()) {
|
||||
// XXX shelljs decides to create a directory when -R|-r is used which sucks. http://goo.gl/nbsjq
|
||||
shell.cp('-Rf', src+'/*', dest);
|
||||
@@ -234,6 +250,22 @@ function copyNewFile (plugin_dir, src, project_dir, dest, link) {
|
||||
copyFile(plugin_dir, src, project_dir, dest, !!link);
|
||||
}
|
||||
|
||||
function symlinkFileOrDirTree(src, dest) {
|
||||
if (fs.existsSync(dest)) {
|
||||
shell.rm('-Rf', dest);
|
||||
}
|
||||
|
||||
if (fs.statSync(src).isDirectory()) {
|
||||
shell.mkdir('-p', dest);
|
||||
fs.readdirSync(src).forEach(function(entry) {
|
||||
symlinkFileOrDirTree(path.join(src, entry), path.join(dest, entry));
|
||||
});
|
||||
}
|
||||
else {
|
||||
fs.symlinkSync(path.relative(fs.realpathSync(path.dirname(dest)), src), dest);
|
||||
}
|
||||
}
|
||||
|
||||
// checks if file exists and then deletes. Error if doesn't exist
|
||||
function removeFile (project_dir, src) {
|
||||
var file = path.resolve(project_dir, src);
|
||||
|
||||
79
bin/templates/cordova/lib/prepare.js
vendored
@@ -33,7 +33,6 @@ var PluginInfoProvider = require('cordova-common').PluginInfoProvider;
|
||||
|
||||
module.exports.prepare = function (cordovaProject, options) {
|
||||
var self = this;
|
||||
var platformResourcesDir = path.relative(cordovaProject.root, path.join(this.locations.root, 'res'));
|
||||
|
||||
var platformJson = PlatformJson.load(this.locations.root, this.platform);
|
||||
var munger = new PlatformMunger(this.platform, this.locations.root, platformJson, new PluginInfoProvider());
|
||||
@@ -47,8 +46,9 @@ module.exports.prepare = function (cordovaProject, options) {
|
||||
return updateProjectAccordingTo(self._config, self.locations);
|
||||
})
|
||||
.then(function () {
|
||||
updateIcons(cordovaProject, platformResourcesDir);
|
||||
updateSplashes(cordovaProject, platformResourcesDir);
|
||||
updateIcons(cordovaProject, path.relative(cordovaProject.root, self.locations.res));
|
||||
updateSplashes(cordovaProject, path.relative(cordovaProject.root, self.locations.res));
|
||||
updateFileResources(cordovaProject, path.relative(cordovaProject.root, self.locations.root));
|
||||
})
|
||||
.then(function () {
|
||||
events.emit('verbose', 'Prepared android project successfully');
|
||||
@@ -61,20 +61,19 @@ module.exports.clean = function (options) {
|
||||
// noPrepare option passed in by the non-CLI clean script. If that's present, or if
|
||||
// there's no config.xml found at the project root, then don't clean prepared files.
|
||||
var projectRoot = path.resolve(this.root, '../..');
|
||||
var projectConfigFile = path.join(projectRoot, 'config.xml');
|
||||
if ((options && options.noPrepare) || !fs.existsSync(projectConfigFile) ||
|
||||
if ((options && options.noPrepare) || !fs.existsSync(this.locations.configXml) ||
|
||||
!fs.existsSync(this.locations.configXml)) {
|
||||
return Q();
|
||||
}
|
||||
|
||||
var projectConfig = new ConfigParser(this.locations.configXml);
|
||||
var platformResourcesDir = path.relative(projectRoot, path.join(this.locations.root, 'res'));
|
||||
|
||||
var self = this;
|
||||
return Q().then(function () {
|
||||
cleanWww(projectRoot, self.locations);
|
||||
cleanIcons(projectRoot, projectConfig, platformResourcesDir);
|
||||
cleanSplashes(projectRoot, projectConfig, platformResourcesDir);
|
||||
cleanIcons(projectRoot, projectConfig, path.relative(projectRoot, self.locations.res));
|
||||
cleanSplashes(projectRoot, projectConfig, path.relative(projectRoot, self.locations.res));
|
||||
cleanFileResources(projectRoot, projectConfig, path.relative(projectRoot, self.locations.root));
|
||||
});
|
||||
};
|
||||
|
||||
@@ -172,7 +171,7 @@ function updateProjectAccordingTo(platformConfig, locations) {
|
||||
// Update app name by editing res/values/strings.xml
|
||||
var name = platformConfig.name();
|
||||
var strings = xmlHelpers.parseElementtreeSync(locations.strings);
|
||||
strings.find('string[@name="app_name"]').text = name;
|
||||
strings.find('string[@name="app_name"]').text = name.replace(/\'/g, '\\\'');
|
||||
fs.writeFileSync(locations.strings, strings.write({indent: 4}), 'utf-8');
|
||||
events.emit('verbose', 'Wrote out android application name "' + name + '" to ' + locations.strings);
|
||||
|
||||
@@ -247,11 +246,11 @@ function default_versionCode(version) {
|
||||
return versionCode;
|
||||
}
|
||||
|
||||
function getImageResourcePath(resourcesDir, density, name, sourceName) {
|
||||
function getImageResourcePath(resourcesDir, type, density, name, sourceName) {
|
||||
if (/\.9\.png$/.test(sourceName)) {
|
||||
name = name.replace(/\.png$/, '.9.png');
|
||||
}
|
||||
var resourcePath = path.join(resourcesDir, (density ? 'drawable-' + density : 'drawable'), name);
|
||||
var resourcePath = path.join(resourcesDir, (density ? type + '-' + density : type), name);
|
||||
return resourcePath;
|
||||
}
|
||||
|
||||
@@ -264,7 +263,7 @@ function updateSplashes(cordovaProject, platformResourcesDir) {
|
||||
return;
|
||||
}
|
||||
|
||||
var resourceMap = mapImageResources(cordovaProject.root, platformResourcesDir, 'screen.png');
|
||||
var resourceMap = mapImageResources(cordovaProject.root, platformResourcesDir, 'drawable', 'screen.png');
|
||||
|
||||
var hadMdpi = false;
|
||||
resources.forEach(function (resource) {
|
||||
@@ -275,14 +274,14 @@ function updateSplashes(cordovaProject, platformResourcesDir) {
|
||||
hadMdpi = true;
|
||||
}
|
||||
var targetPath = getImageResourcePath(
|
||||
platformResourcesDir, resource.density, 'screen.png', path.basename(resource.src));
|
||||
platformResourcesDir, 'drawable', resource.density, 'screen.png', path.basename(resource.src));
|
||||
resourceMap[targetPath] = resource.src;
|
||||
});
|
||||
|
||||
// There's no "default" drawable, so assume default == mdpi.
|
||||
if (!hadMdpi && resources.defaultResource) {
|
||||
var targetPath = getImageResourcePath(
|
||||
platformResourcesDir, 'mdpi', 'screen.png', path.basename(resources.defaultResource.src));
|
||||
platformResourcesDir, 'drawable', 'mdpi', 'screen.png', path.basename(resources.defaultResource.src));
|
||||
resourceMap[targetPath] = resources.defaultResource.src;
|
||||
}
|
||||
|
||||
@@ -294,7 +293,7 @@ function updateSplashes(cordovaProject, platformResourcesDir) {
|
||||
function cleanSplashes(projectRoot, projectConfig, platformResourcesDir) {
|
||||
var resources = projectConfig.getSplashScreens('android');
|
||||
if (resources.length > 0) {
|
||||
var resourceMap = mapImageResources(projectRoot, platformResourcesDir, 'screen.png');
|
||||
var resourceMap = mapImageResources(projectRoot, platformResourcesDir, 'drawable', 'screen.png');
|
||||
events.emit('verbose', 'Cleaning splash screens at ' + platformResourcesDir);
|
||||
|
||||
// No source paths are specified in the map, so updatePaths() will delete the target files.
|
||||
@@ -312,7 +311,7 @@ function updateIcons(cordovaProject, platformResourcesDir) {
|
||||
return;
|
||||
}
|
||||
|
||||
var resourceMap = mapImageResources(cordovaProject.root, platformResourcesDir, 'icon.png');
|
||||
var resourceMap = mapImageResources(cordovaProject.root, platformResourcesDir, 'mipmap', 'icon.png');
|
||||
|
||||
var android_icons = {};
|
||||
var default_icon;
|
||||
@@ -363,14 +362,14 @@ function updateIcons(cordovaProject, platformResourcesDir) {
|
||||
// project's config.xml location, so we use it as base path.
|
||||
for (var density in android_icons) {
|
||||
var targetPath = getImageResourcePath(
|
||||
platformResourcesDir, density, 'icon.png', path.basename(android_icons[density].src));
|
||||
platformResourcesDir, 'mipmap', density, 'icon.png', path.basename(android_icons[density].src));
|
||||
resourceMap[targetPath] = android_icons[density].src;
|
||||
}
|
||||
|
||||
// There's no "default" drawable, so assume default == mdpi.
|
||||
if (default_icon && !android_icons.mdpi) {
|
||||
var defaultTargetPath = getImageResourcePath(
|
||||
platformResourcesDir, 'mdpi', 'icon.png', path.basename(default_icon.src));
|
||||
platformResourcesDir, 'mipmap', 'mdpi', 'icon.png', path.basename(default_icon.src));
|
||||
resourceMap[defaultTargetPath] = default_icon.src;
|
||||
}
|
||||
|
||||
@@ -382,7 +381,7 @@ function updateIcons(cordovaProject, platformResourcesDir) {
|
||||
function cleanIcons(projectRoot, projectConfig, platformResourcesDir) {
|
||||
var icons = projectConfig.getIcons('android');
|
||||
if (icons.length > 0) {
|
||||
var resourceMap = mapImageResources(projectRoot, platformResourcesDir, 'icon.png');
|
||||
var resourceMap = mapImageResources(projectRoot, platformResourcesDir, 'mipmap', 'icon.png');
|
||||
events.emit('verbose', 'Cleaning icons at ' + platformResourcesDir);
|
||||
|
||||
// No source paths are specified in the map, so updatePaths() will delete the target files.
|
||||
@@ -394,9 +393,9 @@ function cleanIcons(projectRoot, projectConfig, platformResourcesDir) {
|
||||
/**
|
||||
* Gets a map containing resources of a specified name from all drawable folders in a directory.
|
||||
*/
|
||||
function mapImageResources(rootDir, subDir, resourceName) {
|
||||
function mapImageResources(rootDir, subDir, type, resourceName) {
|
||||
var pathMap = {};
|
||||
shell.ls(path.join(rootDir, subDir, 'drawable-*'))
|
||||
shell.ls(path.join(rootDir, subDir, type + '-*'))
|
||||
.forEach(function (drawableFolder) {
|
||||
var imagePath = path.join(subDir, path.basename(drawableFolder), resourceName);
|
||||
pathMap[imagePath] = null;
|
||||
@@ -404,6 +403,44 @@ function mapImageResources(rootDir, subDir, resourceName) {
|
||||
return pathMap;
|
||||
}
|
||||
|
||||
|
||||
function updateFileResources(cordovaProject, platformDir) {
|
||||
var files = cordovaProject.projectConfig.getFileResources('android');
|
||||
|
||||
// if there are resource-file elements in config.xml
|
||||
if (files.length === 0) {
|
||||
events.emit('verbose', 'This app does not have additional resource files defined');
|
||||
return;
|
||||
}
|
||||
|
||||
var resourceMap = {};
|
||||
files.forEach(function(res) {
|
||||
var targetPath = path.join(platformDir, res.target);
|
||||
resourceMap[targetPath] = res.src;
|
||||
});
|
||||
|
||||
events.emit('verbose', 'Updating resource files at ' + platformDir);
|
||||
FileUpdater.updatePaths(
|
||||
resourceMap, { rootDir: cordovaProject.root }, logFileOp);
|
||||
}
|
||||
|
||||
|
||||
function cleanFileResources(projectRoot, projectConfig, platformDir) {
|
||||
var files = projectConfig.getFileResources('android');
|
||||
if (files.length > 0) {
|
||||
events.emit('verbose', 'Cleaning resource files at ' + platformDir);
|
||||
|
||||
var resourceMap = {};
|
||||
files.forEach(function(res) {
|
||||
var filePath = path.join(platformDir, res.target);
|
||||
resourceMap[filePath] = null;
|
||||
});
|
||||
|
||||
FileUpdater.updatePaths(
|
||||
resourceMap, { rootDir: projectRoot, all: true}, logFileOp);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets and validates 'AndroidLaunchMode' prepference from config.xml. Returns
|
||||
* preference value and warns if it doesn't seems to be valid
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
*/
|
||||
|
||||
// Coho updates this line:
|
||||
var VERSION = "5.2.2";
|
||||
var VERSION = "6.2.3";
|
||||
|
||||
module.exports.version = VERSION;
|
||||
|
||||
|
||||
@@ -28,6 +28,13 @@ public class __ACTIVITY__ extends CordovaActivity
|
||||
public void onCreate(Bundle savedInstanceState)
|
||||
{
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
// enable Cordova apps to be started in the background
|
||||
Bundle extras = getIntent().getExtras();
|
||||
if (extras != null && extras.getBoolean("cdvStartInBackground", false)) {
|
||||
moveTaskToBack(true);
|
||||
}
|
||||
|
||||
// Set by <content src="index.html" /> in config.xml
|
||||
loadUrl(launchUrl);
|
||||
}
|
||||
|
||||
@@ -30,7 +30,7 @@
|
||||
|
||||
<uses-permission android:name="android.permission.INTERNET" />
|
||||
|
||||
<application android:icon="@drawable/icon" android:label="@string/app_name"
|
||||
<application android:icon="@mipmap/icon" android:label="@string/app_name"
|
||||
android:hardwareAccelerated="true" android:supportsRtl="true">
|
||||
<activity android:name="__ACTIVITY__"
|
||||
android:label="@string/activity_name"
|
||||
@@ -45,5 +45,5 @@
|
||||
</activity>
|
||||
</application>
|
||||
|
||||
<uses-sdk android:minSdkVersion="14" android:targetSdkVersion="__APILEVEL__"/>
|
||||
<uses-sdk android:minSdkVersion="16" android:targetSdkVersion="__APILEVEL__"/>
|
||||
</manifest>
|
||||
|
||||
99
bin/templates/project/assets/www/cordova.js
vendored
@@ -1,5 +1,5 @@
|
||||
// Platform: android
|
||||
// d403ce434788ffe1937711d6ebcbcc837fcbcb14
|
||||
// 7ef9f9c03167a4dde4372d869472241b6816fee9
|
||||
/*
|
||||
Licensed to the Apache Software Foundation (ASF) under one
|
||||
or more contributor license agreements. See the NOTICE file
|
||||
@@ -19,7 +19,7 @@
|
||||
under the License.
|
||||
*/
|
||||
;(function() {
|
||||
var PLATFORM_VERSION_BUILD_LABEL = '5.2.2';
|
||||
var PLATFORM_VERSION_BUILD_LABEL = '6.2.3';
|
||||
// file: src/scripts/require.js
|
||||
|
||||
/*jshint -W079 */
|
||||
@@ -330,7 +330,7 @@ module.exports = cordova;
|
||||
|
||||
});
|
||||
|
||||
// file: /Users/steveng/repo/cordova/cordova-android/cordova-js-src/android/nativeapiprovider.js
|
||||
// file: /Users/maj/src/cordova-android/cordova-js-src/android/nativeapiprovider.js
|
||||
define("cordova/android/nativeapiprovider", function(require, exports, module) {
|
||||
|
||||
/**
|
||||
@@ -353,7 +353,7 @@ module.exports = {
|
||||
|
||||
});
|
||||
|
||||
// file: /Users/steveng/repo/cordova/cordova-android/cordova-js-src/android/promptbasednativeapi.js
|
||||
// file: /Users/maj/src/cordova-android/cordova-js-src/android/promptbasednativeapi.js
|
||||
define("cordova/android/promptbasednativeapi", function(require, exports, module) {
|
||||
|
||||
/**
|
||||
@@ -742,8 +742,13 @@ var Channel = function(type, sticky) {
|
||||
}
|
||||
};
|
||||
|
||||
function forceFunction(f) {
|
||||
if (typeof f != 'function') throw "Function required as first argument!";
|
||||
function checkSubscriptionArgument(argument) {
|
||||
if (typeof argument !== "function" && typeof argument.handleEvent !== "function") {
|
||||
throw new Error(
|
||||
"Must provide a function or an EventListener object " +
|
||||
"implementing the handleEvent interface."
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -753,28 +758,39 @@ function forceFunction(f) {
|
||||
* and a guid that can be used to stop subscribing to the channel.
|
||||
* Returns the guid.
|
||||
*/
|
||||
Channel.prototype.subscribe = function(f, c) {
|
||||
// need a function to call
|
||||
forceFunction(f);
|
||||
Channel.prototype.subscribe = function(eventListenerOrFunction, eventListener) {
|
||||
checkSubscriptionArgument(eventListenerOrFunction);
|
||||
var handleEvent, guid;
|
||||
|
||||
if (eventListenerOrFunction && typeof eventListenerOrFunction === "object") {
|
||||
// Received an EventListener object implementing the handleEvent interface
|
||||
handleEvent = eventListenerOrFunction.handleEvent;
|
||||
eventListener = eventListenerOrFunction;
|
||||
} else {
|
||||
// Received a function to handle event
|
||||
handleEvent = eventListenerOrFunction;
|
||||
}
|
||||
|
||||
if (this.state == 2) {
|
||||
f.apply(c || this, this.fireArgs);
|
||||
handleEvent.apply(eventListener || this, this.fireArgs);
|
||||
return;
|
||||
}
|
||||
|
||||
var func = f,
|
||||
guid = f.observer_guid;
|
||||
if (typeof c == "object") { func = utils.close(c, f); }
|
||||
guid = eventListenerOrFunction.observer_guid;
|
||||
if (typeof eventListener === "object") {
|
||||
handleEvent = utils.close(eventListener, handleEvent);
|
||||
}
|
||||
|
||||
if (!guid) {
|
||||
// first time any channel has seen this subscriber
|
||||
// First time any channel has seen this subscriber
|
||||
guid = '' + nextGuid++;
|
||||
}
|
||||
func.observer_guid = guid;
|
||||
f.observer_guid = guid;
|
||||
handleEvent.observer_guid = guid;
|
||||
eventListenerOrFunction.observer_guid = guid;
|
||||
|
||||
// Don't add the same handler more than once.
|
||||
if (!this.handlers[guid]) {
|
||||
this.handlers[guid] = func;
|
||||
this.handlers[guid] = handleEvent;
|
||||
this.numHandlers++;
|
||||
if (this.numHandlers == 1) {
|
||||
this.onHasSubscribersChange && this.onHasSubscribersChange();
|
||||
@@ -785,12 +801,20 @@ Channel.prototype.subscribe = function(f, c) {
|
||||
/**
|
||||
* Unsubscribes the function with the given guid from the channel.
|
||||
*/
|
||||
Channel.prototype.unsubscribe = function(f) {
|
||||
// need a function to unsubscribe
|
||||
forceFunction(f);
|
||||
Channel.prototype.unsubscribe = function(eventListenerOrFunction) {
|
||||
checkSubscriptionArgument(eventListenerOrFunction);
|
||||
var handleEvent, guid, handler;
|
||||
|
||||
var guid = f.observer_guid,
|
||||
handler = this.handlers[guid];
|
||||
if (eventListenerOrFunction && typeof eventListenerOrFunction === "object") {
|
||||
// Received an EventListener object implementing the handleEvent interface
|
||||
handleEvent = eventListenerOrFunction.handleEvent;
|
||||
} else {
|
||||
// Received a function to handle event
|
||||
handleEvent = eventListenerOrFunction;
|
||||
}
|
||||
|
||||
guid = handleEvent.observer_guid;
|
||||
handler = this.handlers[guid];
|
||||
if (handler) {
|
||||
delete this.handlers[guid];
|
||||
this.numHandlers--;
|
||||
@@ -862,7 +886,7 @@ module.exports = channel;
|
||||
|
||||
});
|
||||
|
||||
// file: /Users/steveng/repo/cordova/cordova-android/cordova-js-src/exec.js
|
||||
// file: /Users/maj/src/cordova-android/cordova-js-src/exec.js
|
||||
define("cordova/exec", function(require, exports, module) {
|
||||
|
||||
/**
|
||||
@@ -897,10 +921,11 @@ var cordova = require('cordova'),
|
||||
// For the ONLINE_EVENT to be viable, it would need to intercept all event
|
||||
// listeners (both through addEventListener and window.ononline) as well
|
||||
// as set the navigator property itself.
|
||||
ONLINE_EVENT: 2
|
||||
ONLINE_EVENT: 2,
|
||||
EVAL_BRIDGE: 3
|
||||
},
|
||||
jsToNativeBridgeMode, // Set lazily.
|
||||
nativeToJsBridgeMode = nativeToJsModes.ONLINE_EVENT,
|
||||
nativeToJsBridgeMode = nativeToJsModes.EVAL_BRIDGE,
|
||||
pollEnabled = false,
|
||||
bridgeSecret = -1;
|
||||
|
||||
@@ -923,6 +948,9 @@ function androidExec(success, fail, service, action, args) {
|
||||
androidExec.setJsToNativeBridgeMode(jsToNativeModes.JS_OBJECT);
|
||||
}
|
||||
|
||||
// If args is not provided, default to an empty array
|
||||
args = args || [];
|
||||
|
||||
// Process any ArrayBuffers in the args into a string.
|
||||
for (var i = 0; i < args.length; i++) {
|
||||
if (utils.typeName(args[i]) == 'ArrayBuffer') {
|
||||
@@ -932,7 +960,6 @@ function androidExec(success, fail, service, action, args) {
|
||||
|
||||
var callbackId = service + cordova.callbackId++,
|
||||
argsJson = JSON.stringify(args);
|
||||
|
||||
if (success || fail) {
|
||||
cordova.callbacks[callbackId] = {success:success, fail:fail};
|
||||
}
|
||||
@@ -952,6 +979,17 @@ function androidExec(success, fail, service, action, args) {
|
||||
}
|
||||
|
||||
androidExec.init = function() {
|
||||
//CB-11828
|
||||
//This failsafe checks the version of Android and if it's Jellybean, it switches it to
|
||||
//using the Online Event bridge for communicating from Native to JS
|
||||
//
|
||||
//It's ugly, but it's necessary.
|
||||
var check = navigator.userAgent.toLowerCase().match(/android\s[0-9].[0-9]/);
|
||||
var version_code = check && check[0].match(/4.[0-3].*/);
|
||||
if (version_code != null && nativeToJsBridgeMode == nativeToJsModes.EVAL_BRIDGE) {
|
||||
nativeToJsBridgeMode = nativeToJsModes.ONLINE_EVENT;
|
||||
}
|
||||
|
||||
bridgeSecret = +prompt('', 'gap_init:' + nativeToJsBridgeMode);
|
||||
channel.onNativeReady.fire();
|
||||
};
|
||||
@@ -1611,7 +1649,7 @@ exports.reset();
|
||||
|
||||
});
|
||||
|
||||
// file: /Users/steveng/repo/cordova/cordova-android/cordova-js-src/platform.js
|
||||
// file: /Users/maj/src/cordova-android/cordova-js-src/platform.js
|
||||
define("cordova/platform", function(require, exports, module) {
|
||||
|
||||
// The last resume event that was received that had the result of a plugin call.
|
||||
@@ -1721,7 +1759,7 @@ function onMessageFromNative(msg) {
|
||||
|
||||
});
|
||||
|
||||
// file: /Users/steveng/repo/cordova/cordova-android/cordova-js-src/plugin/android/app.js
|
||||
// file: /Users/maj/src/cordova-android/cordova-js-src/plugin/android/app.js
|
||||
define("cordova/plugin/android/app", function(require, exports, module) {
|
||||
|
||||
var exec = require('cordova/exec');
|
||||
@@ -2083,7 +2121,10 @@ utils.clone = function(obj) {
|
||||
|
||||
retVal = {};
|
||||
for(i in obj){
|
||||
if((!(i in retVal) || retVal[i] != obj[i]) && typeof obj[i] != 'undefined') {
|
||||
// https://issues.apache.org/jira/browse/CB-11522 'unknown' type may be returned in
|
||||
// custom protocol activation case on Windows Phone 8.1 causing "No such interface supported" exception
|
||||
// on cloning.
|
||||
if((!(i in retVal) || retVal[i] != obj[i]) && typeof obj[i] != 'undefined' && typeof obj[i] != 'unknown') {
|
||||
retVal[i] = utils.clone(obj[i]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -30,7 +30,7 @@ buildscript {
|
||||
// http://tools.android.com/tech-docs/new-build-system/version-compatibility
|
||||
// and https://issues.apache.org/jira/browse/CB-8143
|
||||
dependencies {
|
||||
classpath 'com.android.tools.build:gradle:2.1.0'
|
||||
classpath 'com.android.tools.build:gradle:2.2.3'
|
||||
}
|
||||
}
|
||||
|
||||
@@ -43,7 +43,7 @@ allprojects {
|
||||
}
|
||||
|
||||
task wrapper(type: Wrapper) {
|
||||
gradleVersion = '2.13'
|
||||
gradleVersion = '2.14.1'
|
||||
}
|
||||
|
||||
// Configuration properties. Set these via environment variables, build-extras.gradle, or gradle.properties.
|
||||
@@ -164,7 +164,7 @@ android {
|
||||
}
|
||||
|
||||
defaultConfig {
|
||||
versionCode cdvVersionCode ?: Integer.parseInt("" + privateHelpers.extractIntFromManifest("versionCode"))
|
||||
versionCode cdvVersionCode ?: new BigInteger("" + privateHelpers.extractIntFromManifest("versionCode"))
|
||||
applicationId privateHelpers.extractStringFromManifest("package")
|
||||
|
||||
if (cdvMinSdkVersion != null) {
|
||||
@@ -264,7 +264,7 @@ def promptForReleaseKeyPassword() {
|
||||
|
||||
gradle.taskGraph.whenReady { taskGraph ->
|
||||
taskGraph.getAllTasks().each() { task ->
|
||||
if (task.name == 'validateReleaseSigning') {
|
||||
if (task.name == 'validateReleaseSigning' || task.name == 'validateSigningRelease') {
|
||||
promptForReleaseKeyPassword()
|
||||
}
|
||||
}
|
||||
|
||||
BIN
bin/templates/project/res/drawable-land-xxhdpi/screen.png
Normal file
|
After Width: | Height: | Size: 1.1 MiB |
BIN
bin/templates/project/res/drawable-land-xxxhdpi/screen.png
Normal file
|
After Width: | Height: | Size: 1.4 MiB |
BIN
bin/templates/project/res/drawable-port-xxhdpi/screen.png
Normal file
|
After Width: | Height: | Size: 1.1 MiB |
BIN
bin/templates/project/res/drawable-port-xxxhdpi/screen.png
Normal file
|
After Width: | Height: | Size: 1.5 MiB |
|
Before Width: | Height: | Size: 5.9 KiB After Width: | Height: | Size: 5.9 KiB |
|
Before Width: | Height: | Size: 3.0 KiB After Width: | Height: | Size: 3.0 KiB |
|
Before Width: | Height: | Size: 4.0 KiB After Width: | Height: | Size: 4.0 KiB |
|
Before Width: | Height: | Size: 7.5 KiB After Width: | Height: | Size: 7.5 KiB |
BIN
bin/templates/project/res/mipmap-xxhdpi/icon.png
Normal file
|
After Width: | Height: | Size: 14 KiB |
BIN
bin/templates/project/res/mipmap-xxxhdpi/icon.png
Normal file
|
After Width: | Height: | Size: 18 KiB |
1
bin/templates/project/wrapper.gradle
Normal file
@@ -0,0 +1 @@
|
||||
//This file is intentionally just a comment
|
||||
20
cordova-js-src/exec.js
vendored
@@ -51,10 +51,11 @@ var cordova = require('cordova'),
|
||||
// For the ONLINE_EVENT to be viable, it would need to intercept all event
|
||||
// listeners (both through addEventListener and window.ononline) as well
|
||||
// as set the navigator property itself.
|
||||
ONLINE_EVENT: 2
|
||||
ONLINE_EVENT: 2,
|
||||
EVAL_BRIDGE: 3
|
||||
},
|
||||
jsToNativeBridgeMode, // Set lazily.
|
||||
nativeToJsBridgeMode = nativeToJsModes.ONLINE_EVENT,
|
||||
nativeToJsBridgeMode = nativeToJsModes.EVAL_BRIDGE,
|
||||
pollEnabled = false,
|
||||
bridgeSecret = -1;
|
||||
|
||||
@@ -77,6 +78,9 @@ function androidExec(success, fail, service, action, args) {
|
||||
androidExec.setJsToNativeBridgeMode(jsToNativeModes.JS_OBJECT);
|
||||
}
|
||||
|
||||
// If args is not provided, default to an empty array
|
||||
args = args || [];
|
||||
|
||||
// Process any ArrayBuffers in the args into a string.
|
||||
for (var i = 0; i < args.length; i++) {
|
||||
if (utils.typeName(args[i]) == 'ArrayBuffer') {
|
||||
@@ -86,7 +90,6 @@ function androidExec(success, fail, service, action, args) {
|
||||
|
||||
var callbackId = service + cordova.callbackId++,
|
||||
argsJson = JSON.stringify(args);
|
||||
|
||||
if (success || fail) {
|
||||
cordova.callbacks[callbackId] = {success:success, fail:fail};
|
||||
}
|
||||
@@ -106,6 +109,17 @@ function androidExec(success, fail, service, action, args) {
|
||||
}
|
||||
|
||||
androidExec.init = function() {
|
||||
//CB-11828
|
||||
//This failsafe checks the version of Android and if it's Jellybean, it switches it to
|
||||
//using the Online Event bridge for communicating from Native to JS
|
||||
//
|
||||
//It's ugly, but it's necessary.
|
||||
var check = navigator.userAgent.toLowerCase().match(/android\s[0-9].[0-9]/);
|
||||
var version_code = check && check[0].match(/4.[0-3].*/);
|
||||
if (version_code != null && nativeToJsBridgeMode == nativeToJsModes.EVAL_BRIDGE) {
|
||||
nativeToJsBridgeMode = nativeToJsModes.ONLINE_EVENT;
|
||||
}
|
||||
|
||||
bridgeSecret = +prompt('', 'gap_init:' + nativeToJsBridgeMode);
|
||||
channel.onNativeReady.fire();
|
||||
};
|
||||
|
||||
@@ -16,27 +16,32 @@
|
||||
under the License.
|
||||
*/
|
||||
|
||||
|
||||
|
||||
buildscript {
|
||||
repositories {
|
||||
mavenCentral()
|
||||
}
|
||||
|
||||
dependencies {
|
||||
classpath 'com.android.tools.build:gradle:2.1.0'
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
apply plugin: 'com.android.library'
|
||||
|
||||
ext {
|
||||
apply from: 'cordova.gradle'
|
||||
cdvCompileSdkVersion = privateHelpers.getProjectTarget()
|
||||
cdvBuildToolsVersion = privateHelpers.findLatestInstalledBuildTools()
|
||||
}
|
||||
|
||||
buildscript {
|
||||
repositories {
|
||||
mavenCentral()
|
||||
jcenter()
|
||||
}
|
||||
|
||||
dependencies {
|
||||
classpath 'com.android.tools.build:gradle:2.2.3'
|
||||
classpath 'com.github.dcendents:android-maven-gradle-plugin:1.5'
|
||||
classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.7.3'
|
||||
}
|
||||
}
|
||||
|
||||
apply plugin: 'com.android.library'
|
||||
apply plugin: 'com.github.dcendents.android-maven'
|
||||
apply plugin: 'com.jfrog.bintray'
|
||||
|
||||
group = 'org.apache.cordova'
|
||||
version = '6.2.3'
|
||||
|
||||
android {
|
||||
compileSdkVersion cdvCompileSdkVersion
|
||||
buildToolsVersion cdvBuildToolsVersion
|
||||
@@ -58,4 +63,73 @@ android {
|
||||
assets.srcDirs = ['assets']
|
||||
}
|
||||
}
|
||||
|
||||
packagingOptions {
|
||||
exclude 'META-INF/LICENSE'
|
||||
exclude 'META-INF/LICENSE.txt'
|
||||
exclude 'META-INF/DEPENDENCIES'
|
||||
exclude 'META-INF/NOTICE'
|
||||
}
|
||||
}
|
||||
|
||||
install {
|
||||
repositories.mavenInstaller {
|
||||
pom {
|
||||
project {
|
||||
packaging 'aar'
|
||||
name 'Cordova'
|
||||
url 'https://cordova.apache.org'
|
||||
licenses {
|
||||
license {
|
||||
name 'The Apache Software License, Version 2.0'
|
||||
url 'http://www.apache.org/licenses/LICENSE-2.0.txt'
|
||||
}
|
||||
}
|
||||
developers {
|
||||
developer {
|
||||
id 'stevengill'
|
||||
name 'Steve Gill'
|
||||
}
|
||||
}
|
||||
scm {
|
||||
connection 'https://git-wip-us.apache.org/repos/asf?p=cordova-android.git'
|
||||
developerConnection 'https://git-wip-us.apache.org/repos/asf?p=cordova-android.git'
|
||||
url 'https://git-wip-us.apache.org/repos/asf?p=cordova-android'
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
task sourcesJar(type: Jar) {
|
||||
from android.sourceSets.main.java.srcDirs
|
||||
classifier = 'sources'
|
||||
}
|
||||
|
||||
artifacts {
|
||||
archives sourcesJar
|
||||
}
|
||||
|
||||
bintray {
|
||||
user = System.getenv('BINTRAY_USER')
|
||||
key = System.getenv('BINTRAY_KEY')
|
||||
configurations = ['archives']
|
||||
pkg {
|
||||
repo = 'maven'
|
||||
name = 'cordova-android'
|
||||
userOrg = 'cordova'
|
||||
licenses = ['Apache-2.0']
|
||||
vcsUrl = 'https://git-wip-us.apache.org/repos/asf?p=cordova-android.git'
|
||||
websiteUrl = 'https://cordova.apache.org'
|
||||
issueTrackerUrl = 'https://issues.apache.org/jira/browse/CB'
|
||||
publicDownloadNumbers = true
|
||||
licenses = ['Apache-2.0']
|
||||
labels = ['android', 'cordova', 'phonegap']
|
||||
version {
|
||||
name = '6.2.3'
|
||||
released = new Date()
|
||||
vcsTag = '6.2.3'
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -125,7 +125,7 @@ def doExtractIntFromManifest(name) {
|
||||
def pattern = Pattern.compile(name + "=\"(\\d+)\"")
|
||||
def matcher = pattern.matcher(manifestFile.getText())
|
||||
matcher.find()
|
||||
return Integer.parseInt(matcher.group(1))
|
||||
return new BigInteger(matcher.group(1))
|
||||
}
|
||||
|
||||
def doExtractStringFromManifest(name) {
|
||||
|
||||
6
framework/gradle/wrapper/gradle-wrapper.properties
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
#Mon Dec 28 10:00:20 PST 2015
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-2.14.1-all.zip
|
||||
@@ -10,7 +10,7 @@
|
||||
# Indicates whether an apk should be generated for each density.
|
||||
split.density=false
|
||||
# Project target.
|
||||
target=android-23
|
||||
target=android-25
|
||||
apk-configurations=
|
||||
renderscript.opt.level=O0
|
||||
android.library=true
|
||||
|
||||
@@ -20,8 +20,6 @@ package org.apache.cordova;
|
||||
|
||||
import org.json.JSONArray;
|
||||
|
||||
import android.util.Log;
|
||||
|
||||
import org.apache.cordova.CordovaWebView;
|
||||
import org.apache.cordova.PluginResult;
|
||||
import org.json.JSONObject;
|
||||
@@ -38,15 +36,15 @@ public class CallbackContext {
|
||||
this.callbackId = callbackId;
|
||||
this.webView = webView;
|
||||
}
|
||||
|
||||
|
||||
public boolean isFinished() {
|
||||
return finished;
|
||||
}
|
||||
|
||||
|
||||
public boolean isChangingThreads() {
|
||||
return changingThreads > 0;
|
||||
}
|
||||
|
||||
|
||||
public String getCallbackId() {
|
||||
return callbackId;
|
||||
}
|
||||
@@ -54,7 +52,7 @@ public class CallbackContext {
|
||||
public void sendPluginResult(PluginResult pluginResult) {
|
||||
synchronized (this) {
|
||||
if (finished) {
|
||||
Log.w(LOG_TAG, "Attempted to send a second callback for ID: " + callbackId + "\nResult was: " + pluginResult.getMessage());
|
||||
LOG.w(LOG_TAG, "Attempted to send a second callback for ID: " + callbackId + "\nResult was: " + pluginResult.getMessage());
|
||||
return;
|
||||
} else {
|
||||
finished = !pluginResult.getKeepCallback();
|
||||
@@ -98,7 +96,7 @@ public class CallbackContext {
|
||||
public void success(byte[] message) {
|
||||
sendPluginResult(new PluginResult(PluginResult.Status.OK, message));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Helper for success callbacks that just returns the Status.OK by default
|
||||
*
|
||||
|
||||
@@ -22,7 +22,6 @@ package org.apache.cordova;
|
||||
import java.util.List;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.util.Log;
|
||||
|
||||
@Deprecated // Use Whitelist, CordovaPrefences, etc. directly.
|
||||
public class Config {
|
||||
@@ -61,7 +60,7 @@ public class Config {
|
||||
public static List<PluginEntry> getPluginEntries() {
|
||||
return parser.getPluginEntries();
|
||||
}
|
||||
|
||||
|
||||
public static CordovaPreferences getPreferences() {
|
||||
return parser.getPreferences();
|
||||
}
|
||||
|
||||
@@ -34,7 +34,6 @@ import android.graphics.Color;
|
||||
import android.media.AudioManager;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.util.Log;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
@@ -50,7 +49,7 @@ import android.widget.FrameLayout;
|
||||
* html file that contains the application.
|
||||
*
|
||||
* As an example:
|
||||
*
|
||||
*
|
||||
* <pre>
|
||||
* package org.apache.cordova.examples;
|
||||
*
|
||||
@@ -67,8 +66,8 @@ import android.widget.FrameLayout;
|
||||
* }
|
||||
* }
|
||||
* </pre>
|
||||
*
|
||||
* Cordova xml configuration: Cordova uses a configuration file at
|
||||
*
|
||||
* Cordova xml configuration: Cordova uses a configuration file at
|
||||
* res/xml/config.xml to specify its settings. See "The config.xml File"
|
||||
* guide in cordova-docs at http://cordova.apache.org/docs for the documentation
|
||||
* for the configuration. The use of the set*Property() methods is
|
||||
@@ -104,21 +103,27 @@ public class CordovaActivity extends Activity {
|
||||
*/
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
// need to activate preferences before super.onCreate to avoid "requestFeature() must be called before adding content" exception
|
||||
loadConfig();
|
||||
|
||||
String logLevel = preferences.getString("loglevel", "ERROR");
|
||||
LOG.setLogLevel(logLevel);
|
||||
|
||||
LOG.i(TAG, "Apache Cordova native platform version " + CordovaWebView.CORDOVA_VERSION + " is starting");
|
||||
LOG.d(TAG, "CordovaActivity.onCreate()");
|
||||
|
||||
// need to activate preferences before super.onCreate to avoid "requestFeature() must be called before adding content" exception
|
||||
loadConfig();
|
||||
if (!preferences.getBoolean("ShowTitle", false)) {
|
||||
getWindow().requestFeature(Window.FEATURE_NO_TITLE);
|
||||
}
|
||||
|
||||
if (preferences.getBoolean("SetFullscreen", false)) {
|
||||
Log.d(TAG, "The SetFullscreen configuration is deprecated in favor of Fullscreen, and will be removed in a future version.");
|
||||
LOG.d(TAG, "The SetFullscreen configuration is deprecated in favor of Fullscreen, and will be removed in a future version.");
|
||||
preferences.set("Fullscreen", true);
|
||||
}
|
||||
if (preferences.getBoolean("Fullscreen", false)) {
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
|
||||
// NOTE: use the FullscreenNotImmersive configuration key to set the activity in a REAL full screen
|
||||
// (as was the case in previous cordova versions)
|
||||
if ((Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) && !preferences.getBoolean("FullscreenNotImmersive", false)) {
|
||||
immersiveMode = true;
|
||||
} else {
|
||||
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
|
||||
@@ -175,9 +180,14 @@ public class CordovaActivity extends Activity {
|
||||
setContentView(appView.getView());
|
||||
|
||||
if (preferences.contains("BackgroundColor")) {
|
||||
int backgroundColor = preferences.getInteger("BackgroundColor", Color.BLACK);
|
||||
// Background of activity:
|
||||
appView.getView().setBackgroundColor(backgroundColor);
|
||||
try {
|
||||
int backgroundColor = preferences.getInteger("BackgroundColor", Color.BLACK);
|
||||
// Background of activity:
|
||||
appView.getView().setBackgroundColor(backgroundColor);
|
||||
}
|
||||
catch (NumberFormatException e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
appView.getView().requestFocusFromTouch();
|
||||
|
||||
@@ -23,8 +23,6 @@ import java.security.SecureRandom;
|
||||
import org.json.JSONArray;
|
||||
import org.json.JSONException;
|
||||
|
||||
import android.util.Log;
|
||||
|
||||
/**
|
||||
* Contains APIs that the JS can call. All functions in here should also have
|
||||
* an equivalent entry in CordovaChromeClient.java, and be added to
|
||||
@@ -87,15 +85,15 @@ public class CordovaBridge {
|
||||
private boolean verifySecret(String action, int bridgeSecret) throws IllegalAccessException {
|
||||
if (!jsMessageQueue.isBridgeEnabled()) {
|
||||
if (bridgeSecret == -1) {
|
||||
Log.d(LOG_TAG, action + " call made before bridge was enabled.");
|
||||
LOG.d(LOG_TAG, action + " call made before bridge was enabled.");
|
||||
} else {
|
||||
Log.d(LOG_TAG, "Ignoring " + action + " from previous page load.");
|
||||
LOG.d(LOG_TAG, "Ignoring " + action + " from previous page load.");
|
||||
}
|
||||
return false;
|
||||
}
|
||||
// Bridge secret wrong and bridge not due to it being from the previous page.
|
||||
if (expectedBridgeSecret < 0 || bridgeSecret != expectedBridgeSecret) {
|
||||
Log.e(LOG_TAG, "Bridge access attempt with wrong secret token, possibly from malicious code. Disabling exec() bridge!");
|
||||
LOG.e(LOG_TAG, "Bridge access attempt with wrong secret token, possibly from malicious code. Disabling exec() bridge!");
|
||||
clearBridgeSecret();
|
||||
throw new IllegalAccessException();
|
||||
}
|
||||
@@ -120,7 +118,7 @@ public class CordovaBridge {
|
||||
|
||||
public void reset() {
|
||||
jsMessageQueue.reset();
|
||||
clearBridgeSecret();
|
||||
clearBridgeSecret();
|
||||
}
|
||||
|
||||
public String promptOnJsPrompt(String origin, String message, String defaultValue) {
|
||||
@@ -141,7 +139,7 @@ public class CordovaBridge {
|
||||
}
|
||||
return "";
|
||||
}
|
||||
// Sets the native->JS bridge mode.
|
||||
// Sets the native->JS bridge mode.
|
||||
else if (defaultValue != null && defaultValue.startsWith("gap_bridge_mode:")) {
|
||||
try {
|
||||
int bridgeSecret = Integer.parseInt(defaultValue.substring(16));
|
||||
@@ -153,7 +151,7 @@ public class CordovaBridge {
|
||||
}
|
||||
return "";
|
||||
}
|
||||
// Polling for JavaScript messages
|
||||
// Polling for JavaScript messages
|
||||
else if (defaultValue != null && defaultValue.startsWith("gap_poll:")) {
|
||||
int bridgeSecret = Integer.parseInt(defaultValue.substring(9));
|
||||
try {
|
||||
@@ -175,7 +173,7 @@ public class CordovaBridge {
|
||||
int secret = generateBridgeSecret();
|
||||
return ""+secret;
|
||||
} else {
|
||||
Log.e(LOG_TAG, "gap_init called from restricted origin: " + origin);
|
||||
LOG.e(LOG_TAG, "gap_init called from restricted origin: " + origin);
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
@@ -24,7 +24,6 @@ import android.content.Intent;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.util.Log;
|
||||
import android.util.Pair;
|
||||
|
||||
import org.json.JSONException;
|
||||
@@ -147,13 +146,13 @@ public class CordovaInterfaceImpl implements CordovaInterface {
|
||||
activityResultCallback = null;
|
||||
|
||||
if (callback != null) {
|
||||
Log.d(TAG, "Sending activity result to plugin");
|
||||
LOG.d(TAG, "Sending activity result to plugin");
|
||||
initCallbackService = null;
|
||||
savedResult = null;
|
||||
callback.onActivityResult(requestCode, resultCode, intent);
|
||||
return true;
|
||||
}
|
||||
Log.w(TAG, "Got an activity result, but no plugin was registered to receive it" + (savedResult != null ? " yet!" : "."));
|
||||
LOG.w(TAG, "Got an activity result, but no plugin was registered to receive it" + (savedResult != null ? " yet!" : "."));
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -31,7 +31,7 @@ import android.webkit.WebChromeClient.CustomViewCallback;
|
||||
* are not expected to implement it.
|
||||
*/
|
||||
public interface CordovaWebView {
|
||||
public static final String CORDOVA_VERSION = "5.2.2";
|
||||
public static final String CORDOVA_VERSION = "6.2.3";
|
||||
|
||||
void init(CordovaInterface cordova, List<PluginEntry> pluginEntries, CordovaPreferences preferences);
|
||||
|
||||
|
||||
@@ -20,6 +20,7 @@ package org.apache.cordova;
|
||||
|
||||
import android.view.KeyEvent;
|
||||
import android.view.View;
|
||||
import android.webkit.ValueCallback;
|
||||
|
||||
/**
|
||||
* Interface for all Cordova engines.
|
||||
@@ -58,6 +59,9 @@ public interface CordovaWebViewEngine {
|
||||
/** Clean up all resources associated with the WebView. */
|
||||
void destroy();
|
||||
|
||||
/** Add the evaulate Javascript method **/
|
||||
void evaluateJavascript(String js, ValueCallback<String> callback);
|
||||
|
||||
/**
|
||||
* Used to retrieve the associated CordovaWebView given a View without knowing the type of Engine.
|
||||
* E.g. ((CordovaWebView.EngineView)activity.findViewById(android.R.id.webView)).getCordovaWebView();
|
||||
|
||||
@@ -21,7 +21,6 @@ package org.apache.cordova;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.net.Uri;
|
||||
import android.util.Log;
|
||||
import android.view.Gravity;
|
||||
import android.view.KeyEvent;
|
||||
import android.view.View;
|
||||
@@ -245,7 +244,7 @@ public class CordovaWebViewImpl implements CordovaWebView {
|
||||
@Deprecated
|
||||
public void showCustomView(View view, WebChromeClient.CustomViewCallback callback) {
|
||||
// This code is adapted from the original Android Browser code, licensed under the Apache License, Version 2.0
|
||||
Log.d(TAG, "showing Custom View");
|
||||
LOG.d(TAG, "showing Custom View");
|
||||
// if a view already exists then immediately terminate the new one
|
||||
if (mCustomView != null) {
|
||||
callback.onCustomViewHidden();
|
||||
@@ -276,7 +275,7 @@ public class CordovaWebViewImpl implements CordovaWebView {
|
||||
public void hideCustomView() {
|
||||
// This code is adapted from the original Android Browser code, licensed under the Apache License, Version 2.0
|
||||
if (mCustomView == null) return;
|
||||
Log.d(TAG, "Hiding Custom View");
|
||||
LOG.d(TAG, "Hiding Custom View");
|
||||
|
||||
// Hide the custom view.
|
||||
mCustomView.setVisibility(View.GONE);
|
||||
|
||||
@@ -30,12 +30,13 @@ import android.content.IntentFilter;
|
||||
import android.telephony.TelephonyManager;
|
||||
import android.view.KeyEvent;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.HashMap;
|
||||
|
||||
/**
|
||||
* This class exposes methods in Cordova that can be called from JavaScript.
|
||||
*/
|
||||
class CoreAndroid extends CordovaPlugin {
|
||||
public class CoreAndroid extends CordovaPlugin {
|
||||
|
||||
public static final String PLUGIN_NAME = "CoreAndroid";
|
||||
protected static final String TAG = "CordovaApp";
|
||||
@@ -357,4 +358,33 @@ class CoreAndroid extends CordovaPlugin {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* This needs to be implemented if you wish to use the Camera Plugin or other plugins
|
||||
* that read the Build Configuration.
|
||||
*
|
||||
* Thanks to Phil@Medtronic and Graham Borland for finding the answer and posting it to
|
||||
* StackOverflow. This is annoying as hell!
|
||||
*
|
||||
*/
|
||||
|
||||
public static Object getBuildConfigValue(Context ctx, String key)
|
||||
{
|
||||
try
|
||||
{
|
||||
Class<?> clazz = Class.forName(ctx.getPackageName() + ".BuildConfig");
|
||||
Field field = clazz.getField(key);
|
||||
return field.get(null);
|
||||
} catch (ClassNotFoundException e) {
|
||||
LOG.d(TAG, "Unable to get the BuildConfig, is this built with ANT?");
|
||||
e.printStackTrace();
|
||||
} catch (NoSuchFieldException e) {
|
||||
LOG.d(TAG, key + " is not a valid field. Check your build.gradle");
|
||||
} catch (IllegalAccessException e) {
|
||||
LOG.d(TAG, "Illegal Access Exception: Let's print a stack trace.");
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -154,6 +154,16 @@ public class LOG {
|
||||
if (LOG.INFO >= LOGLEVEL) Log.i(tag, s, e);
|
||||
}
|
||||
|
||||
/**
|
||||
* Warning log message.
|
||||
*
|
||||
* @param tag
|
||||
* @param e
|
||||
*/
|
||||
public static void w(String tag, Throwable e) {
|
||||
if (LOG.WARN >= LOGLEVEL) Log.w(tag, e);
|
||||
}
|
||||
|
||||
/**
|
||||
* Warning log message.
|
||||
*
|
||||
|
||||
@@ -21,8 +21,6 @@ package org.apache.cordova;
|
||||
import java.util.ArrayList;
|
||||
import java.util.LinkedList;
|
||||
|
||||
import android.util.Log;
|
||||
|
||||
/**
|
||||
* Holds the list of messages to be sent to the WebView.
|
||||
*/
|
||||
@@ -42,13 +40,13 @@ public class NativeToJsMessageQueue {
|
||||
// This currently only chops up on message boundaries. It may be useful
|
||||
// to allow it to break up messages.
|
||||
private static int MAX_PAYLOAD_SIZE = 50 * 1024 * 10240;
|
||||
|
||||
|
||||
/**
|
||||
* When true, the active listener is not fired upon enqueue. When set to false,
|
||||
* the active listener will be fired if the queue is non-empty.
|
||||
* the active listener will be fired if the queue is non-empty.
|
||||
*/
|
||||
private boolean paused;
|
||||
|
||||
|
||||
/**
|
||||
* The list of JavaScript statements to be sent to JavaScript.
|
||||
*/
|
||||
@@ -58,7 +56,7 @@ public class NativeToJsMessageQueue {
|
||||
* The array of listeners that can be used to send messages to JS.
|
||||
*/
|
||||
private ArrayList<BridgeMode> bridgeModes = new ArrayList<BridgeMode>();
|
||||
|
||||
|
||||
/**
|
||||
* When null, the bridge is disabled. This occurs during page transitions.
|
||||
* When disabled, all callbacks are dropped since they are assumed to be
|
||||
@@ -83,11 +81,11 @@ public class NativeToJsMessageQueue {
|
||||
*/
|
||||
public void setBridgeMode(int value) {
|
||||
if (value < -1 || value >= bridgeModes.size()) {
|
||||
Log.d(LOG_TAG, "Invalid NativeToJsBridgeMode: " + value);
|
||||
LOG.d(LOG_TAG, "Invalid NativeToJsBridgeMode: " + value);
|
||||
} else {
|
||||
BridgeMode newMode = value < 0 ? null : bridgeModes.get(value);
|
||||
if (newMode != activeBridgeMode) {
|
||||
Log.d(LOG_TAG, "Set native->JS mode to " + (newMode == null ? "null" : newMode.getClass().getSimpleName()));
|
||||
LOG.d(LOG_TAG, "Set native->JS mode to " + (newMode == null ? "null" : newMode.getClass().getSimpleName()));
|
||||
synchronized (this) {
|
||||
activeBridgeMode = newMode;
|
||||
if (newMode != null) {
|
||||
@@ -100,7 +98,7 @@ public class NativeToJsMessageQueue {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Clears all messages and resets to the default bridge mode.
|
||||
*/
|
||||
@@ -114,16 +112,16 @@ public class NativeToJsMessageQueue {
|
||||
private int calculatePackedMessageLength(JsMessage message) {
|
||||
int messageLen = message.calculateEncodedLength();
|
||||
String messageLenStr = String.valueOf(messageLen);
|
||||
return messageLenStr.length() + messageLen + 1;
|
||||
return messageLenStr.length() + messageLen + 1;
|
||||
}
|
||||
|
||||
|
||||
private void packMessage(JsMessage message, StringBuilder sb) {
|
||||
int len = message.calculateEncodedLength();
|
||||
sb.append(len)
|
||||
.append(' ');
|
||||
message.encodeAsMessage(sb);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Combines and returns queued messages combined into a single string.
|
||||
* Combines as many messages as possible, while staying under MAX_PAYLOAD_SIZE.
|
||||
@@ -154,7 +152,7 @@ public class NativeToJsMessageQueue {
|
||||
JsMessage message = queue.removeFirst();
|
||||
packMessage(message, sb);
|
||||
}
|
||||
|
||||
|
||||
if (!queue.isEmpty()) {
|
||||
// Attach a char to indicate that there are more messages pending.
|
||||
sb.append('*');
|
||||
@@ -163,7 +161,7 @@ public class NativeToJsMessageQueue {
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Same as popAndEncode(), except encodes in a form that can be executed as JS.
|
||||
*/
|
||||
@@ -185,7 +183,7 @@ public class NativeToJsMessageQueue {
|
||||
}
|
||||
boolean willSendAllMessages = numMessagesToSend == queue.size();
|
||||
StringBuilder sb = new StringBuilder(totalPayloadLen + (willSendAllMessages ? 0 : 100));
|
||||
// Wrap each statement in a try/finally so that if one throws it does
|
||||
// Wrap each statement in a try/finally so that if one throws it does
|
||||
// not affect the next.
|
||||
for (int i = 0; i < numMessagesToSend; ++i) {
|
||||
JsMessage message = queue.removeFirst();
|
||||
@@ -206,7 +204,7 @@ public class NativeToJsMessageQueue {
|
||||
String ret = sb.toString();
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a JavaScript statement to the list.
|
||||
@@ -220,7 +218,7 @@ public class NativeToJsMessageQueue {
|
||||
*/
|
||||
public void addPluginResult(PluginResult result, String callbackId) {
|
||||
if (callbackId == null) {
|
||||
Log.e(LOG_TAG, "Got plugin result with no callbackId", new Throwable());
|
||||
LOG.e(LOG_TAG, "Got plugin result with no callbackId", new Throwable());
|
||||
return;
|
||||
}
|
||||
// Don't send anything if there is no result and there is no need to
|
||||
@@ -243,7 +241,7 @@ public class NativeToJsMessageQueue {
|
||||
private void enqueueMessage(JsMessage message) {
|
||||
synchronized (this) {
|
||||
if (activeBridgeMode == null) {
|
||||
Log.d(LOG_TAG, "Dropping Native->JS message due to disabled bridge");
|
||||
LOG.d(LOG_TAG, "Dropping Native->JS message due to disabled bridge");
|
||||
return;
|
||||
}
|
||||
queue.add(message);
|
||||
@@ -257,7 +255,7 @@ public class NativeToJsMessageQueue {
|
||||
if (paused && value) {
|
||||
// This should never happen. If a use-case for it comes up, we should
|
||||
// change pause to be a counter.
|
||||
Log.e(LOG_TAG, "nested call to setPaused detected.", new Throwable());
|
||||
LOG.e(LOG_TAG, "nested call to setPaused detected.", new Throwable());
|
||||
}
|
||||
paused = value;
|
||||
if (!value) {
|
||||
@@ -265,7 +263,7 @@ public class NativeToJsMessageQueue {
|
||||
if (!queue.isEmpty() && activeBridgeMode != null) {
|
||||
activeBridgeMode.onNativeToJsMessageAvailable(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -351,6 +349,31 @@ public class NativeToJsMessageQueue {
|
||||
}
|
||||
}
|
||||
|
||||
/** Uses webView.evaluateJavascript to execute messages. */
|
||||
public static class EvalBridgeMode extends BridgeMode {
|
||||
private final CordovaWebViewEngine engine;
|
||||
private final CordovaInterface cordova;
|
||||
|
||||
public EvalBridgeMode(CordovaWebViewEngine engine, CordovaInterface cordova) {
|
||||
this.engine = engine;
|
||||
this.cordova = cordova;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNativeToJsMessageAvailable(final NativeToJsMessageQueue queue) {
|
||||
cordova.getActivity().runOnUiThread(new Runnable() {
|
||||
public void run() {
|
||||
String js = queue.popAndEncodeAsJs();
|
||||
if (js != null) {
|
||||
engine.evaluateJavascript(js, null);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
private static class JsMessage {
|
||||
final String jsPayloadOrCallbackId;
|
||||
final PluginResult pluginResult;
|
||||
@@ -368,7 +391,7 @@ public class NativeToJsMessageQueue {
|
||||
jsPayloadOrCallbackId = callbackId;
|
||||
this.pluginResult = pluginResult;
|
||||
}
|
||||
|
||||
|
||||
static int calculateEncodedLengthHelper(PluginResult pluginResult) {
|
||||
switch (pluginResult.getMessageType()) {
|
||||
case PluginResult.MESSAGE_TYPE_BOOLEAN: // f or t
|
||||
@@ -395,7 +418,7 @@ public class NativeToJsMessageQueue {
|
||||
return pluginResult.getMessage().length();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
int calculateEncodedLength() {
|
||||
if (pluginResult == null) {
|
||||
return jsPayloadOrCallbackId.length() + 1;
|
||||
@@ -424,7 +447,7 @@ public class NativeToJsMessageQueue {
|
||||
case PluginResult.MESSAGE_TYPE_BINARYSTRING: // S
|
||||
sb.append('S');
|
||||
sb.append(pluginResult.getMessage());
|
||||
break;
|
||||
break;
|
||||
case PluginResult.MESSAGE_TYPE_ARRAYBUFFER: // A
|
||||
sb.append('A');
|
||||
sb.append(pluginResult.getMessage());
|
||||
@@ -443,7 +466,7 @@ public class NativeToJsMessageQueue {
|
||||
sb.append(pluginResult.getMessage()); // [ or {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void encodeAsMessage(StringBuilder sb) {
|
||||
if (pluginResult == null) {
|
||||
sb.append('J')
|
||||
@@ -465,6 +488,34 @@ public class NativeToJsMessageQueue {
|
||||
encodeAsMessageHelper(sb, pluginResult);
|
||||
}
|
||||
|
||||
void buildJsMessage(StringBuilder sb) {
|
||||
switch (pluginResult.getMessageType()) {
|
||||
case PluginResult.MESSAGE_TYPE_MULTIPART:
|
||||
int size = pluginResult.getMultipartMessagesSize();
|
||||
for (int i=0; i<size; i++) {
|
||||
PluginResult subresult = pluginResult.getMultipartMessage(i);
|
||||
JsMessage submessage = new JsMessage(subresult, jsPayloadOrCallbackId);
|
||||
submessage.buildJsMessage(sb);
|
||||
if (i < (size-1)) {
|
||||
sb.append(",");
|
||||
}
|
||||
}
|
||||
break;
|
||||
case PluginResult.MESSAGE_TYPE_BINARYSTRING:
|
||||
sb.append("atob('")
|
||||
.append(pluginResult.getMessage())
|
||||
.append("')");
|
||||
break;
|
||||
case PluginResult.MESSAGE_TYPE_ARRAYBUFFER:
|
||||
sb.append("cordova.require('cordova/base64').toArrayBuffer('")
|
||||
.append(pluginResult.getMessage())
|
||||
.append("')");
|
||||
break;
|
||||
default:
|
||||
sb.append(pluginResult.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
void encodeAsJsMessage(StringBuilder sb) {
|
||||
if (pluginResult == null) {
|
||||
sb.append(jsPayloadOrCallbackId);
|
||||
@@ -472,29 +523,16 @@ public class NativeToJsMessageQueue {
|
||||
int status = pluginResult.getStatus();
|
||||
boolean success = (status == PluginResult.Status.OK.ordinal()) || (status == PluginResult.Status.NO_RESULT.ordinal());
|
||||
sb.append("cordova.callbackFromNative('")
|
||||
.append(jsPayloadOrCallbackId)
|
||||
.append("',")
|
||||
.append(success)
|
||||
.append(",")
|
||||
.append(status)
|
||||
.append(",[");
|
||||
switch (pluginResult.getMessageType()) {
|
||||
case PluginResult.MESSAGE_TYPE_BINARYSTRING:
|
||||
sb.append("atob('")
|
||||
.append(pluginResult.getMessage())
|
||||
.append("')");
|
||||
break;
|
||||
case PluginResult.MESSAGE_TYPE_ARRAYBUFFER:
|
||||
sb.append("cordova.require('cordova/base64').toArrayBuffer('")
|
||||
.append(pluginResult.getMessage())
|
||||
.append("')");
|
||||
break;
|
||||
default:
|
||||
sb.append(pluginResult.getMessage());
|
||||
}
|
||||
.append(jsPayloadOrCallbackId)
|
||||
.append("',")
|
||||
.append(success)
|
||||
.append(",")
|
||||
.append(status)
|
||||
.append(",[");
|
||||
buildJsMessage(sb);
|
||||
sb.append("],")
|
||||
.append(pluginResult.getKeepCallback())
|
||||
.append(");");
|
||||
.append(pluginResult.getKeepCallback())
|
||||
.append(");");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -28,7 +28,6 @@ import android.content.res.Configuration;
|
||||
import android.net.Uri;
|
||||
import android.os.Bundle;
|
||||
import android.os.Debug;
|
||||
import android.util.Log;
|
||||
|
||||
/**
|
||||
* PluginManager is exposed to JavaScript in the Cordova WebView.
|
||||
@@ -122,7 +121,7 @@ public class PluginManager {
|
||||
public void exec(final String service, final String action, final String callbackId, final String rawArgs) {
|
||||
CordovaPlugin plugin = getPlugin(service);
|
||||
if (plugin == null) {
|
||||
Log.d(TAG, "exec() call to unknown plugin: " + service);
|
||||
LOG.d(TAG, "exec() call to unknown plugin: " + service);
|
||||
PluginResult cr = new PluginResult(PluginResult.Status.CLASS_NOT_FOUND_EXCEPTION);
|
||||
app.sendPluginResult(cr, callbackId);
|
||||
return;
|
||||
@@ -134,7 +133,7 @@ public class PluginManager {
|
||||
long duration = System.currentTimeMillis() - pluginStartTime;
|
||||
|
||||
if (duration > SLOW_EXEC_WARNING_THRESHOLD) {
|
||||
Log.w(TAG, "THREAD WARNING: exec() call to " + service + "." + action + " blocked the main thread for " + duration + "ms. Plugin should use CordovaInterface.getThreadPool().");
|
||||
LOG.w(TAG, "THREAD WARNING: exec() call to " + service + "." + action + " blocked the main thread for " + duration + "ms. Plugin should use CordovaInterface.getThreadPool().");
|
||||
}
|
||||
if (!wasValidAction) {
|
||||
PluginResult cr = new PluginResult(PluginResult.Status.INVALID_ACTION);
|
||||
@@ -144,7 +143,7 @@ public class PluginManager {
|
||||
PluginResult cr = new PluginResult(PluginResult.Status.JSON_EXCEPTION);
|
||||
callbackContext.sendPluginResult(cr);
|
||||
} catch (Exception e) {
|
||||
Log.e(TAG, "Uncaught exception from plugin", e);
|
||||
LOG.e(TAG, "Uncaught exception from plugin", e);
|
||||
callbackContext.error(e.getMessage());
|
||||
}
|
||||
}
|
||||
@@ -222,9 +221,9 @@ public class PluginManager {
|
||||
* @param handler The HttpAuthHandler used to set the WebView's response
|
||||
* @param host The host requiring authentication
|
||||
* @param realm The realm for which authentication is required
|
||||
*
|
||||
*
|
||||
* @return Returns True if there is a plugin which will resolve this auth challenge, otherwise False
|
||||
*
|
||||
*
|
||||
*/
|
||||
public boolean onReceivedHttpAuthRequest(CordovaWebView view, ICordovaHttpAuthHandler handler, String host, String realm) {
|
||||
for (CordovaPlugin plugin : this.pluginMap.values()) {
|
||||
@@ -234,7 +233,7 @@ public class PluginManager {
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Called when he system received an SSL client certificate request. Plugin can use
|
||||
* the supplied ClientCertRequest to process this certificate challenge.
|
||||
|
||||
@@ -26,7 +26,6 @@ import android.content.ActivityNotFoundException;
|
||||
import android.content.Intent;
|
||||
import android.net.Uri;
|
||||
import android.os.Build;
|
||||
import android.util.Log;
|
||||
import android.view.Gravity;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup.LayoutParams;
|
||||
@@ -62,7 +61,7 @@ public class SystemWebChromeClient extends WebChromeClient {
|
||||
|
||||
// the video progress view
|
||||
private View mVideoProgressView;
|
||||
|
||||
|
||||
private CordovaDialogsHelper dialogsHelper;
|
||||
private Context appContext;
|
||||
|
||||
@@ -193,7 +192,7 @@ public class SystemWebChromeClient extends WebChromeClient {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
// API level 7 is required for this, see if we could lower this using something else
|
||||
@Override
|
||||
public void onShowCustomView(View view, WebChromeClient.CustomViewCallback callback) {
|
||||
@@ -213,9 +212,9 @@ public class SystemWebChromeClient extends WebChromeClient {
|
||||
*/
|
||||
public View getVideoLoadingProgressView() {
|
||||
|
||||
if (mVideoProgressView == null) {
|
||||
if (mVideoProgressView == null) {
|
||||
// Create a new Loading view programmatically.
|
||||
|
||||
|
||||
// create the linear layout
|
||||
LinearLayout layout = new LinearLayout(parentEngine.getView().getContext());
|
||||
layout.setOrientation(LinearLayout.VERTICAL);
|
||||
@@ -226,12 +225,12 @@ public class SystemWebChromeClient extends WebChromeClient {
|
||||
ProgressBar bar = new ProgressBar(parentEngine.getView().getContext());
|
||||
LinearLayout.LayoutParams barLayoutParams = new LinearLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
|
||||
barLayoutParams.gravity = Gravity.CENTER;
|
||||
bar.setLayoutParams(barLayoutParams);
|
||||
bar.setLayoutParams(barLayoutParams);
|
||||
layout.addView(bar);
|
||||
|
||||
|
||||
mVideoProgressView = layout;
|
||||
}
|
||||
return mVideoProgressView;
|
||||
return mVideoProgressView;
|
||||
}
|
||||
|
||||
// <input type=file> support:
|
||||
@@ -240,11 +239,11 @@ public class SystemWebChromeClient extends WebChromeClient {
|
||||
public void openFileChooser(ValueCallback<Uri> uploadMsg) {
|
||||
this.openFileChooser(uploadMsg, "*/*");
|
||||
}
|
||||
|
||||
|
||||
public void openFileChooser( ValueCallback<Uri> uploadMsg, String acceptType ) {
|
||||
this.openFileChooser(uploadMsg, acceptType, null);
|
||||
}
|
||||
|
||||
|
||||
public void openFileChooser(final ValueCallback<Uri> uploadMsg, String acceptType, String capture)
|
||||
{
|
||||
Intent intent = new Intent(Intent.ACTION_GET_CONTENT);
|
||||
@@ -254,7 +253,7 @@ public class SystemWebChromeClient extends WebChromeClient {
|
||||
@Override
|
||||
public void onActivityResult(int requestCode, int resultCode, Intent intent) {
|
||||
Uri result = intent == null || resultCode != Activity.RESULT_OK ? null : intent.getData();
|
||||
Log.d(LOG_TAG, "Receive file chooser URL: " + result);
|
||||
LOG.d(LOG_TAG, "Receive file chooser URL: " + result);
|
||||
uploadMsg.onReceiveValue(result);
|
||||
}
|
||||
}, intent, FILECHOOSER_RESULTCODE);
|
||||
@@ -269,12 +268,12 @@ public class SystemWebChromeClient extends WebChromeClient {
|
||||
@Override
|
||||
public void onActivityResult(int requestCode, int resultCode, Intent intent) {
|
||||
Uri[] result = WebChromeClient.FileChooserParams.parseResult(resultCode, intent);
|
||||
Log.d(LOG_TAG, "Receive file chooser URL: " + result);
|
||||
LOG.d(LOG_TAG, "Receive file chooser URL: " + result);
|
||||
filePathsCallback.onReceiveValue(result);
|
||||
}
|
||||
}, intent, FILECHOOSER_RESULTCODE);
|
||||
} catch (ActivityNotFoundException e) {
|
||||
Log.w("No activity found to handle file chooser intent.", e);
|
||||
LOG.w("No activity found to handle file chooser intent.", e);
|
||||
filePathsCallback.onReceiveValue(null);
|
||||
}
|
||||
return true;
|
||||
@@ -283,7 +282,7 @@ public class SystemWebChromeClient extends WebChromeClient {
|
||||
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
|
||||
@Override
|
||||
public void onPermissionRequest(final PermissionRequest request) {
|
||||
Log.d(LOG_TAG, "onPermissionRequest: " + Arrays.toString(request.getResources()));
|
||||
LOG.d(LOG_TAG, "onPermissionRequest: " + Arrays.toString(request.getResources()));
|
||||
request.grant(request.getResources());
|
||||
}
|
||||
|
||||
|
||||
@@ -27,8 +27,8 @@ import android.content.Intent;
|
||||
import android.content.IntentFilter;
|
||||
import android.content.pm.ApplicationInfo;
|
||||
import android.os.Build;
|
||||
import android.util.Log;
|
||||
import android.view.View;
|
||||
import android.webkit.ValueCallback;
|
||||
import android.webkit.WebSettings;
|
||||
import android.webkit.WebSettings.LayoutAlgorithm;
|
||||
import android.webkit.WebView;
|
||||
@@ -40,6 +40,7 @@ import org.apache.cordova.CordovaResourceApi;
|
||||
import org.apache.cordova.CordovaWebView;
|
||||
import org.apache.cordova.CordovaWebViewEngine;
|
||||
import org.apache.cordova.ICordovaCookieManager;
|
||||
import org.apache.cordova.LOG;
|
||||
import org.apache.cordova.NativeToJsMessageQueue;
|
||||
import org.apache.cordova.PluginManager;
|
||||
|
||||
@@ -116,7 +117,9 @@ public class SystemWebViewEngine implements CordovaWebViewEngine {
|
||||
SystemWebViewEngine.this.cordova.getActivity().runOnUiThread(r);
|
||||
}
|
||||
}));
|
||||
bridge = new CordovaBridge(pluginManager, nativeToJsMessageQueue);
|
||||
if(Build.VERSION.SDK_INT > Build.VERSION_CODES.JELLY_BEAN_MR2)
|
||||
nativeToJsMessageQueue.addBridgeMode(new NativeToJsMessageQueue.EvalBridgeMode(this, cordova));
|
||||
bridge = new CordovaBridge(pluginManager, nativeToJsMessageQueue);
|
||||
exposeJsInterface(webView, bridge);
|
||||
}
|
||||
|
||||
@@ -145,32 +148,32 @@ public class SystemWebViewEngine implements CordovaWebViewEngine {
|
||||
settings.setJavaScriptEnabled(true);
|
||||
settings.setJavaScriptCanOpenWindowsAutomatically(true);
|
||||
settings.setLayoutAlgorithm(LayoutAlgorithm.NORMAL);
|
||||
|
||||
|
||||
// Set the nav dump for HTC 2.x devices (disabling for ICS, deprecated entirely for Jellybean 4.2)
|
||||
try {
|
||||
Method gingerbread_getMethod = WebSettings.class.getMethod("setNavDump", new Class[] { boolean.class });
|
||||
|
||||
|
||||
String manufacturer = android.os.Build.MANUFACTURER;
|
||||
Log.d(TAG, "CordovaWebView is running on device made by: " + manufacturer);
|
||||
LOG.d(TAG, "CordovaWebView is running on device made by: " + manufacturer);
|
||||
if(android.os.Build.VERSION.SDK_INT < android.os.Build.VERSION_CODES.HONEYCOMB &&
|
||||
android.os.Build.MANUFACTURER.contains("HTC"))
|
||||
{
|
||||
gingerbread_getMethod.invoke(settings, true);
|
||||
}
|
||||
} catch (NoSuchMethodException e) {
|
||||
Log.d(TAG, "We are on a modern version of Android, we will deprecate HTC 2.3 devices in 2.8");
|
||||
LOG.d(TAG, "We are on a modern version of Android, we will deprecate HTC 2.3 devices in 2.8");
|
||||
} catch (IllegalArgumentException e) {
|
||||
Log.d(TAG, "Doing the NavDump failed with bad arguments");
|
||||
LOG.d(TAG, "Doing the NavDump failed with bad arguments");
|
||||
} catch (IllegalAccessException e) {
|
||||
Log.d(TAG, "This should never happen: IllegalAccessException means this isn't Android anymore");
|
||||
LOG.d(TAG, "This should never happen: IllegalAccessException means this isn't Android anymore");
|
||||
} catch (InvocationTargetException e) {
|
||||
Log.d(TAG, "This should never happen: InvocationTargetException means this isn't Android anymore.");
|
||||
LOG.d(TAG, "This should never happen: InvocationTargetException means this isn't Android anymore.");
|
||||
}
|
||||
|
||||
//We don't save any form data in the application
|
||||
settings.setSaveFormData(false);
|
||||
settings.setSavePassword(false);
|
||||
|
||||
|
||||
// Jellybean rightfully tried to lock this down. Too bad they didn't give us a whitelist
|
||||
// while we do this
|
||||
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.JELLY_BEAN) {
|
||||
@@ -184,15 +187,15 @@ public class SystemWebViewEngine implements CordovaWebViewEngine {
|
||||
String databasePath = webView.getContext().getApplicationContext().getDir("database", Context.MODE_PRIVATE).getPath();
|
||||
settings.setDatabaseEnabled(true);
|
||||
settings.setDatabasePath(databasePath);
|
||||
|
||||
|
||||
|
||||
|
||||
//Determine whether we're in debug or release mode, and turn on Debugging!
|
||||
ApplicationInfo appInfo = webView.getContext().getApplicationContext().getApplicationInfo();
|
||||
if ((appInfo.flags & ApplicationInfo.FLAG_DEBUGGABLE) != 0 &&
|
||||
android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.KITKAT) {
|
||||
enableRemoteDebugging();
|
||||
}
|
||||
|
||||
|
||||
settings.setGeolocationDatabasePath(databasePath);
|
||||
|
||||
// Enable DOM storage
|
||||
@@ -200,13 +203,18 @@ public class SystemWebViewEngine implements CordovaWebViewEngine {
|
||||
|
||||
// Enable built-in geolocation
|
||||
settings.setGeolocationEnabled(true);
|
||||
|
||||
|
||||
// Enable AppCache
|
||||
// Fix for CB-2282
|
||||
settings.setAppCacheMaxSize(5 * 1048576);
|
||||
settings.setAppCachePath(databasePath);
|
||||
settings.setAppCacheEnabled(true);
|
||||
|
||||
|
||||
// Enable scaling
|
||||
// Fix for CB-12015
|
||||
settings.setUseWideViewPort(true);
|
||||
settings.setLoadWithOverviewMode(true);
|
||||
|
||||
// Fix for CB-1405
|
||||
// Google issue 4641
|
||||
String defaultUserAgent = settings.getUserAgentString();
|
||||
@@ -222,7 +230,7 @@ public class SystemWebViewEngine implements CordovaWebViewEngine {
|
||||
}
|
||||
}
|
||||
// End CB-3360
|
||||
|
||||
|
||||
IntentFilter intentFilter = new IntentFilter();
|
||||
intentFilter.addAction(Intent.ACTION_CONFIGURATION_CHANGED);
|
||||
if (this.receiver == null) {
|
||||
@@ -242,18 +250,18 @@ public class SystemWebViewEngine implements CordovaWebViewEngine {
|
||||
try {
|
||||
WebView.setWebContentsDebuggingEnabled(true);
|
||||
} catch (IllegalArgumentException e) {
|
||||
Log.d(TAG, "You have one job! To turn on Remote Web Debugging! YOU HAVE FAILED! ");
|
||||
LOG.d(TAG, "You have one job! To turn on Remote Web Debugging! YOU HAVE FAILED! ");
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
private static void exposeJsInterface(WebView webView, CordovaBridge bridge) {
|
||||
if ((Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN_MR1)) {
|
||||
Log.i(TAG, "Disabled addJavascriptInterface() bridge since Android version is old.");
|
||||
LOG.i(TAG, "Disabled addJavascriptInterface() bridge since Android version is old.");
|
||||
// Bug being that Java Strings do not get converted to JS strings automatically.
|
||||
// This isn't hard to work-around on the JS side, but it's easier to just
|
||||
// use the prompt bridge instead.
|
||||
return;
|
||||
return;
|
||||
}
|
||||
SystemExposedJsApi exposedJsApi = new SystemExposedJsApi(bridge);
|
||||
webView.addJavascriptInterface(exposedJsApi, "_cordovaNative");
|
||||
@@ -312,8 +320,10 @@ public class SystemWebViewEngine implements CordovaWebViewEngine {
|
||||
@Override
|
||||
public void setPaused(boolean value) {
|
||||
if (value) {
|
||||
webView.onPause();
|
||||
webView.pauseTimers();
|
||||
} else {
|
||||
webView.onResume();
|
||||
webView.resumeTimers();
|
||||
}
|
||||
}
|
||||
@@ -327,8 +337,19 @@ public class SystemWebViewEngine implements CordovaWebViewEngine {
|
||||
try {
|
||||
webView.getContext().unregisterReceiver(receiver);
|
||||
} catch (Exception e) {
|
||||
Log.e(TAG, "Error unregistering configuration receiver: " + e.getMessage(), e);
|
||||
LOG.e(TAG, "Error unregistering configuration receiver: " + e.getMessage(), e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void evaluateJavascript(String js, ValueCallback<String> callback) {
|
||||
if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
|
||||
webView.evaluateJavascript(js, callback);
|
||||
}
|
||||
else
|
||||
{
|
||||
LOG.d(TAG, "This webview is using the old bridge");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
1
node_modules/abbrev/abbrev.js
generated
vendored
@@ -1,4 +1,3 @@
|
||||
|
||||
module.exports = exports = abbrev.abbrev = abbrev
|
||||
|
||||
abbrev.monkeyPatch = monkeyPatch
|
||||
|
||||
30
node_modules/abbrev/package.json
generated
vendored
@@ -14,20 +14,19 @@
|
||||
]
|
||||
],
|
||||
"_from": "abbrev@>=1.0.0 <2.0.0",
|
||||
"_id": "abbrev@1.0.9",
|
||||
"_id": "abbrev@1.1.0",
|
||||
"_inCache": true,
|
||||
"_installable": true,
|
||||
"_location": "/abbrev",
|
||||
"_nodeVersion": "4.4.4",
|
||||
"_nodeVersion": "8.0.0-pre",
|
||||
"_npmOperationalInternal": {
|
||||
"host": "packages-16-east.internal.npmjs.com",
|
||||
"tmp": "tmp/abbrev-1.0.9.tgz_1466016055839_0.7825860097073019"
|
||||
"host": "packages-12-west.internal.npmjs.com",
|
||||
"tmp": "tmp/abbrev-1.1.0.tgz_1487054000015_0.9229173036292195"
|
||||
},
|
||||
"_npmUser": {
|
||||
"name": "isaacs",
|
||||
"email": "i@izs.me"
|
||||
},
|
||||
"_npmVersion": "3.9.1",
|
||||
"_npmVersion": "4.3.0",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"raw": "abbrev@1",
|
||||
@@ -41,8 +40,8 @@
|
||||
"_requiredBy": [
|
||||
"/nopt"
|
||||
],
|
||||
"_resolved": "http://registry.npmjs.org/abbrev/-/abbrev-1.0.9.tgz",
|
||||
"_shasum": "91b4792588a7738c25f35dd6f63752a2f8776135",
|
||||
"_resolved": "http://registry.npmjs.org/abbrev/-/abbrev-1.1.0.tgz",
|
||||
"_shasum": "d0554c2256636e2f56e7c2e5ad183f859428d81f",
|
||||
"_shrinkwrap": null,
|
||||
"_spec": "abbrev@1",
|
||||
"_where": "/Users/steveng/repo/cordova/cordova-android/node_modules/nopt",
|
||||
@@ -56,17 +55,17 @@
|
||||
"dependencies": {},
|
||||
"description": "Like ruby's abbrev module, but in js",
|
||||
"devDependencies": {
|
||||
"tap": "^5.7.2"
|
||||
"tap": "^10.1"
|
||||
},
|
||||
"directories": {},
|
||||
"dist": {
|
||||
"shasum": "91b4792588a7738c25f35dd6f63752a2f8776135",
|
||||
"tarball": "https://registry.npmjs.org/abbrev/-/abbrev-1.0.9.tgz"
|
||||
"shasum": "d0554c2256636e2f56e7c2e5ad183f859428d81f",
|
||||
"tarball": "https://registry.npmjs.org/abbrev/-/abbrev-1.1.0.tgz"
|
||||
},
|
||||
"files": [
|
||||
"abbrev.js"
|
||||
],
|
||||
"gitHead": "c386cd9dbb1d8d7581718c54d4ba944cc9298d6f",
|
||||
"gitHead": "7136d4d95449dc44115d4f78b80ec907724f64e0",
|
||||
"homepage": "https://github.com/isaacs/abbrev-js#readme",
|
||||
"license": "ISC",
|
||||
"main": "abbrev.js",
|
||||
@@ -84,7 +83,10 @@
|
||||
"url": "git+ssh://git@github.com/isaacs/abbrev-js.git"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "tap test.js --cov"
|
||||
"postpublish": "git push origin --all; git push origin --tags",
|
||||
"postversion": "npm publish",
|
||||
"preversion": "npm test",
|
||||
"test": "tap test.js --100"
|
||||
},
|
||||
"version": "1.0.9"
|
||||
"version": "1.1.0"
|
||||
}
|
||||
|
||||
1
node_modules/ansi/package.json
generated
vendored
@@ -16,7 +16,6 @@
|
||||
"_from": "ansi@>=0.3.1 <0.4.0",
|
||||
"_id": "ansi@0.3.1",
|
||||
"_inCache": true,
|
||||
"_installable": true,
|
||||
"_location": "/ansi",
|
||||
"_nodeVersion": "5.3.0",
|
||||
"_npmUser": {
|
||||
|
||||
1
node_modules/balanced-match/package.json
generated
vendored
@@ -16,7 +16,6 @@
|
||||
"_from": "balanced-match@>=0.4.1 <0.5.0",
|
||||
"_id": "balanced-match@0.4.2",
|
||||
"_inCache": true,
|
||||
"_installable": true,
|
||||
"_location": "/balanced-match",
|
||||
"_nodeVersion": "4.4.7",
|
||||
"_npmOperationalInternal": {
|
||||
|
||||
1
node_modules/base64-js/package.json
generated
vendored
@@ -16,7 +16,6 @@
|
||||
"_from": "base64-js@0.0.8",
|
||||
"_id": "base64-js@0.0.8",
|
||||
"_inCache": true,
|
||||
"_installable": true,
|
||||
"_location": "/base64-js",
|
||||
"_nodeVersion": "0.10.35",
|
||||
"_npmUser": {
|
||||
|
||||
63
node_modules/big-integer/BigInteger.js
generated
vendored
@@ -118,7 +118,7 @@ var bigInt = (function (undefined) {
|
||||
}
|
||||
|
||||
BigInteger.prototype.add = function (v) {
|
||||
var value, n = parseValue(v);
|
||||
var n = parseValue(v);
|
||||
if (this.sign !== n.sign) {
|
||||
return this.subtract(n.negate());
|
||||
}
|
||||
@@ -177,7 +177,7 @@ var bigInt = (function (undefined) {
|
||||
}
|
||||
|
||||
function subtractAny(a, b, sign) {
|
||||
var value, isSmall;
|
||||
var value;
|
||||
if (compareAbs(a, b) >= 0) {
|
||||
value = subtract(a,b);
|
||||
} else {
|
||||
@@ -301,7 +301,7 @@ var bigInt = (function (undefined) {
|
||||
|
||||
function multiplyKaratsuba(x, y) {
|
||||
var n = Math.max(x.length, y.length);
|
||||
|
||||
|
||||
if (n <= 30) return multiplyLong(x, y);
|
||||
n = Math.ceil(n / 2);
|
||||
|
||||
@@ -326,7 +326,7 @@ var bigInt = (function (undefined) {
|
||||
}
|
||||
|
||||
BigInteger.prototype.multiply = function (v) {
|
||||
var value, n = parseValue(v),
|
||||
var n = parseValue(v),
|
||||
a = this.value, b = n.value,
|
||||
sign = this.sign !== n.sign,
|
||||
abs;
|
||||
@@ -467,6 +467,7 @@ var bigInt = (function (undefined) {
|
||||
guess, xlen, highx, highy, check;
|
||||
while (a_l) {
|
||||
part.unshift(a[--a_l]);
|
||||
trim(part);
|
||||
if (compareAbs(part, b) < 0) {
|
||||
result.push(0);
|
||||
continue;
|
||||
@@ -822,6 +823,29 @@ var bigInt = (function (undefined) {
|
||||
};
|
||||
SmallInteger.prototype.isProbablePrime = BigInteger.prototype.isProbablePrime;
|
||||
|
||||
BigInteger.prototype.modInv = function (n) {
|
||||
var t = bigInt.zero, newT = bigInt.one, r = parseValue(n), newR = this.abs(), q, lastT, lastR;
|
||||
while (!newR.equals(bigInt.zero)) {
|
||||
q = r.divide(newR);
|
||||
lastT = t;
|
||||
lastR = r;
|
||||
t = newT;
|
||||
r = newR;
|
||||
newT = lastT.subtract(q.multiply(newT));
|
||||
newR = lastR.subtract(q.multiply(newR));
|
||||
}
|
||||
if (!r.equals(1)) throw new Error(this.toString() + " and " + n.toString() + " are not co-prime");
|
||||
if (t.compare(0) === -1) {
|
||||
t = t.add(n);
|
||||
}
|
||||
if (this.isNegative()) {
|
||||
return t.negate();
|
||||
}
|
||||
return t;
|
||||
};
|
||||
|
||||
SmallInteger.prototype.modInv = BigInteger.prototype.modInv;
|
||||
|
||||
BigInteger.prototype.next = function () {
|
||||
var value = this.value;
|
||||
if (this.sign) {
|
||||
@@ -958,7 +982,7 @@ var bigInt = (function (undefined) {
|
||||
b = parseValue(b);
|
||||
return a.greater(b) ? a : b;
|
||||
}
|
||||
function min(a,b) {
|
||||
function min(a, b) {
|
||||
a = parseValue(a);
|
||||
b = parseValue(b);
|
||||
return a.lesser(b) ? a : b;
|
||||
@@ -1013,8 +1037,7 @@ var bigInt = (function (undefined) {
|
||||
return low.add(typeof result === "number" ? new SmallInteger(result) : new BigInteger(result, false));
|
||||
}
|
||||
var parseBase = function (text, base) {
|
||||
var val = Integer[0], pow = Integer[1],
|
||||
length = text.length;
|
||||
var length = text.length;
|
||||
if (2 <= base && base <= 36) {
|
||||
if (length <= LOG_MAX_INT / Math.log(base)) {
|
||||
return new SmallInteger(parseInt(text, base));
|
||||
@@ -1036,13 +1059,17 @@ var bigInt = (function (undefined) {
|
||||
}
|
||||
else throw new Error(c + " is not a valid character");
|
||||
}
|
||||
digits.reverse();
|
||||
for (i = 0; i < digits.length; i++) {
|
||||
return parseBaseFromArray(digits, base, isNegative);
|
||||
};
|
||||
|
||||
function parseBaseFromArray(digits, base, isNegative) {
|
||||
var val = Integer[0], pow = Integer[1], i;
|
||||
for (i = digits.length - 1; i >= 0; i--) {
|
||||
val = val.add(digits[i].times(pow));
|
||||
pow = pow.times(base);
|
||||
}
|
||||
return isNegative ? val.negate() : val;
|
||||
};
|
||||
}
|
||||
|
||||
function stringify(digit) {
|
||||
var v = digit.value;
|
||||
@@ -1114,7 +1141,7 @@ var bigInt = (function (undefined) {
|
||||
return this.value;
|
||||
};
|
||||
SmallInteger.prototype.toJSNumber = SmallInteger.prototype.valueOf;
|
||||
|
||||
|
||||
function parseStringValue(v) {
|
||||
if (isPrecise(+v)) {
|
||||
var x = +v;
|
||||
@@ -1153,7 +1180,7 @@ var bigInt = (function (undefined) {
|
||||
trim(r);
|
||||
return new BigInteger(r, sign);
|
||||
}
|
||||
|
||||
|
||||
function parseNumberValue(v) {
|
||||
if (isPrecise(v)) {
|
||||
if (v !== truncate(v)) throw new Error(v + " is not an integer.");
|
||||
@@ -1186,6 +1213,11 @@ var bigInt = (function (undefined) {
|
||||
Integer.lcm = lcm;
|
||||
Integer.isInstance = function (x) { return x instanceof BigInteger || x instanceof SmallInteger; };
|
||||
Integer.randBetween = randBetween;
|
||||
|
||||
Integer.fromArray = function (digits, base, isNegative) {
|
||||
return parseBaseFromArray(digits.map(parseValue), parseValue(base || 10), isNegative);
|
||||
};
|
||||
|
||||
return Integer;
|
||||
})();
|
||||
|
||||
@@ -1193,3 +1225,10 @@ var bigInt = (function (undefined) {
|
||||
if (typeof module !== "undefined" && module.hasOwnProperty("exports")) {
|
||||
module.exports = bigInt;
|
||||
}
|
||||
|
||||
//amd check
|
||||
if ( typeof define === "function" && define.amd ) {
|
||||
define( "big-integer", [], function() {
|
||||
return bigInt;
|
||||
});
|
||||
}
|
||||
|
||||
34
node_modules/big-integer/BigInteger.min.js
generated
vendored
14
node_modules/big-integer/README.md
generated
vendored
@@ -280,6 +280,13 @@ Performs division and returns the remainder, disregarding the quotient. The sign
|
||||
|
||||
[View benchmarks for this method](http://peterolson.github.io/BigInteger.js/benchmark/#Division)
|
||||
|
||||
#### `modInv(mod)`
|
||||
|
||||
Finds the [multiplicative inverse](https://en.wikipedia.org/wiki/Modular_multiplicative_inverse) of the number modulo `mod`.
|
||||
|
||||
- `bigInt(3).modInv(11)` => `4`
|
||||
- `bigInt(42).modInv(2017)` => `1969`
|
||||
|
||||
#### `modPow(exp, mod)`
|
||||
|
||||
Takes the number to the power `exp` modulo `mod`.
|
||||
@@ -414,6 +421,13 @@ Performs the bitwise XOR operation. The operands are treated as if they were rep
|
||||
|
||||
### Static Methods
|
||||
|
||||
#### `fromArray(digits, base = 10, isNegative?)`
|
||||
|
||||
Constructs a bigInt from an array of digits in base `base`. The optional `isNegative` flag will make the number negative.
|
||||
|
||||
- `bigInt.fromArray([1, 2, 3, 4, 5], 10)` => `12345`
|
||||
- `bigInt.fromArray([1, 0, 0], 2, true)` => `-4`
|
||||
|
||||
#### `gcd(a, b)`
|
||||
|
||||
Finds the greatest common denominator of `a` and `b`.
|
||||
|
||||
30
node_modules/big-integer/bower.json
generated
vendored
Normal file
@@ -0,0 +1,30 @@
|
||||
{
|
||||
"name": "big-integer",
|
||||
"description": "An arbitrary length integer library for Javascript",
|
||||
"main": "./BigInteger.js",
|
||||
"authors": [
|
||||
"Peter Olson"
|
||||
],
|
||||
"license": "Unlicense",
|
||||
"keywords": [
|
||||
"math",
|
||||
"big",
|
||||
"bignum",
|
||||
"bigint",
|
||||
"biginteger",
|
||||
"integer",
|
||||
"arbitrary",
|
||||
"precision",
|
||||
"arithmetic"
|
||||
],
|
||||
"homepage": "https://github.com/peterolson/BigInteger.js",
|
||||
"ignore": [
|
||||
"**/.*",
|
||||
"node_modules",
|
||||
"bower_components",
|
||||
"test",
|
||||
"coverage",
|
||||
"spec",
|
||||
"tests"
|
||||
]
|
||||
}
|
||||
25
node_modules/big-integer/package.json
generated
vendored
@@ -14,20 +14,19 @@
|
||||
]
|
||||
],
|
||||
"_from": "big-integer@>=1.6.7 <2.0.0",
|
||||
"_id": "big-integer@1.6.15",
|
||||
"_id": "big-integer@1.6.22",
|
||||
"_inCache": true,
|
||||
"_installable": true,
|
||||
"_location": "/big-integer",
|
||||
"_nodeVersion": "0.12.3",
|
||||
"_nodeVersion": "6.9.4",
|
||||
"_npmOperationalInternal": {
|
||||
"host": "packages-12-west.internal.npmjs.com",
|
||||
"tmp": "tmp/big-integer-1.6.15.tgz_1460079231162_0.7087579960934818"
|
||||
"tmp": "tmp/big-integer-1.6.22.tgz_1493091323169_0.5048394540790468"
|
||||
},
|
||||
"_npmUser": {
|
||||
"name": "peterolson",
|
||||
"email": "peter.e.c.olson+npm@gmail.com"
|
||||
},
|
||||
"_npmVersion": "2.9.1",
|
||||
"_npmVersion": "3.10.10",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"raw": "big-integer@^1.6.7",
|
||||
@@ -41,8 +40,8 @@
|
||||
"_requiredBy": [
|
||||
"/bplist-parser"
|
||||
],
|
||||
"_resolved": "http://registry.npmjs.org/big-integer/-/big-integer-1.6.15.tgz",
|
||||
"_shasum": "33d27d3b7388dfcc4b86d3130c10740cec01fb9e",
|
||||
"_resolved": "https://registry.npmjs.org/big-integer/-/big-integer-1.6.22.tgz",
|
||||
"_shasum": "487c95fce886022ea48ff5f19e388932df46dd2e",
|
||||
"_shrinkwrap": null,
|
||||
"_spec": "big-integer@^1.6.7",
|
||||
"_where": "/Users/steveng/repo/cordova/cordova-android/node_modules/bplist-parser",
|
||||
@@ -64,17 +63,18 @@
|
||||
"karma": "^0.13.3",
|
||||
"karma-coverage": "^0.4.2",
|
||||
"karma-jasmine": "^0.3.6",
|
||||
"karma-phantomjs-launcher": "~0.1"
|
||||
"karma-phantomjs-launcher": "~0.1",
|
||||
"uglifyjs": "^2.4.10"
|
||||
},
|
||||
"directories": {},
|
||||
"dist": {
|
||||
"shasum": "33d27d3b7388dfcc4b86d3130c10740cec01fb9e",
|
||||
"tarball": "https://registry.npmjs.org/big-integer/-/big-integer-1.6.15.tgz"
|
||||
"shasum": "487c95fce886022ea48ff5f19e388932df46dd2e",
|
||||
"tarball": "https://registry.npmjs.org/big-integer/-/big-integer-1.6.22.tgz"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=0.6"
|
||||
},
|
||||
"gitHead": "cda5bcce74c3a4eb34951201d50c1b8776a56eca",
|
||||
"gitHead": "40483b881b4380931e5af6f2f8a161b6caa71690",
|
||||
"homepage": "https://github.com/peterolson/BigInteger.js#readme",
|
||||
"keywords": [
|
||||
"math",
|
||||
@@ -103,7 +103,8 @@
|
||||
"url": "git+ssh://git@github.com/peterolson/BigInteger.js.git"
|
||||
},
|
||||
"scripts": {
|
||||
"minify": "uglifyjs BigInteger.js -o BigInteger.min.js",
|
||||
"test": "karma start my.conf.js"
|
||||
},
|
||||
"version": "1.6.15"
|
||||
"version": "1.6.22"
|
||||
}
|
||||
|
||||
1
node_modules/bplist-parser/package.json
generated
vendored
@@ -16,7 +16,6 @@
|
||||
"_from": "bplist-parser@>=0.1.0 <0.2.0",
|
||||
"_id": "bplist-parser@0.1.1",
|
||||
"_inCache": true,
|
||||
"_installable": true,
|
||||
"_location": "/bplist-parser",
|
||||
"_nodeVersion": "5.1.0",
|
||||
"_npmUser": {
|
||||
|
||||
1
node_modules/brace-expansion/README.md
generated
vendored
@@ -5,6 +5,7 @@ as known from sh/bash, in JavaScript.
|
||||
|
||||
[](http://travis-ci.org/juliangruber/brace-expansion)
|
||||
[](https://www.npmjs.org/package/brace-expansion)
|
||||
[](https://greenkeeper.io/)
|
||||
|
||||
[](https://ci.testling.com/juliangruber/brace-expansion)
|
||||
|
||||
|
||||
2
node_modules/brace-expansion/index.js
generated
vendored
@@ -106,7 +106,7 @@ function expand(str, isTop) {
|
||||
var isNumericSequence = /^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(m.body);
|
||||
var isAlphaSequence = /^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(m.body);
|
||||
var isSequence = isNumericSequence || isAlphaSequence;
|
||||
var isOptions = /^(.*,)+(.+)?$/.test(m.body);
|
||||
var isOptions = m.body.indexOf(',') >= 0;
|
||||
if (!isSequence && !isOptions) {
|
||||
// {a},b}
|
||||
if (m.post.match(/,.*\}/)) {
|
||||
|
||||
25
node_modules/brace-expansion/package.json
generated
vendored
@@ -14,20 +14,19 @@
|
||||
]
|
||||
],
|
||||
"_from": "brace-expansion@>=1.0.0 <2.0.0",
|
||||
"_id": "brace-expansion@1.1.6",
|
||||
"_id": "brace-expansion@1.1.7",
|
||||
"_inCache": true,
|
||||
"_installable": true,
|
||||
"_location": "/brace-expansion",
|
||||
"_nodeVersion": "4.4.7",
|
||||
"_nodeVersion": "7.8.0",
|
||||
"_npmOperationalInternal": {
|
||||
"host": "packages-16-east.internal.npmjs.com",
|
||||
"tmp": "tmp/brace-expansion-1.1.6.tgz_1469047715600_0.9362958471756428"
|
||||
"host": "packages-12-west.internal.npmjs.com",
|
||||
"tmp": "tmp/brace-expansion-1.1.7.tgz_1491552830231_0.7213963181711733"
|
||||
},
|
||||
"_npmUser": {
|
||||
"name": "juliangruber",
|
||||
"email": "julian@juliangruber.com"
|
||||
},
|
||||
"_npmVersion": "2.15.8",
|
||||
"_npmVersion": "4.2.0",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"raw": "brace-expansion@^1.0.0",
|
||||
@@ -41,8 +40,8 @@
|
||||
"_requiredBy": [
|
||||
"/minimatch"
|
||||
],
|
||||
"_resolved": "http://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.6.tgz",
|
||||
"_shasum": "7197d7eaa9b87e648390ea61fc66c84427420df9",
|
||||
"_resolved": "http://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.7.tgz",
|
||||
"_shasum": "3effc3c50e000531fb720eaff80f0ae8ef23cf59",
|
||||
"_shrinkwrap": null,
|
||||
"_spec": "brace-expansion@^1.0.0",
|
||||
"_where": "/Users/steveng/repo/cordova/cordova-android/node_modules/minimatch",
|
||||
@@ -60,14 +59,15 @@
|
||||
},
|
||||
"description": "Brace expansion as known from sh/bash",
|
||||
"devDependencies": {
|
||||
"matcha": "^0.7.0",
|
||||
"tape": "^4.6.0"
|
||||
},
|
||||
"directories": {},
|
||||
"dist": {
|
||||
"shasum": "7197d7eaa9b87e648390ea61fc66c84427420df9",
|
||||
"tarball": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.6.tgz"
|
||||
"shasum": "3effc3c50e000531fb720eaff80f0ae8ef23cf59",
|
||||
"tarball": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.7.tgz"
|
||||
},
|
||||
"gitHead": "791262fa06625e9c5594cde529a21d82086af5f2",
|
||||
"gitHead": "892512024872ca7680554be90f6e8ce065053372",
|
||||
"homepage": "https://github.com/juliangruber/brace-expansion",
|
||||
"keywords": [],
|
||||
"license": "MIT",
|
||||
@@ -90,6 +90,7 @@
|
||||
"url": "git://github.com/juliangruber/brace-expansion.git"
|
||||
},
|
||||
"scripts": {
|
||||
"bench": "matcha test/perf/bench.js",
|
||||
"gentest": "bash test/generate.sh",
|
||||
"test": "tape test/*.js"
|
||||
},
|
||||
@@ -109,5 +110,5 @@
|
||||
"android-browser/4.2..latest"
|
||||
]
|
||||
},
|
||||
"version": "1.1.6"
|
||||
"version": "1.1.7"
|
||||
}
|
||||
|
||||
1
node_modules/concat-map/package.json
generated
vendored
@@ -16,7 +16,6 @@
|
||||
"_from": "concat-map@0.0.1",
|
||||
"_id": "concat-map@0.0.1",
|
||||
"_inCache": true,
|
||||
"_installable": true,
|
||||
"_location": "/concat-map",
|
||||
"_npmUser": {
|
||||
"name": "substack",
|
||||
|
||||
1
node_modules/cordova-common/.ratignore
generated
vendored
@@ -1,2 +1,3 @@
|
||||
fixtures
|
||||
coverage
|
||||
jasmine.json
|
||||
|
||||
33
node_modules/cordova-common/RELEASENOTES.md
generated
vendored
@@ -20,6 +20,36 @@
|
||||
-->
|
||||
# Cordova-common Release Notes
|
||||
|
||||
### 2.0.2 (Apr 14, 2017)
|
||||
* [CB-11233](https://issues.apache.org/jira/browse/CB-11233) - Support installing frameworks into 'Embedded Binaries' section of the Xcode project
|
||||
* [CB-10438](https://issues.apache.org/jira/browse/CB-10438) - Install correct dependency version. Removed shell.remove, added pkg.json to dependency tests 1-3, and updated install.js (.replace) to fix tests in uninstall.spec.js and update to workw with jasmine 2.0
|
||||
* [CB-11120](https://issues.apache.org/jira/browse/CB-11120) - Allow short/display name in config.xml
|
||||
* [CB-11346](https://issues.apache.org/jira/browse/CB-11346) - Remove known platforms check
|
||||
* [CB-11977](https://issues.apache.org/jira/browse/CB-11977) - updated engines and enginescript for common, fetch, and serve
|
||||
|
||||
### 2.0.1 (Mar 09, 2017)
|
||||
* [CB-12557](https://issues.apache.org/jira/browse/CB-12557) add both stdout and stderr properties to the error object passed to superspawn reject handler.
|
||||
|
||||
### 2.0.0 (Jan 17, 2017)
|
||||
* [CB-8978](https://issues.apache.org/jira/browse/CB-8978) Add `resource-file` parsing to `config.xml`
|
||||
* [CB-12018](https://issues.apache.org/jira/browse/CB-12018): updated `jshint` and updated tests to work with `jasmine@2` instead of `jasmine-node`
|
||||
* [CB-12163](https://issues.apache.org/jira/browse/CB-12163) Add reference attrib to `resource-file` for **Windows**
|
||||
* Move windows-specific logic to `cordova-windows`
|
||||
* [CB-12189](https://issues.apache.org/jira/browse/CB-12189) Add implementation attribute to framework
|
||||
|
||||
### 1.5.1 (Oct 12, 2016)
|
||||
* [CB-12002](https://issues.apache.org/jira/browse/CB-12002) Add `getAllowIntents()` to `ConfigParser`
|
||||
* [CB-11998](https://issues.apache.org/jira/browse/CB-11998) `cordova platform add` error with `cordova-common@1.5.0`
|
||||
|
||||
### 1.5.0 (Oct 06, 2016)
|
||||
* [CB-11776](https://issues.apache.org/jira/browse/CB-11776) Add test case for different `edit-config` targets
|
||||
* [CB-11908](https://issues.apache.org/jira/browse/CB-11908) Add `edit-config` to `config.xml`
|
||||
* [CB-11936](https://issues.apache.org/jira/browse/CB-11936) Support four new **App Transport Security (ATS)** keys
|
||||
* update `config.xml` location if it is a **Android Studio** project.
|
||||
* use `array` methods and `object.keys` for iterating. avoiding `for-in` loops
|
||||
* [CB-11517](https://issues.apache.org/jira/browse/CB-11517) Allow `.folder` matches
|
||||
* [CB-11776](https://issues.apache.org/jira/browse/CB-11776) check `edit-config` target exists
|
||||
|
||||
### 1.4.1 (Aug 09, 2016)
|
||||
* Add general purpose `ConfigParser.getAttribute` API
|
||||
* [CB-11653](https://issues.apache.org/jira/browse/CB-11653) moved `findProjectRoot` from `cordova-lib` to `cordova-common`
|
||||
@@ -27,6 +57,9 @@
|
||||
* [CB-11645](https://issues.apache.org/jira/browse/CB-11645) added check to see if `getEditConfig` exists before trying to use it
|
||||
* [CB-9825](https://issues.apache.org/jira/browse/CB-9825) framework tag spec parsing
|
||||
|
||||
### 1.4.0 (Jul 12, 2016)
|
||||
* [CB-11023](https://issues.apache.org/jira/browse/CB-11023) Add edit-config functionality
|
||||
|
||||
### 1.3.0 (May 12, 2016)
|
||||
* [CB-11259](https://issues.apache.org/jira/browse/CB-11259): Improving prepare and build logging
|
||||
* [CB-11194](https://issues.apache.org/jira/browse/CB-11194) Improve cordova load time
|
||||
|
||||
57
node_modules/cordova-common/package.json
generated
vendored
@@ -2,49 +2,48 @@
|
||||
"_args": [
|
||||
[
|
||||
{
|
||||
"raw": "cordova-common@^1.4.0",
|
||||
"raw": "cordova-common@^2.0.1",
|
||||
"scope": null,
|
||||
"escapedName": "cordova-common",
|
||||
"name": "cordova-common",
|
||||
"rawSpec": "^1.4.0",
|
||||
"spec": ">=1.4.0 <2.0.0",
|
||||
"rawSpec": "^2.0.1",
|
||||
"spec": ">=2.0.1 <3.0.0",
|
||||
"type": "range"
|
||||
},
|
||||
"/Users/steveng/repo/cordova/cordova-android"
|
||||
]
|
||||
],
|
||||
"_from": "cordova-common@>=1.4.0 <2.0.0",
|
||||
"_id": "cordova-common@1.4.1",
|
||||
"_from": "cordova-common@>=2.0.1 <3.0.0",
|
||||
"_id": "cordova-common@2.0.2",
|
||||
"_inCache": true,
|
||||
"_installable": true,
|
||||
"_location": "/cordova-common",
|
||||
"_nodeVersion": "6.2.2",
|
||||
"_nodeVersion": "4.7.3",
|
||||
"_npmOperationalInternal": {
|
||||
"host": "packages-16-east.internal.npmjs.com",
|
||||
"tmp": "tmp/cordova-common-1.4.1.tgz_1471306335501_0.6723270947113633"
|
||||
"host": "packages-12-west.internal.npmjs.com",
|
||||
"tmp": "tmp/cordova-common-2.0.2.tgz_1492453798445_0.6290795875247568"
|
||||
},
|
||||
"_npmUser": {
|
||||
"name": "stevegill",
|
||||
"email": "stevengill97@gmail.com"
|
||||
"name": "shazron",
|
||||
"email": "shazron@gmail.com"
|
||||
},
|
||||
"_npmVersion": "3.9.5",
|
||||
"_npmVersion": "2.15.11",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"raw": "cordova-common@^1.4.0",
|
||||
"raw": "cordova-common@^2.0.1",
|
||||
"scope": null,
|
||||
"escapedName": "cordova-common",
|
||||
"name": "cordova-common",
|
||||
"rawSpec": "^1.4.0",
|
||||
"spec": ">=1.4.0 <2.0.0",
|
||||
"rawSpec": "^2.0.1",
|
||||
"spec": ">=2.0.1 <3.0.0",
|
||||
"type": "range"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/"
|
||||
],
|
||||
"_resolved": "file:cordova-dist-dev/CB-11690/cordova-common-1.4.1.tgz",
|
||||
"_shasum": "8b4f07b3199b398fff553b32bff66676ecd30ab9",
|
||||
"_resolved": "http://registry.npmjs.org/cordova-common/-/cordova-common-2.0.2.tgz",
|
||||
"_shasum": "57467976b8afd5e0bd0a13111b66a420441601cb",
|
||||
"_shrinkwrap": null,
|
||||
"_spec": "cordova-common@^1.4.0",
|
||||
"_spec": "cordova-common@^2.0.1",
|
||||
"_where": "/Users/steveng/repo/cordova/cordova-android",
|
||||
"author": {
|
||||
"name": "Apache Software Foundation"
|
||||
@@ -71,20 +70,20 @@
|
||||
},
|
||||
"description": "Apache Cordova tools and platforms shared routines",
|
||||
"devDependencies": {
|
||||
"istanbul": "^0.3.17",
|
||||
"jasmine-node": "^1.14.5",
|
||||
"istanbul": "^0.4.5",
|
||||
"jasmine": "^2.5.2",
|
||||
"jshint": "^2.8.0",
|
||||
"promise-matchers": "^0.9.6",
|
||||
"rewire": "^2.5.1"
|
||||
},
|
||||
"directories": {},
|
||||
"dist": {
|
||||
"shasum": "8b4f07b3199b398fff553b32bff66676ecd30ab9",
|
||||
"tarball": "https://registry.npmjs.org/cordova-common/-/cordova-common-1.4.1.tgz"
|
||||
"shasum": "57467976b8afd5e0bd0a13111b66a420441601cb",
|
||||
"tarball": "https://registry.npmjs.org/cordova-common/-/cordova-common-2.0.2.tgz"
|
||||
},
|
||||
"engineStrict": true,
|
||||
"engines": {
|
||||
"node": ">=0.9.9"
|
||||
"node": ">=4.0.0"
|
||||
},
|
||||
"license": "Apache-2.0",
|
||||
"main": "cordova-common.js",
|
||||
@@ -93,6 +92,10 @@
|
||||
"name": "bowserj",
|
||||
"email": "bowserj@apache.org"
|
||||
},
|
||||
{
|
||||
"name": "filmaj",
|
||||
"email": "maj.fil@gmail.com"
|
||||
},
|
||||
{
|
||||
"name": "kotikov.vladimir",
|
||||
"email": "kotikov.vladimir@gmail.com"
|
||||
@@ -122,10 +125,10 @@
|
||||
"url": "git://git-wip-us.apache.org/repos/asf/cordova-common.git"
|
||||
},
|
||||
"scripts": {
|
||||
"cover": "node node_modules/istanbul/lib/cli.js cover --root src --print detail node_modules/jasmine-node/bin/jasmine-node -- spec",
|
||||
"jasmine": "node node_modules/jasmine-node/bin/jasmine-node --captureExceptions --color spec",
|
||||
"jshint": "node node_modules/jshint/bin/jshint src && node node_modules/jshint/bin/jshint spec",
|
||||
"cover": "istanbul cover --root src --print detail jasmine",
|
||||
"jasmine": "jasmine --captureExceptions --color",
|
||||
"jshint": "jshint src && jshint spec",
|
||||
"test": "npm run jshint && npm run jasmine"
|
||||
},
|
||||
"version": "1.4.1"
|
||||
"version": "2.0.2"
|
||||
}
|
||||
|
||||
300
node_modules/cordova-common/src/ConfigChanges/ConfigChanges.js
generated
vendored
@@ -1,21 +1,21 @@
|
||||
/*
|
||||
*
|
||||
* Copyright 2013 Anis Kadri
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*
|
||||
*/
|
||||
/**
|
||||
Licensed to the Apache Software Foundation (ASF) under one
|
||||
or more contributor license agreements. See the NOTICE file
|
||||
distributed with this work for additional information
|
||||
regarding copyright ownership. The ASF licenses this file
|
||||
to you under the Apache License, Version 2.0 (the
|
||||
"License"); you may not use this file except in compliance
|
||||
with the License. You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing,
|
||||
software distributed under the License is distributed on an
|
||||
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
KIND, either express or implied. See the License for the
|
||||
specific language governing permissions and limitations
|
||||
under the License.
|
||||
*/
|
||||
|
||||
/*
|
||||
* This module deals with shared configuration / dependency "stuff". That is:
|
||||
@@ -31,11 +31,8 @@
|
||||
|
||||
/* jshint sub:true */
|
||||
|
||||
var fs = require('fs'),
|
||||
path = require('path'),
|
||||
var path = require('path'),
|
||||
et = require('elementtree'),
|
||||
semver = require('semver'),
|
||||
events = require('../events'),
|
||||
ConfigKeeper = require('./ConfigKeeper'),
|
||||
CordovaLogger = require('../CordovaLogger');
|
||||
|
||||
@@ -109,18 +106,6 @@ function remove_plugin_changes(pluginInfo, is_top_level) {
|
||||
var munge = mungeutil.decrement_munge(global_munge, config_munge);
|
||||
|
||||
for (var file in munge.files) {
|
||||
// CB-6976 Windows Universal Apps. Compatibility fix for existing plugins.
|
||||
if (self.platform == 'windows' && file == 'package.appxmanifest' &&
|
||||
!fs.existsSync(path.join(self.project_dir, 'package.appxmanifest'))) {
|
||||
// New windows template separate manifest files for Windows10, Windows8.1 and WP8.1
|
||||
var substs = ['package.phone.appxmanifest', 'package.windows.appxmanifest', 'package.windows10.appxmanifest'];
|
||||
/* jshint loopfunc:true */
|
||||
substs.forEach(function(subst) {
|
||||
events.emit('verbose', 'Applying munge to ' + subst);
|
||||
self.apply_file_munge(subst, munge.files[file], true);
|
||||
});
|
||||
/* jshint loopfunc:false */
|
||||
}
|
||||
self.apply_file_munge(file, munge.files[file], /* remove = */ true);
|
||||
}
|
||||
|
||||
@@ -148,6 +133,11 @@ function add_plugin_changes(pluginInfo, plugin_vars, is_top_level, should_increm
|
||||
}
|
||||
else {
|
||||
var isConflictingInfo = is_conflicting(edit_config_changes, platform_config.config_munge, self, plugin_force);
|
||||
|
||||
if (isConflictingInfo.conflictWithConfigxml) {
|
||||
throw new Error(pluginInfo.id +
|
||||
' cannot be added. <edit-config> changes in this plugin conflicts with <edit-config> changes in config.xml. Conflicts must be resolved before plugin can be added.');
|
||||
}
|
||||
if (plugin_force) {
|
||||
CordovaLogger.get().log(CordovaLogger.WARN, '--force is used. edit-config will overwrite conflicts if any. Conflicting plugins may not work as expected.');
|
||||
|
||||
@@ -170,7 +160,67 @@ function add_plugin_changes(pluginInfo, plugin_vars, is_top_level, should_increm
|
||||
config_munge = self.generate_plugin_config_munge(pluginInfo, plugin_vars, edit_config_changes);
|
||||
}
|
||||
}
|
||||
// global munge looks at all plugins' changes to config files
|
||||
|
||||
self = munge_helper(should_increment, self, platform_config, config_munge);
|
||||
|
||||
// Move to installed/dependent_plugins
|
||||
self.platformJson.addPlugin(pluginInfo.id, plugin_vars || {}, is_top_level);
|
||||
return self;
|
||||
}
|
||||
|
||||
|
||||
// Handle edit-config changes from config.xml
|
||||
PlatformMunger.prototype.add_config_changes = add_config_changes;
|
||||
function add_config_changes(config, should_increment) {
|
||||
var self = this;
|
||||
var platform_config = self.platformJson.root;
|
||||
|
||||
var config_munge;
|
||||
var edit_config_changes = null;
|
||||
if(config.getEditConfigs) {
|
||||
edit_config_changes = config.getEditConfigs(self.platform);
|
||||
}
|
||||
|
||||
if (!edit_config_changes || edit_config_changes.length === 0) {
|
||||
// There are no edit-config changes to add, return here
|
||||
return self;
|
||||
}
|
||||
else {
|
||||
var isConflictingInfo = is_conflicting(edit_config_changes, platform_config.config_munge, self, true /*always force overwrite other edit-config*/);
|
||||
|
||||
if(isConflictingInfo.conflictFound) {
|
||||
var conflict_munge;
|
||||
var conflict_file;
|
||||
|
||||
if (Object.keys(isConflictingInfo.configxmlMunge.files).length !== 0) {
|
||||
// silently remove conflicting config.xml munges so new munges can be added
|
||||
conflict_munge = mungeutil.decrement_munge(platform_config.config_munge, isConflictingInfo.configxmlMunge);
|
||||
for (conflict_file in conflict_munge.files) {
|
||||
self.apply_file_munge(conflict_file, conflict_munge.files[conflict_file], /* remove = */ true);
|
||||
}
|
||||
}
|
||||
if (Object.keys(isConflictingInfo.conflictingMunge.files).length !== 0) {
|
||||
CordovaLogger.get().log(CordovaLogger.WARN, 'Conflict found, edit-config changes from config.xml will overwrite plugin.xml changes');
|
||||
|
||||
// remove conflicting plugin.xml munges
|
||||
conflict_munge = mungeutil.decrement_munge(platform_config.config_munge, isConflictingInfo.conflictingMunge);
|
||||
for (conflict_file in conflict_munge.files) {
|
||||
self.apply_file_munge(conflict_file, conflict_munge.files[conflict_file], /* remove = */ true);
|
||||
}
|
||||
}
|
||||
}
|
||||
// Add config.xml edit-config munges
|
||||
config_munge = self.generate_config_xml_munge(config, edit_config_changes, 'config.xml');
|
||||
}
|
||||
|
||||
self = munge_helper(should_increment, self, platform_config, config_munge);
|
||||
|
||||
// Move to installed/dependent_plugins
|
||||
return self;
|
||||
}
|
||||
|
||||
function munge_helper(should_increment, self, platform_config, config_munge) {
|
||||
// global munge looks at all changes to config files
|
||||
|
||||
// TODO: The should_increment param is only used by cordova-cli and is going away soon.
|
||||
// If should_increment is set to false, avoid modifying the global_munge (use clone)
|
||||
@@ -185,22 +235,9 @@ function add_plugin_changes(pluginInfo, plugin_vars, is_top_level, should_increm
|
||||
}
|
||||
|
||||
for (var file in munge.files) {
|
||||
// CB-6976 Windows Universal Apps. Compatibility fix for existing plugins.
|
||||
if (self.platform == 'windows' && file == 'package.appxmanifest' &&
|
||||
!fs.existsSync(path.join(self.project_dir, 'package.appxmanifest'))) {
|
||||
var substs = ['package.phone.appxmanifest', 'package.windows.appxmanifest', 'package.windows10.appxmanifest'];
|
||||
/* jshint loopfunc:true */
|
||||
substs.forEach(function(subst) {
|
||||
events.emit('verbose', 'Applying munge to ' + subst);
|
||||
self.apply_file_munge(subst, munge.files[file]);
|
||||
});
|
||||
/* jshint loopfunc:false */
|
||||
}
|
||||
self.apply_file_munge(file, munge.files[file]);
|
||||
}
|
||||
|
||||
// Move to installed/dependent_plugins
|
||||
self.platformJson.addPlugin(pluginInfo.id, plugin_vars || {}, is_top_level);
|
||||
return self;
|
||||
}
|
||||
|
||||
@@ -221,6 +258,39 @@ function reapply_global_munge () {
|
||||
return self;
|
||||
}
|
||||
|
||||
// generate_plugin_config_munge
|
||||
// Generate the munge object from config.xml
|
||||
PlatformMunger.prototype.generate_config_xml_munge = generate_config_xml_munge;
|
||||
function generate_config_xml_munge(config, edit_config_changes, type) {
|
||||
|
||||
var munge = { files: {} };
|
||||
var changes = edit_config_changes;
|
||||
var id;
|
||||
|
||||
if(!changes) {
|
||||
return munge;
|
||||
}
|
||||
|
||||
if (type === 'config.xml') {
|
||||
id = type;
|
||||
}
|
||||
else {
|
||||
id = config.id;
|
||||
}
|
||||
|
||||
changes.forEach(function(change) {
|
||||
change.xmls.forEach(function(xml) {
|
||||
// 1. stringify each xml
|
||||
var stringified = (new et.ElementTree(xml)).write({xml_declaration:false});
|
||||
// 2. add into munge
|
||||
if (change.mode) {
|
||||
mungeutil.deep_add(munge, change.file, change.target, { xml: stringified, count: 1, mode: change.mode, id: id });
|
||||
}
|
||||
});
|
||||
});
|
||||
return munge;
|
||||
}
|
||||
|
||||
|
||||
// generate_plugin_config_munge
|
||||
// Generate the munge object from plugin.xml + vars
|
||||
@@ -236,92 +306,6 @@ function generate_plugin_config_munge(pluginInfo, vars, edit_config_changes) {
|
||||
Array.prototype.push.apply(changes, edit_config_changes);
|
||||
}
|
||||
|
||||
// Demux 'package.appxmanifest' into relevant platform-specific appx manifests.
|
||||
// Only spend the cycles if there are version-specific plugin settings
|
||||
if (self.platform === 'windows' &&
|
||||
changes.some(function(change) {
|
||||
return ((typeof change.versions !== 'undefined') ||
|
||||
(typeof change.deviceTarget !== 'undefined'));
|
||||
}))
|
||||
{
|
||||
var manifests = {
|
||||
'windows': {
|
||||
'8.1.0': 'package.windows.appxmanifest',
|
||||
'10.0.0': 'package.windows10.appxmanifest'
|
||||
},
|
||||
'phone': {
|
||||
'8.1.0': 'package.phone.appxmanifest',
|
||||
'10.0.0': 'package.windows10.appxmanifest'
|
||||
},
|
||||
'all': {
|
||||
'8.1.0': ['package.windows.appxmanifest', 'package.phone.appxmanifest'],
|
||||
'10.0.0': 'package.windows10.appxmanifest'
|
||||
}
|
||||
};
|
||||
|
||||
var oldChanges = changes;
|
||||
changes = [];
|
||||
|
||||
oldChanges.forEach(function(change, changeIndex) {
|
||||
// Only support semver/device-target demux for package.appxmanifest
|
||||
// Pass through in case something downstream wants to use it
|
||||
if (change.target !== 'package.appxmanifest') {
|
||||
changes.push(change);
|
||||
return;
|
||||
}
|
||||
|
||||
var hasVersion = (typeof change.versions !== 'undefined');
|
||||
var hasTargets = (typeof change.deviceTarget !== 'undefined');
|
||||
|
||||
// No semver/device-target for this config-file, pass it through
|
||||
if (!(hasVersion || hasTargets)) {
|
||||
changes.push(change);
|
||||
return;
|
||||
}
|
||||
|
||||
var targetDeviceSet = hasTargets ? change.deviceTarget : 'all';
|
||||
if (['windows', 'phone', 'all'].indexOf(targetDeviceSet) === -1) {
|
||||
// target-device couldn't be resolved, fix it up here to a valid value
|
||||
targetDeviceSet = 'all';
|
||||
}
|
||||
var knownWindowsVersionsForTargetDeviceSet = Object.keys(manifests[targetDeviceSet]);
|
||||
|
||||
// at this point, 'change' targets package.appxmanifest and has a version attribute
|
||||
knownWindowsVersionsForTargetDeviceSet.forEach(function(winver) {
|
||||
// This is a local function that creates the new replacement representing the
|
||||
// mutation. Used to save code further down.
|
||||
var createReplacement = function(manifestFile, originalChange) {
|
||||
var replacement = {
|
||||
target: manifestFile,
|
||||
parent: originalChange.parent,
|
||||
after: originalChange.after,
|
||||
xmls: originalChange.xmls,
|
||||
versions: originalChange.versions,
|
||||
deviceTarget: originalChange.deviceTarget
|
||||
};
|
||||
return replacement;
|
||||
};
|
||||
|
||||
// version doesn't satisfy, so skip
|
||||
if (hasVersion && !semver.satisfies(winver, change.versions)) {
|
||||
return;
|
||||
}
|
||||
|
||||
var versionSpecificManifests = manifests[targetDeviceSet][winver];
|
||||
if (versionSpecificManifests.constructor === Array) {
|
||||
// e.g. all['8.1.0'] === ['pkg.windows.appxmanifest', 'pkg.phone.appxmanifest']
|
||||
versionSpecificManifests.forEach(function(manifestFile) {
|
||||
changes.push(createReplacement(manifestFile, change));
|
||||
});
|
||||
}
|
||||
else {
|
||||
// versionSpecificManifests is actually a single string
|
||||
changes.push(createReplacement(versionSpecificManifests, change));
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
changes.forEach(function(change) {
|
||||
change.xmls.forEach(function(xml) {
|
||||
// 1. stringify each xml
|
||||
@@ -335,7 +319,9 @@ function generate_plugin_config_munge(pluginInfo, vars, edit_config_changes) {
|
||||
}
|
||||
// 2. add into munge
|
||||
if (change.mode) {
|
||||
mungeutil.deep_add(munge, change.file, change.target, { xml: stringified, count: 1, mode: change.mode, plugin: pluginInfo.id });
|
||||
if (change.mode !== 'remove') {
|
||||
mungeutil.deep_add(munge, change.file, change.target, { xml: stringified, count: 1, mode: change.mode, plugin: pluginInfo.id });
|
||||
}
|
||||
}
|
||||
else {
|
||||
mungeutil.deep_add(munge, change.target, change.parent, { xml: stringified, count: 1, after: change.after });
|
||||
@@ -348,7 +334,9 @@ function generate_plugin_config_munge(pluginInfo, vars, edit_config_changes) {
|
||||
function is_conflicting(editchanges, config_munge, self, force) {
|
||||
var files = config_munge.files;
|
||||
var conflictFound = false;
|
||||
var conflictWithConfigxml = false;
|
||||
var conflictingMunge = { files: {} };
|
||||
var configxmlMunge = { files: {} };
|
||||
var conflictingParent;
|
||||
var conflictingPlugin;
|
||||
|
||||
@@ -378,23 +366,43 @@ function is_conflicting(editchanges, config_munge, self, force) {
|
||||
conflictingParent = editchange.target;
|
||||
}
|
||||
|
||||
if (target.length !== 0) {
|
||||
// conflict has been found, exit and throw an error
|
||||
if (target && target.length !== 0) {
|
||||
// conflict has been found
|
||||
conflictFound = true;
|
||||
if (!force) {
|
||||
// since there has been modifications to the attributes at this target,
|
||||
// the current plugin should not modify the attributes
|
||||
conflictingPlugin = target[0].plugin;
|
||||
return;
|
||||
}
|
||||
|
||||
// need to find all conflicts when --force is used, track conflicting munges
|
||||
mungeutil.deep_add(conflictingMunge, editchange.file, conflictingParent, target[0]);
|
||||
if (editchange.id === 'config.xml') {
|
||||
if (target[0].id === 'config.xml') {
|
||||
// Keep track of config.xml/config.xml edit-config conflicts
|
||||
mungeutil.deep_add(configxmlMunge, editchange.file, conflictingParent, target[0]);
|
||||
}
|
||||
else {
|
||||
// Keep track of config.xml x plugin.xml edit-config conflicts
|
||||
mungeutil.deep_add(conflictingMunge, editchange.file, conflictingParent, target[0]);
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (target[0].id === 'config.xml') {
|
||||
// plugin.xml cannot overwrite config.xml changes even if --force is used
|
||||
conflictWithConfigxml = true;
|
||||
return;
|
||||
}
|
||||
|
||||
if (force) {
|
||||
// Need to find all conflicts when --force is used, track conflicting munges
|
||||
mungeutil.deep_add(conflictingMunge, editchange.file, conflictingParent, target[0]);
|
||||
}
|
||||
else {
|
||||
// plugin cannot overwrite other plugin changes without --force
|
||||
conflictingPlugin = target[0].plugin;
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
return {conflictFound: conflictFound, conflictingPlugin: conflictingPlugin, conflictingMunge: conflictingMunge};
|
||||
return {conflictFound: conflictFound, conflictingPlugin: conflictingPlugin, conflictingMunge: conflictingMunge,
|
||||
configxmlMunge: configxmlMunge, conflictWithConfigxml:conflictWithConfigxml};
|
||||
}
|
||||
|
||||
// Go over the prepare queue and apply the config munges for each plugin
|
||||
|
||||
12
node_modules/cordova-common/src/ConfigChanges/ConfigFile.js
generated
vendored
@@ -110,6 +110,9 @@ ConfigFile.prototype.graft_child = function ConfigFile_graft_child(selector, xml
|
||||
case 'overwrite':
|
||||
result = modules.xml_helpers.graftXMLOverwrite(self.data, xml_to_graft, selector, xml_child);
|
||||
break;
|
||||
case 'remove':
|
||||
result= true;
|
||||
break;
|
||||
default:
|
||||
result = modules.xml_helpers.graftXML(self.data, xml_to_graft, selector, xml_child.after);
|
||||
}
|
||||
@@ -137,6 +140,9 @@ ConfigFile.prototype.prune_child = function ConfigFile_prune_child(selector, xml
|
||||
case 'overwrite':
|
||||
result = modules.xml_helpers.pruneXMLRestore(self.data, selector, xml_child);
|
||||
break;
|
||||
case 'remove':
|
||||
result = modules.xml_helpers.prunXMLRemove(self.data, selector, xml_to_graft);
|
||||
break;
|
||||
default:
|
||||
result = modules.xml_helpers.pruneXML(self.data, xml_to_graft, selector);
|
||||
}
|
||||
@@ -193,6 +199,12 @@ function resolveConfigFilePath(project_dir, platform, file) {
|
||||
return filepath;
|
||||
}
|
||||
|
||||
// XXX this checks for android studio projects
|
||||
// only if none of the options above are satisfied does this get called
|
||||
if(platform === 'android' && !fs.existsSync(filepath)) {
|
||||
filepath = path.join(project_dir, 'app', 'src', 'main', 'res', 'xml', 'config.xml');
|
||||
}
|
||||
|
||||
// None of the special cases matched, returning project_dir/file.
|
||||
return filepath;
|
||||
}
|
||||
|
||||
78
node_modules/cordova-common/src/ConfigParser/ConfigParser.js
generated
vendored
@@ -116,6 +116,16 @@ ConfigParser.prototype = {
|
||||
var el = findOrCreate(this.doc, 'name');
|
||||
el.text = name;
|
||||
},
|
||||
shortName: function() {
|
||||
return this.doc.find('name').attrib['short'] || this.name();
|
||||
},
|
||||
setShortName: function(shortname) {
|
||||
var el = findOrCreate(this.doc, 'name');
|
||||
if (!el.text) {
|
||||
el.text = shortname;
|
||||
}
|
||||
el.attrib['short'] = shortname;
|
||||
},
|
||||
description: function() {
|
||||
return getNodeTextSafe(this.doc.find('description'));
|
||||
},
|
||||
@@ -256,6 +266,30 @@ ConfigParser.prototype = {
|
||||
return this.getStaticResources(platform, 'splash');
|
||||
},
|
||||
|
||||
/**
|
||||
* Returns all resource-files for a specific platform.
|
||||
* @param {string} platform Platform name
|
||||
* @return {Resource[]} Array of resource file objects.
|
||||
*/
|
||||
getFileResources: function(platform) {
|
||||
var fileResources = [];
|
||||
|
||||
if (platform) { // platform specific resources
|
||||
fileResources = this.doc.findall('platform[@name=\'' + platform + '\']/resource-file').map(function(tag) {
|
||||
return {
|
||||
platform: platform,
|
||||
src: tag.attrib.src,
|
||||
target: tag.attrib.target,
|
||||
versions: tag.attrib.versions,
|
||||
deviceTarget: tag.attrib['device-target'],
|
||||
arch: tag.attrib.arch
|
||||
};
|
||||
});
|
||||
}
|
||||
|
||||
return fileResources;
|
||||
},
|
||||
|
||||
/**
|
||||
* Returns all hook scripts for the hook type specified.
|
||||
* @param {String} hook The hook type.
|
||||
@@ -448,10 +482,19 @@ ConfigParser.prototype = {
|
||||
return accesses.map(function(access){
|
||||
var minimum_tls_version = access.attrib['minimum-tls-version']; /* String */
|
||||
var requires_forward_secrecy = access.attrib['requires-forward-secrecy']; /* Boolean */
|
||||
var requires_certificate_transparency = access.attrib['requires-certificate-transparency']; /* Boolean */
|
||||
var allows_arbitrary_loads_in_web_content = access.attrib['allows-arbitrary-loads-in-web-content']; /* Boolean */
|
||||
var allows_arbitrary_loads_in_media = access.attrib['allows-arbitrary-loads-in-media']; /* Boolean */
|
||||
var allows_local_networking = access.attrib['allows-local-networking']; /* Boolean */
|
||||
|
||||
return {
|
||||
'origin': access.attrib.origin,
|
||||
'minimum_tls_version': minimum_tls_version,
|
||||
'requires_forward_secrecy' : requires_forward_secrecy
|
||||
'requires_forward_secrecy' : requires_forward_secrecy,
|
||||
'requires_certificate_transparency' : requires_certificate_transparency,
|
||||
'allows_arbitrary_loads_in_web_content' : allows_arbitrary_loads_in_web_content,
|
||||
'allows_arbitrary_loads_in_media' : allows_arbitrary_loads_in_media,
|
||||
'allows_local_networking' : allows_local_networking
|
||||
};
|
||||
});
|
||||
},
|
||||
@@ -461,13 +504,44 @@ ConfigParser.prototype = {
|
||||
return allow_navigations.map(function(allow_navigation){
|
||||
var minimum_tls_version = allow_navigation.attrib['minimum-tls-version']; /* String */
|
||||
var requires_forward_secrecy = allow_navigation.attrib['requires-forward-secrecy']; /* Boolean */
|
||||
var requires_certificate_transparency = allow_navigation.attrib['requires-certificate-transparency']; /* Boolean */
|
||||
|
||||
return {
|
||||
'href': allow_navigation.attrib.href,
|
||||
'minimum_tls_version': minimum_tls_version,
|
||||
'requires_forward_secrecy' : requires_forward_secrecy
|
||||
'requires_forward_secrecy' : requires_forward_secrecy,
|
||||
'requires_certificate_transparency' : requires_certificate_transparency
|
||||
};
|
||||
});
|
||||
},
|
||||
/* Get all the allow-intent tags */
|
||||
getAllowIntents: function() {
|
||||
var allow_intents = this.doc.findall('./allow-intent');
|
||||
return allow_intents.map(function(allow_intent){
|
||||
return {
|
||||
'href': allow_intent.attrib.href
|
||||
};
|
||||
});
|
||||
},
|
||||
/* Get all edit-config tags */
|
||||
getEditConfigs: function(platform) {
|
||||
var platform_tag = this.doc.find('./platform[@name="' + platform + '"]');
|
||||
var platform_edit_configs = platform_tag ? platform_tag.findall('edit-config') : [];
|
||||
|
||||
var edit_configs = this.doc.findall('edit-config').concat(platform_edit_configs);
|
||||
|
||||
return edit_configs.map(function(tag) {
|
||||
var editConfig =
|
||||
{
|
||||
file : tag.attrib['file'],
|
||||
target : tag.attrib['target'],
|
||||
mode : tag.attrib['mode'],
|
||||
id : 'config.xml',
|
||||
xmls : tag.getchildren()
|
||||
};
|
||||
return editConfig;
|
||||
});
|
||||
},
|
||||
write:function() {
|
||||
fs.writeFileSync(this.path, this.doc.write({indent: 4}), 'utf-8');
|
||||
}
|
||||
|
||||
82
node_modules/cordova-common/src/FileUpdater.js
generated
vendored
@@ -285,14 +285,14 @@ function mergeAndUpdateDir(sourceDirs, targetDir, options, log) {
|
||||
}
|
||||
|
||||
// Scan the files in each of the source directories.
|
||||
var sourceMaps = [];
|
||||
for (var i in sourceDirs) {
|
||||
var sourceFullPath = path.join(rootDir, sourceDirs[i]);
|
||||
if (!fs.existsSync(sourceFullPath)) {
|
||||
throw new Error("Source directory does not exist: " + sourceDirs[i]);
|
||||
}
|
||||
sourceMaps[i] = mapDirectory(rootDir, sourceDirs[i], include, exclude);
|
||||
}
|
||||
var sourceMaps = sourceDirs.map(function (sourceDir) {
|
||||
return path.join(rootDir, sourceDir);
|
||||
}).map(function (sourcePath) {
|
||||
if (!fs.existsSync(sourcePath)) {
|
||||
throw new Error("Source directory does not exist: " + sourcePath);
|
||||
}
|
||||
return mapDirectory(rootDir, path.relative(rootDir, sourcePath), include, exclude);
|
||||
});
|
||||
|
||||
// Scan the files in the target directory, if it exists.
|
||||
var targetMap = {};
|
||||
@@ -331,46 +331,40 @@ function mapDirectory(rootDir, subDir, include, exclude) {
|
||||
function mapSubdirectory(rootDir, subDir, relativeDir, include, exclude, dirMap) {
|
||||
var itemMapped = false;
|
||||
var items = fs.readdirSync(path.join(rootDir, subDir, relativeDir));
|
||||
for (var i in items) {
|
||||
var relativePath = path.join(relativeDir, items[i]);
|
||||
|
||||
// Skip any files or directories (and everything under) that match an exclude glob.
|
||||
if (matchGlobArray(relativePath, exclude)) {
|
||||
continue;
|
||||
}
|
||||
items.forEach(function(item) {
|
||||
var relativePath = path.join(relativeDir, item);
|
||||
if(!matchGlobArray(relativePath, exclude)) {
|
||||
// Stats obtained here (required at least to know where to recurse in directories)
|
||||
// are saved for later, where the modified times may also be used. This minimizes
|
||||
// the number of file I/O operations performed.
|
||||
var fullPath = path.join(rootDir, subDir, relativePath);
|
||||
var stats = fs.statSync(fullPath);
|
||||
|
||||
// Stats obtained here (required at least to know where to recurse in directories)
|
||||
// are saved for later, where the modified times may also be used. This minimizes
|
||||
// the number of file I/O operations performed.
|
||||
var fullPath = path.join(rootDir, subDir, relativePath);
|
||||
var stats = fs.statSync(fullPath);
|
||||
|
||||
if (stats.isDirectory()) {
|
||||
// Directories are included if either something under them is included or they
|
||||
// match an include glob.
|
||||
if (mapSubdirectory(rootDir, subDir, relativePath, include, exclude, dirMap) ||
|
||||
matchGlobArray(relativePath, include)) {
|
||||
dirMap[relativePath] = { subDir: subDir, stats: stats };
|
||||
itemMapped = true;
|
||||
}
|
||||
} else if (stats.isFile()) {
|
||||
// Files are included only if they match an include glob.
|
||||
if (matchGlobArray(relativePath, include)) {
|
||||
dirMap[relativePath] = { subDir: subDir, stats: stats };
|
||||
itemMapped = true;
|
||||
if (stats.isDirectory()) {
|
||||
// Directories are included if either something under them is included or they
|
||||
// match an include glob.
|
||||
if (mapSubdirectory(rootDir, subDir, relativePath, include, exclude, dirMap) ||
|
||||
matchGlobArray(relativePath, include)) {
|
||||
dirMap[relativePath] = { subDir: subDir, stats: stats };
|
||||
itemMapped = true;
|
||||
}
|
||||
} else if (stats.isFile()) {
|
||||
// Files are included only if they match an include glob.
|
||||
if (matchGlobArray(relativePath, include)) {
|
||||
dirMap[relativePath] = { subDir: subDir, stats: stats };
|
||||
itemMapped = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
return itemMapped;
|
||||
}
|
||||
|
||||
function matchGlobArray(path, globs) {
|
||||
for (var i in globs) {
|
||||
if (minimatch(path, globs[i])) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
return globs.some(function(elem) {
|
||||
return minimatch(path, elem, {dot:true});
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -384,7 +378,7 @@ function mergePathMaps(sourceMaps, targetMap, targetDir) {
|
||||
// Target stats will be filled in below for targets that exist.
|
||||
var pathMap = {};
|
||||
sourceMaps.forEach(function (sourceMap) {
|
||||
for (var sourceSubPath in sourceMap) {
|
||||
Object.keys(sourceMap).forEach(function(sourceSubPath){
|
||||
var sourceEntry = sourceMap[sourceSubPath];
|
||||
pathMap[sourceSubPath] = {
|
||||
targetPath: path.join(targetDir, sourceSubPath),
|
||||
@@ -392,12 +386,12 @@ function mergePathMaps(sourceMaps, targetMap, targetDir) {
|
||||
sourcePath: path.join(sourceEntry.subDir, sourceSubPath),
|
||||
sourceStats: sourceEntry.stats
|
||||
};
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
// Fill in target stats for targets that exist, and create entries
|
||||
// for targets that don't have any corresponding sources.
|
||||
for (var subPath in targetMap) {
|
||||
Object.keys(targetMap).forEach(function(subPath){
|
||||
var entry = pathMap[subPath];
|
||||
if (entry) {
|
||||
entry.targetStats = targetMap[subPath].stats;
|
||||
@@ -409,7 +403,7 @@ function mergePathMaps(sourceMaps, targetMap, targetDir) {
|
||||
sourceStats: null
|
||||
};
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
return pathMap;
|
||||
}
|
||||
|
||||
8
node_modules/cordova-common/src/PluginInfo/PluginInfo.js
generated
vendored
@@ -108,6 +108,7 @@ function PluginInfo(dirname) {
|
||||
function _parseDependency(tag) {
|
||||
var dep =
|
||||
{ id : tag.attrib.id
|
||||
, version: tag.attrib.version || ''
|
||||
, url : tag.attrib.url || ''
|
||||
, subdir : tag.attrib.subdir || ''
|
||||
, commit : tag.attrib.commit
|
||||
@@ -225,7 +226,8 @@ function PluginInfo(dirname) {
|
||||
target: tag.attrib.target,
|
||||
versions: tag.attrib.versions,
|
||||
deviceTarget: tag.attrib['device-target'],
|
||||
arch: tag.attrib.arch
|
||||
arch: tag.attrib.arch,
|
||||
reference: tag.attrib.reference
|
||||
};
|
||||
});
|
||||
return resourceFiles;
|
||||
@@ -317,13 +319,15 @@ function PluginInfo(dirname) {
|
||||
type: el.attrib.type,
|
||||
parent: el.attrib.parent,
|
||||
custom: isStrTrue(el.attrib.custom),
|
||||
embed: isStrTrue(el.attrib.embed),
|
||||
src: el.attrib.src,
|
||||
spec: el.attrib.spec,
|
||||
weak: isStrTrue(el.attrib.weak),
|
||||
versions: el.attrib.versions,
|
||||
targetDir: el.attrib['target-dir'],
|
||||
deviceTarget: el.attrib['device-target'] || el.attrib.target,
|
||||
arch: el.attrib.arch
|
||||
arch: el.attrib.arch,
|
||||
implementation: el.attrib.implementation
|
||||
};
|
||||
return ret;
|
||||
});
|
||||
|
||||
1
node_modules/cordova-common/src/events.js
generated
vendored
@@ -20,6 +20,7 @@
|
||||
var EventEmitter = require('events').EventEmitter;
|
||||
|
||||
var INSTANCE = new EventEmitter();
|
||||
INSTANCE.setMaxListeners(20);
|
||||
var EVENTS_RECEIVER;
|
||||
|
||||
module.exports = INSTANCE;
|
||||
|
||||
6
node_modules/cordova-common/src/superspawn.js
generated
vendored
@@ -167,6 +167,12 @@ exports.spawn = function(cmd, args, opts) {
|
||||
errMsg += ' Error output:\n' + capturedErr.trim();
|
||||
}
|
||||
var err = new Error(errMsg);
|
||||
if (capturedErr) {
|
||||
err.stderr = capturedErr;
|
||||
}
|
||||
if (capturedOut) {
|
||||
err.stdout = capturedOut;
|
||||
}
|
||||
err.code = code;
|
||||
d.reject(err);
|
||||
}
|
||||
|
||||
36
node_modules/cordova-common/src/util/plist-helpers.js
generated
vendored
@@ -1,21 +1,21 @@
|
||||
/*
|
||||
*
|
||||
* Copyright 2013 Brett Rudd
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*
|
||||
*/
|
||||
/**
|
||||
Licensed to the Apache Software Foundation (ASF) under one
|
||||
or more contributor license agreements. See the NOTICE file
|
||||
distributed with this work for additional information
|
||||
regarding copyright ownership. The ASF licenses this file
|
||||
to you under the Apache License, Version 2.0 (the
|
||||
"License"); you may not use this file except in compliance
|
||||
with the License. You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing,
|
||||
software distributed under the License is distributed on an
|
||||
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
KIND, either express or implied. See the License for the
|
||||
specific language governing permissions and limitations
|
||||
under the License.
|
||||
*/
|
||||
|
||||
// contains PLIST utility functions
|
||||
var __ = require('underscore');
|
||||
|
||||
53
node_modules/cordova-common/src/util/xml-helpers.js
generated
vendored
@@ -1,21 +1,21 @@
|
||||
/*
|
||||
*
|
||||
* Copyright 2013 Anis Kadri
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*
|
||||
*/
|
||||
/**
|
||||
Licensed to the Apache Software Foundation (ASF) under one
|
||||
or more contributor license agreements. See the NOTICE file
|
||||
distributed with this work for additional information
|
||||
regarding copyright ownership. The ASF licenses this file
|
||||
to you under the Apache License, Version 2.0 (the
|
||||
"License"); you may not use this file except in compliance
|
||||
with the License. You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing,
|
||||
software distributed under the License is distributed on an
|
||||
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
KIND, either express or implied. See the License for the
|
||||
specific language governing permissions and limitations
|
||||
under the License.
|
||||
*/
|
||||
|
||||
/* jshint sub:true, laxcomma:true */
|
||||
|
||||
@@ -160,6 +160,23 @@ module.exports = {
|
||||
return true;
|
||||
},
|
||||
|
||||
prunXMLRemove: function(doc, selector, nodes) {
|
||||
var target = module.exports.resolveParent(doc, selector);
|
||||
if (!target) return false;
|
||||
|
||||
nodes.forEach(function (node) {
|
||||
var attributes = node.attrib;
|
||||
for (var attribute in attributes) {
|
||||
if (target.attrib[attribute]) {
|
||||
delete target.attrib[attribute];
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
return true;
|
||||
|
||||
},
|
||||
|
||||
|
||||
parseElementtreeSync: function (filename) {
|
||||
var contents = fs.readFileSync(filename, 'utf-8');
|
||||
|
||||
1
node_modules/cordova-registry-mapper/package.json
generated
vendored
@@ -16,7 +16,6 @@
|
||||
"_from": "cordova-registry-mapper@>=1.1.8 <2.0.0",
|
||||
"_id": "cordova-registry-mapper@1.1.15",
|
||||
"_inCache": true,
|
||||
"_installable": true,
|
||||
"_location": "/cordova-registry-mapper",
|
||||
"_nodeVersion": "5.4.1",
|
||||
"_npmUser": {
|
||||
|
||||
21
node_modules/elementtree/package.json
generated
vendored
@@ -2,21 +2,20 @@
|
||||
"_args": [
|
||||
[
|
||||
{
|
||||
"raw": "elementtree@^0.1.6",
|
||||
"raw": "elementtree@0.1.6",
|
||||
"scope": null,
|
||||
"escapedName": "elementtree",
|
||||
"name": "elementtree",
|
||||
"rawSpec": "^0.1.6",
|
||||
"spec": ">=0.1.6 <0.2.0",
|
||||
"type": "range"
|
||||
"rawSpec": "0.1.6",
|
||||
"spec": "0.1.6",
|
||||
"type": "version"
|
||||
},
|
||||
"/Users/steveng/repo/cordova/cordova-android"
|
||||
]
|
||||
],
|
||||
"_from": "elementtree@>=0.1.6 <0.2.0",
|
||||
"_from": "elementtree@0.1.6",
|
||||
"_id": "elementtree@0.1.6",
|
||||
"_inCache": true,
|
||||
"_installable": true,
|
||||
"_location": "/elementtree",
|
||||
"_npmUser": {
|
||||
"name": "rphillips",
|
||||
@@ -25,13 +24,13 @@
|
||||
"_npmVersion": "1.3.24",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"raw": "elementtree@^0.1.6",
|
||||
"raw": "elementtree@0.1.6",
|
||||
"scope": null,
|
||||
"escapedName": "elementtree",
|
||||
"name": "elementtree",
|
||||
"rawSpec": "^0.1.6",
|
||||
"spec": ">=0.1.6 <0.2.0",
|
||||
"type": "range"
|
||||
"rawSpec": "0.1.6",
|
||||
"spec": "0.1.6",
|
||||
"type": "version"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/",
|
||||
@@ -40,7 +39,7 @@
|
||||
"_resolved": "http://registry.npmjs.org/elementtree/-/elementtree-0.1.6.tgz",
|
||||
"_shasum": "2ac4c46ea30516c8c4cbdb5e3ac7418e592de20c",
|
||||
"_shrinkwrap": null,
|
||||
"_spec": "elementtree@^0.1.6",
|
||||
"_spec": "elementtree@0.1.6",
|
||||
"_where": "/Users/steveng/repo/cordova/cordova-android",
|
||||
"author": {
|
||||
"name": "Rackspace US, Inc."
|
||||
|
||||
1
node_modules/glob/package.json
generated
vendored
@@ -16,7 +16,6 @@
|
||||
"_from": "glob@>=5.0.13 <6.0.0",
|
||||
"_id": "glob@5.0.15",
|
||||
"_inCache": true,
|
||||
"_installable": true,
|
||||
"_location": "/glob",
|
||||
"_nodeVersion": "4.0.0",
|
||||
"_npmUser": {
|
||||
|
||||
34
node_modules/inflight/inflight.js
generated
vendored
@@ -19,18 +19,28 @@ function makeres (key) {
|
||||
var cbs = reqs[key]
|
||||
var len = cbs.length
|
||||
var args = slice(arguments)
|
||||
for (var i = 0; i < len; i++) {
|
||||
cbs[i].apply(null, args)
|
||||
}
|
||||
if (cbs.length > len) {
|
||||
// added more in the interim.
|
||||
// de-zalgo, just in case, but don't call again.
|
||||
cbs.splice(0, len)
|
||||
process.nextTick(function () {
|
||||
RES.apply(null, args)
|
||||
})
|
||||
} else {
|
||||
delete reqs[key]
|
||||
|
||||
// XXX It's somewhat ambiguous whether a new callback added in this
|
||||
// pass should be queued for later execution if something in the
|
||||
// list of callbacks throws, or if it should just be discarded.
|
||||
// However, it's such an edge case that it hardly matters, and either
|
||||
// choice is likely as surprising as the other.
|
||||
// As it happens, we do go ahead and schedule it for later execution.
|
||||
try {
|
||||
for (var i = 0; i < len; i++) {
|
||||
cbs[i].apply(null, args)
|
||||
}
|
||||
} finally {
|
||||
if (cbs.length > len) {
|
||||
// added more in the interim.
|
||||
// de-zalgo, just in case, but don't call again.
|
||||
cbs.splice(0, len)
|
||||
process.nextTick(function () {
|
||||
RES.apply(null, args)
|
||||
})
|
||||
} else {
|
||||
delete reqs[key]
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
31
node_modules/inflight/package.json
generated
vendored
@@ -14,20 +14,19 @@
|
||||
]
|
||||
],
|
||||
"_from": "inflight@>=1.0.4 <2.0.0",
|
||||
"_id": "inflight@1.0.5",
|
||||
"_id": "inflight@1.0.6",
|
||||
"_inCache": true,
|
||||
"_installable": true,
|
||||
"_location": "/inflight",
|
||||
"_nodeVersion": "5.10.1",
|
||||
"_nodeVersion": "6.5.0",
|
||||
"_npmOperationalInternal": {
|
||||
"host": "packages-12-west.internal.npmjs.com",
|
||||
"tmp": "tmp/inflight-1.0.5.tgz_1463529611443_0.00041943578980863094"
|
||||
"host": "packages-16-east.internal.npmjs.com",
|
||||
"tmp": "tmp/inflight-1.0.6.tgz_1476330807696_0.10388551792129874"
|
||||
},
|
||||
"_npmUser": {
|
||||
"name": "zkat",
|
||||
"email": "kat@sykosomatic.org"
|
||||
"name": "isaacs",
|
||||
"email": "i@izs.me"
|
||||
},
|
||||
"_npmVersion": "3.9.1",
|
||||
"_npmVersion": "3.10.7",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"raw": "inflight@^1.0.4",
|
||||
@@ -41,8 +40,8 @@
|
||||
"_requiredBy": [
|
||||
"/glob"
|
||||
],
|
||||
"_resolved": "http://registry.npmjs.org/inflight/-/inflight-1.0.5.tgz",
|
||||
"_shasum": "db3204cd5a9de2e6cd890b85c6e2f66bcf4f620a",
|
||||
"_resolved": "http://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz",
|
||||
"_shasum": "49bd6331d7d02d0c09bc910a1075ba8165b56df9",
|
||||
"_shrinkwrap": null,
|
||||
"_spec": "inflight@^1.0.4",
|
||||
"_where": "/Users/steveng/repo/cordova/cordova-android/node_modules/glob",
|
||||
@@ -60,17 +59,17 @@
|
||||
},
|
||||
"description": "Add callbacks to requests in flight to avoid async duplication",
|
||||
"devDependencies": {
|
||||
"tap": "^1.2.0"
|
||||
"tap": "^7.1.2"
|
||||
},
|
||||
"directories": {},
|
||||
"dist": {
|
||||
"shasum": "db3204cd5a9de2e6cd890b85c6e2f66bcf4f620a",
|
||||
"tarball": "https://registry.npmjs.org/inflight/-/inflight-1.0.5.tgz"
|
||||
"shasum": "49bd6331d7d02d0c09bc910a1075ba8165b56df9",
|
||||
"tarball": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz"
|
||||
},
|
||||
"files": [
|
||||
"inflight.js"
|
||||
],
|
||||
"gitHead": "559e37b4f6327fca797fe8d7fe8ed6d9cae08821",
|
||||
"gitHead": "a547881738c8f57b27795e584071d67cf6ac1a57",
|
||||
"homepage": "https://github.com/isaacs/inflight",
|
||||
"license": "ISC",
|
||||
"main": "inflight.js",
|
||||
@@ -100,7 +99,7 @@
|
||||
"url": "git+https://github.com/npm/inflight.git"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "tap test.js"
|
||||
"test": "tap test.js --100"
|
||||
},
|
||||
"version": "1.0.5"
|
||||
"version": "1.0.6"
|
||||
}
|
||||
|
||||
8
node_modules/inherits/inherits.js
generated
vendored
@@ -1 +1,7 @@
|
||||
module.exports = require('util').inherits
|
||||
try {
|
||||
var util = require('util');
|
||||
if (typeof util.inherits !== 'function') throw '';
|
||||
module.exports = util.inherits;
|
||||
} catch (e) {
|
||||
module.exports = require('./inherits_browser.js');
|
||||
}
|
||||
|
||||
29
node_modules/inherits/package.json
generated
vendored
@@ -14,15 +14,19 @@
|
||||
]
|
||||
],
|
||||
"_from": "inherits@>=2.0.0 <3.0.0",
|
||||
"_id": "inherits@2.0.1",
|
||||
"_id": "inherits@2.0.3",
|
||||
"_inCache": true,
|
||||
"_installable": true,
|
||||
"_location": "/inherits",
|
||||
"_nodeVersion": "6.5.0",
|
||||
"_npmOperationalInternal": {
|
||||
"host": "packages-16-east.internal.npmjs.com",
|
||||
"tmp": "tmp/inherits-2.0.3.tgz_1473295776489_0.08142363070510328"
|
||||
},
|
||||
"_npmUser": {
|
||||
"name": "isaacs",
|
||||
"email": "i@izs.me"
|
||||
},
|
||||
"_npmVersion": "1.3.8",
|
||||
"_npmVersion": "3.10.7",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"raw": "inherits@2",
|
||||
@@ -36,8 +40,8 @@
|
||||
"_requiredBy": [
|
||||
"/glob"
|
||||
],
|
||||
"_resolved": "http://registry.npmjs.org/inherits/-/inherits-2.0.1.tgz",
|
||||
"_shasum": "b17d08d326b4423e568eff719f91b0b1cbdf69f1",
|
||||
"_resolved": "http://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz",
|
||||
"_shasum": "633c2c83e3da42a502f52466022480f4208261de",
|
||||
"_shrinkwrap": null,
|
||||
"_spec": "inherits@2",
|
||||
"_where": "/Users/steveng/repo/cordova/cordova-android/node_modules/glob",
|
||||
@@ -47,12 +51,19 @@
|
||||
},
|
||||
"dependencies": {},
|
||||
"description": "Browser-friendly inheritance fully compatible with standard node.js inherits()",
|
||||
"devDependencies": {},
|
||||
"devDependencies": {
|
||||
"tap": "^7.1.0"
|
||||
},
|
||||
"directories": {},
|
||||
"dist": {
|
||||
"shasum": "b17d08d326b4423e568eff719f91b0b1cbdf69f1",
|
||||
"tarball": "https://registry.npmjs.org/inherits/-/inherits-2.0.1.tgz"
|
||||
"shasum": "633c2c83e3da42a502f52466022480f4208261de",
|
||||
"tarball": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz"
|
||||
},
|
||||
"files": [
|
||||
"inherits.js",
|
||||
"inherits_browser.js"
|
||||
],
|
||||
"gitHead": "e05d0fb27c61a3ec687214f0476386b765364d5f",
|
||||
"homepage": "https://github.com/isaacs/inherits#readme",
|
||||
"keywords": [
|
||||
"inheritance",
|
||||
@@ -82,5 +93,5 @@
|
||||
"scripts": {
|
||||
"test": "node test"
|
||||
},
|
||||
"version": "2.0.1"
|
||||
"version": "2.0.3"
|
||||
}
|
||||
|
||||
25
node_modules/inherits/test.js
generated
vendored
@@ -1,25 +0,0 @@
|
||||
var inherits = require('./inherits.js')
|
||||
var assert = require('assert')
|
||||
|
||||
function test(c) {
|
||||
assert(c.constructor === Child)
|
||||
assert(c.constructor.super_ === Parent)
|
||||
assert(Object.getPrototypeOf(c) === Child.prototype)
|
||||
assert(Object.getPrototypeOf(Object.getPrototypeOf(c)) === Parent.prototype)
|
||||
assert(c instanceof Child)
|
||||
assert(c instanceof Parent)
|
||||
}
|
||||
|
||||
function Child() {
|
||||
Parent.call(this)
|
||||
test(this)
|
||||
}
|
||||
|
||||
function Parent() {}
|
||||
|
||||
inherits(Child, Parent)
|
||||
|
||||
var c = new Child
|
||||
test(c)
|
||||
|
||||
console.log('ok')
|
||||
1
node_modules/lodash/package.json
generated
vendored
@@ -16,7 +16,6 @@
|
||||
"_from": "lodash@>=3.5.0 <4.0.0",
|
||||
"_id": "lodash@3.10.1",
|
||||
"_inCache": true,
|
||||
"_installable": true,
|
||||
"_location": "/lodash",
|
||||
"_nodeVersion": "0.12.5",
|
||||
"_npmUser": {
|
||||
|
||||
1
node_modules/minimatch/package.json
generated
vendored
@@ -16,7 +16,6 @@
|
||||
"_from": "minimatch@>=3.0.0 <4.0.0",
|
||||
"_id": "minimatch@3.0.3",
|
||||
"_inCache": true,
|
||||
"_installable": true,
|
||||
"_location": "/minimatch",
|
||||
"_nodeVersion": "4.4.4",
|
||||
"_npmOperationalInternal": {
|
||||
|
||||
1
node_modules/nopt/package.json
generated
vendored
@@ -16,7 +16,6 @@
|
||||
"_from": "nopt@>=3.0.1 <4.0.0",
|
||||
"_id": "nopt@3.0.6",
|
||||
"_inCache": true,
|
||||
"_installable": true,
|
||||
"_location": "/nopt",
|
||||
"_nodeVersion": "4.2.1",
|
||||
"_npmUser": {
|
||||
|
||||
28
node_modules/once/README.md
generated
vendored
@@ -49,3 +49,31 @@ function load (cb) {
|
||||
})
|
||||
}
|
||||
```
|
||||
|
||||
## `once.strict(func)`
|
||||
|
||||
Throw an error if the function is called twice.
|
||||
|
||||
Some functions are expected to be called only once. Using `once` for them would
|
||||
potentially hide logical errors.
|
||||
|
||||
In the example below, the `greet` function has to call the callback only once:
|
||||
|
||||
```javascript
|
||||
function greet (name, cb) {
|
||||
// return is missing from the if statement
|
||||
// when no name is passed, the callback is called twice
|
||||
if (!name) cb('Hello anonymous')
|
||||
cb('Hello ' + name)
|
||||
}
|
||||
|
||||
function log (msg) {
|
||||
console.log(msg)
|
||||
}
|
||||
|
||||
// this will print 'Hello anonymous' but the logical error will be missed
|
||||
greet(null, once(msg))
|
||||
|
||||
// once.strict will print 'Hello anonymous' and throw an error when the callback will be called the second time
|
||||
greet(null, once.strict(msg))
|
||||
```
|
||||
|
||||
21
node_modules/once/once.js
generated
vendored
@@ -1,5 +1,6 @@
|
||||
var wrappy = require('wrappy')
|
||||
module.exports = wrappy(once)
|
||||
module.exports.strict = wrappy(onceStrict)
|
||||
|
||||
once.proto = once(function () {
|
||||
Object.defineProperty(Function.prototype, 'once', {
|
||||
@@ -8,6 +9,13 @@ once.proto = once(function () {
|
||||
},
|
||||
configurable: true
|
||||
})
|
||||
|
||||
Object.defineProperty(Function.prototype, 'onceStrict', {
|
||||
value: function () {
|
||||
return onceStrict(this)
|
||||
},
|
||||
configurable: true
|
||||
})
|
||||
})
|
||||
|
||||
function once (fn) {
|
||||
@@ -19,3 +27,16 @@ function once (fn) {
|
||||
f.called = false
|
||||
return f
|
||||
}
|
||||
|
||||
function onceStrict (fn) {
|
||||
var f = function () {
|
||||
if (f.called)
|
||||
throw new Error(f.onceError)
|
||||
f.called = true
|
||||
return f.value = fn.apply(this, arguments)
|
||||
}
|
||||
var name = fn.name || 'Function wrapped with `once`'
|
||||
f.onceError = name + " shouldn't be called more than once"
|
||||
f.called = false
|
||||
return f
|
||||
}
|
||||
|
||||
25
node_modules/once/package.json
generated
vendored
@@ -14,16 +14,19 @@
|
||||
]
|
||||
],
|
||||
"_from": "once@>=1.3.0 <2.0.0",
|
||||
"_id": "once@1.3.3",
|
||||
"_id": "once@1.4.0",
|
||||
"_inCache": true,
|
||||
"_installable": true,
|
||||
"_location": "/once",
|
||||
"_nodeVersion": "4.0.0",
|
||||
"_nodeVersion": "6.5.0",
|
||||
"_npmOperationalInternal": {
|
||||
"host": "packages-12-west.internal.npmjs.com",
|
||||
"tmp": "tmp/once-1.4.0.tgz_1473196269128_0.537820661207661"
|
||||
},
|
||||
"_npmUser": {
|
||||
"name": "isaacs",
|
||||
"email": "i@izs.me"
|
||||
},
|
||||
"_npmVersion": "3.3.2",
|
||||
"_npmVersion": "3.10.7",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"raw": "once@^1.3.0",
|
||||
@@ -38,8 +41,8 @@
|
||||
"/glob",
|
||||
"/inflight"
|
||||
],
|
||||
"_resolved": "http://registry.npmjs.org/once/-/once-1.3.3.tgz",
|
||||
"_shasum": "b2e261557ce4c314ec8304f3fa82663e4297ca20",
|
||||
"_resolved": "http://registry.npmjs.org/once/-/once-1.4.0.tgz",
|
||||
"_shasum": "583b1aa775961d4b113ac17d9c50baef9dd76bd1",
|
||||
"_shrinkwrap": null,
|
||||
"_spec": "once@^1.3.0",
|
||||
"_where": "/Users/steveng/repo/cordova/cordova-android/node_modules/glob",
|
||||
@@ -56,19 +59,19 @@
|
||||
},
|
||||
"description": "Run a function exactly one time",
|
||||
"devDependencies": {
|
||||
"tap": "^1.2.0"
|
||||
"tap": "^7.0.1"
|
||||
},
|
||||
"directories": {
|
||||
"test": "test"
|
||||
},
|
||||
"dist": {
|
||||
"shasum": "b2e261557ce4c314ec8304f3fa82663e4297ca20",
|
||||
"tarball": "https://registry.npmjs.org/once/-/once-1.3.3.tgz"
|
||||
"shasum": "583b1aa775961d4b113ac17d9c50baef9dd76bd1",
|
||||
"tarball": "https://registry.npmjs.org/once/-/once-1.4.0.tgz"
|
||||
},
|
||||
"files": [
|
||||
"once.js"
|
||||
],
|
||||
"gitHead": "2ad558657e17fafd24803217ba854762842e4178",
|
||||
"gitHead": "0e614d9f5a7e6f0305c625f6b581f6d80b33b8a6",
|
||||
"homepage": "https://github.com/isaacs/once#readme",
|
||||
"keywords": [
|
||||
"once",
|
||||
@@ -94,5 +97,5 @@
|
||||
"scripts": {
|
||||
"test": "tap test/*.js"
|
||||
},
|
||||
"version": "1.3.3"
|
||||
"version": "1.4.0"
|
||||
}
|
||||
|
||||