cordova-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a...@apache.org
Subject [1/2] Revert "Merge branch 'browserPlatform' of https://github.com/surajpindoria/cordova-lib"
Date Mon, 15 Sep 2014 23:40:35 GMT
Repository: cordova-lib
Updated Branches:
  refs/heads/master 405d0da0f -> a01779552


http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/a0177955/cordova-lib/src/cordova/restore.js
----------------------------------------------------------------------
diff --git a/cordova-lib/src/cordova/restore.js b/cordova-lib/src/cordova/restore.js
index 6e4d262..ffd1edc 100644
--- a/cordova-lib/src/cordova/restore.js
+++ b/cordova-lib/src/cordova/restore.js
@@ -60,41 +60,39 @@ function installPlatformsFromConfigXML(cfg){
 //returns a Promise
 function installPluginsFromConfigXML(cfg) {
     //Install plugins that are listed on config.xml
+    var pluginsFromConfig = [];
     var projectRoot = cordova_util.cdProjectRoot();
     var plugins_dir = path.join(projectRoot, 'plugins');
 
-    // Get all configured plugins
-    var features = cfg.getFeatureIdList();
-    if (0 === features.length) {
-        return Q.all('No config.xml plugins to install');
-    }
-
-    return features.reduce(function(soFar, featureId) {
-
-        var pluginPath =  path.join(plugins_dir, featureId);
-        if (fs.existsSync(pluginPath)) {
-            // Plugin already exists
-            return soFar;
+    var features = cfg.doc.findall('feature');
+    features.forEach(function(feature){
+        var params = feature.findall('param');
+        var pluginId = '';
+        var pluginVersion = '';
+        for (var i = 0; i < params.length; i++) {
+            if (params[i].attrib.name === 'id') {
+                pluginId = params[i].attrib.value;
+            }
+            if (params[i].attrib.name === 'version') {
+                pluginVersion = params[i].attrib.value;
+            }
         }
-
-        return soFar.then(function() {
-            events.emit('log', 'Discovered ' + featureId + ' in config.xml. Installing to
the project');
-
-            var feature = cfg.getFeature(featureId);
-
-            // Install from given URL if defined or using a plugin id
-            var installFrom = feature.url;
-            if (!installFrom) {
-                installFrom = feature.id;
-                if (!!feature.version) {
-                    installFrom += ('@' + feature.version);
-                }
+        var pluginPath =  path.join(plugins_dir,pluginId);
+        // contents of the plugins folder takes precedence hence
+        // we ignore if the correct version is installed or not.
+        if (pluginId !== '' && !fs.existsSync(pluginPath)) {
+            if ( pluginVersion !== '') {
+                pluginId = pluginId + '@' + pluginVersion;
             }
+            events.emit('log', 'Discovered ' + pluginId + ' in config.xml. Installing to
the project');
+            pluginsFromConfig.push(pluginId);
+        }
+    });
 
-            // Add feature preferences as CLI variables if have any
-            var options = 'undefined' !== typeof feature.variables ? {cli_variables: feature.variables}
: null;
-
-            return plugin('add', installFrom, options);
-        });
-    }, Q());
+    //Use cli instead of plugman directly ensuring all the hooks
+    // to get fired.
+    if (pluginsFromConfig.length >0) {
+        return plugin('add', pluginsFromConfig);
+    }
+    return Q.all('No config.xml plugins to install');
 }

http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/a0177955/cordova-lib/src/cordova/superspawn.js
----------------------------------------------------------------------
diff --git a/cordova-lib/src/cordova/superspawn.js b/cordova-lib/src/cordova/superspawn.js
index 51a4d6b..b35e311 100644
--- a/cordova-lib/src/cordova/superspawn.js
+++ b/cordova-lib/src/cordova/superspawn.js
@@ -141,10 +141,3 @@ exports.spawn = function(cmd, args, opts) {
     return d.promise;
 };
 
-exports.maybeSpawn = function(cmd, args, opts) {
-    if (fs.existsSync(cmd)) {
-        return exports.spawn(cmd, args, opts);
-    }
-    return Q(null);
-};
-

http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/a0177955/cordova-lib/src/plugman/create.js
----------------------------------------------------------------------
diff --git a/cordova-lib/src/plugman/create.js b/cordova-lib/src/plugman/create.js
index a63ffea..684b126 100644
--- a/cordova-lib/src/plugman/create.js
+++ b/cordova-lib/src/plugman/create.js
@@ -37,38 +37,38 @@ module.exports = function create( name, id, version, pluginPath, options
) {
         clobber,
         jsMod;
 
-    // Check we are not already in a plugin
+    //check we are not already in a plugin
     if( fs.existsSync( cwd + 'plugin.xml' ) ) {
         return Q.reject( new CordovaError( 'plugin.xml already exists. Are you already in
a plugin?' ) );
     }
 
-    // Create a plugin.xml file
+    //Create a plugin.xml file
     root = et.Element( 'plugin' );
     root.set( 'xmlns', 'http://apache.org/cordova/ns/plugins/1.0' );
     root.set( 'xmlns:android', 'http://schemas.android.com/apk/res/android' );
     root.set( 'id', id );
     root.set( 'version', version );
 
-    // Add the name tag
+    //Add the name tag
     pluginName = et.XML( '<name>' );
     pluginName.text = name;
     root.append( pluginName );
 
-    // Loop through the options( variables ) for other tags
+    //loop through the options( variables ) for other tags
     for( var key in options ) {
         var temp = et.XML( '<' + key + '>');
         temp.text = options[ key ];
         root.append( temp );
     }
 
-    // Setup the directory structure
+    //setup the directory structure
     shell.mkdir( '-p', cwd + 'www' );
     shell.mkdir( '-p', cwd + 'src' );
 
-    // Create a base plugin.js file
+    //create a base plugin.js file
     baseJS = fs.readFileSync( templatesDir + 'base.js', 'utf-8').replace( /%pluginName%/g,
name );
     fs.writeFileSync( cwd + 'www/' + name + '.js', baseJS, 'utf-8' );
-    // Add it to the xml as a js module
+    //Add it to the xml as a js module
     jsMod = et.Element( 'js-module' );
     jsMod.set( 'src', 'www/' + name + '.js' );
     jsMod.set( 'name', name );
@@ -79,7 +79,7 @@ module.exports = function create( name, id, version, pluginPath, options
) {
 
     root.append( jsMod );
 
-    // Write out the plugin.xml file
+    //Write out the plugin.xml file
     fs.writeFileSync( cwd + 'plugin.xml', new et.ElementTree( root ).write( {indent: 4} ),
'utf-8' );
 
     return Q();

http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/a0177955/cordova-lib/src/plugman/install.js
----------------------------------------------------------------------
diff --git a/cordova-lib/src/plugman/install.js b/cordova-lib/src/plugman/install.js
index 045afb7..83834b4 100644
--- a/cordova-lib/src/plugman/install.js
+++ b/cordova-lib/src/plugman/install.js
@@ -512,19 +512,19 @@ function handleInstall(actions, pluginInfo, platform, project_dir, plugins_dir,
     var handler = platform_modules[platform];
 
     var platformTag = pluginInfo._et.find('./platform[@name="'+platform+'"]');
-
     // CB-6976 Windows Universal Apps. For smooth transition and to prevent mass api failures
     // we allow using windows8 tag for new windows platform
     if (platform == 'windows' && !platformTag) {
         platformTag = pluginInfo._et.find('platform[@name="' + 'windows8' + '"]');
     }
-    if (platformTag) {
+    if ( pluginInfo.hasPlatformSection(platform) ) {
         var sourceFiles = platformTag.findall('./source-file'),
             headerFiles = platformTag.findall('./header-file'),
             resourceFiles = platformTag.findall('./resource-file'),
             frameworkFiles = platformTag.findall('./framework'),
             libFiles = platformTag.findall('./lib-file');
 
+
         // queue up native stuff
         sourceFiles && sourceFiles.forEach(function(item) {
             actions.push(actions.createAction(handler['source-file'].install,

http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/a0177955/cordova-lib/src/plugman/platform.js
----------------------------------------------------------------------
diff --git a/cordova-lib/src/plugman/platform.js b/cordova-lib/src/plugman/platform.js
index 8761986..414e975 100644
--- a/cordova-lib/src/plugman/platform.js
+++ b/cordova-lib/src/plugman/platform.js
@@ -33,23 +33,23 @@ module.exports = {
         var pluginxml,
             platform;
 
-        // Check to make sure we are in the plugin first
+        //check to make sure we are in the plugin first
         if( !fs.existsSync( 'plugin.xml' ) ) {
             return Q.reject( new Error( "can't find a plugin.xml.  Are you in the plugin?"
) );
         }
 
-        // Get the current plugin.xml file
+        //Get the current plugin.xml file
         pluginxml = et.parse( fs.readFileSync('plugin.xml', 'utf-8') );
 
-        // Check if this platform exists
+        //Check if this platform exists
         if( pluginxml.find("./platform/[@name='"+ platformName +"']") ) {
             return Q.reject( new Error( "platform: " + platformName + " already added"  )
);
         }
 
-        // Get the platform specific elements
+        //Get the platform specific elements
         platform = doPlatform( platformName, pluginxml.find("./name").text, pluginxml.getroot().get(
"id" ) );
 
-        // Make sure we support it
+        //Make sure we support it
         if( !platform ) {
             return Q.reject( new Error( "platform: " + platformName + " not yet supported"
 ) );
         }
@@ -60,26 +60,26 @@ module.exports = {
         return Q();
     },
     remove: function( platformName ) {
-        // Check to make sure we are in the plugin first
+        //check to make sure we are in the plugin first
         if( !fs.existsSync( 'plugin.xml' ) ) {
             return Q.reject( new Error( "can't find a plugin.xml.  Are you in the plugin?"
) );
         }
 
-        // Get the current plugin.xml file
+        //Get the current plugin.xml file
         var pluginxml = et.parse( fs.readFileSync('plugin.xml', 'utf-8') );
 
-        // Check if this platform exists
+        //Check if this platform exists
         if( !pluginxml.find("./platform/[@name='"+ platformName +"']") ) {
             return Q.reject( new Error( "platform: " + platformName + " hasn't been added"
 ) );
         }
 
-        // Remove the Platform in question
+        //Remove the Platform in question
         pluginxml.getroot().remove( 0, pluginxml.find("./platform/[@name='"+ platformName
+"']") );
 
-        // Rewrite the plugin.xml file back out
+        //Rewrite the plugin.xml file back out
         fs.writeFileSync( "plugin.xml", pluginxml.write( "plugin.xml", {indent: 4} ), 'utf-8'
);
 
-        // Remove the src/"platform"
+        //Remove the src/"platform"
         shell.rm( '-rf', 'src/' + platformName );
 
         return Q();
@@ -107,7 +107,7 @@ function doPlatform( platformName, pluginName, pluginID, pluginVersion
) {
 }
 
 function doPlatformBase( templatesDir, platformName, pluginName, pluginID, pluginVersion
) {
-    // Create the default plugin file
+    //Create the default plugin file
     var baseFiles = [],
         i = 0;
 

http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/a0177955/cordova-lib/src/plugman/platforms/ios.js
----------------------------------------------------------------------
diff --git a/cordova-lib/src/plugman/platforms/ios.js b/cordova-lib/src/plugman/platforms/ios.js
index 49336fc..6e2f3fd 100644
--- a/cordova-lib/src/plugman/platforms/ios.js
+++ b/cordova-lib/src/plugman/platforms/ios.js
@@ -26,7 +26,7 @@ var path = require('path')
   , fs   = require('fs')
   , glob = require('glob')
   , xcode = require('xcode')
-  , plist = require('plist')
+  , plist = require('plist-with-patches')
   , shell = require('shelljs')
   , events = require('../../events')
   , cachedProjectFiles = {}
@@ -38,7 +38,7 @@ module.exports = {
     },
     package_name:function(project_dir) {
         var plist_file = glob.sync(path.join(project_dir, '**', '*-Info.plist'))[0];
-        return plist.parse(fs.readFileSync(plist_file, 'utf8')).CFBundleIdentifier;
+        return plist.parseFileSync(plist_file).CFBundleIdentifier;
     },
     'source-file':{
         install:function(source_el, plugin_dir, project_dir, plugin_id, project) {

http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/a0177955/cordova-lib/src/plugman/platforms/ubuntu.js
----------------------------------------------------------------------
diff --git a/cordova-lib/src/plugman/platforms/ubuntu.js b/cordova-lib/src/plugman/platforms/ubuntu.js
index bf2665b..c422d7c 100644
--- a/cordova-lib/src/plugman/platforms/ubuntu.js
+++ b/cordova-lib/src/plugman/platforms/ubuntu.js
@@ -32,10 +32,8 @@ function toCamelCase(str) {
     }).join('');
 }
 
-var shell = require('shelljs')
-   , fs = require('fs')
+var fs = require('fs')
    , path = require('path')
-   , common = require('./common')
    , events = require('../../events')
    , xml_helpers = require(path.join(__dirname, '..', '..', 'util', 'xml-helpers'));
 
@@ -51,24 +49,26 @@ module.exports = {
     },
     'source-file':{
         install:function(source_el, plugin_dir, project_dir, plugin_id) {
-            var dest = path.join('build', 'src', 'plugins', plugin_id, path.basename(source_el.attrib.src));
-            common.copyFile(plugin_dir, source_el.attrib.src, project_dir, dest);
+            var shell = require('shelljs');
+            var dest = path.join(project_dir, 'build', 'src', 'plugins', plugin_id);
+            shell.mkdir(dest);
+            shell.cp(path.join(plugin_dir, source_el.attrib.src), dest);
 
-            var cmake = path.join(project_dir, 'build', 'CMakeLists.txt');
-            shell.exec('touch ' + cmake);
+            shell.exec('touch ' + path.join(project_dir, 'CMakeLists.txt'));
         },
         uninstall:function(source_el, project_dir, plugin_id) {
+            var shell = require('shelljs');
+
             var dest = path.join(project_dir, 'build', 'src', 'plugins', plugin_id);
             shell.rm(path.join(dest, path.basename(source_el.attrib.src)));
-
-            var cmake = path.join(project_dir, 'build', 'CMakeLists.txt');
-            shell.exec('touch ' + cmake);
         }
     },
     'header-file':{
         install:function(source_el, plugin_dir, project_dir, plugin_id) {
-            var dest = path.join('build', 'src', 'plugins', plugin_id, path.basename(source_el.attrib.src));
-            common.copyFile(plugin_dir, source_el.attrib.src, project_dir, dest);
+            var shell = require('shelljs');
+            var dest = path.join(project_dir, 'build', 'src', 'plugins', plugin_id);
+            shell.mkdir(dest);
+            shell.cp(path.join(plugin_dir, source_el.attrib.src), dest);
 
             var plugins = path.join(project_dir, 'build', 'src', 'coreplugins.cpp');
             var src = String(fs.readFileSync(plugins));
@@ -81,6 +81,7 @@ module.exports = {
             fs.writeFileSync(plugins, src);
         },
         uninstall:function(source_el, project_dir, plugin_id) {
+            var shell = require('shelljs');
             var dest = path.join(project_dir, 'build', 'src', 'plugins', plugin_id);
             shell.rm(path.join(dest, path.basename(source_el.attrib.src)));
 
@@ -97,15 +98,15 @@ module.exports = {
     },
     'resource-file':{
         install:function(source_el, plugin_dir, project_dir, plugin_id) {
-            var dest = path.join('qml', path.basename(source_el.attrib.src));
-            if (source_el.attrib['target-dir'])
-                dest = path.join(source_el.attrib['target-dir'], path.basename(source_el.attrib.src));
-            common.copyFile(plugin_dir, source_el.attrib.src, project_dir, dest);
+            var shell = require('shelljs');
+            var dest = path.join(project_dir, 'qml');
+            shell.mkdir(dest);
+            shell.cp(path.join(plugin_dir, source_el.attrib.src), dest);
         },
         uninstall:function(source_el, project_dir, plugin_id) {
+            var shell = require('shelljs');
+
             var dest = path.join(project_dir, 'qml');
-            if (source_el.attrib['target-dir'])
-                dest = path.join(project_dir, source_el.attrib['target-dir']);
             shell.rm(path.join(dest, path.basename(source_el.attrib.src)));
         }
     },

http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/a0177955/cordova-lib/src/plugman/platforms/windows.js
----------------------------------------------------------------------
diff --git a/cordova-lib/src/plugman/platforms/windows.js b/cordova-lib/src/plugman/platforms/windows.js
index 347e6a3..803a3c8 100644
--- a/cordova-lib/src/plugman/platforms/windows.js
+++ b/cordova-lib/src/plugman/platforms/windows.js
@@ -39,8 +39,8 @@ module.exports = {
     package_name:function(project_dir) {
         // CB-6976 Windows Universal Apps. To make platform backward compatible
         // with old template we look for package.appxmanifest file as well.
-        var manifestPath = fs.existsSync(path.join(project_dir, 'package.windows.appxmanifest'))
?
-            path.join(project_dir, 'package.windows.appxmanifest') :
+        var manifestPath = fs.existsSync(path.join(project_dir, 'package.store.appxmanifest'))
?
+            path.join(project_dir, 'package.store.appxmanifest') :
             path.join(project_dir, 'package.appxmanifest');
 
         var manifest = xml_helpers.parseElementtreeSync(manifestPath);
@@ -61,15 +61,15 @@ module.exports = {
     'source-file': {
         install:function(source_el, plugin_dir, project_dir, plugin_id, project_file) {
             var targetDir = source_el.attrib['target-dir'] || '';
-            var dest = path.join('plugins', plugin_id, targetDir, path.basename(source_el.attrib['src']));
+            var dest = path.join('www', 'plugins', plugin_id, targetDir, path.basename(source_el.attrib['src']));
 
             common.copyNewFile(plugin_dir, source_el.attrib['src'], project_dir, dest);
             // add reference to this file to jsproj.
             project_file.addSourceFile(dest);
         },
         uninstall:function(source_el, project_dir, plugin_id, project_file) {
-            var dest = path.join('plugins', plugin_id,
-                                 source_el.attrib['target-dir'] || '',
+            var dest = path.join('www', 'plugins', plugin_id,
+                                 source_el.attrib['target-dir'] ? source_el.attrib['target-dir']
: '',
                                  path.basename(source_el.attrib['src']));
             common.removeFile(project_dir, dest);
             // remove reference to this file from csproj.

http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/a0177955/cordova-lib/src/plugman/prepare.js
----------------------------------------------------------------------
diff --git a/cordova-lib/src/plugman/prepare.js b/cordova-lib/src/plugman/prepare.js
index 284d164..961141e 100644
--- a/cordova-lib/src/plugman/prepare.js
+++ b/cordova-lib/src/plugman/prepare.js
@@ -26,6 +26,8 @@ var platform_modules = require('./platforms'),
     path            = require('path'),
     config_changes  = require('./util/config-changes'),
     xml_helpers     = require('../util/xml-helpers'),
+    wp8             = require('./platforms/wp8'),
+    windows        = require('./platforms/windows'),
     common          = require('./platforms/common'),
     fs              = require('fs'),
     shell           = require('shelljs'),
@@ -71,6 +73,16 @@ module.exports = function handlePrepare(project_dir, platform, plugins_dir,
www_
     events.emit('verbose', 'Processing configuration changes for plugins.');
     config_changes.process(plugins_dir, project_dir, platform);
 
+    // for windows phone and windows8 platforms we need to add all www resources to the .csproj(.jsproj)
file
+    // first we need to remove them all to prevent duplicates
+    var projFile;
+    if (platform == 'wp8' || platform == 'windows8' || platform == 'windows') {
+        projFile = (platform == 'wp8') ? wp8.parseProjectFile(project_dir) :
+            windows.parseProjectFile(project_dir);
+        // remove reference to cordova_plugins.js and all files inside plugins folder
+        projFile.removeSourceFile(/^(\$\(MSBuildThisFileDirectory\))?www\\(cordova_plugins.js|plugins\\)/i);
+    }
+
     platform_json = config_changes.get_platform_json(plugins_dir, platform);
     // This array holds all the metadata for each module and ends up in cordova_plugins.json
     var plugins = Object.keys(platform_json.installed_plugins).concat(Object.keys(platform_json.dependent_plugins));
@@ -138,11 +150,11 @@ module.exports = function handlePrepare(project_dir, platform, plugins_dir,
www_
 
             var fsPath = path.join.apply(path, pathParts);
             var scriptContent = fs.readFileSync(path.join(pluginDir, fsPath), 'utf-8').replace(/^\ufeff/,
''); // Window BOM
-            if (fsPath.match(/.*\.json$/)) {
-                scriptContent = 'module.exports = ' + scriptContent;
-            }
             scriptContent = 'cordova.define("' + moduleName + '", function(require, exports,
module) { ' + scriptContent + '\n});\n';
             fs.writeFileSync(path.join(platformPluginsDir, plugin_id, fsPath), scriptContent,
'utf-8');
+            if(platform == 'wp8' || platform == 'windows8') {
+                projFile.addSourceFile(path.join('www', 'plugins', plugin_id, fsPath));
+            }
 
             // Prepare the object for cordova_plugins.json.
             var obj = {
@@ -183,4 +195,9 @@ module.exports = function handlePrepare(project_dir, platform, plugins_dir,
www_
 
     events.emit('verbose', 'Writing out cordova_plugins.js...');
     fs.writeFileSync(path.join(wwwDir, 'cordova_plugins.js'), final_contents, 'utf-8');
+
+    if(platform == 'wp8' || platform == 'windows8' || platform == 'windows') {
+        projFile.addSourceFile(path.join('www', 'cordova_plugins.js'));
+        projFile.write();
+    }
 };

http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/a0177955/cordova-lib/src/plugman/registry/manifest.js
----------------------------------------------------------------------
diff --git a/cordova-lib/src/plugman/registry/manifest.js b/cordova-lib/src/plugman/registry/manifest.js
index 4496f34..5306b0e 100644
--- a/cordova-lib/src/plugman/registry/manifest.js
+++ b/cordova-lib/src/plugman/registry/manifest.js
@@ -88,7 +88,7 @@ function generatePackageJsonFromPluginXml(plugin_path) {
         if(keywords)     package_json.keywords     = keywords.split(',');
         if(platforms)    package_json.platforms    = platforms;
 
-        // Adding engines
+        // adding engines
         if(engines) {
             package_json.engines = [];
             for(var i = 0, j = engines.length ; i < j ; i++) {
@@ -96,10 +96,10 @@ function generatePackageJsonFromPluginXml(plugin_path) {
             }
         }
 
-        // Set docs_path to doc/index.md exists
+        //set docs_path to doc/index.md exists
         var docs_path = path.resolve(plugin_path, 'doc/index.md');
         if(!(fs.existsSync(docs_path))){
-            // Set docs_path to doc/en/index.md
+            //set docs_path to doc/en/index.md
             docs_path = path.resolve(plugin_path, 'doc/en/index.md');
         }
         if(fs.existsSync(docs_path)){
@@ -107,8 +107,9 @@ function generatePackageJsonFromPluginXml(plugin_path) {
             package_json.englishdoc = englishdoc;
         }
 
-        // Write package.json
+        // write package.json
         var package_json_path = path.resolve(plugin_path, 'package.json');
+        //console.log('about to write package.json');
         fs.writeFileSync(package_json_path, JSON.stringify(package_json, null, 4), 'utf8');
         return package_json;
     });

http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/a0177955/cordova-lib/src/plugman/util/action-stack.js
----------------------------------------------------------------------
diff --git a/cordova-lib/src/plugman/util/action-stack.js b/cordova-lib/src/plugman/util/action-stack.js
index d2508de..376b397 100644
--- a/cordova-lib/src/plugman/util/action-stack.js
+++ b/cordova-lib/src/plugman/util/action-stack.js
@@ -25,8 +25,6 @@
 var platforms = require("../platforms"),
     events = require('../../events'),
     Q = require('q');
-var superspawn = require('../../cordova/superspawn');
-var path = require('path');
 
 function ActionStack() {
     this.stack = [];
@@ -98,13 +96,12 @@ ActionStack.prototype = {
         }
         events.emit('verbose', 'Action stack processing complete.');
 
-        return superspawn.maybeSpawn(path.join(project_dir, 'cordova', 'version'))
-        .then(function(platformVersion) {
-            if (project_files) {
-                events.emit('verbose', 'Writing out ' + platform + ' project files...');
-                project_files.write(platformVersion);
-            }
-        });
+        if (project_files) {
+            events.emit('verbose', 'Writing out ' + platform + ' project files...');
+            project_files.write();
+        }
+
+        return Q();
     }
 };
 

http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/a0177955/cordova-lib/src/plugman/util/android-project.js
----------------------------------------------------------------------
diff --git a/cordova-lib/src/plugman/util/android-project.js b/cordova-lib/src/plugman/util/android-project.js
index bedec6b..d13bfe9 100644
--- a/cordova-lib/src/plugman/util/android-project.js
+++ b/cordova-lib/src/plugman/util/android-project.js
@@ -29,7 +29,6 @@ var fs = require('fs'),
     path = require('path'),
     properties_parser = require('properties-parser'),
     shell = require('shelljs');
-var semver = require('semver');
 
 
 function addLibraryReference(projectProperties, libraryPath) {
@@ -86,22 +85,16 @@ AndroidProject.prototype = {
         delete this._subProjectDirs[subDir];
         this._dirty = true;
     },
-    write: function(platformVersion) {
+    write: function () {
         if (!this._dirty) return;
 
         for (var filename in this._propertiesEditors) {
             fs.writeFileSync(filename, this._propertiesEditors[filename].toString());
         }
 
-        // Starting with 3.6.0, the build scripts set ANDROID_HOME, so there is
-        // no reason to keep run this command. Plus - we really want to avoid
-        // relying on the presense of native SDKs within plugman.
-        var needsUpdateProject = !platformVersion || semver.lt(platformVersion, '3.6.0');
-        if (needsUpdateProject) {
-            for (var sub_dir in this._subProjectDirs)
-            {
-                shell.exec('android update lib-project --path "' + sub_dir + '"');
-            }
+        for (var sub_dir in this._subProjectDirs)
+        {
+            shell.exec('android update lib-project --path "' + sub_dir + '"');
         }
         this._dirty = false;
     },

http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/a0177955/cordova-lib/src/plugman/util/config-changes.js
----------------------------------------------------------------------
diff --git a/cordova-lib/src/plugman/util/config-changes.js b/cordova-lib/src/plugman/util/config-changes.js
index 8a580cc..f93a9b5 100644
--- a/cordova-lib/src/plugman/util/config-changes.js
+++ b/cordova-lib/src/plugman/util/config-changes.js
@@ -38,7 +38,7 @@
 var fs   = require('fs'),
     path = require('path'),
     glob = require('glob'),
-    plist = require('plist'),
+    plist = require('plist-with-patches'),
     bplist = require('bplist-parser'),
     et   = require('elementtree'),
     semver = require('semver'),
@@ -201,7 +201,7 @@ function remove_plugin_changes(plugin_name, plugin_id, is_top_level) {
         if (self.platform == 'windows' && file == 'package.appxmanifest' &&
             !fs.existsSync(path.join(self.project_dir, 'package.appxmanifest'))) {
             // New windows template separate manifest files for Windows8, Windows8.1 and
WP8.1
-            var substs = ['package.phone.appxmanifest', 'package.windows.appxmanifest', 'package.windows80.appxmanifest'];
+            var substs = ['package.phone.appxmanifest', 'package.store.appxmanifest', 'package.store80.appxmanifest'];
             for (var subst in substs) {
                 events.emit('verbose', 'Applying munge to ' + substs[subst]);
                 self.apply_file_munge(substs[subst], munge.files[file], true);
@@ -260,7 +260,7 @@ function add_plugin_changes(plugin_id, plugin_vars, is_top_level, should_increme
         // 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.windows80.appxmanifest'];
+            var substs = ['package.phone.appxmanifest', 'package.store.appxmanifest', 'package.store80.appxmanifest'];
             for (var subst in substs) {
                 events.emit('verbose', 'Applying munge to ' + substs[subst]);
                 self.apply_file_munge(substs[subst], munge.files[file]);
@@ -421,8 +421,8 @@ ConfigKeeper.prototype.get = ConfigKeeper_get;
 function ConfigKeeper_get(project_dir, platform, file) {
     var self = this;
 
-    // This fixes a bug with older plugins - when specifying config xml instead of res/xml/config.xml
-    // https://issues.apache.org/jira/browse/CB-6414
+    //This fixes a bug with older plugins - when specifying config xml instead of res/xml/config.xml
+    //https://issues.apache.org/jira/browse/CB-6414
     if(file == 'config.xml' && platform == 'android'){
         file = 'res/xml/config.xml';
     }
@@ -554,9 +554,8 @@ function ConfigFile_load() {
         //       We always write out text plist, not binary.
         //       Do we still need to support binary plist?
         //       If yes, use plist.parseStringSync() and read the file once.
-        self.data = isBinaryPlist(filepath) ?
-                bplist.parseBuffer(fs.readFileSync(filepath)) :
-                plist.parse(fs.readFileSync(filepath, 'utf8'));
+        self.plist_module = (isBinaryPlist(filepath) ? bplist : plist);
+        self.data = self.plist_module.parseFileSync(filepath);
     }
 }
 
@@ -797,7 +796,7 @@ function process_munge(obj, createParents, func, keys /* or key1, key2
.... */ )
 }
 
 // All values from munge are added to base as
-// base[file][selector][child] += munge[file][selector][child]
+// base[file][selector][child] += base[file][selector][child]
 // Returns a munge object containing values that exist in munge
 // but not in base.
 function increment_munge(base, munge) {
@@ -820,7 +819,7 @@ function increment_munge(base, munge) {
 }
 
 // Update the base munge object as
-// base[file][selector][child] -= munge[file][selector][child]
+// base[file][selector][child] -= base[file][selector][child]
 // nodes that reached zero value are removed from base and added to the returned munge
 // object.
 function decrement_munge(base, munge) {

http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/a0177955/cordova-lib/src/plugman/util/plist-helpers.js
----------------------------------------------------------------------
diff --git a/cordova-lib/src/plugman/util/plist-helpers.js b/cordova-lib/src/plugman/util/plist-helpers.js
index 605a6c2..b8d93f2 100644
--- a/cordova-lib/src/plugman/util/plist-helpers.js
+++ b/cordova-lib/src/plugman/util/plist-helpers.js
@@ -23,12 +23,12 @@
 
 // contains PLIST utility functions
 
-var plist = require('plist');
+var plist = require('plist-with-patches');
 
 // adds node to doc at selector
 module.exports.graftPLIST = graftPLIST;
 function graftPLIST(doc, xml, selector) {
-    var obj = plist.parse('<plist>'+xml+'</plist>');
+    var obj = plist.parseStringSync('<plist>'+xml+'</plist>');
 
     var node = doc[selector];
     if (node && Array.isArray(node) && Array.isArray(obj))
@@ -42,7 +42,7 @@ function graftPLIST(doc, xml, selector) {
 // removes node from doc at selector
 module.exports.prunePLIST = prunePLIST;
 function prunePLIST(doc, xml, selector) {
-    var obj = plist.parse('<plist>'+xml+'</plist>');
+    var obj = plist.parseStringSync('<plist>'+xml+'</plist>');
 
     pruneOBJECT(doc, selector, obj);
 

http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/a0177955/cordova-lib/src/util/windows/jsproj.js
----------------------------------------------------------------------
diff --git a/cordova-lib/src/util/windows/jsproj.js b/cordova-lib/src/util/windows/jsproj.js
index ef1cb38..d847603 100644
--- a/cordova-lib/src/util/windows/jsproj.js
+++ b/cordova-lib/src/util/windows/jsproj.js
@@ -82,6 +82,8 @@ jsproj.prototype = {
 
         events.emit('verbose','addReference::' + relPath);
 
+        relPath = this.isUniversalWindowsApp ? '$(MSBuildThisFileDirectory)' + relPath :
relPath;
+
         var item = new et.Element('ItemGroup');
         var extName = path.extname(relPath);
 
@@ -108,6 +110,8 @@ jsproj.prototype = {
     removeReference:function(relPath) {
         events.emit('verbose','removeReference::' + relPath);
 
+        relPath = this.isUniversalWindowsApp ? '$(MSBuildThisFileDirectory)' + relPath :
relPath;
+
         var extName = path.extname(relPath);
         var includeText = path.basename(relPath,extName);
         // <ItemGroup>
@@ -130,6 +134,7 @@ jsproj.prototype = {
 
         relative_path.forEach(function(filePath) {
             filePath = filePath.split('/').join('\\');
+            filePath = this.isUniversalWindowsApp ? '$(MSBuildThisFileDirectory)' + filePath
: filePath;
 
             var content = new et.Element('Content');
             content.attrib.Include = filePath;
@@ -143,6 +148,7 @@ jsproj.prototype = {
         if (!isRegexp) {
             // path.normalize(relative_path);// ??
             relative_path = relative_path.split('/').join('\\');
+            relative_path = this.isUniversalWindowsApp ? '$(MSBuildThisFileDirectory)' +
relative_path : relative_path;
         }
 
         var root = this.xml.getroot();


Mime
View raw message