@expo/build-tools 1.0.31 → 1.0.34

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (62) hide show
  1. package/dist/customBuildContext.d.ts +1 -0
  2. package/dist/customBuildContext.js +1 -0
  3. package/dist/customBuildContext.js.map +1 -1
  4. package/dist/steps/easFunctions.js +14 -2
  5. package/dist/steps/easFunctions.js.map +1 -1
  6. package/dist/steps/functions/eas/buildReactNativeApp.js +0 -6
  7. package/dist/steps/functions/eas/buildReactNativeApp.js.map +1 -1
  8. package/dist/steps/functions/eas/{configureExpoUpdatesIfInstalled.js → configureEASUpdateIfInstalled.js} +1 -1
  9. package/dist/steps/functions/eas/configureEASUpdateIfInstalled.js.map +1 -0
  10. package/dist/steps/functions/eas/findAndUploadBuildArtifacts.js +1 -5
  11. package/dist/steps/functions/eas/findAndUploadBuildArtifacts.js.map +1 -1
  12. package/dist/steps/functions/utils/configureIosCredentials.d.ts +2 -0
  13. package/dist/steps/functions/utils/configureIosCredentials.js +54 -0
  14. package/dist/steps/functions/utils/configureIosCredentials.js.map +1 -0
  15. package/dist/steps/functions/utils/configureIosVersion.d.ts +2 -0
  16. package/dist/steps/functions/utils/configureIosVersion.js +77 -0
  17. package/dist/steps/functions/utils/configureIosVersion.js.map +1 -0
  18. package/dist/steps/functions/utils/generateGymfileFromTemplate.d.ts +2 -0
  19. package/dist/steps/functions/utils/generateGymfileFromTemplate.js +209 -0
  20. package/dist/steps/functions/utils/generateGymfileFromTemplate.js.map +1 -0
  21. package/dist/steps/functions/utils/resolveAppleTeamIdFromCredentials.d.ts +2 -0
  22. package/dist/steps/functions/utils/resolveAppleTeamIdFromCredentials.js +47 -0
  23. package/dist/steps/functions/utils/resolveAppleTeamIdFromCredentials.js.map +1 -0
  24. package/dist/steps/functions/utils/runFastlane.d.ts +2 -0
  25. package/dist/steps/functions/utils/runFastlane.js +26 -0
  26. package/dist/steps/functions/utils/runFastlane.js.map +1 -0
  27. package/dist/steps/functions/utils/runGradle.d.ts +2 -0
  28. package/dist/steps/functions/utils/runGradle.js +36 -0
  29. package/dist/steps/functions/utils/runGradle.js.map +1 -0
  30. package/dist/steps/utils/android/gradle.d.ts +11 -0
  31. package/dist/steps/utils/android/gradle.js +110 -0
  32. package/dist/steps/utils/android/gradle.js.map +1 -0
  33. package/dist/steps/utils/ios/configure.d.ts +15 -0
  34. package/dist/steps/utils/ios/configure.js +78 -0
  35. package/dist/steps/utils/ios/configure.js.map +1 -0
  36. package/dist/steps/utils/ios/credentials/credentials.d.ts +4 -0
  37. package/dist/steps/utils/ios/credentials/credentials.js +16 -0
  38. package/dist/steps/utils/ios/credentials/credentials.js.map +1 -0
  39. package/dist/steps/utils/ios/credentials/distributionCertificate.d.ts +3 -0
  40. package/dist/steps/utils/ios/credentials/distributionCertificate.js +52 -0
  41. package/dist/steps/utils/ios/credentials/distributionCertificate.js.map +1 -0
  42. package/dist/steps/utils/ios/credentials/keychain.d.ts +19 -0
  43. package/dist/steps/utils/ios/credentials/keychain.js +93 -0
  44. package/dist/steps/utils/ios/credentials/keychain.js.map +1 -0
  45. package/dist/steps/utils/ios/credentials/manager.d.ts +23 -0
  46. package/dist/steps/utils/ios/credentials/manager.js +115 -0
  47. package/dist/steps/utils/ios/credentials/manager.js.map +1 -0
  48. package/dist/steps/utils/ios/credentials/provisioningProfile.d.ts +35 -0
  49. package/dist/steps/utils/ios/credentials/provisioningProfile.js +114 -0
  50. package/dist/steps/utils/ios/credentials/provisioningProfile.js.map +1 -0
  51. package/dist/steps/utils/ios/fastlane.d.ts +7 -3
  52. package/dist/steps/utils/ios/fastlane.js +21 -34
  53. package/dist/steps/utils/ios/fastlane.js.map +1 -1
  54. package/dist/steps/utils/ios/resolve.d.ts +2 -4
  55. package/dist/steps/utils/ios/resolve.js +9 -3
  56. package/dist/steps/utils/ios/resolve.js.map +1 -1
  57. package/dist/steps/utils/ios/xcpretty.d.ts +16 -0
  58. package/dist/steps/utils/ios/xcpretty.js +88 -0
  59. package/dist/steps/utils/ios/xcpretty.js.map +1 -0
  60. package/package.json +3 -3
  61. package/dist/steps/functions/eas/configureExpoUpdatesIfInstalled.js.map +0 -1
  62. /package/dist/steps/functions/eas/{configureExpoUpdatesIfInstalled.d.ts → configureEASUpdateIfInstalled.d.ts} +0 -0
