mirror of
https://github.com/apache/cordova-android.git
synced 2026-01-30 00:05:28 +08:00
Compare commits
83 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c0df73c3c1 | ||
|
|
211a7fc6a8 | ||
|
|
ce67804b65 | ||
|
|
f3ded26e35 | ||
|
|
4b688f8715 | ||
|
|
e3b3bcd75f | ||
|
|
5a7590397d | ||
|
|
af31c83ec1 | ||
|
|
bd94735ba2 | ||
|
|
46e47a3c5c | ||
|
|
814aca2b68 | ||
|
|
cf159c1ae3 | ||
|
|
4868d5e59e | ||
|
|
34c7e8a534 | ||
|
|
d36cfeafa2 | ||
|
|
d2c71e7d75 | ||
|
|
fc8cd37495 | ||
|
|
3f1113ed8f | ||
|
|
4d55fdb3e5 | ||
|
|
b175d611bd | ||
|
|
6d084428a8 | ||
|
|
312efc3878 | ||
|
|
301faebfcc | ||
|
|
a8af103ff4 | ||
|
|
0df50c3f33 | ||
|
|
08c80f77a9 | ||
|
|
ea8d65d7fc | ||
|
|
e3198b0f6b | ||
|
|
19220de388 | ||
|
|
52878d6c5b | ||
|
|
abfece70c1 | ||
|
|
33da6e9eb8 | ||
|
|
4919a2d2a8 | ||
|
|
2f2e8a560d | ||
|
|
884818934f | ||
|
|
1d8e6f53a1 | ||
|
|
3554267adf | ||
|
|
f7687a2567 | ||
|
|
ebd4a02d2c | ||
|
|
4a354bba86 | ||
|
|
d40c22441f | ||
|
|
6395eda0c8 | ||
|
|
eb6ada8091 | ||
|
|
a7ef686a27 | ||
|
|
e2af492a63 | ||
|
|
84de9ee0da | ||
|
|
e182e669f0 | ||
|
|
a9a28d3e77 | ||
|
|
6a77acdbf2 | ||
|
|
028725468a | ||
|
|
9dbffa6ee8 | ||
|
|
2d3f3cae13 | ||
|
|
fb9f0f3ee8 | ||
|
|
ab276504fd | ||
|
|
3cc4e5b440 | ||
|
|
b2664bc469 | ||
|
|
7d5afdebe1 | ||
|
|
3bbc7fb328 | ||
|
|
ac6ad2dea1 | ||
|
|
0b116f1b5c | ||
|
|
acdb934ef9 | ||
|
|
5591a1a4e8 | ||
|
|
124574bb3a | ||
|
|
a2cfaab7f4 | ||
|
|
6355425a6f | ||
|
|
2d96995801 | ||
|
|
3fc4daa447 | ||
|
|
c7ff24b983 | ||
|
|
3f674faf30 | ||
|
|
b9ad1b6b26 | ||
|
|
676f0ddc2e | ||
|
|
6c60dc5dc8 | ||
|
|
1af5ade39a | ||
|
|
ad40d33400 | ||
|
|
5017e2302b | ||
|
|
3bfeda4a3b | ||
|
|
348b1b4dda | ||
|
|
0fd7e7f040 | ||
|
|
cfa0fa7243 | ||
|
|
6a63d9df0a | ||
|
|
d6a1d7a913 | ||
|
|
700b425774 | ||
|
|
e31634b0fb |
@@ -5,3 +5,4 @@ proguard-project.txt
|
||||
spec
|
||||
appveyor.yml
|
||||
framework/build
|
||||
ic_launcher.png
|
||||
|
||||
@@ -5,6 +5,7 @@ jdk:
|
||||
before_install:
|
||||
- nvm install 6
|
||||
- node --version
|
||||
- gradle --version
|
||||
install:
|
||||
- npm install
|
||||
- npm install -g codecov
|
||||
|
||||
@@ -20,6 +20,26 @@
|
||||
-->
|
||||
## Release Notes for Cordova (Android) ##
|
||||
|
||||
### 6.2.3 (May 2, 2017)
|
||||
* [CB-12640](https://issues.apache.org/jira/browse/CB-12640) better handling of unrecognized Android SDK commands on **Windows**.
|
||||
* [CB-12640](https://issues.apache.org/jira/browse/CB-12640) flipped avd parsing logic so that it always tries to use avdmanager to retrieve avds first, then falls back to android command if avdmanager cannot be found (and errors with ENOENT). updated tests - and added explicit tests to ensure to shell out to singular forms of sub-commands when executing `android`
|
||||
* [CB-12640](https://issues.apache.org/jira/browse/CB-12640) support for android sdk tools 26.0.1.
|
||||
|
||||
### 6.2.2 (Apr 24, 2017)
|
||||
* [CB-12697](https://issues.apache.org/jira/browse/CB-12697) Updated checked-in `node_modules`
|
||||
|
||||
### 6.2.1 (Apr 02, 2017)
|
||||
* [CB-12621](https://issues.apache.org/jira/browse/CB-12621) reverted elementtree dep to 0.1.6
|
||||
|
||||
### 6.2.0 (Mar 28, 2017)
|
||||
* [CB-12614](https://issues.apache.org/jira/browse/CB-12614) Adding headers to tests
|
||||
* [CB-8978](https://issues.apache.org/jira/browse/CB-8978) Prepare copy `resource-files` from `config.xml`
|
||||
* [CB-12605](https://issues.apache.org/jira/browse/CB-12605) Fix a requirements check failure on **Windows**
|
||||
* [CB-12595](https://issues.apache.org/jira/browse/CB-12595) This should find an **Android Studio** installation and use the sweet gradle center found inside
|
||||
* [CB-12546](https://issues.apache.org/jira/browse/CB-12546) leverage `avdmanager` if `android` warns it is no longer useful, which happens in **Android SDK Tools 25.3.1**. Explicitly set the `CWD` of the spawned emulator process to workaround a recent google android sdk bug. Rename `android_sdk_version.js` to `android_sdk.js`, to better reflect its contents. Have `create.js` copy over the `android_sdk_version` batch file.
|
||||
* [CB-12524](https://issues.apache.org/jira/browse/CB-12524) Fix for missing gradle template error. This now fetches the template from inside of the **Android Studio** directory, and falls back to a locally installed Gradle instance
|
||||
* [CB-12465](https://issues.apache.org/jira/browse/CB-12465) Writing new JUnit Test Instrumentation to replace tests and retire problmatic tests
|
||||
|
||||
### 6.1.2 (Jan 26, 2017)
|
||||
* **Security** Change to `https` by default
|
||||
* [CB-12018](https://issues.apache.org/jira/browse/CB-12018): updated tests to work with jasmine (promise matcher tests commented out for now)
|
||||
|
||||
@@ -19,10 +19,10 @@
|
||||
under the License.
|
||||
*/
|
||||
|
||||
var android_sdk_version = require('./lib/android_sdk_version');
|
||||
var android_sdk = require('./templates/cordova/lib/android_sdk');
|
||||
|
||||
android_sdk_version.run().done(null, function(err) {
|
||||
console.log(err);
|
||||
android_sdk.print_newest_available_sdk_target().done(null, function(err) {
|
||||
console.error(err);
|
||||
process.exit(2);
|
||||
});
|
||||
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
under the License.
|
||||
*/
|
||||
|
||||
var check_reqs = require('./lib/check_reqs');
|
||||
var check_reqs = require('./templates/cordova/lib/check_reqs');
|
||||
|
||||
check_reqs.run().done(
|
||||
function success() {
|
||||
|
||||
@@ -1,64 +0,0 @@
|
||||
#!/usr/bin/env node
|
||||
|
||||
/*
|
||||
Licensed to the Apache Software Foundation (ASF) under one
|
||||
or more contributor license agreements. See the NOTICE file
|
||||
distributed with this work for additional information
|
||||
regarding copyright ownership. The ASF licenses this file
|
||||
to you under the Apache License, Version 2.0 (the
|
||||
"License"); you may not use this file except in compliance
|
||||
with the License. You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing,
|
||||
software distributed under the License is distributed on an
|
||||
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
KIND, either express or implied. See the License for the
|
||||
specific language governing permissions and limitations
|
||||
under the License.
|
||||
*/
|
||||
|
||||
var child_process = require('child_process'),
|
||||
Q = require('q');
|
||||
|
||||
var get_highest_sdk = function(results){
|
||||
var reg = /\d+/;
|
||||
var apiLevels = [];
|
||||
for(var i=0;i<results.length;i++){
|
||||
apiLevels[i] = parseInt(results[i].match(reg)[0]);
|
||||
}
|
||||
apiLevels.sort(function(a,b){return b-a;});
|
||||
console.log(apiLevels[0]);
|
||||
};
|
||||
|
||||
var get_sdks = function() {
|
||||
var d = Q.defer();
|
||||
child_process.exec('android list targets', function(err, stdout, stderr) {
|
||||
if (err) d.reject(stderr);
|
||||
else d.resolve(stdout);
|
||||
});
|
||||
|
||||
return d.promise.then(function(output) {
|
||||
var reg = /android-\d+/gi;
|
||||
var results = output.match(reg);
|
||||
if(results.length===0){
|
||||
return Q.reject(new Error('No android sdks installed.'));
|
||||
}else{
|
||||
get_highest_sdk(results);
|
||||
}
|
||||
|
||||
return Q();
|
||||
}, function(stderr) {
|
||||
if (stderr.match(/command\snot\sfound/) || stderr.match(/'android' is not recognized/)) {
|
||||
return Q.reject(new Error('The command \"android\" failed. Make sure you have the latest Android SDK installed, and the \"android\" command (inside the tools/ folder) is added to your path.'));
|
||||
} else {
|
||||
return Q.reject(new Error('An error occurred while listing Android targets'));
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
module.exports.run = function() {
|
||||
return Q.all([get_sdks()]);
|
||||
};
|
||||
|
||||
@@ -23,7 +23,7 @@ var shell = require('shelljs'),
|
||||
Q = require('q'),
|
||||
path = require('path'),
|
||||
fs = require('fs'),
|
||||
check_reqs = require('./check_reqs'),
|
||||
check_reqs = require('./../templates/cordova/lib/check_reqs'),
|
||||
ROOT = path.join(__dirname, '..', '..');
|
||||
|
||||
var MIN_SDK_VERSION = 16;
|
||||
@@ -134,20 +134,29 @@ function copyBuildRules(projectPath) {
|
||||
var srcDir = path.join(ROOT, 'bin', 'templates', 'project');
|
||||
|
||||
shell.cp('-f', path.join(srcDir, 'build.gradle'), projectPath);
|
||||
shell.cp('-f', path.join(srcDir, 'wrapper.gradle'), projectPath);
|
||||
}
|
||||
|
||||
function copyScripts(projectPath) {
|
||||
var srcScriptsDir = path.join(ROOT, 'bin', 'templates', 'cordova');
|
||||
var bin = path.join(ROOT, 'bin');
|
||||
var srcScriptsDir = path.join(bin, 'templates', 'cordova');
|
||||
var destScriptsDir = path.join(projectPath, 'cordova');
|
||||
// Delete old scripts directory if this is an update.
|
||||
shell.rm('-rf', destScriptsDir);
|
||||
// Copy in the new ones.
|
||||
shell.cp('-r', srcScriptsDir, projectPath);
|
||||
shell.cp('-r', path.join(ROOT, 'node_modules'), destScriptsDir);
|
||||
shell.cp(path.join(ROOT, 'bin', 'check_reqs*'), destScriptsDir);
|
||||
shell.cp(path.join(ROOT, 'bin', 'lib', 'check_reqs.js'), path.join(projectPath, 'cordova', 'lib', 'check_reqs.js'));
|
||||
shell.cp(path.join(ROOT, 'bin', 'android_sdk_version'), path.join(destScriptsDir, 'android_sdk_version'));
|
||||
shell.cp(path.join(ROOT, 'bin', 'lib', 'android_sdk_version.js'), path.join(projectPath, 'cordova', 'lib', 'android_sdk_version.js'));
|
||||
shell.cp(path.join(bin, 'check_reqs*'), destScriptsDir);
|
||||
shell.cp(path.join(bin, 'android_sdk_version*'), destScriptsDir);
|
||||
var check_reqs = path.join(destScriptsDir, 'check_reqs');
|
||||
var android_sdk_version = path.join(destScriptsDir, 'android_sdk_version');
|
||||
// TODO: the two files being edited on-the-fly here are shared between
|
||||
// platform and project-level commands. the below `sed` is updating the
|
||||
// `require` path for the two libraries. if there's a better way to share
|
||||
// modules across both the repo and generated projects, we should make sure
|
||||
// to remove/update this.
|
||||
shell.sed('-i', /templates\/cordova\//, '', android_sdk_version);
|
||||
shell.sed('-i', /templates\/cordova\//, '', check_reqs);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
106
bin/templates/cordova/lib/android_sdk.js
vendored
Executable file
106
bin/templates/cordova/lib/android_sdk.js
vendored
Executable file
@@ -0,0 +1,106 @@
|
||||
/*
|
||||
Licensed to the Apache Software Foundation (ASF) under one
|
||||
or more contributor license agreements. See the NOTICE file
|
||||
distributed with this work for additional information
|
||||
regarding copyright ownership. The ASF licenses this file
|
||||
to you under the Apache License, Version 2.0 (the
|
||||
"License"); you may not use this file except in compliance
|
||||
with the License. You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing,
|
||||
software distributed under the License is distributed on an
|
||||
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
KIND, either express or implied. See the License for the
|
||||
specific language governing permissions and limitations
|
||||
under the License.
|
||||
*/
|
||||
|
||||
var Q = require('q'),
|
||||
superspawn = require('cordova-common').superspawn;
|
||||
|
||||
var suffix_number_regex = /(\d+)$/;
|
||||
// Used for sorting Android targets, example strings to sort:
|
||||
// android-19
|
||||
// android-L
|
||||
// Google Inc.:Google APIs:20
|
||||
// Google Inc.:Glass Development Kit Preview:20
|
||||
// The idea is to sort based on largest "suffix" number - meaning the bigger
|
||||
// the number at the end, the more recent the target, the closer to the
|
||||
// start of the array.
|
||||
function sort_by_largest_numerical_suffix(a, b) {
|
||||
var suffix_a = a.match(suffix_number_regex);
|
||||
var suffix_b = b.match(suffix_number_regex);
|
||||
if (suffix_a && suffix_b) {
|
||||
// If the two targets being compared have suffixes, return less than
|
||||
// zero, or greater than zero, based on which suffix is larger.
|
||||
return (parseInt(suffix_a[1]) > parseInt(suffix_b[1]) ? -1 : 1);
|
||||
} else {
|
||||
// If no suffix numbers were detected, leave the order as-is between
|
||||
// elements a and b.
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
module.exports.print_newest_available_sdk_target = function() {
|
||||
return module.exports.list_targets()
|
||||
.then(function(targets) {
|
||||
targets.sort(sort_by_largest_numerical_suffix);
|
||||
console.log(targets[0]);
|
||||
});
|
||||
};
|
||||
|
||||
module.exports.version_string_to_api_level = {
|
||||
'4.0': 14,
|
||||
'4.0.3': 15,
|
||||
'4.1': 16,
|
||||
'4.2': 17,
|
||||
'4.3': 18,
|
||||
'4.4': 19,
|
||||
'4.4W': 20,
|
||||
'5.0': 21,
|
||||
'5.1': 22,
|
||||
'6.0': 23,
|
||||
'7.0': 24,
|
||||
'7.1.1': 25
|
||||
};
|
||||
|
||||
function parse_targets(output) {
|
||||
var target_out = output.split('\n');
|
||||
var targets = [];
|
||||
for (var i = target_out.length - 1; i >= 0; i--) {
|
||||
if(target_out[i].match(/id:/)) { // if "id:" is in the line...
|
||||
targets.push(target_out[i].match(/"(.+)"/)[1]); //.. match whatever is in quotes.
|
||||
}
|
||||
}
|
||||
return targets;
|
||||
}
|
||||
|
||||
module.exports.list_targets_with_android = function() {
|
||||
return superspawn.spawn('android', ['list', 'target'])
|
||||
.then(parse_targets);
|
||||
};
|
||||
|
||||
module.exports.list_targets_with_avdmanager = function() {
|
||||
return superspawn.spawn('avdmanager', ['list', 'target'])
|
||||
.then(parse_targets);
|
||||
};
|
||||
|
||||
module.exports.list_targets = function() {
|
||||
return module.exports.list_targets_with_avdmanager()
|
||||
.catch(function(err) {
|
||||
// If there's an error, like avdmanager could not be found, we can try
|
||||
// as a last resort, to run `android`, in case this is a super old
|
||||
// SDK installation.
|
||||
if (err && (err.code == 'ENOENT' || (err.stderr && err.stderr.match(/not recognized/)))) {
|
||||
return module.exports.list_targets_with_android();
|
||||
} else throw err;
|
||||
})
|
||||
.then(function(targets) {
|
||||
if (targets.length === 0) {
|
||||
return Q.reject(new Error('No android targets (SDKs) installed!'));
|
||||
}
|
||||
return targets;
|
||||
});
|
||||
};
|
||||
@@ -65,6 +65,21 @@ GradleBuilder.prototype.getArgs = function(cmd, opts) {
|
||||
return args;
|
||||
};
|
||||
|
||||
/*
|
||||
* This returns a promise
|
||||
*/
|
||||
|
||||
GradleBuilder.prototype.runGradleWrapper = function(gradle_cmd) {
|
||||
var gradlePath = path.join(this.root, 'gradlew');
|
||||
var wrapperGradle = path.join(this.root, 'wrapper.gradle');
|
||||
if(fs.existsSync(gradlePath)) {
|
||||
//Literally do nothing, for some reason this works, while !fs.existsSync didn't on Windows
|
||||
} else {
|
||||
return spawn(gradle_cmd, ['-p', this.root, 'wrapper', '-b', wrapperGradle], {stdio: 'inherit'});
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
// Makes the project buildable, minus the gradle wrapper.
|
||||
GradleBuilder.prototype.prepBuildFiles = function() {
|
||||
// Update the version of build.gradle in each dependent library.
|
||||
@@ -159,17 +174,15 @@ GradleBuilder.prototype.prepBuildFiles = function() {
|
||||
GradleBuilder.prototype.prepEnv = function(opts) {
|
||||
var self = this;
|
||||
return check_reqs.check_gradle()
|
||||
.then(function() {
|
||||
return self.prepBuildFiles();
|
||||
}).then(function() {
|
||||
// Copy the gradle wrapper on each build so that:
|
||||
// A) we don't require the Android SDK at project creation time, and
|
||||
// B) we always use the SDK's latest version of it.
|
||||
// check_reqs ensures that this is set.
|
||||
/*jshint -W069 */
|
||||
var sdkDir = process.env['ANDROID_HOME'];
|
||||
/*jshint +W069 */
|
||||
var wrapperDir = path.join(sdkDir, 'tools', 'templates', 'gradle', 'wrapper');
|
||||
.then(function(gradlePath) {
|
||||
return self.runGradleWrapper(gradlePath);
|
||||
}).then(function() {
|
||||
return self.prepBuildFiles();
|
||||
}).then(function() {
|
||||
// We now copy the gradle out of the framework
|
||||
// This is a dirty patch to get the build working
|
||||
/*
|
||||
var wrapperDir = path.join(self.root, 'CordovaLib');
|
||||
if (process.platform == 'win32') {
|
||||
shell.rm('-f', path.join(self.root, 'gradlew.bat'));
|
||||
shell.cp(path.join(wrapperDir, 'gradlew.bat'), self.root);
|
||||
@@ -180,13 +193,13 @@ GradleBuilder.prototype.prepEnv = function(opts) {
|
||||
shell.rm('-rf', path.join(self.root, 'gradle', 'wrapper'));
|
||||
shell.mkdir('-p', path.join(self.root, 'gradle'));
|
||||
shell.cp('-r', path.join(wrapperDir, 'gradle', 'wrapper'), path.join(self.root, 'gradle'));
|
||||
|
||||
*/
|
||||
// If the gradle distribution URL is set, make sure it points to version we want.
|
||||
// If it's not set, do nothing, assuming that we're using a future version of gradle that we don't want to mess with.
|
||||
// For some reason, using ^ and $ don't work. This does the job, though.
|
||||
var distributionUrlRegex = /distributionUrl.*zip/;
|
||||
/*jshint -W069 */
|
||||
var distributionUrl = process.env['CORDOVA_ANDROID_GRADLE_DISTRIBUTION_URL'] || 'https\\://services.gradle.org/distributions/gradle-2.14.1-all.zip';
|
||||
var distributionUrl = process.env['CORDOVA_ANDROID_GRADLE_DISTRIBUTION_URL'] || 'https\\://services.gradle.org/distributions/gradle-3.3-all.zip';
|
||||
/*jshint +W069 */
|
||||
var gradleWrapperPropertiesPath = path.join(self.root, 'gradle', 'wrapper', 'gradle-wrapper.properties');
|
||||
shell.chmod('u+w', gradleWrapperPropertiesPath);
|
||||
|
||||
@@ -26,10 +26,12 @@ var shelljs = require('shelljs'),
|
||||
Q = require('q'),
|
||||
path = require('path'),
|
||||
fs = require('fs'),
|
||||
ROOT = path.join(__dirname, '..', '..');
|
||||
os = require('os'),
|
||||
REPO_ROOT = path.join(__dirname, '..', '..', '..', '..'),
|
||||
PROJECT_ROOT = path.join(__dirname, '..', '..');
|
||||
var CordovaError = require('cordova-common').CordovaError;
|
||||
|
||||
var isWindows = process.platform == 'win32';
|
||||
var superspawn = require('cordova-common').superspawn;
|
||||
var android_sdk = require('./android_sdk');
|
||||
|
||||
function forgivingWhichSync(cmd) {
|
||||
try {
|
||||
@@ -50,7 +52,16 @@ function tryCommand(cmd, errMsg, catchStderr) {
|
||||
return d.promise;
|
||||
}
|
||||
|
||||
// Get valid target from framework/project.properties
|
||||
module.exports.isWindows = function() {
|
||||
return (os.platform() == 'win32');
|
||||
};
|
||||
|
||||
module.exports.isDarwin = function() {
|
||||
return (os.platform() == 'darwin');
|
||||
};
|
||||
|
||||
// Get valid target from framework/project.properties if run from this repo
|
||||
// Otherwise get target from project.properties file within a generated cordova-android project
|
||||
module.exports.get_target = function() {
|
||||
function extractFromFile(filePath) {
|
||||
var target = shelljs.grep(/\btarget=/, filePath);
|
||||
@@ -59,38 +70,83 @@ module.exports.get_target = function() {
|
||||
}
|
||||
return target.split('=')[1].trim();
|
||||
}
|
||||
if (fs.existsSync(path.join(ROOT, 'framework', 'project.properties'))) {
|
||||
return extractFromFile(path.join(ROOT, 'framework', 'project.properties'));
|
||||
var repo_file = path.join(REPO_ROOT, 'framework', 'project.properties');
|
||||
if (fs.existsSync(repo_file)) {
|
||||
return extractFromFile(repo_file);
|
||||
}
|
||||
if (fs.existsSync(path.join(ROOT, 'project.properties'))) {
|
||||
// if no target found, we're probably in a project and project.properties is in ROOT.
|
||||
return extractFromFile(path.join(ROOT, 'project.properties'));
|
||||
var project_file = path.join(PROJECT_ROOT, 'project.properties');
|
||||
if (fs.existsSync(project_file)) {
|
||||
// if no target found, we're probably in a project and project.properties is in PROJECT_ROOT.
|
||||
return extractFromFile(project_file);
|
||||
}
|
||||
throw new Error('Could not find android target. File missing: ' + path.join(ROOT, 'project.properties'));
|
||||
throw new Error('Could not find android target in either ' + repo_file + ' nor ' + project_file);
|
||||
};
|
||||
|
||||
// Returns a promise. Called only by build and clean commands.
|
||||
module.exports.check_ant = function() {
|
||||
return tryCommand('ant -version', 'Failed to run "ant -version", make sure you have ant installed and added to your PATH.')
|
||||
.then(function (output) {
|
||||
return superspawn.spawn('ant', ['-version'])
|
||||
.then(function(output) {
|
||||
// Parse Ant version from command output
|
||||
return /version ((?:\d+\.)+(?:\d+))/i.exec(output)[1];
|
||||
}).catch(function(err) {
|
||||
throw new CordovaError('Failed to run `ant -version`. Make sure you have `ant` on your $PATH.');
|
||||
});
|
||||
};
|
||||
|
||||
module.exports.get_gradle_wrapper = function() {
|
||||
var androidStudioPath;
|
||||
var i = 0;
|
||||
var foundStudio = false;
|
||||
var program_dir;
|
||||
if (module.exports.isDarwin()) {
|
||||
program_dir = fs.readdirSync('/Applications');
|
||||
while (i < program_dir.length && !foundStudio) {
|
||||
if (program_dir[i].startsWith('Android Studio')) {
|
||||
//TODO: Check for a specific Android Studio version, make sure it's not Canary
|
||||
androidStudioPath = path.join('/Applications', program_dir[i], 'Contents', 'gradle');
|
||||
foundStudio = true;
|
||||
} else { ++i; }
|
||||
}
|
||||
} else if (module.exports.isWindows()) {
|
||||
var androidPath = path.join(process.env['ProgramFiles'], 'Android') + '/';
|
||||
if (fs.existsSync(androidPath)) {
|
||||
program_dir = fs.readdirSync(androidPath);
|
||||
while (i < program_dir.length && !foundStudio) {
|
||||
if (program_dir[i].startsWith('Android Studio')) {
|
||||
foundStudio = true;
|
||||
androidStudioPath = path.join(process.env['ProgramFiles'], 'Android', program_dir[i], 'gradle');
|
||||
} else { ++i; }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (androidStudioPath !== null && fs.existsSync(androidStudioPath)) {
|
||||
var dirs = fs.readdirSync(androidStudioPath);
|
||||
if(dirs[0].split('-')[0] == 'gradle') {
|
||||
return path.join(androidStudioPath, dirs[0], 'bin', 'gradle');
|
||||
}
|
||||
} else {
|
||||
//OK, let's try to check for Gradle!
|
||||
return forgivingWhichSync('gradle');
|
||||
}
|
||||
};
|
||||
|
||||
// Returns a promise. Called only by build and clean commands.
|
||||
module.exports.check_gradle = function() {
|
||||
var sdkDir = process.env['ANDROID_HOME'];
|
||||
var d = Q.defer();
|
||||
if (!sdkDir)
|
||||
return Q.reject(new CordovaError('Could not find gradle wrapper within Android SDK. Could not find Android SDK directory.\n' +
|
||||
'Might need to install Android SDK or set up \'ANDROID_HOME\' env variable.'));
|
||||
|
||||
var wrapperDir = path.join(sdkDir, 'tools', 'templates', 'gradle', 'wrapper');
|
||||
if (!fs.existsSync(wrapperDir)) {
|
||||
return Q.reject(new CordovaError('Could not find gradle wrapper within Android SDK. Might need to update your Android SDK.\n' +
|
||||
'Looked here: ' + wrapperDir));
|
||||
}
|
||||
return Q.when();
|
||||
var gradlePath = module.exports.get_gradle_wrapper();
|
||||
if (gradlePath.length !== 0)
|
||||
d.resolve(gradlePath);
|
||||
else
|
||||
d.reject(new CordovaError('Could not find an installed version of Gradle either in Android Studio,\n' +
|
||||
'or on your system to install the gradle wrapper. Please include gradle \n' +
|
||||
'in your path, or install Android Studio'));
|
||||
return d.promise;
|
||||
};
|
||||
|
||||
// Returns a promise.
|
||||
@@ -105,12 +161,15 @@ module.exports.check_java = function() {
|
||||
}
|
||||
} else {
|
||||
if (javacPath) {
|
||||
var msg = 'Failed to find \'JAVA_HOME\' environment variable. Try setting setting it manually.';
|
||||
// OS X has a command for finding JAVA_HOME.
|
||||
if (fs.existsSync('/usr/libexec/java_home')) {
|
||||
return tryCommand('/usr/libexec/java_home', msg)
|
||||
var find_java = '/usr/libexec/java_home';
|
||||
var default_java_error_msg = 'Failed to find \'JAVA_HOME\' environment variable. Try setting setting it manually.';
|
||||
if (fs.existsSync(find_java)) {
|
||||
return superspawn.spawn(find_java)
|
||||
.then(function(stdout) {
|
||||
process.env['JAVA_HOME'] = stdout.trim();
|
||||
}).catch(function(err) {
|
||||
throw new CordovaError(default_java_error_msg);
|
||||
});
|
||||
} else {
|
||||
// See if we can derive it from javac's location.
|
||||
@@ -119,10 +178,10 @@ module.exports.check_java = function() {
|
||||
if (fs.existsSync(path.join(maybeJavaHome, 'lib', 'tools.jar'))) {
|
||||
process.env['JAVA_HOME'] = maybeJavaHome;
|
||||
} else {
|
||||
throw new CordovaError(msg);
|
||||
throw new CordovaError(default_java_error_msg);
|
||||
}
|
||||
}
|
||||
} else if (isWindows) {
|
||||
} else if (module.exports.isWindows()) {
|
||||
// Try to auto-detect java in the default install paths.
|
||||
var oldSilent = shelljs.config.silent;
|
||||
shelljs.config.silent = true;
|
||||
@@ -142,28 +201,29 @@ module.exports.check_java = function() {
|
||||
}
|
||||
}
|
||||
}).then(function() {
|
||||
var msg =
|
||||
'Failed to run "javac -version", make sure that you have a JDK installed.\n' +
|
||||
'You can get it from: http://www.oracle.com/technetwork/java/javase/downloads.\n';
|
||||
if (process.env['JAVA_HOME']) {
|
||||
msg += 'Your JAVA_HOME is invalid: ' + process.env['JAVA_HOME'] + '\n';
|
||||
}
|
||||
// We use tryCommand with catchStderr = true, because
|
||||
// javac writes version info to stderr instead of stdout
|
||||
return tryCommand('javac -version', msg, true)
|
||||
.then(function (output) {
|
||||
//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];
|
||||
});
|
||||
var msg =
|
||||
'Failed to run "javac -version", make sure that you have a JDK installed.\n' +
|
||||
'You can get it from: http://www.oracle.com/technetwork/java/javase/downloads.\n';
|
||||
if (process.env['JAVA_HOME']) {
|
||||
msg += 'Your JAVA_HOME is invalid: ' + process.env['JAVA_HOME'] + '\n';
|
||||
}
|
||||
// We use tryCommand with catchStderr = true, because
|
||||
// javac writes version info to stderr instead of stdout
|
||||
return tryCommand('javac -version', msg, true)
|
||||
.then(function (output) {
|
||||
//Let's check for at least Java 8, and keep it future proof so we can support Java 10
|
||||
var match = /javac ((?:1\.)(?:[8-9]\.)(?:\d+))|((?:1\.)(?:[1-9]\d+\.)(?:\d+))/i.exec(output);
|
||||
return match && match[1];
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
// Returns a promise.
|
||||
module.exports.check_android = function() {
|
||||
return Q().then(function() {
|
||||
var androidCmdPath = forgivingWhichSync('android');
|
||||
var adbInPath = !!forgivingWhichSync('adb');
|
||||
var adbInPath = forgivingWhichSync('adb');
|
||||
var avdmanagerInPath = forgivingWhichSync('avdmanager');
|
||||
var hasAndroidHome = !!process.env['ANDROID_HOME'] && fs.existsSync(process.env['ANDROID_HOME']);
|
||||
function maybeSetAndroidHome(value) {
|
||||
if (!hasAndroidHome && fs.existsSync(value)) {
|
||||
@@ -171,8 +231,10 @@ module.exports.check_android = function() {
|
||||
process.env['ANDROID_HOME'] = value;
|
||||
}
|
||||
}
|
||||
if (!hasAndroidHome && !androidCmdPath) {
|
||||
if (isWindows) {
|
||||
// First ensure ANDROID_HOME is set
|
||||
// If we have no hints (nothing in PATH), try a few default locations
|
||||
if (!hasAndroidHome && !androidCmdPath && !adbInPath && !avdmanagerInPath) {
|
||||
if (module.exports.isWindows()) {
|
||||
// Android Studio 1.0 installer
|
||||
maybeSetAndroidHome(path.join(process.env['LOCALAPPDATA'], 'Android', 'sdk'));
|
||||
maybeSetAndroidHome(path.join(process.env['ProgramFiles'], 'Android', 'sdk'));
|
||||
@@ -182,7 +244,7 @@ module.exports.check_android = function() {
|
||||
// Stand-alone installer
|
||||
maybeSetAndroidHome(path.join(process.env['LOCALAPPDATA'], 'Android', 'android-sdk'));
|
||||
maybeSetAndroidHome(path.join(process.env['ProgramFiles'], 'Android', 'android-sdk'));
|
||||
} else if (process.platform == 'darwin') {
|
||||
} else if (module.exports.isDarwin()) {
|
||||
// Android Studio 1.0 installer
|
||||
maybeSetAndroidHome(path.join(process.env['HOME'], 'Library', 'Android', 'sdk'));
|
||||
// Android Studio pre-1.0 installer
|
||||
@@ -197,26 +259,42 @@ module.exports.check_android = function() {
|
||||
maybeSetAndroidHome(path.join(process.env['HOME'], 'android-sdk'));
|
||||
}
|
||||
}
|
||||
if (hasAndroidHome && !androidCmdPath) {
|
||||
process.env['PATH'] += path.delimiter + path.join(process.env['ANDROID_HOME'], 'tools');
|
||||
}
|
||||
if (androidCmdPath && !hasAndroidHome) {
|
||||
var parentDir = path.dirname(androidCmdPath);
|
||||
var grandParentDir = path.dirname(parentDir);
|
||||
if (path.basename(parentDir) == 'tools') {
|
||||
process.env['ANDROID_HOME'] = path.dirname(parentDir);
|
||||
hasAndroidHome = true;
|
||||
} else if (fs.existsSync(path.join(grandParentDir, 'tools', 'android'))) {
|
||||
process.env['ANDROID_HOME'] = grandParentDir;
|
||||
hasAndroidHome = true;
|
||||
} else {
|
||||
throw new CordovaError('Failed to find \'ANDROID_HOME\' environment variable. Try setting setting it manually.\n' +
|
||||
'Detected \'android\' command at ' + parentDir + ' but no \'tools\' directory found near.\n' +
|
||||
'Try reinstall Android SDK or update your PATH to include path to valid SDK directory.');
|
||||
if (!hasAndroidHome) {
|
||||
// If we dont have ANDROID_HOME, but we do have some tools on the PATH, try to infer from the tooling PATH.
|
||||
var parentDir, grandParentDir;
|
||||
if (androidCmdPath) {
|
||||
parentDir = path.dirname(androidCmdPath);
|
||||
grandParentDir = path.dirname(parentDir);
|
||||
if (path.basename(parentDir) == 'tools' || fs.existsSync(path.join(grandParentDir, 'tools', 'android'))) {
|
||||
maybeSetAndroidHome(grandParentDir);
|
||||
} else {
|
||||
throw new CordovaError('Failed to find \'ANDROID_HOME\' environment variable. Try setting setting it manually.\n' +
|
||||
'Detected \'android\' command at ' + parentDir + ' but no \'tools\' directory found near.\n' +
|
||||
'Try reinstall Android SDK or update your PATH to include valid path to SDK' + path.sep + 'tools directory.');
|
||||
}
|
||||
}
|
||||
if (adbInPath) {
|
||||
parentDir = path.dirname(adbInPath);
|
||||
grandParentDir = path.dirname(parentDir);
|
||||
if (path.basename(parentDir) == 'platform-tools') {
|
||||
maybeSetAndroidHome(grandParentDir);
|
||||
} else {
|
||||
throw new CordovaError('Failed to find \'ANDROID_HOME\' environment variable. Try setting setting it manually.\n' +
|
||||
'Detected \'adb\' command at ' + parentDir + ' but no \'platform-tools\' directory found near.\n' +
|
||||
'Try reinstall Android SDK or update your PATH to include valid path to SDK' + path.sep + 'platform-tools directory.');
|
||||
}
|
||||
}
|
||||
if (avdmanagerInPath) {
|
||||
parentDir = path.dirname(avdmanagerInPath);
|
||||
grandParentDir = path.dirname(parentDir);
|
||||
if (path.basename(parentDir) == 'bin' && path.basename(grandParentDir) == 'tools') {
|
||||
maybeSetAndroidHome(path.dirname(grandParentDir));
|
||||
} else {
|
||||
throw new CordovaError('Failed to find \'ANDROID_HOME\' environment variable. Try setting setting it manually.\n' +
|
||||
'Detected \'avdmanager\' command at ' + parentDir + ' but no \'tools' + path.sep + 'bin\' directory found near.\n' +
|
||||
'Try reinstall Android SDK or update your PATH to include valid path to SDK' + path.sep + 'tools' + path.sep + 'bin directory.');
|
||||
}
|
||||
}
|
||||
}
|
||||
if (hasAndroidHome && !adbInPath) {
|
||||
process.env['PATH'] += path.delimiter + path.join(process.env['ANDROID_HOME'], 'platform-tools');
|
||||
}
|
||||
if (!process.env['ANDROID_HOME']) {
|
||||
throw new CordovaError('Failed to find \'ANDROID_HOME\' environment variable. Try setting setting it manually.\n' +
|
||||
@@ -226,13 +304,27 @@ module.exports.check_android = function() {
|
||||
throw new CordovaError('\'ANDROID_HOME\' environment variable is set to non-existent path: ' + process.env['ANDROID_HOME'] +
|
||||
'\nTry update it manually to point to valid SDK directory.');
|
||||
}
|
||||
// Next let's make sure relevant parts of the SDK tooling is in our PATH
|
||||
if (hasAndroidHome && !androidCmdPath) {
|
||||
process.env['PATH'] += path.delimiter + path.join(process.env['ANDROID_HOME'], 'tools');
|
||||
}
|
||||
if (hasAndroidHome && !adbInPath) {
|
||||
process.env['PATH'] += path.delimiter + path.join(process.env['ANDROID_HOME'], 'platform-tools');
|
||||
}
|
||||
if (hasAndroidHome && !avdmanagerInPath) {
|
||||
process.env['PATH'] += path.delimiter + path.join(process.env['ANDROID_HOME'], 'tools', 'bin');
|
||||
}
|
||||
return hasAndroidHome;
|
||||
});
|
||||
};
|
||||
|
||||
// TODO: is this actually needed?
|
||||
module.exports.getAbsoluteAndroidCmd = function () {
|
||||
var cmd = forgivingWhichSync('android');
|
||||
if (process.platform === 'win32') {
|
||||
if (cmd.length === 0) {
|
||||
cmd = forgivingWhichSync('sdkmanager');
|
||||
}
|
||||
if (module.exports.isWindows()) {
|
||||
return '"' + cmd + '"';
|
||||
}
|
||||
return cmd.replace(/(\s)/g, '\\$1');
|
||||
@@ -244,20 +336,17 @@ module.exports.check_android_target = function(originalError) {
|
||||
// android-L
|
||||
// Google Inc.:Google APIs:20
|
||||
// Google Inc.:Glass Development Kit Preview:20
|
||||
var valid_target = module.exports.get_target();
|
||||
var msg = 'Android SDK not found. Make sure that it is installed. If it is not at the default location, set the ANDROID_HOME environment variable.';
|
||||
return tryCommand('android list targets --compact', msg)
|
||||
.then(function(output) {
|
||||
var targets = output.split('\n');
|
||||
if (targets.indexOf(valid_target) >= 0) {
|
||||
var desired_api_level = module.exports.get_target();
|
||||
return android_sdk.list_targets()
|
||||
.then(function(targets) {
|
||||
if (targets.indexOf(desired_api_level) >= 0) {
|
||||
return targets;
|
||||
}
|
||||
|
||||
var androidCmd = module.exports.getAbsoluteAndroidCmd();
|
||||
var msg = 'Please install Android target: "' + valid_target + '".\n\n' +
|
||||
var msg = 'Please install Android target / API level: "' + desired_api_level + '".\n\n' +
|
||||
'Hint: Open the SDK manager by running: ' + androidCmd + '\n' +
|
||||
'You will require:\n' +
|
||||
'1. "SDK Platform" for ' + valid_target + '\n' +
|
||||
'1. "SDK Platform" for API level ' + desired_api_level + '\n' +
|
||||
'2. "Android SDK Platform-tools (latest)\n' +
|
||||
'3. "Android SDK Build-tools" (latest)';
|
||||
if (originalError) {
|
||||
@@ -278,7 +367,6 @@ module.exports.run = function() {
|
||||
throw new CordovaError('Requirements check failed for JDK 1.8 or greater');
|
||||
}
|
||||
|
||||
|
||||
if (!values[1]) {
|
||||
throw new CordovaError('Requirements check failed for Android SDK');
|
||||
}
|
||||
131
bin/templates/cordova/lib/emulator.js
vendored
131
bin/templates/cordova/lib/emulator.js
vendored
@@ -27,11 +27,15 @@ var path = require('path');
|
||||
var Adb = require('./Adb');
|
||||
var AndroidManifest = require('./AndroidManifest');
|
||||
var events = require('cordova-common').events;
|
||||
var spawn = require('cordova-common').superspawn.spawn;
|
||||
var superspawn = require('cordova-common').superspawn;
|
||||
var CordovaError = require('cordova-common').CordovaError;
|
||||
var shelljs = require('shelljs');
|
||||
var android_sdk = require('./android_sdk');
|
||||
var check_reqs = require('./check_reqs');
|
||||
|
||||
var Q = require('q');
|
||||
var os = require('os');
|
||||
var fs = require('fs');
|
||||
var child_process = require('child_process');
|
||||
|
||||
// constants
|
||||
@@ -42,18 +46,77 @@ var NUM_INSTALL_RETRIES = 3;
|
||||
var CHECK_BOOTED_INTERVAL = 3 * ONE_SECOND; // in milliseconds
|
||||
var EXEC_KILL_SIGNAL = 'SIGKILL';
|
||||
|
||||
/**
|
||||
* Returns a Promise for a list of emulator images in the form of objects
|
||||
* {
|
||||
name : <emulator_name>,
|
||||
path : <path_to_emulator_image>,
|
||||
target : <api_target>,
|
||||
abi : <cpu>,
|
||||
skin : <skin>
|
||||
}
|
||||
*/
|
||||
module.exports.list_images = function() {
|
||||
return spawn('android', ['list', 'avds'])
|
||||
function forgivingWhichSync(cmd) {
|
||||
try {
|
||||
return fs.realpathSync(shelljs.which(cmd));
|
||||
} catch (e) {
|
||||
return '';
|
||||
}
|
||||
}
|
||||
|
||||
module.exports.list_images_using_avdmanager = function () {
|
||||
return superspawn.spawn('avdmanager', ['list', 'avd'])
|
||||
.then(function(output) {
|
||||
var response = output.split('\n');
|
||||
var emulator_list = [];
|
||||
for (var i = 1; i < response.length; i++) {
|
||||
// To return more detailed information use img_obj
|
||||
var img_obj = {};
|
||||
if (response[i].match(/Name:\s/)) {
|
||||
img_obj['name'] = response[i].split('Name: ')[1].replace('\r', '');
|
||||
if (response[i + 1].match(/Device:\s/)) {
|
||||
i++;
|
||||
img_obj['device'] = response[i].split('Device: ')[1].replace('\r', '');
|
||||
}
|
||||
if (response[i + 1].match(/Path:\s/)) {
|
||||
i++;
|
||||
img_obj['path'] = response[i].split('Path: ')[1].replace('\r', '');
|
||||
}
|
||||
if (response[i + 1].match(/Target:\s/)) {
|
||||
i++;
|
||||
if (response[i + 1].match(/ABI:\s/)) {
|
||||
img_obj['abi'] = response[i + 1].split('ABI: ')[1].replace('\r', '');
|
||||
}
|
||||
// This next conditional just aims to match the old output of `android list avd`
|
||||
// We do so so that we don't have to change the logic when parsing for the
|
||||
// best emulator target to spawn (see below in `best_image`)
|
||||
// This allows us to transitionally support both `android` and `avdmanager` binaries,
|
||||
// depending on what SDK version the user has
|
||||
if (response[i + 1].match(/Based\son:\s/)) {
|
||||
img_obj['target'] = response[i + 1].split('Based on:')[1];
|
||||
if (img_obj['target'].match(/Tag\/ABI:\s/)) {
|
||||
img_obj['target'] = img_obj['target'].split('Tag/ABI:')[0].replace('\r', '').trim();
|
||||
if (img_obj['target'].indexOf('(') > -1) {
|
||||
img_obj['target'] = img_obj['target'].substr(0, img_obj['target'].indexOf('(') - 1).trim();
|
||||
}
|
||||
}
|
||||
var version_string = img_obj['target'].replace(/Android\s+/, '');
|
||||
|
||||
var api_level = android_sdk.version_string_to_api_level[version_string];
|
||||
if (api_level) {
|
||||
img_obj['target'] += ' (API level ' + api_level + ')';
|
||||
}
|
||||
}
|
||||
}
|
||||
if (response[i + 1].match(/Skin:\s/)) {
|
||||
i++;
|
||||
img_obj['skin'] = response[i].split('Skin: ')[1].replace('\r', '');
|
||||
}
|
||||
|
||||
emulator_list.push(img_obj);
|
||||
}
|
||||
/* To just return a list of names use this
|
||||
if (response[i].match(/Name:\s/)) {
|
||||
emulator_list.push(response[i].split('Name: ')[1].replace('\r', '');
|
||||
}*/
|
||||
|
||||
}
|
||||
return emulator_list;
|
||||
});
|
||||
};
|
||||
|
||||
module.exports.list_images_using_android = function() {
|
||||
return superspawn.spawn('android', ['list', 'avd'])
|
||||
.then(function(output) {
|
||||
var response = output.split('\n');
|
||||
var emulator_list = [];
|
||||
@@ -96,6 +159,29 @@ module.exports.list_images = function() {
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* Returns a Promise for a list of emulator images in the form of objects
|
||||
* {
|
||||
name : <emulator_name>,
|
||||
device : <device>,
|
||||
path : <path_to_emulator_image>,
|
||||
target : <api_target>,
|
||||
abi : <cpu>,
|
||||
skin : <skin>
|
||||
}
|
||||
*/
|
||||
module.exports.list_images = function() {
|
||||
if (forgivingWhichSync('avdmanager')) {
|
||||
return module.exports.list_images_using_avdmanager();
|
||||
} else if (forgivingWhichSync('android')) {
|
||||
return module.exports.list_images_using_android();
|
||||
} else {
|
||||
return Q().then(function() {
|
||||
throw new CordovaError('Could not find either `android` or `avdmanager` on your $PATH! Are you sure the Android SDK is installed and available?');
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Will return the closest avd to the projects target
|
||||
* or undefined if no avds exist.
|
||||
@@ -109,8 +195,7 @@ module.exports.best_image = function() {
|
||||
|
||||
var closest = 9999;
|
||||
var best = images[0];
|
||||
// Loading check_reqs at run-time to avoid test-time vs run-time directory structure difference issue
|
||||
var project_target = require('./check_reqs').get_target().replace('android-', '');
|
||||
var project_target = check_reqs.get_target().replace('android-', '');
|
||||
for (var i in images) {
|
||||
var target = images[i].target;
|
||||
if(target) {
|
||||
@@ -133,8 +218,9 @@ module.exports.list_started = function() {
|
||||
};
|
||||
|
||||
// Returns a promise.
|
||||
// TODO: we should remove this, there's a more robust method under android_sdk.js
|
||||
module.exports.list_targets = function() {
|
||||
return spawn('android', ['list', 'targets'], {cwd: os.tmpdir()})
|
||||
return superspawn.spawn('android', ['list', 'targets'], {cwd: os.tmpdir()})
|
||||
.then(function(output) {
|
||||
var target_out = output.split('\n');
|
||||
var targets = [];
|
||||
@@ -189,8 +275,7 @@ module.exports.start = function(emulator_ID, boot_timeout) {
|
||||
return best.name;
|
||||
}
|
||||
|
||||
// Loading check_reqs at run-time to avoid test-time vs run-time directory structure difference issue
|
||||
var androidCmd = require('./check_reqs').getAbsoluteAndroidCmd();
|
||||
var androidCmd = check_reqs.getAbsoluteAndroidCmd();
|
||||
return Q.reject(new CordovaError('No emulator images (avds) found.\n' +
|
||||
'1. Download desired System Image by running: ' + androidCmd + ' sdk\n' +
|
||||
'2. Create an AVD by running: ' + androidCmd + ' avd\n' +
|
||||
@@ -199,10 +284,13 @@ module.exports.start = function(emulator_ID, boot_timeout) {
|
||||
}).then(function(emulatorId) {
|
||||
return self.get_available_port()
|
||||
.then(function (port) {
|
||||
// Figure out the directory the emulator binary runs in, and set the cwd to that directory.
|
||||
// Workaround for https://code.google.com/p/android/issues/detail?id=235461
|
||||
var emulator_dir = path.dirname(shelljs.which('emulator'));
|
||||
var args = ['-avd', emulatorId, '-port', port];
|
||||
// Don't wait for it to finish, since the emulator will probably keep running for a long time.
|
||||
child_process
|
||||
.spawn('emulator', args, { stdio: 'inherit', detached: true })
|
||||
.spawn('emulator', args, { stdio: 'inherit', detached: true, cwd: emulator_dir })
|
||||
.unref();
|
||||
|
||||
// wait for emulator to start
|
||||
@@ -294,7 +382,7 @@ module.exports.wait_for_boot = function(emulator_id, time_remaining) {
|
||||
module.exports.create_image = function(name, target) {
|
||||
console.log('Creating new avd named ' + name);
|
||||
if (target) {
|
||||
return spawn('android', ['create', 'avd', '--name', name, '--target', target])
|
||||
return superspawn.spawn('android', ['create', 'avd', '--name', name, '--target', target])
|
||||
.then(null, function(error) {
|
||||
console.error('ERROR : Failed to create emulator image : ');
|
||||
console.error(' Do you have the latest android targets including ' + target + '?');
|
||||
@@ -302,7 +390,8 @@ module.exports.create_image = function(name, target) {
|
||||
});
|
||||
} else {
|
||||
console.log('WARNING : Project target not found, creating avd with a different target but the project may fail to install.');
|
||||
return spawn('android', ['create', 'avd', '--name', name, '--target', this.list_targets()[0]])
|
||||
// TODO: there's a more robust method for finding targets in android_sdk.js
|
||||
return superspawn.spawn('android', ['create', 'avd', '--name', name, '--target', this.list_targets()[0]])
|
||||
.then(function() {
|
||||
// TODO: This seems like another error case, even though it always happens.
|
||||
console.error('ERROR : Unable to create an avd emulator, no targets found.');
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
var devices = require('./device');
|
||||
|
||||
// Usage support for when args are given
|
||||
require('../lib/check_reqs').check_android().then(function() {
|
||||
require('./check_reqs').check_android().then(function() {
|
||||
devices.list().done(function(device_list) {
|
||||
device_list && device_list.forEach(function(dev) {
|
||||
console.log(dev);
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
var emulators = require('./emulator');
|
||||
|
||||
// Usage support for when args are given
|
||||
require('../lib/check_reqs').check_android().then(function() {
|
||||
require('./check_reqs').check_android().then(function() {
|
||||
emulators.list_images().done(function(emulator_list) {
|
||||
emulator_list && emulator_list.forEach(function(emu) {
|
||||
console.log(emu.name);
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
var emulators = require('./emulator');
|
||||
|
||||
// Usage support for when args are given
|
||||
require('../lib/check_reqs').check_android().then(function() {
|
||||
require('./check_reqs').check_android().then(function() {
|
||||
emulators.list_started().done(function(emulator_list) {
|
||||
emulator_list && emulator_list.forEach(function(emu) {
|
||||
console.log(emu);
|
||||
|
||||
40
bin/templates/cordova/lib/prepare.js
vendored
40
bin/templates/cordova/lib/prepare.js
vendored
@@ -48,6 +48,7 @@ module.exports.prepare = function (cordovaProject, options) {
|
||||
.then(function () {
|
||||
updateIcons(cordovaProject, path.relative(cordovaProject.root, self.locations.res));
|
||||
updateSplashes(cordovaProject, path.relative(cordovaProject.root, self.locations.res));
|
||||
updateFileResources(cordovaProject, path.relative(cordovaProject.root, self.locations.root));
|
||||
})
|
||||
.then(function () {
|
||||
events.emit('verbose', 'Prepared android project successfully');
|
||||
@@ -72,6 +73,7 @@ module.exports.clean = function (options) {
|
||||
cleanWww(projectRoot, self.locations);
|
||||
cleanIcons(projectRoot, projectConfig, path.relative(projectRoot, self.locations.res));
|
||||
cleanSplashes(projectRoot, projectConfig, path.relative(projectRoot, self.locations.res));
|
||||
cleanFileResources(projectRoot, projectConfig, path.relative(projectRoot, self.locations.root));
|
||||
});
|
||||
};
|
||||
|
||||
@@ -401,6 +403,44 @@ function mapImageResources(rootDir, subDir, type, resourceName) {
|
||||
return pathMap;
|
||||
}
|
||||
|
||||
|
||||
function updateFileResources(cordovaProject, platformDir) {
|
||||
var files = cordovaProject.projectConfig.getFileResources('android');
|
||||
|
||||
// if there are resource-file elements in config.xml
|
||||
if (files.length === 0) {
|
||||
events.emit('verbose', 'This app does not have additional resource files defined');
|
||||
return;
|
||||
}
|
||||
|
||||
var resourceMap = {};
|
||||
files.forEach(function(res) {
|
||||
var targetPath = path.join(platformDir, res.target);
|
||||
resourceMap[targetPath] = res.src;
|
||||
});
|
||||
|
||||
events.emit('verbose', 'Updating resource files at ' + platformDir);
|
||||
FileUpdater.updatePaths(
|
||||
resourceMap, { rootDir: cordovaProject.root }, logFileOp);
|
||||
}
|
||||
|
||||
|
||||
function cleanFileResources(projectRoot, projectConfig, platformDir) {
|
||||
var files = projectConfig.getFileResources('android');
|
||||
if (files.length > 0) {
|
||||
events.emit('verbose', 'Cleaning resource files at ' + platformDir);
|
||||
|
||||
var resourceMap = {};
|
||||
files.forEach(function(res) {
|
||||
var filePath = path.join(platformDir, res.target);
|
||||
resourceMap[filePath] = null;
|
||||
});
|
||||
|
||||
FileUpdater.updatePaths(
|
||||
resourceMap, { rootDir: projectRoot, all: true}, logFileOp);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets and validates 'AndroidLaunchMode' prepference from config.xml. Returns
|
||||
* preference value and warns if it doesn't seems to be valid
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
*/
|
||||
|
||||
// Coho updates this line:
|
||||
var VERSION = "6.1.2";
|
||||
var VERSION = "6.2.3";
|
||||
|
||||
module.exports.version = VERSION;
|
||||
|
||||
|
||||
14
bin/templates/project/assets/www/cordova.js
vendored
14
bin/templates/project/assets/www/cordova.js
vendored
@@ -1,5 +1,5 @@
|
||||
// Platform: android
|
||||
// 7c5fcc5a5adfbf3fb8ceaf36fbdd4bd970bd9c20
|
||||
// 7ef9f9c03167a4dde4372d869472241b6816fee9
|
||||
/*
|
||||
Licensed to the Apache Software Foundation (ASF) under one
|
||||
or more contributor license agreements. See the NOTICE file
|
||||
@@ -19,7 +19,7 @@
|
||||
under the License.
|
||||
*/
|
||||
;(function() {
|
||||
var PLATFORM_VERSION_BUILD_LABEL = '6.1.2';
|
||||
var PLATFORM_VERSION_BUILD_LABEL = '6.2.3';
|
||||
// file: src/scripts/require.js
|
||||
|
||||
/*jshint -W079 */
|
||||
@@ -330,7 +330,7 @@ module.exports = cordova;
|
||||
|
||||
});
|
||||
|
||||
// file: /Users/steveng/repo/cordova/cordova-android/cordova-js-src/android/nativeapiprovider.js
|
||||
// file: /Users/maj/src/cordova-android/cordova-js-src/android/nativeapiprovider.js
|
||||
define("cordova/android/nativeapiprovider", function(require, exports, module) {
|
||||
|
||||
/**
|
||||
@@ -353,7 +353,7 @@ module.exports = {
|
||||
|
||||
});
|
||||
|
||||
// file: /Users/steveng/repo/cordova/cordova-android/cordova-js-src/android/promptbasednativeapi.js
|
||||
// file: /Users/maj/src/cordova-android/cordova-js-src/android/promptbasednativeapi.js
|
||||
define("cordova/android/promptbasednativeapi", function(require, exports, module) {
|
||||
|
||||
/**
|
||||
@@ -886,7 +886,7 @@ module.exports = channel;
|
||||
|
||||
});
|
||||
|
||||
// file: /Users/steveng/repo/cordova/cordova-android/cordova-js-src/exec.js
|
||||
// file: /Users/maj/src/cordova-android/cordova-js-src/exec.js
|
||||
define("cordova/exec", function(require, exports, module) {
|
||||
|
||||
/**
|
||||
@@ -1649,7 +1649,7 @@ exports.reset();
|
||||
|
||||
});
|
||||
|
||||
// file: /Users/steveng/repo/cordova/cordova-android/cordova-js-src/platform.js
|
||||
// file: /Users/maj/src/cordova-android/cordova-js-src/platform.js
|
||||
define("cordova/platform", function(require, exports, module) {
|
||||
|
||||
// The last resume event that was received that had the result of a plugin call.
|
||||
@@ -1759,7 +1759,7 @@ function onMessageFromNative(msg) {
|
||||
|
||||
});
|
||||
|
||||
// file: /Users/steveng/repo/cordova/cordova-android/cordova-js-src/plugin/android/app.js
|
||||
// file: /Users/maj/src/cordova-android/cordova-js-src/plugin/android/app.js
|
||||
define("cordova/plugin/android/app", function(require, exports, module) {
|
||||
|
||||
var exec = require('cordova/exec');
|
||||
|
||||
@@ -30,7 +30,7 @@ buildscript {
|
||||
// http://tools.android.com/tech-docs/new-build-system/version-compatibility
|
||||
// and https://issues.apache.org/jira/browse/CB-8143
|
||||
dependencies {
|
||||
classpath 'com.android.tools.build:gradle:2.2.1'
|
||||
classpath 'com.android.tools.build:gradle:2.2.3'
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
BIN
bin/templates/project/res/drawable-land-xxhdpi/screen.png
Normal file
BIN
bin/templates/project/res/drawable-land-xxhdpi/screen.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.1 MiB |
BIN
bin/templates/project/res/drawable-land-xxxhdpi/screen.png
Normal file
BIN
bin/templates/project/res/drawable-land-xxxhdpi/screen.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.4 MiB |
BIN
bin/templates/project/res/drawable-port-xxhdpi/screen.png
Normal file
BIN
bin/templates/project/res/drawable-port-xxhdpi/screen.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.1 MiB |
BIN
bin/templates/project/res/drawable-port-xxxhdpi/screen.png
Normal file
BIN
bin/templates/project/res/drawable-port-xxxhdpi/screen.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.5 MiB |
BIN
bin/templates/project/res/mipmap-xxhdpi/icon.png
Normal file
BIN
bin/templates/project/res/mipmap-xxhdpi/icon.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 14 KiB |
BIN
bin/templates/project/res/mipmap-xxxhdpi/icon.png
Normal file
BIN
bin/templates/project/res/mipmap-xxxhdpi/icon.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 18 KiB |
1
bin/templates/project/wrapper.gradle
Normal file
1
bin/templates/project/wrapper.gradle
Normal file
@@ -0,0 +1 @@
|
||||
//This file is intentionally just a comment
|
||||
@@ -16,28 +16,32 @@
|
||||
under the License.
|
||||
*/
|
||||
|
||||
|
||||
|
||||
buildscript {
|
||||
repositories {
|
||||
mavenCentral()
|
||||
jcenter();
|
||||
}
|
||||
|
||||
dependencies {
|
||||
classpath 'com.android.tools.build:gradle:2.2.1'
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
apply plugin: 'com.android.library'
|
||||
|
||||
ext {
|
||||
apply from: 'cordova.gradle'
|
||||
cdvCompileSdkVersion = privateHelpers.getProjectTarget()
|
||||
cdvBuildToolsVersion = privateHelpers.findLatestInstalledBuildTools()
|
||||
}
|
||||
|
||||
buildscript {
|
||||
repositories {
|
||||
mavenCentral()
|
||||
jcenter()
|
||||
}
|
||||
|
||||
dependencies {
|
||||
classpath 'com.android.tools.build:gradle:2.2.3'
|
||||
classpath 'com.github.dcendents:android-maven-gradle-plugin:1.5'
|
||||
classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.7.3'
|
||||
}
|
||||
}
|
||||
|
||||
apply plugin: 'com.android.library'
|
||||
apply plugin: 'com.github.dcendents.android-maven'
|
||||
apply plugin: 'com.jfrog.bintray'
|
||||
|
||||
group = 'org.apache.cordova'
|
||||
version = '6.2.3'
|
||||
|
||||
android {
|
||||
compileSdkVersion cdvCompileSdkVersion
|
||||
buildToolsVersion cdvBuildToolsVersion
|
||||
@@ -59,4 +63,73 @@ android {
|
||||
assets.srcDirs = ['assets']
|
||||
}
|
||||
}
|
||||
|
||||
packagingOptions {
|
||||
exclude 'META-INF/LICENSE'
|
||||
exclude 'META-INF/LICENSE.txt'
|
||||
exclude 'META-INF/DEPENDENCIES'
|
||||
exclude 'META-INF/NOTICE'
|
||||
}
|
||||
}
|
||||
|
||||
install {
|
||||
repositories.mavenInstaller {
|
||||
pom {
|
||||
project {
|
||||
packaging 'aar'
|
||||
name 'Cordova'
|
||||
url 'https://cordova.apache.org'
|
||||
licenses {
|
||||
license {
|
||||
name 'The Apache Software License, Version 2.0'
|
||||
url 'http://www.apache.org/licenses/LICENSE-2.0.txt'
|
||||
}
|
||||
}
|
||||
developers {
|
||||
developer {
|
||||
id 'stevengill'
|
||||
name 'Steve Gill'
|
||||
}
|
||||
}
|
||||
scm {
|
||||
connection 'https://git-wip-us.apache.org/repos/asf?p=cordova-android.git'
|
||||
developerConnection 'https://git-wip-us.apache.org/repos/asf?p=cordova-android.git'
|
||||
url 'https://git-wip-us.apache.org/repos/asf?p=cordova-android'
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
task sourcesJar(type: Jar) {
|
||||
from android.sourceSets.main.java.srcDirs
|
||||
classifier = 'sources'
|
||||
}
|
||||
|
||||
artifacts {
|
||||
archives sourcesJar
|
||||
}
|
||||
|
||||
bintray {
|
||||
user = System.getenv('BINTRAY_USER')
|
||||
key = System.getenv('BINTRAY_KEY')
|
||||
configurations = ['archives']
|
||||
pkg {
|
||||
repo = 'maven'
|
||||
name = 'cordova-android'
|
||||
userOrg = 'cordova'
|
||||
licenses = ['Apache-2.0']
|
||||
vcsUrl = 'https://git-wip-us.apache.org/repos/asf?p=cordova-android.git'
|
||||
websiteUrl = 'https://cordova.apache.org'
|
||||
issueTrackerUrl = 'https://issues.apache.org/jira/browse/CB'
|
||||
publicDownloadNumbers = true
|
||||
licenses = ['Apache-2.0']
|
||||
labels = ['android', 'cordova', 'phonegap']
|
||||
version {
|
||||
name = '6.2.3'
|
||||
released = new Date()
|
||||
vcsTag = '6.2.3'
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
6
framework/gradle/wrapper/gradle-wrapper.properties
vendored
Normal file
6
framework/gradle/wrapper/gradle-wrapper.properties
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
#Mon Dec 28 10:00:20 PST 2015
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-2.14.1-all.zip
|
||||
@@ -31,7 +31,7 @@ import android.webkit.WebChromeClient.CustomViewCallback;
|
||||
* are not expected to implement it.
|
||||
*/
|
||||
public interface CordovaWebView {
|
||||
public static final String CORDOVA_VERSION = "6.1.2";
|
||||
public static final String CORDOVA_VERSION = "6.2.3";
|
||||
|
||||
void init(CordovaInterface cordova, List<PluginEntry> pluginEntries, CordovaPreferences preferences);
|
||||
|
||||
|
||||
@@ -488,6 +488,34 @@ public class NativeToJsMessageQueue {
|
||||
encodeAsMessageHelper(sb, pluginResult);
|
||||
}
|
||||
|
||||
void buildJsMessage(StringBuilder sb) {
|
||||
switch (pluginResult.getMessageType()) {
|
||||
case PluginResult.MESSAGE_TYPE_MULTIPART:
|
||||
int size = pluginResult.getMultipartMessagesSize();
|
||||
for (int i=0; i<size; i++) {
|
||||
PluginResult subresult = pluginResult.getMultipartMessage(i);
|
||||
JsMessage submessage = new JsMessage(subresult, jsPayloadOrCallbackId);
|
||||
submessage.buildJsMessage(sb);
|
||||
if (i < (size-1)) {
|
||||
sb.append(",");
|
||||
}
|
||||
}
|
||||
break;
|
||||
case PluginResult.MESSAGE_TYPE_BINARYSTRING:
|
||||
sb.append("atob('")
|
||||
.append(pluginResult.getMessage())
|
||||
.append("')");
|
||||
break;
|
||||
case PluginResult.MESSAGE_TYPE_ARRAYBUFFER:
|
||||
sb.append("cordova.require('cordova/base64').toArrayBuffer('")
|
||||
.append(pluginResult.getMessage())
|
||||
.append("')");
|
||||
break;
|
||||
default:
|
||||
sb.append(pluginResult.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
void encodeAsJsMessage(StringBuilder sb) {
|
||||
if (pluginResult == null) {
|
||||
sb.append(jsPayloadOrCallbackId);
|
||||
@@ -495,29 +523,16 @@ public class NativeToJsMessageQueue {
|
||||
int status = pluginResult.getStatus();
|
||||
boolean success = (status == PluginResult.Status.OK.ordinal()) || (status == PluginResult.Status.NO_RESULT.ordinal());
|
||||
sb.append("cordova.callbackFromNative('")
|
||||
.append(jsPayloadOrCallbackId)
|
||||
.append("',")
|
||||
.append(success)
|
||||
.append(",")
|
||||
.append(status)
|
||||
.append(",[");
|
||||
switch (pluginResult.getMessageType()) {
|
||||
case PluginResult.MESSAGE_TYPE_BINARYSTRING:
|
||||
sb.append("atob('")
|
||||
.append(pluginResult.getMessage())
|
||||
.append("')");
|
||||
break;
|
||||
case PluginResult.MESSAGE_TYPE_ARRAYBUFFER:
|
||||
sb.append("cordova.require('cordova/base64').toArrayBuffer('")
|
||||
.append(pluginResult.getMessage())
|
||||
.append("')");
|
||||
break;
|
||||
default:
|
||||
sb.append(pluginResult.getMessage());
|
||||
}
|
||||
.append(jsPayloadOrCallbackId)
|
||||
.append("',")
|
||||
.append(success)
|
||||
.append(",")
|
||||
.append(status)
|
||||
.append(",[");
|
||||
buildJsMessage(sb);
|
||||
sb.append("],")
|
||||
.append(pluginResult.getKeepCallback())
|
||||
.append(");");
|
||||
.append(pluginResult.getKeepCallback())
|
||||
.append(");");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -210,6 +210,11 @@ public class SystemWebViewEngine implements CordovaWebViewEngine {
|
||||
settings.setAppCachePath(databasePath);
|
||||
settings.setAppCacheEnabled(true);
|
||||
|
||||
// Enable scaling
|
||||
// Fix for CB-12015
|
||||
settings.setUseWideViewPort(true);
|
||||
settings.setLoadWithOverviewMode(true);
|
||||
|
||||
// Fix for CB-1405
|
||||
// Google issue 4641
|
||||
String defaultUserAgent = settings.getUserAgentString();
|
||||
|
||||
1
node_modules/abbrev/abbrev.js
generated
vendored
1
node_modules/abbrev/abbrev.js
generated
vendored
@@ -1,4 +1,3 @@
|
||||
|
||||
module.exports = exports = abbrev.abbrev = abbrev
|
||||
|
||||
abbrev.monkeyPatch = monkeyPatch
|
||||
|
||||
31
node_modules/abbrev/package.json
generated
vendored
31
node_modules/abbrev/package.json
generated
vendored
@@ -14,20 +14,19 @@
|
||||
]
|
||||
],
|
||||
"_from": "abbrev@>=1.0.0 <2.0.0",
|
||||
"_id": "abbrev@1.0.9",
|
||||
"_id": "abbrev@1.1.0",
|
||||
"_inCache": true,
|
||||
"_installable": true,
|
||||
"_location": "/abbrev",
|
||||
"_nodeVersion": "4.4.4",
|
||||
"_nodeVersion": "8.0.0-pre",
|
||||
"_npmOperationalInternal": {
|
||||
"host": "packages-16-east.internal.npmjs.com",
|
||||
"tmp": "tmp/abbrev-1.0.9.tgz_1466016055839_0.7825860097073019"
|
||||
"host": "packages-12-west.internal.npmjs.com",
|
||||
"tmp": "tmp/abbrev-1.1.0.tgz_1487054000015_0.9229173036292195"
|
||||
},
|
||||
"_npmUser": {
|
||||
"name": "isaacs",
|
||||
"email": "i@izs.me"
|
||||
},
|
||||
"_npmVersion": "3.9.1",
|
||||
"_npmVersion": "4.3.0",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"raw": "abbrev@1",
|
||||
@@ -39,11 +38,10 @@
|
||||
"type": "range"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/istanbul",
|
||||
"/nopt"
|
||||
],
|
||||
"_resolved": "http://registry.npmjs.org/abbrev/-/abbrev-1.0.9.tgz",
|
||||
"_shasum": "91b4792588a7738c25f35dd6f63752a2f8776135",
|
||||
"_resolved": "http://registry.npmjs.org/abbrev/-/abbrev-1.1.0.tgz",
|
||||
"_shasum": "d0554c2256636e2f56e7c2e5ad183f859428d81f",
|
||||
"_shrinkwrap": null,
|
||||
"_spec": "abbrev@1",
|
||||
"_where": "/Users/steveng/repo/cordova/cordova-android/node_modules/nopt",
|
||||
@@ -57,17 +55,17 @@
|
||||
"dependencies": {},
|
||||
"description": "Like ruby's abbrev module, but in js",
|
||||
"devDependencies": {
|
||||
"tap": "^5.7.2"
|
||||
"tap": "^10.1"
|
||||
},
|
||||
"directories": {},
|
||||
"dist": {
|
||||
"shasum": "91b4792588a7738c25f35dd6f63752a2f8776135",
|
||||
"tarball": "https://registry.npmjs.org/abbrev/-/abbrev-1.0.9.tgz"
|
||||
"shasum": "d0554c2256636e2f56e7c2e5ad183f859428d81f",
|
||||
"tarball": "https://registry.npmjs.org/abbrev/-/abbrev-1.1.0.tgz"
|
||||
},
|
||||
"files": [
|
||||
"abbrev.js"
|
||||
],
|
||||
"gitHead": "c386cd9dbb1d8d7581718c54d4ba944cc9298d6f",
|
||||
"gitHead": "7136d4d95449dc44115d4f78b80ec907724f64e0",
|
||||
"homepage": "https://github.com/isaacs/abbrev-js#readme",
|
||||
"license": "ISC",
|
||||
"main": "abbrev.js",
|
||||
@@ -85,7 +83,10 @@
|
||||
"url": "git+ssh://git@github.com/isaacs/abbrev-js.git"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "tap test.js --cov"
|
||||
"postpublish": "git push origin --all; git push origin --tags",
|
||||
"postversion": "npm publish",
|
||||
"preversion": "npm test",
|
||||
"test": "tap test.js --100"
|
||||
},
|
||||
"version": "1.0.9"
|
||||
"version": "1.1.0"
|
||||
}
|
||||
|
||||
1
node_modules/ansi/package.json
generated
vendored
1
node_modules/ansi/package.json
generated
vendored
@@ -16,7 +16,6 @@
|
||||
"_from": "ansi@>=0.3.1 <0.4.0",
|
||||
"_id": "ansi@0.3.1",
|
||||
"_inCache": true,
|
||||
"_installable": true,
|
||||
"_location": "/ansi",
|
||||
"_nodeVersion": "5.3.0",
|
||||
"_npmUser": {
|
||||
|
||||
1
node_modules/balanced-match/package.json
generated
vendored
1
node_modules/balanced-match/package.json
generated
vendored
@@ -16,7 +16,6 @@
|
||||
"_from": "balanced-match@>=0.4.1 <0.5.0",
|
||||
"_id": "balanced-match@0.4.2",
|
||||
"_inCache": true,
|
||||
"_installable": true,
|
||||
"_location": "/balanced-match",
|
||||
"_nodeVersion": "4.4.7",
|
||||
"_npmOperationalInternal": {
|
||||
|
||||
1
node_modules/base64-js/package.json
generated
vendored
1
node_modules/base64-js/package.json
generated
vendored
@@ -16,7 +16,6 @@
|
||||
"_from": "base64-js@0.0.8",
|
||||
"_id": "base64-js@0.0.8",
|
||||
"_inCache": true,
|
||||
"_installable": true,
|
||||
"_location": "/base64-js",
|
||||
"_nodeVersion": "0.10.35",
|
||||
"_npmUser": {
|
||||
|
||||
17
node_modules/big-integer/.npmignore
generated
vendored
17
node_modules/big-integer/.npmignore
generated
vendored
@@ -1,17 +0,0 @@
|
||||
/.travis.yml
|
||||
/.npmignore
|
||||
/.gitignore
|
||||
/spec
|
||||
/benchmark
|
||||
/big-integer*.tgz
|
||||
/my.conf.js
|
||||
/node_modules
|
||||
/*.csproj*
|
||||
/*.sh
|
||||
/*.suo
|
||||
/bin
|
||||
/coverage
|
||||
/*.bat
|
||||
/obj
|
||||
/Properties
|
||||
/Web.*
|
||||
57
node_modules/big-integer/BigInteger.js
generated
vendored
57
node_modules/big-integer/BigInteger.js
generated
vendored
@@ -118,7 +118,7 @@ var bigInt = (function (undefined) {
|
||||
}
|
||||
|
||||
BigInteger.prototype.add = function (v) {
|
||||
var value, n = parseValue(v);
|
||||
var n = parseValue(v);
|
||||
if (this.sign !== n.sign) {
|
||||
return this.subtract(n.negate());
|
||||
}
|
||||
@@ -177,7 +177,7 @@ var bigInt = (function (undefined) {
|
||||
}
|
||||
|
||||
function subtractAny(a, b, sign) {
|
||||
var value, isSmall;
|
||||
var value;
|
||||
if (compareAbs(a, b) >= 0) {
|
||||
value = subtract(a,b);
|
||||
} else {
|
||||
@@ -326,7 +326,7 @@ var bigInt = (function (undefined) {
|
||||
}
|
||||
|
||||
BigInteger.prototype.multiply = function (v) {
|
||||
var value, n = parseValue(v),
|
||||
var n = parseValue(v),
|
||||
a = this.value, b = n.value,
|
||||
sign = this.sign !== n.sign,
|
||||
abs;
|
||||
@@ -467,6 +467,7 @@ var bigInt = (function (undefined) {
|
||||
guess, xlen, highx, highy, check;
|
||||
while (a_l) {
|
||||
part.unshift(a[--a_l]);
|
||||
trim(part);
|
||||
if (compareAbs(part, b) < 0) {
|
||||
result.push(0);
|
||||
continue;
|
||||
@@ -825,19 +826,24 @@ var bigInt = (function (undefined) {
|
||||
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));
|
||||
q = r.divide(newR);
|
||||
lastT = t;
|
||||
lastR = r;
|
||||
t = newT;
|
||||
r = newR;
|
||||
newT = lastT.subtract(q.multiply(newT));
|
||||
newR = lastR.subtract(q.multiply(newR));
|
||||
}
|
||||
if (!r.equals(1)) throw new Error(this.toString() + " and " + n.toString() + " are not co-prime");
|
||||
if (t.compare(0) === -1) {
|
||||
t = t.add(n);
|
||||
t = t.add(n);
|
||||
}
|
||||
if (this.isNegative()) {
|
||||
return t.negate();
|
||||
}
|
||||
return t;
|
||||
}
|
||||
};
|
||||
|
||||
SmallInteger.prototype.modInv = BigInteger.prototype.modInv;
|
||||
|
||||
BigInteger.prototype.next = function () {
|
||||
@@ -976,7 +982,7 @@ var bigInt = (function (undefined) {
|
||||
b = parseValue(b);
|
||||
return a.greater(b) ? a : b;
|
||||
}
|
||||
function min(a,b) {
|
||||
function min(a, b) {
|
||||
a = parseValue(a);
|
||||
b = parseValue(b);
|
||||
return a.lesser(b) ? a : b;
|
||||
@@ -1031,8 +1037,7 @@ var bigInt = (function (undefined) {
|
||||
return low.add(typeof result === "number" ? new SmallInteger(result) : new BigInteger(result, false));
|
||||
}
|
||||
var parseBase = function (text, base) {
|
||||
var val = Integer[0], pow = Integer[1],
|
||||
length = text.length;
|
||||
var length = text.length;
|
||||
if (2 <= base && base <= 36) {
|
||||
if (length <= LOG_MAX_INT / Math.log(base)) {
|
||||
return new SmallInteger(parseInt(text, base));
|
||||
@@ -1054,13 +1059,17 @@ var bigInt = (function (undefined) {
|
||||
}
|
||||
else throw new Error(c + " is not a valid character");
|
||||
}
|
||||
digits.reverse();
|
||||
for (i = 0; i < digits.length; i++) {
|
||||
return parseBaseFromArray(digits, base, isNegative);
|
||||
};
|
||||
|
||||
function parseBaseFromArray(digits, base, isNegative) {
|
||||
var val = Integer[0], pow = Integer[1], i;
|
||||
for (i = digits.length - 1; i >= 0; i--) {
|
||||
val = val.add(digits[i].times(pow));
|
||||
pow = pow.times(base);
|
||||
}
|
||||
return isNegative ? val.negate() : val;
|
||||
};
|
||||
}
|
||||
|
||||
function stringify(digit) {
|
||||
var v = digit.value;
|
||||
@@ -1204,6 +1213,11 @@ var bigInt = (function (undefined) {
|
||||
Integer.lcm = lcm;
|
||||
Integer.isInstance = function (x) { return x instanceof BigInteger || x instanceof SmallInteger; };
|
||||
Integer.randBetween = randBetween;
|
||||
|
||||
Integer.fromArray = function (digits, base, isNegative) {
|
||||
return parseBaseFromArray(digits.map(parseValue), parseValue(base || 10), isNegative);
|
||||
};
|
||||
|
||||
return Integer;
|
||||
})();
|
||||
|
||||
@@ -1211,3 +1225,10 @@ var bigInt = (function (undefined) {
|
||||
if (typeof module !== "undefined" && module.hasOwnProperty("exports")) {
|
||||
module.exports = bigInt;
|
||||
}
|
||||
|
||||
//amd check
|
||||
if ( typeof define === "function" && define.amd ) {
|
||||
define( "big-integer", [], function() {
|
||||
return bigInt;
|
||||
});
|
||||
}
|
||||
|
||||
2
node_modules/big-integer/BigInteger.min.js
generated
vendored
2
node_modules/big-integer/BigInteger.min.js
generated
vendored
File diff suppressed because one or more lines are too long
24
node_modules/big-integer/LICENSE
generated
vendored
Normal file
24
node_modules/big-integer/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,24 @@
|
||||
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
7
node_modules/big-integer/README.md
generated
vendored
@@ -421,6 +421,13 @@ Performs the bitwise XOR operation. The operands are treated as if they were rep
|
||||
|
||||
### Static Methods
|
||||
|
||||
#### `fromArray(digits, base = 10, isNegative?)`
|
||||
|
||||
Constructs a bigInt from an array of digits in base `base`. The optional `isNegative` flag will make the number negative.
|
||||
|
||||
- `bigInt.fromArray([1, 2, 3, 4, 5], 10)` => `12345`
|
||||
- `bigInt.fromArray([1, 0, 0], 2, true)` => `-4`
|
||||
|
||||
#### `gcd(a, b)`
|
||||
|
||||
Finds the greatest common denominator of `a` and `b`.
|
||||
|
||||
27
node_modules/big-integer/package.json
generated
vendored
27
node_modules/big-integer/package.json
generated
vendored
@@ -14,20 +14,19 @@
|
||||
]
|
||||
],
|
||||
"_from": "big-integer@>=1.6.7 <2.0.0",
|
||||
"_id": "big-integer@1.6.16",
|
||||
"_id": "big-integer@1.6.22",
|
||||
"_inCache": true,
|
||||
"_installable": true,
|
||||
"_location": "/big-integer",
|
||||
"_nodeVersion": "4.4.5",
|
||||
"_nodeVersion": "6.9.4",
|
||||
"_npmOperationalInternal": {
|
||||
"host": "packages-16-east.internal.npmjs.com",
|
||||
"tmp": "tmp/big-integer-1.6.16.tgz_1473665148825_0.5824211346916854"
|
||||
"host": "packages-12-west.internal.npmjs.com",
|
||||
"tmp": "tmp/big-integer-1.6.22.tgz_1493091323169_0.5048394540790468"
|
||||
},
|
||||
"_npmUser": {
|
||||
"name": "peterolson",
|
||||
"email": "peter.e.c.olson+npm@gmail.com"
|
||||
},
|
||||
"_npmVersion": "2.15.5",
|
||||
"_npmVersion": "3.10.10",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"raw": "big-integer@^1.6.7",
|
||||
@@ -41,8 +40,8 @@
|
||||
"_requiredBy": [
|
||||
"/bplist-parser"
|
||||
],
|
||||
"_resolved": "http://registry.npmjs.org/big-integer/-/big-integer-1.6.16.tgz",
|
||||
"_shasum": "0ca30b58013db46b10084a09242ca1d8954724cc",
|
||||
"_resolved": "https://registry.npmjs.org/big-integer/-/big-integer-1.6.22.tgz",
|
||||
"_shasum": "487c95fce886022ea48ff5f19e388932df46dd2e",
|
||||
"_shrinkwrap": null,
|
||||
"_spec": "big-integer@^1.6.7",
|
||||
"_where": "/Users/steveng/repo/cordova/cordova-android/node_modules/bplist-parser",
|
||||
@@ -64,17 +63,18 @@
|
||||
"karma": "^0.13.3",
|
||||
"karma-coverage": "^0.4.2",
|
||||
"karma-jasmine": "^0.3.6",
|
||||
"karma-phantomjs-launcher": "~0.1"
|
||||
"karma-phantomjs-launcher": "~0.1",
|
||||
"uglifyjs": "^2.4.10"
|
||||
},
|
||||
"directories": {},
|
||||
"dist": {
|
||||
"shasum": "0ca30b58013db46b10084a09242ca1d8954724cc",
|
||||
"tarball": "https://registry.npmjs.org/big-integer/-/big-integer-1.6.16.tgz"
|
||||
"shasum": "487c95fce886022ea48ff5f19e388932df46dd2e",
|
||||
"tarball": "https://registry.npmjs.org/big-integer/-/big-integer-1.6.22.tgz"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=0.6"
|
||||
},
|
||||
"gitHead": "09b50ab4e701a2ec4d403fa3ecf12ae327227190",
|
||||
"gitHead": "40483b881b4380931e5af6f2f8a161b6caa71690",
|
||||
"homepage": "https://github.com/peterolson/BigInteger.js#readme",
|
||||
"keywords": [
|
||||
"math",
|
||||
@@ -103,7 +103,8 @@
|
||||
"url": "git+ssh://git@github.com/peterolson/BigInteger.js.git"
|
||||
},
|
||||
"scripts": {
|
||||
"minify": "uglifyjs BigInteger.js -o BigInteger.min.js",
|
||||
"test": "karma start my.conf.js"
|
||||
},
|
||||
"version": "1.6.16"
|
||||
"version": "1.6.22"
|
||||
}
|
||||
|
||||
1
node_modules/bplist-parser/package.json
generated
vendored
1
node_modules/bplist-parser/package.json
generated
vendored
@@ -16,7 +16,6 @@
|
||||
"_from": "bplist-parser@>=0.1.0 <0.2.0",
|
||||
"_id": "bplist-parser@0.1.1",
|
||||
"_inCache": true,
|
||||
"_installable": true,
|
||||
"_location": "/bplist-parser",
|
||||
"_nodeVersion": "5.1.0",
|
||||
"_npmUser": {
|
||||
|
||||
1
node_modules/brace-expansion/README.md
generated
vendored
1
node_modules/brace-expansion/README.md
generated
vendored
@@ -5,6 +5,7 @@ as known from sh/bash, in JavaScript.
|
||||
|
||||
[](http://travis-ci.org/juliangruber/brace-expansion)
|
||||
[](https://www.npmjs.org/package/brace-expansion)
|
||||
[](https://greenkeeper.io/)
|
||||
|
||||
[](https://ci.testling.com/juliangruber/brace-expansion)
|
||||
|
||||
|
||||
2
node_modules/brace-expansion/index.js
generated
vendored
2
node_modules/brace-expansion/index.js
generated
vendored
@@ -106,7 +106,7 @@ function expand(str, isTop) {
|
||||
var isNumericSequence = /^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(m.body);
|
||||
var isAlphaSequence = /^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(m.body);
|
||||
var isSequence = isNumericSequence || isAlphaSequence;
|
||||
var isOptions = /^(.*,)+(.+)?$/.test(m.body);
|
||||
var isOptions = m.body.indexOf(',') >= 0;
|
||||
if (!isSequence && !isOptions) {
|
||||
// {a},b}
|
||||
if (m.post.match(/,.*\}/)) {
|
||||
|
||||
25
node_modules/brace-expansion/package.json
generated
vendored
25
node_modules/brace-expansion/package.json
generated
vendored
@@ -14,20 +14,19 @@
|
||||
]
|
||||
],
|
||||
"_from": "brace-expansion@>=1.0.0 <2.0.0",
|
||||
"_id": "brace-expansion@1.1.6",
|
||||
"_id": "brace-expansion@1.1.7",
|
||||
"_inCache": true,
|
||||
"_installable": true,
|
||||
"_location": "/brace-expansion",
|
||||
"_nodeVersion": "4.4.7",
|
||||
"_nodeVersion": "7.8.0",
|
||||
"_npmOperationalInternal": {
|
||||
"host": "packages-16-east.internal.npmjs.com",
|
||||
"tmp": "tmp/brace-expansion-1.1.6.tgz_1469047715600_0.9362958471756428"
|
||||
"host": "packages-12-west.internal.npmjs.com",
|
||||
"tmp": "tmp/brace-expansion-1.1.7.tgz_1491552830231_0.7213963181711733"
|
||||
},
|
||||
"_npmUser": {
|
||||
"name": "juliangruber",
|
||||
"email": "julian@juliangruber.com"
|
||||
},
|
||||
"_npmVersion": "2.15.8",
|
||||
"_npmVersion": "4.2.0",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"raw": "brace-expansion@^1.0.0",
|
||||
@@ -41,8 +40,8 @@
|
||||
"_requiredBy": [
|
||||
"/minimatch"
|
||||
],
|
||||
"_resolved": "http://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.6.tgz",
|
||||
"_shasum": "7197d7eaa9b87e648390ea61fc66c84427420df9",
|
||||
"_resolved": "http://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.7.tgz",
|
||||
"_shasum": "3effc3c50e000531fb720eaff80f0ae8ef23cf59",
|
||||
"_shrinkwrap": null,
|
||||
"_spec": "brace-expansion@^1.0.0",
|
||||
"_where": "/Users/steveng/repo/cordova/cordova-android/node_modules/minimatch",
|
||||
@@ -60,14 +59,15 @@
|
||||
},
|
||||
"description": "Brace expansion as known from sh/bash",
|
||||
"devDependencies": {
|
||||
"matcha": "^0.7.0",
|
||||
"tape": "^4.6.0"
|
||||
},
|
||||
"directories": {},
|
||||
"dist": {
|
||||
"shasum": "7197d7eaa9b87e648390ea61fc66c84427420df9",
|
||||
"tarball": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.6.tgz"
|
||||
"shasum": "3effc3c50e000531fb720eaff80f0ae8ef23cf59",
|
||||
"tarball": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.7.tgz"
|
||||
},
|
||||
"gitHead": "791262fa06625e9c5594cde529a21d82086af5f2",
|
||||
"gitHead": "892512024872ca7680554be90f6e8ce065053372",
|
||||
"homepage": "https://github.com/juliangruber/brace-expansion",
|
||||
"keywords": [],
|
||||
"license": "MIT",
|
||||
@@ -90,6 +90,7 @@
|
||||
"url": "git://github.com/juliangruber/brace-expansion.git"
|
||||
},
|
||||
"scripts": {
|
||||
"bench": "matcha test/perf/bench.js",
|
||||
"gentest": "bash test/generate.sh",
|
||||
"test": "tape test/*.js"
|
||||
},
|
||||
@@ -109,5 +110,5 @@
|
||||
"android-browser/4.2..latest"
|
||||
]
|
||||
},
|
||||
"version": "1.1.6"
|
||||
"version": "1.1.7"
|
||||
}
|
||||
|
||||
1
node_modules/concat-map/package.json
generated
vendored
1
node_modules/concat-map/package.json
generated
vendored
@@ -16,7 +16,6 @@
|
||||
"_from": "concat-map@0.0.1",
|
||||
"_id": "concat-map@0.0.1",
|
||||
"_inCache": true,
|
||||
"_installable": true,
|
||||
"_location": "/concat-map",
|
||||
"_npmUser": {
|
||||
"name": "substack",
|
||||
|
||||
1
node_modules/cordova-common/.ratignore
generated
vendored
1
node_modules/cordova-common/.ratignore
generated
vendored
@@ -1,2 +1,3 @@
|
||||
fixtures
|
||||
coverage
|
||||
jasmine.json
|
||||
|
||||
17
node_modules/cordova-common/RELEASENOTES.md
generated
vendored
17
node_modules/cordova-common/RELEASENOTES.md
generated
vendored
@@ -20,6 +20,23 @@
|
||||
-->
|
||||
# Cordova-common Release Notes
|
||||
|
||||
### 2.0.2 (Apr 14, 2017)
|
||||
* [CB-11233](https://issues.apache.org/jira/browse/CB-11233) - Support installing frameworks into 'Embedded Binaries' section of the Xcode project
|
||||
* [CB-10438](https://issues.apache.org/jira/browse/CB-10438) - Install correct dependency version. Removed shell.remove, added pkg.json to dependency tests 1-3, and updated install.js (.replace) to fix tests in uninstall.spec.js and update to workw with jasmine 2.0
|
||||
* [CB-11120](https://issues.apache.org/jira/browse/CB-11120) - Allow short/display name in config.xml
|
||||
* [CB-11346](https://issues.apache.org/jira/browse/CB-11346) - Remove known platforms check
|
||||
* [CB-11977](https://issues.apache.org/jira/browse/CB-11977) - updated engines and enginescript for common, fetch, and serve
|
||||
|
||||
### 2.0.1 (Mar 09, 2017)
|
||||
* [CB-12557](https://issues.apache.org/jira/browse/CB-12557) add both stdout and stderr properties to the error object passed to superspawn reject handler.
|
||||
|
||||
### 2.0.0 (Jan 17, 2017)
|
||||
* [CB-8978](https://issues.apache.org/jira/browse/CB-8978) Add `resource-file` parsing to `config.xml`
|
||||
* [CB-12018](https://issues.apache.org/jira/browse/CB-12018): updated `jshint` and updated tests to work with `jasmine@2` instead of `jasmine-node`
|
||||
* [CB-12163](https://issues.apache.org/jira/browse/CB-12163) Add reference attrib to `resource-file` for **Windows**
|
||||
* Move windows-specific logic to `cordova-windows`
|
||||
* [CB-12189](https://issues.apache.org/jira/browse/CB-12189) Add implementation attribute to framework
|
||||
|
||||
### 1.5.1 (Oct 12, 2016)
|
||||
* [CB-12002](https://issues.apache.org/jira/browse/CB-12002) Add `getAllowIntents()` to `ConfigParser`
|
||||
* [CB-11998](https://issues.apache.org/jira/browse/CB-11998) `cordova platform add` error with `cordova-common@1.5.0`
|
||||
|
||||
55
node_modules/cordova-common/package.json
generated
vendored
55
node_modules/cordova-common/package.json
generated
vendored
@@ -2,49 +2,48 @@
|
||||
"_args": [
|
||||
[
|
||||
{
|
||||
"raw": "cordova-common@^1.5.0",
|
||||
"raw": "cordova-common@^2.0.1",
|
||||
"scope": null,
|
||||
"escapedName": "cordova-common",
|
||||
"name": "cordova-common",
|
||||
"rawSpec": "^1.5.0",
|
||||
"spec": ">=1.5.0 <2.0.0",
|
||||
"rawSpec": "^2.0.1",
|
||||
"spec": ">=2.0.1 <3.0.0",
|
||||
"type": "range"
|
||||
},
|
||||
"/Users/steveng/repo/cordova/cordova-android"
|
||||
]
|
||||
],
|
||||
"_from": "cordova-common@>=1.5.0 <2.0.0",
|
||||
"_id": "cordova-common@1.5.1",
|
||||
"_from": "cordova-common@>=2.0.1 <3.0.0",
|
||||
"_id": "cordova-common@2.0.2",
|
||||
"_inCache": true,
|
||||
"_installable": true,
|
||||
"_location": "/cordova-common",
|
||||
"_nodeVersion": "6.6.0",
|
||||
"_nodeVersion": "4.7.3",
|
||||
"_npmOperationalInternal": {
|
||||
"host": "packages-12-west.internal.npmjs.com",
|
||||
"tmp": "tmp/cordova-common-1.5.1.tgz_1476725179180_0.39604957425035536"
|
||||
"tmp": "tmp/cordova-common-2.0.2.tgz_1492453798445_0.6290795875247568"
|
||||
},
|
||||
"_npmUser": {
|
||||
"name": "stevegill",
|
||||
"email": "stevengill97@gmail.com"
|
||||
"name": "shazron",
|
||||
"email": "shazron@gmail.com"
|
||||
},
|
||||
"_npmVersion": "3.10.3",
|
||||
"_npmVersion": "2.15.11",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"raw": "cordova-common@^1.5.0",
|
||||
"raw": "cordova-common@^2.0.1",
|
||||
"scope": null,
|
||||
"escapedName": "cordova-common",
|
||||
"name": "cordova-common",
|
||||
"rawSpec": "^1.5.0",
|
||||
"spec": ">=1.5.0 <2.0.0",
|
||||
"rawSpec": "^2.0.1",
|
||||
"spec": ">=2.0.1 <3.0.0",
|
||||
"type": "range"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/"
|
||||
],
|
||||
"_resolved": "file:cordova-dist/tools/cordova-common-1.5.1.tgz",
|
||||
"_shasum": "6770de0d6200ad6f94a1abe8939b5bd9ece139e3",
|
||||
"_resolved": "http://registry.npmjs.org/cordova-common/-/cordova-common-2.0.2.tgz",
|
||||
"_shasum": "57467976b8afd5e0bd0a13111b66a420441601cb",
|
||||
"_shrinkwrap": null,
|
||||
"_spec": "cordova-common@^1.5.0",
|
||||
"_spec": "cordova-common@^2.0.1",
|
||||
"_where": "/Users/steveng/repo/cordova/cordova-android",
|
||||
"author": {
|
||||
"name": "Apache Software Foundation"
|
||||
@@ -71,20 +70,20 @@
|
||||
},
|
||||
"description": "Apache Cordova tools and platforms shared routines",
|
||||
"devDependencies": {
|
||||
"istanbul": "^0.3.17",
|
||||
"jasmine-node": "^1.14.5",
|
||||
"istanbul": "^0.4.5",
|
||||
"jasmine": "^2.5.2",
|
||||
"jshint": "^2.8.0",
|
||||
"promise-matchers": "^0.9.6",
|
||||
"rewire": "^2.5.1"
|
||||
},
|
||||
"directories": {},
|
||||
"dist": {
|
||||
"shasum": "6770de0d6200ad6f94a1abe8939b5bd9ece139e3",
|
||||
"tarball": "https://registry.npmjs.org/cordova-common/-/cordova-common-1.5.1.tgz"
|
||||
"shasum": "57467976b8afd5e0bd0a13111b66a420441601cb",
|
||||
"tarball": "https://registry.npmjs.org/cordova-common/-/cordova-common-2.0.2.tgz"
|
||||
},
|
||||
"engineStrict": true,
|
||||
"engines": {
|
||||
"node": ">=0.9.9"
|
||||
"node": ">=4.0.0"
|
||||
},
|
||||
"license": "Apache-2.0",
|
||||
"main": "cordova-common.js",
|
||||
@@ -93,6 +92,10 @@
|
||||
"name": "bowserj",
|
||||
"email": "bowserj@apache.org"
|
||||
},
|
||||
{
|
||||
"name": "filmaj",
|
||||
"email": "maj.fil@gmail.com"
|
||||
},
|
||||
{
|
||||
"name": "kotikov.vladimir",
|
||||
"email": "kotikov.vladimir@gmail.com"
|
||||
@@ -122,10 +125,10 @@
|
||||
"url": "git://git-wip-us.apache.org/repos/asf/cordova-common.git"
|
||||
},
|
||||
"scripts": {
|
||||
"cover": "node node_modules/istanbul/lib/cli.js cover --root src --print detail node_modules/jasmine-node/bin/jasmine-node -- spec",
|
||||
"jasmine": "node node_modules/jasmine-node/bin/jasmine-node --captureExceptions --color spec",
|
||||
"jshint": "node node_modules/jshint/bin/jshint src && node node_modules/jshint/bin/jshint spec",
|
||||
"cover": "istanbul cover --root src --print detail jasmine",
|
||||
"jasmine": "jasmine --captureExceptions --color",
|
||||
"jshint": "jshint src && jshint spec",
|
||||
"test": "npm run jshint && npm run jasmine"
|
||||
},
|
||||
"version": "1.5.1"
|
||||
"version": "2.0.2"
|
||||
}
|
||||
|
||||
151
node_modules/cordova-common/src/ConfigChanges/ConfigChanges.js
generated
vendored
151
node_modules/cordova-common/src/ConfigChanges/ConfigChanges.js
generated
vendored
@@ -1,21 +1,21 @@
|
||||
/*
|
||||
*
|
||||
* Copyright 2013 Anis Kadri
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*
|
||||
*/
|
||||
/**
|
||||
Licensed to the Apache Software Foundation (ASF) under one
|
||||
or more contributor license agreements. See the NOTICE file
|
||||
distributed with this work for additional information
|
||||
regarding copyright ownership. The ASF licenses this file
|
||||
to you under the Apache License, Version 2.0 (the
|
||||
"License"); you may not use this file except in compliance
|
||||
with the License. You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing,
|
||||
software distributed under the License is distributed on an
|
||||
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
KIND, either express or implied. See the License for the
|
||||
specific language governing permissions and limitations
|
||||
under the License.
|
||||
*/
|
||||
|
||||
/*
|
||||
* This module deals with shared configuration / dependency "stuff". That is:
|
||||
@@ -31,11 +31,8 @@
|
||||
|
||||
/* jshint sub:true */
|
||||
|
||||
var fs = require('fs'),
|
||||
path = require('path'),
|
||||
var path = require('path'),
|
||||
et = require('elementtree'),
|
||||
semver = require('semver'),
|
||||
events = require('../events'),
|
||||
ConfigKeeper = require('./ConfigKeeper'),
|
||||
CordovaLogger = require('../CordovaLogger');
|
||||
|
||||
@@ -109,18 +106,6 @@ function remove_plugin_changes(pluginInfo, is_top_level) {
|
||||
var munge = mungeutil.decrement_munge(global_munge, config_munge);
|
||||
|
||||
for (var file in munge.files) {
|
||||
// CB-6976 Windows Universal Apps. Compatibility fix for existing plugins.
|
||||
if (self.platform == 'windows' && file == 'package.appxmanifest' &&
|
||||
!fs.existsSync(path.join(self.project_dir, 'package.appxmanifest'))) {
|
||||
// New windows template separate manifest files for Windows10, Windows8.1 and WP8.1
|
||||
var substs = ['package.phone.appxmanifest', 'package.windows.appxmanifest', 'package.windows10.appxmanifest'];
|
||||
/* jshint loopfunc:true */
|
||||
substs.forEach(function(subst) {
|
||||
events.emit('verbose', 'Applying munge to ' + subst);
|
||||
self.apply_file_munge(subst, munge.files[file], true);
|
||||
});
|
||||
/* jshint loopfunc:false */
|
||||
}
|
||||
self.apply_file_munge(file, munge.files[file], /* remove = */ true);
|
||||
}
|
||||
|
||||
@@ -250,18 +235,6 @@ function munge_helper(should_increment, self, platform_config, config_munge) {
|
||||
}
|
||||
|
||||
for (var file in munge.files) {
|
||||
// CB-6976 Windows Universal Apps. Compatibility fix for existing plugins.
|
||||
if (self.platform == 'windows' && file == 'package.appxmanifest' &&
|
||||
!fs.existsSync(path.join(self.project_dir, 'package.appxmanifest'))) {
|
||||
var substs = ['package.phone.appxmanifest', 'package.windows.appxmanifest', 'package.windows10.appxmanifest'];
|
||||
/* jshint loopfunc:true */
|
||||
substs.forEach(function(subst) {
|
||||
events.emit('verbose', 'Applying munge to ' + subst);
|
||||
self.apply_file_munge(subst, munge.files[file]);
|
||||
});
|
||||
/* jshint loopfunc:false */
|
||||
}
|
||||
|
||||
self.apply_file_munge(file, munge.files[file]);
|
||||
}
|
||||
|
||||
@@ -333,92 +306,6 @@ function generate_plugin_config_munge(pluginInfo, vars, edit_config_changes) {
|
||||
Array.prototype.push.apply(changes, edit_config_changes);
|
||||
}
|
||||
|
||||
// Demux 'package.appxmanifest' into relevant platform-specific appx manifests.
|
||||
// Only spend the cycles if there are version-specific plugin settings
|
||||
if (self.platform === 'windows' &&
|
||||
changes.some(function(change) {
|
||||
return ((typeof change.versions !== 'undefined') ||
|
||||
(typeof change.deviceTarget !== 'undefined'));
|
||||
}))
|
||||
{
|
||||
var manifests = {
|
||||
'windows': {
|
||||
'8.1.0': 'package.windows.appxmanifest',
|
||||
'10.0.0': 'package.windows10.appxmanifest'
|
||||
},
|
||||
'phone': {
|
||||
'8.1.0': 'package.phone.appxmanifest',
|
||||
'10.0.0': 'package.windows10.appxmanifest'
|
||||
},
|
||||
'all': {
|
||||
'8.1.0': ['package.windows.appxmanifest', 'package.phone.appxmanifest'],
|
||||
'10.0.0': 'package.windows10.appxmanifest'
|
||||
}
|
||||
};
|
||||
|
||||
var oldChanges = changes;
|
||||
changes = [];
|
||||
|
||||
oldChanges.forEach(function(change, changeIndex) {
|
||||
// Only support semver/device-target demux for package.appxmanifest
|
||||
// Pass through in case something downstream wants to use it
|
||||
if (change.target !== 'package.appxmanifest') {
|
||||
changes.push(change);
|
||||
return;
|
||||
}
|
||||
|
||||
var hasVersion = (typeof change.versions !== 'undefined');
|
||||
var hasTargets = (typeof change.deviceTarget !== 'undefined');
|
||||
|
||||
// No semver/device-target for this config-file, pass it through
|
||||
if (!(hasVersion || hasTargets)) {
|
||||
changes.push(change);
|
||||
return;
|
||||
}
|
||||
|
||||
var targetDeviceSet = hasTargets ? change.deviceTarget : 'all';
|
||||
if (['windows', 'phone', 'all'].indexOf(targetDeviceSet) === -1) {
|
||||
// target-device couldn't be resolved, fix it up here to a valid value
|
||||
targetDeviceSet = 'all';
|
||||
}
|
||||
var knownWindowsVersionsForTargetDeviceSet = Object.keys(manifests[targetDeviceSet]);
|
||||
|
||||
// at this point, 'change' targets package.appxmanifest and has a version attribute
|
||||
knownWindowsVersionsForTargetDeviceSet.forEach(function(winver) {
|
||||
// This is a local function that creates the new replacement representing the
|
||||
// mutation. Used to save code further down.
|
||||
var createReplacement = function(manifestFile, originalChange) {
|
||||
var replacement = {
|
||||
target: manifestFile,
|
||||
parent: originalChange.parent,
|
||||
after: originalChange.after,
|
||||
xmls: originalChange.xmls,
|
||||
versions: originalChange.versions,
|
||||
deviceTarget: originalChange.deviceTarget
|
||||
};
|
||||
return replacement;
|
||||
};
|
||||
|
||||
// version doesn't satisfy, so skip
|
||||
if (hasVersion && !semver.satisfies(winver, change.versions)) {
|
||||
return;
|
||||
}
|
||||
|
||||
var versionSpecificManifests = manifests[targetDeviceSet][winver];
|
||||
if (versionSpecificManifests.constructor === Array) {
|
||||
// e.g. all['8.1.0'] === ['pkg.windows.appxmanifest', 'pkg.phone.appxmanifest']
|
||||
versionSpecificManifests.forEach(function(manifestFile) {
|
||||
changes.push(createReplacement(manifestFile, change));
|
||||
});
|
||||
}
|
||||
else {
|
||||
// versionSpecificManifests is actually a single string
|
||||
changes.push(createReplacement(versionSpecificManifests, change));
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
changes.forEach(function(change) {
|
||||
change.xmls.forEach(function(xml) {
|
||||
// 1. stringify each xml
|
||||
|
||||
34
node_modules/cordova-common/src/ConfigParser/ConfigParser.js
generated
vendored
34
node_modules/cordova-common/src/ConfigParser/ConfigParser.js
generated
vendored
@@ -116,6 +116,16 @@ ConfigParser.prototype = {
|
||||
var el = findOrCreate(this.doc, 'name');
|
||||
el.text = name;
|
||||
},
|
||||
shortName: function() {
|
||||
return this.doc.find('name').attrib['short'] || this.name();
|
||||
},
|
||||
setShortName: function(shortname) {
|
||||
var el = findOrCreate(this.doc, 'name');
|
||||
if (!el.text) {
|
||||
el.text = shortname;
|
||||
}
|
||||
el.attrib['short'] = shortname;
|
||||
},
|
||||
description: function() {
|
||||
return getNodeTextSafe(this.doc.find('description'));
|
||||
},
|
||||
@@ -256,6 +266,30 @@ ConfigParser.prototype = {
|
||||
return this.getStaticResources(platform, 'splash');
|
||||
},
|
||||
|
||||
/**
|
||||
* Returns all resource-files for a specific platform.
|
||||
* @param {string} platform Platform name
|
||||
* @return {Resource[]} Array of resource file objects.
|
||||
*/
|
||||
getFileResources: function(platform) {
|
||||
var fileResources = [];
|
||||
|
||||
if (platform) { // platform specific resources
|
||||
fileResources = this.doc.findall('platform[@name=\'' + platform + '\']/resource-file').map(function(tag) {
|
||||
return {
|
||||
platform: platform,
|
||||
src: tag.attrib.src,
|
||||
target: tag.attrib.target,
|
||||
versions: tag.attrib.versions,
|
||||
deviceTarget: tag.attrib['device-target'],
|
||||
arch: tag.attrib.arch
|
||||
};
|
||||
});
|
||||
}
|
||||
|
||||
return fileResources;
|
||||
},
|
||||
|
||||
/**
|
||||
* Returns all hook scripts for the hook type specified.
|
||||
* @param {String} hook The hook type.
|
||||
|
||||
8
node_modules/cordova-common/src/PluginInfo/PluginInfo.js
generated
vendored
8
node_modules/cordova-common/src/PluginInfo/PluginInfo.js
generated
vendored
@@ -108,6 +108,7 @@ function PluginInfo(dirname) {
|
||||
function _parseDependency(tag) {
|
||||
var dep =
|
||||
{ id : tag.attrib.id
|
||||
, version: tag.attrib.version || ''
|
||||
, url : tag.attrib.url || ''
|
||||
, subdir : tag.attrib.subdir || ''
|
||||
, commit : tag.attrib.commit
|
||||
@@ -225,7 +226,8 @@ function PluginInfo(dirname) {
|
||||
target: tag.attrib.target,
|
||||
versions: tag.attrib.versions,
|
||||
deviceTarget: tag.attrib['device-target'],
|
||||
arch: tag.attrib.arch
|
||||
arch: tag.attrib.arch,
|
||||
reference: tag.attrib.reference
|
||||
};
|
||||
});
|
||||
return resourceFiles;
|
||||
@@ -317,13 +319,15 @@ function PluginInfo(dirname) {
|
||||
type: el.attrib.type,
|
||||
parent: el.attrib.parent,
|
||||
custom: isStrTrue(el.attrib.custom),
|
||||
embed: isStrTrue(el.attrib.embed),
|
||||
src: el.attrib.src,
|
||||
spec: el.attrib.spec,
|
||||
weak: isStrTrue(el.attrib.weak),
|
||||
versions: el.attrib.versions,
|
||||
targetDir: el.attrib['target-dir'],
|
||||
deviceTarget: el.attrib['device-target'] || el.attrib.target,
|
||||
arch: el.attrib.arch
|
||||
arch: el.attrib.arch,
|
||||
implementation: el.attrib.implementation
|
||||
};
|
||||
return ret;
|
||||
});
|
||||
|
||||
1
node_modules/cordova-common/src/events.js
generated
vendored
1
node_modules/cordova-common/src/events.js
generated
vendored
@@ -20,6 +20,7 @@
|
||||
var EventEmitter = require('events').EventEmitter;
|
||||
|
||||
var INSTANCE = new EventEmitter();
|
||||
INSTANCE.setMaxListeners(20);
|
||||
var EVENTS_RECEIVER;
|
||||
|
||||
module.exports = INSTANCE;
|
||||
|
||||
6
node_modules/cordova-common/src/superspawn.js
generated
vendored
6
node_modules/cordova-common/src/superspawn.js
generated
vendored
@@ -167,6 +167,12 @@ exports.spawn = function(cmd, args, opts) {
|
||||
errMsg += ' Error output:\n' + capturedErr.trim();
|
||||
}
|
||||
var err = new Error(errMsg);
|
||||
if (capturedErr) {
|
||||
err.stderr = capturedErr;
|
||||
}
|
||||
if (capturedOut) {
|
||||
err.stdout = capturedOut;
|
||||
}
|
||||
err.code = code;
|
||||
d.reject(err);
|
||||
}
|
||||
|
||||
36
node_modules/cordova-common/src/util/plist-helpers.js
generated
vendored
36
node_modules/cordova-common/src/util/plist-helpers.js
generated
vendored
@@ -1,21 +1,21 @@
|
||||
/*
|
||||
*
|
||||
* Copyright 2013 Brett Rudd
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*
|
||||
*/
|
||||
/**
|
||||
Licensed to the Apache Software Foundation (ASF) under one
|
||||
or more contributor license agreements. See the NOTICE file
|
||||
distributed with this work for additional information
|
||||
regarding copyright ownership. The ASF licenses this file
|
||||
to you under the Apache License, Version 2.0 (the
|
||||
"License"); you may not use this file except in compliance
|
||||
with the License. You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing,
|
||||
software distributed under the License is distributed on an
|
||||
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
KIND, either express or implied. See the License for the
|
||||
specific language governing permissions and limitations
|
||||
under the License.
|
||||
*/
|
||||
|
||||
// contains PLIST utility functions
|
||||
var __ = require('underscore');
|
||||
|
||||
36
node_modules/cordova-common/src/util/xml-helpers.js
generated
vendored
36
node_modules/cordova-common/src/util/xml-helpers.js
generated
vendored
@@ -1,21 +1,21 @@
|
||||
/*
|
||||
*
|
||||
* Copyright 2013 Anis Kadri
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*
|
||||
*/
|
||||
/**
|
||||
Licensed to the Apache Software Foundation (ASF) under one
|
||||
or more contributor license agreements. See the NOTICE file
|
||||
distributed with this work for additional information
|
||||
regarding copyright ownership. The ASF licenses this file
|
||||
to you under the Apache License, Version 2.0 (the
|
||||
"License"); you may not use this file except in compliance
|
||||
with the License. You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing,
|
||||
software distributed under the License is distributed on an
|
||||
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
KIND, either express or implied. See the License for the
|
||||
specific language governing permissions and limitations
|
||||
under the License.
|
||||
*/
|
||||
|
||||
/* jshint sub:true, laxcomma:true */
|
||||
|
||||
|
||||
1
node_modules/cordova-registry-mapper/package.json
generated
vendored
1
node_modules/cordova-registry-mapper/package.json
generated
vendored
@@ -16,7 +16,6 @@
|
||||
"_from": "cordova-registry-mapper@>=1.1.8 <2.0.0",
|
||||
"_id": "cordova-registry-mapper@1.1.15",
|
||||
"_inCache": true,
|
||||
"_installable": true,
|
||||
"_location": "/cordova-registry-mapper",
|
||||
"_nodeVersion": "5.4.1",
|
||||
"_npmUser": {
|
||||
|
||||
21
node_modules/elementtree/package.json
generated
vendored
21
node_modules/elementtree/package.json
generated
vendored
@@ -2,21 +2,20 @@
|
||||
"_args": [
|
||||
[
|
||||
{
|
||||
"raw": "elementtree@^0.1.6",
|
||||
"raw": "elementtree@0.1.6",
|
||||
"scope": null,
|
||||
"escapedName": "elementtree",
|
||||
"name": "elementtree",
|
||||
"rawSpec": "^0.1.6",
|
||||
"spec": ">=0.1.6 <0.2.0",
|
||||
"type": "range"
|
||||
"rawSpec": "0.1.6",
|
||||
"spec": "0.1.6",
|
||||
"type": "version"
|
||||
},
|
||||
"/Users/steveng/repo/cordova/cordova-android"
|
||||
]
|
||||
],
|
||||
"_from": "elementtree@>=0.1.6 <0.2.0",
|
||||
"_from": "elementtree@0.1.6",
|
||||
"_id": "elementtree@0.1.6",
|
||||
"_inCache": true,
|
||||
"_installable": true,
|
||||
"_location": "/elementtree",
|
||||
"_npmUser": {
|
||||
"name": "rphillips",
|
||||
@@ -25,13 +24,13 @@
|
||||
"_npmVersion": "1.3.24",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"raw": "elementtree@^0.1.6",
|
||||
"raw": "elementtree@0.1.6",
|
||||
"scope": null,
|
||||
"escapedName": "elementtree",
|
||||
"name": "elementtree",
|
||||
"rawSpec": "^0.1.6",
|
||||
"spec": ">=0.1.6 <0.2.0",
|
||||
"type": "range"
|
||||
"rawSpec": "0.1.6",
|
||||
"spec": "0.1.6",
|
||||
"type": "version"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/",
|
||||
@@ -40,7 +39,7 @@
|
||||
"_resolved": "http://registry.npmjs.org/elementtree/-/elementtree-0.1.6.tgz",
|
||||
"_shasum": "2ac4c46ea30516c8c4cbdb5e3ac7418e592de20c",
|
||||
"_shrinkwrap": null,
|
||||
"_spec": "elementtree@^0.1.6",
|
||||
"_spec": "elementtree@0.1.6",
|
||||
"_where": "/Users/steveng/repo/cordova/cordova-android",
|
||||
"author": {
|
||||
"name": "Rackspace US, Inc."
|
||||
|
||||
4
node_modules/glob/package.json
generated
vendored
4
node_modules/glob/package.json
generated
vendored
@@ -16,7 +16,6 @@
|
||||
"_from": "glob@>=5.0.13 <6.0.0",
|
||||
"_id": "glob@5.0.15",
|
||||
"_inCache": true,
|
||||
"_installable": true,
|
||||
"_location": "/glob",
|
||||
"_nodeVersion": "4.0.0",
|
||||
"_npmUser": {
|
||||
@@ -35,8 +34,7 @@
|
||||
"type": "range"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/cordova-common",
|
||||
"/istanbul"
|
||||
"/cordova-common"
|
||||
],
|
||||
"_resolved": "http://registry.npmjs.org/glob/-/glob-5.0.15.tgz",
|
||||
"_shasum": "1bc936b9e02f4a603fcc222ecf7633d30b8b93b1",
|
||||
|
||||
2
node_modules/inflight/package.json
generated
vendored
2
node_modules/inflight/package.json
generated
vendored
@@ -16,7 +16,6 @@
|
||||
"_from": "inflight@>=1.0.4 <2.0.0",
|
||||
"_id": "inflight@1.0.6",
|
||||
"_inCache": true,
|
||||
"_installable": true,
|
||||
"_location": "/inflight",
|
||||
"_nodeVersion": "6.5.0",
|
||||
"_npmOperationalInternal": {
|
||||
@@ -39,7 +38,6 @@
|
||||
"type": "range"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/cli/glob",
|
||||
"/glob"
|
||||
],
|
||||
"_resolved": "http://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz",
|
||||
|
||||
6
node_modules/inherits/package.json
generated
vendored
6
node_modules/inherits/package.json
generated
vendored
@@ -16,7 +16,6 @@
|
||||
"_from": "inherits@>=2.0.0 <3.0.0",
|
||||
"_id": "inherits@2.0.3",
|
||||
"_inCache": true,
|
||||
"_installable": true,
|
||||
"_location": "/inherits",
|
||||
"_nodeVersion": "6.5.0",
|
||||
"_npmOperationalInternal": {
|
||||
@@ -39,10 +38,7 @@
|
||||
"type": "range"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/cli/glob",
|
||||
"/fileset/glob",
|
||||
"/glob",
|
||||
"/readable-stream"
|
||||
"/glob"
|
||||
],
|
||||
"_resolved": "http://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz",
|
||||
"_shasum": "633c2c83e3da42a502f52466022480f4208261de",
|
||||
|
||||
1
node_modules/lodash/package.json
generated
vendored
1
node_modules/lodash/package.json
generated
vendored
@@ -16,7 +16,6 @@
|
||||
"_from": "lodash@>=3.5.0 <4.0.0",
|
||||
"_id": "lodash@3.10.1",
|
||||
"_inCache": true,
|
||||
"_installable": true,
|
||||
"_location": "/lodash",
|
||||
"_nodeVersion": "0.12.5",
|
||||
"_npmUser": {
|
||||
|
||||
5
node_modules/minimatch/package.json
generated
vendored
5
node_modules/minimatch/package.json
generated
vendored
@@ -16,7 +16,6 @@
|
||||
"_from": "minimatch@>=3.0.0 <4.0.0",
|
||||
"_id": "minimatch@3.0.3",
|
||||
"_inCache": true,
|
||||
"_installable": true,
|
||||
"_location": "/minimatch",
|
||||
"_nodeVersion": "4.4.4",
|
||||
"_npmOperationalInternal": {
|
||||
@@ -39,10 +38,8 @@
|
||||
"type": "range"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/cli/glob",
|
||||
"/cordova-common",
|
||||
"/glob",
|
||||
"/jshint"
|
||||
"/glob"
|
||||
],
|
||||
"_resolved": "http://registry.npmjs.org/minimatch/-/minimatch-3.0.3.tgz",
|
||||
"_shasum": "2a4e4090b96b2db06a9d7df01055a62a77c9b774",
|
||||
|
||||
4
node_modules/nopt/package.json
generated
vendored
4
node_modules/nopt/package.json
generated
vendored
@@ -16,7 +16,6 @@
|
||||
"_from": "nopt@>=3.0.1 <4.0.0",
|
||||
"_id": "nopt@3.0.6",
|
||||
"_inCache": true,
|
||||
"_installable": true,
|
||||
"_location": "/nopt",
|
||||
"_nodeVersion": "4.2.1",
|
||||
"_npmUser": {
|
||||
@@ -35,8 +34,7 @@
|
||||
"type": "range"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/",
|
||||
"/istanbul"
|
||||
"/"
|
||||
],
|
||||
"_resolved": "http://registry.npmjs.org/nopt/-/nopt-3.0.6.tgz",
|
||||
"_shasum": "c6465dbf08abcd4db359317f79ac68a646b28ff9",
|
||||
|
||||
5
node_modules/once/package.json
generated
vendored
5
node_modules/once/package.json
generated
vendored
@@ -16,7 +16,6 @@
|
||||
"_from": "once@>=1.3.0 <2.0.0",
|
||||
"_id": "once@1.4.0",
|
||||
"_inCache": true,
|
||||
"_installable": true,
|
||||
"_location": "/once",
|
||||
"_nodeVersion": "6.5.0",
|
||||
"_npmOperationalInternal": {
|
||||
@@ -39,10 +38,8 @@
|
||||
"type": "range"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/cli/glob",
|
||||
"/glob",
|
||||
"/inflight",
|
||||
"/istanbul"
|
||||
"/inflight"
|
||||
],
|
||||
"_resolved": "http://registry.npmjs.org/once/-/once-1.4.0.tgz",
|
||||
"_shasum": "583b1aa775961d4b113ac17d9c50baef9dd76bd1",
|
||||
|
||||
1
node_modules/os-homedir/package.json
generated
vendored
1
node_modules/os-homedir/package.json
generated
vendored
@@ -16,7 +16,6 @@
|
||||
"_from": "os-homedir@>=1.0.0 <2.0.0",
|
||||
"_id": "os-homedir@1.0.2",
|
||||
"_inCache": true,
|
||||
"_installable": true,
|
||||
"_location": "/os-homedir",
|
||||
"_nodeVersion": "6.6.0",
|
||||
"_npmOperationalInternal": {
|
||||
|
||||
1
node_modules/os-tmpdir/package.json
generated
vendored
1
node_modules/os-tmpdir/package.json
generated
vendored
@@ -16,7 +16,6 @@
|
||||
"_from": "os-tmpdir@>=1.0.0 <2.0.0",
|
||||
"_id": "os-tmpdir@1.0.2",
|
||||
"_inCache": true,
|
||||
"_installable": true,
|
||||
"_location": "/os-tmpdir",
|
||||
"_nodeVersion": "6.6.0",
|
||||
"_npmOperationalInternal": {
|
||||
|
||||
27
node_modules/osenv/package.json
generated
vendored
27
node_modules/osenv/package.json
generated
vendored
@@ -14,16 +14,19 @@
|
||||
]
|
||||
],
|
||||
"_from": "osenv@>=0.1.3 <0.2.0",
|
||||
"_id": "osenv@0.1.3",
|
||||
"_id": "osenv@0.1.4",
|
||||
"_inCache": true,
|
||||
"_installable": true,
|
||||
"_location": "/osenv",
|
||||
"_nodeVersion": "2.2.1",
|
||||
"_nodeVersion": "6.5.0",
|
||||
"_npmOperationalInternal": {
|
||||
"host": "packages-18-east.internal.npmjs.com",
|
||||
"tmp": "tmp/osenv-0.1.4.tgz_1481655889868_0.3980878754518926"
|
||||
},
|
||||
"_npmUser": {
|
||||
"name": "isaacs",
|
||||
"email": "isaacs@npmjs.com"
|
||||
"email": "i@izs.me"
|
||||
},
|
||||
"_npmVersion": "3.0.0",
|
||||
"_npmVersion": "3.10.9",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"raw": "osenv@^0.1.3",
|
||||
@@ -37,8 +40,8 @@
|
||||
"_requiredBy": [
|
||||
"/cordova-common"
|
||||
],
|
||||
"_resolved": "http://registry.npmjs.org/osenv/-/osenv-0.1.3.tgz",
|
||||
"_shasum": "83cf05c6d6458fc4d5ac6362ea325d92f2754217",
|
||||
"_resolved": "http://registry.npmjs.org/osenv/-/osenv-0.1.4.tgz",
|
||||
"_shasum": "42fe6d5953df06c8064be6f176c3d05aaaa34644",
|
||||
"_shrinkwrap": null,
|
||||
"_spec": "osenv@^0.1.3",
|
||||
"_where": "/Users/steveng/repo/cordova/cordova-android/node_modules/cordova-common",
|
||||
@@ -56,16 +59,16 @@
|
||||
},
|
||||
"description": "Look up environment settings specific to different operating systems",
|
||||
"devDependencies": {
|
||||
"tap": "^1.2.0"
|
||||
"tap": "^8.0.1"
|
||||
},
|
||||
"directories": {
|
||||
"test": "test"
|
||||
},
|
||||
"dist": {
|
||||
"shasum": "83cf05c6d6458fc4d5ac6362ea325d92f2754217",
|
||||
"tarball": "https://registry.npmjs.org/osenv/-/osenv-0.1.3.tgz"
|
||||
"shasum": "42fe6d5953df06c8064be6f176c3d05aaaa34644",
|
||||
"tarball": "https://registry.npmjs.org/osenv/-/osenv-0.1.4.tgz"
|
||||
},
|
||||
"gitHead": "f746b3405d8f9e28054d11b97e1436f6a15016c4",
|
||||
"gitHead": "ef718f0d20e38d45ec452b7faeefc692d3cd1062",
|
||||
"homepage": "https://github.com/npm/osenv#readme",
|
||||
"keywords": [
|
||||
"environment",
|
||||
@@ -106,5 +109,5 @@
|
||||
"scripts": {
|
||||
"test": "tap test/*.js"
|
||||
},
|
||||
"version": "0.1.3"
|
||||
"version": "0.1.4"
|
||||
}
|
||||
|
||||
12
node_modules/osenv/test/unix.js
generated
vendored
12
node_modules/osenv/test/unix.js
generated
vendored
@@ -2,14 +2,14 @@
|
||||
// pretending to be another platform is too hacky, since it breaks
|
||||
// how the underlying system looks up module paths and runs
|
||||
// child processes, and all that stuff is cached.
|
||||
if (process.platform === 'win32') {
|
||||
console.log('TAP Version 13\n' +
|
||||
'1..0\n' +
|
||||
'# Skip unix tests, this is not unix\n')
|
||||
return
|
||||
}
|
||||
var tap = require('tap')
|
||||
|
||||
|
||||
if (process.platform === 'win32') {
|
||||
tap.plan(0, 'Skip unix tests, this is not unix')
|
||||
process.exit(0)
|
||||
}
|
||||
|
||||
// like unix, but funny
|
||||
process.env.USER = 'sirUser'
|
||||
process.env.HOME = '/home/sirUser'
|
||||
|
||||
2
node_modules/path-is-absolute/package.json
generated
vendored
2
node_modules/path-is-absolute/package.json
generated
vendored
@@ -16,7 +16,6 @@
|
||||
"_from": "path-is-absolute@>=1.0.0 <2.0.0",
|
||||
"_id": "path-is-absolute@1.0.1",
|
||||
"_inCache": true,
|
||||
"_installable": true,
|
||||
"_location": "/path-is-absolute",
|
||||
"_nodeVersion": "6.6.0",
|
||||
"_npmOperationalInternal": {
|
||||
@@ -39,7 +38,6 @@
|
||||
"type": "range"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/cli/glob",
|
||||
"/glob"
|
||||
],
|
||||
"_resolved": "http://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz",
|
||||
|
||||
1
node_modules/plist/package.json
generated
vendored
1
node_modules/plist/package.json
generated
vendored
@@ -16,7 +16,6 @@
|
||||
"_from": "plist@>=1.2.0 <2.0.0",
|
||||
"_id": "plist@1.2.0",
|
||||
"_inCache": true,
|
||||
"_installable": true,
|
||||
"_location": "/plist",
|
||||
"_nodeVersion": "5.0.0",
|
||||
"_npmUser": {
|
||||
|
||||
1
node_modules/properties-parser/package.json
generated
vendored
1
node_modules/properties-parser/package.json
generated
vendored
@@ -16,7 +16,6 @@
|
||||
"_from": "properties-parser@>=0.2.3 <0.3.0",
|
||||
"_id": "properties-parser@0.2.3",
|
||||
"_inCache": true,
|
||||
"_installable": true,
|
||||
"_location": "/properties-parser",
|
||||
"_npmUser": {
|
||||
"name": "xavi",
|
||||
|
||||
6
node_modules/q/CHANGES.md
generated
vendored
6
node_modules/q/CHANGES.md
generated
vendored
@@ -1,3 +1,9 @@
|
||||
## 1.5.0
|
||||
|
||||
- Q.any gives an error message from the last rejected promise
|
||||
- Throw if callback supplied to "finally" is invalid (@grahamrhay)
|
||||
- Long stack trace improvements, can now construct long stack traces
|
||||
across rethrows.
|
||||
|
||||
## 1.4.1
|
||||
|
||||
|
||||
2
node_modules/q/LICENSE
generated
vendored
2
node_modules/q/LICENSE
generated
vendored
@@ -1,4 +1,4 @@
|
||||
Copyright 2009–2014 Kristopher Michael Kowal. All rights reserved.
|
||||
Copyright 2009–2017 Kristopher Michael Kowal. All rights reserved.
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to
|
||||
deal in the Software without restriction, including without limitation the
|
||||
|
||||
19
node_modules/q/README.md
generated
vendored
19
node_modules/q/README.md
generated
vendored
@@ -1,17 +1,10 @@
|
||||
[](http://travis-ci.org/kriskowal/q)
|
||||
[](http://travis-ci.org/kriskowal/q)
|
||||
[](https://cdnjs.com/libraries/q.js)
|
||||
|
||||
<a href="http://promises-aplus.github.com/promises-spec">
|
||||
<img src="http://kriskowal.github.io/q/q.png"
|
||||
align="right" alt="Q logo" />
|
||||
<img src="http://kriskowal.github.io/q/q.png" align="right" alt="Q logo" />
|
||||
</a>
|
||||
|
||||
*This is Q version 1, from the `v1` branch in Git. This documentation applies to
|
||||
the latest of both the version 1 and version 0.9 release trains. These releases
|
||||
are stable. There will be no further releases of 0.9 after 0.9.7 which is nearly
|
||||
equivalent to version 1.0.0. All further releases of `q@~1.0` will be backward
|
||||
compatible. The version 2 release train introduces significant and
|
||||
backward-incompatible changes and is experimental at this time.*
|
||||
|
||||
If a function cannot return a value or throw an exception without
|
||||
blocking, it can return a promise instead. A promise is an object
|
||||
that represents the return value or the thrown exception that the
|
||||
@@ -80,7 +73,7 @@ The Q module can be loaded as:
|
||||
the [q](https://npmjs.org/package/q) package
|
||||
- An AMD module
|
||||
- A [component](https://github.com/component/component) as ``microjs/q``
|
||||
- Using [bower](http://bower.io/) as `q#1.0.1`
|
||||
- Using [bower](http://bower.io/) as `q#^1.4.1`
|
||||
- Using [NuGet](http://nuget.org/) as [Q](https://nuget.org/packages/q)
|
||||
|
||||
Q can exchange promises with jQuery, Dojo, When.js, WinJS, and more.
|
||||
@@ -386,7 +379,7 @@ return funcs.reduce(Q.when, Q(initialVal));
|
||||
|
||||
### Handling Errors
|
||||
|
||||
One sometimes-unintuive aspect of promises is that if you throw an
|
||||
One sometimes-unintuitive aspect of promises is that if you throw an
|
||||
exception in the fulfillment handler, it will not be caught by the error
|
||||
handler.
|
||||
|
||||
@@ -876,6 +869,6 @@ You can view the results of the Q test suite [in your browser][tests]!
|
||||
|
||||
## License
|
||||
|
||||
Copyright 2009–2015 Kristopher Michael Kowal and contributors
|
||||
Copyright 2009–2017 Kristopher Michael Kowal and contributors
|
||||
MIT License (enclosed)
|
||||
|
||||
|
||||
30
node_modules/q/package.json
generated
vendored
30
node_modules/q/package.json
generated
vendored
@@ -14,16 +14,19 @@
|
||||
]
|
||||
],
|
||||
"_from": "q@>=1.4.1 <2.0.0",
|
||||
"_id": "q@1.4.1",
|
||||
"_id": "q@1.5.0",
|
||||
"_inCache": true,
|
||||
"_installable": true,
|
||||
"_location": "/q",
|
||||
"_nodeVersion": "1.8.1",
|
||||
"_nodeVersion": "6.9.5",
|
||||
"_npmOperationalInternal": {
|
||||
"host": "packages-18-east.internal.npmjs.com",
|
||||
"tmp": "tmp/q-1.5.0.tgz_1490148893963_0.4695124195422977"
|
||||
},
|
||||
"_npmUser": {
|
||||
"name": "kriskowal",
|
||||
"email": "kris.kowal@cixar.com"
|
||||
},
|
||||
"_npmVersion": "2.8.3",
|
||||
"_npmVersion": "3.10.10",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"raw": "q@^1.4.1",
|
||||
@@ -38,8 +41,8 @@
|
||||
"/",
|
||||
"/cordova-common"
|
||||
],
|
||||
"_resolved": "http://registry.npmjs.org/q/-/q-1.4.1.tgz",
|
||||
"_shasum": "55705bcd93c5f3673530c2c2cbc0c2b3addc286e",
|
||||
"_resolved": "http://registry.npmjs.org/q/-/q-1.5.0.tgz",
|
||||
"_shasum": "dd01bac9d06d30e6f219aecb8253ee9ebdc308f1",
|
||||
"_shrinkwrap": null,
|
||||
"_spec": "q@^1.4.1",
|
||||
"_where": "/Users/steveng/repo/cordova/cordova-android",
|
||||
@@ -85,8 +88,8 @@
|
||||
"test": "./spec"
|
||||
},
|
||||
"dist": {
|
||||
"shasum": "55705bcd93c5f3673530c2c2cbc0c2b3addc286e",
|
||||
"tarball": "https://registry.npmjs.org/q/-/q-1.4.1.tgz"
|
||||
"shasum": "dd01bac9d06d30e6f219aecb8253ee9ebdc308f1",
|
||||
"tarball": "https://registry.npmjs.org/q/-/q-1.5.0.tgz"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=0.6.0",
|
||||
@@ -97,7 +100,7 @@
|
||||
"q.js",
|
||||
"queue.js"
|
||||
],
|
||||
"gitHead": "d373079d3620152e3d60e82f27265a09ee0e81bd",
|
||||
"gitHead": "4fecabe07ff9f3683a3d4548e7f81c2aba693326",
|
||||
"homepage": "https://github.com/kriskowal/q",
|
||||
"keywords": [
|
||||
"q",
|
||||
@@ -113,10 +116,7 @@
|
||||
"browser",
|
||||
"node"
|
||||
],
|
||||
"license": {
|
||||
"type": "MIT",
|
||||
"url": "http://github.com/kriskowal/q/raw/master/LICENSE"
|
||||
},
|
||||
"license": "MIT",
|
||||
"main": "q.js",
|
||||
"maintainers": [
|
||||
{
|
||||
@@ -148,8 +148,8 @@
|
||||
"lint": "jshint q.js",
|
||||
"minify": "grunt",
|
||||
"prepublish": "grunt",
|
||||
"test": "jasmine-node spec && promises-aplus-tests spec/aplus-adapter",
|
||||
"test": "npm ls -s && jasmine-node spec && promises-aplus-tests spec/aplus-adapter && npm run -s lint",
|
||||
"test-browser": "opener spec/q-spec.html"
|
||||
},
|
||||
"version": "1.4.1"
|
||||
"version": "1.5.0"
|
||||
}
|
||||
|
||||
53
node_modules/q/q.js
generated
vendored
53
node_modules/q/q.js
generated
vendored
@@ -1,8 +1,8 @@
|
||||
// vim:ts=4:sts=4:sw=4:
|
||||
/*!
|
||||
*
|
||||
* Copyright 2009-2012 Kris Kowal under the terms of the MIT
|
||||
* license found at http://github.com/kriskowal/q/raw/master/LICENSE
|
||||
* Copyright 2009-2017 Kris Kowal under the terms of the MIT
|
||||
* license found at https://github.com/kriskowal/q/blob/v1/LICENSE
|
||||
*
|
||||
* With parts by Tyler Close
|
||||
* Copyright 2007-2009 Tyler Close under the terms of the MIT X license found
|
||||
@@ -190,7 +190,7 @@ var nextTick =(function () {
|
||||
// `setTimeout`. In this case `setImmediate` is preferred because
|
||||
// it is faster. Browserify's `process.toString()` yields
|
||||
// "[object Object]", while in a real Node environment
|
||||
// `process.nextTick()` yields "[object process]".
|
||||
// `process.toString()` yields "[object process]".
|
||||
isNodeJS = true;
|
||||
|
||||
requestTick = function () {
|
||||
@@ -327,6 +327,11 @@ var object_create = Object.create || function (prototype) {
|
||||
return new Type();
|
||||
};
|
||||
|
||||
var object_defineProperty = Object.defineProperty || function (obj, prop, descriptor) {
|
||||
obj[prop] = descriptor.value;
|
||||
return obj;
|
||||
};
|
||||
|
||||
var object_hasOwnProperty = uncurryThis(Object.prototype.hasOwnProperty);
|
||||
|
||||
var object_keys = Object.keys || function (object) {
|
||||
@@ -377,19 +382,20 @@ function makeStackTraceLong(error, promise) {
|
||||
promise.stack &&
|
||||
typeof error === "object" &&
|
||||
error !== null &&
|
||||
error.stack &&
|
||||
error.stack.indexOf(STACK_JUMP_SEPARATOR) === -1
|
||||
error.stack
|
||||
) {
|
||||
var stacks = [];
|
||||
for (var p = promise; !!p; p = p.source) {
|
||||
if (p.stack) {
|
||||
if (p.stack && (!error.__minimumStackCounter__ || error.__minimumStackCounter__ > p.stackCounter)) {
|
||||
object_defineProperty(error, "__minimumStackCounter__", {value: p.stackCounter, configurable: true});
|
||||
stacks.unshift(p.stack);
|
||||
}
|
||||
}
|
||||
stacks.unshift(error.stack);
|
||||
|
||||
var concatedStacks = stacks.join("\n" + STACK_JUMP_SEPARATOR + "\n");
|
||||
error.stack = filterStackString(concatedStacks);
|
||||
var stack = filterStackString(concatedStacks);
|
||||
object_defineProperty(error, "stack", {value: stack, configurable: true});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -516,6 +522,14 @@ Q.nextTick = nextTick;
|
||||
*/
|
||||
Q.longStackSupport = false;
|
||||
|
||||
/**
|
||||
* The counter is used to determine the stopping point for building
|
||||
* long stack traces. In makeStackTraceLong we walk backwards through
|
||||
* the linked list of promises, only stacks which were created before
|
||||
* the rejection are concatenated.
|
||||
*/
|
||||
var longStackCounter = 1;
|
||||
|
||||
// enable long stacks if Q_DEBUG is set
|
||||
if (typeof process === "object" && process && process.env && process.env.Q_DEBUG) {
|
||||
Q.longStackSupport = true;
|
||||
@@ -588,6 +602,7 @@ function defer() {
|
||||
// At the same time, cut off the first line; it's always just
|
||||
// "[object Promise]\n", as per the `toString`.
|
||||
promise.stack = e.stack.substring(e.stack.indexOf("\n") + 1);
|
||||
promise.stackCounter = longStackCounter++;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -597,7 +612,12 @@ function defer() {
|
||||
|
||||
function become(newPromise) {
|
||||
resolvedPromise = newPromise;
|
||||
promise.source = newPromise;
|
||||
|
||||
if (Q.longStackSupport && hasStacks) {
|
||||
// Only hold a reference to the new promise if long stacks
|
||||
// are enabled to reduce memory usage
|
||||
promise.source = newPromise;
|
||||
}
|
||||
|
||||
array_reduce(messages, function (undefined, message) {
|
||||
Q.nextTick(function () {
|
||||
@@ -725,7 +745,7 @@ Promise.prototype.join = function (that) {
|
||||
// TODO: "===" should be Object.is or equiv
|
||||
return x;
|
||||
} else {
|
||||
throw new Error("Can't join: not the same: " + x + " " + y);
|
||||
throw new Error("Q can't join: not the same: " + x + " " + y);
|
||||
}
|
||||
});
|
||||
};
|
||||
@@ -1622,13 +1642,12 @@ function any(promises) {
|
||||
function onFulfilled(result) {
|
||||
deferred.resolve(result);
|
||||
}
|
||||
function onRejected() {
|
||||
function onRejected(err) {
|
||||
pendingCount--;
|
||||
if (pendingCount === 0) {
|
||||
deferred.reject(new Error(
|
||||
"Can't get fulfillment value from any promise, all " +
|
||||
"promises were rejected."
|
||||
));
|
||||
err.message = ("Q can't get fulfillment value from any promise, all " +
|
||||
"promises were rejected. Last error message: " + err.message);
|
||||
deferred.reject(err);
|
||||
}
|
||||
}
|
||||
function onProgress(progress) {
|
||||
@@ -1752,6 +1771,9 @@ Q["finally"] = function (object, callback) {
|
||||
|
||||
Promise.prototype.fin = // XXX legacy
|
||||
Promise.prototype["finally"] = function (callback) {
|
||||
if (!callback || typeof callback.apply !== "function") {
|
||||
throw new Error("Q can't apply finally callback");
|
||||
}
|
||||
callback = Q(callback);
|
||||
return this.then(function (value) {
|
||||
return callback.fcall().then(function () {
|
||||
@@ -1915,6 +1937,9 @@ Promise.prototype.nfcall = function (/*...args*/) {
|
||||
*/
|
||||
Q.nfbind =
|
||||
Q.denodeify = function (callback /*...args*/) {
|
||||
if (callback === undefined) {
|
||||
throw new Error("Q can't wrap an undefined function");
|
||||
}
|
||||
var baseArgs = array_slice(arguments, 1);
|
||||
return function () {
|
||||
var nodeArgs = baseArgs.concat(array_slice(arguments));
|
||||
|
||||
1
node_modules/sax/package.json
generated
vendored
1
node_modules/sax/package.json
generated
vendored
@@ -18,7 +18,6 @@
|
||||
"_from": "sax@0.3.5",
|
||||
"_id": "sax@0.3.5",
|
||||
"_inCache": true,
|
||||
"_installable": true,
|
||||
"_location": "/sax",
|
||||
"_nodeVersion": "v0.6.7-pre",
|
||||
"_npmUser": {
|
||||
|
||||
1
node_modules/semver/package.json
generated
vendored
1
node_modules/semver/package.json
generated
vendored
@@ -16,7 +16,6 @@
|
||||
"_from": "semver@>=5.0.1 <6.0.0",
|
||||
"_id": "semver@5.3.0",
|
||||
"_inCache": true,
|
||||
"_installable": true,
|
||||
"_location": "/semver",
|
||||
"_nodeVersion": "4.4.4",
|
||||
"_npmOperationalInternal": {
|
||||
|
||||
1
node_modules/shelljs/package.json
generated
vendored
1
node_modules/shelljs/package.json
generated
vendored
@@ -16,7 +16,6 @@
|
||||
"_from": "shelljs@>=0.5.3 <0.6.0",
|
||||
"_id": "shelljs@0.5.3",
|
||||
"_inCache": true,
|
||||
"_installable": true,
|
||||
"_location": "/shelljs",
|
||||
"_nodeVersion": "1.2.0",
|
||||
"_npmUser": {
|
||||
|
||||
4
node_modules/underscore/package.json
generated
vendored
4
node_modules/underscore/package.json
generated
vendored
@@ -16,7 +16,6 @@
|
||||
"_from": "underscore@>=1.8.3 <2.0.0",
|
||||
"_id": "underscore@1.8.3",
|
||||
"_inCache": true,
|
||||
"_installable": true,
|
||||
"_location": "/underscore",
|
||||
"_npmUser": {
|
||||
"name": "jashkenas",
|
||||
@@ -34,8 +33,7 @@
|
||||
"type": "range"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/cordova-common",
|
||||
"/jasmine-node"
|
||||
"/cordova-common"
|
||||
],
|
||||
"_resolved": "http://registry.npmjs.org/underscore/-/underscore-1.8.3.tgz",
|
||||
"_shasum": "4f3fb53b106e6097fcf9cb4109f2a5e9bdfa5022",
|
||||
|
||||
1
node_modules/unorm/package.json
generated
vendored
1
node_modules/unorm/package.json
generated
vendored
@@ -16,7 +16,6 @@
|
||||
"_from": "unorm@>=1.3.3 <2.0.0",
|
||||
"_id": "unorm@1.4.1",
|
||||
"_inCache": true,
|
||||
"_installable": true,
|
||||
"_location": "/unorm",
|
||||
"_npmUser": {
|
||||
"name": "walling",
|
||||
|
||||
1
node_modules/util-deprecate/package.json
generated
vendored
1
node_modules/util-deprecate/package.json
generated
vendored
@@ -16,7 +16,6 @@
|
||||
"_from": "util-deprecate@1.0.2",
|
||||
"_id": "util-deprecate@1.0.2",
|
||||
"_inCache": true,
|
||||
"_installable": true,
|
||||
"_location": "/util-deprecate",
|
||||
"_nodeVersion": "4.1.2",
|
||||
"_npmUser": {
|
||||
|
||||
1
node_modules/wrappy/package.json
generated
vendored
1
node_modules/wrappy/package.json
generated
vendored
@@ -16,7 +16,6 @@
|
||||
"_from": "wrappy@>=1.0.0 <2.0.0",
|
||||
"_id": "wrappy@1.0.2",
|
||||
"_inCache": true,
|
||||
"_installable": true,
|
||||
"_location": "/wrappy",
|
||||
"_nodeVersion": "5.10.1",
|
||||
"_npmOperationalInternal": {
|
||||
|
||||
1
node_modules/xmlbuilder/package.json
generated
vendored
1
node_modules/xmlbuilder/package.json
generated
vendored
@@ -16,7 +16,6 @@
|
||||
"_from": "xmlbuilder@4.0.0",
|
||||
"_id": "xmlbuilder@4.0.0",
|
||||
"_inCache": true,
|
||||
"_installable": true,
|
||||
"_location": "/xmlbuilder",
|
||||
"_npmUser": {
|
||||
"name": "oozcitak",
|
||||
|
||||
46
node_modules/xmldom/dom-parser.js
generated
vendored
46
node_modules/xmldom/dom-parser.js
generated
vendored
@@ -2,7 +2,7 @@ function DOMParser(options){
|
||||
this.options = options ||{locator:{}};
|
||||
|
||||
}
|
||||
DOMParser.prototype.parseFromString = function(source,mimeType){
|
||||
DOMParser.prototype.parseFromString = function(source,mimeType){
|
||||
var options = this.options;
|
||||
var sax = new XMLReader();
|
||||
var domBuilder = options.domBuilder || new DOMHandler();//contentHandler and LexicalHandler
|
||||
@@ -25,9 +25,9 @@ DOMParser.prototype.parseFromString = function(source,mimeType){
|
||||
if(source){
|
||||
sax.parse(source,defaultNSMap,entityMap);
|
||||
}else{
|
||||
sax.errorHandler.error("invalid document source");
|
||||
sax.errorHandler.error("invalid doc source");
|
||||
}
|
||||
return domBuilder.document;
|
||||
return domBuilder.doc;
|
||||
}
|
||||
function buildErrorHandler(errorImpl,domBuilder,locator){
|
||||
if(!errorImpl){
|
||||
@@ -77,13 +77,13 @@ function position(locator,node){
|
||||
*/
|
||||
DOMHandler.prototype = {
|
||||
startDocument : function() {
|
||||
this.document = new DOMImplementation().createDocument(null, null, null);
|
||||
this.doc = new DOMImplementation().createDocument(null, null, null);
|
||||
if (this.locator) {
|
||||
this.document.documentURI = this.locator.systemId;
|
||||
this.doc.documentURI = this.locator.systemId;
|
||||
}
|
||||
},
|
||||
startElement:function(namespaceURI, localName, qName, attrs) {
|
||||
var doc = this.document;
|
||||
var doc = this.doc;
|
||||
var el = doc.createElementNS(namespaceURI, qName||localName);
|
||||
var len = attrs.length;
|
||||
appendElement(this, el);
|
||||
@@ -95,24 +95,22 @@ DOMHandler.prototype = {
|
||||
var value = attrs.getValue(i);
|
||||
var qName = attrs.getQName(i);
|
||||
var attr = doc.createAttributeNS(namespaceURI, qName);
|
||||
if( attr.getOffset){
|
||||
position(attr.getOffset(1),attr)
|
||||
}
|
||||
this.locator &&position(attrs.getLocator(i),attr);
|
||||
attr.value = attr.nodeValue = value;
|
||||
el.setAttributeNode(attr)
|
||||
}
|
||||
},
|
||||
endElement:function(namespaceURI, localName, qName) {
|
||||
var current = this.currentElement
|
||||
var tagName = current.tagName;
|
||||
this.currentElement = current.parentNode;
|
||||
var tagName = current.tagName;
|
||||
this.currentElement = current.parentNode;
|
||||
},
|
||||
startPrefixMapping:function(prefix, uri) {
|
||||
},
|
||||
endPrefixMapping:function(prefix) {
|
||||
},
|
||||
processingInstruction:function(target, data) {
|
||||
var ins = this.document.createProcessingInstruction(target, data);
|
||||
var ins = this.doc.createProcessingInstruction(target, data);
|
||||
this.locator && position(this.locator,ins)
|
||||
appendElement(this, ins);
|
||||
},
|
||||
@@ -121,13 +119,17 @@ DOMHandler.prototype = {
|
||||
characters:function(chars, start, length) {
|
||||
chars = _toString.apply(this,arguments)
|
||||
//console.log(chars)
|
||||
if(this.currentElement && chars){
|
||||
if(chars){
|
||||
if (this.cdata) {
|
||||
var charNode = this.document.createCDATASection(chars);
|
||||
this.currentElement.appendChild(charNode);
|
||||
var charNode = this.doc.createCDATASection(chars);
|
||||
} else {
|
||||
var charNode = this.document.createTextNode(chars);
|
||||
var charNode = this.doc.createTextNode(chars);
|
||||
}
|
||||
if(this.currentElement){
|
||||
this.currentElement.appendChild(charNode);
|
||||
}else if(/^\s*$/.test(chars)){
|
||||
this.doc.appendChild(charNode);
|
||||
//process xml
|
||||
}
|
||||
this.locator && position(this.locator,charNode)
|
||||
}
|
||||
@@ -135,7 +137,7 @@ DOMHandler.prototype = {
|
||||
skippedEntity:function(name) {
|
||||
},
|
||||
endDocument:function() {
|
||||
this.document.normalize();
|
||||
this.doc.normalize();
|
||||
},
|
||||
setDocumentLocator:function (locator) {
|
||||
if(this.locator = locator){// && !('lineNumber' in locator)){
|
||||
@@ -145,7 +147,7 @@ DOMHandler.prototype = {
|
||||
//LexicalHandler
|
||||
comment:function(chars, start, length) {
|
||||
chars = _toString.apply(this,arguments)
|
||||
var comm = this.document.createComment(chars);
|
||||
var comm = this.doc.createComment(chars);
|
||||
this.locator && position(this.locator,comm)
|
||||
appendElement(this, comm);
|
||||
},
|
||||
@@ -159,7 +161,7 @@ DOMHandler.prototype = {
|
||||
},
|
||||
|
||||
startDTD:function(name, publicId, systemId) {
|
||||
var impl = this.document.implementation;
|
||||
var impl = this.doc.implementation;
|
||||
if (impl && impl.createDocumentType) {
|
||||
var dt = impl.createDocumentType(name, publicId, systemId);
|
||||
this.locator && position(this.locator,dt)
|
||||
@@ -235,15 +237,15 @@ function _toString(chars,start,length){
|
||||
/* Private static helpers treated below as private instance methods, so don't need to add these to the public API; we might use a Relator to also get rid of non-standard public properties */
|
||||
function appendElement (hander,node) {
|
||||
if (!hander.currentElement) {
|
||||
hander.document.appendChild(node);
|
||||
hander.doc.appendChild(node);
|
||||
} else {
|
||||
hander.currentElement.appendChild(node);
|
||||
}
|
||||
}//appendChild and setAttributeNS are preformance key
|
||||
|
||||
if(typeof require == 'function'){
|
||||
//if(typeof require == 'function'){
|
||||
var XMLReader = require('./sax').XMLReader;
|
||||
var DOMImplementation = exports.DOMImplementation = require('./dom').DOMImplementation;
|
||||
exports.XMLSerializer = require('./dom').XMLSerializer ;
|
||||
exports.DOMParser = DOMParser;
|
||||
}
|
||||
//}
|
||||
|
||||
163
node_modules/xmldom/dom.js
generated
vendored
163
node_modules/xmldom/dom.js
generated
vendored
@@ -110,9 +110,9 @@ NodeList.prototype = {
|
||||
item: function(index) {
|
||||
return this[index] || null;
|
||||
},
|
||||
toString:function(){
|
||||
toString:function(isHTML,nodeFilter){
|
||||
for(var buf = [], i = 0;i<this.length;i++){
|
||||
serializeToString(this[i],buf);
|
||||
serializeToString(this[i],buf,isHTML,nodeFilter);
|
||||
}
|
||||
return buf.join('');
|
||||
}
|
||||
@@ -170,6 +170,7 @@ function _addNamedNode(el,list,newAttr,oldAttr){
|
||||
}
|
||||
}
|
||||
function _removeNamedNode(el,list,attr){
|
||||
//console.log('remove attr:'+attr)
|
||||
var i = _findNodeIndex(list,attr);
|
||||
if(i>=0){
|
||||
var lastIndex = list.length-1
|
||||
@@ -185,7 +186,7 @@ function _removeNamedNode(el,list,attr){
|
||||
}
|
||||
}
|
||||
}else{
|
||||
throw DOMException(NOT_FOUND_ERR,new Error())
|
||||
throw DOMException(NOT_FOUND_ERR,new Error(el.tagName+'@'+attr))
|
||||
}
|
||||
}
|
||||
NamedNodeMap.prototype = {
|
||||
@@ -195,9 +196,11 @@ NamedNodeMap.prototype = {
|
||||
// if(key.indexOf(':')>0 || key == 'xmlns'){
|
||||
// return null;
|
||||
// }
|
||||
//console.log()
|
||||
var i = this.length;
|
||||
while(i--){
|
||||
var attr = this[i];
|
||||
//console.log(attr.nodeName,key)
|
||||
if(attr.nodeName == key){
|
||||
return attr;
|
||||
}
|
||||
@@ -379,7 +382,7 @@ Node.prototype = {
|
||||
}
|
||||
}
|
||||
}
|
||||
el = el.nodeType == 2?el.ownerDocument : el.parentNode;
|
||||
el = el.nodeType == ATTRIBUTE_NODE?el.ownerDocument : el.parentNode;
|
||||
}
|
||||
return null;
|
||||
},
|
||||
@@ -394,7 +397,7 @@ Node.prototype = {
|
||||
return map[prefix] ;
|
||||
}
|
||||
}
|
||||
el = el.nodeType == 2?el.ownerDocument : el.parentNode;
|
||||
el = el.nodeType == ATTRIBUTE_NODE?el.ownerDocument : el.parentNode;
|
||||
}
|
||||
return null;
|
||||
},
|
||||
@@ -579,7 +582,7 @@ Document.prototype = {
|
||||
}
|
||||
return newChild;
|
||||
}
|
||||
if(this.documentElement == null && newChild.nodeType == 1){
|
||||
if(this.documentElement == null && newChild.nodeType == ELEMENT_NODE){
|
||||
this.documentElement = newChild;
|
||||
}
|
||||
|
||||
@@ -599,7 +602,7 @@ Document.prototype = {
|
||||
getElementById : function(id){
|
||||
var rtv = null;
|
||||
_visitNode(this.documentElement,function(node){
|
||||
if(node.nodeType == 1){
|
||||
if(node.nodeType == ELEMENT_NODE){
|
||||
if(node.getAttribute('id') == id){
|
||||
rtv = node;
|
||||
return true;
|
||||
@@ -748,6 +751,7 @@ Element.prototype = {
|
||||
return this.attributes.setNamedItemNS(newAttr);
|
||||
},
|
||||
removeAttributeNode : function(oldAttr){
|
||||
//console.log(this == oldAttr.ownerElement)
|
||||
return this.attributes.removeNamedItem(oldAttr.nodeName);
|
||||
},
|
||||
//get real attribute name,and remove it by removeAttributeNode
|
||||
@@ -792,6 +796,7 @@ Element.prototype = {
|
||||
}
|
||||
});
|
||||
return ls;
|
||||
|
||||
});
|
||||
}
|
||||
};
|
||||
@@ -823,10 +828,7 @@ CharacterData.prototype = {
|
||||
|
||||
},
|
||||
appendChild:function(newChild){
|
||||
//if(!(newChild instanceof CharacterData)){
|
||||
throw new Error(ExceptionMessage[3])
|
||||
//}
|
||||
return Node.prototype.appendChild.apply(this,arguments)
|
||||
throw new Error(ExceptionMessage[HIERARCHY_REQUEST_ERR])
|
||||
},
|
||||
deleteData: function(offset, count) {
|
||||
this.replaceData(offset,count,"");
|
||||
@@ -908,39 +910,132 @@ function ProcessingInstruction() {
|
||||
ProcessingInstruction.prototype.nodeType = PROCESSING_INSTRUCTION_NODE;
|
||||
_extends(ProcessingInstruction,Node);
|
||||
function XMLSerializer(){}
|
||||
XMLSerializer.prototype.serializeToString = function(node,attributeSorter){
|
||||
return node.toString(attributeSorter);
|
||||
XMLSerializer.prototype.serializeToString = function(node,isHtml,nodeFilter){
|
||||
return nodeSerializeToString.call(node,isHtml,nodeFilter);
|
||||
}
|
||||
Node.prototype.toString =function(attributeSorter){
|
||||
Node.prototype.toString = nodeSerializeToString;
|
||||
function nodeSerializeToString(isHtml,nodeFilter){
|
||||
var buf = [];
|
||||
serializeToString(this,buf,attributeSorter);
|
||||
var refNode = this.nodeType == 9?this.documentElement:this;
|
||||
var prefix = refNode.prefix;
|
||||
var uri = refNode.namespaceURI;
|
||||
|
||||
if(uri && prefix == null){
|
||||
//console.log(prefix)
|
||||
var prefix = refNode.lookupPrefix(uri);
|
||||
if(prefix == null){
|
||||
//isHTML = true;
|
||||
var visibleNamespaces=[
|
||||
{namespace:uri,prefix:null}
|
||||
//{namespace:uri,prefix:''}
|
||||
]
|
||||
}
|
||||
}
|
||||
serializeToString(this,buf,isHtml,nodeFilter,visibleNamespaces);
|
||||
//console.log('###',this.nodeType,uri,prefix,buf.join(''))
|
||||
return buf.join('');
|
||||
}
|
||||
function serializeToString(node,buf,attributeSorter,isHTML){
|
||||
function needNamespaceDefine(node,isHTML, visibleNamespaces) {
|
||||
var prefix = node.prefix||'';
|
||||
var uri = node.namespaceURI;
|
||||
if (!prefix && !uri){
|
||||
return false;
|
||||
}
|
||||
if (prefix === "xml" && uri === "http://www.w3.org/XML/1998/namespace"
|
||||
|| uri == 'http://www.w3.org/2000/xmlns/'){
|
||||
return false;
|
||||
}
|
||||
|
||||
var i = visibleNamespaces.length
|
||||
//console.log('@@@@',node.tagName,prefix,uri,visibleNamespaces)
|
||||
while (i--) {
|
||||
var ns = visibleNamespaces[i];
|
||||
// get namespace prefix
|
||||
//console.log(node.nodeType,node.tagName,ns.prefix,prefix)
|
||||
if (ns.prefix == prefix){
|
||||
return ns.namespace != uri;
|
||||
}
|
||||
}
|
||||
//console.log(isHTML,uri,prefix=='')
|
||||
//if(isHTML && prefix ==null && uri == 'http://www.w3.org/1999/xhtml'){
|
||||
// return false;
|
||||
//}
|
||||
//node.flag = '11111'
|
||||
//console.error(3,true,node.flag,node.prefix,node.namespaceURI)
|
||||
return true;
|
||||
}
|
||||
function serializeToString(node,buf,isHTML,nodeFilter,visibleNamespaces){
|
||||
if(nodeFilter){
|
||||
node = nodeFilter(node);
|
||||
if(node){
|
||||
if(typeof node == 'string'){
|
||||
buf.push(node);
|
||||
return;
|
||||
}
|
||||
}else{
|
||||
return;
|
||||
}
|
||||
//buf.sort.apply(attrs, attributeSorter);
|
||||
}
|
||||
switch(node.nodeType){
|
||||
case ELEMENT_NODE:
|
||||
if (!visibleNamespaces) visibleNamespaces = [];
|
||||
var startVisibleNamespaces = visibleNamespaces.length;
|
||||
var attrs = node.attributes;
|
||||
var len = attrs.length;
|
||||
var child = node.firstChild;
|
||||
var nodeName = node.tagName;
|
||||
|
||||
isHTML = (htmlns === node.namespaceURI) ||isHTML
|
||||
buf.push('<',nodeName);
|
||||
if(attributeSorter){
|
||||
buf.sort.apply(attrs, attributeSorter);
|
||||
|
||||
|
||||
|
||||
for(var i=0;i<len;i++){
|
||||
// add namespaces for attributes
|
||||
var attr = attrs.item(i);
|
||||
if (attr.prefix == 'xmlns') {
|
||||
visibleNamespaces.push({ prefix: attr.localName, namespace: attr.value });
|
||||
}else if(attr.nodeName == 'xmlns'){
|
||||
visibleNamespaces.push({ prefix: '', namespace: attr.value });
|
||||
}
|
||||
}
|
||||
for(var i=0;i<len;i++){
|
||||
serializeToString(attrs.item(i),buf,attributeSorter,isHTML);
|
||||
var attr = attrs.item(i);
|
||||
if (needNamespaceDefine(attr,isHTML, visibleNamespaces)) {
|
||||
var prefix = attr.prefix||'';
|
||||
var uri = attr.namespaceURI;
|
||||
var ns = prefix ? ' xmlns:' + prefix : " xmlns";
|
||||
buf.push(ns, '="' , uri , '"');
|
||||
visibleNamespaces.push({ prefix: prefix, namespace:uri });
|
||||
}
|
||||
serializeToString(attr,buf,isHTML,nodeFilter,visibleNamespaces);
|
||||
}
|
||||
if(child || isHTML && !/^(?:meta|link|img|br|hr|input|button)$/i.test(nodeName)){
|
||||
// add namespace for current node
|
||||
if (needNamespaceDefine(node,isHTML, visibleNamespaces)) {
|
||||
var prefix = node.prefix||'';
|
||||
var uri = node.namespaceURI;
|
||||
var ns = prefix ? ' xmlns:' + prefix : " xmlns";
|
||||
buf.push(ns, '="' , uri , '"');
|
||||
visibleNamespaces.push({ prefix: prefix, namespace:uri });
|
||||
}
|
||||
|
||||
if(child || isHTML && !/^(?:meta|link|img|br|hr|input)$/i.test(nodeName)){
|
||||
buf.push('>');
|
||||
//if is cdata child node
|
||||
if(isHTML && /^script$/i.test(nodeName)){
|
||||
if(child){
|
||||
buf.push(child.data);
|
||||
}
|
||||
}else{
|
||||
while(child){
|
||||
serializeToString(child,buf,attributeSorter,isHTML);
|
||||
if(child.data){
|
||||
buf.push(child.data);
|
||||
}else{
|
||||
serializeToString(child,buf,isHTML,nodeFilter,visibleNamespaces);
|
||||
}
|
||||
child = child.nextSibling;
|
||||
}
|
||||
}else
|
||||
{
|
||||
while(child){
|
||||
serializeToString(child,buf,isHTML,nodeFilter,visibleNamespaces);
|
||||
child = child.nextSibling;
|
||||
}
|
||||
}
|
||||
@@ -948,12 +1043,14 @@ function serializeToString(node,buf,attributeSorter,isHTML){
|
||||
}else{
|
||||
buf.push('/>');
|
||||
}
|
||||
// remove added visible namespaces
|
||||
//visibleNamespaces.length = startVisibleNamespaces;
|
||||
return;
|
||||
case DOCUMENT_NODE:
|
||||
case DOCUMENT_FRAGMENT_NODE:
|
||||
var child = node.firstChild;
|
||||
while(child){
|
||||
serializeToString(child,buf,attributeSorter,isHTML);
|
||||
serializeToString(child,buf,isHTML,nodeFilter,visibleNamespaces);
|
||||
child = child.nextSibling;
|
||||
}
|
||||
return;
|
||||
@@ -1098,8 +1195,8 @@ try{
|
||||
},
|
||||
set:function(data){
|
||||
switch(this.nodeType){
|
||||
case 1:
|
||||
case 11:
|
||||
case ELEMENT_NODE:
|
||||
case DOCUMENT_FRAGMENT_NODE:
|
||||
while(this.firstChild){
|
||||
this.removeChild(this.firstChild);
|
||||
}
|
||||
@@ -1110,7 +1207,7 @@ try{
|
||||
default:
|
||||
//TODO:
|
||||
this.data = data;
|
||||
this.value = value;
|
||||
this.value = data;
|
||||
this.nodeValue = data;
|
||||
}
|
||||
}
|
||||
@@ -1118,8 +1215,8 @@ try{
|
||||
|
||||
function getTextContent(node){
|
||||
switch(node.nodeType){
|
||||
case 1:
|
||||
case 11:
|
||||
case ELEMENT_NODE:
|
||||
case DOCUMENT_FRAGMENT_NODE:
|
||||
var buf = [];
|
||||
node = node.firstChild;
|
||||
while(node){
|
||||
@@ -1141,7 +1238,7 @@ try{
|
||||
}catch(e){//ie8
|
||||
}
|
||||
|
||||
if(typeof require == 'function'){
|
||||
//if(typeof require == 'function'){
|
||||
exports.DOMImplementation = DOMImplementation;
|
||||
exports.XMLSerializer = XMLSerializer;
|
||||
}
|
||||
//}
|
||||
|
||||
19
node_modules/xmldom/package.json
generated
vendored
19
node_modules/xmldom/package.json
generated
vendored
@@ -14,11 +14,14 @@
|
||||
]
|
||||
],
|
||||
"_from": "xmldom@>=0.1.0 <0.2.0",
|
||||
"_id": "xmldom@0.1.22",
|
||||
"_id": "xmldom@0.1.27",
|
||||
"_inCache": true,
|
||||
"_installable": true,
|
||||
"_location": "/xmldom",
|
||||
"_nodeVersion": "5.5.0",
|
||||
"_npmOperationalInternal": {
|
||||
"host": "packages-12-west.internal.npmjs.com",
|
||||
"tmp": "tmp/xmldom-0.1.27.tgz_1480305406093_0.9070004557725042"
|
||||
},
|
||||
"_npmUser": {
|
||||
"name": "jindw",
|
||||
"email": "jindw@xidea.org"
|
||||
@@ -37,8 +40,8 @@
|
||||
"_requiredBy": [
|
||||
"/plist"
|
||||
],
|
||||
"_resolved": "http://registry.npmjs.org/xmldom/-/xmldom-0.1.22.tgz",
|
||||
"_shasum": "10de4e5e964981f03c8cc72fadc08d14b6c3aa26",
|
||||
"_resolved": "http://registry.npmjs.org/xmldom/-/xmldom-0.1.27.tgz",
|
||||
"_shasum": "d501f97b3bdb403af8ef9ecc20573187aadac0e9",
|
||||
"_shrinkwrap": null,
|
||||
"_spec": "xmldom@0.1.x",
|
||||
"_where": "/Users/steveng/repo/cordova/cordova-android/node_modules/plist",
|
||||
@@ -75,13 +78,13 @@
|
||||
},
|
||||
"directories": {},
|
||||
"dist": {
|
||||
"shasum": "10de4e5e964981f03c8cc72fadc08d14b6c3aa26",
|
||||
"tarball": "https://registry.npmjs.org/xmldom/-/xmldom-0.1.22.tgz"
|
||||
"shasum": "d501f97b3bdb403af8ef9ecc20573187aadac0e9",
|
||||
"tarball": "https://registry.npmjs.org/xmldom/-/xmldom-0.1.27.tgz"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=0.1"
|
||||
},
|
||||
"gitHead": "29a83b315aef56c156602286b2d884a3b4c2521f",
|
||||
"gitHead": "b53aa82a36160d85faab394035dcd1784764537f",
|
||||
"homepage": "https://github.com/jindw/xmldom",
|
||||
"keywords": [
|
||||
"w3c",
|
||||
@@ -132,5 +135,5 @@
|
||||
"scripts": {
|
||||
"test": "proof platform win32 && proof test */*/*.t.js || t/test"
|
||||
},
|
||||
"version": "0.1.22"
|
||||
"version": "0.1.27"
|
||||
}
|
||||
|
||||
217
node_modules/xmldom/sax.js
generated
vendored
217
node_modules/xmldom/sax.js
generated
vendored
@@ -2,21 +2,21 @@
|
||||
//[4a] NameChar ::= NameStartChar | "-" | "." | [0-9] | #xB7 | [#x0300-#x036F] | [#x203F-#x2040]
|
||||
//[5] Name ::= NameStartChar (NameChar)*
|
||||
var nameStartChar = /[A-Z_a-z\xC0-\xD6\xD8-\xF6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]///\u10000-\uEFFFF
|
||||
var nameChar = new RegExp("[\\-\\.0-9"+nameStartChar.source.slice(1,-1)+"\u00B7\u0300-\u036F\\u203F-\u2040]");
|
||||
var nameChar = new RegExp("[\\-\\.0-9"+nameStartChar.source.slice(1,-1)+"\\u00B7\\u0300-\\u036F\\u203F-\\u2040]");
|
||||
var tagNamePattern = new RegExp('^'+nameStartChar.source+nameChar.source+'*(?:\:'+nameStartChar.source+nameChar.source+'*)?$');
|
||||
//var tagNamePattern = /^[a-zA-Z_][\w\-\.]*(?:\:[a-zA-Z_][\w\-\.]*)?$/
|
||||
//var handlers = 'resolveEntity,getExternalSubset,characters,endDocument,endElement,endPrefixMapping,ignorableWhitespace,processingInstruction,setDocumentLocator,skippedEntity,startDocument,startElement,startPrefixMapping,notationDecl,unparsedEntityDecl,error,fatalError,warning,attributeDecl,elementDecl,externalEntityDecl,internalEntityDecl,comment,endCDATA,endDTD,endEntity,startCDATA,startDTD,startEntity'.split(',')
|
||||
|
||||
//S_TAG, S_ATTR, S_EQ, S_V
|
||||
//S_ATTR_S, S_E, S_S, S_C
|
||||
//S_TAG, S_ATTR, S_EQ, S_ATTR_NOQUOT_VALUE
|
||||
//S_ATTR_SPACE, S_ATTR_END, S_TAG_SPACE, S_TAG_CLOSE
|
||||
var S_TAG = 0;//tag name offerring
|
||||
var S_ATTR = 1;//attr name offerring
|
||||
var S_ATTR_S=2;//attr name end and space offer
|
||||
var S_ATTR_SPACE=2;//attr name end and space offer
|
||||
var S_EQ = 3;//=space?
|
||||
var S_V = 4;//attr value(no quot value only)
|
||||
var S_E = 5;//attr value end and no space(quot end)
|
||||
var S_S = 6;//(attr value end || tag end ) && (space offer)
|
||||
var S_C = 7;//closed el<el />
|
||||
var S_ATTR_NOQUOT_VALUE = 4;//attr value(no quot value only)
|
||||
var S_ATTR_END = 5;//attr value end and no space(quot end)
|
||||
var S_TAG_SPACE = 6;//(attr value end || tag end ) && (space offer)
|
||||
var S_TAG_CLOSE = 7;//closed el<el />
|
||||
|
||||
function XMLReader(){
|
||||
|
||||
@@ -33,7 +33,7 @@ XMLReader.prototype = {
|
||||
}
|
||||
}
|
||||
function parse(source,defaultNSMapCopy,entityMap,domBuilder,errorHandler){
|
||||
function fixedFromCharCode(code) {
|
||||
function fixedFromCharCode(code) {
|
||||
// String.prototype.fromCharCode does not supports
|
||||
// > 2 bytes unicode chars directly
|
||||
if (code > 0xffff) {
|
||||
@@ -76,7 +76,7 @@ function parse(source,defaultNSMapCopy,entityMap,domBuilder,errorHandler){
|
||||
}
|
||||
var lineStart = 0;
|
||||
var lineEnd = 0;
|
||||
var linePattern = /.+(?:\r\n?|\n)|.*$/g
|
||||
var linePattern = /.*(?:\r\n?|\n)|.*$/g
|
||||
var locator = domBuilder.locator;
|
||||
|
||||
var parseStack = [{currentNSMap:defaultNSMapCopy}]
|
||||
@@ -87,7 +87,7 @@ function parse(source,defaultNSMapCopy,entityMap,domBuilder,errorHandler){
|
||||
var tagStart = source.indexOf('<',start);
|
||||
if(tagStart<0){
|
||||
if(!source.substr(start).match(/^\s*$/)){
|
||||
var doc = domBuilder.document;
|
||||
var doc = domBuilder.doc;
|
||||
var text = doc.createTextNode(source.substr(start));
|
||||
doc.appendChild(text);
|
||||
domBuilder.currentElement = text;
|
||||
@@ -102,16 +102,36 @@ function parse(source,defaultNSMapCopy,entityMap,domBuilder,errorHandler){
|
||||
var end = source.indexOf('>',tagStart+3);
|
||||
var tagName = source.substring(tagStart+2,end);
|
||||
var config = parseStack.pop();
|
||||
var localNSMap = config.localNSMap;
|
||||
if(config.tagName != tagName){
|
||||
errorHandler.fatalError("end tag name: "+tagName+' is not match the current start tagName:'+config.tagName );
|
||||
}
|
||||
domBuilder.endElement(config.uri,config.localName,tagName);
|
||||
if(localNSMap){
|
||||
for(var prefix in localNSMap){
|
||||
domBuilder.endPrefixMapping(prefix) ;
|
||||
}
|
||||
if(end<0){
|
||||
|
||||
tagName = source.substring(tagStart+2).replace(/[\s<].*/,'');
|
||||
//console.error('#@@@@@@'+tagName)
|
||||
errorHandler.error("end tag name: "+tagName+' is not complete:'+config.tagName);
|
||||
end = tagStart+1+tagName.length;
|
||||
}else if(tagName.match(/\s</)){
|
||||
tagName = tagName.replace(/[\s<].*/,'');
|
||||
errorHandler.error("end tag name: "+tagName+' maybe not complete');
|
||||
end = tagStart+1+tagName.length;
|
||||
}
|
||||
//console.error(parseStack.length,parseStack)
|
||||
//console.error(config);
|
||||
var localNSMap = config.localNSMap;
|
||||
var endMatch = config.tagName == tagName;
|
||||
var endIgnoreCaseMach = endMatch || config.tagName&&config.tagName.toLowerCase() == tagName.toLowerCase()
|
||||
if(endIgnoreCaseMach){
|
||||
domBuilder.endElement(config.uri,config.localName,tagName);
|
||||
if(localNSMap){
|
||||
for(var prefix in localNSMap){
|
||||
domBuilder.endPrefixMapping(prefix) ;
|
||||
}
|
||||
}
|
||||
if(!endMatch){
|
||||
errorHandler.fatalError("end tag name: "+tagName+' is not match the current start tagName:'+config.tagName );
|
||||
}
|
||||
}else{
|
||||
parseStack.push(config)
|
||||
}
|
||||
|
||||
end++;
|
||||
break;
|
||||
// end elment
|
||||
@@ -124,33 +144,40 @@ function parse(source,defaultNSMapCopy,entityMap,domBuilder,errorHandler){
|
||||
end = parseDCC(source,tagStart,domBuilder,errorHandler);
|
||||
break;
|
||||
default:
|
||||
|
||||
locator&&position(tagStart);
|
||||
|
||||
var el = new ElementAttributes();
|
||||
|
||||
var currentNSMap = parseStack[parseStack.length-1].currentNSMap;
|
||||
//elStartEnd
|
||||
var end = parseElementStartPart(source,tagStart,el,entityReplacer,errorHandler);
|
||||
var end = parseElementStartPart(source,tagStart,el,currentNSMap,entityReplacer,errorHandler);
|
||||
var len = el.length;
|
||||
|
||||
if(locator){
|
||||
if(len){
|
||||
//attribute position fixed
|
||||
for(var i = 0;i<len;i++){
|
||||
var a = el[i];
|
||||
position(a.offset);
|
||||
a.offset = copyLocator(locator,{});
|
||||
}
|
||||
}
|
||||
position(end);
|
||||
}
|
||||
|
||||
if(!el.closed && fixSelfClosed(source,end,el.tagName,closeMap)){
|
||||
el.closed = true;
|
||||
if(!entityMap.nbsp){
|
||||
errorHandler.warning('unclosed xml attribute');
|
||||
}
|
||||
}
|
||||
appendElement(el,domBuilder,parseStack);
|
||||
if(locator && len){
|
||||
var locator2 = copyLocator(locator,{});
|
||||
//try{//attribute position fixed
|
||||
for(var i = 0;i<len;i++){
|
||||
var a = el[i];
|
||||
position(a.offset);
|
||||
a.locator = copyLocator(locator,{});
|
||||
}
|
||||
//}catch(e){console.error('@@@@@'+e)}
|
||||
domBuilder.locator = locator2
|
||||
if(appendElement(el,domBuilder,currentNSMap)){
|
||||
parseStack.push(el)
|
||||
}
|
||||
domBuilder.locator = locator;
|
||||
}else{
|
||||
if(appendElement(el,domBuilder,currentNSMap)){
|
||||
parseStack.push(el)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
if(el.uri === 'http://www.w3.org/1999/xhtml' && !el.closed){
|
||||
@@ -160,8 +187,10 @@ function parse(source,defaultNSMapCopy,entityMap,domBuilder,errorHandler){
|
||||
}
|
||||
}
|
||||
}catch(e){
|
||||
errorHandler.error('element parse error: '+e);
|
||||
errorHandler.error('element parse error: '+e)
|
||||
//errorHandler.error('element parse error: '+e);
|
||||
end = -1;
|
||||
//throw e;
|
||||
}
|
||||
if(end>start){
|
||||
start = end;
|
||||
@@ -181,7 +210,7 @@ function copyLocator(f,t){
|
||||
* @see #appendElement(source,elStartEnd,el,selfClosed,entityReplacer,domBuilder,parseStack);
|
||||
* @return end of the elementStartPart(end of elementEndPart for selfClosed el)
|
||||
*/
|
||||
function parseElementStartPart(source,start,el,entityReplacer,errorHandler){
|
||||
function parseElementStartPart(source,start,el,currentNSMap,entityReplacer,errorHandler){
|
||||
var attrName;
|
||||
var value;
|
||||
var p = ++start;
|
||||
@@ -193,7 +222,7 @@ function parseElementStartPart(source,start,el,entityReplacer,errorHandler){
|
||||
if(s === S_ATTR){//attrName
|
||||
attrName = source.slice(start,p);
|
||||
s = S_EQ;
|
||||
}else if(s === S_ATTR_S){
|
||||
}else if(s === S_ATTR_SPACE){
|
||||
s = S_EQ;
|
||||
}else{
|
||||
//fatalError: equal must after attrName or space after attrName
|
||||
@@ -202,25 +231,30 @@ function parseElementStartPart(source,start,el,entityReplacer,errorHandler){
|
||||
break;
|
||||
case '\'':
|
||||
case '"':
|
||||
if(s === S_EQ){//equal
|
||||
if(s === S_EQ || s === S_ATTR //|| s == S_ATTR_SPACE
|
||||
){//equal
|
||||
if(s === S_ATTR){
|
||||
errorHandler.warning('attribute value must after "="')
|
||||
attrName = source.slice(start,p)
|
||||
}
|
||||
start = p+1;
|
||||
p = source.indexOf(c,start)
|
||||
if(p>0){
|
||||
value = source.slice(start,p).replace(/&#?\w+;/g,entityReplacer);
|
||||
el.add(attrName,value,start-1);
|
||||
s = S_E;
|
||||
s = S_ATTR_END;
|
||||
}else{
|
||||
//fatalError: no end quot match
|
||||
throw new Error('attribute value no end \''+c+'\' match');
|
||||
}
|
||||
}else if(s == S_V){
|
||||
}else if(s == S_ATTR_NOQUOT_VALUE){
|
||||
value = source.slice(start,p).replace(/&#?\w+;/g,entityReplacer);
|
||||
//console.log(attrName,value,start,p)
|
||||
el.add(attrName,value,start);
|
||||
//console.dir(el)
|
||||
errorHandler.warning('attribute "'+attrName+'" missed start quot('+c+')!!');
|
||||
start = p+1;
|
||||
s = S_E
|
||||
s = S_ATTR_END
|
||||
}else{
|
||||
//fatalError: no equal before
|
||||
throw new Error('attribute value must after "="');
|
||||
@@ -230,14 +264,14 @@ function parseElementStartPart(source,start,el,entityReplacer,errorHandler){
|
||||
switch(s){
|
||||
case S_TAG:
|
||||
el.setTagName(source.slice(start,p));
|
||||
case S_E:
|
||||
case S_S:
|
||||
case S_C:
|
||||
s = S_C;
|
||||
case S_ATTR_END:
|
||||
case S_TAG_SPACE:
|
||||
case S_TAG_CLOSE:
|
||||
s =S_TAG_CLOSE;
|
||||
el.closed = true;
|
||||
case S_V:
|
||||
case S_ATTR_NOQUOT_VALUE:
|
||||
case S_ATTR:
|
||||
case S_ATTR_S:
|
||||
case S_ATTR_SPACE:
|
||||
break;
|
||||
//case S_EQ:
|
||||
default:
|
||||
@@ -247,30 +281,36 @@ function parseElementStartPart(source,start,el,entityReplacer,errorHandler){
|
||||
case ''://end document
|
||||
//throw new Error('unexpected end of input')
|
||||
errorHandler.error('unexpected end of input');
|
||||
if(s == S_TAG){
|
||||
el.setTagName(source.slice(start,p));
|
||||
}
|
||||
return p;
|
||||
case '>':
|
||||
switch(s){
|
||||
case S_TAG:
|
||||
el.setTagName(source.slice(start,p));
|
||||
case S_E:
|
||||
case S_S:
|
||||
case S_C:
|
||||
case S_ATTR_END:
|
||||
case S_TAG_SPACE:
|
||||
case S_TAG_CLOSE:
|
||||
break;//normal
|
||||
case S_V://Compatible state
|
||||
case S_ATTR_NOQUOT_VALUE://Compatible state
|
||||
case S_ATTR:
|
||||
value = source.slice(start,p);
|
||||
if(value.slice(-1) === '/'){
|
||||
el.closed = true;
|
||||
value = value.slice(0,-1)
|
||||
}
|
||||
case S_ATTR_S:
|
||||
if(s === S_ATTR_S){
|
||||
case S_ATTR_SPACE:
|
||||
if(s === S_ATTR_SPACE){
|
||||
value = attrName;
|
||||
}
|
||||
if(s == S_V){
|
||||
if(s == S_ATTR_NOQUOT_VALUE){
|
||||
errorHandler.warning('attribute "'+value+'" missed quot(")!!');
|
||||
el.add(attrName,value.replace(/&#?\w+;/g,entityReplacer),start)
|
||||
}else{
|
||||
errorHandler.warning('attribute "'+value+'" missed value!! "'+value+'" instead!!')
|
||||
if(currentNSMap[''] !== 'http://www.w3.org/1999/xhtml' || !value.match(/^(?:disabled|checked|selected)$/i)){
|
||||
errorHandler.warning('attribute "'+value+'" missed value!! "'+value+'" instead!!')
|
||||
}
|
||||
el.add(value,value,start)
|
||||
}
|
||||
break;
|
||||
@@ -287,64 +327,68 @@ function parseElementStartPart(source,start,el,entityReplacer,errorHandler){
|
||||
switch(s){
|
||||
case S_TAG:
|
||||
el.setTagName(source.slice(start,p));//tagName
|
||||
s = S_S;
|
||||
s = S_TAG_SPACE;
|
||||
break;
|
||||
case S_ATTR:
|
||||
attrName = source.slice(start,p)
|
||||
s = S_ATTR_S;
|
||||
s = S_ATTR_SPACE;
|
||||
break;
|
||||
case S_V:
|
||||
case S_ATTR_NOQUOT_VALUE:
|
||||
var value = source.slice(start,p).replace(/&#?\w+;/g,entityReplacer);
|
||||
errorHandler.warning('attribute "'+value+'" missed quot(")!!');
|
||||
el.add(attrName,value,start)
|
||||
case S_E:
|
||||
s = S_S;
|
||||
case S_ATTR_END:
|
||||
s = S_TAG_SPACE;
|
||||
break;
|
||||
//case S_S:
|
||||
//case S_TAG_SPACE:
|
||||
//case S_EQ:
|
||||
//case S_ATTR_S:
|
||||
//case S_ATTR_SPACE:
|
||||
// void();break;
|
||||
//case S_C:
|
||||
//case S_TAG_CLOSE:
|
||||
//ignore warning
|
||||
}
|
||||
}else{//not space
|
||||
//S_TAG, S_ATTR, S_EQ, S_V
|
||||
//S_ATTR_S, S_E, S_S, S_C
|
||||
//S_TAG, S_ATTR, S_EQ, S_ATTR_NOQUOT_VALUE
|
||||
//S_ATTR_SPACE, S_ATTR_END, S_TAG_SPACE, S_TAG_CLOSE
|
||||
switch(s){
|
||||
//case S_TAG:void();break;
|
||||
//case S_ATTR:void();break;
|
||||
//case S_V:void();break;
|
||||
case S_ATTR_S:
|
||||
errorHandler.warning('attribute "'+attrName+'" missed value!! "'+attrName+'" instead!!')
|
||||
//case S_ATTR_NOQUOT_VALUE:void();break;
|
||||
case S_ATTR_SPACE:
|
||||
var tagName = el.tagName;
|
||||
if(currentNSMap[''] !== 'http://www.w3.org/1999/xhtml' || !attrName.match(/^(?:disabled|checked|selected)$/i)){
|
||||
errorHandler.warning('attribute "'+attrName+'" missed value!! "'+attrName+'" instead2!!')
|
||||
}
|
||||
el.add(attrName,attrName,start);
|
||||
start = p;
|
||||
s = S_ATTR;
|
||||
break;
|
||||
case S_E:
|
||||
case S_ATTR_END:
|
||||
errorHandler.warning('attribute space is required"'+attrName+'"!!')
|
||||
case S_S:
|
||||
case S_TAG_SPACE:
|
||||
s = S_ATTR;
|
||||
start = p;
|
||||
break;
|
||||
case S_EQ:
|
||||
s = S_V;
|
||||
s = S_ATTR_NOQUOT_VALUE;
|
||||
start = p;
|
||||
break;
|
||||
case S_C:
|
||||
case S_TAG_CLOSE:
|
||||
throw new Error("elements closed character '/' and '>' must be connected to");
|
||||
}
|
||||
}
|
||||
}
|
||||
}//end outer switch
|
||||
//console.log('p++',p)
|
||||
p++;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* @return end of the elementStartPart(end of elementEndPart for selfClosed el)
|
||||
* @return true if has new namespace define
|
||||
*/
|
||||
function appendElement(el,domBuilder,parseStack){
|
||||
function appendElement(el,domBuilder,currentNSMap){
|
||||
var tagName = el.tagName;
|
||||
var localNSMap = null;
|
||||
var currentNSMap = parseStack[parseStack.length-1].currentNSMap;
|
||||
//var currentNSMap = parseStack[parseStack.length-1].currentNSMap;
|
||||
var i = el.length;
|
||||
while(i--){
|
||||
var a = el[i];
|
||||
@@ -383,7 +427,7 @@ function appendElement(el,domBuilder,parseStack){
|
||||
if(prefix === 'xml'){
|
||||
a.uri = 'http://www.w3.org/XML/1998/namespace';
|
||||
}if(prefix !== 'xmlns'){
|
||||
a.uri = currentNSMap[prefix]
|
||||
a.uri = currentNSMap[prefix || '']
|
||||
|
||||
//{console.log('###'+a.qName,domBuilder.locator.systemId+'',currentNSMap,a.uri)}
|
||||
}
|
||||
@@ -412,7 +456,8 @@ function appendElement(el,domBuilder,parseStack){
|
||||
}else{
|
||||
el.currentNSMap = currentNSMap;
|
||||
el.localNSMap = localNSMap;
|
||||
parseStack.push(el);
|
||||
//parseStack.push(el);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
function parseHtmlSpecialContent(source,elStartEnd,tagName,entityReplacer,domBuilder){
|
||||
@@ -442,7 +487,11 @@ function fixSelfClosed(source,elStartEnd,tagName,closeMap){
|
||||
var pos = closeMap[tagName];
|
||||
if(pos == null){
|
||||
//console.log(tagName)
|
||||
pos = closeMap[tagName] = source.lastIndexOf('</'+tagName+'>')
|
||||
pos = source.lastIndexOf('</'+tagName+'>')
|
||||
if(pos<elStartEnd){//忘记闭合
|
||||
pos = source.lastIndexOf('</'+tagName)
|
||||
}
|
||||
closeMap[tagName] =pos
|
||||
}
|
||||
return pos<elStartEnd;
|
||||
//}
|
||||
@@ -533,7 +582,7 @@ ElementAttributes.prototype = {
|
||||
},
|
||||
length:0,
|
||||
getLocalName:function(i){return this[i].localName},
|
||||
getOffset:function(i){return this[i].offset},
|
||||
getLocator:function(i){return this[i].locator},
|
||||
getQName:function(i){return this[i].qName},
|
||||
getURI:function(i){return this[i].uri},
|
||||
getValue:function(i){return this[i].value}
|
||||
@@ -580,7 +629,5 @@ function split(source,start){
|
||||
}
|
||||
}
|
||||
|
||||
if(typeof require == 'function'){
|
||||
exports.XMLReader = XMLReader;
|
||||
}
|
||||
exports.XMLReader = XMLReader;
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "cordova-android",
|
||||
"version": "6.1.2",
|
||||
"version": "6.2.3",
|
||||
"description": "cordova-android release",
|
||||
"bin": {
|
||||
"create": "bin/create"
|
||||
@@ -24,8 +24,8 @@
|
||||
"author": "Apache Software Foundation",
|
||||
"license": "Apache-2.0",
|
||||
"dependencies": {
|
||||
"cordova-common": "^1.5.0",
|
||||
"elementtree": "^0.1.6",
|
||||
"cordova-common": "^2.0.1",
|
||||
"elementtree": "0.1.6",
|
||||
"nopt": "^3.0.1",
|
||||
"properties-parser": "^0.2.3",
|
||||
"q": "^1.4.1",
|
||||
|
||||
@@ -78,14 +78,6 @@ describe('update', function() {
|
||||
|
||||
}, UPDATE_TIMEOUT);
|
||||
|
||||
it('Test#003 : should downgrade major version and build the project', function(done) {
|
||||
var projectname = 'testupdate';
|
||||
var projectid = 'com.test.update.app2';
|
||||
|
||||
testUpdate(projectname, projectid, platformEdge, platformOld, true, done);
|
||||
}, UPDATE_TIMEOUT);
|
||||
|
||||
// TODO: After next Android release, add tests for minor/patch version update
|
||||
});
|
||||
|
||||
describe('cleanup', function () {
|
||||
|
||||
7
spec/fixtures/sdk25.2-android_list_avd.txt
vendored
Normal file
7
spec/fixtures/sdk25.2-android_list_avd.txt
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
Available Android Virtual Devices:
|
||||
Name: QWR
|
||||
Device: Nexus 5 (Google)
|
||||
Path: /Users/shazron/.android/avd/QWR.avd
|
||||
Target: Android 7.1.1 (API level 25)
|
||||
Tag/ABI: google_apis/x86_64
|
||||
Skin: 1080x1920
|
||||
116
spec/fixtures/sdk25.2-android_list_targets.txt
vendored
Normal file
116
spec/fixtures/sdk25.2-android_list_targets.txt
vendored
Normal file
@@ -0,0 +1,116 @@
|
||||
Available Android targets:
|
||||
----------
|
||||
id: 1 or "android-20"
|
||||
Name: Android 4.4W.2
|
||||
Type: Platform
|
||||
API level: 20
|
||||
Revision: 2
|
||||
Skins: HVGA, QVGA, WQVGA400, WQVGA432, WSVGA, WVGA800 (default), WVGA854, WXGA720, WXGA800, WXGA800-7in
|
||||
Tag/ABIs : no ABIs.
|
||||
----------
|
||||
id: 2 or "android-21"
|
||||
Name: Android 5.0.1
|
||||
Type: Platform
|
||||
API level: 21
|
||||
Revision: 2
|
||||
Skins: HVGA, QVGA, WQVGA400, WQVGA432, WSVGA, WVGA800 (default), WVGA854, WXGA720, WXGA800, WXGA800-7in
|
||||
Tag/ABIs : android-tv/armeabi-v7a, android-tv/x86, default/armeabi-v7a, default/x86, default/x86_64
|
||||
----------
|
||||
id: 3 or "android-22"
|
||||
Name: Android 5.1.1
|
||||
Type: Platform
|
||||
API level: 22
|
||||
Revision: 2
|
||||
Skins: HVGA, QVGA, WQVGA400, WQVGA432, WSVGA, WVGA800 (default), WVGA854, WXGA720, WXGA800, WXGA800-7in
|
||||
Tag/ABIs : android-tv/armeabi-v7a, android-tv/x86, default/armeabi-v7a, default/x86, default/x86_64
|
||||
----------
|
||||
id: 4 or "android-MNC"
|
||||
Name: Android M (Preview)
|
||||
Type: Platform
|
||||
API level: MNC
|
||||
Revision: 1
|
||||
Skins: HVGA, QVGA, WQVGA400, WQVGA432, WSVGA, WVGA800 (default), WVGA854, WXGA720, WXGA800, WXGA800-7in
|
||||
Tag/ABIs : no ABIs.
|
||||
----------
|
||||
id: 5 or "android-23"
|
||||
Name: Android 6.0
|
||||
Type: Platform
|
||||
API level: 23
|
||||
Revision: 3
|
||||
Skins: HVGA, QVGA, WQVGA400, WQVGA432, WSVGA, WVGA800 (default), WVGA854, WXGA720, WXGA800, WXGA800-7in
|
||||
Tag/ABIs : android-tv/armeabi-v7a, android-tv/x86, default/x86, default/x86_64
|
||||
----------
|
||||
id: 6 or "android-N"
|
||||
Name: Android N (Preview)
|
||||
Type: Platform
|
||||
API level: N
|
||||
Revision: 3
|
||||
Skins: HVGA, QVGA, WQVGA400, WQVGA432, WSVGA, WVGA800 (default), WVGA854, WXGA720, WXGA800, WXGA800-7in
|
||||
Tag/ABIs : no ABIs.
|
||||
----------
|
||||
id: 7 or "android-24"
|
||||
Name: Android 7.0
|
||||
Type: Platform
|
||||
API level: 24
|
||||
Revision: 2
|
||||
Skins: HVGA, QVGA, WQVGA400, WQVGA432, WSVGA, WVGA800 (default), WVGA854, WXGA720, WXGA800, WXGA800-7in
|
||||
Tag/ABIs : android-tv/x86, default/x86, default/x86_64
|
||||
----------
|
||||
id: 8 or "android-25"
|
||||
Name: Android 7.1.1
|
||||
Type: Platform
|
||||
API level: 25
|
||||
Revision: 3
|
||||
Skins: HVGA, QVGA, WQVGA400, WQVGA432, WSVGA, WVGA800 (default), WVGA854, WXGA720, WXGA800, WXGA800-7in
|
||||
Tag/ABIs : android-tv/x86, google_apis/x86, google_apis/x86_64
|
||||
----------
|
||||
id: 9 or "Google Inc.:Google APIs:21"
|
||||
Name: Google APIs
|
||||
Type: Add-On
|
||||
Vendor: Google Inc.
|
||||
Revision: 1
|
||||
Description: Android + Google APIs
|
||||
Based on Android 5.0.1 (API level 21)
|
||||
Libraries:
|
||||
* com.android.future.usb.accessory (usb.jar)
|
||||
API for USB Accessories
|
||||
* com.google.android.media.effects (effects.jar)
|
||||
Collection of video effects
|
||||
* com.google.android.maps (maps.jar)
|
||||
API for Google Maps
|
||||
Skins: HVGA, QVGA, WQVGA400, WQVGA432, WSVGA, WVGA800 (default), WVGA854, WXGA720, WXGA800, WXGA800-7in
|
||||
Tag/ABIs : google_apis/armeabi-v7a, google_apis/x86, google_apis/x86_64
|
||||
----------
|
||||
id: 10 or "Google Inc.:Google APIs:22"
|
||||
Name: Google APIs
|
||||
Type: Add-On
|
||||
Vendor: Google Inc.
|
||||
Revision: 1
|
||||
Description: Android + Google APIs
|
||||
Based on Android 5.1.1 (API level 22)
|
||||
Libraries:
|
||||
* com.android.future.usb.accessory (usb.jar)
|
||||
API for USB Accessories
|
||||
* com.google.android.media.effects (effects.jar)
|
||||
Collection of video effects
|
||||
* com.google.android.maps (maps.jar)
|
||||
API for Google Maps
|
||||
Skins: HVGA, QVGA, WQVGA400, WQVGA432, WSVGA, WVGA800 (default), WVGA854, WXGA720, WXGA800, WXGA800-7in
|
||||
Tag/ABIs : google_apis/armeabi-v7a, google_apis/x86, google_apis/x86_64
|
||||
----------
|
||||
id: 11 or "Google Inc.:Google APIs:23"
|
||||
Name: Google APIs
|
||||
Type: Add-On
|
||||
Vendor: Google Inc.
|
||||
Revision: 1
|
||||
Description: Android + Google APIs
|
||||
Based on Android 6.0 (API level 23)
|
||||
Libraries:
|
||||
* com.android.future.usb.accessory (usb.jar)
|
||||
API for USB Accessories
|
||||
* com.google.android.media.effects (effects.jar)
|
||||
Collection of video effects
|
||||
* com.google.android.maps (maps.jar)
|
||||
API for Google Maps
|
||||
Skins: HVGA, QVGA, WQVGA400, WQVGA432, WSVGA, WVGA800 (default), WVGA854, WXGA720, WXGA800, WXGA800-7in
|
||||
Tag/ABIs : google_apis/armeabi-v7a, google_apis/x86, google_apis/x86_64
|
||||
22
spec/fixtures/sdk25.3-avdmanager_list_avd.txt
vendored
Normal file
22
spec/fixtures/sdk25.3-avdmanager_list_avd.txt
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
Available Android Virtual Devices:
|
||||
Name: nexus5-5.1
|
||||
Device: Nexus 5 (Google)
|
||||
Path: /Users/maj/.android/avd/nexus5-5.1.avd
|
||||
Target: Google APIs
|
||||
Based on: Android 5.1 (Lollipop) Tag/ABI: google_apis/x86_64
|
||||
Skin: 1080x1920
|
||||
Sdcard: 128M
|
||||
---------
|
||||
Name: Pixel_API_25
|
||||
Device: pixel (Google)
|
||||
Path: /Users/maj/.android/avd/Pixel_API_25.avd
|
||||
Target: Google APIs
|
||||
Based on: Android 7.1.1 (Nougat) Tag/ABI: google_apis/x86_64
|
||||
Skin: pixel
|
||||
Sdcard: 100M
|
||||
---------
|
||||
Name: stock51
|
||||
Path: /Users/maj/.android/avd/stock51.avd
|
||||
Target: Default
|
||||
Based on: Android 5.1 (Lollipop) Tag/ABI: default/x86_64
|
||||
Sdcard: 128M
|
||||
7
spec/fixtures/sdk25.3-avdmanager_list_target.txt
vendored
Normal file
7
spec/fixtures/sdk25.3-avdmanager_list_target.txt
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
Available Android targets:
|
||||
----------
|
||||
id: 1 or "android-25"
|
||||
Name: Android API 25
|
||||
Type: Platform
|
||||
API level: 25
|
||||
Revision: 3
|
||||
132
spec/unit/android_sdk.spec.js
Normal file
132
spec/unit/android_sdk.spec.js
Normal file
@@ -0,0 +1,132 @@
|
||||
/**
|
||||
Licensed to the Apache Software Foundation (ASF) under one
|
||||
or more contributor license agreements. See the NOTICE file
|
||||
distributed with this work for additional information
|
||||
regarding copyright ownership. The ASF licenses this file
|
||||
to you under the Apache License, Version 2.0 (the
|
||||
"License"); you may not use this file except in compliance
|
||||
with the License. You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing,
|
||||
software distributed under the License is distributed on an
|
||||
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
KIND, either express or implied. See the License for the
|
||||
specific language governing permissions and limitations
|
||||
under the License.
|
||||
*/
|
||||
/* jshint laxcomma:true */
|
||||
|
||||
var android_sdk = require("../../bin/templates/cordova/lib/android_sdk");
|
||||
var superspawn = require("cordova-common").superspawn;
|
||||
var fs = require("fs");
|
||||
var path = require("path");
|
||||
var Q = require("q");
|
||||
|
||||
describe("android_sdk", function () {
|
||||
describe("list_targets_with_android", function() {
|
||||
it("should invoke `android` with the `list target` command and _not_ the `list targets` command, as the plural form is not supported in some Android SDK Tools versions", function() {
|
||||
var deferred = Q.defer();
|
||||
spyOn(superspawn, "spawn").and.returnValue(deferred.promise);
|
||||
android_sdk.list_targets_with_android();
|
||||
expect(superspawn.spawn).toHaveBeenCalledWith("android", ["list", "target"]);
|
||||
});
|
||||
it("should parse and return results from `android list targets` command", function(done) {
|
||||
var deferred = Q.defer();
|
||||
spyOn(superspawn, "spawn").and.returnValue(deferred.promise);
|
||||
deferred.resolve(fs.readFileSync(path.join("spec", "fixtures", "sdk25.2-android_list_targets.txt"), "utf-8"));
|
||||
return android_sdk.list_targets_with_android()
|
||||
.then(function(list) {
|
||||
[ "Google Inc.:Google APIs:23",
|
||||
"Google Inc.:Google APIs:22",
|
||||
"Google Inc.:Google APIs:21",
|
||||
"android-25",
|
||||
"android-24",
|
||||
"android-N",
|
||||
"android-23",
|
||||
"android-MNC",
|
||||
"android-22",
|
||||
"android-21",
|
||||
"android-20" ].forEach(function(target) {
|
||||
expect(list).toContain(target);
|
||||
});
|
||||
}).fail(function(err) {
|
||||
console.log(err);
|
||||
expect(err).toBeUndefined();
|
||||
}).fin(function() {
|
||||
done();
|
||||
});
|
||||
});
|
||||
});
|
||||
describe("list_targets_with_avdmanager", function() {
|
||||
it("should parse and return results from `avdmanager list target` command", function(done) {
|
||||
var deferred = Q.defer();
|
||||
spyOn(superspawn, "spawn").and.returnValue(deferred.promise);
|
||||
deferred.resolve(fs.readFileSync(path.join("spec", "fixtures", "sdk25.3-avdmanager_list_target.txt"), "utf-8"));
|
||||
return android_sdk.list_targets_with_avdmanager()
|
||||
.then(function(list) {
|
||||
expect(list).toContain("android-25");
|
||||
}).fail(function(err) {
|
||||
console.log(err);
|
||||
expect(err).toBeUndefined();
|
||||
}).fin(function() {
|
||||
done();
|
||||
});
|
||||
});
|
||||
});
|
||||
describe("list_targets", function() {
|
||||
it("should parse Android SDK installed target information with `avdmanager` command first", function() {
|
||||
var deferred = Q.defer();
|
||||
var avdmanager_spy = spyOn(android_sdk, "list_targets_with_avdmanager").and.returnValue(deferred.promise);
|
||||
android_sdk.list_targets();
|
||||
expect(avdmanager_spy).toHaveBeenCalled();
|
||||
});
|
||||
it("should parse Android SDK installed target information with `android` command if list_targets_with_avdmanager fails with ENOENT", function(done) {
|
||||
var deferred = Q.defer();
|
||||
spyOn(android_sdk, "list_targets_with_avdmanager").and.returnValue(deferred.promise);
|
||||
deferred.reject({
|
||||
code: "ENOENT"
|
||||
});
|
||||
var twoferred = Q.defer();
|
||||
twoferred.resolve(["target1"]);
|
||||
var avdmanager_spy = spyOn(android_sdk, "list_targets_with_android").and.returnValue(twoferred.promise);
|
||||
return android_sdk.list_targets()
|
||||
.then(function(targets) {
|
||||
expect(avdmanager_spy).toHaveBeenCalled();
|
||||
expect(targets[0]).toEqual("target1");
|
||||
done();
|
||||
});
|
||||
});
|
||||
it("should parse Android SDK installed target information with `android` command if list_targets_with_avdmanager fails with not-recognized error (Windows)", function(done) {
|
||||
var deferred = Q.defer();
|
||||
spyOn(android_sdk, "list_targets_with_avdmanager").and.returnValue(deferred.promise);
|
||||
deferred.reject({
|
||||
code: 1,
|
||||
stderr: "'avdmanager' is not recognized as an internal or external commmand,\r\noperable program or batch file.\r\n"
|
||||
});
|
||||
var twoferred = Q.defer();
|
||||
twoferred.resolve(["target1"]);
|
||||
var avdmanager_spy = spyOn(android_sdk, "list_targets_with_android").and.returnValue(twoferred.promise);
|
||||
return android_sdk.list_targets()
|
||||
.then(function(targets) {
|
||||
expect(avdmanager_spy).toHaveBeenCalled();
|
||||
expect(targets[0]).toEqual("target1");
|
||||
done();
|
||||
});
|
||||
});
|
||||
it("should throw an error if no Android targets were found.", function(done) {
|
||||
var deferred = Q.defer();
|
||||
spyOn(android_sdk, "list_targets_with_avdmanager").and.returnValue(deferred.promise);
|
||||
deferred.resolve([]);
|
||||
return android_sdk.list_targets()
|
||||
.then(function(targets) {
|
||||
done.fail();
|
||||
}).catch(function(err) {
|
||||
expect(err).toBeDefined();
|
||||
expect(err.message).toContain("No android targets (SDKs) installed!");
|
||||
done();
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
251
spec/unit/check_reqs.spec.js
Normal file
251
spec/unit/check_reqs.spec.js
Normal file
@@ -0,0 +1,251 @@
|
||||
/**
|
||||
Licensed to the Apache Software Foundation (ASF) under one
|
||||
or more contributor license agreements. See the NOTICE file
|
||||
distributed with this work for additional information
|
||||
regarding copyright ownership. The ASF licenses this file
|
||||
to you under the Apache License, Version 2.0 (the
|
||||
"License"); you may not use this file except in compliance
|
||||
with the License. You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing,
|
||||
software distributed under the License is distributed on an
|
||||
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
KIND, either express or implied. See the License for the
|
||||
specific language governing permissions and limitations
|
||||
under the License.
|
||||
*/
|
||||
/* jshint laxcomma:true */
|
||||
|
||||
var check_reqs = require("../../bin/templates/cordova/lib/check_reqs");
|
||||
var android_sdk = require("../../bin/templates/cordova/lib/android_sdk");
|
||||
var shelljs = require("shelljs");
|
||||
var fs = require("fs");
|
||||
var path = require("path");
|
||||
var Q = require("q");
|
||||
|
||||
describe("check_reqs", function () {
|
||||
var original_env;
|
||||
beforeAll(function() {
|
||||
original_env = Object.create(process.env);
|
||||
});
|
||||
afterEach(function() {
|
||||
Object.keys(original_env).forEach(function(k) {
|
||||
process.env[k] = original_env[k];
|
||||
});
|
||||
});
|
||||
describe("check_android", function() {
|
||||
describe("set ANDROID_HOME if not set", function() {
|
||||
beforeEach(function() {
|
||||
delete process.env.ANDROID_HOME;
|
||||
});
|
||||
describe("even if no Android binaries are on the PATH", function() {
|
||||
beforeEach(function() {
|
||||
spyOn(shelljs, "which").and.returnValue(null);
|
||||
spyOn(fs, "existsSync").and.returnValue(true);
|
||||
});
|
||||
it("it should set ANDROID_HOME on Windows", function(done) {
|
||||
spyOn(check_reqs, "isWindows").and.returnValue(true);
|
||||
process.env.LOCALAPPDATA = "windows-local-app-data";
|
||||
process.env.ProgramFiles = "windows-program-files";
|
||||
return check_reqs.check_android()
|
||||
.then(function() {
|
||||
expect(process.env.ANDROID_HOME).toContain("windows-local-app-data");
|
||||
}).fail(function(err) {
|
||||
expect(err).toBeUndefined();
|
||||
console.log(err);
|
||||
}).fin(function() {
|
||||
delete process.env.LOCALAPPDATA;
|
||||
delete process.env.ProgramFiles;
|
||||
done();
|
||||
});
|
||||
});
|
||||
it("it should set ANDROID_HOME on Darwin", function(done) {
|
||||
spyOn(check_reqs, "isWindows").and.returnValue(false);
|
||||
spyOn(check_reqs, "isDarwin").and.returnValue(true);
|
||||
process.env.HOME = "home is where the heart is";
|
||||
return check_reqs.check_android()
|
||||
.then(function() {
|
||||
expect(process.env.ANDROID_HOME).toContain("home is where the heart is");
|
||||
}).fail(function(err) {
|
||||
expect(err).toBeUndefined();
|
||||
console.log(err);
|
||||
}).fin(function() {
|
||||
delete process.env.HOME;
|
||||
done();
|
||||
});
|
||||
});
|
||||
});
|
||||
describe("if some Android tooling exists on the PATH", function() {
|
||||
beforeEach(function() {
|
||||
spyOn(fs, "realpathSync").and.callFake(function(path) {
|
||||
return path;
|
||||
});
|
||||
});
|
||||
it("should set ANDROID_HOME based on `android` command if command exists in a SDK-like directory structure", function(done) {
|
||||
spyOn(fs, "existsSync").and.returnValue(true);
|
||||
spyOn(shelljs, "which").and.callFake(function(cmd) {
|
||||
if (cmd == "android") {
|
||||
return "/android/sdk/tools/android";
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
});
|
||||
return check_reqs.check_android()
|
||||
.then(function() {
|
||||
expect(process.env.ANDROID_HOME).toEqual("/android/sdk");
|
||||
done();
|
||||
}).fail(function(err) {
|
||||
expect(err).toBeUndefined();
|
||||
console.log(err);
|
||||
});
|
||||
});
|
||||
it("should error out if `android` command exists in a non-SDK-like directory structure", function(done) {
|
||||
spyOn(shelljs, "which").and.callFake(function(cmd) {
|
||||
if (cmd == "android") {
|
||||
return "/just/some/random/path/android";
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
});
|
||||
return check_reqs.check_android()
|
||||
.then(function() {
|
||||
done.fail();
|
||||
}).fail(function(err) {
|
||||
expect(err).toBeDefined();
|
||||
expect(err.message).toContain("update your PATH to include valid path");
|
||||
done();
|
||||
});
|
||||
});
|
||||
it("should set ANDROID_HOME based on `adb` command if command exists in a SDK-like directory structure", function(done) {
|
||||
spyOn(fs, "existsSync").and.returnValue(true);
|
||||
spyOn(shelljs, "which").and.callFake(function(cmd) {
|
||||
if (cmd == "adb") {
|
||||
return "/android/sdk/platform-tools/adb";
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
});
|
||||
return check_reqs.check_android()
|
||||
.then(function() {
|
||||
expect(process.env.ANDROID_HOME).toEqual("/android/sdk");
|
||||
done();
|
||||
}).fail(function(err) {
|
||||
expect(err).toBeUndefined();
|
||||
console.log(err);
|
||||
});
|
||||
});
|
||||
it("should error out if `adb` command exists in a non-SDK-like directory structure", function(done) {
|
||||
spyOn(shelljs, "which").and.callFake(function(cmd) {
|
||||
if (cmd == "adb") {
|
||||
return "/just/some/random/path/adb";
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
});
|
||||
return check_reqs.check_android()
|
||||
.then(function() {
|
||||
done.fail();
|
||||
}).fail(function(err) {
|
||||
expect(err).toBeDefined();
|
||||
expect(err.message).toContain("update your PATH to include valid path");
|
||||
done();
|
||||
});
|
||||
});
|
||||
it("should set ANDROID_HOME based on `avdmanager` command if command exists in a SDK-like directory structure", function(done) {
|
||||
spyOn(fs, "existsSync").and.returnValue(true);
|
||||
spyOn(shelljs, "which").and.callFake(function(cmd) {
|
||||
if (cmd == "avdmanager") {
|
||||
return "/android/sdk/tools/bin/avdmanager";
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
});
|
||||
return check_reqs.check_android()
|
||||
.then(function() {
|
||||
expect(process.env.ANDROID_HOME).toEqual("/android/sdk");
|
||||
done();
|
||||
}).fail(function(err) {
|
||||
expect(err).toBeUndefined();
|
||||
console.log(err);
|
||||
});
|
||||
});
|
||||
it("should error out if `avdmanager` command exists in a non-SDK-like directory structure", function(done) {
|
||||
spyOn(shelljs, "which").and.callFake(function(cmd) {
|
||||
if (cmd == "avdmanager") {
|
||||
return "/just/some/random/path/avdmanager";
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
});
|
||||
return check_reqs.check_android()
|
||||
.then(function() {
|
||||
done.fail();
|
||||
}).fail(function(err) {
|
||||
expect(err).toBeDefined();
|
||||
expect(err.message).toContain("update your PATH to include valid path");
|
||||
done();
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
describe("set PATH for various Android binaries if not available", function() {
|
||||
beforeEach(function() {
|
||||
spyOn(shelljs, "which").and.returnValue(null);
|
||||
process.env.ANDROID_HOME = "let the children play";
|
||||
spyOn(fs, "existsSync").and.returnValue(true);
|
||||
});
|
||||
afterEach(function() {
|
||||
delete process.env.ANDROID_HOME;
|
||||
});
|
||||
it("should add tools/bin,tools,platform-tools to PATH if `avdmanager`,`android`,`adb` is not found", function(done) {
|
||||
return check_reqs.check_android()
|
||||
.then(function() {
|
||||
expect(process.env.PATH).toContain("let the children play" + path.sep + "tools");
|
||||
expect(process.env.PATH).toContain("let the children play" + path.sep + "platform-tools");
|
||||
expect(process.env.PATH).toContain("let the children play" + path.sep + "tools" + path.sep + "bin");
|
||||
done();
|
||||
}).fail(function(err) {
|
||||
expect(err).toBeUndefined();
|
||||
console.log(err);
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
describe("get_target", function() {
|
||||
it("should retrieve target from framework project.properties file", function() {
|
||||
var target = check_reqs.get_target();
|
||||
expect(target).toBeDefined();
|
||||
expect(target).toContain("android-");
|
||||
});
|
||||
});
|
||||
describe("check_android_target", function() {
|
||||
it("should should return full list of supported targets if there is a match to ideal api level", function(done) {
|
||||
var deferred = Q.defer();
|
||||
spyOn(android_sdk, "list_targets").and.returnValue(deferred.promise);
|
||||
var fake_targets = ["you are my fire", "my one desire"];
|
||||
deferred.resolve(fake_targets);
|
||||
spyOn(check_reqs, "get_target").and.returnValue("you are my fire");
|
||||
return check_reqs.check_android_target()
|
||||
.then(function(targets) {
|
||||
expect(targets).toBeDefined();
|
||||
expect(targets).toEqual(fake_targets);
|
||||
done();
|
||||
});
|
||||
});
|
||||
it("should error out if there is no match between ideal api level and installed targets", function(done) {
|
||||
var deferred = Q.defer();
|
||||
spyOn(android_sdk, "list_targets").and.returnValue(deferred.promise);
|
||||
var fake_targets = ["you are my fire", "my one desire"];
|
||||
deferred.resolve(fake_targets);
|
||||
spyOn(check_reqs, "get_target").and.returnValue("and i knowwwwwwwwwwww");
|
||||
return check_reqs.check_android_target()
|
||||
.catch(function(err) {
|
||||
expect(err).toBeDefined();
|
||||
expect(err.message).toContain("Please install Android target");
|
||||
done();
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
113
spec/unit/emulator.spec.js
Normal file
113
spec/unit/emulator.spec.js
Normal file
@@ -0,0 +1,113 @@
|
||||
/**
|
||||
Licensed to the Apache Software Foundation (ASF) under one
|
||||
or more contributor license agreements. See the NOTICE file
|
||||
distributed with this work for additional information
|
||||
regarding copyright ownership. The ASF licenses this file
|
||||
to you under the Apache License, Version 2.0 (the
|
||||
"License"); you may not use this file except in compliance
|
||||
with the License. You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing,
|
||||
software distributed under the License is distributed on an
|
||||
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
KIND, either express or implied. See the License for the
|
||||
specific language governing permissions and limitations
|
||||
under the License.
|
||||
*/
|
||||
var emu = require("../../bin/templates/cordova/lib/emulator");
|
||||
var superspawn = require("cordova-common").superspawn;
|
||||
var Q = require("q");
|
||||
var fs = require("fs");
|
||||
var path = require("path");
|
||||
var shelljs = require("shelljs");
|
||||
|
||||
describe("emulator", function () {
|
||||
describe("list_images_using_avdmanager", function() {
|
||||
it("should properly parse details of SDK Tools 25.3.1 `avdmanager` output", function(done) {
|
||||
var deferred = Q.defer();
|
||||
spyOn(superspawn, "spawn").and.returnValue(deferred.promise);
|
||||
deferred.resolve(fs.readFileSync(path.join("spec", "fixtures", "sdk25.3-avdmanager_list_avd.txt"), "utf-8"));
|
||||
return emu.list_images_using_avdmanager()
|
||||
.then(function(list) {
|
||||
expect(list).toBeDefined();
|
||||
expect(list[0].name).toEqual("nexus5-5.1");
|
||||
expect(list[0].target).toEqual("Android 5.1 (API level 22)");
|
||||
expect(list[1].device).toEqual("pixel (Google)");
|
||||
expect(list[2].abi).toEqual("default/x86_64");
|
||||
}).fail(function(err) {
|
||||
expect(err).toBeUndefined();
|
||||
}).fin(function() {
|
||||
done();
|
||||
});
|
||||
});
|
||||
});
|
||||
describe("list_images_using_android", function() {
|
||||
it("should invoke `android` with the `list avd` command and _not_ the `list avds` command, as the plural form is not supported in some Android SDK Tools versions", function() {
|
||||
var deferred = Q.defer();
|
||||
spyOn(superspawn, "spawn").and.returnValue(deferred.promise);
|
||||
emu.list_images_using_android();
|
||||
expect(superspawn.spawn).toHaveBeenCalledWith("android", ["list", "avd"]);
|
||||
});
|
||||
it("should properly parse details of SDK Tools pre-25.3.1 `android list avd` output", function(done) {
|
||||
var deferred = Q.defer();
|
||||
spyOn(superspawn, "spawn").and.returnValue(deferred.promise);
|
||||
deferred.resolve(fs.readFileSync(path.join("spec", "fixtures", "sdk25.2-android_list_avd.txt"), "utf-8"));
|
||||
return emu.list_images_using_android()
|
||||
.then(function(list) {
|
||||
expect(list).toBeDefined();
|
||||
expect(list[0].name).toEqual("QWR");
|
||||
expect(list[0].device).toEqual("Nexus 5 (Google)");
|
||||
expect(list[0].path).toEqual("/Users/shazron/.android/avd/QWR.avd");
|
||||
expect(list[0].target).toEqual("Android 7.1.1 (API level 25)");
|
||||
expect(list[0].abi).toEqual("google_apis/x86_64");
|
||||
expect(list[0].skin).toEqual("1080x1920");
|
||||
}).fail(function(err) {
|
||||
expect(err).toBeUndefined();
|
||||
}).fin(function() {
|
||||
done();
|
||||
});
|
||||
});
|
||||
});
|
||||
describe("list_images", function() {
|
||||
beforeEach(function() {
|
||||
spyOn(fs, "realpathSync").and.callFake(function(cmd) {
|
||||
return cmd;
|
||||
});
|
||||
});
|
||||
it("should try to parse AVD information using `avdmanager` first", function() {
|
||||
spyOn(shelljs, "which").and.callFake(function(cmd) {
|
||||
if (cmd == "avdmanager") {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
});
|
||||
var avdmanager_spy = spyOn(emu, "list_images_using_avdmanager").and.returnValue({catch:function(){}});
|
||||
emu.list_images();
|
||||
expect(avdmanager_spy).toHaveBeenCalled();
|
||||
});
|
||||
it("should delegate to `android` if `avdmanager` cant be found and `android` can", function() {
|
||||
spyOn(shelljs, "which").and.callFake(function(cmd) {
|
||||
if (cmd == "avdmanager") {
|
||||
return false;
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
});
|
||||
var android_spy = spyOn(emu, "list_images_using_android");
|
||||
emu.list_images();
|
||||
expect(android_spy).toHaveBeenCalled();
|
||||
});
|
||||
it("should throw an error if neither `avdmanager` nor `android` are able to be found", function(done) {
|
||||
spyOn(shelljs, "which").and.returnValue(false);
|
||||
return emu.list_images()
|
||||
.catch(function(err) {
|
||||
expect(err).toBeDefined();
|
||||
expect(err.message).toContain("Could not find either `android` or `avdmanager`");
|
||||
done();
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
@@ -1,9 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<classpath>
|
||||
<classpathentry kind="con" path="com.android.ide.eclipse.adt.ANDROID_FRAMEWORK"/>
|
||||
<classpathentry exported="true" kind="con" path="com.android.ide.eclipse.adt.LIBRARIES"/>
|
||||
<classpathentry exported="true" kind="con" path="com.android.ide.eclipse.adt.DEPENDENCIES"/>
|
||||
<classpathentry kind="src" path="src"/>
|
||||
<classpathentry kind="src" path="gen"/>
|
||||
<classpathentry kind="output" path="bin/classes"/>
|
||||
</classpath>
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user