node-xcode icon indicating copy to clipboard operation
node-xcode copied to clipboard

Support for the addition of Embedded Binaries

Open Compulsed opened this issue 9 years ago • 7 comments

I need to be able to programmatically add embedded binaries (Cordova & a 3rd party dynamic framework being used), but I cannot see how I am able to do this using this XCode node module.

Is there plans on having this supported sometime in the future? Is this already supported and I am missing something?

Thanks!

image

Compulsed avatar Feb 23 '16 05:02 Compulsed

+1 Coming from the Cordova Plugins world, I need this as well in my custom plugin, would be nice if it was supported (and with an option in plugin.xml).

aabluedragon avatar Apr 13 '16 13:04 aabluedragon

For the time being, here's a workaround I implemented: http://stackoverflow.com/a/36723619/230637

aabluedragon avatar Apr 19 '16 16:04 aabluedragon

@aabluedragon isn't your workaround for Embedded Framework and not Embedded binary?

jainpiyushb avatar Feb 07 '17 12:02 jainpiyushb

@jainpiyushb It is, however the Xcode section refers to it by the name "Embedded Binaries" (and The framework contains the binary itself) also note that the headers are removed upon build (as opposed to the binary).

aabluedragon avatar Feb 07 '17 13:02 aabluedragon

Hi @aabluedragon , I thought it's supported here: https://github.com/alunny/node-xcode/blob/078625f16c102372965cc5a4f6a8f7a5145d36aa/lib/pbxProject.js#L300 already (embed option)? But I can't get it to work by implementing https://github.com/apache/cordova-ios/pull/299

shazron avatar Apr 01 '17 06:04 shazron

Debugged this. The embed option will only add the framework if the "Copy Files" phase (that has to be named "Embed Frameworks") exists.

shazron avatar Apr 04 '17 23:04 shazron

I believe this feature is already implemented. Here's some code that should work:

let embed = true,
    link = false,
    frameworkPath = '/Users/me/Desktop/MyFramework.framework',
    project; // the node-xcode pbxProject reference
	
let existsEmbedFrameworks = project.buildPhaseObject('PBXCopyFilesBuildPhase', 'Embed Frameworks');
if (!existsEmbedFrameworks && embed) {
    console.log('"Embed Frameworks" Build Phase (Embedded Binaries) does not exist, creating it.');
    project.addBuildPhase([], 'PBXCopyFilesBuildPhase', 'Embed Frameworks', null, 'frameworks');
}

let options = { customFramework: true, embed: embed, link: link, sign: true };
project.addFramework(frameworkPath, opt);

shazron avatar Apr 11 '17 18:04 shazron