@@ -0,0 +1,93 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ const os_1 = __importDefault(require("os"));
7
+ const path_1 = __importDefault(require("path"));
8
+ const turtle_spawn_1 = __importDefault(require("@expo/turtle-spawn"));
9
+ const uuid_1 = require("uuid");
10
+ const fastlane_1 = require("../fastlane");
11
+ class Keychain {
12
+ constructor() {
13
+ this.created = false;
14
+ this.destroyed = false;
15
+ this.keychainPath = path_1.default.join(os_1.default.tmpdir(), `turtle-v2-${(0, uuid_1.v4)()}.keychain`);
16
+ this.keychainPassword = (0, uuid_1.v4)();
17
+ }
18
+ get data() {
19
+ return {
20
+ path: this.keychainPath,
21
+ password: this.keychainPassword,
22
+ };
23
+ }
24
+ async create(logger) {
25
+ logger.debug(`Creating keychain - ${this.keychainPath}`);
26
+ await (0, fastlane_1.runFastlane)([
27
+ 'run',
28
+ 'create_keychain',
29
+ `path:${this.keychainPath}`,
30
+ `password:${this.keychainPassword}`,
31
+ 'unlock:true',
32
+ 'timeout:360000',
33
+ ]);
34
+ this.created = true;
35
+ }
36
+ async importCertificate(logger, certPath, certPassword) {
37
+ if (!this.created) {
38
+ throw new Error('You must create a keychain first.');
39
+ }
40
+ logger.debug(`Importing certificate ${certPath} into keychain ${this.keychainPath}`);
41
+ await (0, fastlane_1.runFastlane)([
42
+ 'run',
43
+ 'import_certificate',
44
+ `certificate_path:${certPath}`,
45
+ `certificate_password:${certPassword}`,
46
+ `keychain_path:${this.keychainPath}`,
47
+ `keychain_password:${this.keychainPassword}`,
48
+ ]);
49
+ }
50
+ async ensureCertificateImported(teamId, fingerprint) {
51
+ const identities = await this.findIdentitiesByTeamId(teamId);
52
+ if (!identities.includes(fingerprint)) {
53
+ throw new Error(`Distribution certificate with fingerprint ${fingerprint} hasn't been imported successfully`);
54
+ }
55
+ }
56
+ async destroy(logger, keychainPath) {
57
+ if (!keychainPath && !this.created) {
58
+ logger.warn("There is nothing to destroy, a keychain hasn't been created yet.");
59
+ return;
60
+ }
61
+ if (this.destroyed) {
62
+ logger.warn('The keychain has been already destroyed');
63
+ return;
64
+ }
65
+ const keychainToDeletePath = keychainPath !== null && keychainPath !== void 0 ? keychainPath : this.keychainPath;
66
+ logger.info(`Destroying keychain - ${keychainToDeletePath}`);
67
+ try {
68
+ await (0, fastlane_1.runFastlane)(['run', 'delete_keychain', `keychain_path:${keychainToDeletePath}`]);
69
+ this.destroyed = true;
70
+ }
71
+ catch (err) {
72
+ logger.error({ err }, 'Failed to delete the keychain\n');
73
+ throw err;
74
+ }
75
+ }
76
+ async cleanUpKeychains(logger) {
77
+ var _a;
78
+ const { stdout } = await (0, turtle_spawn_1.default)('security', ['list-keychains'], { stdio: 'pipe' });
79
+ const keychainList = ((_a = /"(.*)"/g.exec(stdout)) !== null && _a !== void 0 ? _a : []).map((i) => i.slice(1, i.length - 1));
80
+ const turtleKeychainList = keychainList.filter((keychain) => /turtle-v2-[\w-]+\.keychain$/.exec(keychain));
81
+ for (const turtleKeychainPath of turtleKeychainList) {
82
+ await this.destroy(logger, turtleKeychainPath);
83
+ }
84
+ }
85
+ async findIdentitiesByTeamId(teamId) {
86
+ const { output } = await (0, turtle_spawn_1.default)('security', ['find-identity', '-v', '-s', `(${teamId})`, this.keychainPath], {
87
+ stdio: 'pipe',
88
+ });
89
+ return output.join('');
90
+ }
91
+ }
92
+ exports.default = Keychain;
93
+ //# sourceMappingURL=keychain.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"keychain.js","sourceRoot":"","sources":["../../../../../src/steps/utils/ios/credent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gB,CAAC,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,CAAC,CAAC;QAClF,MAAM,YAAY,GAAG,CAAC,MAAA,SAAS,CAAC,IAAI,CAAC,MAAM,CAAC,mCAAK,EAAe,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAC1E,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC,CACzB,CAAC;QACF,MAAM,kBAAkB,GAAG,YAAY,CAAC,MAAM,CAAC,CAAC,QAAQ,EAAE,EAAE,CAC1D,6BAA6B,CAAC,IAAI,CAAC,QAAQ,CAAC,CAC7C,CAAC;QACF,KAAK,MAAM,kBAAkB,IAAI,kBAAkB,EAAE;YACnD,MAAM,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE,kBAAkB,CAAC,CAAC;SAChD;IACH,CAAC;IAEO,KAAK,CAAC,sBAAsB,CAAC,MAAc;QACjD,MAAM,EAAE,MAAM,EAAE,GAAG,MAAM,IAAA,sBAAK,EAC5B,UAAU,EACV,CAAC,eAAe,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,MAAM,GAAG,EAAE,IAAI,CAAC,YAAY,CAAC,EAC/D;YACE,KAAK,EAAE,MAAM;SACd,CACF,CAAC;QACF,OAAO,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IACzB,CAAC;CACF;AAvGD,2BAuGC","sourcesContent":["import os from 'os';\nimport path from 'path';\n\nimport spawn from '@expo/turtle-spawn';\nimport { v4 as uuid } from 'uuid';\nimport { bunyan } from '@expo/logger';\n\nimport { runFastlane } from '../fastlane';\n\nexport default class Keychain {\n private readonly keychainPath: string;\n private readonly keychainPassword: string;\n private created = false;\n private destroyed = false;\n\n constructor() {\n this.keychainPath = path.join(os.tmpdir(), `turtle-v2-${uuid()}.keychain`);\n this.keychainPassword = uuid();\n }\n\n get data(): { path: string; password: string } {\n return {\n path: this.keychainPath,\n password: this.keychainPassword,\n };\n }\n\n public async create(logger: bunyan): Promise<void> {\n logger.debug(`Creating keychain - ${this.keychainPath}`);\n await runFastlane([\n 'run',\n 'create_keychain',\n `path:${this.keychainPath}`,\n `password:${this.keychainPassword}`,\n 'unlock:true',\n 'timeout:360000',\n ]);\n this.created = true;\n }\n\n public async importCertificate(\n logger: bunyan,\n certPath: string,\n certPassword: string\n ): Promise<void> {\n if (!this.created) {\n throw new Error('You must create a keychain first.');\n }\n\n logger.debug(`Importing certificate ${certPath} into keychain ${this.keychainPath}`);\n await runFastlane([\n 'run',\n 'import_certificate',\n `certificate_path:${certPath}`,\n `certificate_password:${certPassword}`,\n `keychain_path:${this.keychainPath}`,\n `keychain_password:${this.keychainPassword}`,\n ]);\n }\n\n public async ensureCertificateImported(teamId: string, fingerprint: string): Promise<void> {\n const identities = await this.findIdentitiesByTeamId(teamId);\n if (!identities.includes(fingerprint)) {\n throw new Error(\n `Distribution certificate with fingerprint ${fingerprint} hasn't been imported successfully`\n );\n }\n }\n\n public async destroy(logger: bunyan, keychainPath?: string): Promise<void> {\n if (!keychainPath && !this.created) {\n logger.warn(\"There is nothing to destroy, a keychain hasn't been created yet.\");\n return;\n }\n if (this.destroyed) {\n logger.warn('The keychain has been already destroyed');\n return;\n }\n const keychainToDeletePath = keychainPath ?? this.keychainPath;\n logger.info(`Destroying keychain - ${keychainToDeletePath}`);\n try {\n await runFastlane(['run', 'delete_keychain', `keychain_path:${keychainToDeletePath}`]);\n this.destroyed = true;\n } catch (err) {\n logger.error({ err }, 'Failed to delete the keychain\\n');\n throw err;\n }\n }\n\n public async cleanUpKeychains(logger: bunyan): Promise<void> {\n const { stdout } = await spawn('security', ['list-keychains'], { stdio: 'pipe' });\n const keychainList = (/\"(.*)\"/g.exec(stdout) ?? ([] as string[])).map((i) =>\n i.slice(1, i.length - 1)\n );\n const turtleKeychainList = keychainList.filter((keychain) =>\n /turtle-v2-[\\w-]+\\.keychain$/.exec(keychain)\n );\n for (const turtleKeychainPath of turtleKeychainList) {\n await this.destroy(logger, turtleKeychainPath);\n }\n }\n\n private async findIdentitiesByTeamId(teamId: string): Promise<string> {\n const { output } = await spawn(\n 'security',\n ['find-identity', '-v', '-s', `(${teamId})`, this.keychainPath],\n {\n stdio: 'pipe',\n }\n );\n return output.join('');\n }\n}\n"]}
@@ -0,0 +1,23 @@
1
+ /// <reference types="bunyan" />
2
+ import { Ios } from '@expo/eas-build-job';
3
+ import { bunyan } from '@expo/logger';
4
+ import ProvisioningProfile, { DistributionType, ProvisioningProfileData } from './provisioningProfile';
5
+ export interface Credentials {
6
+ applicationTargetProvisioningProfile: ProvisioningProfile;
7
+ keychainPath: string;
8
+ targetProvisioningProfiles: TargetProvisioningProfiles;
9
+ distributionType: DistributionType;
10
+ teamId: string;
11
+ }
12
+ export type TargetProvisioningProfiles = Record<string, ProvisioningProfileData>;
13
+ export default class IosCredentialsManager {
14
+ private readonly buildCredentials;
15
+ private keychain?;
16
+ private readonly provisioningProfiles;
17
+ private cleanedUp;
18
+ constructor(buildCredentials: Ios.BuildCredentials);
19
+ prepare(logger: bunyan): Promise<Credentials>;
20
+ cleanUp(logger: bunyan): Promise<void>;
21
+ private prepareTargetCredentials;
22
+ private getApplicationTargetProvisioningProfile;
23
+ }
@@ -0,0 +1,115 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
25
+ var __importDefault = (this && this.__importDefault) || function (mod) {
26
+ return (mod && mod.__esModule) ? mod : { "default": mod };
27
+ };
28
+ Object.defineProperty(exports, "__esModule", { value: true });
29
+ const assert_1 = __importDefault(require("assert"));
30
+ const os_1 = __importDefault(require("os"));
31
+ const path_1 = __importDefault(require("path"));
32
+ const fs_extra_1 = __importDefault(require("fs-extra"));
33
+ const lodash_1 = require("lodash");
34
+ const uuid_1 = require("uuid");
35
+ const distributionCertificateUtils = __importStar(require("./distributionCertificate"));
36
+ const keychain_1 = __importDefault(require("./keychain"));
37
+ const provisioningProfile_1 = __importDefault(require("./provisioningProfile"));
38
+ class IosCredentialsManager {
39
+ constructor(buildCredentials) {
40
+ this.buildCredentials = buildCredentials;
41
+ this.provisioningProfiles = [];
42
+ this.cleanedUp = false;
43
+ }
44
+ async prepare(logger) {
45
+ logger.info('Preparing credentials');
46
+ logger.info('Creating keychain');
47
+ this.keychain = new keychain_1.default();
48
+ await this.keychain.create(logger);
49
+ const targets = Object.keys(this.buildCredentials);
50
+ const targetProvisioningProfiles = {};
51
+ for (const target of targets) {
52
+ const provisioningProfile = await this.prepareTargetCredentials(logger, target, this.buildCredentials[target]);
53
+ this.provisioningProfiles.push(provisioningProfile);
54
+ targetProvisioningProfiles[target] = provisioningProfile.data;
55
+ }
56
+ const applicationTargetProvisioningProfile = this.getApplicationTargetProvisioningProfile();
57
+ // TODO: ensure that all dist types and team ids in the array are the same
58
+ const { distributionType, teamId } = applicationTargetProvisioningProfile.data;
59
+ return {
60
+ applicationTargetProvisioningProfile,
61
+ keychainPath: this.keychain.data.path,
62
+ targetProvisioningProfiles,
63
+ distributionType,
64
+ teamId,
65
+ };
66
+ }
67
+ async cleanUp(logger) {
68
+ if (this.cleanedUp || (!this.keychain && this.provisioningProfiles.length === 0)) {
69
+ return;
70
+ }
71
+ if (this.keychain) {
72
+ await this.keychain.destroy(logger);
73
+ }
74
+ if (this.provisioningProfiles) {
75
+ for (const provisioningProfile of this.provisioningProfiles) {
76
+ await provisioningProfile.destroy(logger);
77
+ }
78
+ }
79
+ this.cleanedUp = true;
80
+ }
81
+ async prepareTargetCredentials(logger, target, targetCredentials) {
82
+ try {
83
+ (0, assert_1.default)(this.keychain, 'Keychain should be initialized');
84
+ logger.info(`Preparing credentials for target '${target}'`);
85
+ const distCertPath = path_1.default.join(os_1.default.tmpdir(), `${(0, uuid_1.v4)()}.p12`);
86
+ logger.info('Getting distribution certificate fingerprint and common name');
87
+ const certificateFingerprint = distributionCertificateUtils.getFingerprint(targetCredentials.distributionCertificate);
88
+ const certificateCommonName = distributionCertificateUtils.getCommonName(targetCredentials.distributionCertificate);
89
+ logger.info(`Fingerprint = "${certificateFingerprint}", common name = ${certificateCommonName}`);
90
+ logger.info(`Writing distribution certificate to ${distCertPath}`);
91
+ await fs_extra_1.default.writeFile(distCertPath, Buffer.from(targetCredentials.distributionCertificate.dataBase64, 'base64'));
92
+ logger.info('Importing distribution certificate into the keychain');
93
+ await this.keychain.importCertificate(logger, distCertPath, targetCredentials.distributionCertificate.password);
94
+ logger.info('Initializing provisioning profile');
95
+ const provisioningProfile = new provisioningProfile_1.default(Buffer.from(targetCredentials.provisioningProfileBase64, 'base64'), this.keychain.data.path, target, certificateCommonName);
96
+ await provisioningProfile.init(logger);
97
+ logger.info('Validating whether distribution certificate has been imported successfully');
98
+ await this.keychain.ensureCertificateImported(provisioningProfile.data.teamId, certificateFingerprint);
99
+ logger.info('Verifying whether the distribution certificate and provisioning profile match');
100
+ provisioningProfile.verifyCertificate(certificateFingerprint);
101
+ return provisioningProfile;
102
+ }
103
+ catch (err) {
104
+ await this.cleanUp(logger);
105
+ throw err;
106
+ }
107
+ }
108
+ getApplicationTargetProvisioningProfile() {
109
+ // sorting works because bundle ids share common prefix
110
+ const sorted = (0, lodash_1.orderBy)(this.provisioningProfiles, 'data.bundleIdentifier', 'asc');
111
+ return sorted[0];
112
+ }
113
+ }
114
+ exports.default = IosCredentialsManager;
115
+ //# sourceMappingURL=manager.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"manager.js","sourceRoot":"","sources":["../../../../../src/steps/utils/ios/credentials/manager.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,oDAA4B;AAC5B,4CAAoB;AACpB,gDAAwB;AAGxB,wDAA0B;AAC1B,mCAAiC;AACjC,+BAAkC;AAGlC,wFAA0E;AAC1E,0DAAkC;AAClC,gFAG+B;AAY/B,MAAqB,qBAAqB;IAKxC,YAA6B,gBAAsC;QAAtC,qBAAgB,GAAhB,gBAAgB,CAAsB;QAHlD,yBAAoB,GAA0B,EAAE,CAAC;QAC1D,cAAS,GAAG,KAAK,CAAC;IAE4C,CAAC;IAEhE,KAAK,CAAC,OAAO,CAAC,MAAc;QACjC,MAAM,CAAC,IAAI,CAAC,uBAAuB,CAAC,CAAC;QAErC,MAAM,CAAC,IAAI,CAAC,mBAAmB,CAAC,CAAC;QACjC,IAAI,CAAC,QAAQ,GAAG,IAAI,kBAAQ,EAAE,CAAC;QAC/B,MAAM,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;QAEnC,MAAM,OAAO,GAAG,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC;QACnD,MAAM,0BAA0B,GAA+B,EAAE,CAAC;QAClE,KAAK,MAAM,MAAM,IAAI,OAAO,EAAE;YAC5B,MAAM,mBAAmB,GAAG,MAAM,IAAI,CAAC,wBAAwB,CAC7D,MAAM,EACN,MAAM,EACN,IAAI,CAAC,gBAAgB,CAAC,MAAM,CAAC,CAC9B,CAAC;YACF,IAAI,CAAC,oBAAoB,CAAC,IAAI,CAAC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CAAC,iBAAiB,CAAC,sBAAsB,CAAC,CAAC;YAE9D,OAAO,mBAAmB,CAAC;SAC5B;QAAC,OAAO,GAAG,EAAE;YACZ,MAAM,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;YAC3B,MAAM,GAAG,CAAC;SACX;IACH,CAAC;IAEO,uCAAuC;QAC7C,uDAAuD;QACvD,MAAM,MAAM,GAAG,IAAA,gBAAO,EAAC,IAAI,CAAC,oBAAoB,EAAE,uBAAuB,EAAE,KAAK,CAAC,CAAC;QAClF,OAAO,MAAM,CAAC,CAAC,CAAC,CAAC;IACnB,CAAC;CACF;AAzHD,wCAyHC","sourcesContent":["import assert from 'assert';\nimport os from 'os';\nimport path from 'path';\n\nimport { Ios } from '@expo/eas-build-job';\nimport fs from 'fs-extra';\nimport { orderBy } from 'lodash';\nimport { v4 as uuid } from 'uuid';\nimport { bunyan } from '@expo/logger';\n\nimport * as distributionCertificateUtils from './distributionCertificate';\nimport Keychain from './keychain';\nimport ProvisioningProfile, {\n DistributionType,\n ProvisioningProfileData,\n} from './provisioningProfile';\n\nexport interface Credentials {\n applicationTargetProvisioningProfile: ProvisioningProfile;\n keychainPath: string;\n targetProvisioningProfiles: TargetProvisioningProfiles;\n distributionType: DistributionType;\n teamId: string;\n}\n\nexport type TargetProvisioningProfiles = Record<string, ProvisioningProfileData>;\n\nexport default class IosCredentialsManager {\n private keychain?: Keychain;\n private readonly provisioningProfiles: ProvisioningProfile[] = [];\n private cleanedUp = false;\n\n constructor(private readonly buildCredentials: Ios.BuildCredentials) {}\n\n public async prepare(logger: bunyan): Promise<Credentials> {\n logger.info('Preparing credentials');\n\n logger.info('Creating keychain');\n this.keychain = new Keychain();\n await this.keychain.create(logger);\n\n const targets = Object.keys(this.buildCredentials);\n const targetProvisioningProfiles: TargetProvisioningProfiles = {};\n for (const target of targets) {\n const provisioningProfile = await this.prepareTargetCredentials(\n logger,\n target,\n this.buildCredentials[target]\n );\n this.provisioningProfiles.push(provisioningProfile);\n targetProvisioningProfiles[target] = provisioningProfile.data;\n }\n\n const applicationTargetProvisioningProfile = this.getApplicationTargetProvisioningProfile();\n\n // TODO: ensure that all dist types and team ids in the array are the same\n const { distributionType, teamId } = applicationTargetProvisioningProfile.data;\n\n return {\n applicationTargetProvisioningProfile,\n keychainPath: this.keychain.data.path,\n targetProvisioningProfiles,\n distributionType,\n teamId,\n };\n }\n\n public async cleanUp(logger: bunyan): Promise<void> {\n if (this.cleanedUp || (!this.keychain && this.provisioningProfiles.length === 0)) {\n return;\n }\n\n if (this.keychain) {\n await this.keychain.destroy(logger);\n }\n if (this.provisioningProfiles) {\n for (const provisioningProfile of this.provisioningProfiles) {\n await provisioningProfile.destroy(logger);\n }\n }\n this.cleanedUp = true;\n }\n\n private async prepareTargetCredentials(\n logger: bunyan,\n target: string,\n targetCredentials: Ios.TargetCredentials\n ): Promise<ProvisioningProfile> {\n try {\n assert(this.keychain, 'Keychain should be initialized');\n\n logger.info(`Preparing credentials for target '${target}'`);\n const distCertPath = path.join(os.tmpdir(), `${uuid()}.p12`);\n\n logger.info('Getting distribution certificate fingerprint and common name');\n const certificateFingerprint = distributionCertificateUtils.getFingerprint(\n targetCredentials.distributionCertificate\n );\n const certificateCommonName = distributionCertificateUtils.getCommonName(\n targetCredentials.distributionCertificate\n );\n logger.info(\n `Fingerprint = \"${certificateFingerprint}\", common name = ${certificateCommonName}`\n );\n\n logger.info(`Writing distribution certificate to ${distCertPath}`);\n await fs.writeFile(\n distCertPath,\n Buffer.from(targetCredentials.distributionCertificate.dataBase64, 'base64')\n );\n\n logger.info('Importing distribution certificate into the keychain');\n await this.keychain.importCertificate(\n logger,\n distCertPath,\n targetCredentials.distributionCertificate.password\n );\n\n logger.info('Initializing provisioning profile');\n const provisioningProfile = new ProvisioningProfile(\n Buffer.from(targetCredentials.provisioningProfileBase64, 'base64'),\n this.keychain.data.path,\n target,\n certificateCommonName\n );\n await provisioningProfile.init(logger);\n\n logger.info('Validating whether distribution certificate has been imported successfully');\n await this.keychain.ensureCertificateImported(\n provisioningProfile.data.teamId,\n certificateFingerprint\n );\n\n logger.info('Verifying whether the distribution certificate and provisioning profile match');\n provisioningProfile.verifyCertificate(certificateFingerprint);\n\n return provisioningProfile;\n } catch (err) {\n await this.cleanUp(logger);\n throw err;\n }\n }\n\n private getApplicationTargetProvisioningProfile(): ProvisioningProfile {\n // sorting works because bundle ids share common prefix\n const sorted = orderBy(this.provisioningProfiles, 'data.bundleIdentifier', 'asc');\n return sorted[0];\n }\n}\n"]}
@@ -0,0 +1,35 @@
1
+ /// <reference types="node" />
2
+ /// <reference types="bunyan" />
3
+ import { bunyan } from '@expo/logger';
4
+ export interface ProvisioningProfileData {
5
+ path: string;
6
+ target: string;
7
+ bundleIdentifier: string;
8
+ teamId: string;
9
+ uuid: string;
10
+ name: string;
11
+ developerCertificate: Buffer;
12
+ certificateCommonName: string;
13
+ distributionType: DistributionType;
14
+ }
15
+ export declare enum DistributionType {
16
+ AD_HOC = "ad-hoc",
17
+ APP_STORE = "app-store",
18
+ ENTERPRISE = "enterprise"
19
+ }
20
+ export default class ProvisioningProfile {
21
+ private readonly profile;
22
+ private readonly keychainPath;
23
+ private readonly target;
24
+ private readonly certificateCommonName;
25
+ get data(): ProvisioningProfileData;
26
+ private readonly profilePath;
27
+ private profileData?;
28
+ constructor(profile: Buffer, keychainPath: string, target: string, certificateCommonName: string);
29
+ init(logger: bunyan): Promise<void>;
30
+ destroy(logger: bunyan): Promise<void>;
31
+ verifyCertificate(fingerprint: string): void;
32
+ private load;
33
+ private resolveDistributionType;
34
+ private genDerCertFingerprint;
35
+ }
@@ -0,0 +1,114 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.DistributionType = void 0;
7
+ const crypto_1 = __importDefault(require("crypto"));
8
+ const os_1 = __importDefault(require("os"));
9
+ const path_1 = __importDefault(require("path"));
10
+ const eas_build_job_1 = require("@expo/eas-build-job");
11
+ const turtle_spawn_1 = __importDefault(require("@expo/turtle-spawn"));
12
+ const fs_extra_1 = __importDefault(require("fs-extra"));
13
+ const plist_1 = __importDefault(require("plist"));
14
+ const uuid_1 = require("uuid");
15
+ var DistributionType;
16
+ (function (DistributionType) {
17
+ DistributionType["AD_HOC"] = "ad-hoc";
18
+ DistributionType["APP_STORE"] = "app-store";
19
+ DistributionType["ENTERPRISE"] = "enterprise";
20
+ })(DistributionType || (exports.DistributionType = DistributionType = {}));
21
+ const PROVISIONING_PROFILES_DIRECTORY = path_1.default.join(os_1.default.homedir(), 'Library/MobileDevice/Provisioning Profiles');
22
+ class ProvisioningProfile {
23
+ get data() {
24
+ if (!this.profileData) {
25
+ throw new Error('You must init the profile first!');
26
+ }
27
+ else {
28
+ return this.profileData;
29
+ }
30
+ }
31
+ constructor(profile, keychainPath, target, certificateCommonName) {
32
+ this.profile = profile;
33
+ this.keychainPath = keychainPath;
34
+ this.target = target;
35
+ this.certificateCommonName = certificateCommonName;
36
+ this.profilePath = path_1.default.join(PROVISIONING_PROFILES_DIRECTORY, `${(0, uuid_1.v4)()}.mobileprovision`);
37
+ }
38
+ async init(logger) {
39
+ logger.debug(`Making sure ${PROVISIONING_PROFILES_DIRECTORY} exits`);
40
+ await fs_extra_1.default.ensureDir(PROVISIONING_PROFILES_DIRECTORY);
41
+ logger.debug(`Writing provisioning profile to ${this.profilePath}`);
42
+ await fs_extra_1.default.writeFile(this.profilePath, this.profile);
43
+ logger.debug('Loading provisioning profile');
44
+ await this.load();
45
+ }
46
+ async destroy(logger) {
47
+ if (!this.profilePath) {
48
+ logger.warn("There is nothing to destroy, a provisioning profile hasn't been created yet.");
49
+ return;
50
+ }
51
+ logger.info('Removing provisioning profile');
52
+ await fs_extra_1.default.remove(this.profilePath);
53
+ }
54
+ verifyCertificate(fingerprint) {
55
+ const devCertFingerprint = this.genDerCertFingerprint();
56
+ if (devCertFingerprint !== fingerprint) {
57
+ throw new eas_build_job_1.errors.CredentialsDistCertMismatchError(`Provisioning profile and distribution certificate don't match.
58
+ Profile's certificate fingerprint = ${devCertFingerprint}, distribution certificate fingerprint = ${fingerprint}`);
59
+ }
60
+ }
61
+ async load() {
62
+ let result;
63
+ try {
64
+ result = await (0, turtle_spawn_1.default)('security', ['cms', '-D', '-k', this.keychainPath, '-i', this.profilePath], {
65
+ stdio: 'pipe',
66
+ });
67
+ }
68
+ catch (err) {
69
+ throw new Error(err.stderr.trim());
70
+ }
71
+ const { output } = result;
72
+ const plistRaw = output.join('');
73
+ let plistData;
74
+ try {
75
+ plistData = plist_1.default.parse(plistRaw);
76
+ }
77
+ catch (error) {
78
+ throw new Error(`Error when parsing plist: ${error.message}`);
79
+ }
80
+ const applicationIdentifier = plistData.Entitlements['application-identifier'];
81
+ const bundleIdentifier = applicationIdentifier.replace(/^.+?\./, '');
82
+ this.profileData = {
83
+ path: this.profilePath,
84
+ target: this.target,
85
+ bundleIdentifier,
86
+ teamId: plistData.TeamIdentifier[0],
87
+ uuid: plistData.UUID,
88
+ name: plistData.Name,
89
+ developerCertificate: Buffer.from(plistData.DeveloperCertificates[0], 'base64'),
90
+ certificateCommonName: this.certificateCommonName,
91
+ distributionType: this.resolveDistributionType(plistData),
92
+ };
93
+ }
94
+ resolveDistributionType(plistData) {
95
+ if (plistData.ProvisionsAllDevices) {
96
+ return DistributionType.ENTERPRISE;
97
+ }
98
+ else if (plistData.ProvisionedDevices) {
99
+ return DistributionType.AD_HOC;
100
+ }
101
+ else {
102
+ return DistributionType.APP_STORE;
103
+ }
104
+ }
105
+ genDerCertFingerprint() {
106
+ return crypto_1.default
107
+ .createHash('sha1')
108
+ .update(this.data.developerCertificate)
109
+ .digest('hex')
110
+ .toUpperCase();
111
+ }
112
+ }
113
+ exports.default = ProvisioningProfile;
114
+ //# sourceMappingURL=provisioningProfile.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"provisioningProfile.js","sourceRoot":"","sources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ypto from 'crypto';\nimport os from 'os';\nimport path from 'path';\n\nimport { errors } from '@expo/eas-build-job';\nimport spawn from '@expo/turtle-spawn';\nimport fs from 'fs-extra';\nimport plist from 'plist';\nimport { v4 as uuid } from 'uuid';\nimport { bunyan } from '@expo/logger';\n\nexport interface ProvisioningProfileData {\n path: string;\n target: string;\n bundleIdentifier: string;\n teamId: string;\n uuid: string;\n name: string;\n developerCertificate: Buffer;\n certificateCommonName: string;\n distributionType: DistributionType;\n}\n\nexport enum DistributionType {\n AD_HOC = 'ad-hoc',\n APP_STORE = 'app-store',\n ENTERPRISE = 'enterprise',\n}\n\nconst PROVISIONING_PROFILES_DIRECTORY = path.join(\n os.homedir(),\n 'Library/MobileDevice/Provisioning Profiles'\n);\n\nexport default class ProvisioningProfile {\n get data(): ProvisioningProfileData {\n if (!this.profileData) {\n throw new Error('You must init the profile first!');\n } else {\n return this.profileData;\n }\n }\n\n private readonly profilePath: string;\n private profileData?: ProvisioningProfileData;\n\n constructor(\n private readonly profile: Buffer,\n private readonly keychainPath: string,\n private readonly target: string,\n private readonly certificateCommonName: string\n ) {\n this.profilePath = path.join(PROVISIONING_PROFILES_DIRECTORY, `${uuid()}.mobileprovision`);\n }\n\n public async init(logger: bunyan): Promise<void> {\n logger.debug(`Making sure ${PROVISIONING_PROFILES_DIRECTORY} exits`);\n await fs.ensureDir(PROVISIONING_PROFILES_DIRECTORY);\n\n logger.debug(`Writing provisioning profile to ${this.profilePath}`);\n await fs.writeFile(this.profilePath, this.profile);\n\n logger.debug('Loading provisioning profile');\n await this.load();\n }\n\n public async destroy(logger: bunyan): Promise<void> {\n if (!this.profilePath) {\n logger.warn(\"There is nothing to destroy, a provisioning profile hasn't been created yet.\");\n return;\n }\n logger.info('Removing provisioning profile');\n await fs.remove(this.profilePath);\n }\n\n public verifyCertificate(fingerprint: string): void {\n const devCertFingerprint = this.genDerCertFingerprint();\n if (devCertFingerprint !== fingerprint) {\n throw new errors.CredentialsDistCertMismatchError(\n `Provisioning profile and distribution certificate don't match.\nProfile's certificate fingerprint = ${devCertFingerprint}, distribution certificate fingerprint = ${fingerprint}`\n );\n }\n }\n\n private async load(): Promise<void> {\n let result;\n try {\n result = await spawn(\n 'security',\n ['cms', '-D', '-k', this.keychainPath, '-i', this.profilePath],\n {\n stdio: 'pipe',\n }\n );\n } catch (err: any) {\n throw new Error(err.stderr.trim());\n }\n const { output } = result;\n\n const plistRaw = output.join('');\n let plistData;\n try {\n plistData = plist.parse(plistRaw) as plist.PlistObject;\n } catch (error: any) {\n throw new Error(`Error when parsing plist: ${error.message}`);\n }\n\n const applicationIdentifier = (plistData.Entitlements as plist.PlistObject)[\n 'application-identifier'\n ] as string;\n const bundleIdentifier = applicationIdentifier.replace(/^.+?\\./, '');\n\n this.profileData = {\n path: this.profilePath,\n target: this.target,\n bundleIdentifier,\n teamId: (plistData.TeamIdentifier as string[])[0],\n uuid: plistData.UUID as string,\n name: plistData.Name as string,\n developerCertificate: Buffer.from((plistData.DeveloperCertificates as string[])[0], 'base64'),\n certificateCommonName: this.certificateCommonName,\n distributionType: this.resolveDistributionType(plistData),\n };\n }\n\n private resolveDistributionType(plistData: plist.PlistObject): DistributionType {\n if (plistData.ProvisionsAllDevices) {\n return DistributionType.ENTERPRISE;\n } else if (plistData.ProvisionedDevices) {\n return DistributionType.AD_HOC;\n } else {\n return DistributionType.APP_STORE;\n }\n }\n\n private genDerCertFingerprint(): string {\n return crypto\n .createHash('sha1')\n .update(this.data.developerCertificate)\n .digest('hex')\n .toUpperCase();\n }\n}\n"]}
@@ -1,11 +1,15 @@
1
1
  /// <reference types="bunyan" />
