[ 
https://issues.apache.org/jira/browse/CB-10034?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16602707#comment-16602707
 ] 

ASF GitHub Bot commented on CB-10034:
-------------------------------------

raphinesse closed pull request #399: CB-10034 Addresses Embedded/Linked/Signed 
Custom Frameworks via updated node-xcode
URL: https://github.com/apache/cordova-lib/pull/399
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/cordova-common/src/PluginInfo/PluginInfo.js 
b/cordova-common/src/PluginInfo/PluginInfo.js
index e1a1b3180..7c28eb572 100644
--- a/cordova-common/src/PluginInfo/PluginInfo.js
+++ b/cordova-common/src/PluginInfo/PluginInfo.js
@@ -301,8 +301,11 @@ function PluginInfo(dirname) {
                 type: el.attrib.type,
                 parent: el.attrib.parent,
                 custom: isStrTrue(el.attrib.custom),
+                embed: el.attrib.embed === undefined ? undefined : 
isStrTrue(el.attrib.embed),
+                link: el.attrib.link === undefined ? undefined : 
isStrTrue(el.attrib.link),
                 src: el.attrib.src,
                 weak: isStrTrue(el.attrib.weak),
+                sign: isStrTrue(el.attrib.sign),
                 versions: el.attrib.versions,
                 targetDir: el.attrib['target-dir'],
                 deviceTarget: el.attrib['device-target'] || el.attrib.target,
diff --git a/cordova-lib/package.json b/cordova-lib/package.json
index 5a3d2ba6e..4df772076 100644
--- a/cordova-lib/package.json
+++ b/cordova-lib/package.json
@@ -40,7 +40,7 @@
         "underscore": "1.7.0",
         "unorm": "1.3.3",
         "valid-identifier": "0.0.1",
-        "xcode": "0.8.0"
+        "xcode": "0.8.6"
     },
     "devDependencies": {
         "codecov": "^1.0.1",
diff --git a/cordova-lib/spec-plugman/platforms/ios.spec.js 
b/cordova-lib/spec-plugman/platforms/ios.spec.js
index 7c245bd2c..c3e999cfa 100644
--- a/cordova-lib/spec-plugman/platforms/ios.spec.js
+++ b/cordova-lib/spec-plugman/platforms/ios.spec.js
@@ -269,7 +269,7 @@ describe('ios project handler', function() {
                 var frameworks = copyArray(valid_custom_frameworks);
                 var spy = spyOn(proj_files.xcode, 'addFramework');
                 ios['framework'].install(frameworks[0], dummyplugin, temp, 
dummy_id, null, proj_files);
-                
expect(spy).toHaveBeenCalledWith(path.normalize('SampleApp/Plugins/org.test.plugins.dummyplugin/Custom.framework'),
 {customFramework:true});
+                
expect(spy).toHaveBeenCalledWith(path.normalize('SampleApp/Plugins/org.test.plugins.dummyplugin/Custom.framework'),
 {customFramework:true, embed:true, link:undefined, sign:false});
             });
 
             // TODO: Add more tests to cover the cases:
@@ -299,6 +299,27 @@ describe('ios project handler', function() {
                                                      path.join(temp, 
'SampleApp/Plugins/org.test.plugins.dummyplugin'));
                 });
             });
