Compare commits

..

81 Commits
5.2.2 ... 6.0.x

Author SHA1 Message Date
Joe Bowser
355aae7b4b Fix for broken testUrl test 2016-10-20 12:47:55 -07:00
Joe Bowser
5b4524ae12 Last minute change of test targets 2016-10-20 12:26:10 -07:00
Joe Bowser
33ac5c20b5 Set VERSION to 6.0.0 (via coho) 2016-10-20 11:49:03 -07:00
Joe Bowser
3ac3688d8c Update JS snapshot to version 6.0.0 (via coho) 2016-10-20 11:49:03 -07:00
Joe Bowser
81dfe96355 CB-12038 Updated RELEASENOTES and Version for release 6.0.0 2016-10-20 11:48:20 -07:00
Joe Bowser
efa23bd39b Updating the gradle build for test to use the latest 2016-10-20 11:25:06 -07:00
Joe Bowser
6aa4b1b301 CB-11083: Fixing syncronous file check and future-proofing the JS for Travis
This closes #323
2016-10-19 09:49:42 -07:00
Joe Bowser
304cbef5ed CB-11083: Reading files to check for CordovaLib dependency, if so, we exclude CordovaLib to be safe 2016-10-19 09:49:39 -07:00
Joe Bowser
263968e019 CB-11083: Plugin build script for dependencies without a gradle file 2016-10-19 09:49:39 -07:00
Joe Bowser
c05521e55a CB-11083: The GradleBuidler can tell the difference between a Cordova Plugin Framework and a regular framework based on the name 2016-10-19 09:49:39 -07:00
Joe Bowser
2f3c71feaa CB-11083 Fix to deal with custom frameworks with their own Gradle configuration 2016-10-19 09:49:39 -07:00
Steve Gill
0b710a86a9 CB-12003 updated node_modules 2016-10-17 10:50:30 -07:00
Martin Bektchiev
2e37d2c253 CB-11771 Deep symlink directories to target project instead of linking the directory itself
When installing a plugin with custom library using the --link option the whole directory is symlinked and temporary
files leak into the original plugin directory on build. This leads to broken builds if the same plugin is linked in
2 projects targeting different Cordova versions.

 This closes #326
2016-10-13 18:39:27 -07:00
Steve Gill
d7c1dc5517 updated .gitignore to include dev dep 2016-10-13 18:29:22 -07:00
Simon MacDonald
77b9fd62a7 Fix tab/space issue 2016-10-12 22:21:14 -04:00
Thomas Raffray
f838db4e18 CB-11880 android: Fail-safe for cordova.exec()
- added preliminary sanity check on args variable
- replication of iosExec() behaviour
- allows to call cordova.exec() without args variable

This closes #334
2016-10-12 15:20:40 -07:00
Jesse MacFadyen
b2d7124424 CB-11999 add message, catch exception if require fails 2016-10-12 11:48:06 -07:00
Joe Bowser
2532c4a39e This closes #308 2016-10-11 15:50:54 -07:00
Joe Bowser
be19585c68 Merge branch 'fix-appname-apostrophe' of https://github.com/revolunet/cordova-android
Using a merge commit to merge in a PR
This closes #272
2016-10-11 15:49:20 -07:00
Darryl Pogue
ca0cbad1c7 CB-8722 - Move icons from drawable to mipmap
This closes #340
2016-10-11 13:29:15 -07:00
Joe Bowser
fb53452d37 Unused requires cause AppVeyor to not work
This closes #339
2016-10-07 18:14:36 -07:00
Joe Bowser
b5246f3f09 Clean also wipes out the www directory, which was causing the strange errors that were happening when building 2016-10-07 18:14:36 -07:00
Joe Bowser
4be413af79 Removing try/catch now that we have the new tests and committing latest 2016-10-07 18:14:36 -07:00
Alexander Sorokin
5db2de95f5 CB-11964 Call clean after plugin install and mock it in tests 2016-10-07 18:14:36 -07:00
Joe Bowser
6418add83d Did a try/catch to deal with the unit tests vs actual project environment, code duplication is needed because of builderEnv 2016-10-07 18:14:36 -07:00
Joe Bowser
7d26c51da6 CB-11964: Do a clean when installing a plugin to et around the bug 2016-10-07 18:14:36 -07:00
Shazron Abdullah
dcada79e06 CB-11921 - Add github pull request template 2016-10-04 21:49:55 -07:00
Simon Pireyn
37384c583d CB-11935 Does a best-effort attempt to pause any processing that can be paused safely, such as animations and geolocation.
This closes #337
2016-10-03 16:16:52 -07:00
Joe Bowser
9544783b5e CB-11640: Fixing check_reqs.js so it actually works
This closes #338
2016-10-03 14:41:14 -07:00
Joe Bowser
eaf9b319ca Tweaking the regex 2016-10-03 14:41:14 -07:00
Joe Bowser
47abde2f8d CB-11640: Changing requirements check to ask for Java 8 2016-10-03 14:41:14 -07:00
daserge
30325e4f32 CB-11869 Fix cordova-js android exec tests
Useragent Regexp result is null in node environment - add a check for it
Updated cordova-js
Increased e2e create specs timeout
2016-09-29 12:24:52 +03:00
Joe Bowser
9cf38f8705 CB-11907: Bumping Gradle to work with Android Studio 2.2 and the Gradle Plugin, I should have done this last commit
This closes #336
2016-09-26 15:28:02 -07:00
Joe Bowser
7de4803e21 CB-11907: Bumping Gradle to work with Android Studio 2.2 and the Android Gradle Plugin 2016-09-26 15:06:44 -07:00
Joe Bowser
9586a7ddcd CB-11907: Bumping Android Gradle Plugin version to 2.2 so this works with Android Studio 2016-09-26 15:06:44 -07:00
Simon MacDonald
a4f6c8bf7b Enable background start of Cordova Android apps
This closes #322
2016-09-23 09:12:18 -07:00
Anis Kadri
f5ab6fc602 adding tests for Android Studio
This closes #331
2016-09-20 19:54:38 -07:00
Anis Kadri
222fb1c0e7 adding tests for AndroidStudio 2016-09-20 19:54:34 -07:00
Anis Kadri
511fe7c51e fixing jshint issues 2016-09-20 19:54:34 -07:00
Anis Kadri
acb3cc80b7 First attempt at supporting Android Studio 2016-09-20 19:54:34 -07:00
Pierre-Alexis de Solminihac
23fd0982b0 replace Integer.parseInt with BigInteger so that you can use longer Android version codes
I used to have DNS like version codes (YYYYmmmddXX format) for my apps builds, and I can't go back in older apps because Google Play wont allow me to upload inferior version codes, so I thing we should to use BigInteger instead of Integer.parseInt

This closes #298
2016-09-12 10:39:34 -07:00
Joe Bowser
d2a159d2dc Close #280 2016-09-09 14:23:33 -07:00
Joe Bowser
dc0bfeb0cc CB-11828: Adding dirty userAgent checking to see if we're running Jellybean or not for bridge modes 2016-09-09 12:05:19 -07:00
Joe Bowser
deea0f7e4f CB-11828: Switching default bridge back to ONLINE_BRIDGE 2016-09-09 12:05:19 -07:00
Simon MacDonald
3a33f4c0a6 Add gradle build flag to enable dex in process for large projects 2016-09-08 19:00:55 -04:00
Or Arnon
312872adaf 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)
This closes #279
This closes #218

PR #218 didn't cleanly merge
2016-09-08 11:02:17 -07:00
Joe Bowser
ba5e3a81e0 Updating travis
This closes #328
2016-09-06 10:42:59 -07:00
Joe Bowser
bf5c32d780 Adding Static Method to CoreAndroid Plugin so we can get the BuildConfig data from other plugins 2016-09-06 10:42:51 -07:00
Joe Bowser
d3cb38de29 Bump Target and Min API levels 2016-09-06 10:42:51 -07:00
Simon MacDonald
047ed52d60 Make evaluateJavaScript brige default
This closes #320
2016-09-01 08:50:29 -07:00
Joe Bowser
bb96bb9a88 Creating an evaluateJavascript branch 2016-09-01 08:49:32 -07:00
Joe Bowser
0ee672d2b0 Close #253
I can't reproduce this issue, and the issue has been closed for a while,
closing the PR makes sense
2016-08-31 14:40:10 -07:00
dheeran1
2a8a6b3970 Update CoreAndroid.java
No modifier (package-private) class to public class

This closes #293
2016-08-30 12:55:12 -07:00
Joe Bowser
5dbc51da59 Close #262 2016-08-29 15:51:32 -07:00
Joe Bowser
f1a6d938cd Close #243 2016-08-29 15:50:06 -07:00
Joe Bowser
991a2b1873 Close #242 2016-08-29 15:49:03 -07:00
Joe Bowser
172c01561b Close #227 2016-08-29 15:48:26 -07:00
Joe Bowser
b2f061cbaf Close #219 2016-08-29 15:47:44 -07:00
Joe Bowser
1f1b2977a4 Close #185 2016-08-29 15:46:23 -07:00
Simon MacDonald
4a0a7bc424 Cordova-Android should use org.apache.cordova.LOG for logging
* Read LogLevel preference from config.xml
* Replace Log with LOG
* Add addition warning method to LOG
2016-08-22 13:19:51 -04:00
Shazron Abdullah
8fbb6d7c62 CB-11727 - travis ci setup is still using 0.10.32 node
This closes #325
2016-08-19 15:50:38 -07:00
Shazron Abdullah
0299467831 CB-11726 - Update appveyor node versions to 4 and 6, so they will always use the latest versions
This closes #324
2016-08-19 15:49:56 -07:00
Steve Gill
2efe240617 updated bundled cordova-common to 1.4.1 2016-08-16 13:23:10 -07:00
Vladimir Kotikov
ed543dc648 Close invalid PRs
This closes #317, closes #318
2016-08-11 14:53:22 +03:00
Szymon Drosdzol
db6295c917 CB-11683 Fixed linking to directories during plugin installation.
This closes #322
2016-08-11 14:47:36 +03:00
akilawickey
d54a42f0f0 fixed CB-11078 Empty string for BackgroundColor preference crashes application
This closes #316
2016-08-02 22:38:58 -07:00
Steve Gill
74ae6651c8 Update JS snapshot to version 5.3.0-dev (via coho) 2016-07-26 14:57:29 -07:00
Steve Gill
f33f352501 Set VERSION to 5.3.0-dev (via coho) 2016-07-26 14:57:28 -07:00
Steve Gill
39c17e71ef CB-11626 Updated RELEASENOTES and Version for release 5.2.2 2016-07-26 13:06:08 -07:00
Steve Gill
081637134f updated cordoova-common to 1.4.0 2016-07-22 12:24:27 -07:00
Joe Bowser
39165a8694 This closes #195 2016-07-11 15:30:10 -07:00
Joe Bowser
ad163ce244 Updaing the gradle for the tests to the latest 2016-07-11 14:26:36 -07:00
Vladimir Kotikov
a7176d39f0 CB-11550 Updated RELEASENOTES for release 5.2.1 2016-07-11 14:06:55 +03:00
Alexander Sorokin
f1c185b771 CB-9489 Fixed "endless waiting for emulator" issue 2016-07-06 15:12:36 +03:00
Steve Gill
103e1e8d24 Update JS snapshot to version 5.3.0-dev (via coho) 2016-06-29 15:04:55 -07:00
Steve Gill
30198c4bdd Set VERSION to 5.3.0-dev (via coho) 2016-06-29 15:04:55 -07:00
Steve Gill
841f02f43f CB-11444 Updated RELEASENOTES and Version for release 5.2.0 2016-06-29 15:04:55 -07:00
Joe Bowser
a5e9861440 Close #288 2016-06-29 14:48:50 -07:00
Vivek Kiran
d69698c23f Update plugin-build.gradle. This closes #312 2016-06-29 14:40:20 -07:00
Vivek Kiran
d763f14ffe CB-11481: android-library is deprecated use com.android.library instead 2016-06-29 12:10:51 -07:00
Julien Bouquillon
2cefb42559 fix issue with app_name containing apostrophes 2016-03-14 14:01:43 +01:00
107 changed files with 1733 additions and 572 deletions

22
.github/PULL_REQUEST_TEMPLATE.md vendored Normal file
View 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.

1
.gitignore vendored
View File

@@ -129,4 +129,5 @@ node_modules/which/
node_modules/window-size/ node_modules/window-size/
node_modules/wordwrap/ node_modules/wordwrap/
node_modules/yargs/ node_modules/yargs/
node_modules/fs.realpath/
/coverage /coverage

View File

@@ -1,9 +1,18 @@
language: android language: android
sudo: false sudo: false
jdk:
- oraclejdk8
before_install:
- nvm install 6
- node --version
install: install:
- npm install - npm install
- npm install -g codecov - 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:
components:
- tools
- tools
script: script:
- npm run jshint - npm run jshint
- npm run cover - npm run cover

View File

