cordova-android
Advanced tools
Comparing version 5.2.0-nightly.2016.5.31.d125ece9 to 5.2.0-nightly.2016.6.1.3a1b4ffc
@@ -163,4 +163,4 @@ /** | ||
*/ | ||
Api.prototype.prepare = function (cordovaProject) { | ||
return require('./lib/prepare').prepare.call(this, cordovaProject); | ||
Api.prototype.prepare = function (cordovaProject, prepareOptions) { | ||
return require('./lib/prepare').prepare.call(this, cordovaProject, prepareOptions); | ||
}; | ||
@@ -332,2 +332,5 @@ | ||
return require('./lib/build').runClean.call(self, cleanOptions); | ||
}) | ||
.then(function () { | ||
return require('./lib/prepare').clean.call(self, cleanOptions); | ||
}); | ||
@@ -334,0 +337,0 @@ }; |
@@ -29,2 +29,3 @@ /** | ||
var ConfigParser = require('cordova-common').ConfigParser; | ||
var FileUpdater = require('cordova-common').FileUpdater; | ||
var PlatformJson = require('cordova-common').PlatformJson; | ||
@@ -34,5 +35,5 @@ var PlatformMunger = require('cordova-common').ConfigChanges.PlatformMunger; | ||
module.exports.prepare = function (cordovaProject) { | ||
module.exports.prepare = function (cordovaProject, options) { | ||
var self = this; | ||
var platformResourcesDir = path.relative(cordovaProject.root, path.join(this.locations.root, 'res')); | ||
@@ -45,3 +46,3 @@ var platformJson = PlatformJson.load(this.locations.root, this.platform); | ||
// Update own www dir with project's www assets and plugins' assets and js-files | ||
return Q.when(updateWwwFrom(cordovaProject, this.locations)) | ||
return Q.when(updateWww(cordovaProject, this.locations)) | ||
.then(function () { | ||
@@ -52,4 +53,4 @@ // update project according to config.xml changes. | ||
.then(function () { | ||
handleIcons(cordovaProject.projectConfig, self.root); | ||
handleSplashes(cordovaProject.projectConfig, self.root); | ||
updateIcons(cordovaProject, platformResourcesDir); | ||
updateSplashes(cordovaProject, platformResourcesDir); | ||
}) | ||
@@ -61,2 +62,25 @@ .then(function () { | ||
module.exports.clean = function (options) { | ||
// A cordovaProject isn't passed into the clean() function, because it might have | ||
// been called from the platform shell script rather than the CLI. Check for the | ||
// noPrepare option passed in by the non-CLI clean script. If that's present, or if | ||
// there's no config.xml found at the project root, then don't clean prepared files. | ||
var projectRoot = path.resolve(this.root, '../..'); | ||
var projectConfigFile = path.join(projectRoot, 'config.xml'); | ||
if ((options && options.noPrepare) || !fs.existsSync(projectConfigFile) || | ||
!fs.existsSync(this.locations.configXml)) { | ||
return Q(); | ||
} | ||
var projectConfig = new ConfigParser(this.locations.configXml); | ||
var platformResourcesDir = path.relative(projectRoot, path.join(this.locations.root, 'res')); | ||
var self = this; | ||
return Q().then(function () { | ||
cleanWww(projectRoot, self.locations); | ||
cleanIcons(projectRoot, projectConfig, platformResourcesDir); | ||
cleanSplashes(projectRoot, projectConfig, platformResourcesDir); | ||
}); | ||
}; | ||
/** | ||
@@ -98,2 +122,9 @@ * Updates config files in project based on app's config.xml and config munge, | ||
/** | ||
* Logs all file operations via the verbose event stream, indented. | ||
*/ | ||
function logFileOp(message) { | ||
events.emit('verbose', ' ' + message); | ||
} | ||
/** | ||
* Updates platform 'www' directory by replacing it with contents of | ||
@@ -107,9 +138,7 @@ * 'platform_www' and app www. Also copies project's overrides' folder into | ||
*/ | ||
function updateWwwFrom(cordovaProject, destinations) { | ||
shell.rm('-rf', destinations.www); | ||
shell.mkdir('-p', destinations.www); | ||
// Copy source files from project's www directory | ||
shell.cp('-rf', path.join(cordovaProject.locations.www, '*'), destinations.www); | ||
// Override www sources by files in 'platform_www' directory | ||
shell.cp('-rf', path.join(destinations.platformWww, '*'), destinations.www); | ||
function updateWww(cordovaProject, destinations) { | ||
var sourceDirs = [ | ||
path.relative(cordovaProject.root, cordovaProject.locations.www), | ||
path.relative(cordovaProject.root, destinations.platformWww) | ||
]; | ||
@@ -120,8 +149,25 @@ // If project contains 'merges' for our platform, use them as another overrides | ||
events.emit('verbose', 'Found "merges/android" folder. Copying its contents into the android project.'); | ||
var overrides = path.join(merges_path, '*'); | ||
shell.cp('-rf', overrides, destinations.www); | ||
sourceDirs.push(path.join('merges', 'android')); | ||
} | ||
var targetDir = path.relative(cordovaProject.root, destinations.www); | ||
events.emit( | ||
'verbose', 'Merging and updating files from [' + sourceDirs.join(', ') + '] to ' + targetDir); | ||
FileUpdater.mergeAndUpdateDir( | ||
sourceDirs, targetDir, { rootDir: cordovaProject.root }, logFileOp); | ||
} | ||
/** | ||
* Cleans all files from the platform 'www' directory. | ||
*/ | ||
function cleanWww(projectRoot, locations) { | ||
var targetDir = path.relative(projectRoot, locations.www); | ||
events.emit('verbose', 'Cleaning ' + targetDir); | ||
// No source paths are specified, so mergeAndUpdateDir() will clear the target directory. | ||
FileUpdater.mergeAndUpdateDir( | ||
[], targetDir, { rootDir: projectRoot, all: true }, logFileOp); | ||
} | ||
/** | ||
* Updates project structure and AndroidManifest according to project's configuration. | ||
@@ -212,48 +258,60 @@ * | ||
function copyImage(src, resourcesDir, density, name) { | ||
var destFolder = path.join(resourcesDir, (density ? 'drawable-': 'drawable') + density); | ||
var isNinePatch = !!/\.9\.png$/.exec(src); | ||
var ninePatchName = name.replace(/\.png$/, '.9.png'); | ||
function getImageResourcePath(resourcesDir, density, name, sourceName) { | ||
if (/\.9\.png$/.test(sourceName)) { | ||
name = name.replace(/\.png$/, '.9.png'); | ||
} | ||
var resourcePath = path.join(resourcesDir, (density ? 'drawable-' + density : 'drawable'), name); | ||
return resourcePath; | ||
} | ||
// default template does not have default asset for this density | ||
if (!fs.existsSync(destFolder)) { | ||
fs.mkdirSync(destFolder); | ||
function updateSplashes(cordovaProject, platformResourcesDir) { | ||
var resources = cordovaProject.projectConfig.getSplashScreens('android'); | ||
// if there are "splash" elements in config.xml | ||
if (resources.length === 0) { | ||
events.emit('verbose', 'This app does not have splash screens defined'); | ||
return; | ||
} | ||
var destFilePath = path.join(destFolder, isNinePatch ? ninePatchName : name); | ||
events.emit('verbose', 'Copying image from ' + src + ' to ' + destFilePath); | ||
shell.cp('-f', src, destFilePath); | ||
var resourceMap = mapImageResources(cordovaProject.root, platformResourcesDir, 'screen.png'); | ||
var hadMdpi = false; | ||
resources.forEach(function (resource) { | ||
if (!resource.density) { | ||
return; | ||
} | ||
if (resource.density == 'mdpi') { | ||
hadMdpi = true; | ||
} | ||
var targetPath = getImageResourcePath( | ||
platformResourcesDir, resource.density, 'screen.png', path.basename(resource.src)); | ||
resourceMap[targetPath] = resource.src; | ||
}); | ||
// There's no "default" drawable, so assume default == mdpi. | ||
if (!hadMdpi && resources.defaultResource) { | ||
var targetPath = getImageResourcePath( | ||
platformResourcesDir, 'mdpi', 'screen.png', path.basename(resources.defaultResource.src)); | ||
resourceMap[targetPath] = resources.defaultResource.src; | ||
} | ||
events.emit('verbose', 'Updating splash screens at ' + platformResourcesDir); | ||
FileUpdater.updatePaths( | ||
resourceMap, { rootDir: cordovaProject.root }, logFileOp); | ||
} | ||
function handleSplashes(projectConfig, platformRoot) { | ||
function cleanSplashes(projectRoot, projectConfig, platformResourcesDir) { | ||
var resources = projectConfig.getSplashScreens('android'); | ||
// if there are "splash" elements in config.xml | ||
if (resources.length > 0) { | ||
deleteDefaultResourceAt(platformRoot, 'screen.png'); | ||
events.emit('verbose', 'splash screens: ' + JSON.stringify(resources)); | ||
var resourceMap = mapImageResources(projectRoot, platformResourcesDir, 'screen.png'); | ||
events.emit('verbose', 'Cleaning splash screens at ' + platformResourcesDir); | ||
// The source paths for icons and splashes are relative to | ||
// project's config.xml location, so we use it as base path. | ||
var projectRoot = path.dirname(projectConfig.path); | ||
var destination = path.join(platformRoot, 'res'); | ||
var hadMdpi = false; | ||
resources.forEach(function (resource) { | ||
if (!resource.density) { | ||
return; | ||
} | ||
if (resource.density == 'mdpi') { | ||
hadMdpi = true; | ||
} | ||
copyImage(path.join(projectRoot, resource.src), destination, resource.density, 'screen.png'); | ||
}); | ||
// There's no "default" drawable, so assume default == mdpi. | ||
if (!hadMdpi && resources.defaultResource) { | ||
copyImage(path.join(projectRoot, resources.defaultResource.src), destination, 'mdpi', 'screen.png'); | ||
} | ||
// No source paths are specified in the map, so updatePaths() will delete the target files. | ||
FileUpdater.updatePaths( | ||
resourceMap, { rootDir: projectRoot, all: true }, logFileOp); | ||
} | ||
} | ||
function handleIcons(projectConfig, platformRoot) { | ||
var icons = projectConfig.getIcons('android'); | ||
function updateIcons(cordovaProject, platformResourcesDir) { | ||
var icons = cordovaProject.projectConfig.getIcons('android'); | ||
@@ -266,3 +324,3 @@ // if there are icon elements in config.xml | ||
deleteDefaultResourceAt(platformRoot, 'icon.png'); | ||
var resourceMap = mapImageResources(cordovaProject.root, platformResourcesDir, 'icon.png'); | ||
@@ -316,21 +374,43 @@ var android_icons = {}; | ||
// project's config.xml location, so we use it as base path. | ||
var projectRoot = path.dirname(projectConfig.path); | ||
var destination = path.join(platformRoot, 'res'); | ||
for (var density in android_icons) { | ||
copyImage(path.join(projectRoot, android_icons[density].src), destination, density, 'icon.png'); | ||
var targetPath = getImageResourcePath( | ||
platformResourcesDir, density, 'icon.png', path.basename(android_icons[density].src)); | ||
resourceMap[targetPath] = android_icons[density].src; | ||
} | ||
// There's no "default" drawable, so assume default == mdpi. | ||
if (default_icon && !android_icons.mdpi) { | ||
copyImage(path.join(projectRoot, default_icon.src), destination, 'mdpi', 'icon.png'); | ||
var defaultTargetPath = getImageResourcePath( | ||
platformResourcesDir, 'mdpi', 'icon.png', path.basename(default_icon.src)); | ||
resourceMap[defaultTargetPath] = default_icon.src; | ||
} | ||
events.emit('verbose', 'Updating icons at ' + platformResourcesDir); | ||
FileUpdater.updatePaths( | ||
resourceMap, { rootDir: cordovaProject.root }, logFileOp); | ||
} | ||
// remove the default resource name from all drawable folders | ||
function deleteDefaultResourceAt(baseDir, resourceName) { | ||
shell.ls(path.join(baseDir, 'res/drawable-*')) | ||
function cleanIcons(projectRoot, projectConfig, platformResourcesDir) { | ||
var icons = projectConfig.getIcons('android'); | ||
if (icons.length > 0) { | ||
var resourceMap = mapImageResources(projectRoot, platformResourcesDir, 'icon.png'); | ||
events.emit('verbose', 'Cleaning icons at ' + platformResourcesDir); | ||
// No source paths are specified in the map, so updatePaths() will delete the target files. | ||
FileUpdater.updatePaths( | ||
resourceMap, { rootDir: projectRoot, all: true }, logFileOp); | ||
} | ||
} | ||
/** | ||
* Gets a map containing resources of a specified name from all drawable folders in a directory. | ||
*/ | ||
function mapImageResources(rootDir, subDir, resourceName) { | ||
var pathMap = {}; | ||
shell.ls(path.join(rootDir, subDir, 'drawable-*')) | ||
.forEach(function (drawableFolder) { | ||
var imagePath = path.join(drawableFolder, resourceName); | ||
shell.rm('-f', [imagePath, imagePath.replace(/\.png$/, '.9.png')]); | ||
events.emit('verbose', 'Deleted ' + imagePath); | ||
var imagePath = path.join(subDir, path.basename(drawableFolder), resourceName); | ||
pathMap[imagePath] = null; | ||
}); | ||
return pathMap; | ||
} | ||
@@ -337,0 +417,0 @@ |
@@ -20,24 +20,28 @@ /** | ||
exports = module.exports = { | ||
events: require('./src/events'), | ||
superspawn: require('./src/superspawn'), | ||
var addProperty = require('./src/util/addProperty'); | ||
ActionStack: require('./src/ActionStack'), | ||
CordovaError: require('./src/CordovaError/CordovaError'), | ||
CordovaLogger: require('./src/CordovaLogger'), | ||
CordovaExternalToolErrorContext: require('./src/CordovaError/CordovaExternalToolErrorContext'), | ||
PlatformJson: require('./src/PlatformJson'), | ||
ConfigParser: require('./src/ConfigParser/ConfigParser.js'), | ||
module.exports = { }; | ||
PluginInfo: require('./src/PluginInfo/PluginInfo.js'), | ||
PluginInfoProvider: require('./src/PluginInfo/PluginInfoProvider.js'), | ||
PluginManager: require('./src/PluginManager'), | ||
addProperty(module, 'events', './src/events'); | ||
addProperty(module, 'superspawn', './src/superspawn'); | ||
ConfigChanges: require('./src/ConfigChanges/ConfigChanges.js'), | ||
ConfigKeeper: require('./src/ConfigChanges/ConfigKeeper.js'), | ||
ConfigFile: require('./src/ConfigChanges/ConfigFile.js'), | ||
mungeUtil: require('./src/ConfigChanges/munge-util.js'), | ||
addProperty(module, 'ActionStack', './src/ActionStack'); | ||
addProperty(module, 'CordovaError', './src/CordovaError/CordovaError'); | ||
addProperty(module, 'CordovaLogger', './src/CordovaLogger'); | ||
addProperty(module, 'CordovaExternalToolErrorContext', './src/CordovaError/CordovaExternalToolErrorContext'); | ||
addProperty(module, 'PlatformJson', './src/PlatformJson'); | ||
addProperty(module, 'ConfigParser', './src/ConfigParser/ConfigParser'); | ||
addProperty(module, 'FileUpdater', './src/FileUpdater'); | ||
xmlHelpers: require('./src/util/xml-helpers') | ||
}; | ||
addProperty(module, 'PluginInfo', './src/PluginInfo/PluginInfo'); | ||
addProperty(module, 'PluginInfoProvider', './src/PluginInfo/PluginInfoProvider'); | ||
addProperty(module, 'PluginManager', './src/PluginManager'); | ||
addProperty(module, 'ConfigChanges', './src/ConfigChanges/ConfigChanges'); | ||
addProperty(module, 'ConfigKeeper', './src/ConfigChanges/ConfigKeeper'); | ||
addProperty(module, 'ConfigFile', './src/ConfigChanges/ConfigFile'); | ||
addProperty(module, 'mungeUtil', './src/ConfigChanges/munge-util'); | ||
addProperty(module, 'xmlHelpers', './src/util/xml-helpers'); | ||
{ | ||
"_args": [ | ||
[ | ||
"cordova-common@1.2.0", | ||
"d:\\cordova\\cordova-android" | ||
"cordova-common@^1.3.0", | ||
"D:\\Cordova\\cordova-android" | ||
] | ||
], | ||
"_from": "cordova-common@1.2.0", | ||
"_id": "cordova-common@1.2.0", | ||
"_from": "cordova-common@>=1.3.0 <2.0.0", | ||
"_id": "cordova-common@1.3.0", | ||
"_inCache": true, | ||
"_installable": true, | ||
"_location": "/cordova-common", | ||
"_nodeVersion": "5.9.1", | ||
"_nodeVersion": "5.4.1", | ||
"_npmOperationalInternal": { | ||
"host": "packages-12-west.internal.npmjs.com", | ||
"tmp": "tmp/cordova-common-1.2.0.tgz_1461227352417_0.14771279646083713" | ||
"host": "packages-16-east.internal.npmjs.com", | ||
"tmp": "tmp/cordova-common-1.3.0.tgz_1464130094288_0.48495062021538615" | ||
}, | ||
"_npmUser": { | ||
"email": "kotikov.vladimir@gmail.com", | ||
"name": "kotikov.vladimir" | ||
"email": "stevengill97@gmail.com", | ||
"name": "stevegill" | ||
}, | ||
"_npmVersion": "3.8.5", | ||
"_npmVersion": "3.9.0", | ||
"_phantomChildren": {}, | ||
"_requested": { | ||
"name": "cordova-common", | ||
"raw": "cordova-common@1.2.0", | ||
"rawSpec": "1.2.0", | ||
"raw": "cordova-common@^1.3.0", | ||
"rawSpec": "^1.3.0", | ||
"scope": null, | ||
"spec": "1.2.0", | ||
"type": "version" | ||
"spec": ">=1.3.0 <2.0.0", | ||
"type": "range" | ||
}, | ||
@@ -35,7 +35,7 @@ "_requiredBy": [ | ||
], | ||
"_resolved": "file:cordova-dist\\tools\\cordova-common-1.2.0.tgz", | ||
"_shasum": "474b7f77c6c89d3f995c947d96046edf2e8c404d", | ||
"_resolved": "https://registry.npmjs.org/cordova-common/-/cordova-common-1.3.0.tgz", | ||
"_shasum": "f75161f6aa7cef5486fd5d69a3b0a1f628334491", | ||
"_shrinkwrap": null, | ||
"_spec": "cordova-common@1.2.0", | ||
"_where": "d:\\cordova\\cordova-android", | ||
"_spec": "cordova-common@^1.3.0", | ||
"_where": "D:\\Cordova\\cordova-android", | ||
"author": { | ||
@@ -55,2 +55,3 @@ "name": "Apache Software Foundation" | ||
"glob": "^5.0.13", | ||
"minimatch": "^3.0.0", | ||
"osenv": "^0.1.3", | ||
@@ -74,4 +75,4 @@ "plist": "^1.2.0", | ||
"dist": { | ||
"shasum": "474b7f77c6c89d3f995c947d96046edf2e8c404d", | ||
"tarball": "https://registry.npmjs.org/cordova-common/-/cordova-common-1.2.0.tgz" | ||
"shasum": "f75161f6aa7cef5486fd5d69a3b0a1f628334491", | ||
"tarball": "https://registry.npmjs.org/cordova-common/-/cordova-common-1.3.0.tgz" | ||
}, | ||
@@ -123,3 +124,3 @@ "engineStrict": true, | ||
}, | ||
"version": "1.2.0" | ||
"version": "1.3.0" | ||
} |
@@ -23,37 +23,43 @@ <!-- | ||
### 1.3.0 (May 12, 2016) | ||
* [CB-11259](https://issues.apache.org/jira/browse/CB-11259): Improving prepare and build logging | ||
* [CB-11194](https://issues.apache.org/jira/browse/CB-11194) Improve cordova load time | ||
* [CB-1117](https://issues.apache.org/jira/browse/CB-1117) Add `FileUpdater` module to `cordova-common`. | ||
* [CB-11131](https://issues.apache.org/jira/browse/CB-11131) Fix `TypeError: message.toUpperCase` is not a function in `CordovaLogger` | ||
### 1.2.0 (Apr 18, 2016) | ||
* CB-11022 Save modulesMetadata to both www and platform_www when necessary | ||
* CB-10833 Deduplicate common logic for plugin installation/uninstallation | ||
* CB-10822 Manage plugins/modules metadata using PlatformJson | ||
* CB-10940 Can't add Android platform from path | ||
* CB-10965 xml helper allows multiple instances to be merge in config.xml | ||
* [CB-11022](https://issues.apache.org/jira/browse/CB-11022) Save modulesMetadata to both www and platform_www when necessary | ||
* [CB-10833](https://issues.apache.org/jira/browse/CB-10833) Deduplicate common logic for plugin installation/uninstallation | ||
* [CB-10822](https://issues.apache.org/jira/browse/CB-10822) Manage plugins/modules metadata using PlatformJson | ||
* [CB-10940](https://issues.apache.org/jira/browse/CB-10940) Can't add Android platform from path | ||
* [CB-10965](https://issues.apache.org/jira/browse/CB-10965) xml helper allows multiple instances to be merge in config.xml | ||
### 1.1.1 (Mar 18, 2016) | ||
* CB-10694 Update test to reflect merging of CB-9264 fix | ||
* CB-10694 Platform-specific configuration preferences don't override global settings | ||
* CB-9264 Duplicate entries in `config.xml` | ||
* CB-10791 Add `adjustLoggerLevel` to `cordova-common.CordovaLogger` | ||
* CB-10662 Add tests for `ConfigParser.getStaticResources` | ||
* CB-10622 fix target attribute being ignored for images in `config.xml`. | ||
* CB-10583 Protect plugin preferences from adding extra Array properties. | ||
* [CB-10694](https://issues.apache.org/jira/browse/CB-10694) Update test to reflect merging of [CB-9264](https://issues.apache.org/jira/browse/CB-9264) fix | ||
* [CB-10694](https://issues.apache.org/jira/browse/CB-10694) Platform-specific configuration preferences don't override global settings | ||
* [CB-9264](https://issues.apache.org/jira/browse/CB-9264) Duplicate entries in `config.xml` | ||
* [CB-10791](https://issues.apache.org/jira/browse/CB-10791) Add `adjustLoggerLevel` to `cordova-common.CordovaLogger` | ||
* [CB-10662](https://issues.apache.org/jira/browse/CB-10662) Add tests for `ConfigParser.getStaticResources` | ||
* [CB-10622](https://issues.apache.org/jira/browse/CB-10622) fix target attribute being ignored for images in `config.xml`. | ||
* [CB-10583](https://issues.apache.org/jira/browse/CB-10583) Protect plugin preferences from adding extra Array properties. | ||
### 1.1.0 (Feb 16, 2016) | ||
* CB-10482 Remove references to windows8 from cordova-lib/cli | ||
* CB-10430 Adds forwardEvents method to easily connect two EventEmitters | ||
* CB-10176 Adds CordovaLogger class, based on logger module from cordova-cli | ||
* CB-10052 Expose child process' io streams via promise progress notification | ||
* CB-10497 Prefer .bat over .cmd on windows platform | ||
* CB-9984 Bumps plist version and fixes failing cordova-common test | ||
* [CB-10482](https://issues.apache.org/jira/browse/CB-10482) Remove references to windows8 from cordova-lib/cli | ||
* [CB-10430](https://issues.apache.org/jira/browse/CB-10430) Adds forwardEvents method to easily connect two EventEmitters | ||
* [CB-10176](https://issues.apache.org/jira/browse/CB-10176) Adds CordovaLogger class, based on logger module from cordova-cli | ||
* [CB-10052](https://issues.apache.org/jira/browse/CB-10052) Expose child process' io streams via promise progress notification | ||
* [CB-10497](https://issues.apache.org/jira/browse/CB-10497) Prefer .bat over .cmd on windows platform | ||
* [CB-9984](https://issues.apache.org/jira/browse/CB-9984) Bumps plist version and fixes failing cordova-common test | ||
### 1.0.0 (Oct 29, 2015) | ||
* CB-9890 Documents cordova-common | ||
* CB-9598 Correct cordova-lib -> cordova-common in README | ||
* [CB-9890](https://issues.apache.org/jira/browse/CB-9890) Documents cordova-common | ||
* [CB-9598](https://issues.apache.org/jira/browse/CB-9598) Correct cordova-lib -> cordova-common in README | ||
* Pick ConfigParser changes from apache@0c3614e | ||
* CB-9743 Removes system frameworks handling from ConfigChanges | ||
* CB-9598 Cleans out code which has been moved to `cordova-common` | ||
* [CB-9743](https://issues.apache.org/jira/browse/CB-9743) Removes system frameworks handling from ConfigChanges | ||
* [CB-9598](https://issues.apache.org/jira/browse/CB-9598) Cleans out code which has been moved to `cordova-common` | ||
* Pick ConfigParser changes from apache@ddb027b | ||
* Picking CordovaError changes from apache@a3b1fca | ||
* CB-9598 Adds tests and fixtures based on existing cordova-lib ones | ||
* CB-9598 Initial implementation for cordova-common | ||
* [CB-9598](https://issues.apache.org/jira/browse/CB-9598) Adds tests and fixtures based on existing cordova-lib ones | ||
* [CB-9598](https://issues.apache.org/jira/browse/CB-9598) Initial implementation for cordova-common | ||
@@ -20,9 +20,13 @@ /* | ||
var bplist = require('bplist-parser'); | ||
var et = require('elementtree'); | ||
var glob = require('glob'); | ||
var plist = require('plist'); | ||
var modules = {}; | ||
var addProperty = require('../util/addProperty'); | ||
var plist_helpers = require('../util/plist-helpers'); | ||
var xml_helpers = require('../util/xml-helpers'); | ||
// Use delay loading to ensure plist and other node modules to not get loaded | ||
// on Android, Windows platforms | ||
addProperty(module, 'bplist', 'bplist-parser', modules); | ||
addProperty(module, 'et', 'elementtree', modules); | ||
addProperty(module, 'glob', 'glob', modules); | ||
addProperty(module, 'plist', 'plist', modules); | ||
addProperty(module, 'plist_helpers', '../util/plist-helpers', modules); | ||
addProperty(module, 'xml_helpers', '../util/xml-helpers', modules); | ||
@@ -71,3 +75,3 @@ /****************************************************************************** | ||
self.type = 'xml'; | ||
self.data = xml_helpers.parseElementtreeSync(filepath); | ||
self.data = modules.xml_helpers.parseElementtreeSync(filepath); | ||
} else { | ||
@@ -81,4 +85,4 @@ // plist file | ||
self.data = isBinaryPlist(filepath) ? | ||
bplist.parseBuffer(fs.readFileSync(filepath)) : | ||
plist.parse(fs.readFileSync(filepath, 'utf8')); | ||
modules.bplist.parseBuffer(fs.readFileSync(filepath)) : | ||
modules.plist.parse(fs.readFileSync(filepath, 'utf8')); | ||
} | ||
@@ -94,3 +98,3 @@ } | ||
var regExp = new RegExp('<string>[ \t\r\n]+?</string>', 'g'); | ||
fs.writeFileSync(self.filepath, plist.build(self.data).replace(regExp, '<string></string>')); | ||
fs.writeFileSync(self.filepath, modules.plist.build(self.data).replace(regExp, '<string></string>')); | ||
} | ||
@@ -105,12 +109,12 @@ self.is_changed = false; | ||
if (self.type === 'xml') { | ||
var xml_to_graft = [et.XML(xml_child.xml)]; | ||
result = xml_helpers.graftXML(self.data, xml_to_graft, selector, xml_child.after); | ||
var xml_to_graft = [modules.et.XML(xml_child.xml)]; | ||
result = modules.xml_helpers.graftXML(self.data, xml_to_graft, selector, xml_child.after); | ||
if ( !result) { | ||
throw new Error('grafting xml at selector "' + selector + '" from "' + filepath + '" during config install went bad :('); | ||
throw new Error('Unable to graft xml at selector "' + selector + '" from "' + filepath + '" during config install'); | ||
} | ||
} else { | ||
// plist file | ||
result = plist_helpers.graftPLIST(self.data, xml_child.xml, selector); | ||
result = modules.plist_helpers.graftPLIST(self.data, xml_child.xml, selector); | ||
if ( !result ) { | ||
throw new Error('grafting to plist "' + filepath + '" during config install went bad :('); | ||
throw new Error('Unable to graft plist "' + filepath + '" during config install'); | ||
} | ||
@@ -126,7 +130,7 @@ } | ||
if (self.type === 'xml') { | ||
var xml_to_graft = [et.XML(xml_child.xml)]; | ||
result = xml_helpers.pruneXML(self.data, xml_to_graft, selector); | ||
var xml_to_graft = [modules.et.XML(xml_child.xml)]; | ||
result = modules.xml_helpers.pruneXML(self.data, xml_to_graft, selector); | ||
} else { | ||
// plist file | ||
result = plist_helpers.prunePLIST(self.data, xml_child.xml, selector); | ||
result = modules.plist_helpers.prunePLIST(self.data, xml_child.xml, selector); | ||
} | ||
@@ -149,3 +153,3 @@ if (!result) { | ||
// handle wildcards in targets using glob. | ||
matches = glob.sync(path.join(project_dir, '**', file)); | ||
matches = modules.glob.sync(path.join(project_dir, '**', file)); | ||
if (matches.length) filepath = matches[0]; | ||
@@ -177,3 +181,3 @@ | ||
} else { | ||
matches = glob.sync(path.join(project_dir, '**', 'config.xml')); | ||
matches = modules.glob.sync(path.join(project_dir, '**', 'config.xml')); | ||
if (matches.length) filepath = matches[0]; | ||
@@ -191,3 +195,3 @@ } | ||
function getIOSProjectname(project_dir) { | ||
var matches = glob.sync(path.join(project_dir, '*.xcodeproj')); | ||
var matches = modules.glob.sync(path.join(project_dir, '*.xcodeproj')); | ||
var iospath; | ||
@@ -194,0 +198,0 @@ if (matches.length === 1) { |
@@ -92,3 +92,3 @@ /* | ||
if(message instanceof Error || logLevel === CordovaLogger.ERROR) { | ||
if (message instanceof Error || logLevel === CordovaLogger.ERROR) { | ||
message = formatError(message, isVerbose); | ||
@@ -200,6 +200,6 @@ cursor = this.stderrCursor; | ||
if(error instanceof CordovaError) { | ||
if (error instanceof CordovaError) { | ||
message = error.toString(isVerbose); | ||
} else if(error instanceof Error) { | ||
if(isVerbose) { | ||
} else if (error instanceof Error) { | ||
if (isVerbose) { | ||
message = error.stack; | ||
@@ -214,3 +214,3 @@ } else { | ||
if(message.toUpperCase().indexOf('ERROR:') !== 0) { | ||
if (typeof message === 'string' && message.toUpperCase().indexOf('ERROR:') !== 0) { | ||
// Needed for backward compatibility with external tools | ||
@@ -217,0 +217,0 @@ message = 'Error: ' + message; |
@@ -43,3 +43,3 @@ /** | ||
if (!(eventEmitter instanceof EventEmitter)) | ||
throw new Error('Cordova events could be redirected to another EventEmitter instance only'); | ||
throw new Error('Cordova events can be redirected to another EventEmitter instance only'); | ||
@@ -46,0 +46,0 @@ // CB-10940 Skipping forwarding to self to avoid infinite recursion. |
@@ -334,3 +334,3 @@ /** | ||
if (!fs.existsSync(self.filepath)) { | ||
throw new CordovaError('Cannot find plugin.xml for plugin \'' + path.basename(dirname) + '\'. Please try adding it again.'); | ||
throw new CordovaError('Cannot find plugin.xml for plugin "' + path.basename(dirname) + '". Please try adding it again.'); | ||
} | ||
@@ -337,0 +337,0 @@ |
@@ -5,3 +5,3 @@ { | ||
"elementtree@^0.1.6", | ||
"/Users/steveng/repo/cordova/cordova-android" | ||
"D:\\Cordova\\cordova-android" | ||
] | ||
@@ -32,7 +32,7 @@ ], | ||
], | ||
"_resolved": "http://registry.npmjs.org/elementtree/-/elementtree-0.1.6.tgz", | ||
"_resolved": "https://registry.npmjs.org/elementtree/-/elementtree-0.1.6.tgz", | ||
"_shasum": "2ac4c46ea30516c8c4cbdb5e3ac7418e592de20c", | ||
"_shrinkwrap": null, | ||
"_spec": "elementtree@^0.1.6", | ||
"_where": "/Users/steveng/repo/cordova/cordova-android", | ||
"_where": "D:\\Cordova\\cordova-android", | ||
"author": { | ||
@@ -46,8 +46,8 @@ "name": "Rackspace US, Inc." | ||
{ | ||
"name": "Paul Querna", | ||
"email": "paul.querna@rackspace.com" | ||
"email": "paul.querna@rackspace.com", | ||
"name": "Paul Querna" | ||
}, | ||
{ | ||
"name": "Tomaz Muraus", | ||
"email": "tomaz.muraus@rackspace.com" | ||
"email": "tomaz.muraus@rackspace.com", | ||
"name": "Tomaz Muraus" | ||
} | ||
@@ -67,3 +67,3 @@ ], | ||
"shasum": "2ac4c46ea30516c8c4cbdb5e3ac7418e592de20c", | ||
"tarball": "http://registry.npmjs.org/elementtree/-/elementtree-0.1.6.tgz" | ||
"tarball": "https://registry.npmjs.org/elementtree/-/elementtree-0.1.6.tgz" | ||
}, | ||
@@ -75,7 +75,7 @@ "engines": { | ||
"keywords": [ | ||
"elementtree", | ||
"xml", | ||
"sax", | ||
"parser", | ||
"sax", | ||
"seralization", | ||
"xml" | ||
"elementtree" | ||
], | ||
@@ -91,4 +91,4 @@ "licenses": [ | ||
{ | ||
"name": "rphillips", | ||
"email": "ryan@trolocsis.com" | ||
"email": "ryan@trolocsis.com", | ||
"name": "rphillips" | ||
} | ||
@@ -95,0 +95,0 @@ ], |
@@ -5,3 +5,3 @@ { | ||
"nopt@^3.0.1", | ||
"/Users/steveng/repo/cordova/cordova-android" | ||
"D:\\Cordova\\cordova-android" | ||
] | ||
@@ -32,7 +32,7 @@ ], | ||
], | ||
"_resolved": "http://registry.npmjs.org/nopt/-/nopt-3.0.6.tgz", | ||
"_resolved": "https://registry.npmjs.org/nopt/-/nopt-3.0.6.tgz", | ||
"_shasum": "c6465dbf08abcd4db359317f79ac68a646b28ff9", | ||
"_shrinkwrap": null, | ||
"_spec": "nopt@^3.0.1", | ||
"_where": "/Users/steveng/repo/cordova/cordova-android", | ||
"_where": "D:\\Cordova\\cordova-android", | ||
"author": { | ||
@@ -59,3 +59,3 @@ "email": "i@izs.me", | ||
"shasum": "c6465dbf08abcd4db359317f79ac68a646b28ff9", | ||
"tarball": "http://registry.npmjs.org/nopt/-/nopt-3.0.6.tgz" | ||
"tarball": "https://registry.npmjs.org/nopt/-/nopt-3.0.6.tgz" | ||
}, | ||
@@ -68,12 +68,12 @@ "gitHead": "10a750c9bb99c1950160353459e733ac2aa18cb6", | ||
{ | ||
"name": "isaacs", | ||
"email": "i@izs.me" | ||
"email": "i@izs.me", | ||
"name": "isaacs" | ||
}, | ||
{ | ||
"name": "othiym23", | ||
"email": "ogd@aoaioxxysz.net" | ||
"email": "ogd@aoaioxxysz.net", | ||
"name": "othiym23" | ||
}, | ||
{ | ||
"name": "zkat", | ||
"email": "kat@sykosomatic.org" | ||
"email": "kat@sykosomatic.org", | ||
"name": "zkat" | ||
} | ||
@@ -80,0 +80,0 @@ ], |
@@ -5,3 +5,3 @@ { | ||
"properties-parser@^0.2.3", | ||
"/Users/steveng/repo/cordova/cordova-android" | ||
"D:\\Cordova\\cordova-android" | ||
] | ||
@@ -31,7 +31,7 @@ ], | ||
], | ||
"_resolved": "http://registry.npmjs.org/properties-parser/-/properties-parser-0.2.3.tgz", | ||
"_resolved": "https://registry.npmjs.org/properties-parser/-/properties-parser-0.2.3.tgz", | ||
"_shasum": "f7591255f707abbff227c7b56b637dbb0373a10f", | ||
"_shrinkwrap": null, | ||
"_spec": "properties-parser@^0.2.3", | ||
"_where": "/Users/steveng/repo/cordova/cordova-android", | ||
"_where": "D:\\Cordova\\cordova-android", | ||
"bugs": { | ||
@@ -53,8 +53,8 @@ "url": "https://github.com/xavi-/node-properties-parser/issues" | ||
"keywords": [ | ||
"parser", | ||
".properties", | ||
"actionscript", | ||
"properties", | ||
"java", | ||
"file parser", | ||
"java", | ||
"parser", | ||
"properties" | ||
"actionscript" | ||
], | ||
@@ -64,4 +64,4 @@ "main": "./index.js", | ||
{ | ||
"name": "xavi", | ||
"email": "xavi.rmz@gmail.com" | ||
"email": "xavi.rmz@gmail.com", | ||
"name": "xavi" | ||
} | ||
@@ -68,0 +68,0 @@ ], |
@@ -5,3 +5,3 @@ { | ||
"q@^1.4.1", | ||
"/Users/steveng/repo/cordova/cordova-android" | ||
"D:\\Cordova\\cordova-android" | ||
] | ||
@@ -33,7 +33,7 @@ ], | ||
], | ||
"_resolved": "http://registry.npmjs.org/q/-/q-1.4.1.tgz", | ||
"_resolved": "https://registry.npmjs.org/q/-/q-1.4.1.tgz", | ||
"_shasum": "55705bcd93c5f3673530c2c2cbc0c2b3addc286e", | ||
"_shrinkwrap": null, | ||
"_spec": "q@^1.4.1", | ||
"_where": "/Users/steveng/repo/cordova/cordova-android", | ||
"_where": "D:\\Cordova\\cordova-android", | ||
"author": { | ||
@@ -49,14 +49,14 @@ "email": "kris@cixar.com", | ||
{ | ||
"email": "kris@cixar.com", | ||
"name": "Kris Kowal", | ||
"email": "kris@cixar.com", | ||
"url": "https://github.com/kriskowal" | ||
}, | ||
{ | ||
"email": "rfobic@gmail.com", | ||
"name": "Irakli Gozalishvili", | ||
"email": "rfobic@gmail.com", | ||
"url": "http://jeditoolkit.com" | ||
}, | ||
{ | ||
"email": "domenic@domenicdenicola.com", | ||
"name": "Domenic Denicola", | ||
"email": "domenic@domenicdenicola.com", | ||
"url": "http://domenicdenicola.com" | ||
@@ -83,3 +83,3 @@ } | ||
"shasum": "55705bcd93c5f3673530c2c2cbc0c2b3addc286e", | ||
"tarball": "http://registry.npmjs.org/q/-/q-1.4.1.tgz" | ||
"tarball": "https://registry.npmjs.org/q/-/q-1.4.1.tgz" | ||
}, | ||
@@ -98,9 +98,3 @@ "engines": { | ||
"keywords": [ | ||
"async", | ||
"browser", | ||
"deferred", | ||
"flow control", | ||
"fluent", | ||
"future", | ||
"node", | ||
"q", | ||
"promise", | ||
@@ -110,3 +104,9 @@ "promises", | ||
"promises-aplus", | ||
"q" | ||
"deferred", | ||
"future", | ||
"async", | ||
"flow control", | ||
"fluent", | ||
"browser", | ||
"node" | ||
], | ||
@@ -120,8 +120,8 @@ "license": { | ||
{ | ||
"name": "kriskowal", | ||
"email": "kris.kowal@cixar.com" | ||
"email": "kris.kowal@cixar.com", | ||
"name": "kriskowal" | ||
}, | ||
{ | ||
"name": "domenic", | ||
"email": "domenic@domenicdenicola.com" | ||
"email": "domenic@domenicdenicola.com", | ||
"name": "domenic" | ||
} | ||
@@ -128,0 +128,0 @@ ], |
@@ -5,3 +5,3 @@ { | ||
"shelljs@^0.5.3", | ||
"/Users/steveng/repo/cordova/cordova-android" | ||
"D:\\Cordova\\cordova-android" | ||
] | ||
@@ -33,7 +33,7 @@ ], | ||
], | ||
"_resolved": "http://registry.npmjs.org/shelljs/-/shelljs-0.5.3.tgz", | ||
"_resolved": "https://registry.npmjs.org/shelljs/-/shelljs-0.5.3.tgz", | ||
"_shasum": "c54982b996c76ef0c1e6b59fbdc5825f5b713113", | ||
"_shrinkwrap": null, | ||
"_spec": "shelljs@^0.5.3", | ||
"_where": "/Users/steveng/repo/cordova/cordova-android", | ||
"_where": "D:\\Cordova\\cordova-android", | ||
"author": { | ||
@@ -57,3 +57,3 @@ "email": "arturadib@gmail.com", | ||
"shasum": "c54982b996c76ef0c1e6b59fbdc5825f5b713113", | ||
"tarball": "http://registry.npmjs.org/shelljs/-/shelljs-0.5.3.tgz" | ||
"tarball": "https://registry.npmjs.org/shelljs/-/shelljs-0.5.3.tgz" | ||
}, | ||
@@ -66,8 +66,8 @@ "engines": { | ||
"keywords": [ | ||
"unix", | ||
"shell", | ||
"makefile", | ||
"make", | ||
"jake", | ||
"make", | ||
"makefile", | ||
"shell", | ||
"synchronous", | ||
"unix" | ||
"synchronous" | ||
], | ||
@@ -78,4 +78,4 @@ "license": "BSD*", | ||
{ | ||
"name": "artur", | ||
"email": "arturadib@gmail.com" | ||
"email": "arturadib@gmail.com", | ||
"name": "artur" | ||
} | ||
@@ -82,0 +82,0 @@ ], |
{ | ||
"name": "cordova-android", | ||
"version": "5.2.0-nightly.2016.5.31.d125ece9", | ||
"version": "5.2.0-nightly.2016.6.1.3a1b4ffc", | ||
"description": "cordova-android release", | ||
@@ -27,3 +27,3 @@ "bin": { | ||
"dependencies": { | ||
"cordova-common": "^1.2.0", | ||
"cordova-common": "^1.3.0", | ||
"elementtree": "^0.1.6", | ||
@@ -30,0 +30,0 @@ "nopt": "^3.0.1", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Unidentified License
License(Experimental) Something that seems like a license was found, but its contents could not be matched with a known license.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Unidentified License
License(Experimental) Something that seems like a license was found, but its contents could not be matched with a known license.
Found 1 instance in 1 package
3121038
349
24754
115
Updatedcordova-common@^1.3.0