cordova-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From shaz...@apache.org
Subject cordova-lib git commit: CB-9517 Adding a plugin on iOS/OSX that uses a private framework does not work (closes #281)
Date Tue, 25 Aug 2015 21:08:25 GMT
Repository: cordova-lib
Updated Branches:
  refs/heads/master fe517618c -> d1a9602a5


CB-9517 Adding a plugin on iOS/OSX that uses a private framework does not work (closes #281)


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

Branch: refs/heads/master
Commit: d1a9602a5431274699969921ad9a911b163f6059
Parents: fe51761
Author: Tobias Bocanegra <tripod@adobe.com>
Authored: Wed Aug 19 14:29:13 2015 -0700
Committer: Shazron Abdullah <shazron@apache.org>
Committed: Tue Aug 25 14:08:24 2015 -0700

----------------------------------------------------------------------
 cordova-lib/src/plugman/platforms/ios.js | 43 +++++++++++++++++++++++++--
 cordova-lib/src/plugman/plugman.js       |  2 +-
 2 files changed, 42 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/d1a9602a/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 38981dd..a6a55cc 100644
--- a/cordova-lib/src/plugman/platforms/ios.js
+++ b/cordova-lib/src/plugman/platforms/ios.js
@@ -93,6 +93,39 @@ function uninstallHelper(type, obj, project_dir, plugin_id, options, project)
{
     }
 }
 
+// special handlers to add frameworks to the 'Embed Frameworks' build phase, needed for custom
frameworks
+// see CB-9517. should probably be moved to node-xcode.
+var util = require('util');
+function pbxBuildPhaseObj(file) {
+    var obj = Object.create(null);
+    obj.value = file.uuid;
+    obj.comment = longComment(file);
+    return obj;
+}
+
+function longComment(file) {
+    return util.format('%s in %s', file.basename, file.group);
+}
+
+xcode.project.prototype.pbxEmbedFrameworksBuildPhaseObj = function (target) {
+    return this.buildPhaseObject('PBXCopyFilesBuildPhase', 'Embed Frameworks', target);
+};
+
+xcode.project.prototype.addToPbxEmbedFrameworksBuildPhase = function (file) {
+    var sources = this.pbxEmbedFrameworksBuildPhaseObj(file.target);
+    if (sources) {
+        sources.files.push(pbxBuildPhaseObj(file));
+    }
+};
+xcode.project.prototype.removeFromPbxEmbedFrameworksBuildPhase = function (file) {
+    var sources = this.pbxEmbedFrameworksBuildPhaseObj(file.target);
+    if (sources) {
+        sources.files = _.reject(sources.files, function(file){
+            return file.comment === longComment(file);
+        });
+    }
+};
+
 module.exports = {
     www_dir:function(project_dir) {
         return path.join(project_dir, 'www');
@@ -146,12 +179,18 @@ module.exports = {
             shell.mkdir('-p', path.dirname(targetDir));
             shell.cp('-R', srcFile, path.dirname(targetDir)); // frameworks are directories
             var project_relative = path.relative(project_dir, targetDir);
-            project.xcode.addFramework(project_relative, {customFramework: true});
+            var pbxFile = project.xcode.addFramework(project_relative, {customFramework:
true});
+            if (pbxFile) {
+                project.xcode.addToPbxEmbedFrameworksBuildPhase(pbxFile);
+            }
         },
         uninstall:function(obj, project_dir, plugin_id, options, project) {
             var src = obj.src,
                 targetDir = path.resolve(project.plugins_dir, plugin_id, path.basename(src));
-            project.xcode.removeFramework(targetDir, {customFramework: true});
+            var pbxFile = project.xcode.removeFramework(targetDir, {customFramework: true});
+            if (pbxFile) {
+                project.xcode.removeFromPbxEmbedFrameworksBuildPhase(pbxFile);
+            }
             shell.rm('-rf', targetDir);
         }
     },

http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/d1a9602a/cordova-lib/src/plugman/plugman.js
----------------------------------------------------------------------
diff --git a/cordova-lib/src/plugman/plugman.js b/cordova-lib/src/plugman/plugman.js
index 0a8cd8d..7d952f5 100644
--- a/cordova-lib/src/plugman/plugman.js
+++ b/cordova-lib/src/plugman/plugman.js
@@ -94,6 +94,7 @@ plugman.commands =  {
             plugman.prepare = require('./prepare-browserify');
         }
         var cli_variables = {};
+
         if (cli_opts.variable) {
             cli_opts.variable.forEach(function (variable) {
                 var tokens = variable.split('=');
@@ -108,7 +109,6 @@ plugman.commands =  {
             searchpath: cli_opts.searchpath,
             link: cli_opts.link
         };
-
         var p = Q();
         cli_opts.plugin.forEach(function (pluginSrc) {
             p = p.then(function () {


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org


Mime
View raw message