From ac301badca23d871944ad3a044849157508c3078 Mon Sep 17 00:00:00 2001 From: Peter Staev Date: Fri, 4 Aug 2017 09:48:20 +0300 Subject: [PATCH 1/4] fixes #3020 --- lib/services/ios-project-service.ts | 42 ++++++++++++++++++++++++++++- 1 file changed, 41 insertions(+), 1 deletion(-) diff --git a/lib/services/ios-project-service.ts b/lib/services/ios-project-service.ts index d083538223..1f394abe70 100644 --- a/lib/services/ios-project-service.ts +++ b/lib/services/ios-project-service.ts @@ -251,6 +251,20 @@ 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 = ` + + + + method + ${exportOptionsMethod} + +`; + + // 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 .ipa at that directory. let exportPath = path.resolve(options.exportDir || buildOutputPath); @@ -259,7 +273,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 }, @@ -1331,6 +1345,32 @@ 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 async getEmbeddedPlistData(projectData: IProjectData): Promise> { + let embeddedPlistContents = ""; + const embeddedMobileProvisionPath = path.join(this.getPlatformData(projectData).deviceBuildOutputPath, `${projectData.projectName}.app`, "embedded.mobileprovision"); + + embeddedPlistContents = await this.$childProcess.exec(`security cms -D -i ${embeddedMobileProvisionPath}`); + + return plist.parse(embeddedPlistContents); + } + + private async getExportOptionsMethod(projectData: IProjectData): Promise<"app-store" | "ad-hoc" | "enterprise" | "development"> { + const embeddedPlistData = await this.getEmbeddedPlistData(projectData); + + if (embeddedPlistData.ProvisionsAllDevices) { + return "enterprise"; + } else if (embeddedPlistData.ProvisionedDevices && embeddedPlistData.ProvisionedDevices.length) { + const entitlements = embeddedPlistData.Entitlements; + if (entitlements["get-task-allow"]) { + return "development"; + } else { + return "ad-hoc"; + } + } else { + return "app-store"; + } + } } $injector.register("iOSProjectService", IOSProjectService); From a1ed578519f8d8e180c8d291657bf20359237d97 Mon Sep 17 00:00:00 2001 From: Peter Staev Date: Sat, 5 Aug 2017 18:31:54 +0300 Subject: [PATCH 2/4] changes requested from review --- lib/services/ios-project-service.ts | 34 ++++++++++------------------- 1 file changed, 11 insertions(+), 23 deletions(-) diff --git a/lib/services/ios-project-service.ts b/lib/services/ios-project-service.ts index 1f394abe70..5409d353f0 100644 --- a/lib/services/ios-project-service.ts +++ b/lib/services/ios-project-service.ts @@ -258,6 +258,8 @@ export class IOSProjectService extends projectServiceBaseLib.PlatformProjectServ method ${exportOptionsMethod} + uploadBitcode + `; @@ -1346,30 +1348,16 @@ We will now place an empty obsolete compatability white screen LauncScreen.xib f } } - private async getEmbeddedPlistData(projectData: IProjectData): Promise> { - let embeddedPlistContents = ""; + private getExportOptionsMethod(projectData: IProjectData): string { const embeddedMobileProvisionPath = path.join(this.getPlatformData(projectData).deviceBuildOutputPath, `${projectData.projectName}.app`, "embedded.mobileprovision"); - - embeddedPlistContents = await this.$childProcess.exec(`security cms -D -i ${embeddedMobileProvisionPath}`); - - return plist.parse(embeddedPlistContents); - } - - private async getExportOptionsMethod(projectData: IProjectData): Promise<"app-store" | "ad-hoc" | "enterprise" | "development"> { - const embeddedPlistData = await this.getEmbeddedPlistData(projectData); - - if (embeddedPlistData.ProvisionsAllDevices) { - return "enterprise"; - } else if (embeddedPlistData.ProvisionedDevices && embeddedPlistData.ProvisionedDevices.length) { - const entitlements = embeddedPlistData.Entitlements; - if (entitlements["get-task-allow"]) { - return "development"; - } else { - return "ad-hoc"; - } - } else { - return "app-store"; - } + const provision = mobileprovision.provision.readFromFile(embeddedMobileProvisionPath); + + return { + "Development": "development", + "AdHoc": "ad-hoc", + "Distribution": "app-store", + "Enterprise": "enterprise" + }[provision.Type]; } } From c18fa55a5434895f3ef42c81e588f13558efc0cc Mon Sep 17 00:00:00 2001 From: Peter Staev Date: Sat, 5 Aug 2017 18:36:15 +0300 Subject: [PATCH 3/4] require new version of ios-mobileprovision-finder module --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 9b36164ee2..af34c0b271 100644 --- a/package.json +++ b/package.json @@ -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", From 5f9d80a57f21eb121b90438ee22d8a786b18df00 Mon Sep 17 00:00:00 2001 From: rosen-vladimirov Date: Thu, 10 Aug 2017 16:47:43 +0300 Subject: [PATCH 4/4] Update shrinkwrap, so ios-mobileprovision-finder 1.0.10 will be used --- npm-shrinkwrap.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/npm-shrinkwrap.json b/npm-shrinkwrap.json index 172a7e87ac..b834b74b20 100644 --- a/npm-shrinkwrap.json +++ b/npm-shrinkwrap.json @@ -2872,9 +2872,9 @@ } }, "ios-mobileprovision-finder": { - "version": "1.0.9", - "resolved": "https://registry.npmjs.org/ios-mobileprovision-finder/-/ios-mobileprovision-finder-1.0.9.tgz", - "integrity": "sha1-Hc80ywKeP+oMhSkmu79K6GTswKc=", + "version": "1.0.10", + "resolved": "https://registry.npmjs.org/ios-mobileprovision-finder/-/ios-mobileprovision-finder-1.0.10.tgz", + "integrity": "sha1-UaXn+TzUCwN/fI8+JwXjSI11VgE=", "requires": { "chalk": "1.1.3", "plist": "2.1.0",