cordova-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From fil...@apache.org
Subject git commit: [CB-4373] Uninstall should no longer concern itself with frameworks (handled in prepare). Added array of four frameworks required by default by cordova-ios.
Date Tue, 30 Jul 2013 03:07:13 GMT
Updated Branches:
  refs/heads/frameworks 00ece4c51 -> c19d4d66a


[CB-4373] Uninstall should no longer concern itself with frameworks (handled in prepare).
Added array of four frameworks required by default by cordova-ios.


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

Branch: refs/heads/frameworks
Commit: c19d4d66a130ee9fbdb24366bef9c302df56a527
Parents: 00ece4c
Author: Fil Maj <maj.fil@gmail.com>
Authored: Mon Jul 29 20:07:05 2013 -0700
Committer: Fil Maj <maj.fil@gmail.com>
Committed: Mon Jul 29 20:07:05 2013 -0700

----------------------------------------------------------------------
 spec/util/config-changes.spec.js | 22 +++++-----------------
 src/uninstall.js                 |  7 +------
 src/util/config-changes.js       | 30 ++++++++++++++++++++++--------
 3 files changed, 28 insertions(+), 31 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-plugman/blob/c19d4d66/spec/util/config-changes.spec.js
----------------------------------------------------------------------
diff --git a/spec/util/config-changes.spec.js b/spec/util/config-changes.spec.js
index 59f674c..fa0ec70 100644
--- a/spec/util/config-changes.spec.js
+++ b/spec/util/config-changes.spec.js
@@ -19,6 +19,8 @@ var configChanges = require('../../src/util/config-changes'),
     ios_config_xml = path.join(__dirname, '..', 'projects', 'ios-config-xml', '*'),
     plugins_dir = path.join(temp, 'cordova', 'plugins');
 
