Skip to content

Commit

Permalink
[TIMOB-25432] Explicitly link against system frameworks (#251)
Browse files Browse the repository at this point in the history
This was removed with 2.2.0 but the automatic framework linking does not work with Hyperloop's reflective nature, so this makes sure we explicitly link against all used system frameworks again.
  • Loading branch information
janvennemann authored and hansemannn committed Oct 25, 2017
1 parent 59dbf62 commit 9259f33
Showing 1 changed file with 17 additions and 3 deletions.
20 changes: 17 additions & 3 deletions iphone/plugins/hyperloop/hooks/ios/hyperloop.js
Original file line number Diff line number Diff line change
Expand Up @@ -942,8 +942,24 @@ HyperloopiOSBuilder.prototype.updateXcodeProject = function updateXcodeProject()
var frameworksBuildPhase = xobjs.PBXFrameworksBuildPhase[mainTarget.buildPhases.filter(function (phase) { return xobjs.PBXFrameworksBuildPhase[phase.value]; })[0].value];
var frameworkRegExp = /\.framework$/;
var frameworksToAdd = [];
var alreadyAddedFrameworks = [];
var alreadyAddedFrameworks = {};
Object.keys(xobjs.PBXFrameworksBuildPhase).forEach(function (id) {
if (xobjs.PBXFrameworksBuildPhase[id] && typeof xobjs.PBXFrameworksBuildPhase[id] === 'object') {
xobjs.PBXFrameworksBuildPhase[id].files.forEach(function (file) {
var frameworkPackageName = xobjs.PBXBuildFile[file.value].fileRef_comment;
alreadyAddedFrameworks[frameworkPackageName] = 1;
});
}
});

// Add all detected system frameworks
Object.keys(this.packages).forEach(function (pkg) {
if (this.systemFrameworks[pkg]) {
frameworksToAdd.push(pkg);
}
}, this);

// Add any additionally configured system frameworks from appc.js
if (this.hyperloopConfig.ios.xcodebuild && Array.isArray(this.hyperloopConfig.ios.xcodebuild.frameworks)) {
this.hyperloopConfig.ios.xcodebuild.frameworks.forEach(function (framework) {
framework && frameworksToAdd.push(framework);
Expand Down Expand Up @@ -972,13 +988,11 @@ HyperloopiOSBuilder.prototype.updateXcodeProject = function updateXcodeProject()
};
xobjs.PBXFileReference[fileRefUuid + '_comment'] = framework;

// add the library to the Frameworks group
frameworksGroup.children.push({
value: fileRefUuid,
comment: framework
});

// add the build file
xobjs.PBXBuildFile[buildFileUuid] = {
isa: 'PBXBuildFile',
fileRef: fileRefUuid,
Expand Down

0 comments on commit 9259f33

Please sign in to comment.