+
+            it('with embed="false" attribute should call into xcodeproj\'s 
addFramework accordingly', function() {
+                var frameworks = copyArray(valid_custom_frameworks);
+                var spy = spyOn(proj_files.xcode, 'addFramework');
+                ios['framework'].install(frameworks[1], dummyplugin, temp, 
dummy_id, null, proj_files);
+                
expect(spy).toHaveBeenCalledWith(path.normalize('SampleApp/Plugins/org.test.plugins.dummyplugin/NonEmbeddable.framework'),
 {customFramework:true, embed:false, link:undefined, sign:false});
+            });
+
+            it('with link="false" attribute should call into xcodeproj\'s 
addFramework accordingly', function() {
+                var frameworks = copyArray(valid_custom_frameworks);
+                var spy = spyOn(proj_files.xcode, 'addFramework');
+                ios['framework'].install(frameworks[2], dummyplugin, temp, 
dummy_id, null, proj_files);
+                
expect(spy).toHaveBeenCalledWith(path.normalize('SampleApp/Plugins/org.test.plugins.dummyplugin/Unlinkable.framework'),
 {customFramework:true, embed:false, link:false, sign:false});
+            });
+
+            it('with sign="true" attribute should call into xcodeproj\'s 
addFramework accordingly', function() {
+                var frameworks = copyArray(valid_custom_frameworks);
+                var spy = spyOn(proj_files.xcode, 'addFramework');
+                ios['framework'].install(frameworks[3], dummyplugin, temp, 
dummy_id, null, proj_files);
+                
expect(spy).toHaveBeenCalledWith(path.normalize('SampleApp/Plugins/org.test.plugins.dummyplugin/Signable.framework'),
 {customFramework:true, embed:true, link:undefined, sign:true});
+            });
         });
         it('of two plugins should apply xcode file changes from both', 
function(){
             runs(function() {
@@ -310,19 +331,18 @@ describe('ios project handler', function() {
             waitsFor(function() { return done; }, 'install promise never 
resolved', 200);
             runs(function() {
                 var xcode = ios.parseProjectFile(temp).xcode;
-                // from org.test.plugins.dummyplugin
-                expect(xcode.hasFile(slashJoin('Resources', 
'DummyPlugin.bundle'))).toBe(true);
-                
expect(xcode.hasFile(slashJoin('Plugins','org.test.plugins.dummyplugin', 
'DummyPluginCommand.h'))).toBe(true);
-                
expect(xcode.hasFile(slashJoin('Plugins','org.test.plugins.dummyplugin', 
'DummyPluginCommand.m'))).toBe(true);
-                
expect(xcode.hasFile(slashJoin('Plugins','org.test.plugins.dummyplugin','targetDir','TargetDirTest.h'))).toBe(true);
-                
expect(xcode.hasFile(slashJoin('Plugins','org.test.plugins.dummyplugin','targetDir','TargetDirTest.m'))).toBe(true);
-                
expect(xcode.hasFile('usr/lib/src/ios/libsqlite3.dylib')).toBe(true);
-                
expect(xcode.hasFile(slashJoin('SampleApp','Plugins','org.test.plugins.dummyplugin','Custom.framework'))).toBe(true);
+                expect(xcode.hasFile(slashJoin('Resources', 
'DummyPlugin.bundle'))).toBeTruthy();
+                
expect(xcode.hasFile(slashJoin('Plugins','org.test.plugins.dummyplugin', 
'DummyPluginCommand.h'))).toBeTruthy();
+                
expect(xcode.hasFile(slashJoin('Plugins','org.test.plugins.dummyplugin', 
'DummyPluginCommand.m'))).toBeTruthy();
+                
expect(xcode.hasFile(slashJoin('Plugins','org.test.plugins.dummyplugin','targetDir','TargetDirTest.h'))).toBeTruthy();
+                
expect(xcode.hasFile(slashJoin('Plugins','org.test.plugins.dummyplugin','targetDir','TargetDirTest.m'))).toBeTruthy();
+                expect(xcode.hasFile('usr/lib/libsqlite3.dylib')).toBeTruthy();
+                
expect(xcode.hasFile(slashJoin('SampleApp','Plugins','org.test.plugins.dummyplugin','Custom.framework'))).toBeTruthy();
                 // from org.test.plugins.weblessplugin
-                expect(xcode.hasFile(slashJoin('Resources', 
'WeblessPluginViewController.xib'))).toBe(true);
-                
expect(xcode.hasFile(slashJoin('Plugins','org.test.plugins.weblessplugin','WeblessPluginCommand.h'))).toBe(true);
-                
expect(xcode.hasFile(slashJoin('Plugins','org.test.plugins.weblessplugin','WeblessPluginCommand.m'))).toBe(true);
-                expect(xcode.hasFile('usr/lib/libsqlite3.dylib')).toBe(true);
+                expect(xcode.hasFile(slashJoin('Resources', 
'WeblessPluginViewController.xib'))).toBeTruthy();
+                
expect(xcode.hasFile(slashJoin('Plugins','org.test.plugins.weblessplugin','WeblessPluginCommand.h'))).toBeTruthy();
+                
expect(xcode.hasFile(slashJoin('Plugins','org.test.plugins.weblessplugin','WeblessPluginCommand.m'))).toBeTruthy();
+                expect(xcode.hasFile('usr/lib/libsqlite3.dylib')).toBeTruthy();
             });
         });
     });
diff --git 
a/cordova-lib/spec-plugman/plugins/org.test.plugins.dummyplugin/plugin.xml 
b/cordova-lib/spec-plugman/plugins/org.test.plugins.dummyplugin/plugin.xml
index f656661aa..f4bb42a53 100644
--- a/cordova-lib/spec-plugman/plugins/org.test.plugins.dummyplugin/plugin.xml
+++ b/cordova-lib/spec-plugman/plugins/org.test.plugins.dummyplugin/plugin.xml
@@ -133,8 +133,11 @@
 
         <!-- framework for testing (not actual dependency of 
org.test.plugins.dummyplugin -->
         <framework src="src/ios/libsqlite3.dylib" />
-        <framework src="src/ios/libsqlite3.dylib" weak="true" />
+        <framework src="src/ios/weaklibsqlite3.dylib" weak="true" />
         <framework src="src/ios/Custom.framework" custom="true" />
+        <framework src="src/ios/NonEmbeddable.framework" custom="true" 
embed="false" />
+        <framework src="src/ios/Unlinkable.framework" custom="true" 
embed="false" link="false" />
+        <framework src="src/ios/Signable.framework" custom="true" embed="true" 
sign="true" />
     </platform>
 
     <!-- wp8 -->
diff --git 
a/cordova-lib/spec-plugman/plugins/org.test.plugins.dummyplugin/src/ios/NonEmbeddable.framework/someFheader.h
 
b/cordova-lib/spec-plugman/plugins/org.test.plugins.dummyplugin/src/ios/NonEmbeddable.framework/someFheader.h
new file mode 100644
index 000000000..0602b4b01
--- /dev/null
+++ 
b/cordova-lib/spec-plugman/plugins/org.test.plugins.dummyplugin/src/ios/NonEmbeddable.framework/someFheader.h
@@ -0,0 +1 @@
+./org.test.plugins.dummyplugin/src/ios/NonEmbeddable.framework/someFheader.h
diff --git 
a/cordova-lib/spec-plugman/plugins/org.test.plugins.dummyplugin/src/ios/NonEmbeddable.framework/somebinlib
 
b/cordova-lib/spec-plugman/plugins/org.test.plugins.dummyplugin/src/ios/NonEmbeddable.framework/somebinlib
new file mode 100644
index 000000000..7e56867e7
--- /dev/null
+++ 
b/cordova-lib/spec-plugman/plugins/org.test.plugins.dummyplugin/src/ios/NonEmbeddable.framework/somebinlib
@@ -0,0 +1 @@
+./org.test.plugins.dummyplugin/src/ios/NonEmbeddable.framework/somebinlib
diff --git 
a/cordova-lib/spec-plugman/plugins/org.test.plugins.dummyplugin/src/ios/Signable.framework/someFheader.h
 
b/cordova-lib/spec-plugman/plugins/org.test.plugins.dummyplugin/src/ios/Signable.framework/someFheader.h
new file mode 100644
index 000000000..ae69c83bd
--- /dev/null
+++ 
b/cordova-lib/spec-plugman/plugins/org.test.plugins.dummyplugin/src/ios/Signable.framework/someFheader.h
@@ -0,0 +1 @@
+./org.test.plugins.dummyplugin/src/ios/Signable.framework/someFheader.h
diff --git 
a/cordova-lib/spec-plugman/plugins/org.test.plugins.dummyplugin/src/ios/Signable.framework/somebinlib
 
b/cordova-lib/spec-plugman/plugins/org.test.plugins.dummyplugin/src/ios/Signable.framework/somebinlib
new file mode 100644
index 000000000..d84f7cd79
--- /dev/null
+++ 
b/cordova-lib/spec-plugman/plugins/org.test.plugins.dummyplugin/src/ios/Signable.framework/somebinlib
@@ -0,0 +1 @@
+./org.test.plugins.dummyplugin/src/ios/Signable.framework/somebinlib
diff --git 
a/cordova-lib/spec-plugman/plugins/org.test.plugins.dummyplugin/src/ios/Unlinkable.framework/someFheader.h
 
b/cordova-lib/spec-plugman/plugins/org.test.plugins.dummyplugin/src/ios/Unlinkable.framework/someFheader.h
new file mode 100644
index 000000000..c922a8f51
--- /dev/null
+++ 
b/cordova-lib/spec-plugman/plugins/org.test.plugins.dummyplugin/src/ios/Unlinkable.framework/someFheader.h
@@ -0,0 +1 @@
+./org.test.plugins.dummyplugin/src/ios/Unlinkable.framework/someFheader.h
diff --git a/cordova-lib/src/plugman/platforms/ios.js 
b/cordova-lib/src/plugman/platforms/ios.js
index 37503c523..0b8d9f028 100644
--- a/cordova-lib/src/plugman/platforms/ios.js
+++ b/cordova-lib/src/plugman/platforms/ios.js
@@ -94,39 +94,6 @@ 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);
-        });
-    }
-};
-
 // These frameworks are required by cordova-ios by default. We should never 