+// TODO: dont do fs so much
+
 var dummy_xml = new et.ElementTree(et.XML(fs.readFileSync(path.join(dummyplugin, 'plugin.xml'),
'utf-8')));
 
 function innerXML(xmltext) {
@@ -34,23 +36,6 @@ describe('config-changes module', function() {
         shell.rm('-rf', temp);
     });
 
-    it('should have queue methods', function() {
-        expect(configChanges.add_installed_plugin_to_prepare_queue).toBeDefined();
-        expect(configChanges.add_uninstalled_plugin_to_prepare_queue).toBeDefined();
-    });
-    it('should have a get_platform_json method', function() {
-        expect(configChanges.get_platform_json).toBeDefined();
-    });
-    it('should have a save_platform_json method', function() {
-        expect(configChanges.save_platform_json).toBeDefined();
-    });
-    it('should have a generate_plugin_config_munge method', function() {
-        expect(configChanges.generate_plugin_config_munge).toBeDefined();
-    });
-    it('should have a process method', function() {
-        expect(configChanges.process).toBeDefined();
-    });
-
     describe('queue methods', function() {
         describe('add_installed_plugin_to_prepare_queue', function() {
             it('should call get_platform_json method', function() {
@@ -219,6 +204,9 @@ describe('config-changes module', function() {
             expect(munge['plugins-plist']).toBeDefined();
             expect(munge['plugins-plist']['com.phonegap.plugins.dummyplugin']).toEqual('DummyPluginCommand');
         });
+        it('should special case framework elements for ios', function() {
+
+        });
     });
 
     describe('processing of plugins (via process method)', function() {

http://git-wip-us.apache.org/repos/asf/cordova-plugman/blob/c19d4d66/src/uninstall.js
----------------------------------------------------------------------
diff --git a/src/uninstall.js b/src/uninstall.js
index 3b73a53..31117af 100644
--- a/src/uninstall.js
+++ b/src/uninstall.js
@@ -132,8 +132,7 @@ function handleUninstall(actions, platform, plugin_id, plugin_et, project_dir,
w
     if (platformTag) {
         var sourceFiles = platformTag.findall('./source-file'),
             headerFiles = platformTag.findall('./header-file'),
-            resourceFiles = platformTag.findall('./resource-file'),
-            frameworks = platformTag.findall('./framework');
+            resourceFiles = platformTag.findall('./resource-file');
         assets = assets.concat(platformTag.findall('./asset'));
 
         // queue up native stuff
@@ -148,10 +147,6 @@ function handleUninstall(actions, platform, plugin_id, plugin_et, project_dir,
w
         resourceFiles && resourceFiles.forEach(function(resource) {
             actions.push(actions.createAction(handler["resource-file"].uninstall, [resource,
project_dir], handler["resource-file"].install, [resource, plugin_dir, project_dir]));
         });
-
-        frameworks && frameworks.forEach(function(framework) {
-            actions.push(actions.createAction(handler["framework"].uninstall, [framework,
project_dir], handler["framework"].install, [framework, plugin_dir, project_dir]));
-        });
     }
 
     // queue up asset installation

http://git-wip-us.apache.org/repos/asf/cordova-plugman/blob/c19d4d66/src/util/config-changes.js
----------------------------------------------------------------------
diff --git a/src/util/config-changes.js b/src/util/config-changes.js
index 36dfe4b..558f80d 100644
--- a/src/util/config-changes.js
+++ b/src/util/config-changes.js
@@ -44,6 +44,14 @@ function checkPlatform(platform) {
     if (!(platform in require('./../platforms'))) throw new Error('platform "' + platform
+ '" not recognized.');
 }
 
+// These frameworks are required by cordova-ios by default. We should never add/remove them.
+var keep_these_frameworks = [
+    'MobileCoreServices.framework',
+    'CoreGraphics.framework',
+    'CoreLocation.framework',
+    'AssetsLibrary.framework'
+];
+
 module.exports = {
     add_installed_plugin_to_prepare_queue:function(plugins_dir, plugin, platform, vars, is_top_level)
{
         checkPlatform(platform);
@@ -217,9 +225,12 @@ module.exports = {
                                 if (global_munge[file][selector][xml_child] === 0) {
                                     if (is_framework) {
                                         // this is a .framework reference in ios files
-                                        pbxproj.xcode.removeFramework(selector); // in this
case the 2nd-level key is the src attrib of <framework> els
-                                        // TODO: dont write on every loop eh
-                                        fs.writeFileSync(pbxproj.pbx, pbxproj.xcode.writeSync());
+                                        // We also need to keep some frameworks core to cordova-ios
+                                        if (keep_these_frameworks.indexOf(selector) == -1)
{
+                                            pbxproj.xcode.removeFramework(selector); // in
this case the 2nd-level key is the src attrib of <framework> els
+                                            // TODO: dont write on every loop eh
+                                            fs.writeFileSync(pbxproj.pbx, pbxproj.xcode.writeSync());
+                                        }
                                     } else {
                                         // this xml child is no longer necessary, prune it
                                         // config.xml referenced in ios config changes refer
to the project's config.xml, which we need to glob for.
@@ -327,11 +338,14 @@ module.exports = {
                         if (global_munge[file][selector][xml_child] == 1) {
                             if (is_framework) {
                                 var src = selector; // 2nd-level leaves are src path
-                                // xml_child in this case is whether the framework should
use weak or not
-                                var opt = {weak: (xml_child != 'true' ? false : true)};
-                                pbxproj.xcode.addFramework(src, opt);
-                                // TODO: dont write on every loop eh
-                                fs.writeFileSync(pbxproj.pbx, pbxproj.xcode.writeSync());
+                                // Only add the framework if it's not a cordova-ios core
framework
+                                if (keep_these_frameworks.indexOf(src) > -1) {
+                                    // xml_child in this case is whether the framework should
use weak or not
+                                    var opt = {weak: (xml_child != 'true' ? false : true)};
+                                    pbxproj.xcode.addFramework(src, opt);
+                                    // TODO: dont write on every loop eh
+                                    fs.writeFileSync(pbxproj.pbx, pbxproj.xcode.writeSync());
+                                }
                             } else {
                                 // this xml child is new, graft it (only if config file exists)
                                 // config file may be in a place not exactly specified in
the target


Mime
View raw message