2
2
  import { bunyan } from '@expo/logger';
3
3
  import { Env } from '@expo/eas-build-job';
4
- export declare function runFastlaneGym({ scheme, buildConfiguration, workingDir, logger, buildLogsDirectory, env, }: {
5
- scheme: string;
6
- buildConfiguration?: string;
4
+ import { SpawnResult } from '@expo/turtle-spawn';
5
+ export declare function runFastlaneGym({ workingDir, logger, buildLogsDirectory, env, }: {
7
6
  workingDir: string;
8
7
  logger: bunyan;
9
8
  buildLogsDirectory: string;
10
9
  env: Env;
11
10
  }): Promise<void>;
11
+ export declare function runFastlane(fastlaneArgs: string[], { logger, env, cwd, }?: {
12
+ logger?: bunyan;
13
+ env?: Record<string, string>;
14
+ cwd?: string;
15
+ }): Promise<SpawnResult>;
@@ -3,44 +3,15 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.runFastlaneGym = void 0;
6
+ exports.runFastlane = exports.runFastlaneGym = void 0;
7
7
  const path_1 = __importDefault(require("path"));
8
- const fs_extra_1 = __importDefault(require("fs-extra"));
9
- const gymfile_1 = require("../../../ios/gymfile");
10
- const xcpretty_1 = require("../../../ios/xcpretty");
11
- const fastlane_1 = require("../../../ios/fastlane");
12
- const tvos_1 = require("./tvos");
13
- async function ensureGymfileExists({ logger, scheme, buildConfiguration, logsDirectory, workingDir, }) {
14
- const gymfilePath = path_1.default.join(workingDir, 'ios/Gymfile');
15
- if (await fs_extra_1.default.pathExists(gymfilePath)) {
16
- logger.info('Gymfile already exists');
17
- return;
18
- }
19
- const isTV = await (0, tvos_1.isTVOS)({ scheme, buildConfiguration, workingDir });
20
- const simulatorDestination = `generic/platform=${isTV ? 'tvOS' : 'iOS'} Simulator`;
21
- await (0, gymfile_1.createGymfileForSimulatorBuild)({
22
- outputFile: gymfilePath,
23
- scheme,
24
- buildConfiguration: buildConfiguration !== null && buildConfiguration !== void 0 ? buildConfiguration : 'release',
25
- derivedDataPath: './build',
26
- clean: false,
27
- logsDirectory,
28
- simulatorDestination,
29
- });
30
- logger.info('Creating Gymfile');
31
- }
32
- async function runFastlaneGym({ scheme, buildConfiguration, workingDir, logger, buildLogsDirectory, env, }) {
33
- await ensureGymfileExists({
34
- scheme,
35
- buildConfiguration: buildConfiguration !== null && buildConfiguration !== void 0 ? buildConfiguration : 'release',
36
- logsDirectory: buildLogsDirectory,
37
- workingDir,
38
- logger,
39
- });
8
+ const turtle_spawn_1 = __importDefault(require("@expo/turtle-spawn"));
9
+ const xcpretty_1 = require("./xcpretty");
10
+ async function runFastlaneGym({ workingDir, logger, buildLogsDirectory, env, }) {
40
11
  const buildLogger = new xcpretty_1.XcodeBuildLogger(logger, workingDir);
41
12
  void buildLogger.watchLogFiles(buildLogsDirectory);
42
13
  try {
43
- await (0, fastlane_1.runFastlane)(['gym'], {
14
+ await runFastlane(['gym'], {
44
15
  cwd: path_1.default.join(workingDir, 'ios'),
45
16
  logger,
46
17
  env,
@@ -51,4 +22,20 @@ async function runFastlaneGym({ scheme, buildConfiguration, workingDir, logger,
51
22
  }
52
23
  }
53
24
  exports.runFastlaneGym = runFastlaneGym;
25
+ async function runFastlane(fastlaneArgs, { logger, env, cwd, } = {}) {
26
+ const fastlaneEnvVars = {
27
+ FASTLANE_DISABLE_COLORS: '1',
28
+ FASTLANE_SKIP_UPDATE_CHECK: '1',
29
+ SKIP_SLOW_FASTLANE_WARNING: 'true',
30
+ FASTLANE_HIDE_TIMESTAMP: 'true',
31
+ LC_ALL: 'en_US.UTF-8',
32
+ ...(env !== null && env !== void 0 ? env : process.env),
33
+ };
34
+ return await (0, turtle_spawn_1.default)('fastlane', fastlaneArgs, {
35
+ env: fastlaneEnvVars,
36
+ logger,
37
+ cwd,
38
+ });
39
+ }
40
+ exports.runFastlane = runFastlane;
54
41
  //# sourceMappingURL=fastlane.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"fastlane.js","sourceRoot":"","sources":["../../../../src/steps/utils/ios/fastlane.ts"],"names":[],"mappings":";;;;;;AAAA,gDAAwB;AAExB,wDAA0B;AAI1B,kDAAsE;AACtE,oDAAyD;AACzD,oDAAoD;AAEpD,iCAAgC;AAEhC,KAAK,UAAU,mBAAmB,CAAC,EACjC,MAAM,EACN,MAAM,EACN,kBAAkB,EAClB,aAAa,EACb,UAAU,GAOX;IACC,MAAM,WAAW,GAAG,cAA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C,MAAM;YACN,GAAG;SACJ,CAAC,CAAC;KACJ;YAAS;QACR,MAAM,WAAW,CAAC,KAAK,EAAE,CAAC;KAC3B;AACH,CAAC;AAjCD,wCAiCC","sourcesContent":["import path from 'path';\n\nimport fs from 'fs-extra';\nimport { bunyan } from '@expo/logger';\nimport { Env } from '@expo/eas-build-job';\n\nimport { createGymfileForSimulatorBuild } from '../../../ios/gymfile';\nimport { XcodeBuildLogger } from '../../../ios/xcpretty';\nimport { runFastlane } from '../../../ios/fastlane';\n\nimport { isTVOS } from './tvos';\n\nasync function ensureGymfileExists({\n logger,\n scheme,\n buildConfiguration,\n logsDirectory,\n workingDir,\n}: {\n logger: bunyan;\n scheme: string;\n buildConfiguration: string;\n logsDirectory: string;\n workingDir: string;\n}): Promise<void> {\n const gymfilePath = path.join(workingDir, 'ios/Gymfile');\n if (await fs.pathExists(gymfilePath)) {\n logger.info('Gymfile already exists');\n return;\n }\n\n const isTV = await isTVOS({ scheme, buildConfiguration, workingDir });\n const simulatorDestination = `generic/platform=${isTV ? 'tvOS' : 'iOS'} Simulator`;\n\n await createGymfileForSimulatorBuild({\n outputFile: gymfilePath,\n scheme,\n buildConfiguration: buildConfiguration ?? 'release',\n derivedDataPath: './build',\n clean: false,\n logsDirectory,\n simulatorDestination,\n });\n\n logger.info('Creating Gymfile');\n}\n\nexport async function runFastlaneGym({\n scheme,\n buildConfiguration,\n workingDir,\n logger,\n buildLogsDirectory,\n env,\n}: {\n scheme: string;\n buildConfiguration?: string;\n workingDir: string;\n logger: bunyan;\n buildLogsDirectory: string;\n env: Env;\n}): Promise<void> {\n await ensureGymfileExists({\n scheme,\n buildConfiguration: buildConfiguration ?? 'release',\n logsDirectory: buildLogsDirectory,\n workingDir,\n logger,\n });\n const buildLogger = new XcodeBuildLogger(logger, workingDir);\n void buildLogger.watchLogFiles(buildLogsDirectory);\n try {\n await runFastlane(['gym'], {\n cwd: path.join(workingDir, 'ios'),\n logger,\n env,\n });\n } finally {\n await buildLogger.flush();\n }\n}\n"]}
1
+ {"version":3,"file":"fastlane.js","sourceRoot":"","sources":["../../../../src/steps/utils/ios/fastlane.ts"],"names":[],"mappings":";;;;;;AAAA,gDAAwB;AAIxB,sEAAwD;AAExD,yCAA8C;AAEvC,KAAK,UAAU,cAAc,CAAC,EACnC,UAAU,EACV,MAAM,EACN,kBAAkB,EAClB,GAAG,GAMJ;IACC,MAAM,WAAW,GAAG,IAAI,2BAAgB,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC;IAC7D,KAAK,WAAW,CAAC,aAAa,CAAC,kBAAkB,CAAC,CAAC;IACnD,IAAI;QACF,MAAM,WAAW,CAAC,CAAC,KAAK,CAAC,EAAE;YACzB,GAAG,EAAE,cAAI,CAAC,IAAI,CAAC,UAAU,EAAE,KAAK,CAAC;YACjC,MAAM;YACN,GAAG;SACJ,CAAC,CAAC;KACJ;YAAS;QACR,MAAM,WAAW,CAAC,KAAK,EAAE,CAAC;KAC3B;AACH,CAAC;AAtBD,wCAsBC;AAEM,KAAK,UAAU,WAAW,CAC/B,YAAsB,EACtB,EACE,MAAM,EACN,GAAG,EACH,GAAG,MAKD,EAAE;IAEN,MAAM,eAAe,GAAG;QACtB,uBAAuB,EAAE,GAAG;QAC5B,0BAA0B,EAAE,GAAG;QAC/B,0BAA0B,EAAE,MAAM;QAClC,uBAAuB,EAAE,MAAM;QAC/B,MAAM,EAAE,aAAa;QACrB,GAAG,CAAC,GAAG,aAAH,GAAG,cAAH,GAAG,GAAI,OAAO,CAAC,GAAG,CAAC;KACxB,CAAC;IACF,OAAO,MAAM,IAAA,sBAAK,EAAC,UAAU,EAAE,YAAY,EAAE;QAC3C,GAAG,EAAE,eAAe;QACpB,MAAM;QACN,GAAG;KACJ,CAAC,CAAC;AACL,CAAC;AAzBD,kCAyBC","sourcesContent":["import path from 'path';\n\nimport { bunyan } from '@expo/logger';\nimport { Env } from '@expo/eas-build-job';\nimport spawn, { SpawnResult } from '@expo/turtle-spawn';\n\nimport { XcodeBuildLogger } from './xcpretty';\n\nexport async function runFastlaneGym({\n workingDir,\n logger,\n buildLogsDirectory,\n env,\n}: {\n workingDir: string;\n logger: bunyan;\n buildLogsDirectory: string;\n env: Env;\n}): Promise<void> {\n const buildLogger = new XcodeBuildLogger(logger, workingDir);\n void buildLogger.watchLogFiles(buildLogsDirectory);\n try {\n await runFastlane(['gym'], {\n cwd: path.join(workingDir, 'ios'),\n logger,\n env,\n });\n } finally {\n await buildLogger.flush();\n }\n}\n\nexport async function runFastlane(\n fastlaneArgs: string[],\n {\n logger,\n env,\n cwd,\n }: {\n logger?: bunyan;\n env?: Record<string, string>;\n cwd?: string;\n } = {}\n): Promise<SpawnResult> {\n const fastlaneEnvVars = {\n FASTLANE_DISABLE_COLORS: '1',\n FASTLANE_SKIP_UPDATE_CHECK: '1',\n SKIP_SLOW_FASTLANE_WARNING: 'true',\n FASTLANE_HIDE_TIMESTAMP: 'true',\n LC_ALL: 'en_US.UTF-8',\n ...(env ?? process.env),\n };\n return await spawn('fastlane', fastlaneArgs, {\n env: fastlaneEnvVars,\n logger,\n cwd,\n });\n}\n"]}
@@ -1,5 +1,3 @@
1
1
  import { Ios } from '@expo/eas-build-job';
2
- export declare function resolveScheme(job: Ios.Job, { workingDir }: {
3
- workingDir: string;
4
- }): string;
5
- export declare function resolveBuildConfiguration(job: Ios.Job): string;
2
+ export declare function resolveScheme(workingDir: string, job: Ios.Job, scheme?: string): string;
3
+ export declare function resolveBuildConfiguration(job: Ios.Job, buildConfiguration?: string): string;
@@ -6,7 +6,10 @@ Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.resolveBuildConfiguration = exports.resolveScheme = void 0;
7
7
  const assert_1 = __importDefault(require("assert"));
8
8
  const config_plugins_1 = require("@expo/config-plugins");
9
- function resolveScheme(job, { workingDir }) {
9
+ function resolveScheme(workingDir, job, scheme) {
10
+ if (scheme) {
11
+ return scheme;
12
+ }
10
13
  if (job.scheme) {
11
14
  return job.scheme;
12
15
  }
@@ -15,8 +18,11 @@ function resolveScheme(job, { workingDir }) {
15
18
  return schemes[0];
16
19
  }
17
20
  exports.resolveScheme = resolveScheme;
18
- function resolveBuildConfiguration(job) {
19
- if (job.buildConfiguration) {
21
+ function resolveBuildConfiguration(job, buildConfiguration) {
22
+ if (buildConfiguration) {
23
+ return buildConfiguration;
24
+ }
25
+ else if (job.buildConfiguration) {
20
26
  return job.buildConfiguration;
21
27
  }
22
28
  else if (job.developmentClient) {
@@ -1 +1 @@
1
- {"version":3,"file":"resolve.js","sourceRoot":"","sources":["../../../../src/steps/utils/ios/resolve.ts"],"names":[],"mappings":";;;;;;AAAA,oDAA4B;AAG5B,yDAAiD;AAEjD,SAAgB,aAAa,CAAC,GAAY,EAAE,EAAE,UAAU,EAA0B;IAChF,IAAI,GAAG,CAAC,MAAM,EAAE;QACd,OAAO,GAAG,CAAC,MAAM,CAAC;KACnB;IACD,MAAM,OAAO,GAAG,0BAAS,CAAC,WAAW,CAAC,uBAAuB,CAAC,UAAU,CAAC,CAAC;IAC1E,IAAA,gBAAM,EAAC,OAAO,CAAC,MAAM,KAAK,CAAC,EAAE,gDAAgD,CAAC,CAAC;IAC/E,OAAO,OAAO,CAAC,CAAC,CAAC,CAAC;AACpB,CAAC;AAPD,sCAOC;AAED,SAAgB,yBAAyB,CAAC,GAAY;IACpD,IAAI,GAAG,CAAC,kBAAkB,EAAE;QAC1B,OAAO,GAAG,CAAC,kBAAkB,CAAC;KAC/B;SAAM,IAAI,GAAG,CAAC,iBAAiB,EAAE;QAChC,OAAO,OAAO,CAAC;KAChB;SAAM;QACL,OAAO,SAAS,CAAC;KAClB;AACH,CAAC;AARD,8DAQC","sourcesContent":["import assert from 'assert';\n\nimport { Ios } from '@expo/eas-build-job';\nimport { IOSConfig } from '@expo/config-plugins';\n\nexport function resolveScheme(job: Ios.Job, { workingDir }: { workingDir: string }): string {\n if (job.scheme) {\n return job.scheme;\n }\n const schemes = IOSConfig.BuildScheme.getSchemesFromXcodeproj(workingDir);\n assert(schemes.length === 1, 'Ejected project should have exactly one scheme');\n return schemes[0];\n}\n\nexport function resolveBuildConfiguration(job: Ios.Job): string {\n if (job.buildConfiguration) {\n return job.buildConfiguration;\n } else if (job.developmentClient) {\n return 'Debug';\n } else {\n return 'Release';\n }\n}\n"]}
1
+ {"version":3,"file":"resolve.js","sourceRoot":"","sources":["../../../../src/steps/utils/ios/resolve.ts"],"names":[],"mappings":";;;;;;AAAA,oDAA4B;AAG5B,yDAAiD;AAEjD,SAAgB,aAAa,CAAC,UAAkB,EAAE,GAAY,EAAE,MAAe;IAC7E,IAAI,MAAM,EAAE;QACV,OAAO,MAAM,CAAC;KACf;IACD,IAAI,GAAG,CAAC,MAAM,EAAE;QACd,OAAO,GAAG,CAAC,MAAM,CAAC;KACnB;IACD,MAAM,OAAO,GAAG,0BAAS,CAAC,WAAW,CAAC,uBAAuB,CAAC,UAAU,CAAC,CAAC;IAC1E,IAAA,gBAAM,EAAC,OAAO,CAAC,MAAM,KAAK,CAAC,EAAE,gDAAgD,CAAC,CAAC;IAC/E,OAAO,OAAO,CAAC,CAAC,CAAC,CAAC;AACpB,CAAC;AAVD,sCAUC;AAED,SAAgB,yBAAyB,CAAC,GAAY,EAAE,kBAA2B;IACjF,IAAI,kBAAkB,EAAE;QACtB,OAAO,kBAAkB,CAAC;KAC3B;SAAM,IAAI,GAAG,CAAC,kBAAkB,EAAE;QACjC,OAAO,GAAG,CAAC,kBAAkB,CAAC;KAC/B;SAAM,IAAI,GAAG,CAAC,iBAAiB,EAAE;QAChC,OAAO,OAAO,CAAC;KAChB;SAAM;QACL,OAAO,SAAS,CAAC;KAClB;AACH,CAAC;AAVD,8DAUC","sourcesContent":["import assert from 'assert';\n\nimport { Ios } from '@expo/eas-build-job';\nimport { IOSConfig } from '@expo/config-plugins';\n\nexport function resolveScheme(workingDir: string, job: Ios.Job, scheme?: string): string {\n if (scheme) {\n return scheme;\n }\n if (job.scheme) {\n return job.scheme;\n }\n const schemes = IOSConfig.BuildScheme.getSchemesFromXcodeproj(workingDir);\n assert(schemes.length === 1, 'Ejected project should have exactly one scheme');\n return schemes[0];\n}\n\nexport function resolveBuildConfiguration(job: Ios.Job, buildConfiguration?: string): string {\n if (buildConfiguration) {\n return buildConfiguration;\n } else if (job.buildConfiguration) {\n return job.buildConfiguration;\n } else if (job.developmentClient) {\n return 'Debug';\n } else {\n return 'Release';\n }\n}\n"]}
@@ -0,0 +1,16 @@
1
+ /// <reference types="bunyan" />
2
+ import { bunyan } from '@expo/logger';
3
+ export declare class XcodeBuildLogger {
4
+ private readonly logger;
5
+ private readonly projectRoot;
6
+ private loggerError?;
7
+ private flushing;
8
+ private logReaderPromise?;
9
+ private logsPath?;
10
+ constructor(logger: bunyan, projectRoot: string);
11
+ watchLogFiles(logsDirectory: string): Promise<void>;
12
+ flush(): Promise<void>;
13
+ private getBuildLogFilename;
14
+ private startBuildLogger;
15
+ private findBundlerErrors;
16
+ }