cordova-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From purplecabb...@apache.org
Subject [1/2] git commit: CB-6699 Include files from www folder via single element (use ** glob pattern)
Date Fri, 15 Aug 2014 20:42:41 GMT
Repository: cordova-lib
Updated Branches:
  refs/heads/master 1cf81044a -> c8adbc2a0


CB-6699 Include files from www folder via single element (use ** glob pattern)


Project: http://git-wip-us.apache.org/repos/asf/cordova-lib/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-lib/commit/ede4a867
Tree: http://git-wip-us.apache.org/repos/asf/cordova-lib/tree/ede4a867
Diff: http://git-wip-us.apache.org/repos/asf/cordova-lib/diff/ede4a867

Branch: refs/heads/master
Commit: ede4a867fd76b8bbc49838f0c58133077f2d2e1f
Parents: 1cf8104
Author: Vladimir Kotikov <v-vlkoti@microsoft.com>
Authored: Fri Aug 15 14:56:13 2014 +0400
Committer: Vladimir Kotikov <v-vlkoti@microsoft.com>
Committed: Fri Aug 15 15:51:10 2014 +0400

----------------------------------------------------------------------
 .../src/cordova/metadata/windows_parser.js      | 40 +------------------
 cordova-lib/src/cordova/metadata/wp8_parser.js  | 41 +-------------------
 cordova-lib/src/plugman/prepare.js              | 20 ----------
 3 files changed, 2 insertions(+), 99 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/ede4a867/cordova-lib/src/cordova/metadata/windows_parser.js
----------------------------------------------------------------------
diff --git a/cordova-lib/src/cordova/metadata/windows_parser.js b/cordova-lib/src/cordova/metadata/windows_parser.js
index eaeacbb..aefb94e 100644
--- a/cordova-lib/src/cordova/metadata/windows_parser.js
+++ b/cordova-lib/src/cordova/metadata/windows_parser.js
@@ -30,8 +30,7 @@ var fs            = require('fs'),
     ConfigParser  = require('../../configparser/ConfigParser'),
     CordovaError  = require('../../CordovaError'),
     xml           = require('../../util/xml-helpers'),
