Skip to content

Fix IPA export #3036

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 4 commits into from
Aug 11, 2017
Merged
Show file tree
Hide file tree
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
30 changes: 29 additions & 1 deletion lib/services/ios-project-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,22 @@ export class IOSProjectService extends projectServiceBaseLib.PlatformProjectServ
let projectRoot = platformData.projectRoot;
let archivePath = options.archivePath;
let buildOutputPath = path.join(projectRoot, "build", "device");
let exportOptionsMethod = await this.getExportOptionsMethod(projectData);
let plistTemplate = `<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>method</key>
<string>${exportOptionsMethod}</string>
<key>uploadBitcode</key>
<false/>
</dict>
</plist>`;

// Save the options...
temp.track();
let exportOptionsPlist = temp.path({ prefix: "export-", suffix: ".plist" });
this.$fs.writeFile(exportOptionsPlist, plistTemplate);

// The xcodebuild exportPath expects directory and writes the <project-name>.ipa at that directory.
let exportPath = path.resolve(options.exportDir || buildOutputPath);
Expand All @@ -259,7 +275,7 @@ export class IOSProjectService extends projectServiceBaseLib.PlatformProjectServ
let args = ["-exportArchive",
"-archivePath", archivePath,
"-exportPath", exportPath,
"-exportOptionsPlist", platformData.configurationFilePath
"-exportOptionsPlist", exportOptionsPlist
];
await this.$childProcess.spawnFromEvent("xcodebuild", args, "exit",
{ stdio: buildConfig.buildOutputStdio || 'inherit', cwd: this.getPlatformData(projectData).projectRoot },
Expand Down Expand Up @@ -1331,6 +1347,18 @@ We will now place an empty obsolete compatability white screen LauncScreen.xib f
this.$logger.warnWithLabel("The CFBundleIdentifier key inside the 'Info.plist' will be overriden by the 'id' inside 'package.json'.");
}
}

private getExportOptionsMethod(projectData: IProjectData): string {
const embeddedMobileProvisionPath = path.join(this.getPlatformData(projectData).deviceBuildOutputPath, `${projectData.projectName}.app`, "embedded.mobileprovision");
const provision = mobileprovision.provision.readFromFile(embeddedMobileProvisionPath);

return {
Copy link
Contributor

Choose a reason for hiding this comment

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

I love this way of mapping big time!
Definitely better than switches!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Actually took the idea from the ios-mobileprovision-finder 😄

"Development": "development",
"AdHoc": "ad-hoc",
"Distribution": "app-store",
"Enterprise": "enterprise"
}[provision.Type];
}
}

$injector.register("iOSProjectService", IOSProjectService);
6 changes: 3 additions & 3 deletions npm-shrinkwrap.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
"iconv-lite": "0.4.11",
"inquirer": "0.9.0",
"ios-device-lib": "0.4.8",
"ios-mobileprovision-finder": "1.0.9",
"ios-mobileprovision-finder": "1.0.10",
"ios-sim-portable": "~3.0.0",
"lockfile": "1.0.1",
"lodash": "4.13.1",
Expand Down