@@ -20,6 +20,75 @@
--> -->
## Release Notes for Cordova (Android) ## ## Release Notes for Cordova (Android) ##
### 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: Fixing syncronous file check and future-proofing the JS for Travis
* CB-11083: Reading files to check for CordovaLib dependency, if so, we exclude CordovaLib to be safe
* CB-11083: Plugin build script for dependencies without a gradle file
* CB-11083: The GradleBuidler can tell the difference between a Cordova Plugin Framework and a regular framework based on the name
* CB-11083 Fix to deal with custom frameworks with their own Gradle configuration
* CB-12003 updated node_modules
* CB-11771 Deep symlink directories to target project instead of linking the directory itself
* CB-11880 android: Fail-safe for cordova.exec()
* CB-11999 add message, catch exception if require fails
* fix issue with app_name containing apostrophes
* CB-8722 - Move icons from drawable to mipmap
* 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: Do a clean when installing a plugin to et around the bug
* CB-11921 - Add github pull request template
* CB-11935 Does a best-effort attempt to pause any processing that can be paused safely, such as animations and geolocation.
* CB-11640: Fixing check_reqs.js so it actually works
* CB-11640: Changing requirements check to ask for Java 8
* CB-11869 Fix cordova-js android exec tests
* 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: Adding dirty userAgent checking to see if we're running Jellybean or not for bridge modes
* 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 - travis ci setup is still using 0.10.32 node
* CB-11726 - Update appveyor node versions to 4 and 6, so they will always use the latest versions
* Close invalid PRs
* CB-11683 Fixed linking to directories during plugin installation.
* fixed 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 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 Updated RELEASENOTES for release 5.2.1
* 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 Updated RELEASENOTES and Version for release 5.2.0
* CB-11481: android-library is deprecated use com.android.library instead
### 5.2.2 (Jul 26, 2016) ### 5.2.2 (Jul 26, 2016)
* [CB-11615](https://issues.apache.org/jira/browse/CB-11615) updated `cordoova-common` to `1.4.0` * [CB-11615](https://issues.apache.org/jira/browse/CB-11615) updated `cordoova-common` to `1.4.0`

View File

@@ -1 +1 @@
5.2.2 6.0.0

View File

@@ -2,7 +2,8 @@ environment:
matrix: matrix:
- nodejs_version: "0.10" - nodejs_version: "0.10"
- nodejs_version: "0.12" - nodejs_version: "0.12"
- nodejs_version: "4.2" - nodejs_version: "4"
- nodejs_version: "6"
install: install:
# - cinst android-sdk # - cinst android-sdk

View File

@@ -152,7 +152,8 @@ module.exports.check_java = function() {
// javac writes version info to stderr instead of stdout // javac writes version info to stderr instead of stdout
return tryCommand('javac -version', msg, true) return tryCommand('javac -version', msg, true)
.then(function (output) { .then(function (output) {
var match = /javac ((?:\d+\.)+(?:\d+))/i.exec(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]; return match && match[1];
}); });
}); });
@@ -225,6 +226,7 @@ module.exports.check_android = function() {
throw new CordovaError('\'ANDROID_HOME\' environment variable is set to non-existent path: ' + process.env['ANDROID_HOME'] + 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.'); '\nTry update it manually to point to valid SDK directory.');
} }
return hasAndroidHome;
}); });
}; };
@@ -267,13 +269,23 @@ module.exports.check_android_target = function(originalError) {
// Returns a promise. // Returns a promise.
module.exports.run = function() { module.exports.run = function() {
return Q.all([this.check_java(), this.check_android()]) return Q.all([this.check_java(), this.check_android()])
.then(function() { .then(function(values) {
console.log('ANDROID_HOME=' + process.env['ANDROID_HOME']); console.log('ANDROID_HOME=' + process.env['ANDROID_HOME']);
console.log('JAVA_HOME=' + process.env['JAVA_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. * Object thar represents one of requirements for current platform.
* @param {String} id The unique identifier for this requirements. * @param {String} id The unique identifier for this requirements.

View File

@@ -26,7 +26,7 @@ var shell = require('shelljs'),
check_reqs = require('./check_reqs'), check_reqs = require('./check_reqs'),
ROOT = path.join(__dirname, '..', '..'); ROOT = path.join(__dirname, '..', '..');
var MIN_SDK_VERSION = 14; var MIN_SDK_VERSION = 16;
var CordovaError = require('cordova-common').CordovaError; var CordovaError = require('cordova-common').CordovaError;
var AndroidManifest = require('../templates/cordova/lib/AndroidManifest'); var AndroidManifest = require('../templates/cordova/lib/AndroidManifest');

View File

@@ -18,8 +18,10 @@
*/ */
var path = require('path'); var path = require('path');
var Q = require('q');
var AndroidProject = require('./lib/AndroidProject'); var AndroidProject = require('./lib/AndroidProject');
var AndroidStudio = require('./lib/AndroidStudio');
var PluginManager = require('cordova-common').PluginManager; var PluginManager = require('cordova-common').PluginManager;
var CordovaLogger = require('cordova-common').CordovaLogger; var CordovaLogger = require('cordova-common').CordovaLogger;
@@ -27,6 +29,7 @@ var selfEvents = require('cordova-common').events;
var PLATFORM = 'android'; var PLATFORM = 'android';
function setupEvents(externalEventEmitter) { function setupEvents(externalEventEmitter) {
if (externalEventEmitter) { if (externalEventEmitter) {
// This will make the platform internal events visible outside // This will make the platform internal events visible outside
@@ -40,6 +43,7 @@ function setupEvents(externalEventEmitter) {
return selfEvents; return selfEvents;
} }
/** /**
* Class, that acts as abstraction over particular platform. Encapsulates the * Class, that acts as abstraction over particular platform. Encapsulates the
* platform's properties and methods. * platform's properties and methods.
@@ -62,6 +66,7 @@ function Api(platform, platformRootDir, events) {
this.locations = { this.locations = {
root: self.root, root: self.root,
www: path.join(self.root, 'assets/www'), www: path.join(self.root, 'assets/www'),
res: path.relative(self.root, path.join(self.root, 'res')),
platformWww: path.join(self.root, 'platform_www'), platformWww: path.join(self.root, 'platform_www'),
configXml: path.join(self.root, 'res/xml/config.xml'), configXml: path.join(self.root, 'res/xml/config.xml'),
defaultConfigXml: path.join(self.root, 'cordova/defaults.xml'), defaultConfigXml: path.join(self.root, 'cordova/defaults.xml'),
@@ -71,6 +76,17 @@ function Api(platform, platformRootDir, events) {
cordovaJs: 'bin/templates/project/assets/www/cordova.js', cordovaJs: 'bin/templates/project/assets/www/cordova.js',
cordovaJsSrc: 'cordova-js-src' 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.relative(self.root, path.join(self.root, 'app/src/main/res'));
}
} }
/** /**
@@ -93,13 +109,20 @@ function Api(platform, platformRootDir, events) {
*/ */
Api.createPlatform = function (destination, config, options, events) { Api.createPlatform = function (destination, config, options, events) {
events = setupEvents(events); events = setupEvents(events);
var result;
return require('../../lib/create') try {
.create(destination, config, options, events) result = require('../../lib/create')
.then(function (destination) { .create(destination, config, options, events)
var PlatformApi = require(path.resolve(destination, 'cordova/Api')); .then(function (destination) {
return new PlatformApi(PLATFORM, destination, events); 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 +143,20 @@ Api.createPlatform = function (destination, config, options, events) {
*/ */
Api.updatePlatform = function (destination, options, events) { Api.updatePlatform = function (destination, options, events) {
events = setupEvents(events); events = setupEvents(events);
var result;
return require('../../lib/create') try {
.update(destination, options, events) result = require('../../lib/create')
.then(function (destination) { .update(destination, options, events)
var PlatformApi = require(path.resolve(destination, 'cordova/Api')); .then(function (destination) {
return new PlatformApi('android', destination, events); 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 +216,7 @@ Api.prototype.prepare = function (cordovaProject, prepareOptions) {
*/ */
Api.prototype.addPlugin = function (plugin, installOptions) { Api.prototype.addPlugin = function (plugin, installOptions) {
var project = AndroidProject.getProjectFile(this.root); var project = AndroidProject.getProjectFile(this.root);
var self = this;
installOptions = installOptions || {}; installOptions = installOptions || {};
installOptions.variables = installOptions.variables || {}; installOptions.variables = installOptions.variables || {};
@@ -194,15 +225,38 @@ Api.prototype.addPlugin = function (plugin, installOptions) {
installOptions.variables.PACKAGE_NAME = project.getPackageName(); installOptions.variables.PACKAGE_NAME = project.getPackageName();
} }
return PluginManager.get(this.platform, this.locations, project) if(this.android_studio === true) {
.addPlugin(plugin, installOptions) installOptions.android_studio = true;
.then(function () { }
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;
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; if (plugin.getFrameworks(this.platform).length === 0) return;
selfEvents.emit('verbose', 'Updating build files since android plugin contained <framework>'); selfEvents.emit('verbose', 'Updating build files since android plugin contained <framework>');
require('./lib/builders/builders').getBuilder('gradle').prepBuildFiles(); require('./lib/builders/builders').getBuilder('gradle').prepBuildFiles();
}.bind(this)) }.bind(this))
// CB-11022 Return truthy value to prevent running prepare after // CB-11022 Return truthy value to prevent running prepare after
.thenResolve(true); .thenResolve(true);
}; };
@@ -221,6 +275,12 @@ Api.prototype.addPlugin = function (plugin, installOptions) {
*/ */
Api.prototype.removePlugin = function (plugin, uninstallOptions) { Api.prototype.removePlugin = function (plugin, uninstallOptions) {
var project = AndroidProject.getProjectFile(this.root); 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) return PluginManager.get(this.platform, this.locations, project)
.removePlugin(plugin, uninstallOptions) .removePlugin(plugin, uninstallOptions)
.then(function () { .then(function () {
@@ -318,7 +378,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 * @return {Promise} Return a promise either fulfilled, or rejected with
* CordovaError. * CordovaError.
@@ -326,12 +387,12 @@ Api.prototype.run = function(runOptions) {
Api.prototype.clean = function(cleanOptions) { Api.prototype.clean = function(cleanOptions) {
var self = this; var self = this;
return require('./lib/check_reqs').run() return require('./lib/check_reqs').run()
.then(function () { .then(function () {
return require('./lib/build').runClean.call(self, cleanOptions); return require('./lib/build').runClean.call(self, cleanOptions);
}) })
.then(function () { .then(function () {
return require('./lib/prepare').clean.call(self, cleanOptions); return require('./lib/prepare').clean.call(self, cleanOptions);
}); });
}; };
/** /**

View File

@@ -21,6 +21,7 @@ var fs = require('fs');
var path = require('path'); var path = require('path');
var properties_parser = require('properties-parser'); var properties_parser = require('properties-parser');
var AndroidManifest = require('./AndroidManifest'); var AndroidManifest = require('./AndroidManifest');
var AndroidStudio = require('./AndroidStudio');
var pluginHandlers = require('./pluginHandlers'); var pluginHandlers = require('./pluginHandlers');
var projectFileCache = {}; var projectFileCache = {};
@@ -63,6 +64,9 @@ function AndroidProject(projectDir) {
this.projectDir = projectDir; this.projectDir = projectDir;
this.platformWww = path.join(this.projectDir, 'platform_www'); this.platformWww = path.join(this.projectDir, 'platform_www');
this.www = path.join(this.projectDir, 'assets/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) { AndroidProject.getProjectFile = function (projectDir) {
@@ -89,7 +93,11 @@ AndroidProject.purgeCache = function (projectDir) {
* @return {String} The name of the package * @return {String} The name of the package
*/ */
AndroidProject.prototype.getPackageName = function() { 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) { AndroidProject.prototype.getCustomSubprojectRelativeDir = function(plugin_id, src) {

View File

@@ -0,0 +1,29 @@
/*
* This is a simple routine that checks if project is an Android Studio Project
*
* @param {String} root Root folder of the project
*/
/*jshint esversion: 6 */
var path = require('path');
var fs = require('fs');
function isAndroidStudioProject(root) {
var eclipseFiles = ['AndroidManifest.xml', 'libs', 'res', 'project.properties', 'platform_www'];
var androidStudioFiles = ['app', 'gradle', 'build', 'app/src/main/assets'];
var file;
for(file of eclipseFiles) {
if(fs.existsSync(path.join(root, file))) {
return false;
}
}
for(file of androidStudioFiles) {
if(!fs.existsSync(path.join(root, file))) {
return false;
}
}
return true;
}
module.exports.isAndroidStudioProject = isAndroidStudioProject;

View File

@@ -55,6 +55,8 @@ GradleBuilder.prototype.getArgs = function(cmd, opts) {
// 10 seconds -> 6 seconds // 10 seconds -> 6 seconds
args.push('-Dorg.gradle.daemon=true'); 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 // allow NDK to be used - required by Gradle 1.5 plugin
args.push('-Pandroid.useDeprecatedNdk=true'); args.push('-Pandroid.useDeprecatedNdk=true');
args.push.apply(args, opts.extraArgs); args.push.apply(args, opts.extraArgs);
@@ -69,12 +71,21 @@ GradleBuilder.prototype.prepBuildFiles = function() {
var pluginBuildGradle = path.join(this.root, 'cordova', 'lib', 'plugin-build.gradle'); var pluginBuildGradle = path.join(this.root, 'cordova', 'lib', 'plugin-build.gradle');
var propertiesObj = this.readProjectProperties(); var propertiesObj = this.readProjectProperties();
var subProjects = propertiesObj.libs; 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) { for (var i = 0; i < subProjects.length; ++i) {
if (subProjects[i] !== 'CordovaLib') { 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(); var name = this.extractRealProjectNameFromManifest();
//Remove the proj.id/name- prefix from projects: https://issues.apache.org/jira/browse/CB-9149 //Remove the proj.id/name- prefix from projects: https://issues.apache.org/jira/browse/CB-9149
var settingsGradlePaths = subProjects.map(function(p){ var settingsGradlePaths = subProjects.map(function(p){
@@ -93,10 +104,24 @@ GradleBuilder.prototype.prepBuildFiles = function() {
// Update dependencies within build.gradle. // Update dependencies within build.gradle.
var buildGradle = fs.readFileSync(path.join(this.root, 'build.gradle'), 'utf8'); var buildGradle = fs.readFileSync(path.join(this.root, 'build.gradle'), 'utf8');
var depsList = ''; 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) { subProjects.forEach(function(p) {
console.log('Subproject Path: ' + p);
var libName=p.replace(/[/\\]/g, ':').replace(name+'-',''); var libName=p.replace(/[/\\]/g, ':').replace(name+'-','');
depsList += ' debugCompile project(path: "' + libName + '", configuration: "debug")\n'; depsList += ' debugCompile(project(path: "' + libName + '", configuration: "debug"))';
depsList += ' releaseCompile project(path: "' + libName + '", configuration: "release")\n'; 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 // For why we do this mapping: https://issues.apache.org/jira/browse/CB-8390
var SYSTEM_LIBRARY_MAPPINGS = [ var SYSTEM_LIBRARY_MAPPINGS = [
@@ -161,7 +186,7 @@ GradleBuilder.prototype.prepEnv = function(opts) {
// For some reason, using ^ and $ don't work. This does the job, though. // For some reason, using ^ and $ don't work. This does the job, though.
var distributionUrlRegex = /distributionUrl.*zip/; var distributionUrlRegex = /distributionUrl.*zip/;
/*jshint -W069 */ /*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'] || 'http\\://services.gradle.org/distributions/gradle-2.14.1-all.zip';
/*jshint +W069 */ /*jshint +W069 */
var gradleWrapperPropertiesPath = path.join(self.root, 'gradle', 'wrapper', 'gradle-wrapper.properties'); var gradleWrapperPropertiesPath = path.join(self.root, 'gradle', 'wrapper', 'gradle-wrapper.properties');
shell.chmod('u+w', gradleWrapperPropertiesPath); shell.chmod('u+w', gradleWrapperPropertiesPath);
@@ -189,7 +214,7 @@ GradleBuilder.prototype.build = function(opts) {
.progress(function (stdio){ .progress(function (stdio){
if (stdio.stderr) { 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. * stderr instead of stdout.
* This function suppresses 'Picked up _JAVA_OPTIONS' message from being * This function suppresses 'Picked up _JAVA_OPTIONS' message from being
* printed to stderr. See https://issues.apache.org/jira/browse/CB-9971 for * printed to stderr. See https://issues.apache.org/jira/browse/CB-9971 for

View File

@@ -21,24 +21,15 @@
buildscript { buildscript {
repositories { repositories {
mavenCentral() mavenCentral()
jcenter()
} }
// Switch the Android Gradle plugin version requirement depending on the // Switch the Android Gradle plugin version requirement depending on the
// installed version of Gradle. This dependency is documented at // installed version of Gradle. This dependency is documented at
// http://tools.android.com/tech-docs/new-build-system/version-compatibility // http://tools.android.com/tech-docs/new-build-system/version-compatibility
// and https://issues.apache.org/jira/browse/CB-8143 // and https://issues.apache.org/jira/browse/CB-8143
if (gradle.gradleVersion >= "2.2") { dependencies {
dependencies { classpath 'com.android.tools.build:gradle:1.0.0+'
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+'
}
} }
} }

View File

@@ -30,7 +30,13 @@ var handlers = {
install:function(obj, plugin, project, options) { install:function(obj, plugin, project, options) {
if (!obj.src) throw new CordovaError(generateAttributeError('src', 'source-file', plugin.id)); 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)); if (!obj.targetDir) throw new CordovaError(generateAttributeError('target-dir', 'source-file', plugin.id));
var dest = path.join(obj.targetDir, path.basename(obj.src)); 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) { if (options && options.force) {
copyFile(plugin.dir, obj.src, project.projectDir, dest, !!(options && options.link)); copyFile(plugin.dir, obj.src, project.projectDir, dest, !!(options && options.link));
} else { } else {
@@ -39,16 +45,27 @@ var handlers = {
}, },
uninstall:function(obj, plugin, project, options) { uninstall:function(obj, plugin, project, options) {
var dest = path.join(obj.targetDir, path.basename(obj.src)); 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); deleteJava(project.projectDir, dest);
} }
}, },
'lib-file':{ 'lib-file':{
install:function(obj, plugin, project, options) { install:function(obj, plugin, project, options) {
var dest = path.join('libs', path.basename(obj.src)); 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)); copyFile(plugin.dir, obj.src, project.projectDir, dest, !!(options && options.link));
}, },
uninstall:function(obj, plugin, project, options) { uninstall:function(obj, plugin, project, options) {
var dest = path.join('libs', path.basename(obj.src)); 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); 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'); throw new CordovaError('Destination "' + dest + '" for source file "' + src + '" is located outside the project');
shell.mkdir('-p', path.dirname(dest)); shell.mkdir('-p', path.dirname(dest));
if (link) { if (link) {
fs.symlinkSync(path.relative(path.dirname(dest), src), dest); symlinkFileOrDirTree(src, dest);
} else if (fs.statSync(src).isDirectory()) { } else if (fs.statSync(src).isDirectory()) {
// XXX shelljs decides to create a directory when -R|-r is used which sucks. http://goo.gl/nbsjq // XXX shelljs decides to create a directory when -R|-r is used which sucks. http://goo.gl/nbsjq
shell.cp('-Rf', src+'/*', dest); 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); 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 // checks if file exists and then deletes. Error if doesn't exist
function removeFile (project_dir, src) { function removeFile (project_dir, src) {
var file = path.resolve(project_dir, src); var file = path.resolve(project_dir, src);

View File

@@ -33,7 +33,6 @@ var PluginInfoProvider = require('cordova-common').PluginInfoProvider;
module.exports.prepare = function (cordovaProject, options) { module.exports.prepare = function (cordovaProject, options) {
var self = this; 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 platformJson = PlatformJson.load(this.locations.root, this.platform);
var munger = new PlatformMunger(this.platform, this.locations.root, platformJson, new PluginInfoProvider()); var munger = new PlatformMunger(this.platform, this.locations.root, platformJson, new PluginInfoProvider());
@@ -47,8 +46,8 @@ module.exports.prepare = function (cordovaProject, options) {
return updateProjectAccordingTo(self._config, self.locations); return updateProjectAccordingTo(self._config, self.locations);
}) })
.then(function () { .then(function () {
updateIcons(cordovaProject, platformResourcesDir); updateIcons(cordovaProject, self.locations.res);
updateSplashes(cordovaProject, platformResourcesDir); updateSplashes(cordovaProject, self.locations.res);
}) })
.then(function () { .then(function () {
events.emit('verbose', 'Prepared android project successfully'); events.emit('verbose', 'Prepared android project successfully');
@@ -61,20 +60,18 @@ module.exports.clean = function (options) {
// noPrepare option passed in by the non-CLI clean script. If that's present, or if // 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. // there's no config.xml found at the project root, then don't clean prepared files.
var projectRoot = path.resolve(this.root, '../..'); var projectRoot = path.resolve(this.root, '../..');
var projectConfigFile = path.join(projectRoot, 'config.xml'); if ((options && options.noPrepare) || !fs.existsSync(this.locations.configXml) ||
if ((options && options.noPrepare) || !fs.existsSync(projectConfigFile) ||
!fs.existsSync(this.locations.configXml)) { !fs.existsSync(this.locations.configXml)) {
return Q(); return Q();
} }
var projectConfig = new ConfigParser(this.locations.configXml); var projectConfig = new ConfigParser(this.locations.configXml);
var platformResourcesDir = path.relative(projectRoot, path.join(this.locations.root, 'res'));
var self = this; var self = this;
return Q().then(function () { return Q().then(function () {
cleanWww(projectRoot, self.locations); cleanWww(projectRoot, self.locations);
cleanIcons(projectRoot, projectConfig, platformResourcesDir); cleanIcons(projectRoot, projectConfig, self.locations.res);
cleanSplashes(projectRoot, projectConfig, platformResourcesDir); cleanSplashes(projectRoot, projectConfig, self.locations.res);
}); });
}; };
@@ -172,7 +169,7 @@ function updateProjectAccordingTo(platformConfig, locations) {
// Update app name by editing res/values/strings.xml // Update app name by editing res/values/strings.xml
var name = platformConfig.name(); var name = platformConfig.name();
var strings = xmlHelpers.parseElementtreeSync(locations.strings); 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'); fs.writeFileSync(locations.strings, strings.write({indent: 4}), 'utf-8');
events.emit('verbose', 'Wrote out android application name "' + name + '" to ' + locations.strings); events.emit('verbose', 'Wrote out android application name "' + name + '" to ' + locations.strings);
@@ -247,11 +244,11 @@ function default_versionCode(version) {
return versionCode; return versionCode;
} }
function getImageResourcePath(resourcesDir, density, name, sourceName) { function getImageResourcePath(resourcesDir, type, density, name, sourceName) {
if (/\.9\.png$/.test(sourceName)) { if (/\.9\.png$/.test(sourceName)) {
name = name.replace(/\.png$/, '.9.png'); 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; return resourcePath;
} }
@@ -264,7 +261,7 @@ function updateSplashes(cordovaProject, platformResourcesDir) {
return; return;
} }
var resourceMap = mapImageResources(cordovaProject.root, platformResourcesDir, 'screen.png'); var resourceMap = mapImageResources(cordovaProject.root, platformResourcesDir, 'drawable', 'screen.png');
var hadMdpi = false; var hadMdpi = false;
resources.forEach(function (resource) { resources.forEach(function (resource) {
@@ -275,14 +272,14 @@ function updateSplashes(cordovaProject, platformResourcesDir) {
hadMdpi = true; hadMdpi = true;
} }
var targetPath = getImageResourcePath( 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; resourceMap[targetPath] = resource.src;
}); });
// There's no "default" drawable, so assume default == mdpi. // There's no "default" drawable, so assume default == mdpi.
if (!hadMdpi && resources.defaultResource) { if (!hadMdpi && resources.defaultResource) {
var targetPath = getImageResourcePath( 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; resourceMap[targetPath] = resources.defaultResource.src;
} }
@@ -294,7 +291,7 @@ function updateSplashes(cordovaProject, platformResourcesDir) {
function cleanSplashes(projectRoot, projectConfig, platformResourcesDir) { function cleanSplashes(projectRoot, projectConfig, platformResourcesDir) {
var resources = projectConfig.getSplashScreens('android'); var resources = projectConfig.getSplashScreens('android');
if (resources.length > 0) { 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); events.emit('verbose', 'Cleaning splash screens at ' + platformResourcesDir);
// No source paths are specified in the map, so updatePaths() will delete the target files. // No source paths are specified in the map, so updatePaths() will delete the target files.
@@ -312,7 +309,7 @@ function updateIcons(cordovaProject, platformResourcesDir) {
return; return;
} }
var resourceMap = mapImageResources(cordovaProject.root, platformResourcesDir, 'icon.png'); var resourceMap = mapImageResources(cordovaProject.root, platformResourcesDir, 'mipmap', 'icon.png');
var android_icons = {}; var android_icons = {};
var default_icon; var default_icon;
@@ -363,14 +360,14 @@ function updateIcons(cordovaProject, platformResourcesDir) {
// project's config.xml location, so we use it as base path. // project's config.xml location, so we use it as base path.
for (var density in android_icons) { for (var density in android_icons) {
var targetPath = getImageResourcePath( 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; resourceMap[targetPath] = android_icons[density].src;
} }
// There's no "default" drawable, so assume default == mdpi. // There's no "default" drawable, so assume default == mdpi.
if (default_icon && !android_icons.mdpi) { if (default_icon && !android_icons.mdpi) {
var defaultTargetPath = getImageResourcePath( 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; resourceMap[defaultTargetPath] = default_icon.src;
} }
@@ -382,7 +379,7 @@ function updateIcons(cordovaProject, platformResourcesDir) {
function cleanIcons(projectRoot, projectConfig, platformResourcesDir) { function cleanIcons(projectRoot, projectConfig, platformResourcesDir) {
var icons = projectConfig.getIcons('android'); var icons = projectConfig.getIcons('android');
if (icons.length > 0) { 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); events.emit('verbose', 'Cleaning icons at ' + platformResourcesDir);
// No source paths are specified in the map, so updatePaths() will delete the target files. // No source paths are specified in the map, so updatePaths() will delete the target files.
@@ -394,9 +391,9 @@ function cleanIcons(projectRoot, projectConfig, platformResourcesDir) {
/** /**
* Gets a map containing resources of a specified name from all drawable folders in a directory. * 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 = {}; var pathMap = {};
shell.ls(path.join(rootDir, subDir, 'drawable-*')) shell.ls(path.join(rootDir, subDir, type + '-*'))
.forEach(function (drawableFolder) { .forEach(function (drawableFolder) {
var imagePath = path.join(subDir, path.basename(drawableFolder), resourceName); var imagePath = path.join(subDir, path.basename(drawableFolder), resourceName);
pathMap[imagePath] = null; pathMap[imagePath] = null;

View File

@@ -20,7 +20,7 @@
*/ */
// Coho updates this line: // Coho updates this line:
var VERSION = "5.2.2"; var VERSION = "6.0.0";
module.exports.version = VERSION; module.exports.version = VERSION;

View File

@@ -28,6 +28,13 @@ public class __ACTIVITY__ extends CordovaActivity
public void onCreate(Bundle savedInstanceState) public void onCreate(Bundle savedInstanceState)
{ {
super.onCreate(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 // Set by <content src="index.html" /> in config.xml
loadUrl(launchUrl); loadUrl(launchUrl);
} }

View File

@@ -30,7 +30,7 @@
<uses-permission android:name="android.permission.INTERNET" /> <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"> android:hardwareAccelerated="true" android:supportsRtl="true">
<activity android:name="__ACTIVITY__" <activity android:name="__ACTIVITY__"
android:label="@string/activity_name" android:label="@string/activity_name"
@@ -45,5 +45,5 @@
</activity> </activity>
</application> </application>
<uses-sdk android:minSdkVersion="14" android:targetSdkVersion="__APILEVEL__"/> <uses-sdk android:minSdkVersion="16" android:targetSdkVersion="__APILEVEL__"/>
</manifest> </manifest>

View File

@@ -1,5 +1,5 @@
// Platform: android // Platform: android
// d403ce434788ffe1937711d6ebcbcc837fcbcb14 // 53ea1913735222d326e65326e03391405df3cd4e
/* /*
Licensed to the Apache Software Foundation (ASF) under one Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file or more contributor license agreements. See the NOTICE file
@@ -19,7 +19,7 @@
under the License. under the License.
*/ */
;(function() { ;(function() {
var PLATFORM_VERSION_BUILD_LABEL = '5.2.2'; var PLATFORM_VERSION_BUILD_LABEL = '6.0.0';
// file: src/scripts/require.js // file: src/scripts/require.js
/*jshint -W079 */ /*jshint -W079 */
@@ -330,7 +330,7 @@ module.exports = cordova;
}); });
// file: /Users/steveng/repo/cordova/cordova-android/cordova-js-src/android/nativeapiprovider.js // file: /Users/jbowser/cordova/cordova-android/cordova-js-src/android/nativeapiprovider.js
define("cordova/android/nativeapiprovider", function(require, exports, module) { 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/jbowser/cordova/cordova-android/cordova-js-src/android/promptbasednativeapi.js
define("cordova/android/promptbasednativeapi", function(require, exports, module) { define("cordova/android/promptbasednativeapi", function(require, exports, module) {
/** /**
@@ -742,8 +742,13 @@ var Channel = function(type, sticky) {
} }
}; };
function forceFunction(f) { function checkSubscriptionArgument(argument) {
if (typeof f != 'function') throw "Function required as first 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. * and a guid that can be used to stop subscribing to the channel.
* Returns the guid. * Returns the guid.
*/ */
Channel.prototype.subscribe = function(f, c) { Channel.prototype.subscribe = function(eventListenerOrFunction, eventListener) {
// need a function to call checkSubscriptionArgument(eventListenerOrFunction);
forceFunction(f); 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) { if (this.state == 2) {
f.apply(c || this, this.fireArgs); handleEvent.apply(eventListener || this, this.fireArgs);
return; return;
} }
var func = f, guid = eventListenerOrFunction.observer_guid;
guid = f.observer_guid; if (typeof eventListener === "object") {
if (typeof c == "object") { func = utils.close(c, f); } handleEvent = utils.close(eventListener, handleEvent);
}
if (!guid) { if (!guid) {
// first time any channel has seen this subscriber // First time any channel has seen this subscriber
guid = '' + nextGuid++; guid = '' + nextGuid++;
} }
func.observer_guid = guid; handleEvent.observer_guid = guid;
f.observer_guid = guid; eventListenerOrFunction.observer_guid = guid;
// Don't add the same handler more than once. // Don't add the same handler more than once.
if (!this.handlers[guid]) { if (!this.handlers[guid]) {
this.handlers[guid] = func; this.handlers[guid] = handleEvent;
this.numHandlers++; this.numHandlers++;
if (this.numHandlers == 1) { if (this.numHandlers == 1) {
this.onHasSubscribersChange && this.onHasSubscribersChange(); this.onHasSubscribersChange && this.onHasSubscribersChange();
@@ -785,12 +801,20 @@ Channel.prototype.subscribe = function(f, c) {
/** /**
* Unsubscribes the function with the given guid from the channel. * Unsubscribes the function with the given guid from the channel.
*/ */
Channel.prototype.unsubscribe = function(f) { Channel.prototype.unsubscribe = function(eventListenerOrFunction) {
// need a function to unsubscribe checkSubscriptionArgument(eventListenerOrFunction);
forceFunction(f); var handleEvent, guid, handler;
var guid = f.observer_guid, if (eventListenerOrFunction && typeof eventListenerOrFunction === "object") {
handler = this.handlers[guid]; // 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) { if (handler) {
delete this.handlers[guid]; delete this.handlers[guid];
this.numHandlers--; this.numHandlers--;
@@ -862,7 +886,7 @@ module.exports = channel;
}); });
// file: /Users/steveng/repo/cordova/cordova-android/cordova-js-src/exec.js // file: /Users/jbowser/cordova/cordova-android/cordova-js-src/exec.js
define("cordova/exec", function(require, exports, module) { 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 // For the ONLINE_EVENT to be viable, it would need to intercept all event
// listeners (both through addEventListener and window.ononline) as well // listeners (both through addEventListener and window.ononline) as well
// as set the navigator property itself. // as set the navigator property itself.
ONLINE_EVENT: 2 ONLINE_EVENT: 2,
EVAL_BRIDGE: 3
}, },
jsToNativeBridgeMode, // Set lazily. jsToNativeBridgeMode, // Set lazily.
nativeToJsBridgeMode = nativeToJsModes.ONLINE_EVENT, nativeToJsBridgeMode = nativeToJsModes.EVAL_BRIDGE,
pollEnabled = false, pollEnabled = false,
bridgeSecret = -1; bridgeSecret = -1;
@@ -923,6 +948,9 @@ function androidExec(success, fail, service, action, args) {
androidExec.setJsToNativeBridgeMode(jsToNativeModes.JS_OBJECT); 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. // Process any ArrayBuffers in the args into a string.
for (var i = 0; i < args.length; i++) { for (var i = 0; i < args.length; i++) {
if (utils.typeName(args[i]) == 'ArrayBuffer') { if (utils.typeName(args[i]) == 'ArrayBuffer') {
@@ -932,7 +960,6 @@ function androidExec(success, fail, service, action, args) {
var callbackId = service + cordova.callbackId++, var callbackId = service + cordova.callbackId++,
argsJson = JSON.stringify(args); argsJson = JSON.stringify(args);
if (success || fail) { if (success || fail) {
cordova.callbacks[callbackId] = {success:success, fail:fail}; cordova.callbacks[callbackId] = {success:success, fail:fail};
} }
@@ -952,6 +979,17 @@ function androidExec(success, fail, service, action, args) {
} }
androidExec.init = function() { 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); bridgeSecret = +prompt('', 'gap_init:' + nativeToJsBridgeMode);
channel.onNativeReady.fire(); channel.onNativeReady.fire();
}; };
@@ -1611,7 +1649,7 @@ exports.reset();
}); });
// file: /Users/steveng/repo/cordova/cordova-android/cordova-js-src/platform.js // file: /Users/jbowser/cordova/cordova-android/cordova-js-src/platform.js
define("cordova/platform", function(require, exports, module) { define("cordova/platform", function(require, exports, module) {
// The last resume event that was received that had the result of a plugin call. // 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/jbowser/cordova/cordova-android/cordova-js-src/plugin/android/app.js
define("cordova/plugin/android/app", function(require, exports, module) { define("cordova/plugin/android/app", function(require, exports, module) {
var exec = require('cordova/exec'); var exec = require('cordova/exec');
@@ -2083,7 +2121,10 @@ utils.clone = function(obj) {
retVal = {}; retVal = {};
for(i in obj){ 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]); retVal[i] = utils.clone(obj[i]);
} }
} }

View File

@@ -30,7 +30,7 @@ buildscript {
// http://tools.android.com/tech-docs/new-build-system/version-compatibility // http://tools.android.com/tech-docs/new-build-system/version-compatibility
// and https://issues.apache.org/jira/browse/CB-8143 // and https://issues.apache.org/jira/browse/CB-8143
dependencies { dependencies {
classpath 'com.android.tools.build:gradle:2.1.0' classpath 'com.android.tools.build:gradle:2.2.0'
} }
} }
@@ -43,7 +43,7 @@ allprojects {
} }
task wrapper(type: Wrapper) { task wrapper(type: Wrapper) {
gradleVersion = '2.13' gradleVersion = '2.14.1'
} }
// Configuration properties. Set these via environment variables, build-extras.gradle, or gradle.properties. // Configuration properties. Set these via environment variables, build-extras.gradle, or gradle.properties.
@@ -164,7 +164,7 @@ android {
} }
defaultConfig { defaultConfig {
versionCode cdvVersionCode ?: Integer.parseInt("" + privateHelpers.extractIntFromManifest("versionCode")) versionCode cdvVersionCode ?: new BigInteger("" + privateHelpers.extractIntFromManifest("versionCode"))
applicationId privateHelpers.extractStringFromManifest("package") applicationId privateHelpers.extractStringFromManifest("package")
if (cdvMinSdkVersion != null) { if (cdvMinSdkVersion != null) {

View File

Before

Width:  |  Height:  |  Size: 5.9 KiB

After

Width:  |  Height:  |  Size: 5.9 KiB

View File

Before

Width:  |  Height:  |  Size: 3.0 KiB

After

Width:  |  Height:  |  Size: 3.0 KiB

View File

Before

Width:  |  Height:  |  Size: 4.0 KiB

After

Width:  |  Height:  |  Size: 4.0 KiB

View File

Before

Width:  |  Height:  |  Size: 7.5 KiB

After

Width:  |  Height:  |  Size: 7.5 KiB

View File

@@ -51,10 +51,11 @@ var cordova = require('cordova'),
// For the ONLINE_EVENT to be viable, it would need to intercept all event // For the ONLINE_EVENT to be viable, it would need to intercept all event
// listeners (both through addEventListener and window.ononline) as well // listeners (both through addEventListener and window.ononline) as well
// as set the navigator property itself. // as set the navigator property itself.
ONLINE_EVENT: 2 ONLINE_EVENT: 2,
EVAL_BRIDGE: 3
}, },
jsToNativeBridgeMode, // Set lazily. jsToNativeBridgeMode, // Set lazily.
nativeToJsBridgeMode = nativeToJsModes.ONLINE_EVENT, nativeToJsBridgeMode = nativeToJsModes.EVAL_BRIDGE,
pollEnabled = false, pollEnabled = false,
bridgeSecret = -1; bridgeSecret = -1;
@@ -77,6 +78,9 @@ function androidExec(success, fail, service, action, args) {
androidExec.setJsToNativeBridgeMode(jsToNativeModes.JS_OBJECT); 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. // Process any ArrayBuffers in the args into a string.
for (var i = 0; i < args.length; i++) { for (var i = 0; i < args.length; i++) {
if (utils.typeName(args[i]) == 'ArrayBuffer') { if (utils.typeName(args[i]) == 'ArrayBuffer') {
@@ -86,7 +90,6 @@ function androidExec(success, fail, service, action, args) {
var callbackId = service + cordova.callbackId++, var callbackId = service + cordova.callbackId++,
argsJson = JSON.stringify(args); argsJson = JSON.stringify(args);
if (success || fail) { if (success || fail) {
cordova.callbacks[callbackId] = {success:success, fail:fail}; cordova.callbacks[callbackId] = {success:success, fail:fail};
} }
@@ -106,6 +109,17 @@ function androidExec(success, fail, service, action, args) {
} }
androidExec.init = function() { 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); bridgeSecret = +prompt('', 'gap_init:' + nativeToJsBridgeMode);
channel.onNativeReady.fire(); channel.onNativeReady.fire();
}; };

View File

@@ -125,7 +125,7 @@ def doExtractIntFromManifest(name) {
def pattern = Pattern.compile(name + "=\"(\\d+)\"") def pattern = Pattern.compile(name + "=\"(\\d+)\"")
def matcher = pattern.matcher(manifestFile.getText()) def matcher = pattern.matcher(manifestFile.getText())
matcher.find() matcher.find()
return Integer.parseInt(matcher.group(1)) return new BigInteger(matcher.group(1))
} }
def doExtractStringFromManifest(name) { def doExtractStringFromManifest(name) {

View File

@@ -10,7 +10,7 @@
# Indicates whether an apk should be generated for each density. # Indicates whether an apk should be generated for each density.
split.density=false split.density=false
# Project target. # Project target.
target=android-23 target=android-24
apk-configurations= apk-configurations=
renderscript.opt.level=O0 renderscript.opt.level=O0
android.library=true android.library=true

View File

@@ -20,8 +20,6 @@ package org.apache.cordova;
import org.json.JSONArray; import org.json.JSONArray;
import android.util.Log;
import org.apache.cordova.CordovaWebView; import org.apache.cordova.CordovaWebView;
import org.apache.cordova.PluginResult; import org.apache.cordova.PluginResult;
import org.json.JSONObject; import org.json.JSONObject;
@@ -38,15 +36,15 @@ public class CallbackContext {
this.callbackId = callbackId; this.callbackId = callbackId;
this.webView = webView; this.webView = webView;
} }
public boolean isFinished() { public boolean isFinished() {
return finished; return finished;
} }
public boolean isChangingThreads() { public boolean isChangingThreads() {
return changingThreads > 0; return changingThreads > 0;
} }
public String getCallbackId() { public String getCallbackId() {
return callbackId; return callbackId;
} }
@@ -54,7 +52,7 @@ public class CallbackContext {
public void sendPluginResult(PluginResult pluginResult) { public void sendPluginResult(PluginResult pluginResult) {
synchronized (this) { synchronized (this) {
if (finished) { 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; return;
} else { } else {
finished = !pluginResult.getKeepCallback(); finished = !pluginResult.getKeepCallback();
@@ -98,7 +96,7 @@ public class CallbackContext {
public void success(byte[] message) { public void success(byte[] message) {
sendPluginResult(new PluginResult(PluginResult.Status.OK, message)); sendPluginResult(new PluginResult(PluginResult.Status.OK, message));
} }
/** /**
* Helper for success callbacks that just returns the Status.OK by default * Helper for success callbacks that just returns the Status.OK by default
* *

View File

@@ -22,7 +22,6 @@ package org.apache.cordova;
import java.util.List; import java.util.List;
import android.app.Activity; import android.app.Activity;
import android.util.Log;
@Deprecated // Use Whitelist, CordovaPrefences, etc. directly. @Deprecated // Use Whitelist, CordovaPrefences, etc. directly.
public class Config { public class Config {
@@ -61,7 +60,7 @@ public class Config {
public static List<PluginEntry> getPluginEntries() { public static List<PluginEntry> getPluginEntries() {
return parser.getPluginEntries(); return parser.getPluginEntries();
} }
public static CordovaPreferences getPreferences() { public static CordovaPreferences getPreferences() {
return parser.getPreferences(); return parser.getPreferences();
} }

View File

@@ -34,7 +34,6 @@ import android.graphics.Color;
import android.media.AudioManager; import android.media.AudioManager;
import android.os.Build; import android.os.Build;
import android.os.Bundle; import android.os.Bundle;
import android.util.Log;
import android.view.Menu; import android.view.Menu;
import android.view.MenuItem; import android.view.MenuItem;
import android.view.View; import android.view.View;
@@ -50,7 +49,7 @@ import android.widget.FrameLayout;
* html file that contains the application. * html file that contains the application.
* *
* As an example: * As an example:
* *
* <pre> * <pre>
* package org.apache.cordova.examples; * package org.apache.cordova.examples;
* *
@@ -67,8 +66,8 @@ import android.widget.FrameLayout;
* } * }
* } * }
* </pre> * </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" * 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 * guide in cordova-docs at http://cordova.apache.org/docs for the documentation
* for the configuration. The use of the set*Property() methods is * for the configuration. The use of the set*Property() methods is
@@ -104,21 +103,27 @@ public class CordovaActivity extends Activity {
*/ */
@Override @Override
public void onCreate(Bundle savedInstanceState) { 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.i(TAG, "Apache Cordova native platform version " + CordovaWebView.CORDOVA_VERSION + " is starting");
LOG.d(TAG, "CordovaActivity.onCreate()"); 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)) { if (!preferences.getBoolean("ShowTitle", false)) {
getWindow().requestFeature(Window.FEATURE_NO_TITLE); getWindow().requestFeature(Window.FEATURE_NO_TITLE);
} }
if (preferences.getBoolean("SetFullscreen", false)) { 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); preferences.set("Fullscreen", true);
} }
if (preferences.getBoolean("Fullscreen", false)) { 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; immersiveMode = true;
} else { } else {
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
@@ -175,9 +180,14 @@ public class CordovaActivity extends Activity {
setContentView(appView.getView()); setContentView(appView.getView());
if (preferences.contains("BackgroundColor")) { if (preferences.contains("BackgroundColor")) {
int backgroundColor = preferences.getInteger("BackgroundColor", Color.BLACK); try {
// Background of activity: int backgroundColor = preferences.getInteger("BackgroundColor", Color.BLACK);
appView.getView().setBackgroundColor(backgroundColor); // Background of activity:
appView.getView().setBackgroundColor(backgroundColor);
}
catch (NumberFormatException e){
e.printStackTrace();
}
} }
appView.getView().requestFocusFromTouch(); appView.getView().requestFocusFromTouch();

View File

@@ -23,8 +23,6 @@ import java.security.SecureRandom;
import org.json.JSONArray; import org.json.JSONArray;
import org.json.JSONException; import org.json.JSONException;
import android.util.Log;
/** /**
* Contains APIs that the JS can call. All functions in here should also have * Contains APIs that the JS can call. All functions in here should also have
* an equivalent entry in CordovaChromeClient.java, and be added to * 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 { private boolean verifySecret(String action, int bridgeSecret) throws IllegalAccessException {
if (!jsMessageQueue.isBridgeEnabled()) { if (!jsMessageQueue.isBridgeEnabled()) {
if (bridgeSecret == -1) { 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 { } else {
Log.d(LOG_TAG, "Ignoring " + action + " from previous page load."); LOG.d(LOG_TAG, "Ignoring " + action + " from previous page load.");
} }
return false; return false;
} }
// Bridge secret wrong and bridge not due to it being from the previous page. // Bridge secret wrong and bridge not due to it being from the previous page.
if (expectedBridgeSecret < 0 || bridgeSecret != expectedBridgeSecret) { 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(); clearBridgeSecret();
throw new IllegalAccessException(); throw new IllegalAccessException();
} }
@@ -120,7 +118,7 @@ public class CordovaBridge {
public void reset() { public void reset() {
jsMessageQueue.reset(); jsMessageQueue.reset();
clearBridgeSecret(); clearBridgeSecret();
} }
public String promptOnJsPrompt(String origin, String message, String defaultValue) { public String promptOnJsPrompt(String origin, String message, String defaultValue) {
@@ -141,7 +139,7 @@ public class CordovaBridge {
} }
return ""; return "";
} }
// Sets the native->JS bridge mode. // Sets the native->JS bridge mode.
else if (defaultValue != null && defaultValue.startsWith("gap_bridge_mode:")) { else if (defaultValue != null && defaultValue.startsWith("gap_bridge_mode:")) {
try { try {
int bridgeSecret = Integer.parseInt(defaultValue.substring(16)); int bridgeSecret = Integer.parseInt(defaultValue.substring(16));
@@ -153,7 +151,7 @@ public class CordovaBridge {
} }
return ""; return "";
} }
// Polling for JavaScript messages // Polling for JavaScript messages
else if (defaultValue != null && defaultValue.startsWith("gap_poll:")) { else if (defaultValue != null && defaultValue.startsWith("gap_poll:")) {
int bridgeSecret = Integer.parseInt(defaultValue.substring(9)); int bridgeSecret = Integer.parseInt(defaultValue.substring(9));
try { try {
@@ -175,7 +173,7 @@ public class CordovaBridge {
int secret = generateBridgeSecret(); int secret = generateBridgeSecret();
return ""+secret; return ""+secret;
} else { } else {
Log.e(LOG_TAG, "gap_init called from restricted origin: " + origin); LOG.e(LOG_TAG, "gap_init called from restricted origin: " + origin);
} }
return ""; return "";
} }

View File

@@ -24,7 +24,6 @@ import android.content.Intent;
import android.content.pm.PackageManager; import android.content.pm.PackageManager;
import android.os.Build; import android.os.Build;
import android.os.Bundle; import android.os.Bundle;
import android.util.Log;
import android.util.Pair; import android.util.Pair;
import org.json.JSONException; import org.json.JSONException;
@@ -147,13 +146,13 @@ public class CordovaInterfaceImpl implements CordovaInterface {
activityResultCallback = null; activityResultCallback = null;
if (callback != null) { if (callback != null) {
Log.d(TAG, "Sending activity result to plugin"); LOG.d(TAG, "Sending activity result to plugin");
initCallbackService = null; initCallbackService = null;
savedResult = null; savedResult = null;
callback.onActivityResult(requestCode, resultCode, intent); callback.onActivityResult(requestCode, resultCode, intent);
return true; 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; return false;
} }

View File

@@ -31,7 +31,7 @@ import android.webkit.WebChromeClient.CustomViewCallback;
* are not expected to implement it. * are not expected to implement it.
*/ */
public interface CordovaWebView { public interface CordovaWebView {
public static final String CORDOVA_VERSION = "5.2.2"; public static final String CORDOVA_VERSION = "6.0.0";
void init(CordovaInterface cordova, List<PluginEntry> pluginEntries, CordovaPreferences preferences); void init(CordovaInterface cordova, List<PluginEntry> pluginEntries, CordovaPreferences preferences);

View File

@@ -20,6 +20,7 @@ package org.apache.cordova;
import android.view.KeyEvent; import android.view.KeyEvent;
import android.view.View; import android.view.View;
import android.webkit.ValueCallback;
/** /**
* Interface for all Cordova engines. * Interface for all Cordova engines.
@@ -58,6 +59,9 @@ public interface CordovaWebViewEngine {
/** Clean up all resources associated with the WebView. */ /** Clean up all resources associated with the WebView. */
void destroy(); 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. * 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(); * E.g. ((CordovaWebView.EngineView)activity.findViewById(android.R.id.webView)).getCordovaWebView();

View File

@@ -21,7 +21,6 @@ package org.apache.cordova;
import android.content.Context; import android.content.Context;
import android.content.Intent; import android.content.Intent;
import android.net.Uri; import android.net.Uri;
import android.util.Log;
import android.view.Gravity; import android.view.Gravity;
import android.view.KeyEvent; import android.view.KeyEvent;
import android.view.View; import android.view.View;
@@ -245,7 +244,7 @@ public class CordovaWebViewImpl implements CordovaWebView {
@Deprecated @Deprecated
public void showCustomView(View view, WebChromeClient.CustomViewCallback callback) { 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 // 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 a view already exists then immediately terminate the new one
if (mCustomView != null) { if (mCustomView != null) {
callback.onCustomViewHidden(); callback.onCustomViewHidden();
@@ -276,7 +275,7 @@ public class CordovaWebViewImpl implements CordovaWebView {
public void hideCustomView() { public void hideCustomView() {
// This code is adapted from the original Android Browser code, licensed under the Apache License, Version 2.0 // This code is adapted from the original Android Browser code, licensed under the Apache License, Version 2.0
if (mCustomView == null) return; if (mCustomView == null) return;
Log.d(TAG, "Hiding Custom View"); LOG.d(TAG, "Hiding Custom View");
// Hide the custom view. // Hide the custom view.
mCustomView.setVisibility(View.GONE); mCustomView.setVisibility(View.GONE);

View File

@@ -30,12 +30,13 @@ import android.content.IntentFilter;
import android.telephony.TelephonyManager; import android.telephony.TelephonyManager;
import android.view.KeyEvent; import android.view.KeyEvent;
import java.lang.reflect.Field;
import java.util.HashMap; import java.util.HashMap;
/** /**
* This class exposes methods in Cordova that can be called from JavaScript. * 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"; public static final String PLUGIN_NAME = "CoreAndroid";
protected static final String TAG = "CordovaApp"; 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;
}
} }

View File

@@ -154,6 +154,16 @@ public class LOG {
if (LOG.INFO >= LOGLEVEL) Log.i(tag, s, e); 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. * Warning log message.
* *

View File

@@ -21,8 +21,6 @@ package org.apache.cordova;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.LinkedList; import java.util.LinkedList;
import android.util.Log;
/** /**
* Holds the list of messages to be sent to the WebView. * 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 // This currently only chops up on message boundaries. It may be useful
// to allow it to break up messages. // to allow it to break up messages.
private static int MAX_PAYLOAD_SIZE = 50 * 1024 * 10240; private static int MAX_PAYLOAD_SIZE = 50 * 1024 * 10240;
/** /**
* When true, the active listener is not fired upon enqueue. When set to false, * 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; private boolean paused;
/** /**
* The list of JavaScript statements to be sent to JavaScript. * 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. * The array of listeners that can be used to send messages to JS.
*/ */
private ArrayList<BridgeMode> bridgeModes = new ArrayList<BridgeMode>(); private ArrayList<BridgeMode> bridgeModes = new ArrayList<BridgeMode>();
/** /**
* When null, the bridge is disabled. This occurs during page transitions. * When null, the bridge is disabled. This occurs during page transitions.
* When disabled, all callbacks are dropped since they are assumed to be * When disabled, all callbacks are dropped since they are assumed to be
@@ -83,11 +81,11 @@ public class NativeToJsMessageQueue {
*/ */
public void setBridgeMode(int value) { public void setBridgeMode(int value) {
if (value < -1 || value >= bridgeModes.size()) { if (value < -1 || value >= bridgeModes.size()) {
Log.d(LOG_TAG, "Invalid NativeToJsBridgeMode: " + value); LOG.d(LOG_TAG, "Invalid NativeToJsBridgeMode: " + value);
} else { } else {
BridgeMode newMode = value < 0 ? null : bridgeModes.get(value); BridgeMode newMode = value < 0 ? null : bridgeModes.get(value);
if (newMode != activeBridgeMode) { 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) { synchronized (this) {
activeBridgeMode = newMode; activeBridgeMode = newMode;
if (newMode != null) { if (newMode != null) {
@@ -100,7 +98,7 @@ public class NativeToJsMessageQueue {
} }
} }
} }
/** /**
* Clears all messages and resets to the default bridge mode. * Clears all messages and resets to the default bridge mode.
*/ */
@@ -114,16 +112,16 @@ public class NativeToJsMessageQueue {
private int calculatePackedMessageLength(JsMessage message) { private int calculatePackedMessageLength(JsMessage message) {
int messageLen = message.calculateEncodedLength(); int messageLen = message.calculateEncodedLength();
String messageLenStr = String.valueOf(messageLen); String messageLenStr = String.valueOf(messageLen);
return messageLenStr.length() + messageLen + 1; return messageLenStr.length() + messageLen + 1;
} }
private void packMessage(JsMessage message, StringBuilder sb) { private void packMessage(JsMessage message, StringBuilder sb) {
int len = message.calculateEncodedLength(); int len = message.calculateEncodedLength();
sb.append(len) sb.append(len)
.append(' '); .append(' ');
message.encodeAsMessage(sb); message.encodeAsMessage(sb);
} }
/** /**
* Combines and returns queued messages combined into a single string. * Combines and returns queued messages combined into a single string.
* Combines as many messages as possible, while staying under MAX_PAYLOAD_SIZE. * Combines as many messages as possible, while staying under MAX_PAYLOAD_SIZE.
@@ -154,7 +152,7 @@ public class NativeToJsMessageQueue {
JsMessage message = queue.removeFirst(); JsMessage message = queue.removeFirst();
packMessage(message, sb); packMessage(message, sb);
} }
if (!queue.isEmpty()) { if (!queue.isEmpty()) {
// Attach a char to indicate that there are more messages pending. // Attach a char to indicate that there are more messages pending.
sb.append('*'); sb.append('*');
@@ -163,7 +161,7 @@ public class NativeToJsMessageQueue {
return ret; return ret;
} }
} }
/** /**
* Same as popAndEncode(), except encodes in a form that can be executed as JS. * 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(); boolean willSendAllMessages = numMessagesToSend == queue.size();
StringBuilder sb = new StringBuilder(totalPayloadLen + (willSendAllMessages ? 0 : 100)); 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. // not affect the next.
for (int i = 0; i < numMessagesToSend; ++i) { for (int i = 0; i < numMessagesToSend; ++i) {
JsMessage message = queue.removeFirst(); JsMessage message = queue.removeFirst();
@@ -206,7 +204,7 @@ public class NativeToJsMessageQueue {
String ret = sb.toString(); String ret = sb.toString();
return ret; return ret;
} }
} }
/** /**
* Add a JavaScript statement to the list. * Add a JavaScript statement to the list.
@@ -220,7 +218,7 @@ public class NativeToJsMessageQueue {
*/ */
public void addPluginResult(PluginResult result, String callbackId) { public void addPluginResult(PluginResult result, String callbackId) {
if (callbackId == null) { 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; return;
} }
// Don't send anything if there is no result and there is no need to // 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) { private void enqueueMessage(JsMessage message) {
synchronized (this) { synchronized (this) {
if (activeBridgeMode == null) { 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; return;
} }
queue.add(message); queue.add(message);
@@ -257,7 +255,7 @@ public class NativeToJsMessageQueue {
if (paused && value) { if (paused && value) {
// This should never happen. If a use-case for it comes up, we should // This should never happen. If a use-case for it comes up, we should
// change pause to be a counter. // 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; paused = value;
if (!value) { if (!value) {
@@ -265,7 +263,7 @@ public class NativeToJsMessageQueue {
if (!queue.isEmpty() && activeBridgeMode != null) { if (!queue.isEmpty() && activeBridgeMode != null) {
activeBridgeMode.onNativeToJsMessageAvailable(this); 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 { private static class JsMessage {
final String jsPayloadOrCallbackId; final String jsPayloadOrCallbackId;
final PluginResult pluginResult; final PluginResult pluginResult;
@@ -368,7 +391,7 @@ public class NativeToJsMessageQueue {
jsPayloadOrCallbackId = callbackId; jsPayloadOrCallbackId = callbackId;
this.pluginResult = pluginResult; this.pluginResult = pluginResult;
} }
static int calculateEncodedLengthHelper(PluginResult pluginResult) { static int calculateEncodedLengthHelper(PluginResult pluginResult) {
switch (pluginResult.getMessageType()) { switch (pluginResult.getMessageType()) {
case PluginResult.MESSAGE_TYPE_BOOLEAN: // f or t case PluginResult.MESSAGE_TYPE_BOOLEAN: // f or t
@@ -395,7 +418,7 @@ public class NativeToJsMessageQueue {
return pluginResult.getMessage().length(); return pluginResult.getMessage().length();
} }
} }
int calculateEncodedLength() { int calculateEncodedLength() {
if (pluginResult == null) { if (pluginResult == null) {
return jsPayloadOrCallbackId.length() + 1; return jsPayloadOrCallbackId.length() + 1;
@@ -424,7 +447,7 @@ public class NativeToJsMessageQueue {
case PluginResult.MESSAGE_TYPE_BINARYSTRING: // S case PluginResult.MESSAGE_TYPE_BINARYSTRING: // S
sb.append('S'); sb.append('S');
sb.append(pluginResult.getMessage()); sb.append(pluginResult.getMessage());
break; break;
case PluginResult.MESSAGE_TYPE_ARRAYBUFFER: // A case PluginResult.MESSAGE_TYPE_ARRAYBUFFER: // A
sb.append('A'); sb.append('A');
sb.append(pluginResult.getMessage()); sb.append(pluginResult.getMessage());
@@ -443,7 +466,7 @@ public class NativeToJsMessageQueue {
sb.append(pluginResult.getMessage()); // [ or { sb.append(pluginResult.getMessage()); // [ or {
} }
} }
void encodeAsMessage(StringBuilder sb) { void encodeAsMessage(StringBuilder sb) {
if (pluginResult == null) { if (pluginResult == null) {
sb.append('J') sb.append('J')

View File

@@ -28,7 +28,6 @@ import android.content.res.Configuration;
import android.net.Uri; import android.net.Uri;
import android.os.Bundle; import android.os.Bundle;
import android.os.Debug; import android.os.Debug;
import android.util.Log;
/** /**
* PluginManager is exposed to JavaScript in the Cordova WebView. * 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) { public void exec(final String service, final String action, final String callbackId, final String rawArgs) {
CordovaPlugin plugin = getPlugin(service); CordovaPlugin plugin = getPlugin(service);
if (plugin == null) { 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); PluginResult cr = new PluginResult(PluginResult.Status.CLASS_NOT_FOUND_EXCEPTION);
app.sendPluginResult(cr, callbackId); app.sendPluginResult(cr, callbackId);
return; return;
@@ -134,7 +133,7 @@ public class PluginManager {
long duration = System.currentTimeMillis() - pluginStartTime; long duration = System.currentTimeMillis() - pluginStartTime;
if (duration > SLOW_EXEC_WARNING_THRESHOLD) { 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) { if (!wasValidAction) {
PluginResult cr = new PluginResult(PluginResult.Status.INVALID_ACTION); PluginResult cr = new PluginResult(PluginResult.Status.INVALID_ACTION);
@@ -144,7 +143,7 @@ public class PluginManager {
PluginResult cr = new PluginResult(PluginResult.Status.JSON_EXCEPTION); PluginResult cr = new PluginResult(PluginResult.Status.JSON_EXCEPTION);
callbackContext.sendPluginResult(cr); callbackContext.sendPluginResult(cr);
} catch (Exception e) { } catch (Exception e) {
Log.e(TAG, "Uncaught exception from plugin", e); LOG.e(TAG, "Uncaught exception from plugin", e);
callbackContext.error(e.getMessage()); callbackContext.error(e.getMessage());
} }
} }
@@ -222,9 +221,9 @@ public class PluginManager {
* @param handler The HttpAuthHandler used to set the WebView's response * @param handler The HttpAuthHandler used to set the WebView's response
* @param host The host requiring authentication * @param host The host requiring authentication
* @param realm The realm for which authentication is required * @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 * @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) { public boolean onReceivedHttpAuthRequest(CordovaWebView view, ICordovaHttpAuthHandler handler, String host, String realm) {
for (CordovaPlugin plugin : this.pluginMap.values()) { for (CordovaPlugin plugin : this.pluginMap.values()) {
@@ -234,7 +233,7 @@ public class PluginManager {
} }
return false; return false;
} }
/** /**
* Called when he system received an SSL client certificate request. Plugin can use * Called when he system received an SSL client certificate request. Plugin can use
* the supplied ClientCertRequest to process this certificate challenge. * the supplied ClientCertRequest to process this certificate challenge.

View File

@@ -26,7 +26,6 @@ import android.content.ActivityNotFoundException;
import android.content.Intent; import android.content.Intent;
import android.net.Uri; import android.net.Uri;
import android.os.Build; import android.os.Build;
import android.util.Log;
import android.view.Gravity; import android.view.Gravity;
import android.view.View; import android.view.View;
import android.view.ViewGroup.LayoutParams; import android.view.ViewGroup.LayoutParams;
@@ -62,7 +61,7 @@ public class SystemWebChromeClient extends WebChromeClient {
// the video progress view // the video progress view
private View mVideoProgressView; private View mVideoProgressView;
private CordovaDialogsHelper dialogsHelper; private CordovaDialogsHelper dialogsHelper;
private Context appContext; 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 // API level 7 is required for this, see if we could lower this using something else
@Override @Override
public void onShowCustomView(View view, WebChromeClient.CustomViewCallback callback) { public void onShowCustomView(View view, WebChromeClient.CustomViewCallback callback) {
@@ -213,9 +212,9 @@ public class SystemWebChromeClient extends WebChromeClient {
*/ */
public View getVideoLoadingProgressView() { public View getVideoLoadingProgressView() {
if (mVideoProgressView == null) { if (mVideoProgressView == null) {
// Create a new Loading view programmatically. // Create a new Loading view programmatically.
// create the linear layout // create the linear layout
LinearLayout layout = new LinearLayout(parentEngine.getView().getContext()); LinearLayout layout = new LinearLayout(parentEngine.getView().getContext());
layout.setOrientation(LinearLayout.VERTICAL); layout.setOrientation(LinearLayout.VERTICAL);
@@ -226,12 +225,12 @@ public class SystemWebChromeClient extends WebChromeClient {
ProgressBar bar = new ProgressBar(parentEngine.getView().getContext()); ProgressBar bar = new ProgressBar(parentEngine.getView().getContext());
LinearLayout.LayoutParams barLayoutParams = new LinearLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT); LinearLayout.LayoutParams barLayoutParams = new LinearLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
barLayoutParams.gravity = Gravity.CENTER; barLayoutParams.gravity = Gravity.CENTER;
bar.setLayoutParams(barLayoutParams); bar.setLayoutParams(barLayoutParams);
layout.addView(bar); layout.addView(bar);
mVideoProgressView = layout; mVideoProgressView = layout;
} }
return mVideoProgressView; return mVideoProgressView;
} }
// <input type=file> support: // <input type=file> support:
@@ -240,11 +239,11 @@ public class SystemWebChromeClient extends WebChromeClient {
public void openFileChooser(ValueCallback<Uri> uploadMsg) { public void openFileChooser(ValueCallback<Uri> uploadMsg) {
this.openFileChooser(uploadMsg, "*/*"); this.openFileChooser(uploadMsg, "*/*");
} }
public void openFileChooser( ValueCallback<Uri> uploadMsg, String acceptType ) { public void openFileChooser( ValueCallback<Uri> uploadMsg, String acceptType ) {
this.openFileChooser(uploadMsg, acceptType, null); this.openFileChooser(uploadMsg, acceptType, null);
} }
public void openFileChooser(final ValueCallback<Uri> uploadMsg, String acceptType, String capture) public void openFileChooser(final ValueCallback<Uri> uploadMsg, String acceptType, String capture)
{ {
Intent intent = new Intent(Intent.ACTION_GET_CONTENT); Intent intent = new Intent(Intent.ACTION_GET_CONTENT);
@@ -254,7 +253,7 @@ public class SystemWebChromeClient extends WebChromeClient {
@Override @Override
public void onActivityResult(int requestCode, int resultCode, Intent intent) { public void onActivityResult(int requestCode, int resultCode, Intent intent) {
Uri result = intent == null || resultCode != Activity.RESULT_OK ? null : intent.getData(); 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); uploadMsg.onReceiveValue(result);
} }
}, intent, FILECHOOSER_RESULTCODE); }, intent, FILECHOOSER_RESULTCODE);
@@ -269,12 +268,12 @@ public class SystemWebChromeClient extends WebChromeClient {
@Override @Override
public void onActivityResult(int requestCode, int resultCode, Intent intent) { public void onActivityResult(int requestCode, int resultCode, Intent intent) {
Uri[] result = WebChromeClient.FileChooserParams.parseResult(resultCode, 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); filePathsCallback.onReceiveValue(result);
} }
}, intent, FILECHOOSER_RESULTCODE); }, intent, FILECHOOSER_RESULTCODE);
} catch (ActivityNotFoundException e) { } 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); filePathsCallback.onReceiveValue(null);
} }
return true; return true;
@@ -283,7 +282,7 @@ public class SystemWebChromeClient extends WebChromeClient {
@TargetApi(Build.VERSION_CODES.LOLLIPOP) @TargetApi(Build.VERSION_CODES.LOLLIPOP)
@Override @Override
public void onPermissionRequest(final PermissionRequest request) { 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()); request.grant(request.getResources());
} }

View File

@@ -27,8 +27,8 @@ import android.content.Intent;
import android.content.IntentFilter; import android.content.IntentFilter;
import android.content.pm.ApplicationInfo; import android.content.pm.ApplicationInfo;
import android.os.Build; import android.os.Build;
import android.util.Log;
import android.view.View; import android.view.View;
import android.webkit.ValueCallback;
import android.webkit.WebSettings; import android.webkit.WebSettings;
import android.webkit.WebSettings.LayoutAlgorithm; import android.webkit.WebSettings.LayoutAlgorithm;
import android.webkit.WebView; import android.webkit.WebView;
@@ -40,6 +40,7 @@ import org.apache.cordova.CordovaResourceApi;
import org.apache.cordova.CordovaWebView; import org.apache.cordova.CordovaWebView;
import org.apache.cordova.CordovaWebViewEngine; import org.apache.cordova.CordovaWebViewEngine;
import org.apache.cordova.ICordovaCookieManager; import org.apache.cordova.ICordovaCookieManager;
import org.apache.cordova.LOG;
import org.apache.cordova.NativeToJsMessageQueue; import org.apache.cordova.NativeToJsMessageQueue;
import org.apache.cordova.PluginManager; import org.apache.cordova.PluginManager;
@@ -116,7 +117,9 @@ public class SystemWebViewEngine implements CordovaWebViewEngine {
SystemWebViewEngine.this.cordova.getActivity().runOnUiThread(r); 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); exposeJsInterface(webView, bridge);
} }
@@ -145,32 +148,32 @@ public class SystemWebViewEngine implements CordovaWebViewEngine {
settings.setJavaScriptEnabled(true); settings.setJavaScriptEnabled(true);
settings.setJavaScriptCanOpenWindowsAutomatically(true); settings.setJavaScriptCanOpenWindowsAutomatically(true);
settings.setLayoutAlgorithm(LayoutAlgorithm.NORMAL); settings.setLayoutAlgorithm(LayoutAlgorithm.NORMAL);
// Set the nav dump for HTC 2.x devices (disabling for ICS, deprecated entirely for Jellybean 4.2) // Set the nav dump for HTC 2.x devices (disabling for ICS, deprecated entirely for Jellybean 4.2)
try { try {
Method gingerbread_getMethod = WebSettings.class.getMethod("setNavDump", new Class[] { boolean.class }); Method gingerbread_getMethod = WebSettings.class.getMethod("setNavDump", new Class[] { boolean.class });
String manufacturer = android.os.Build.MANUFACTURER; 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 && if(android.os.Build.VERSION.SDK_INT < android.os.Build.VERSION_CODES.HONEYCOMB &&
android.os.Build.MANUFACTURER.contains("HTC")) android.os.Build.MANUFACTURER.contains("HTC"))
{ {
gingerbread_getMethod.invoke(settings, true); gingerbread_getMethod.invoke(settings, true);
} }
} catch (NoSuchMethodException e) { } 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) { } 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) { } 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) { } 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 //We don't save any form data in the application
settings.setSaveFormData(false); settings.setSaveFormData(false);
settings.setSavePassword(false); settings.setSavePassword(false);
// Jellybean rightfully tried to lock this down. Too bad they didn't give us a whitelist // Jellybean rightfully tried to lock this down. Too bad they didn't give us a whitelist
// while we do this // while we do this
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.JELLY_BEAN) { 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(); String databasePath = webView.getContext().getApplicationContext().getDir("database", Context.MODE_PRIVATE).getPath();
settings.setDatabaseEnabled(true); settings.setDatabaseEnabled(true);
settings.setDatabasePath(databasePath); settings.setDatabasePath(databasePath);
//Determine whether we're in debug or release mode, and turn on Debugging! //Determine whether we're in debug or release mode, and turn on Debugging!
ApplicationInfo appInfo = webView.getContext().getApplicationContext().getApplicationInfo(); ApplicationInfo appInfo = webView.getContext().getApplicationContext().getApplicationInfo();
if ((appInfo.flags & ApplicationInfo.FLAG_DEBUGGABLE) != 0 && if ((appInfo.flags & ApplicationInfo.FLAG_DEBUGGABLE) != 0 &&
android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.KITKAT) { android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.KITKAT) {
enableRemoteDebugging(); enableRemoteDebugging();
} }
settings.setGeolocationDatabasePath(databasePath); settings.setGeolocationDatabasePath(databasePath);
// Enable DOM storage // Enable DOM storage
@@ -200,13 +203,13 @@ public class SystemWebViewEngine implements CordovaWebViewEngine {
// Enable built-in geolocation // Enable built-in geolocation
settings.setGeolocationEnabled(true); settings.setGeolocationEnabled(true);
// Enable AppCache // Enable AppCache
// Fix for CB-2282 // Fix for CB-2282
settings.setAppCacheMaxSize(5 * 1048576); settings.setAppCacheMaxSize(5 * 1048576);
settings.setAppCachePath(databasePath); settings.setAppCachePath(databasePath);
settings.setAppCacheEnabled(true); settings.setAppCacheEnabled(true);
// Fix for CB-1405 // Fix for CB-1405
// Google issue 4641 // Google issue 4641
String defaultUserAgent = settings.getUserAgentString(); String defaultUserAgent = settings.getUserAgentString();
@@ -222,7 +225,7 @@ public class SystemWebViewEngine implements CordovaWebViewEngine {
} }
} }
// End CB-3360 // End CB-3360
IntentFilter intentFilter = new IntentFilter(); IntentFilter intentFilter = new IntentFilter();
intentFilter.addAction(Intent.ACTION_CONFIGURATION_CHANGED); intentFilter.addAction(Intent.ACTION_CONFIGURATION_CHANGED);
if (this.receiver == null) { if (this.receiver == null) {
@@ -242,18 +245,18 @@ public class SystemWebViewEngine implements CordovaWebViewEngine {
try { try {
WebView.setWebContentsDebuggingEnabled(true); WebView.setWebContentsDebuggingEnabled(true);
} catch (IllegalArgumentException e) { } 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(); e.printStackTrace();
} }
} }
private static void exposeJsInterface(WebView webView, CordovaBridge bridge) { private static void exposeJsInterface(WebView webView, CordovaBridge bridge) {
if ((Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN_MR1)) { 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. // 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 // This isn't hard to work-around on the JS side, but it's easier to just
// use the prompt bridge instead. // use the prompt bridge instead.
return; return;
} }
SystemExposedJsApi exposedJsApi = new SystemExposedJsApi(bridge); SystemExposedJsApi exposedJsApi = new SystemExposedJsApi(bridge);
webView.addJavascriptInterface(exposedJsApi, "_cordovaNative"); webView.addJavascriptInterface(exposedJsApi, "_cordovaNative");
@@ -312,8 +315,10 @@ public class SystemWebViewEngine implements CordovaWebViewEngine {
@Override @Override
public void setPaused(boolean value) { public void setPaused(boolean value) {
if (value) { if (value) {
webView.onPause();
webView.pauseTimers(); webView.pauseTimers();
} else { } else {
webView.onResume();
webView.resumeTimers(); webView.resumeTimers();
} }
} }
@@ -327,8 +332,19 @@ public class SystemWebViewEngine implements CordovaWebViewEngine {
try { try {
webView.getContext().unregisterReceiver(receiver); webView.getContext().unregisterReceiver(receiver);
} catch (Exception e) { } 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/package.json generated vendored
View File

@@ -39,6 +39,7 @@
"type": "range" "type": "range"
}, },
"_requiredBy": [ "_requiredBy": [
"/istanbul",
"/nopt" "/nopt"
], ],
"_resolved": "http://registry.npmjs.org/abbrev/-/abbrev-1.0.9.tgz", "_resolved": "http://registry.npmjs.org/abbrev/-/abbrev-1.0.9.tgz",

17
node_modules/big-integer/.npmignore generated vendored Normal file
View File

@@ -0,0 +1,17 @@
/.travis.yml
/.npmignore
/.gitignore
/spec
/benchmark
/big-integer*.tgz
/my.conf.js
/node_modules
/*.csproj*
/*.sh
/*.suo
/bin
/coverage
/*.bat
/obj
/Properties
/Web.*

View File

@@ -301,7 +301,7 @@ var bigInt = (function (undefined) {
function multiplyKaratsuba(x, y) { function multiplyKaratsuba(x, y) {
var n = Math.max(x.length, y.length); var n = Math.max(x.length, y.length);
if (n <= 30) return multiplyLong(x, y); if (n <= 30) return multiplyLong(x, y);
n = Math.ceil(n / 2); n = Math.ceil(n / 2);
@@ -822,6 +822,24 @@ var bigInt = (function (undefined) {
}; };
SmallInteger.prototype.isProbablePrime = BigInteger.prototype.isProbablePrime; 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 (t.compare(0) === -1) {
t = t.add(n);
}
return t;
}
SmallInteger.prototype.modInv = BigInteger.prototype.modInv;
BigInteger.prototype.next = function () { BigInteger.prototype.next = function () {
var value = this.value; var value = this.value;
if (this.sign) { if (this.sign) {
@@ -1114,7 +1132,7 @@ var bigInt = (function (undefined) {
return this.value; return this.value;
}; };
SmallInteger.prototype.toJSNumber = SmallInteger.prototype.valueOf; SmallInteger.prototype.toJSNumber = SmallInteger.prototype.valueOf;
function parseStringValue(v) { function parseStringValue(v) {
if (isPrecise(+v)) { if (isPrecise(+v)) {
var x = +v; var x = +v;
@@ -1153,7 +1171,7 @@ var bigInt = (function (undefined) {
trim(r); trim(r);
return new BigInteger(r, sign); return new BigInteger(r, sign);
} }
function parseNumberValue(v) { function parseNumberValue(v) {
if (isPrecise(v)) { if (isPrecise(v)) {
if (v !== truncate(v)) throw new Error(v + " is not an integer."); if (v !== truncate(v)) throw new Error(v + " is not an integer.");

File diff suppressed because one or more lines are too long

24
node_modules/big-integer/LICENSE generated vendored
View File

@@ -1,24 +0,0 @@
This is free and unencumbered software released into the public domain.
Anyone is free to copy, modify, publish, use, compile, sell, or
distribute this software, either in source code form or as a compiled
binary, for any purpose, commercial or non-commercial, and by any
means.
In jurisdictions that recognize copyright laws, the author or authors
of this software dedicate any and all copyright interest in the
software to the public domain. We make this dedication for the benefit
of the public at large and to the detriment of our heirs and
successors. We intend this dedication to be an overt act of
relinquishment in perpetuity of all present and future rights to this
software under copyright law.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.
For more information, please refer to <http://unlicense.org>

7
node_modules/big-integer/README.md generated vendored
View File

@@ -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) [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)` #### `modPow(exp, mod)`
Takes the number to the power `exp` modulo `mod`. Takes the number to the power `exp` modulo `mod`.

30
node_modules/big-integer/bower.json generated vendored Normal file
View 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"
]
}

View File

@@ -14,20 +14,20 @@
] ]
], ],
"_from": "big-integer@>=1.6.7 <2.0.0", "_from": "big-integer@>=1.6.7 <2.0.0",
"_id": "big-integer@1.6.15", "_id": "big-integer@1.6.16",
"_inCache": true, "_inCache": true,
"_installable": true, "_installable": true,
"_location": "/big-integer", "_location": "/big-integer",
"_nodeVersion": "0.12.3", "_nodeVersion": "4.4.5",
"_npmOperationalInternal": { "_npmOperationalInternal": {
"host": "packages-12-west.internal.npmjs.com", "host": "packages-16-east.internal.npmjs.com",
"tmp": "tmp/big-integer-1.6.15.tgz_1460079231162_0.7087579960934818" "tmp": "tmp/big-integer-1.6.16.tgz_1473665148825_0.5824211346916854"
}, },
"_npmUser": { "_npmUser": {
"name": "peterolson", "name": "peterolson",
"email": "peter.e.c.olson+npm@gmail.com" "email": "peter.e.c.olson+npm@gmail.com"
}, },
"_npmVersion": "2.9.1", "_npmVersion": "2.15.5",
"_phantomChildren": {}, "_phantomChildren": {},
"_requested": { "_requested": {
"raw": "big-integer@^1.6.7", "raw": "big-integer@^1.6.7",
@@ -41,8 +41,8 @@
"_requiredBy": [ "_requiredBy": [
"/bplist-parser" "/bplist-parser"
], ],
"_resolved": "http://registry.npmjs.org/big-integer/-/big-integer-1.6.15.tgz", "_resolved": "http://registry.npmjs.org/big-integer/-/big-integer-1.6.16.tgz",
"_shasum": "33d27d3b7388dfcc4b86d3130c10740cec01fb9e", "_shasum": "0ca30b58013db46b10084a09242ca1d8954724cc",
"_shrinkwrap": null, "_shrinkwrap": null,
"_spec": "big-integer@^1.6.7", "_spec": "big-integer@^1.6.7",
"_where": "/Users/steveng/repo/cordova/cordova-android/node_modules/bplist-parser", "_where": "/Users/steveng/repo/cordova/cordova-android/node_modules/bplist-parser",
@@ -68,13 +68,13 @@
}, },
"directories": {}, "directories": {},
"dist": { "dist": {
"shasum": "33d27d3b7388dfcc4b86d3130c10740cec01fb9e", "shasum": "0ca30b58013db46b10084a09242ca1d8954724cc",
"tarball": "https://registry.npmjs.org/big-integer/-/big-integer-1.6.15.tgz" "tarball": "https://registry.npmjs.org/big-integer/-/big-integer-1.6.16.tgz"
}, },
"engines": { "engines": {
"node": ">=0.6" "node": ">=0.6"
}, },
"gitHead": "cda5bcce74c3a4eb34951201d50c1b8776a56eca", "gitHead": "09b50ab4e701a2ec4d403fa3ecf12ae327227190",
"homepage": "https://github.com/peterolson/BigInteger.js#readme", "homepage": "https://github.com/peterolson/BigInteger.js#readme",
"keywords": [ "keywords": [
"math", "math",
@@ -105,5 +105,5 @@
"scripts": { "scripts": {
"test": "karma start my.conf.js" "test": "karma start my.conf.js"
}, },
"version": "1.6.15" "version": "1.6.16"
} }

View File

@@ -20,6 +20,19 @@
--> -->
# Cordova-common Release Notes # Cordova-common Release Notes
### 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) ### 1.4.1 (Aug 09, 2016)
* Add general purpose `ConfigParser.getAttribute` API * Add general purpose `ConfigParser.getAttribute` API
* [CB-11653](https://issues.apache.org/jira/browse/CB-11653) moved `findProjectRoot` from `cordova-lib` to `cordova-common` * [CB-11653](https://issues.apache.org/jira/browse/CB-11653) moved `findProjectRoot` from `cordova-lib` to `cordova-common`
@@ -27,6 +40,9 @@
* [CB-11645](https://issues.apache.org/jira/browse/CB-11645) added check to see if `getEditConfig` exists before trying to use it * [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 * [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) ### 1.3.0 (May 12, 2016)
* [CB-11259](https://issues.apache.org/jira/browse/CB-11259): Improving prepare and build logging * [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 * [CB-11194](https://issues.apache.org/jira/browse/CB-11194) Improve cordova load time

View File

@@ -2,49 +2,49 @@
"_args": [ "_args": [
[ [
{ {
"raw": "cordova-common@^1.4.0", "raw": "cordova-common@^1.5.0",
"scope": null, "scope": null,
"escapedName": "cordova-common", "escapedName": "cordova-common",
"name": "cordova-common", "name": "cordova-common",
"rawSpec": "^1.4.0", "rawSpec": "^1.5.0",
"spec": ">=1.4.0 <2.0.0", "spec": ">=1.5.0 <2.0.0",
"type": "range" "type": "range"
}, },
"/Users/steveng/repo/cordova/cordova-android" "/Users/steveng/repo/cordova/cordova-android"
] ]
], ],
"_from": "cordova-common@>=1.4.0 <2.0.0", "_from": "cordova-common@>=1.5.0 <2.0.0",
"_id": "cordova-common@1.4.1", "_id": "cordova-common@1.5.1",
"_inCache": true, "_inCache": true,
"_installable": true, "_installable": true,
"_location": "/cordova-common", "_location": "/cordova-common",
"_nodeVersion": "6.2.2", "_nodeVersion": "6.6.0",
"_npmOperationalInternal": { "_npmOperationalInternal": {
"host": "packages-16-east.internal.npmjs.com", "host": "packages-12-west.internal.npmjs.com",
"tmp": "tmp/cordova-common-1.4.1.tgz_1471306335501_0.6723270947113633" "tmp": "tmp/cordova-common-1.5.1.tgz_1476725179180_0.39604957425035536"
}, },
"_npmUser": { "_npmUser": {
"name": "stevegill", "name": "stevegill",
"email": "stevengill97@gmail.com" "email": "stevengill97@gmail.com"
}, },
"_npmVersion": "3.9.5", "_npmVersion": "3.10.3",
"_phantomChildren": {}, "_phantomChildren": {},
"_requested": { "_requested": {
"raw": "cordova-common@^1.4.0", "raw": "cordova-common@^1.5.0",
"scope": null, "scope": null,
"escapedName": "cordova-common", "escapedName": "cordova-common",
"name": "cordova-common", "name": "cordova-common",
"rawSpec": "^1.4.0", "rawSpec": "^1.5.0",
"spec": ">=1.4.0 <2.0.0", "spec": ">=1.5.0 <2.0.0",
"type": "range" "type": "range"
}, },
"_requiredBy": [ "_requiredBy": [
"/" "/"
], ],
"_resolved": "file:cordova-dist-dev/CB-11690/cordova-common-1.4.1.tgz", "_resolved": "file:cordova-dist/tools/cordova-common-1.5.1.tgz",
"_shasum": "8b4f07b3199b398fff553b32bff66676ecd30ab9", "_shasum": "6770de0d6200ad6f94a1abe8939b5bd9ece139e3",
"_shrinkwrap": null, "_shrinkwrap": null,
"_spec": "cordova-common@^1.4.0", "_spec": "cordova-common@^1.5.0",
"_where": "/Users/steveng/repo/cordova/cordova-android", "_where": "/Users/steveng/repo/cordova/cordova-android",
"author": { "author": {
"name": "Apache Software Foundation" "name": "Apache Software Foundation"
@@ -79,8 +79,8 @@
}, },
"directories": {}, "directories": {},
"dist": { "dist": {
"shasum": "8b4f07b3199b398fff553b32bff66676ecd30ab9", "shasum": "6770de0d6200ad6f94a1abe8939b5bd9ece139e3",
"tarball": "https://registry.npmjs.org/cordova-common/-/cordova-common-1.4.1.tgz" "tarball": "https://registry.npmjs.org/cordova-common/-/cordova-common-1.5.1.tgz"
}, },
"engineStrict": true, "engineStrict": true,
"engines": { "engines": {
@@ -127,5 +127,5 @@
"jshint": "node node_modules/jshint/bin/jshint src && node node_modules/jshint/bin/jshint spec", "jshint": "node node_modules/jshint/bin/jshint src && node node_modules/jshint/bin/jshint spec",
"test": "npm run jshint && npm run jasmine" "test": "npm run jshint && npm run jasmine"
}, },
"version": "1.4.1" "version": "1.5.1"
} }

View File

@@ -148,6 +148,11 @@ function add_plugin_changes(pluginInfo, plugin_vars, is_top_level, should_increm
} }
else { else {
var isConflictingInfo = is_conflicting(edit_config_changes, platform_config.config_munge, self, plugin_force); 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) { 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.'); CordovaLogger.get().log(CordovaLogger.WARN, '--force is used. edit-config will overwrite conflicts if any. Conflicting plugins may not work as expected.');
@@ -170,7 +175,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); 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. // 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) // If should_increment is set to false, avoid modifying the global_munge (use clone)
@@ -196,11 +261,10 @@ function add_plugin_changes(pluginInfo, plugin_vars, is_top_level, should_increm
}); });
/* jshint loopfunc:false */ /* jshint loopfunc:false */
} }
self.apply_file_munge(file, munge.files[file]); 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; return self;
} }
@@ -221,6 +285,39 @@ function reapply_global_munge () {
return self; 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_plugin_config_munge
// Generate the munge object from plugin.xml + vars // Generate the munge object from plugin.xml + vars
@@ -335,7 +432,9 @@ function generate_plugin_config_munge(pluginInfo, vars, edit_config_changes) {
} }
// 2. add into munge // 2. add into munge
if (change.mode) { 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 { else {
mungeutil.deep_add(munge, change.target, change.parent, { xml: stringified, count: 1, after: change.after }); mungeutil.deep_add(munge, change.target, change.parent, { xml: stringified, count: 1, after: change.after });
@@ -348,7 +447,9 @@ function generate_plugin_config_munge(pluginInfo, vars, edit_config_changes) {
function is_conflicting(editchanges, config_munge, self, force) { function is_conflicting(editchanges, config_munge, self, force) {
var files = config_munge.files; var files = config_munge.files;
var conflictFound = false; var conflictFound = false;
var conflictWithConfigxml = false;
var conflictingMunge = { files: {} }; var conflictingMunge = { files: {} };
var configxmlMunge = { files: {} };
var conflictingParent; var conflictingParent;
var conflictingPlugin; var conflictingPlugin;
@@ -378,23 +479,43 @@ function is_conflicting(editchanges, config_munge, self, force) {
conflictingParent = editchange.target; conflictingParent = editchange.target;
} }
if (target.length !== 0) { if (target && target.length !== 0) {
// conflict has been found, exit and throw an error // conflict has been found
conflictFound = true; 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 if (editchange.id === 'config.xml') {
mungeutil.deep_add(conflictingMunge, editchange.file, conflictingParent, target[0]); 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 // Go over the prepare queue and apply the config munges for each plugin

View File

@@ -110,6 +110,9 @@ ConfigFile.prototype.graft_child = function ConfigFile_graft_child(selector, xml
case 'overwrite': case 'overwrite':
result = modules.xml_helpers.graftXMLOverwrite(self.data, xml_to_graft, selector, xml_child); result = modules.xml_helpers.graftXMLOverwrite(self.data, xml_to_graft, selector, xml_child);
break; break;
case 'remove':
result= true;
break;
default: default:
result = modules.xml_helpers.graftXML(self.data, xml_to_graft, selector, xml_child.after); 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': case 'overwrite':
result = modules.xml_helpers.pruneXMLRestore(self.data, selector, xml_child); result = modules.xml_helpers.pruneXMLRestore(self.data, selector, xml_child);
break; break;
case 'remove':
result = modules.xml_helpers.prunXMLRemove(self.data, selector, xml_to_graft);
break;
default: default:
result = modules.xml_helpers.pruneXML(self.data, xml_to_graft, selector); result = modules.xml_helpers.pruneXML(self.data, xml_to_graft, selector);
} }
@@ -193,6 +199,12 @@ function resolveConfigFilePath(project_dir, platform, file) {
return filepath; 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. // None of the special cases matched, returning project_dir/file.
return filepath; return filepath;
} }

View File

@@ -448,10 +448,19 @@ ConfigParser.prototype = {
return accesses.map(function(access){ return accesses.map(function(access){
var minimum_tls_version = access.attrib['minimum-tls-version']; /* String */ var minimum_tls_version = access.attrib['minimum-tls-version']; /* String */
var requires_forward_secrecy = access.attrib['requires-forward-secrecy']; /* Boolean */ 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 { return {
'origin': access.attrib.origin, 'origin': access.attrib.origin,
'minimum_tls_version': minimum_tls_version, '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 +470,44 @@ ConfigParser.prototype = {
return allow_navigations.map(function(allow_navigation){ return allow_navigations.map(function(allow_navigation){
var minimum_tls_version = allow_navigation.attrib['minimum-tls-version']; /* String */ var minimum_tls_version = allow_navigation.attrib['minimum-tls-version']; /* String */
var requires_forward_secrecy = allow_navigation.attrib['requires-forward-secrecy']; /* Boolean */ var requires_forward_secrecy = allow_navigation.attrib['requires-forward-secrecy']; /* Boolean */
var requires_certificate_transparency = allow_navigation.attrib['requires-certificate-transparency']; /* Boolean */
return { return {
'href': allow_navigation.attrib.href, 'href': allow_navigation.attrib.href,
'minimum_tls_version': minimum_tls_version, '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() { write:function() {
fs.writeFileSync(this.path, this.doc.write({indent: 4}), 'utf-8'); fs.writeFileSync(this.path, this.doc.write({indent: 4}), 'utf-8');
} }

View File

@@ -285,14 +285,14 @@ function mergeAndUpdateDir(sourceDirs, targetDir, options, log) {
} }
// Scan the files in each of the source directories. // Scan the files in each of the source directories.
var sourceMaps = []; var sourceMaps = sourceDirs.map(function (sourceDir) {
for (var i in sourceDirs) { return path.join(rootDir, sourceDir);
var sourceFullPath = path.join(rootDir, sourceDirs[i]); }).map(function (sourcePath) {
if (!fs.existsSync(sourceFullPath)) { if (!fs.existsSync(sourcePath)) {
throw new Error("Source directory does not exist: " + sourceDirs[i]); throw new Error("Source directory does not exist: " + sourcePath);
} }
sourceMaps[i] = mapDirectory(rootDir, sourceDirs[i], include, exclude); return mapDirectory(rootDir, path.relative(rootDir, sourcePath), include, exclude);
} });
// Scan the files in the target directory, if it exists. // Scan the files in the target directory, if it exists.
var targetMap = {}; var targetMap = {};
@@ -331,46 +331,40 @@ function mapDirectory(rootDir, subDir, include, exclude) {
function mapSubdirectory(rootDir, subDir, relativeDir, include, exclude, dirMap) { function mapSubdirectory(rootDir, subDir, relativeDir, include, exclude, dirMap) {
var itemMapped = false; var itemMapped = false;
var items = fs.readdirSync(path.join(rootDir, subDir, relativeDir)); 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. items.forEach(function(item) {
if (matchGlobArray(relativePath, exclude)) { var relativePath = path.join(relativeDir, item);
continue; 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) if (stats.isDirectory()) {
// are saved for later, where the modified times may also be used. This minimizes // Directories are included if either something under them is included or they
// the number of file I/O operations performed. // match an include glob.
var fullPath = path.join(rootDir, subDir, relativePath); if (mapSubdirectory(rootDir, subDir, relativePath, include, exclude, dirMap) ||
var stats = fs.statSync(fullPath); matchGlobArray(relativePath, include)) {
dirMap[relativePath] = { subDir: subDir, stats: stats };
if (stats.isDirectory()) { itemMapped = true;
// Directories are included if either something under them is included or they }
// match an include glob. } else if (stats.isFile()) {
if (mapSubdirectory(rootDir, subDir, relativePath, include, exclude, dirMap) || // Files are included only if they match an include glob.
matchGlobArray(relativePath, include)) { if (matchGlobArray(relativePath, include)) {
dirMap[relativePath] = { subDir: subDir, stats: stats }; dirMap[relativePath] = { subDir: subDir, stats: stats };
itemMapped = true; 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; return itemMapped;
} }
function matchGlobArray(path, globs) { function matchGlobArray(path, globs) {
for (var i in globs) { return globs.some(function(elem) {
if (minimatch(path, globs[i])) { return minimatch(path, elem, {dot:true});
return true; });
}
}
return false;
} }
} }
@@ -384,7 +378,7 @@ function mergePathMaps(sourceMaps, targetMap, targetDir) {
// Target stats will be filled in below for targets that exist. // Target stats will be filled in below for targets that exist.
var pathMap = {}; var pathMap = {};
sourceMaps.forEach(function (sourceMap) { sourceMaps.forEach(function (sourceMap) {
for (var sourceSubPath in sourceMap) { Object.keys(sourceMap).forEach(function(sourceSubPath){
var sourceEntry = sourceMap[sourceSubPath]; var sourceEntry = sourceMap[sourceSubPath];
pathMap[sourceSubPath] = { pathMap[sourceSubPath] = {
targetPath: path.join(targetDir, sourceSubPath), targetPath: path.join(targetDir, sourceSubPath),
@@ -392,12 +386,12 @@ function mergePathMaps(sourceMaps, targetMap, targetDir) {
sourcePath: path.join(sourceEntry.subDir, sourceSubPath), sourcePath: path.join(sourceEntry.subDir, sourceSubPath),
sourceStats: sourceEntry.stats sourceStats: sourceEntry.stats
}; };
} });
}); });
// Fill in target stats for targets that exist, and create entries // Fill in target stats for targets that exist, and create entries
// for targets that don't have any corresponding sources. // for targets that don't have any corresponding sources.
for (var subPath in targetMap) { Object.keys(targetMap).forEach(function(subPath){
var entry = pathMap[subPath]; var entry = pathMap[subPath];
if (entry) { if (entry) {
entry.targetStats = targetMap[subPath].stats; entry.targetStats = targetMap[subPath].stats;
@@ -409,7 +403,7 @@ function mergePathMaps(sourceMaps, targetMap, targetDir) {
sourceStats: null sourceStats: null
}; };
} }
} });
return pathMap; return pathMap;
} }

View File

@@ -160,6 +160,23 @@ module.exports = {
return true; 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) { parseElementtreeSync: function (filename) {
var contents = fs.readFileSync(filename, 'utf-8'); var contents = fs.readFileSync(filename, 'utf-8');

3
node_modules/glob/package.json generated vendored
View File

@@ -35,7 +35,8 @@
"type": "range" "type": "range"
}, },
"_requiredBy": [ "_requiredBy": [
"/cordova-common" "/cordova-common",
"/istanbul"
], ],
"_resolved": "http://registry.npmjs.org/glob/-/glob-5.0.15.tgz", "_resolved": "http://registry.npmjs.org/glob/-/glob-5.0.15.tgz",
"_shasum": "1bc936b9e02f4a603fcc222ecf7633d30b8b93b1", "_shasum": "1bc936b9e02f4a603fcc222ecf7633d30b8b93b1",

34
node_modules/inflight/inflight.js generated vendored
View File

@@ -19,18 +19,28 @@ function makeres (key) {
var cbs = reqs[key] var cbs = reqs[key]
var len = cbs.length var len = cbs.length
var args = slice(arguments) var args = slice(arguments)
for (var i = 0; i < len; i++) {
cbs[i].apply(null, args) // XXX It's somewhat ambiguous whether a new callback added in this
} // pass should be queued for later execution if something in the
if (cbs.length > len) { // list of callbacks throws, or if it should just be discarded.
// added more in the interim. // However, it's such an edge case that it hardly matters, and either
// de-zalgo, just in case, but don't call again. // choice is likely as surprising as the other.
cbs.splice(0, len) // As it happens, we do go ahead and schedule it for later execution.
process.nextTick(function () { try {
RES.apply(null, args) for (var i = 0; i < len; i++) {
}) cbs[i].apply(null, args)
} else { }
delete reqs[key] } 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
View File

@@ -14,20 +14,20 @@
] ]
], ],
"_from": "inflight@>=1.0.4 <2.0.0", "_from": "inflight@>=1.0.4 <2.0.0",
"_id": "inflight@1.0.5", "_id": "inflight@1.0.6",
"_inCache": true, "_inCache": true,
"_installable": true, "_installable": true,
"_location": "/inflight", "_location": "/inflight",
"_nodeVersion": "5.10.1", "_nodeVersion": "6.5.0",
"_npmOperationalInternal": { "_npmOperationalInternal": {
"host": "packages-12-west.internal.npmjs.com", "host": "packages-16-east.internal.npmjs.com",
"tmp": "tmp/inflight-1.0.5.tgz_1463529611443_0.00041943578980863094" "tmp": "tmp/inflight-1.0.6.tgz_1476330807696_0.10388551792129874"
}, },
"_npmUser": { "_npmUser": {
"name": "zkat", "name": "isaacs",
"email": "kat@sykosomatic.org" "email": "i@izs.me"
}, },
"_npmVersion": "3.9.1", "_npmVersion": "3.10.7",
"_phantomChildren": {}, "_phantomChildren": {},
"_requested": { "_requested": {
"raw": "inflight@^1.0.4", "raw": "inflight@^1.0.4",
@@ -39,10 +39,11 @@
"type": "range" "type": "range"
}, },
"_requiredBy": [ "_requiredBy": [
"/cli/glob",
"/glob" "/glob"
], ],
"_resolved": "http://registry.npmjs.org/inflight/-/inflight-1.0.5.tgz", "_resolved": "http://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz",
"_shasum": "db3204cd5a9de2e6cd890b85c6e2f66bcf4f620a", "_shasum": "49bd6331d7d02d0c09bc910a1075ba8165b56df9",
"_shrinkwrap": null, "_shrinkwrap": null,
"_spec": "inflight@^1.0.4", "_spec": "inflight@^1.0.4",
"_where": "/Users/steveng/repo/cordova/cordova-android/node_modules/glob", "_where": "/Users/steveng/repo/cordova/cordova-android/node_modules/glob",
@@ -60,17 +61,17 @@
}, },
"description": "Add callbacks to requests in flight to avoid async duplication", "description": "Add callbacks to requests in flight to avoid async duplication",
"devDependencies": { "devDependencies": {
"tap": "^1.2.0" "tap": "^7.1.2"
}, },
"directories": {}, "directories": {},
"dist": { "dist": {
"shasum": "db3204cd5a9de2e6cd890b85c6e2f66bcf4f620a", "shasum": "49bd6331d7d02d0c09bc910a1075ba8165b56df9",
"tarball": "https://registry.npmjs.org/inflight/-/inflight-1.0.5.tgz" "tarball": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz"
}, },
"files": [ "files": [
"inflight.js" "inflight.js"
], ],
"gitHead": "559e37b4f6327fca797fe8d7fe8ed6d9cae08821", "gitHead": "a547881738c8f57b27795e584071d67cf6ac1a57",
"homepage": "https://github.com/isaacs/inflight", "homepage": "https://github.com/isaacs/inflight",
"license": "ISC", "license": "ISC",
"main": "inflight.js", "main": "inflight.js",
@@ -100,7 +101,7 @@
"url": "git+https://github.com/npm/inflight.git" "url": "git+https://github.com/npm/inflight.git"
}, },
"scripts": { "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
View File

@@ -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');
}

33
node_modules/inherits/package.json generated vendored
View File

@@ -14,15 +14,20 @@
] ]
], ],
"_from": "inherits@>=2.0.0 <3.0.0", "_from": "inherits@>=2.0.0 <3.0.0",
"_id": "inherits@2.0.1", "_id": "inherits@2.0.3",
"_inCache": true, "_inCache": true,
"_installable": true, "_installable": true,
"_location": "/inherits", "_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": { "_npmUser": {
"name": "isaacs", "name": "isaacs",
"email": "i@izs.me" "email": "i@izs.me"
}, },
"_npmVersion": "1.3.8", "_npmVersion": "3.10.7",
"_phantomChildren": {}, "_phantomChildren": {},
"_requested": { "_requested": {
"raw": "inherits@2", "raw": "inherits@2",
@@ -34,10 +39,13 @@
"type": "range" "type": "range"
}, },
"_requiredBy": [ "_requiredBy": [
"/glob" "/cli/glob",
"/fileset/glob",
"/glob",
"/readable-stream"
], ],
"_resolved": "http://registry.npmjs.org/inherits/-/inherits-2.0.1.tgz", "_resolved": "http://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz",
"_shasum": "b17d08d326b4423e568eff719f91b0b1cbdf69f1", "_shasum": "633c2c83e3da42a502f52466022480f4208261de",
"_shrinkwrap": null, "_shrinkwrap": null,
"_spec": "inherits@2", "_spec": "inherits@2",
"_where": "/Users/steveng/repo/cordova/cordova-android/node_modules/glob", "_where": "/Users/steveng/repo/cordova/cordova-android/node_modules/glob",
@@ -47,12 +55,19 @@
}, },
"dependencies": {}, "dependencies": {},
"description": "Browser-friendly inheritance fully compatible with standard node.js inherits()", "description": "Browser-friendly inheritance fully compatible with standard node.js inherits()",
"devDependencies": {}, "devDependencies": {
"tap": "^7.1.0"
},
"directories": {}, "directories": {},
"dist": { "dist": {
"shasum": "b17d08d326b4423e568eff719f91b0b1cbdf69f1", "shasum": "633c2c83e3da42a502f52466022480f4208261de",
"tarball": "https://registry.npmjs.org/inherits/-/inherits-2.0.1.tgz" "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", "homepage": "https://github.com/isaacs/inherits#readme",
"keywords": [ "keywords": [
"inheritance", "inheritance",
@@ -82,5 +97,5 @@
"scripts": { "scripts": {
"test": "node test" "test": "node test"
}, },
"version": "2.0.1" "version": "2.0.3"
} }

25
node_modules/inherits/test.js generated vendored
View File

@@ -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')

View File

@@ -39,8 +39,10 @@
"type": "range" "type": "range"
}, },
"_requiredBy": [ "_requiredBy": [
"/cli/glob",
"/cordova-common", "/cordova-common",
"/glob" "/glob",
"/jshint"
], ],
"_resolved": "http://registry.npmjs.org/minimatch/-/minimatch-3.0.3.tgz", "_resolved": "http://registry.npmjs.org/minimatch/-/minimatch-3.0.3.tgz",
"_shasum": "2a4e4090b96b2db06a9d7df01055a62a77c9b774", "_shasum": "2a4e4090b96b2db06a9d7df01055a62a77c9b774",

3
node_modules/nopt/package.json generated vendored
View File

@@ -35,7 +35,8 @@
"type": "range" "type": "range"
}, },
"_requiredBy": [ "_requiredBy": [
"/" "/",
"/istanbul"
], ],
"_resolved": "http://registry.npmjs.org/nopt/-/nopt-3.0.6.tgz", "_resolved": "http://registry.npmjs.org/nopt/-/nopt-3.0.6.tgz",
"_shasum": "c6465dbf08abcd4db359317f79ac68a646b28ff9", "_shasum": "c6465dbf08abcd4db359317f79ac68a646b28ff9",

28
node_modules/once/README.md generated vendored
View File

@@ -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
View File

@@ -1,5 +1,6 @@
var wrappy = require('wrappy') var wrappy = require('wrappy')
module.exports = wrappy(once) module.exports = wrappy(once)
module.exports.strict = wrappy(onceStrict)
once.proto = once(function () { once.proto = once(function () {
Object.defineProperty(Function.prototype, 'once', { Object.defineProperty(Function.prototype, 'once', {
@@ -8,6 +9,13 @@ once.proto = once(function () {
}, },
configurable: true configurable: true
}) })
Object.defineProperty(Function.prototype, 'onceStrict', {
value: function () {
return onceStrict(this)
},
configurable: true
})
}) })
function once (fn) { function once (fn) {
@@ -19,3 +27,16 @@ function once (fn) {
f.called = false f.called = false
return f 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
}

28
node_modules/once/package.json generated vendored
View File

@@ -14,16 +14,20 @@
] ]
], ],
"_from": "once@>=1.3.0 <2.0.0", "_from": "once@>=1.3.0 <2.0.0",
"_id": "once@1.3.3", "_id": "once@1.4.0",
"_inCache": true, "_inCache": true,
"_installable": true, "_installable": true,
"_location": "/once", "_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": { "_npmUser": {
"name": "isaacs", "name": "isaacs",
"email": "i@izs.me" "email": "i@izs.me"
}, },
"_npmVersion": "3.3.2", "_npmVersion": "3.10.7",
"_phantomChildren": {}, "_phantomChildren": {},
"_requested": { "_requested": {
"raw": "once@^1.3.0", "raw": "once@^1.3.0",
@@ -35,11 +39,13 @@
"type": "range" "type": "range"
}, },
"_requiredBy": [ "_requiredBy": [
"/cli/glob",
"/glob", "/glob",
"/inflight" "/inflight",
"/istanbul"
], ],
"_resolved": "http://registry.npmjs.org/once/-/once-1.3.3.tgz", "_resolved": "http://registry.npmjs.org/once/-/once-1.4.0.tgz",
"_shasum": "b2e261557ce4c314ec8304f3fa82663e4297ca20", "_shasum": "583b1aa775961d4b113ac17d9c50baef9dd76bd1",
"_shrinkwrap": null, "_shrinkwrap": null,
"_spec": "once@^1.3.0", "_spec": "once@^1.3.0",
"_where": "/Users/steveng/repo/cordova/cordova-android/node_modules/glob", "_where": "/Users/steveng/repo/cordova/cordova-android/node_modules/glob",
@@ -56,19 +62,19 @@
}, },
"description": "Run a function exactly one time", "description": "Run a function exactly one time",
"devDependencies": { "devDependencies": {
"tap": "^1.2.0" "tap": "^7.0.1"
}, },
"directories": { "directories": {
"test": "test" "test": "test"
}, },
"dist": { "dist": {
"shasum": "b2e261557ce4c314ec8304f3fa82663e4297ca20", "shasum": "583b1aa775961d4b113ac17d9c50baef9dd76bd1",
"tarball": "https://registry.npmjs.org/once/-/once-1.3.3.tgz" "tarball": "https://registry.npmjs.org/once/-/once-1.4.0.tgz"
}, },
"files": [ "files": [
"once.js" "once.js"
], ],
"gitHead": "2ad558657e17fafd24803217ba854762842e4178", "gitHead": "0e614d9f5a7e6f0305c625f6b581f6d80b33b8a6",
"homepage": "https://github.com/isaacs/once#readme", "homepage": "https://github.com/isaacs/once#readme",
"keywords": [ "keywords": [
"once", "once",
@@ -94,5 +100,5 @@
"scripts": { "scripts": {
"test": "tap test/*.js" "test": "tap test/*.js"
}, },
"version": "1.3.3" "version": "1.4.0"
} }

35
node_modules/os-homedir/package.json generated vendored
View File

@@ -14,16 +14,20 @@
] ]
], ],
"_from": "os-homedir@>=1.0.0 <2.0.0", "_from": "os-homedir@>=1.0.0 <2.0.0",
"_id": "os-homedir@1.0.1", "_id": "os-homedir@1.0.2",
"_inCache": true, "_inCache": true,
"_installable": true, "_installable": true,
"_location": "/os-homedir", "_location": "/os-homedir",
"_nodeVersion": "0.12.5", "_nodeVersion": "6.6.0",
"_npmOperationalInternal": {
"host": "packages-16-east.internal.npmjs.com",
"tmp": "tmp/os-homedir-1.0.2.tgz_1475211519628_0.7873868853785098"
},
"_npmUser": { "_npmUser": {
"name": "sindresorhus", "name": "sindresorhus",
"email": "sindresorhus@gmail.com" "email": "sindresorhus@gmail.com"
}, },
"_npmVersion": "2.11.2", "_npmVersion": "3.10.3",
"_phantomChildren": {}, "_phantomChildren": {},
"_requested": { "_requested": {
"raw": "os-homedir@^1.0.0", "raw": "os-homedir@^1.0.0",
@@ -37,8 +41,8 @@
"_requiredBy": [ "_requiredBy": [
"/osenv" "/osenv"
], ],
"_resolved": "http://registry.npmjs.org/os-homedir/-/os-homedir-1.0.1.tgz", "_resolved": "http://registry.npmjs.org/os-homedir/-/os-homedir-1.0.2.tgz",
"_shasum": "0d62bdf44b916fd3bbdcf2cab191948fb094f007", "_shasum": "ffbc4988336e0e833de0c168c7ef152121aa7fb3",
"_shrinkwrap": null, "_shrinkwrap": null,
"_spec": "os-homedir@^1.0.0", "_spec": "os-homedir@^1.0.0",
"_where": "/Users/steveng/repo/cordova/cordova-android/node_modules/osenv", "_where": "/Users/steveng/repo/cordova/cordova-android/node_modules/osenv",
@@ -51,15 +55,16 @@
"url": "https://github.com/sindresorhus/os-homedir/issues" "url": "https://github.com/sindresorhus/os-homedir/issues"
}, },
"dependencies": {}, "dependencies": {},
"description": "io.js 2.3.0 os.homedir() ponyfill", "description": "Node.js 4 `os.homedir()` ponyfill",
"devDependencies": { "devDependencies": {
"ava": "0.0.4", "ava": "*",
"path-exists": "^1.0.0" "path-exists": "^2.0.0",
"xo": "^0.16.0"
}, },
"directories": {}, "directories": {},
"dist": { "dist": {
"shasum": "0d62bdf44b916fd3bbdcf2cab191948fb094f007", "shasum": "ffbc4988336e0e833de0c168c7ef152121aa7fb3",
"tarball": "https://registry.npmjs.org/os-homedir/-/os-homedir-1.0.1.tgz" "tarball": "https://registry.npmjs.org/os-homedir/-/os-homedir-1.0.2.tgz"
}, },
"engines": { "engines": {
"node": ">=0.10.0" "node": ">=0.10.0"
@@ -67,10 +72,10 @@
"files": [ "files": [
"index.js" "index.js"
], ],
"gitHead": "13ff83fbd13ebe286a6092286b2c634ab4534c5f", "gitHead": "b1b0ae70a5965fef7005ff6509a5dd1a78c95e36",
"homepage": "https://github.com/sindresorhus/os-homedir", "homepage": "https://github.com/sindresorhus/os-homedir#readme",
"keywords": [ "keywords": [
"built-in", "builtin",
"core", "core",
"ponyfill", "ponyfill",
"polyfill", "polyfill",
@@ -99,7 +104,7 @@
"url": "git+https://github.com/sindresorhus/os-homedir.git" "url": "git+https://github.com/sindresorhus/os-homedir.git"
}, },
"scripts": { "scripts": {
"test": "node test.js" "test": "xo && ava"
}, },
"version": "1.0.1" "version": "1.0.2"
} }

10
node_modules/os-homedir/readme.md generated vendored
View File

@@ -1,8 +1,6 @@
# os-homedir [![Build Status](https://travis-ci.org/sindresorhus/os-homedir.svg?branch=master)](https://travis-ci.org/sindresorhus/os-homedir) # os-homedir [![Build Status](https://travis-ci.org/sindresorhus/os-homedir.svg?branch=master)](https://travis-ci.org/sindresorhus/os-homedir)
> io.js 2.3.0 [`os.homedir()`](https://iojs.org/api/os.html#os_os_homedir) ponyfill > Node.js 4 [`os.homedir()`](https://nodejs.org/api/os.html#os_os_homedir) [ponyfill](https://ponyfill.com)
> Ponyfill: A polyfill that doesn't overwrite the native method
## Install ## Install
@@ -15,10 +13,10 @@ $ npm install --save os-homedir
## Usage ## Usage
```js ```js
var osHomedir = require('os-homedir'); const osHomedir = require('os-homedir');
console.log(osHomedir()); console.log(osHomedir());
//=> /Users/sindresorhus //=> '/Users/sindresorhus'
``` ```
@@ -30,4 +28,4 @@ console.log(osHomedir());
## License ## License
MIT © [Sindre Sorhus](http://sindresorhus.com) MIT © [Sindre Sorhus](https://sindresorhus.com)

2
node_modules/os-tmpdir/index.js generated vendored
View File

@@ -2,7 +2,7 @@
var isWindows = process.platform === 'win32'; var isWindows = process.platform === 'win32';
var trailingSlashRe = isWindows ? /[^:]\\$/ : /.\/$/; var trailingSlashRe = isWindows ? /[^:]\\$/ : /.\/$/;
// https://github.com/nodejs/io.js/blob/3e7a14381497a3b73dda68d05b5130563cdab420/lib/os.js#L25-L43 // https://github.com/nodejs/node/blob/3e7a14381497a3b73dda68d05b5130563cdab420/lib/os.js#L25-L43
module.exports = function () { module.exports = function () {
var path; var path;

29
node_modules/os-tmpdir/package.json generated vendored
View File

@@ -14,16 +14,20 @@
] ]
], ],
"_from": "os-tmpdir@>=1.0.0 <2.0.0", "_from": "os-tmpdir@>=1.0.0 <2.0.0",
"_id": "os-tmpdir@1.0.1", "_id": "os-tmpdir@1.0.2",
"_inCache": true, "_inCache": true,
"_installable": true, "_installable": true,
"_location": "/os-tmpdir", "_location": "/os-tmpdir",
"_nodeVersion": "0.12.3", "_nodeVersion": "6.6.0",
"_npmOperationalInternal": {
"host": "packages-12-west.internal.npmjs.com",
"tmp": "tmp/os-tmpdir-1.0.2.tgz_1475211274587_0.14931037812493742"
},
"_npmUser": { "_npmUser": {
"name": "sindresorhus", "name": "sindresorhus",
"email": "sindresorhus@gmail.com" "email": "sindresorhus@gmail.com"
}, },
"_npmVersion": "2.9.1", "_npmVersion": "3.10.3",
"_phantomChildren": {}, "_phantomChildren": {},
"_requested": { "_requested": {
"raw": "os-tmpdir@^1.0.0", "raw": "os-tmpdir@^1.0.0",
@@ -37,8 +41,8 @@
"_requiredBy": [ "_requiredBy": [
"/osenv" "/osenv"
], ],
"_resolved": "http://registry.npmjs.org/os-tmpdir/-/os-tmpdir-1.0.1.tgz", "_resolved": "http://registry.npmjs.org/os-tmpdir/-/os-tmpdir-1.0.2.tgz",
"_shasum": "e9b423a1edaf479882562e92ed71d7743a071b6e", "_shasum": "bbe67406c79aa85c5cfec766fe5734555dfa1274",
"_shrinkwrap": null, "_shrinkwrap": null,
"_spec": "os-tmpdir@^1.0.0", "_spec": "os-tmpdir@^1.0.0",
"_where": "/Users/steveng/repo/cordova/cordova-android/node_modules/osenv", "_where": "/Users/steveng/repo/cordova/cordova-android/node_modules/osenv",
@@ -53,12 +57,13 @@
"dependencies": {}, "dependencies": {},
"description": "Node.js os.tmpdir() ponyfill", "description": "Node.js os.tmpdir() ponyfill",
"devDependencies": { "devDependencies": {
"ava": "0.0.4" "ava": "*",
"xo": "^0.16.0"
}, },
"directories": {}, "directories": {},
"dist": { "dist": {
"shasum": "e9b423a1edaf479882562e92ed71d7743a071b6e", "shasum": "bbe67406c79aa85c5cfec766fe5734555dfa1274",
"tarball": "https://registry.npmjs.org/os-tmpdir/-/os-tmpdir-1.0.1.tgz" "tarball": "https://registry.npmjs.org/os-tmpdir/-/os-tmpdir-1.0.2.tgz"
}, },
"engines": { "engines": {
"node": ">=0.10.0" "node": ">=0.10.0"
@@ -66,8 +71,8 @@
"files": [ "files": [
"index.js" "index.js"
], ],
"gitHead": "5c5d355f81378980db629d60128ad03e02b1c1e5", "gitHead": "1abf9cf5611b4be7377060ea67054b45cbf6813c",
"homepage": "https://github.com/sindresorhus/os-tmpdir", "homepage": "https://github.com/sindresorhus/os-tmpdir#readme",
"keywords": [ "keywords": [
"built-in", "built-in",
"core", "core",
@@ -99,7 +104,7 @@
"url": "git+https://github.com/sindresorhus/os-tmpdir.git" "url": "git+https://github.com/sindresorhus/os-tmpdir.git"
}, },
"scripts": { "scripts": {
"test": "node test.js" "test": "xo && ava"
}, },
"version": "1.0.1" "version": "1.0.2"
} }

14
node_modules/os-tmpdir/readme.md generated vendored
View File

@@ -1,12 +1,8 @@
# os-tmpdir [![Build Status](https://travis-ci.org/sindresorhus/os-tmpdir.svg?branch=master)](https://travis-ci.org/sindresorhus/os-tmpdir) # os-tmpdir [![Build Status](https://travis-ci.org/sindresorhus/os-tmpdir.svg?branch=master)](https://travis-ci.org/sindresorhus/os-tmpdir)
> Node.js [`os.tmpdir()`](https://nodejs.org/api/os.html#os_os_tmpdir) ponyfill > Node.js [`os.tmpdir()`](https://nodejs.org/api/os.html#os_os_tmpdir) [ponyfill](https://ponyfill.com)
> Ponyfill: A polyfill that doesn't overwrite the native method Use this instead of `require('os').tmpdir()` to get a consistent behavior on different Node.js versions (even 0.8).
Use this instead of `require('os').tmpdir()` to get a consistent behaviour on different Node.js versions (even 0.8).
*This is actually taken from io.js 2.0.2 as it contains some fixes that haven't bubbled up to Node.js yet.*
## Install ## Install
@@ -19,10 +15,10 @@ $ npm install --save os-tmpdir
## Usage ## Usage
```js ```js
var osTmpdir = require('os-tmpdir'); const osTmpdir = require('os-tmpdir');
osTmpdir(); osTmpdir();
//=> /var/folders/m3/5574nnhn0yj488ccryqr7tc80000gn/T //=> '/var/folders/m3/5574nnhn0yj488ccryqr7tc80000gn/T'
``` ```
@@ -33,4 +29,4 @@ See the [`os.tmpdir()` docs](https://nodejs.org/api/os.html#os_os_tmpdir).
## License ## License
MIT © [Sindre Sorhus](http://sindresorhus.com) MIT © [Sindre Sorhus](https://sindresorhus.com)

View File

@@ -2,18 +2,18 @@
function posix(path) { function posix(path) {
return path.charAt(0) === '/'; return path.charAt(0) === '/';
}; }
function win32(path) { function win32(path) {
// https://github.com/joyent/node/blob/b3fcc245fb25539909ef1d5eaa01dbf92e168633/lib/path.js#L56 // https://github.com/nodejs/node/blob/b3fcc245fb25539909ef1d5eaa01dbf92e168633/lib/path.js#L56
var splitDeviceRe = /^([a-zA-Z]:|[\\\/]{2}[^\\\/]+[\\\/]+[^\\\/]+)?([\\\/])?([\s\S]*?)$/; var splitDeviceRe = /^([a-zA-Z]:|[\\\/]{2}[^\\\/]+[\\\/]+[^\\\/]+)?([\\\/])?([\s\S]*?)$/;
var result = splitDeviceRe.exec(path); var result = splitDeviceRe.exec(path);
var device = result[1] || ''; var device = result[1] || '';
var isUnc = !!device && device.charAt(1) !== ':'; var isUnc = Boolean(device && device.charAt(1) !== ':');
// UNC paths are always absolute // UNC paths are always absolute
return !!result[2] || isUnc; return Boolean(result[2] || isUnc);
}; }
module.exports = process.platform === 'win32' ? win32 : posix; module.exports = process.platform === 'win32' ? win32 : posix;
module.exports.posix = posix; module.exports.posix = posix;

View File

@@ -14,16 +14,20 @@
] ]
], ],
"_from": "path-is-absolute@>=1.0.0 <2.0.0", "_from": "path-is-absolute@>=1.0.0 <2.0.0",
"_id": "path-is-absolute@1.0.0", "_id": "path-is-absolute@1.0.1",
"_inCache": true, "_inCache": true,
"_installable": true, "_installable": true,
"_location": "/path-is-absolute", "_location": "/path-is-absolute",
"_nodeVersion": "0.12.0", "_nodeVersion": "6.6.0",
"_npmOperationalInternal": {
"host": "packages-12-west.internal.npmjs.com",
"tmp": "tmp/path-is-absolute-1.0.1.tgz_1475210523565_0.9876507974695414"
},
"_npmUser": { "_npmUser": {
"name": "sindresorhus", "name": "sindresorhus",
"email": "sindresorhus@gmail.com" "email": "sindresorhus@gmail.com"
}, },
"_npmVersion": "2.5.1", "_npmVersion": "3.10.3",
"_phantomChildren": {}, "_phantomChildren": {},
"_requested": { "_requested": {
"raw": "path-is-absolute@^1.0.0", "raw": "path-is-absolute@^1.0.0",
@@ -35,10 +39,11 @@
"type": "range" "type": "range"
}, },
"_requiredBy": [ "_requiredBy": [
"/cli/glob",
"/glob" "/glob"
], ],
"_resolved": "http://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.0.tgz", "_resolved": "http://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz",
"_shasum": "263dada66ab3f2fb10bf7f9d24dd8f3e570ef912", "_shasum": "174b9268735534ffbc7ace6bf53a5a9e1b5c5f5f",
"_shrinkwrap": null, "_shrinkwrap": null,
"_spec": "path-is-absolute@^1.0.0", "_spec": "path-is-absolute@^1.0.0",
"_where": "/Users/steveng/repo/cordova/cordova-android/node_modules/glob", "_where": "/Users/steveng/repo/cordova/cordova-android/node_modules/glob",
@@ -52,11 +57,13 @@
}, },
"dependencies": {}, "dependencies": {},
"description": "Node.js 0.12 path.isAbsolute() ponyfill", "description": "Node.js 0.12 path.isAbsolute() ponyfill",
"devDependencies": {}, "devDependencies": {
"xo": "^0.16.0"
},
"directories": {}, "directories": {},
"dist": { "dist": {
"shasum": "263dada66ab3f2fb10bf7f9d24dd8f3e570ef912", "shasum": "174b9268735534ffbc7ace6bf53a5a9e1b5c5f5f",
"tarball": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.0.tgz" "tarball": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz"
}, },
"engines": { "engines": {
"node": ">=0.10.0" "node": ">=0.10.0"
@@ -64,8 +71,8 @@
"files": [ "files": [
"index.js" "index.js"
], ],
"gitHead": "7a76a0c9f2263192beedbe0a820e4d0baee5b7a1", "gitHead": "edc91d348b21dac2ab65ea2fbec2868e2eff5eb6",
"homepage": "https://github.com/sindresorhus/path-is-absolute", "homepage": "https://github.com/sindresorhus/path-is-absolute#readme",
"keywords": [ "keywords": [
"path", "path",
"paths", "paths",
@@ -100,7 +107,7 @@
"url": "git+https://github.com/sindresorhus/path-is-absolute.git" "url": "git+https://github.com/sindresorhus/path-is-absolute.git"
}, },
"scripts": { "scripts": {
"test": "node test.js" "test": "xo && node test.js"
}, },
"version": "1.0.0" "version": "1.0.1"
} }

View File

@@ -1,8 +1,6 @@
# path-is-absolute [![Build Status](https://travis-ci.org/sindresorhus/path-is-absolute.svg?branch=master)](https://travis-ci.org/sindresorhus/path-is-absolute) # path-is-absolute [![Build Status](https://travis-ci.org/sindresorhus/path-is-absolute.svg?branch=master)](https://travis-ci.org/sindresorhus/path-is-absolute)
> Node.js 0.12 [`path.isAbsolute()`](http://nodejs.org/api/path.html#path_path_isabsolute_path) ponyfill > Node.js 0.12 [`path.isAbsolute()`](http://nodejs.org/api/path.html#path_path_isabsolute_path) [ponyfill](https://ponyfill.com)
> Ponyfill: A polyfill that doesn't overwrite the native method
## Install ## Install
@@ -15,19 +13,29 @@ $ npm install --save path-is-absolute
## Usage ## Usage
```js ```js
var pathIsAbsolute = require('path-is-absolute'); const pathIsAbsolute = require('path-is-absolute');
// Linux // Running on Linux
pathIsAbsolute('/home/foo'); pathIsAbsolute('/home/foo');
//=> true //=> true
pathIsAbsolute('C:/Users/foo');
//=> false
// Windows // Running on Windows
pathIsAbsolute('C:/Users/'); pathIsAbsolute('C:/Users/foo');
//=> true //=> true
pathIsAbsolute('/home/foo');
//=> false
// Any OS // Running on any OS
pathIsAbsolute.posix('/home/foo'); pathIsAbsolute.posix('/home/foo');
//=> true //=> true
pathIsAbsolute.posix('C:/Users/foo');
//=> false
pathIsAbsolute.win32('C:/Users/foo');
//=> true
pathIsAbsolute.win32('/home/foo');
//=> false
``` ```
@@ -39,13 +47,13 @@ See the [`path.isAbsolute()` docs](http://nodejs.org/api/path.html#path_path_isa
### pathIsAbsolute.posix(path) ### pathIsAbsolute.posix(path)
The Posix specific version. POSIX specific version.
### pathIsAbsolute.win32(path) ### pathIsAbsolute.win32(path)
The Windows specific version. Windows specific version.
## License ## License
MIT © [Sindre Sorhus](http://sindresorhus.com) MIT © [Sindre Sorhus](https://sindresorhus.com)

View File

@@ -34,7 +34,8 @@
"type": "range" "type": "range"
}, },
"_requiredBy": [ "_requiredBy": [
"/cordova-common" "/cordova-common",
"/jasmine-node"
], ],
"_resolved": "http://registry.npmjs.org/underscore/-/underscore-1.8.3.tgz", "_resolved": "http://registry.npmjs.org/underscore/-/underscore-1.8.3.tgz",
"_shasum": "4f3fb53b106e6097fcf9cb4109f2a5e9bdfa5022", "_shasum": "4f3fb53b106e6097fcf9cb4109f2a5e9bdfa5022",

View File

@@ -1,49 +1,49 @@
{ {
"name": "cordova-android", "name": "cordova-android",
"version": "5.2.2", "version": "6.0.0",
"description": "cordova-android release", "description": "cordova-android release",
"bin": { "bin": {
"create": "bin/create" "create": "bin/create"
}, },
"main": "bin/templates/cordova/Api.js", "main": "bin/templates/cordova/Api.js",
"repository": { "repository": {
"type": "git", "type": "git",
"url": "https://git-wip-us.apache.org/repos/asf/cordova-android.git" "url": "https://git-wip-us.apache.org/repos/asf/cordova-android.git"
}, },
"keywords": [ "keywords": [
"android", "android",
"cordova", "cordova",
"apache" "apache"
], ],
"scripts": { "scripts": {
"test": "npm run jshint && jasmine-node --color spec/unit", "test": "npm run jshint && jasmine-node --color spec/unit",
"cover": "istanbul cover --root bin/templates/cordova --print detail node_modules/jasmine-node/bin/jasmine-node -- spec/unit", "cover": "istanbul cover --root bin/templates/cordova --print detail node_modules/jasmine-node/bin/jasmine-node -- spec/unit",
"test-build": "jasmine-node --captureExceptions --color spec/e2e", "test-build": "jasmine-node --captureExceptions --color spec/e2e",
"jshint": "node node_modules/jshint/bin/jshint bin && node node_modules/jshint/bin/jshint spec" "jshint": "node node_modules/jshint/bin/jshint bin && node node_modules/jshint/bin/jshint spec"
}, },
"author": "Apache Software Foundation", "author": "Apache Software Foundation",
"license": "Apache-2.0", "license": "Apache-2.0",
"dependencies": { "dependencies": {
"cordova-common": "^1.4.0", "cordova-common": "^1.5.0",
"elementtree": "^0.1.6", "elementtree": "^0.1.6",
"nopt": "^3.0.1", "nopt": "^3.0.1",
"properties-parser": "^0.2.3", "properties-parser": "^0.2.3",
"q": "^1.4.1", "q": "^1.4.1",
"shelljs": "^0.5.3" "shelljs": "^0.5.3"
}, },
"bundledDependencies": [ "bundledDependencies": [
"cordova-common", "cordova-common",
"elementtree", "elementtree",
"nopt", "nopt",
"properties-parser", "properties-parser",
"q", "q",
"shelljs" "shelljs"
], ],
"devDependencies": { "devDependencies": {
"istanbul": "^0.4.2", "istanbul": "^0.4.2",
"jasmine-node": "^1.14.5", "jasmine-node": "^1.14.5",
"jshint": "^2.6.0", "jshint": "^2.6.0",
"promise-matchers": "~0", "promise-matchers": "~0",
"rewire": "^2.1.3" "rewire": "^2.1.3"
} }
} }

View File

@@ -19,7 +19,7 @@
var actions = require('./helpers/projectActions.js'); var actions = require('./helpers/projectActions.js');
var CREATE_TIMEOUT = 60000; var CREATE_TIMEOUT = 180000;
function createAndBuild(projectname, projectid, done) { function createAndBuild(projectname, projectid, done) {
actions.createProject(projectname, projectid, function (error) { actions.createProject(projectname, projectid, function (error) {
@@ -27,7 +27,7 @@ function createAndBuild(projectname, projectid, done) {
actions.buildProject(projectid, function (error) { actions.buildProject(projectid, function (error) {
expect(error).toBe(null); expect(error).toBe(null);
actions.removeProject(projectid); actions.removeProject(projectid);
done(); done();
}); });
}); });
} }

View File

@@ -25,7 +25,7 @@ var actions = require('./helpers/projectActions.js'),
platformEdge = { version: getCurrentVersion(), path: '.' }; platformEdge = { version: getCurrentVersion(), path: '.' };
var DOWNLOAD_TIMEOUT = 2 * 60 * 1000, var DOWNLOAD_TIMEOUT = 2 * 60 * 1000,
UPDATE_TIMEOUT = 60 * 1000, UPDATE_TIMEOUT = 90 * 1000,
PLATFORM_GIT_URL = 'https://github.com/apache/cordova-android'; PLATFORM_GIT_URL = 'https://github.com/apache/cordova-android';
function getCurrentVersion() { function getCurrentVersion() {

View File

@@ -0,0 +1 @@
/build

View File

@@ -0,0 +1,26 @@
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.1"
defaultConfig {
applicationId "com.example.anis.myapplication"
minSdkVersion 21
targetSdkVersion 23
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.4.0'
}

View File

@@ -0,0 +1,17 @@
# Add project specific ProGuard rules here.
# By default, the flags in this file are appended to flags specified
# in /Users/anis/opt/android-sdk-macosx/tools/proguard/proguard-android.txt
# You can edit the include path and order by changing the proguardFiles
# directive in build.gradle.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html
# Add any project specific keep options here:
# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}

View File

@@ -0,0 +1,20 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.anis.myapplication">
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity android:name=".MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>
</application>
</manifest>

View File

@@ -0,0 +1,17 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
android:paddingBottom="@dimen/activity_vertical_margin"
tools:context="com.example.anis.myapplication.MainActivity">
<TextView
android:text="Hello World!"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
</RelativeLayout>

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

View File

@@ -0,0 +1,6 @@
<resources>
<!-- Example customization of dimensions originally defined in res/values/dimens.xml
(such as screen margins) for screens with more than 820dp of available width. This
would include 7" and 10" devices in landscape (~960dp and ~1280dp respectively). -->
<dimen name="activity_horizontal_margin">64dp</dimen>
</resources>

View File

@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="colorPrimary">#3F51B5</color>
<color name="colorPrimaryDark">#303F9F</color>
<color name="colorAccent">#FF4081</color>
</resources>

View File

@@ -0,0 +1,5 @@
<resources>
<!-- Default screen margins, per the Android Design guidelines. -->
<dimen name="activity_horizontal_margin">16dp</dimen>
<dimen name="activity_vertical_margin">16dp</dimen>
</resources>

View File

@@ -0,0 +1,3 @@
<resources>
<string name="app_name">My Application</string>
</resources>

View File

@@ -0,0 +1,11 @@
<resources>
<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<!-- Customize your theme here. -->
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>
</style>
</resources>

View File

@@ -0,0 +1,23 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.0.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}

View File

@@ -0,0 +1,18 @@
# Project-wide Gradle settings.
# IDE (e.g. Android Studio) users:
# Gradle settings configured through the IDE *will override*
# any settings specified in this file.
# For more details on how to configure your build environment visit
# http://www.gradle.org/docs/current/userguide/build_environment.html
# Specifies the JVM arguments used for the daemon process.
# The setting is particularly useful for tweaking memory settings.
# Default value: -Xmx10248m -XX:MaxPermSize=256m
# org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
# When configured, Gradle will run in incubating parallel mode.
# This option should only be used with decoupled projects. More details, visit
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
# org.gradle.parallel=true

View 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.10-all.zip

160
spec/fixtures/android_studio_project/gradlew vendored Executable file
View File

@@ -0,0 +1,160 @@
#!/usr/bin/env bash
##############################################################################
##
## Gradle start up script for UN*X
##
##############################################################################
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS=""
APP_NAME="Gradle"
APP_BASE_NAME=`basename "$0"`
# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD="maximum"
warn ( ) {
echo "$*"
}
die ( ) {
echo
echo "$*"
echo
exit 1
}
# OS specific support (must be 'true' or 'false').
cygwin=false
msys=false
darwin=false
case "`uname`" in
CYGWIN* )
cygwin=true
;;
Darwin* )
darwin=true
;;
MINGW* )
msys=true
;;
esac
# Attempt to set APP_HOME
# Resolve links: $0 may be a link
PRG="$0"
# Need this for relative symlinks.
while [ -h "$PRG" ] ; do
ls=`ls -ld "$PRG"`
link=`expr "$ls" : '.*-> \(.*\)$'`
if expr "$link" : '/.*' > /dev/null; then
PRG="$link"
else
PRG=`dirname "$PRG"`"/$link"
fi
done
SAVED="`pwd`"
cd "`dirname \"$PRG\"`/" >/dev/null
APP_HOME="`pwd -P`"
cd "$SAVED" >/dev/null
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
# Determine the Java command to use to start the JVM.
if [ -n "$JAVA_HOME" ] ; then
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
# IBM's JDK on AIX uses strange locations for the executables
JAVACMD="$JAVA_HOME/jre/sh/java"
else
JAVACMD="$JAVA_HOME/bin/java"
fi
if [ ! -x "$JAVACMD" ] ; then
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
else
JAVACMD="java"
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
# Increase the maximum file descriptors if we can.
if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then
MAX_FD_LIMIT=`ulimit -H -n`
if [ $? -eq 0 ] ; then
if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
MAX_FD="$MAX_FD_LIMIT"
fi
ulimit -n $MAX_FD
if [ $? -ne 0 ] ; then
warn "Could not set maximum file descriptor limit: $MAX_FD"
fi
else
warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
fi
fi
# For Darwin, add options to specify how the application appears in the dock
if $darwin; then
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
fi
# For Cygwin, switch paths to Windows format before running java
if $cygwin ; then
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
JAVACMD=`cygpath --unix "$JAVACMD"`
# We build the pattern for arguments to be converted via cygpath
ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
SEP=""
for dir in $ROOTDIRSRAW ; do
ROOTDIRS="$ROOTDIRS$SEP$dir"
SEP="|"
done
OURCYGPATTERN="(^($ROOTDIRS))"
# Add a user-defined pattern to the cygpath arguments
if [ "$GRADLE_CYGPATTERN" != "" ] ; then
OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
fi
# Now convert the arguments - kludge to limit ourselves to /bin/sh
i=0
for arg in "$@" ; do
CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
else
eval `echo args$i`="\"$arg\""
fi
i=$((i+1))
done
case $i in
(0) set -- ;;
(1) set -- "$args0" ;;
(2) set -- "$args0" "$args1" ;;
(3) set -- "$args0" "$args1" "$args2" ;;
(4) set -- "$args0" "$args1" "$args2" "$args3" ;;
(5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
(6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
(7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
(8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
(9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
esac
fi
# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
function splitJvmOpts() {
JVM_OPTS=("$@")
}
eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"

View File

@@ -0,0 +1,90 @@
@if "%DEBUG%" == "" @echo off
@rem ##########################################################################
@rem
@rem Gradle startup script for Windows
@rem
@rem ##########################################################################
@rem Set local scope for the variables with windows NT shell
if "%OS%"=="Windows_NT" setlocal
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
set DEFAULT_JVM_OPTS=
set DIRNAME=%~dp0
if "%DIRNAME%" == "" set DIRNAME=.
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%
@rem Find java.exe
if defined JAVA_HOME goto findJavaFromJavaHome
set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if "%ERRORLEVEL%" == "0" goto init
echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
goto fail
:findJavaFromJavaHome
set JAVA_HOME=%JAVA_HOME:"=%
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
if exist "%JAVA_EXE%" goto init
echo.
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
goto fail
:init
@rem Get command-line arguments, handling Windowz variants
if not "%OS%" == "Windows_NT" goto win9xME_args
if "%@eval[2+2]" == "4" goto 4NT_args
:win9xME_args
@rem Slurp the command line arguments.
set CMD_LINE_ARGS=
set _SKIP=2
:win9xME_args_slurp
if "x%~1" == "x" goto execute
set CMD_LINE_ARGS=%*
goto execute
:4NT_args
@rem Get arguments from the 4NT Shell from JP Software
set CMD_LINE_ARGS=%$
:execute
@rem Setup the command line
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
@rem Execute Gradle
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
:end
@rem End local scope for the variables with windows NT shell
if "%ERRORLEVEL%"=="0" goto mainEnd
:fail
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
rem the _cmd.exe /c_ return code!
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
exit /b 1
:mainEnd
if "%OS%"=="Windows_NT" endlocal
:omega

View File

@@ -0,0 +1 @@
include ':app'

Some files were not shown because too many files have changed in this diff Show More