add/remove them.
 var keep_these_frameworks = [
     'MobileCoreServices.framework',
@@ -178,7 +145,10 @@ module.exports = {
     'framework':{ // CB-5238 custom frameworks only
         install:function(obj, plugin_dir, project_dir, plugin_id, options, 
project) {
             var src = obj.src,
-                custom = obj.custom;
+                custom = obj.custom,
+                embed = obj.embed === undefined || obj.embed, /*defaults to 
true if not specified to keep behavior from CB-9517*/
+                link = obj.link,
+                sign = obj.sign;
 
             if (!custom) {
                 var keepFrameworks = keep_these_frameworks;
@@ -200,10 +170,7 @@ 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);
-            var pbxFile = project.xcode.addFramework(project_relative, 
{customFramework: true});
-            if (pbxFile) {
-                project.xcode.addToPbxEmbedFrameworksBuildPhase(pbxFile);
-            }
+            project.xcode.addFramework(project_relative, {customFramework: 
true, embed: embed, link: link, sign:sign});
         },
         uninstall:function(obj, project_dir, plugin_id, options, project) {
             var src = obj.src;
@@ -226,11 +193,8 @@ module.exports = {
                 return;
             }
 
-            var targetDir = path.resolve(project.plugins_dir, plugin_id, 
path.basename(src)),
-                pbxFile = project.xcode.removeFramework(targetDir, 
{customFramework: true});
-            if (pbxFile) {
-                project.xcode.removeFromPbxEmbedFrameworksBuildPhase(pbxFile);
-            }
+            var targetDir = path.resolve(project.plugins_dir, plugin_id, 
path.basename(src));
+            project.xcode.removeFramework(targetDir, {customFramework: true});
             shell.rm('-rf', targetDir);
         }
     },


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


> Plugins iOS Custom Frameworks are added to "Embedded Binaries" XCode project 
> section by default
> -----------------------------------------------------------------------------------------------
>
>                 Key: CB-10034
>                 URL: https://issues.apache.org/jira/browse/CB-10034
>             Project: Apache Cordova
>          Issue Type: Bug
>          Components: cordova-lib
>    Affects Versions: 5.4.0, 5.3.3, 6.0.1, 6.1.1
>         Environment: OSX developing for iOS
>            Reporter: Roberto Andrade
>            Priority: Major
>
> Since CB-9517 was merged and released in 5.3.0 it seems to have changed the 
> approach to adding a "custom framework" dependency declared in {{plugin.xml}} 
> with the {{<framework custom="true"/>}} directive into the xcode project, as 
> per the [following 
> change|https://github.com/apache/cordova-lib/commit/737f2df4e5c8de205c90cc29614483ebcd71f605].
> It assumes all frameworks are "embeddable", which is not true for a great 
> chunk of frameworks out there that have not being built with the new iOS 
> 8/XCode 6 Cocoa Framework architecture. Most of the frameworks I use 
> (developed prior to Apple coming up with the "official" iOS 8 Framework 
> utilities and Xcode project options) use community provided 
> [iOS-Universal-Framework|https://github.com/kstenerud/iOS-Universal-Framework],
>  which once an artifact generated using that project template gets added to 
> the "embedded binaries" section of a depending app (ie: Cordova app), Xcode 
> has issues doing its thing because they were not built with the iOS 8 
> framework magic in it.
> I suggest that the new behavior be the default (ie: add it to the embedded 
> binaries section) but provide an option when declaring the framework 
> dependency in {{plugin.xml}} so that we can override the behavior and specify 
> whether or not we want it to the embedded (at that point the old <=5.2.0 
> behavior should take over, ie: just add it to the list of framework 
> dependencies but not the the embedded binaries section of the project), may I 
> suggest:
> {{<framework custom="true" embed="false"/>}}
> as the optional override (being assumed as {{true}} by default)?



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@cordova.apache.org
For additional commands, e-mail: issues-h...@cordova.apache.org

Reply via email to