Skip to content

Add library with relative path to .xcodeproj file #694

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 28, 2015
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 7 additions & 6 deletions lib/services/ios-project-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -181,14 +181,15 @@ class IOSProjectService extends projectServiceBaseLib.PlatformProjectServiceBase
this.validateDynamicFramework(libraryPath).wait();
var umbrellaHeader = this.getUmbrellaHeaderFromDynamicFramework(libraryPath).wait();

var frameworkName = path.basename(libraryPath, path.extname(libraryPath));
var targetPath = path.join(this.$projectData.projectDir, "lib", this.platformData.normalizedPlatformName, frameworkName);
this.$fs.ensureDirectoryExists(targetPath).wait();
shell.cp("-R", libraryPath, targetPath);
let frameworkName = path.basename(libraryPath, path.extname(libraryPath));
let targetPath = path.join("lib", this.platformData.normalizedPlatformName, frameworkName);
let fullTargetPath = path.join(this.$projectData.projectDir, targetPath);
this.$fs.ensureDirectoryExists(fullTargetPath).wait();
shell.cp("-R", libraryPath, fullTargetPath);

let project = this.createPbxProj();

project.addFramework(path.join(targetPath, frameworkName + ".framework"), { customFramework: true, embed: true });
let frameworkPath = path.relative("platforms/ios", path.join(targetPath, frameworkName + ".framework"));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

platforms/ios - will this work on Windows?
Maybe:

let frameworkPath = path.relative(path.join("platforms", "ios"), path.join(targetPath, frameworkName + ".framework"));

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, don't you need full paths on both places:

let frameworkPath = path.relative(path.join(this.$projectData.projectDir, "platforms", "ios"), path.join(fullTargetPath, frameworkName + ".framework"));

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"platforms/ios - will this work on Windows?" - This service is executed only on OSX.
"Also, don't you need full paths on both places:" - No, I don't need the fullPath, a just need the relative path to native project.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

By the way, it works - but path.join will return a string with backslashes.

project.addFramework(frameworkPath, { customFramework: true, embed: true });
project.updateBuildProperty("IPHONEOS_DEPLOYMENT_TARGET", "8.0");
this.savePbxProj(project).wait();
this.$logger.info("The iOS Deployment Target is now 8.0 in order to support Cocoa Touch Frameworks.");
Expand Down