-    hooker        = require('../hooker'),
-    jsproj        = require('../../util/windows/jsproj');
+    hooker        = require('../hooker');
 
 module.exports = function windows_parser(project) {
     try {
@@ -229,42 +228,6 @@ module.exports.prototype = {
         shell.cp('-rf', path.join(platform_www, '*'), this.www_dir());
     },
 
-    // Returns an array of all the files in the given directory with relative paths
-    // - name     : the name of the top level directory (i.e all files will start with this
in their path)
-    // - dir     : the directory whos contents will be listed under 'name' directory
-    folder_contents:function(name, dir) {
-        var results = [];
-        var folder_dir = fs.readdirSync(dir);
-        for(var item in folder_dir) {
-            var stat = fs.statSync(path.join(dir, folder_dir[item]));
-            // Add all subfolder item paths if it's not a .svn dir.
-            if( stat.isDirectory() && (folder_dir[item] !== '.svn') ) {
-                var sub_dir = this.folder_contents(path.join(name, folder_dir[item]), path.join(dir,
folder_dir[item]));
-                for(var sub_item in sub_dir) {
-                    results.push(sub_dir[sub_item]);
-                }
-            } else if(stat.isFile()) {
-                results.push(path.join(name, folder_dir[item]));
-            }
-            // else { it is a FIFO, or a Socket, Symbolic Link or something ... }
-        }
-        return results;
-    },
-
-    // updates the jsproj file to explicitly list all www content.
-    update_jsproj:function() {
-        var projFile = new jsproj(this.projFilePath);
-        // remove any previous references to the www files
-        projFile.removeSourceFile(/^(\$\(MSBuildThisFileDirectory\))?www\\/i);
-
-        // now add all www references back in from the root www folder
-        var www_files = this.folder_contents('www', this.www_dir());
-        projFile.addSourceFile(www_files);
-
-        // save file
-        projFile.write();
-    },
-
     // calls the nessesary functions to update the windows8 project
     update_project:function(cfg) {
         // console.log("Updating windows8 project...");
@@ -282,7 +245,6 @@ module.exports.prototype = {
         return hooks.fire('pre_package', { wwwPath:this.www_dir(), platforms: ['windows8']
})
         .then(function() {
             // overrides (merges) are handled in update_www()
-            that.update_jsproj();
             that.add_bom();
             util.deleteSvnFolders(that.www_dir());
         });

http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/ede4a867/cordova-lib/src/cordova/metadata/wp8_parser.js
----------------------------------------------------------------------
diff --git a/cordova-lib/src/cordova/metadata/wp8_parser.js b/cordova-lib/src/cordova/metadata/wp8_parser.js
index 0d458ee..4d5b332 100644
--- a/cordova-lib/src/cordova/metadata/wp8_parser.js
+++ b/cordova-lib/src/cordova/metadata/wp8_parser.js
@@ -30,8 +30,7 @@ var fs            = require('fs'),
     ConfigParser  = require('../../configparser/ConfigParser'),
     CordovaError  = require('../../CordovaError'),
     xml           = require('../../util/xml-helpers'),
-    hooker        = require('../hooker'),
-    csproj = require('../../util/windows/csproj');
+    hooker        = require('../hooker');
 
 module.exports = function wp8_parser(project) {
     try {
@@ -197,43 +196,6 @@ module.exports.prototype = {
         shell.cp('-rf', path.join(platform_www, '*'), this.www_dir());
     },
 
-    // updates the csproj file to explicitly list all www content.
-    update_csproj:function() {
-        var projFile = new csproj(this.csproj_path);
-
-        // remove any previous references to the www files
-        projFile.removeSourceFile(new RegExp('www\\\\*', 'i'));
-
-        // now add all www references back in from the root www folder
-        var www_files = this.folder_contents('www', this.www_dir());
-        projFile.addSourceFile(www_files);
-        // save file
-        projFile.write();
-    },
-    // Returns an array of all the files in the given directory with relative paths
-    // - name     : the name of the top level directory (i.e all files will start with this
in their path)
-    // - dir     : the directory whos contents will be listed under 'name' directory
-    folder_contents:function(name, dir) {
-        var results = [];
-        var folder_dir = fs.readdirSync(dir);
-        for(var item in folder_dir) {
-            var stat = fs.statSync(path.join(dir, folder_dir[item]));
-
-            if(stat.isDirectory()) {
-                var sub_dir = this.folder_contents(path.join(name, folder_dir[item]), path.join(dir,
folder_dir[item]));
-                //Add all subfolder item paths
-                for(var sub_item in sub_dir) {
-                    results.push(sub_dir[sub_item]);
-                }
-            }
-            else if(stat.isFile()) {
-                results.push(path.join(name, folder_dir[item]));
-            }
-            // else { it is a FIFO, or a Socket or something ... }
-        }
-        return results;
-    },
-
     // calls the nessesary functions to update the wp8 project
     // Returns a promise.
     update_project:function(cfg) {
@@ -250,7 +212,6 @@ module.exports.prototype = {
         var hooks = new hooker(projectRoot);
         return hooks.fire('pre_package', { wwwPath:this.www_dir(), platforms: ['wp8']  })
         .then(function() {
-            that.update_csproj();
             util.deleteSvnFolders(that.www_dir());
         });
     }

http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/ede4a867/cordova-lib/src/plugman/prepare.js
----------------------------------------------------------------------
diff --git a/cordova-lib/src/plugman/prepare.js b/cordova-lib/src/plugman/prepare.js
index 6083cbf..284d164 100644
--- a/cordova-lib/src/plugman/prepare.js
+++ b/cordova-lib/src/plugman/prepare.js
@@ -26,8 +26,6 @@ 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'),
@@ -73,16 +71,6 @@ 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));
@@ -155,9 +143,6 @@ module.exports = function handlePrepare(project_dir, platform, plugins_dir,
www_
             }
             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 = {
@@ -198,9 +183,4 @@ 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();
-    }
 };


Mime
View raw message