@expo/build-tools 1.0.109 → 1.0.111
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.
- package/dist/builders/custom.js +2 -0
- package/dist/builders/custom.js.map +1 -1
- package/dist/generic.d.ts +2 -0
- package/dist/generic.js +2 -1
- package/dist/generic.js.map +1 -1
- package/dist/steps/easFunctions.js +2 -0
- package/dist/steps/easFunctions.js.map +1 -1
- package/dist/steps/functions/repack.d.ts +2 -0
- package/dist/steps/functions/repack.js +127 -0
- package/dist/steps/functions/repack.js.map +1 -0
- package/dist/utils/artifacts.js +5 -1
- package/dist/utils/artifacts.js.map +1 -1
- package/package.json +3 -2
- package/resources/__eas/repack.yml +13 -0
package/dist/builders/custom.js
CHANGED
|
@@ -14,9 +14,11 @@ const customBuildContext_1 = require("../customBuildContext");
|
|
|
14
14
|
const easBuildInternal_1 = require("../common/easBuildInternal");
|
|
15
15
|
const easFunctionGroups_1 = require("../steps/easFunctionGroups");
|
|
16
16
|
const xcodeBuildLogs_1 = require("../ios/xcodeBuildLogs");
|
|
17
|
+
const generic_1 = require("../generic");
|
|
17
18
|
async function runCustomBuildAsync(ctx) {
|
|
18
19
|
var _a, _b;
|
|
19
20
|
const customBuildCtx = new customBuildContext_1.CustomBuildContext(ctx);
|
|
21
|
+
await (0, generic_1.addEasWorkflows)(customBuildCtx);
|
|
20
22
|
await (0, projectSources_1.prepareProjectSourcesAsync)(ctx, customBuildCtx.projectSourceDirectory);
|
|
21
23
|
if (ctx.job.triggeredBy === eas_build_job_1.BuildTrigger.GIT_BASED_INTEGRATION) {
|
|
22
24
|
// We need to setup envs from eas.json
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"custom.js","sourceRoot":"","sources":["../../src/builders/custom.ts"],"names":[],"mappings":";;;;;;AAAA,gDAAwB;AAExB,uDAAwF;AACxF,uCAAgF;AAChF,4DAAoC;AAGpC,6DAAsE;AACtE,wDAAwD;AACxD,8DAA2D;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AC;oBACP,yCAAyC;gBAC3C,CAAC;YACH,CAAC;QACH,CAAC;IACH,CAAC;IAAC,OAAO,GAAQ,EAAE,CAAC;QAClB,GAAG,CAAC,SAAS,GAAG,GAAG,CAAC,SAAS,CAAC;QAC9B,MAAM,GAAG,CAAC;IACZ,CAAC;IAED,OAAO,GAAG,CAAC,SAAS,CAAC;AACvB,CAAC;AA9DD,kDA8DC","sourcesContent":["import path from 'path';\n\nimport { BuildJob, BuildPhase, BuildTrigger, Ios, Platform } from '@expo/eas-build-job';\nimport { BuildConfigParser, BuildStepGlobalContext, errors } from '@expo/steps';\nimport nullthrows from 'nullthrows';\n\nimport { Artifacts, BuildContext } from '../context';\nimport { prepareProjectSourcesAsync } from '../common/projectSources';\nimport { getEasFunctions } from '../steps/easFunctions';\nimport { CustomBuildContext } from '../customBuildContext';\nimport { resolveEnvFromBuildProfileAsync } from '../common/easBuildInternal';\nimport { getEasFunctionGroups } from '../steps/easFunctionGroups';\nimport { findAndUploadXcodeBuildLogsAsync } from '../ios/xcodeBuildLogs';\nimport { addEasWorkflows } from '../generic';\n\nexport async function runCustomBuildAsync(ctx: BuildContext<BuildJob>): Promise<Artifacts> {\n const customBuildCtx = new CustomBuildContext(ctx);\n await addEasWorkflows(customBuildCtx);\n await prepareProjectSourcesAsync(ctx, customBuildCtx.projectSourceDirectory);\n if (ctx.job.triggeredBy === BuildTrigger.GIT_BASED_INTEGRATION) {\n // We need to setup envs from eas.json\n const env = await resolveEnvFromBuildProfileAsync(ctx, {\n cwd: path.join(customBuildCtx.projectSourceDirectory, ctx.job.projectRootDirectory ?? '.'),\n });\n ctx.updateEnv(env);\n customBuildCtx.updateEnv(ctx.env);\n }\n const relativeConfigPath = nullthrows(\n ctx.job.customBuildConfig?.path,\n 'Custom build config must be defined for custom builds'\n );\n const configPath = path.join(\n ctx.getReactNativeProjectDirectory(customBuildCtx.projectSourceDirectory),\n relativeConfigPath\n );\n\n const globalContext = new BuildStepGlobalContext(customBuildCtx, false);\n const easFunctions = getEasFunctions(customBuildCtx);\n const easFunctionGroups = getEasFunctionGroups(customBuildCtx);\n const parser = new BuildConfigParser(globalContext, {\n externalFunctions: easFunctions,\n externalFunctionGroups: easFunctionGroups,\n configPath,\n });\n const workflow = await ctx.runBuildPhase(BuildPhase.PARSE_CUSTOM_WORKFLOW_CONFIG, async () => {\n try {\n return await parser.parseAsync();\n } catch (parseError: any) {\n ctx.logger.error('Failed to parse the custom build config file.');\n if (parseError instanceof errors.BuildWorkflowError) {\n for (const err of parseError.errors) {\n ctx.logger.error({ err });\n }\n }\n throw parseError;\n }\n });\n try {\n try {\n await workflow.executeAsync();\n } finally {\n if (!ctx.artifacts.XCODE_BUILD_LOGS && ctx.job.platform === Platform.IOS) {\n try {\n await findAndUploadXcodeBuildLogsAsync(ctx as BuildContext<Ios.Job>, {\n logger: ctx.logger,\n });\n } catch {\n // do nothing, it's a non-breaking error.\n }\n }\n }\n } catch (err: any) {\n err.artifacts = ctx.artifacts;\n throw err;\n }\n\n return ctx.artifacts;\n}\n"]}
|
package/dist/generic.d.ts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
1
|
import { Generic } from '@expo/eas-build-job';
|
|
2
2
|
import { BuildContext } from './context';
|
|
3
|
+
import { CustomBuildContext } from './customBuildContext';
|
|
3
4
|
export declare function runGenericJobAsync(ctx: BuildContext<Generic.Job>): Promise<void>;
|
|
5
|
+
export declare function addEasWorkflows(customBuildCtx: CustomBuildContext): Promise<void>;
|
package/dist/generic.js
CHANGED
|
@@ -3,7 +3,7 @@ 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.runGenericJobAsync = void 0;
|
|
6
|
+
exports.addEasWorkflows = exports.runGenericJobAsync = void 0;
|
|
7
7
|
const fs_1 = __importDefault(require("fs"));
|
|
8
8
|
const path_1 = __importDefault(require("path"));
|
|
9
9
|
const eas_build_job_1 = require("@expo/eas-build-job");
|
|
@@ -49,4 +49,5 @@ async function addEasWorkflows(customBuildCtx) {
|
|
|
49
49
|
});
|
|
50
50
|
await fs_1.default.promises.cp(path_1.default.join(__dirname, '..', 'resources', '__eas'), path_1.default.join(customBuildCtx.projectSourceDirectory, '__eas'), { recursive: true });
|
|
51
51
|
}
|
|
52
|
+
exports.addEasWorkflows = addEasWorkflows;
|
|
52
53
|
//# sourceMappingURL=generic.js.map
|
package/dist/generic.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generic.js","sourceRoot":"","sources":["../src/generic.ts"],"names":[],"mappings":";;;;;;AAAA,4CAAoB;AACpB,gDAAwB;AAExB,uDAA0D;AAC1D,uCAAgF;AAChF,4DAAoC;AAGpC,4DAAqE;AACrE,uDAAuD;AACvD,6DAA0D;AAC1D,iEAAiE;AAE1D,KAAK,UAAU,kBAAkB,CAAC,GAA8B;;IACrE,MAAM,cAAc,GAAG,IAAI,uCAAkB,CAAC,GAAG,CAAC,CAAC;IAEnD,MAAM,IAAA,2CAA0B,EAAC,GAAG,EAAE,cAAc,CAAC,sBAAsB,CAAC,CAAC;IAE7E,MAAM,eAAe,CAAC,cAAc,CAAC,CAAC;IAEtC,MAAM,kBAAkB,GAAG,IAAA,oBAAU,EACnC,MAAA,GAAG,CAAC,GAAG,CAAC,iBAAiB,0CAAE,IAAI,EAC/B,mCAAmC,CACpC,CAAC;IACF,MAAM,UAAU,GAAG,cAAI,CAAC,IAAI,CAAC,cAAc,CAAC,sBAAsB,EAAE,kBAAkB,CAAC,CAAC;IAExF,MAAM,aAAa,GAAG,IAAI,8BAAsB,CAAC,cAAc,EAAE,KAAK,CAAC,CAAC;IAExE,MAAM,MAAM,GAAG,IAAI,yBAAiB,CAAC,aAAa,EAAE;QAClD,iBAAiB,EAAE,IAAA,8BAAe,EAAC,cAAc,CAAC;QAClD,sBAAsB,EAAE,IAAA,wCAAoB,EA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AAI,CAAC,SAAS,EAAE,IAAI,EAAE,WAAW,EAAE,OAAO,CAAC,EAChD,cAAI,CAAC,IAAI,CAAC,cAAc,CAAC,sBAAsB,EAAE,OAAO,CAAC,EACzD,EAAE,SAAS,EAAE,IAAI,EAAE,CACpB,CAAC;AACJ,CAAC;AAVD,0CAUC","sourcesContent":["import fs from 'fs';\nimport path from 'path';\n\nimport { BuildPhase, Generic } from '@expo/eas-build-job';\nimport { BuildConfigParser, BuildStepGlobalContext, errors } from '@expo/steps';\nimport nullthrows from 'nullthrows';\n\nimport { BuildContext } from './context';\nimport { prepareProjectSourcesAsync } from './common/projectSources';\nimport { getEasFunctions } from './steps/easFunctions';\nimport { CustomBuildContext } from './customBuildContext';\nimport { getEasFunctionGroups } from './steps/easFunctionGroups';\n\nexport async function runGenericJobAsync(ctx: BuildContext<Generic.Job>): Promise<void> {\n const customBuildCtx = new CustomBuildContext(ctx);\n\n await prepareProjectSourcesAsync(ctx, customBuildCtx.projectSourceDirectory);\n\n await addEasWorkflows(customBuildCtx);\n\n const relativeConfigPath = nullthrows(\n ctx.job.customBuildConfig?.path,\n 'Missing job definition file path.'\n );\n const configPath = path.join(customBuildCtx.projectSourceDirectory, relativeConfigPath);\n\n const globalContext = new BuildStepGlobalContext(customBuildCtx, false);\n\n const parser = new BuildConfigParser(globalContext, {\n externalFunctions: getEasFunctions(customBuildCtx),\n externalFunctionGroups: getEasFunctionGroups(customBuildCtx),\n configPath,\n });\n\n const workflow = await ctx.runBuildPhase(BuildPhase.PARSE_CUSTOM_WORKFLOW_CONFIG, async () => {\n try {\n return await parser.parseAsync();\n } catch (parseError: any) {\n ctx.logger.error('Failed to parse the job definition file.');\n if (parseError instanceof errors.BuildWorkflowError) {\n for (const err of parseError.errors) {\n ctx.logger.error({ err });\n }\n }\n throw parseError;\n }\n });\n\n await workflow.executeAsync();\n}\n\nexport async function addEasWorkflows(customBuildCtx: CustomBuildContext): Promise<void> {\n await fs.promises.mkdir(path.join(customBuildCtx.projectSourceDirectory, '__eas'), {\n recursive: true,\n });\n\n await fs.promises.cp(\n path.join(__dirname, '..', 'resources', '__eas'),\n path.join(customBuildCtx.projectSourceDirectory, '__eas'),\n { recursive: true }\n );\n}\n"]}
|
|
@@ -24,6 +24,7 @@ const installPods_1 = require("./functions/installPods");
|
|
|
24
24
|
const sendSlackMessage_1 = require("./functions/sendSlackMessage");
|
|
25
25
|
const resolveBuildConfig_1 = require("./functions/resolveBuildConfig");
|
|
26
26
|
const calculateEASUpdateRuntimeVersion_1 = require("./functions/calculateEASUpdateRuntimeVersion");
|
|
27
|
+
const repack_1 = require("./functions/repack");
|
|
27
28
|
function getEasFunctions(ctx) {
|
|
28
29
|
const functions = [
|
|
29
30
|
(0, checkout_1.createCheckoutBuildFunction)(),
|
|
@@ -46,6 +47,7 @@ function getEasFunctions(ctx) {
|
|
|
46
47
|
(0, installPods_1.createInstallPodsBuildFunction)(),
|
|
47
48
|
(0, sendSlackMessage_1.createSendSlackMessageFunction)(),
|
|
48
49
|
(0, calculateEASUpdateRuntimeVersion_1.calculateEASUpdateRuntimeVersionFunction)(ctx),
|
|
50
|
+
(0, repack_1.createRepackBuildFunction)(),
|
|
49
51
|
];
|
|
50
52
|
if (ctx.hasBuildJob()) {
|
|
51
53
|
functions.push(...[
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"easFunctions.js","sourceRoot":"","sources":["../../src/steps/easFunctions.ts"],"names":[],"mappings":";;;AAIA,+DAA+E;AAC/E,mDAAmE;AACnE,yDAAwE;AACxE,uEAAuF;AACvF,mDAAmE;AACnE,yFAAyG;AACzG,6FAAkG;AAClG,mFAAwF;AACxF,iFAAsF;AACtF,qDAA0D;AAC1D,qGAA0G;AAC1G,iFAAsF;AACtF,yEAA8E;AAC9E,yFAA8F;AAC9F,yDAA8D;AAC9D,2EAA2F;AAC3F,qEAAqF;AACrF,+DAA+E;AAC/E,uIAA0I;AAC1I,yDAAyE;AACzE,mEAA8E;AAC9E,uEAAuF;AAC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,CAAC;YACnD,IAAA,0DAAqC,EAAC,GAAG,CAAC;YAC1C,IAAA,6GAAwD,EAAC,GAAG,CAAC;SAC9D,CACF,CAAC;IACJ,CAAC;IAED,OAAO,SAAS,CAAC;AACnB,CAAC;AAxCD,0CAwCC","sourcesContent":["import { BuildFunction } from '@expo/steps';\n\nimport { CustomBuildContext } from '../customBuildContext';\n\nimport { createUploadArtifactBuildFunction } from './functions/uploadArtifact';\nimport { createCheckoutBuildFunction } from './functions/checkout';\nimport { createSetUpNpmrcBuildFunction } from './functions/useNpmToken';\nimport { createInstallNodeModulesBuildFunction } from './functions/installNodeModules';\nimport { createPrebuildBuildFunction } from './functions/prebuild';\nimport { createFindAndUploadBuildArtifactsBuildFunction } from './functions/findAndUploadBuildArtifacts';\nimport { configureEASUpdateIfInstalledFunction } from './functions/configureEASUpdateIfInstalled';\nimport { injectAndroidCredentialsFunction } from './functions/injectAndroidCredentials';\nimport { configureAndroidVersionFunction } from './functions/configureAndroidVersion';\nimport { runGradleFunction } from './functions/runGradle';\nimport { resolveAppleTeamIdFromCredentialsFunction } from './functions/resolveAppleTeamIdFromCredentials';\nimport { configureIosCredentialsFunction } from './functions/configureIosCredentials';\nimport { configureIosVersionFunction } from './functions/configureIosVersion';\nimport { generateGymfileFromTemplateFunction } from './functions/generateGymfileFromTemplate';\nimport { runFastlaneFunction } from './functions/runFastlane';\nimport { createStartAndroidEmulatorBuildFunction } from './functions/startAndroidEmulator';\nimport { createStartIosSimulatorBuildFunction } from './functions/startIosSimulator';\nimport { createInstallMaestroBuildFunction } from './functions/installMaestro';\nimport { createGetCredentialsForBuildTriggeredByGithubIntegration } from './functions/getCredentialsForBuildTriggeredByGitHubIntegration';\nimport { createInstallPodsBuildFunction } from './functions/installPods';\nimport { createSendSlackMessageFunction } from './functions/sendSlackMessage';\nimport { createResolveBuildConfigBuildFunction } from './functions/resolveBuildConfig';\nimport { calculateEASUpdateRuntimeVersionFunction } from './functions/calculateEASUpdateRuntimeVersion';\nimport { createRepackBuildFunction } from './functions/repack';\n\nexport function getEasFunctions(ctx: CustomBuildContext): BuildFunction[] {\n const functions = [\n createCheckoutBuildFunction(),\n createUploadArtifactBuildFunction(ctx),\n createSetUpNpmrcBuildFunction(),\n createInstallNodeModulesBuildFunction(),\n createPrebuildBuildFunction(),\n\n configureEASUpdateIfInstalledFunction(),\n injectAndroidCredentialsFunction(),\n configureAndroidVersionFunction(),\n runGradleFunction(),\n resolveAppleTeamIdFromCredentialsFunction(),\n configureIosCredentialsFunction(),\n configureIosVersionFunction(),\n generateGymfileFromTemplateFunction(),\n runFastlaneFunction(),\n createStartAndroidEmulatorBuildFunction(),\n createStartIosSimulatorBuildFunction(),\n createInstallMaestroBuildFunction(),\n\n createInstallPodsBuildFunction(),\n createSendSlackMessageFunction(),\n\n calculateEASUpdateRuntimeVersionFunction(ctx),\n\n createRepackBuildFunction(),\n ];\n\n if (ctx.hasBuildJob()) {\n functions.push(\n ...[\n createFindAndUploadBuildArtifactsBuildFunction(ctx),\n createResolveBuildConfigBuildFunction(ctx),\n createGetCredentialsForBuildTriggeredByGithubIntegration(ctx),\n ]\n );\n }\n\n return functions;\n}\n"]}
|
|
@@ -0,0 +1,127 @@
|
|
|
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.createRepackBuildFunction = void 0;
|
|
7
|
+
const path_1 = __importDefault(require("path"));
|
|
8
|
+
const util_1 = require("util");
|
|
9
|
+
const stream_1 = require("stream");
|
|
10
|
+
const os_1 = __importDefault(require("os"));
|
|
11
|
+
const assert_1 = __importDefault(require("assert"));
|
|
12
|
+
const steps_1 = require("@expo/steps");
|
|
13
|
+
const fs_extra_1 = __importDefault(require("fs-extra"));
|
|
14
|
+
const eas_build_job_1 = require("@expo/eas-build-job");
|
|
15
|
+
const node_fetch_1 = __importDefault(require("node-fetch"));
|
|
16
|
+
const repack_app_1 = require("@expo/repack-app");
|
|
17
|
+
const uuid_1 = require("uuid");
|
|
18
|
+
const manager_1 = __importDefault(require("../utils/ios/credentials/manager"));
|
|
19
|
+
const pipeline = (0, util_1.promisify)(stream_1.Stream.pipeline);
|
|
20
|
+
function createRepackBuildFunction() {
|
|
21
|
+
return new steps_1.BuildFunction({
|
|
22
|
+
namespace: 'eas',
|
|
23
|
+
id: '__download_and_repack_golden_development_client_archive',
|
|
24
|
+
name: 'Download and repack golden development client archive',
|
|
25
|
+
outputProviders: [
|
|
26
|
+
steps_1.BuildStepOutput.createProvider({
|
|
27
|
+
id: 'repacked_archive_path',
|
|
28
|
+
required: true,
|
|
29
|
+
}),
|
|
30
|
+
],
|
|
31
|
+
fn: async (stepsCtx, { outputs, env }) => {
|
|
32
|
+
var _a, _b, _c, _d;
|
|
33
|
+
const tmpDir = path_1.default.join(os_1.default.tmpdir(), `eas-build-golden-dev-client-app-${(0, uuid_1.v4)()}`);
|
|
34
|
+
await fs_extra_1.default.mkdirs(tmpDir);
|
|
35
|
+
stepsCtx.logger.info(`Created temporary directory: ${tmpDir}`);
|
|
36
|
+
stepsCtx.logger.info('Downloading golden development client archive...');
|
|
37
|
+
const fileName = stepsCtx.global.staticContext.job.platform === eas_build_job_1.Platform.IOS
|
|
38
|
+
? stepsCtx.global.staticContext.job.simulator
|
|
39
|
+
? 'golden-dev-client-simulator-latest.ipa'
|
|
40
|
+
: 'golden-dev-client-device-latest.ipa'
|
|
41
|
+
: 'golden-dev-client-latest.apk';
|
|
42
|
+
const goldenArchiveUrl = (_a = env.__EAS_GOLDEN_DEV_CLIENT_URL) !== null && _a !== void 0 ? _a : `https://storage.googleapis.com/turtle-v2/onboarding/${fileName}`;
|
|
43
|
+
const goldenArchivePath = path_1.default.join(tmpDir, fileName);
|
|
44
|
+
try {
|
|
45
|
+
const response = await (0, node_fetch_1.default)(goldenArchiveUrl, {
|
|
46
|
+
timeout: 1 * 60 * 1000, // 1 minute
|
|
47
|
+
});
|
|
48
|
+
if (!response.ok) {
|
|
49
|
+
throw new Error(`[${response.status}] ${response.statusText}`);
|
|
50
|
+
}
|
|
51
|
+
await pipeline(response.body, fs_extra_1.default.createWriteStream(goldenArchivePath));
|
|
52
|
+
}
|
|
53
|
+
catch (error) {
|
|
54
|
+
throw new Error(`Failed to download golden development client archive: ${error.message}`);
|
|
55
|
+
}
|
|
56
|
+
stepsCtx.logger.info(`Downloaded golden development client archive to ${goldenArchivePath}`);
|
|
57
|
+
stepsCtx.logger.info('Repacking and resigning the app...');
|
|
58
|
+
const repackedArchivePath = path_1.default.join(tmpDir, stepsCtx.global.staticContext.job.platform === eas_build_job_1.Platform.IOS
|
|
59
|
+
? stepsCtx.global.staticContext.job.simulator
|
|
60
|
+
? 'target.zip'
|
|
61
|
+
: 'target.ipa'
|
|
62
|
+
: 'target.apk');
|
|
63
|
+
if (stepsCtx.global.staticContext.job.platform === eas_build_job_1.Platform.IOS) {
|
|
64
|
+
await (0, repack_app_1.repackAppIosAsync)({
|
|
65
|
+
platform: 'ios',
|
|
66
|
+
projectRoot: stepsCtx.workingDirectory,
|
|
67
|
+
sourceAppPath: goldenArchivePath,
|
|
68
|
+
outputPath: repackedArchivePath,
|
|
69
|
+
workingDirectory: tmpDir,
|
|
70
|
+
iosSigningOptions: stepsCtx.global.staticContext.job.simulator
|
|
71
|
+
? undefined
|
|
72
|
+
: await resolveIosSigningOptions({
|
|
73
|
+
logger: stepsCtx.logger,
|
|
74
|
+
buildCredentials: (_b = stepsCtx.global.staticContext.job.secrets) === null || _b === void 0 ? void 0 : _b.buildCredentials,
|
|
75
|
+
}),
|
|
76
|
+
logger: stepsCtx.logger,
|
|
77
|
+
skipWorkingDirCleanup: true,
|
|
78
|
+
verbose: env.__EAS_REPACK_VERBOSE !== undefined,
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
else if (stepsCtx.global.staticContext.job.platform === eas_build_job_1.Platform.ANDROID) {
|
|
82
|
+
let androidCredentials;
|
|
83
|
+
if ((_d = (_c = stepsCtx.global.staticContext.job.secrets) === null || _c === void 0 ? void 0 : _c.buildCredentials) === null || _d === void 0 ? void 0 : _d.keystore.dataBase64) {
|
|
84
|
+
const keyStorePath = path_1.default.join(tmpDir, `keystore-${(0, uuid_1.v4)()}`);
|
|
85
|
+
await fs_extra_1.default.writeFile(keyStorePath, Buffer.from(stepsCtx.global.staticContext.job.secrets.buildCredentials.keystore.dataBase64, 'base64'));
|
|
86
|
+
androidCredentials = {
|
|
87
|
+
keyStorePath,
|
|
88
|
+
keyStorePassword: stepsCtx.global.staticContext.job.secrets.buildCredentials.keystore.keystorePassword,
|
|
89
|
+
keyAlias: stepsCtx.global.staticContext.job.secrets.buildCredentials.keystore.keyAlias,
|
|
90
|
+
keyPassword: stepsCtx.global.staticContext.job.secrets.buildCredentials.keystore.keyPassword,
|
|
91
|
+
};
|
|
92
|
+
}
|
|
93
|
+
await (0, repack_app_1.repackAppAndroidAsync)({
|
|
94
|
+
platform: 'android',
|
|
95
|
+
projectRoot: stepsCtx.workingDirectory,
|
|
96
|
+
sourceAppPath: goldenArchivePath,
|
|
97
|
+
outputPath: repackedArchivePath,
|
|
98
|
+
workingDirectory: tmpDir,
|
|
99
|
+
androidSigningOptions: androidCredentials,
|
|
100
|
+
logger: stepsCtx.logger,
|
|
101
|
+
skipWorkingDirCleanup: true,
|
|
102
|
+
verbose: env.__EAS_REPACK_VERBOSE !== undefined,
|
|
103
|
+
});
|
|
104
|
+
}
|
|
105
|
+
else {
|
|
106
|
+
throw new Error('Unsupported platform');
|
|
107
|
+
}
|
|
108
|
+
if (!(await fs_extra_1.default.exists(repackedArchivePath))) {
|
|
109
|
+
throw new Error(`Failed to repack the app. ${repackedArchivePath} does not exist`);
|
|
110
|
+
}
|
|
111
|
+
stepsCtx.logger.info(`Repacked and resigned the app to ${repackedArchivePath}`);
|
|
112
|
+
outputs.repacked_archive_path.set(repackedArchivePath);
|
|
113
|
+
},
|
|
114
|
+
});
|
|
115
|
+
}
|
|
116
|
+
exports.createRepackBuildFunction = createRepackBuildFunction;
|
|
117
|
+
async function resolveIosSigningOptions({ buildCredentials, logger, }) {
|
|
118
|
+
(0, assert_1.default)(buildCredentials, 'buildCredentials is required for repacking non-simulator iOS apps');
|
|
119
|
+
const credentialsManager = new manager_1.default(buildCredentials);
|
|
120
|
+
const credentials = await credentialsManager.prepare(logger);
|
|
121
|
+
return {
|
|
122
|
+
provisioningProfile: Object.values(credentials.targetProvisioningProfiles)[0].path,
|
|
123
|
+
keychainPath: credentials.keychainPath,
|
|
124
|
+
signingIdentity: credentials.applicationTargetProvisioningProfile.data.certificateCommonName,
|
|
125
|
+
};
|
|
126
|
+
}
|
|
127
|
+
//# sourceMappingURL=repack.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"repack.js","sourceRoot":"","sources":["../../../src/steps/functions/repack.ts"],"names":[],"mappings":";;;;;;AAAA,gDAAwB;AACxB,+BAAiC;AACjC,mCAAgC;AAChC,4CAAoB;AACpB,oDAA4B;AAE5B,uCAA6D;AAC7D,wDAA0B;AAC1B,uDAA+C;AAC/C,4DAA+B;AAC/B,iDAA4E;AAC5E,+BAAoC;AAIpC,+EAAqE;AAErE,MAAM,QAAQ,GAAG,IAAA,gBAAS,EAAC,eAAM,CAAC,QAAQ,CAAC,CAAC;AAE5C,SAAgB,yBAAyB;IACvC,OAAO,IAAI,qBAAa,CAAC;QACvB,SAAS,EAAE,KAAK;QAChB,EAAE,EAAE,yDAAyD;QAC7D,IAAI,EAAE,uDAAuD;QAC7D,eAAe,EAAE;YACf,uBAAe,CAAC,cAAc,CAAC;gBAC7B,EAAE,EAAE,uBAAuB;gBAC3B,QAAQ,EAAE,IAAI;aACf,CAAC;SACH;QACD,EAAE,EAAE,KAAK,EAAE,QAAQ,EAAE,EAAE,OAAO,EAAE,GAAG,EAAE,EAAE,EAAE;;YACvC,MAAM,MAAM,GAAG,cAAI,C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AQ,CAAC,MAAM;oBACvB,qBAAqB,EAAE,IAAI;oBAC3B,OAAO,EAAE,GAAG,CAAC,oBAAoB,KAAK,SAAS;iBAChD,CAAC,CAAC;YACL,CAAC;iBAAM,CAAC;gBACN,MAAM,IAAI,KAAK,CAAC,sBAAsB,CAAC,CAAC;YAC1C,CAAC;YAED,IAAI,CAAC,CAAC,MAAM,kBAAE,CAAC,MAAM,CAAC,mBAAmB,CAAC,CAAC,EAAE,CAAC;gBAC5C,MAAM,IAAI,KAAK,CAAC,6BAA6B,mBAAmB,iBAAiB,CAAC,CAAC;YACrF,CAAC;YAED,QAAQ,CAAC,MAAM,CAAC,IAAI,CAAC,oCAAoC,mBAAmB,EAAE,CAAC,CAAC;YAChF,OAAO,CAAC,qBAAqB,CAAC,GAAG,CAAC,mBAAmB,CAAC,CAAC;QACzD,CAAC;KACF,CAAC,CAAC;AACL,CAAC;AArHD,8DAqHC;AAED,KAAK,UAAU,wBAAwB,CAAC,EACtC,gBAAgB,EAChB,MAAM,GAIP;IAKC,IAAA,gBAAM,EAAC,gBAAgB,EAAE,mEAAmE,CAAC,CAAC;IAE9F,MAAM,kBAAkB,GAAG,IAAI,iBAAqB,CAAC,gBAAgB,CAAC,CAAC;IACvE,MAAM,WAAW,GAAG,MAAM,kBAAkB,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;IAE7D,OAAO;QACL,mBAAmB,EAAE,MAAM,CAAC,MAAM,CAAC,WAAW,CAAC,0BAA0B,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI;QAClF,YAAY,EAAE,WAAW,CAAC,YAAY;QACtC,eAAe,EAAE,WAAW,CAAC,oCAAoC,CAAC,IAAI,CAAC,qBAAqB;KAC7F,CAAC;AACJ,CAAC","sourcesContent":["import path from 'path';\nimport { promisify } from 'util';\nimport { Stream } from 'stream';\nimport os from 'os';\nimport assert from 'assert';\n\nimport { BuildFunction, BuildStepOutput } from '@expo/steps';\nimport fs from 'fs-extra';\nimport { Platform } from '@expo/eas-build-job';\nimport fetch from 'node-fetch';\nimport { repackAppAndroidAsync, repackAppIosAsync } from '@expo/repack-app';\nimport { v4 as uuidv4 } from 'uuid';\nimport { BuildCredentials } from '@expo/eas-build-job/dist/ios';\nimport { bunyan } from '@expo/logger';\n\nimport IosCredentialsManager from '../utils/ios/credentials/manager';\n\nconst pipeline = promisify(Stream.pipeline);\n\nexport function createRepackBuildFunction(): BuildFunction {\n return new BuildFunction({\n namespace: 'eas',\n id: '__download_and_repack_golden_development_client_archive',\n name: 'Download and repack golden development client archive',\n outputProviders: [\n BuildStepOutput.createProvider({\n id: 'repacked_archive_path',\n required: true,\n }),\n ],\n fn: async (stepsCtx, { outputs, env }) => {\n const tmpDir = path.join(os.tmpdir(), `eas-build-golden-dev-client-app-${uuidv4()}`);\n await fs.mkdirs(tmpDir);\n stepsCtx.logger.info(`Created temporary directory: ${tmpDir}`);\n\n stepsCtx.logger.info('Downloading golden development client archive...');\n const fileName =\n stepsCtx.global.staticContext.job.platform === Platform.IOS\n ? stepsCtx.global.staticContext.job.simulator\n ? 'golden-dev-client-simulator-latest.ipa'\n : 'golden-dev-client-device-latest.ipa'\n : 'golden-dev-client-latest.apk';\n const goldenArchiveUrl =\n env.__EAS_GOLDEN_DEV_CLIENT_URL ??\n `https://storage.googleapis.com/turtle-v2/onboarding/${fileName}`;\n const goldenArchivePath = path.join(tmpDir, fileName);\n try {\n const response = await fetch(goldenArchiveUrl, {\n timeout: 1 * 60 * 1000, // 1 minute\n });\n if (!response.ok) {\n throw new Error(`[${response.status}] ${response.statusText}`);\n }\n await pipeline(response.body, fs.createWriteStream(goldenArchivePath));\n } catch (error: any) {\n throw new Error(`Failed to download golden development client archive: ${error.message}`);\n }\n stepsCtx.logger.info(`Downloaded golden development client archive to ${goldenArchivePath}`);\n\n stepsCtx.logger.info('Repacking and resigning the app...');\n const repackedArchivePath = path.join(\n tmpDir,\n stepsCtx.global.staticContext.job.platform === Platform.IOS\n ? stepsCtx.global.staticContext.job.simulator\n ? 'target.zip'\n : 'target.ipa'\n : 'target.apk'\n );\n if (stepsCtx.global.staticContext.job.platform === Platform.IOS) {\n await repackAppIosAsync({\n platform: 'ios',\n projectRoot: stepsCtx.workingDirectory,\n sourceAppPath: goldenArchivePath,\n outputPath: repackedArchivePath,\n workingDirectory: tmpDir,\n iosSigningOptions: stepsCtx.global.staticContext.job.simulator\n ? undefined\n : await resolveIosSigningOptions({\n logger: stepsCtx.logger,\n buildCredentials: stepsCtx.global.staticContext.job.secrets?.buildCredentials,\n }),\n logger: stepsCtx.logger,\n skipWorkingDirCleanup: true,\n verbose: env.__EAS_REPACK_VERBOSE !== undefined,\n });\n } else if (stepsCtx.global.staticContext.job.platform === Platform.ANDROID) {\n let androidCredentials:\n | {\n keyStorePath: string;\n keyStorePassword: string;\n keyAlias: string;\n keyPassword: string | undefined;\n }\n | undefined;\n if (stepsCtx.global.staticContext.job.secrets?.buildCredentials?.keystore.dataBase64) {\n const keyStorePath = path.join(tmpDir, `keystore-${uuidv4()}`);\n await fs.writeFile(\n keyStorePath,\n Buffer.from(\n stepsCtx.global.staticContext.job.secrets.buildCredentials.keystore.dataBase64,\n 'base64'\n )\n );\n androidCredentials = {\n keyStorePath,\n keyStorePassword:\n stepsCtx.global.staticContext.job.secrets.buildCredentials.keystore.keystorePassword,\n keyAlias: stepsCtx.global.staticContext.job.secrets.buildCredentials.keystore.keyAlias,\n keyPassword:\n stepsCtx.global.staticContext.job.secrets.buildCredentials.keystore.keyPassword,\n };\n }\n\n await repackAppAndroidAsync({\n platform: 'android',\n projectRoot: stepsCtx.workingDirectory,\n sourceAppPath: goldenArchivePath,\n outputPath: repackedArchivePath,\n workingDirectory: tmpDir,\n androidSigningOptions: androidCredentials,\n logger: stepsCtx.logger,\n skipWorkingDirCleanup: true,\n verbose: env.__EAS_REPACK_VERBOSE !== undefined,\n });\n } else {\n throw new Error('Unsupported platform');\n }\n\n if (!(await fs.exists(repackedArchivePath))) {\n throw new Error(`Failed to repack the app. ${repackedArchivePath} does not exist`);\n }\n\n stepsCtx.logger.info(`Repacked and resigned the app to ${repackedArchivePath}`);\n outputs.repacked_archive_path.set(repackedArchivePath);\n },\n });\n}\n\nasync function resolveIosSigningOptions({\n buildCredentials,\n logger,\n}: {\n buildCredentials: BuildCredentials | undefined;\n logger: bunyan;\n}): Promise<{\n provisioningProfile: string;\n keychainPath: string;\n signingIdentity: string;\n}> {\n assert(buildCredentials, 'buildCredentials is required for repacking non-simulator iOS apps');\n\n const credentialsManager = new IosCredentialsManager(buildCredentials);\n const credentials = await credentialsManager.prepare(logger);\n\n return {\n provisioningProfile: Object.values(credentials.targetProvisioningProfiles)[0].path,\n keychainPath: credentials.keychainPath,\n signingIdentity: credentials.applicationTargetProvisioningProfile.data.certificateCommonName,\n };\n}\n"]}
|
package/dist/utils/artifacts.js
CHANGED
|
@@ -12,7 +12,11 @@ class FindArtifactsError extends Error {
|
|
|
12
12
|
}
|
|
13
13
|
exports.FindArtifactsError = FindArtifactsError;
|
|
14
14
|
async function findArtifacts({ rootDir, patternOrPath, logger, }) {
|
|
15
|
-
const files =
|
|
15
|
+
const files = path_1.default.isAbsolute(patternOrPath)
|
|
16
|
+
? (await fs_extra_1.default.pathExists(patternOrPath))
|
|
17
|
+
? [patternOrPath]
|
|
18
|
+
: []
|
|
19
|
+
: await (0, fast_glob_1.default)(patternOrPath, { cwd: rootDir, onlyFiles: false });
|
|
16
20
|
if (files.length === 0) {
|
|
17
21
|
if (fast_glob_1.default.isDynamicPattern(patternOrPath)) {
|
|
18
22
|
throw new FindArtifactsError(`There are no files matching pattern "${patternOrPath}"`);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"artifacts.js","sourceRoot":"","sources":["../../src/utils/artifacts.ts"],"names":[],"mappings":";;;;;;AAAA,gDAAwB;AAExB,wDAA0B;AAC1B,0DAA2B;AAE3B,uDAAyE;AAIzE,MAAa,kBAAmB,SAAQ,KAAK;CAAG;AAAhD,gDAAgD;AAEzC,KAAK,UAAU,a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I,EAAE,mCAAmB,CAAC,mBAAmB;YAC7C,KAAK,EAAE,mBAAmB;SAC3B;QACD,MAAM;KACP,CAAC,CAAC;AACL,CAAC;AAtBD,4DAsBC","sourcesContent":["import path from 'path';\n\nimport fs from 'fs-extra';\nimport fg from 'fast-glob';\nimport { bunyan } from '@expo/logger';\nimport { ManagedArtifactType, Job, BuildJob } from '@expo/eas-build-job';\n\nimport { BuildContext } from '../context';\n\nexport class FindArtifactsError extends Error {}\n\nexport async function findArtifacts({\n rootDir,\n patternOrPath,\n logger,\n}: {\n rootDir: string;\n patternOrPath: string;\n /** If provided, will log error suggesting possible files to upload. */\n logger: bunyan | null;\n}): Promise<string[]> {\n const files = path.isAbsolute(patternOrPath)\n ? (await fs.pathExists(patternOrPath))\n ? [patternOrPath]\n : []\n : await fg(patternOrPath, { cwd: rootDir, onlyFiles: false });\n if (files.length === 0) {\n if (fg.isDynamicPattern(patternOrPath)) {\n throw new FindArtifactsError(`There are no files matching pattern \"${patternOrPath}\"`);\n } else {\n if (logger) {\n await logMissingFileError(path.join(rootDir, patternOrPath), logger);\n }\n throw new FindArtifactsError(`No such file or directory ${patternOrPath}`);\n }\n }\n\n return files.map((filePath) => {\n // User may provide an absolute path as input in which case\n // fg will return an absolute path.\n if (path.isAbsolute(filePath)) {\n return filePath;\n }\n\n // User may also provide a relative path in which case\n // fg will return a path relative to rootDir.\n return path.join(rootDir, filePath);\n });\n}\n\nasync function logMissingFileError(artifactPath: string, buildLogger: bunyan): Promise<void> {\n let currentPath = artifactPath;\n while (!(await fs.pathExists(currentPath))) {\n currentPath = path.resolve(currentPath, '..');\n }\n if (currentPath === path.resolve(currentPath, '..')) {\n buildLogger.error(`There is no such file or directory \"${artifactPath}\".`);\n return;\n }\n const dirContent = await fs.readdir(currentPath);\n if (dirContent.length === 0) {\n buildLogger.error(\n `There is no such file or directory \"${artifactPath}\". Directory \"${currentPath}\" is empty.`\n );\n } else {\n buildLogger.error(\n `There is no such file or directory \"${artifactPath}\". Directory \"${currentPath}\" contains [${dirContent.join(\n ', '\n )}].`\n );\n }\n}\n\nexport async function maybeFindAndUploadBuildArtifacts(\n ctx: BuildContext<BuildJob>,\n { logger }: { logger: bunyan }\n): Promise<void> {\n if (!ctx.job.buildArtifactPaths || ctx.job.buildArtifactPaths.length === 0) {\n return;\n }\n try {\n const buildArtifacts = (\n await Promise.all(\n ctx.job.buildArtifactPaths.map((path) =>\n findArtifacts({\n rootDir: ctx.getReactNativeProjectDirectory(),\n patternOrPath: path,\n logger,\n })\n )\n )\n ).flat();\n logger.info(`Build artifacts: ${buildArtifacts.join(', ')}`);\n logger.info('Uploading build artifacts...');\n await ctx.uploadArtifact({\n artifact: {\n type: ManagedArtifactType.BUILD_ARTIFACTS,\n paths: buildArtifacts,\n },\n logger,\n });\n } catch (err: any) {\n logger.error({ err }, 'Failed to upload build artifacts');\n }\n}\n\nexport async function uploadApplicationArchive(\n ctx: BuildContext<Job>,\n {\n logger,\n patternOrPath,\n rootDir,\n }: {\n logger: bunyan;\n patternOrPath: string;\n rootDir: string;\n }\n): Promise<void> {\n const applicationArchives = await findArtifacts({ rootDir, patternOrPath, logger });\n logger.info(`Application archives: ${applicationArchives.join(', ')}`);\n logger.info('Uploading application archive...');\n await ctx.uploadArtifact({\n artifact: {\n type: ManagedArtifactType.APPLICATION_ARCHIVE,\n paths: applicationArchives,\n },\n logger,\n });\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@expo/build-tools",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.111",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"types": "dist/index.d.ts",
|
|
6
6
|
"files": [
|
|
@@ -30,6 +30,7 @@
|
|
|
30
30
|
"@expo/logger": "1.0.57",
|
|
31
31
|
"@expo/package-manager": "1.1.2",
|
|
32
32
|
"@expo/plist": "^0.0.20",
|
|
33
|
+
"@expo/repack-app": "0.0.5",
|
|
33
34
|
"@expo/steps": "1.0.108",
|
|
34
35
|
"@expo/template-file": "1.0.57",
|
|
35
36
|
"@expo/turtle-spawn": "1.0.57",
|
|
@@ -70,5 +71,5 @@
|
|
|
70
71
|
"node": "20.11.0",
|
|
71
72
|
"yarn": "1.22.21"
|
|
72
73
|
},
|
|
73
|
-
"gitHead": "
|
|
74
|
+
"gitHead": "01ec06dd378c8aa73b4353d2ec15421d2e2dfbe4"
|
|
74
75
|
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
build:
|
|
2
|
+
name: Resign development client
|
|
3
|
+
steps:
|
|
4
|
+
- eas/checkout
|
|
5
|
+
- eas/install_node_modules
|
|
6
|
+
- eas/__download_and_repack_golden_development_client_archive:
|
|
7
|
+
id: download_and_repack_golden_development_client_archive
|
|
8
|
+
- eas/upload_artifact:
|
|
9
|
+
name: Upload build artifact
|
|
10
|
+
inputs:
|
|
11
|
+
type: application-archive
|
|
12
|
+
path: ${ steps.download_and_repack_golden_development_client_archive.repacked_archive_path }
|
|
13
|
+
|