cordova-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From agri...@apache.org
Subject git commit: CB-5299 Cache pbxproj to avoid re-parsing it for each plugin.
Date Fri, 17 Jan 2014 19:25:40 GMT
Updated Branches:
  refs/heads/master e9615884c -> 4b9804391


CB-5299 Cache pbxproj to avoid re-parsing it for each plugin.

Parsing pbxproj is very slow (~250ms on my machine). It is done for each plugin
that needs to add frameworks to the ios project.


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

Branch: refs/heads/master
Commit: 4b98043916d2c23afd3df4afae48a0c555ddb4e3
Parents: e961588
Author: Mark Koudritsky <kamrik@gmail.com>
Authored: Thu Jan 16 14:51:09 2014 -0500
Committer: Andrew Grieve <agrieve@chromium.org>
Committed: Fri Jan 17 14:24:54 2014 -0500

----------------------------------------------------------------------
 spec/prepare.spec.js |  2 +-
 src/prepare.js       | 17 +++++++++++++++--
 2 files changed, 16 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/4b980439/spec/prepare.spec.js
----------------------------------------------------------------------
diff --git a/spec/prepare.spec.js b/spec/prepare.spec.js
index 3d4ff78..0388ec8 100644
--- a/spec/prepare.spec.js
+++ b/spec/prepare.spec.js
@@ -164,7 +164,7 @@ describe('prepare command', function() {
                 cordova.raw.prepare().then(function() {
                     supported_platforms.forEach(function(p) {
                         var platform_path = path.join(project_dir, 'platforms', p);
-                        expect(add_plugin_changes).toHaveBeenCalledWith((p=='blackberry'?'blackberry10':p),
platform_path, plugins_dir, 'testPlugin', 'plugin vars', true, false);
+                        expect(add_plugin_changes).toHaveBeenCalledWith((p=='blackberry'?'blackberry10':p),
platform_path, plugins_dir, 'testPlugin', 'plugin vars', true, false, {});
                     });
                 }, function(err) {
                     expect(err).toBeUndefined();

http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/4b980439/src/prepare.js
----------------------------------------------------------------------
diff --git a/src/prepare.js b/src/prepare.js
index 7ca3f2e..2dd7d35 100644
--- a/src/prepare.js
+++ b/src/prepare.js
@@ -100,13 +100,26 @@ module.exports = function prepare(options) {
                 var plugins = cordova_util.findPlugins(plugins_dir),
                     platform_json = plugman.config_changes.get_platform_json(plugins_dir,
platform);
                 if (plugins && Array.isArray(plugins)) {
+                    var plugman_cache = {};
                     plugins.forEach(function(plugin_id) {
                         if (platform_json.installed_plugins[plugin_id]) {
                             events.emit('verbose', 'Ensuring plugin "' + plugin_id + '" is
installed correctly...');
-                            plugman.config_changes.add_plugin_changes(platform, platformPath,
plugins_dir, plugin_id, /* variables for plugin */ platform_json.installed_plugins[plugin_id],
/* top level plugin? */ true, /* should increment config munge? cordova-cli never should,
only plugman */ false);
+                            plugman.config_changes.add_plugin_changes(
+                                platform, platformPath, plugins_dir, plugin_id,
+                                /* variables for plugin */ platform_json.installed_plugins[plugin_id],
+                                /* top level plugin? */ true,
+                                /* should increment config munge? cordova-cli never should,
only plugman */ false,
+                                plugman_cache
+                            );
                         } else if (platform_json.dependent_plugins[plugin_id]) {
                             events.emit('verbose', 'Ensuring plugin "' + plugin_id + '" is
installed correctly...');
-                            plugman.config_changes.add_plugin_changes(platform, platformPath,
plugins_dir, plugin_id, /* variables for plugin */ platform_json.dependent_plugins[plugin_id],
/* top level plugin? */ false, /* should increment config munge? cordova-cli never should,
only plugman */ false);
+                            plugman.config_changes.add_plugin_changes(
+                                platform, platformPath, plugins_dir, plugin_id,
+                                /* variables for plugin */ platform_json.dependent_plugins[plugin_id],
+                                /* top level plugin? */ false,
+                                /* should increment config munge? cordova-cli never should,
only plugman */ false,
+                                plugman_cache
+                            );
                         }
                         events.emit('verbose', 'Plugin "' + plugin_id + '" is good to go.');
                     });


Mime
View raw message