eas-cli-local-build-plugin 0.0.103 → 0.0.104
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/android.d.ts +2 -1
- package/dist/android.js +9 -2
- package/dist/android.js.map +1 -1
- package/dist/artifacts.d.ts +2 -0
- package/dist/{buildArtifact.js → artifacts.js} +7 -6
- package/dist/artifacts.js.map +1 -0
- package/dist/build.js +5 -4
- package/dist/build.js.map +1 -1
- package/dist/ios.d.ts +2 -1
- package/dist/ios.js +9 -2
- package/dist/ios.js.map +1 -1
- package/package.json +4 -3
- package/src/android.ts +11 -4
- package/src/{buildArtifact.ts → artifacts.ts} +5 -8
- package/src/build.ts +10 -5
- package/src/ios.ts +11 -4
- package/dist/buildArtifact.d.ts +0 -3
- package/dist/buildArtifact.js.map +0 -1
package/dist/android.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
import { Android } from '@expo/eas-build-job';
|
|
2
|
+
import { Artifacts } from '@expo/build-tools';
|
|
2
3
|
import { BuildParams } from './types';
|
|
3
|
-
export declare function buildAndroidAsync(job: Android.Job, { workingdir, env: baseEnv, metadata }: BuildParams): Promise<
|
|
4
|
+
export declare function buildAndroidAsync(job: Android.Job, { workingdir, env: baseEnv, metadata }: BuildParams): Promise<Artifacts>;
|
package/dist/android.js
CHANGED
|
@@ -31,7 +31,7 @@ const eas_build_job_1 = require("@expo/eas-build-job");
|
|
|
31
31
|
const build_tools_1 = require("@expo/build-tools");
|
|
32
32
|
const omit_1 = __importDefault(require("lodash/omit"));
|
|
33
33
|
const logger_1 = __importStar(require("./logger"));
|
|
34
|
-
const
|
|
34
|
+
const artifacts_1 = require("./artifacts");
|
|
35
35
|
const config_1 = __importDefault(require("./config"));
|
|
36
36
|
const expoCli_1 = require("./expoCli");
|
|
37
37
|
async function buildAndroidAsync(job, { workingdir, env: baseEnv, metadata }) {
|
|
@@ -44,7 +44,14 @@ async function buildAndroidAsync(job, { workingdir, env: baseEnv, metadata }) {
|
|
|
44
44
|
logger: logger_1.default,
|
|
45
45
|
logBuffer: logger_1.logBuffer,
|
|
46
46
|
runGlobalExpoCliCommand: expoCli_1.runGlobalExpoCliCommandAsync,
|
|
47
|
-
|
|
47
|
+
uploadArtifacts: async (type, paths, logger) => {
|
|
48
|
+
if (type !== build_tools_1.ArtifactType.APPLICATION_ARCHIVE) {
|
|
49
|
+
return null;
|
|
50
|
+
}
|
|
51
|
+
else {
|
|
52
|
+
return await (0, artifacts_1.prepareArtifacts)(paths, logger);
|
|
53
|
+
}
|
|
54
|
+
},
|
|
48
55
|
env,
|
|
49
56
|
metadata,
|
|
50
57
|
skipNativeBuild: config_1.default.skipNativeBuild,
|
package/dist/android.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"android.js","sourceRoot":"","sources":["../src/android.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"android.js","sourceRoot":"","sources":["../src/android.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,uDAA+D;AAC/D,mDAAoF;AACpF,uDAA+B;AAE/B,mDAA6C;AAE7C,2CAA+C;AAC/C,sDAA8B;AAC9B,uCAAyD;AAElD,KAAK,UAAU,iBAAiB,CACrC,GAAgB,EAChB,EAAE,UAAU,EAAE,GAAG,EAAE,OAAO,EAAE,QAAQ,EAAe;;IAEnD,MAAM,WAAW,GAAG,MAAA,GAAG,CAAC,OAAO,0CAAE,WAAW,CAAC;IAC7C,MAAM,WAAW,GAAG,MAAA,GAAG,CAAC,OAAO,0CAAE,WAAW,CAAC;IAC7C,MAAM,GAAG,iDACJ,OAAO,GACP,CAAC,WAAW,IAAI,EAAE,8BAA8B,EAAE,WAAW,EAAE,CAAC,GAChE,CAAC,WAAW,IAAI,EAAE,8BAA8B,EAAE,WAAW,EAAE,CAAC,CACpE,CAAC;IACF,MAAM,GAAG,GAAG,IAAI,0BAAY,CAAc,GAAG,EAAE;QAC7C,UAAU;QACV,MAAM,EAAN,gBAAM;QACN,SAAS,EAAT,kBAAS;QACT,uBAAuB,EAAE,sCAA4B;QACrD,eAAe,EAAE,KAAK,EAAE,IAAkB,EAAE,KAAe,EAAE,MAAe,EAAE,EAAE;YAC9E,IAAI,IAAI,KAAK,0BAAY,CAAC,mBAAmB,EAAE;gBAC7C,OAAO,IAAI,CAAC;aACb;iBAAM;gBACL,OAAO,MAAM,IAAA,4BAAgB,EAAC,KAAK,EAAE,MAAM,CAAC,CAAC;aAC9C;QACH,CAAC;QACD,GAAG;QACH,QAAQ;QACR,eAAe,EAAE,gBAAM,CAAC,eAAe;KACxC,CAAC,CAAC;IAEH,MAAM,GAAG,CAAC,aAAa,CAAC,0BAAU,CAAC,WAAW,EAAE,KAAK,IAAI,EAAE;QACzD,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,GAAG,EAAE,IAAA,cAAI,EAAC,GAAG,CAAC,GAAG,EAAE,SAAS,CAAC,EAAE,EAAE,gBAAgB,CAAC,CAAC;IACvE,CAAC,CAAC,CAAC;IAEH,OAAO,MAAM,sBAAQ,CAAC,cAAc,CAAC,GAAG,CAAC,CAAC;AAC5C,CAAC;AAjCD,8CAiCC","sourcesContent":["import { bunyan } from '@expo/logger';\nimport { Android, BuildPhase, Env } from '@expo/eas-build-job';\nimport { Builders, BuildContext, ArtifactType, Artifacts } from '@expo/build-tools';\nimport omit from 'lodash/omit';\n\nimport logger, { logBuffer } from './logger';\nimport { BuildParams } from './types';\nimport { prepareArtifacts } from './artifacts';\nimport config from './config';\nimport { runGlobalExpoCliCommandAsync } from './expoCli';\n\nexport async function buildAndroidAsync(\n job: Android.Job,\n { workingdir, env: baseEnv, metadata }: BuildParams\n): Promise<Artifacts> {\n const versionName = job.version?.versionName;\n const versionCode = job.version?.versionCode;\n const env: Env = {\n ...baseEnv,\n ...(versionCode && { EAS_BUILD_ANDROID_VERSION_CODE: versionCode }),\n ...(versionName && { EAS_BUILD_ANDROID_VERSION_NAME: versionName }),\n };\n const ctx = new BuildContext<Android.Job>(job, {\n workingdir,\n logger,\n logBuffer,\n runGlobalExpoCliCommand: runGlobalExpoCliCommandAsync,\n uploadArtifacts: async (type: ArtifactType, paths: string[], logger?: bunyan) => {\n if (type !== ArtifactType.APPLICATION_ARCHIVE) {\n return null;\n } else {\n return await prepareArtifacts(paths, logger);\n }\n },\n env,\n metadata,\n skipNativeBuild: config.skipNativeBuild,\n });\n\n await ctx.runBuildPhase(BuildPhase.START_BUILD, async () => {\n ctx.logger.info({ job: omit(ctx.job, 'secrets') }, 'Starting build');\n });\n\n return await Builders.androidBuilder(ctx);\n}\n"]}
|
|
@@ -3,14 +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.
|
|
6
|
+
exports.prepareArtifacts = void 0;
|
|
7
7
|
const path_1 = __importDefault(require("path"));
|
|
8
8
|
const fs_extra_1 = __importDefault(require("fs-extra"));
|
|
9
9
|
const tar_1 = __importDefault(require("tar"));
|
|
10
10
|
const config_1 = __importDefault(require("./config"));
|
|
11
|
-
async function
|
|
11
|
+
async function prepareArtifacts(artifactPaths, logger) {
|
|
12
12
|
var _a;
|
|
13
|
-
|
|
13
|
+
const l = logger === null || logger === void 0 ? void 0 : logger.child({ phase: 'PREPARE_ARTIFACTS' });
|
|
14
|
+
l === null || l === void 0 ? void 0 : l.info('Preparing artifacts');
|
|
14
15
|
let suffix;
|
|
15
16
|
let localPath;
|
|
16
17
|
if (artifactPaths.length === 1 && !(await fs_extra_1.default.lstat(artifactPaths[0])).isDirectory()) {
|
|
@@ -32,10 +33,10 @@ async function prepareBuildArtifact(ctx, artifactPaths) {
|
|
|
32
33
|
const artifactName = `build-${Date.now()}${suffix}`;
|
|
33
34
|
const destPath = (_a = config_1.default.artifactPath) !== null && _a !== void 0 ? _a : path_1.default.join(config_1.default.artifactsDir, artifactName);
|
|
34
35
|
await fs_extra_1.default.copy(localPath, destPath);
|
|
35
|
-
|
|
36
|
+
l === null || l === void 0 ? void 0 : l.info({ phase: 'PREPARE_ARTIFACTS' }, `Writing artifacts to ${destPath}`);
|
|
36
37
|
return destPath;
|
|
37
38
|
}
|
|
38
|
-
exports.
|
|
39
|
+
exports.prepareArtifacts = prepareArtifacts;
|
|
39
40
|
function getCommonParentDir(path1, path2) {
|
|
40
41
|
const normalizedPath1 = path_1.default.normalize(path1);
|
|
41
42
|
const normalizedPath2 = path_1.default.normalize(path2);
|
|
@@ -48,4 +49,4 @@ function getCommonParentDir(path1, path2) {
|
|
|
48
49
|
}
|
|
49
50
|
return '/';
|
|
50
51
|
}
|
|
51
|
-
//# sourceMappingURL=
|
|
52
|
+
//# sourceMappingURL=artifacts.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"artifacts.js","sourceRoot":"","sources":["../src/artifacts.ts"],"names":[],"mappings":";;;;;;AAAA,gDAAwB;AAGxB,wDAA0B;AAC1B,8CAAsB;AAEtB,sDAA8B;AAEvB,KAAK,UAAU,gBAAgB,CAAC,aAAuB,EAAE,MAAe;;IAC7E,MAAM,CAAC,GAAG,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,KAAK,CAAC,EAAE,KAAK,EAAE,mBAAmB,EAAE,CAAC,CAAC;IACxD,CAAC,aAAD,CAAC,uBAAD,CAAC,CAAE,IAAI,CAAC,qBAAqB,CAAC,CAAC;IAC/B,IAAI,MAAM,CAAC;IACX,IAAI,SAAS,CAAC;IACd,IAAI,aAAa,CAAC,MAAM,KAAK,CAAC,IAAI,CAAC,CAAC,MAAM,kBAAE,CAAC,KAAK,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,EAAE;QACnF,CAAC,SAAS,CAAC,GAAG,aAAa,CAAC;QAC5B,MAA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,KAAK,CAAC,CAAC;IAC9C,MAAM,eAAe,GAAG,cAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;IAC9C,IAAI,OAAO,GAAG,cAAI,CAAC,OAAO,CAAC,eAAe,CAAC,CAAC;IAC5C,OAAO,OAAO,KAAK,GAAG,EAAE;QACtB,IAAI,eAAe,CAAC,UAAU,CAAC,OAAO,CAAC,EAAE;YACvC,OAAO,OAAO,CAAC;SAChB;QACD,OAAO,GAAG,cAAI,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;KACjC;IACD,OAAO,GAAG,CAAC;AACb,CAAC","sourcesContent":["import path from 'path';\n\nimport { bunyan } from '@expo/logger';\nimport fs from 'fs-extra';\nimport tar from 'tar';\n\nimport config from './config';\n\nexport async function prepareArtifacts(artifactPaths: string[], logger?: bunyan): Promise<string> {\n const l = logger?.child({ phase: 'PREPARE_ARTIFACTS' });\n l?.info('Preparing artifacts');\n let suffix;\n let localPath;\n if (artifactPaths.length === 1 && !(await fs.lstat(artifactPaths[0])).isDirectory()) {\n [localPath] = artifactPaths;\n suffix = path.extname(artifactPaths[0]);\n } else {\n const parentDir = artifactPaths.reduce(\n (acc, item) => getCommonParentDir(acc, item),\n artifactPaths[0]\n );\n const relativePathsToArchive = artifactPaths.map((absolute) =>\n path.relative(parentDir, absolute)\n );\n\n const archivePath = path.join(config.workingdir, 'artifacts.tar.gz');\n await tar.c(\n {\n gzip: true,\n file: archivePath,\n cwd: parentDir,\n },\n relativePathsToArchive\n );\n suffix = '.tar.gz';\n localPath = archivePath;\n }\n const artifactName = `build-${Date.now()}${suffix}`;\n const destPath = config.artifactPath ?? path.join(config.artifactsDir, artifactName);\n await fs.copy(localPath, destPath);\n l?.info({ phase: 'PREPARE_ARTIFACTS' }, `Writing artifacts to ${destPath}`);\n return destPath;\n}\n\nfunction getCommonParentDir(path1: string, path2: string): string {\n const normalizedPath1 = path.normalize(path1);\n const normalizedPath2 = path.normalize(path2);\n let current = path.dirname(normalizedPath1);\n while (current !== '/') {\n if (normalizedPath2.startsWith(current)) {\n return current;\n }\n current = path.dirname(current);\n }\n return '/';\n}\n"]}
|
package/dist/build.js
CHANGED
|
@@ -10,6 +10,7 @@ const pickBy_1 = __importDefault(require("lodash/pickBy"));
|
|
|
10
10
|
const fs_extra_1 = __importDefault(require("fs-extra"));
|
|
11
11
|
const chalk_1 = __importDefault(require("chalk"));
|
|
12
12
|
const build_tools_1 = require("@expo/build-tools");
|
|
13
|
+
const nullthrows_1 = __importDefault(require("nullthrows"));
|
|
13
14
|
const android_1 = require("./android");
|
|
14
15
|
const config_1 = __importDefault(require("./config"));
|
|
15
16
|
const ios_1 = require("./ios");
|
|
@@ -32,21 +33,21 @@ async function buildAsync(job, metadata) {
|
|
|
32
33
|
EAS_BUILD_IOS_APP_VERSION: (_e = job.version) === null || _e === void 0 ? void 0 : _e.appVersion,
|
|
33
34
|
}));
|
|
34
35
|
const env = (0, pickBy_1.default)(unfilteredEnv, (val) => !!val);
|
|
35
|
-
let
|
|
36
|
+
let artifacts;
|
|
36
37
|
switch (job.platform) {
|
|
37
38
|
case eas_build_job_1.Platform.ANDROID: {
|
|
38
|
-
|
|
39
|
+
artifacts = await (0, android_1.buildAndroidAsync)(job, { env, workingdir, metadata });
|
|
39
40
|
break;
|
|
40
41
|
}
|
|
41
42
|
case eas_build_job_1.Platform.IOS: {
|
|
42
|
-
|
|
43
|
+
artifacts = await (0, ios_1.buildIosAsync)(job, { env, workingdir, metadata });
|
|
43
44
|
break;
|
|
44
45
|
}
|
|
45
46
|
}
|
|
46
47
|
if (!config_1.default.skipNativeBuild) {
|
|
47
48
|
console.log();
|
|
48
49
|
console.log(chalk_1.default.green('Build successful'));
|
|
49
|
-
console.log(chalk_1.default.green(`You can find the build artifacts in ${
|
|
50
|
+
console.log(chalk_1.default.green(`You can find the build artifacts in ${(0, nullthrows_1.default)(artifacts.APPLICATION_ARCHIVE)}`));
|
|
50
51
|
}
|
|
51
52
|
}
|
|
52
53
|
catch (e) {
|
package/dist/build.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"build.js","sourceRoot":"","sources":["../src/build.ts"],"names":[],"mappings":";;;;;;AAAA,gDAAwB;AAExB,uDAA2F;AAC3F,2DAAmC;AACnC,wDAA0B;AAC1B,kDAA0B;AAC1B,
|
|
1
|
+
{"version":3,"file":"build.js","sourceRoot":"","sources":["../src/build.ts"],"names":[],"mappings":";;;;;;AAAA,gDAAwB;AAExB,uDAA2F;AAC3F,2DAAmC;AACnC,wDAA0B;AAC1B,kDAA0B;AAC1B,mDAAoE;AACpE,4DAAoC;AAEpC,uCAA8C;AAC9C,sDAA8B;AAC9B,+BAAsC;AACtC,6CAAsD;AAE/C,KAAK,UAAU,UAAU,CAAC,GAAQ,EAAE,QAAkB;;IAC3D,MAAM,UAAU,GAAG,MAAM,IAAA,mCAAsB,GAAE,CAAC;IAElD,IAAI;QACF,IAAI,QAAQ,GAAG,QAAQ,CAAC,QAAQ,CAAC;QACjC,IAAI,CAAC,QAAQ,IAAI,GAAG,CAAC,IAAI,KAAK,wBAAQ,CAAC,OAAO,EAAE;YAC9C,QAAQ,GAAG,GAAG,CAAC,QAAQ,CAAC;SACzB;QAED,oCAAoC;QACpC,6EAA6E;QAC7E,MAAM,aAAa,6EACd,OAAO,CAAC,GAAG,GACX,MAAA,GAAG,CAAC,kBAAkB,0CAAE,GAAG,KAC9B,SAAS,EAAE,GAAG,EACd,gBAAgB,EAAE,oBAAoB,EACtC,kBAAkB,EAAE,GAAG,CAAC,QAAQ,EAChC,oBAAoB,EAAE,cAAI,CAAC,IAAI,CAAC,UAAU,EAAE,OAAO,CAAC,EACpD,iBAAiB,EAAE,QAAQ,CAAC,YAAY,EACxC,yBAAyB,EAAE,QAAQ,CAAC,aAAa,EACjD,kBAAkB,EAAE,QAAQ,KACzB,CAAC,GAAG,CAAC,QAAQ,KAAK,wBAAQ,CAAC,OAAO,IAAI;YACvC,8BAA8B,EAAE,MAAA,GAAG,CAAC,O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AAC,CAAC;YACvB,OAAO;SACR;QACD,OAAO,CAAC,KAAK,EAAE,CAAC;QAChB,OAAO,CAAC,KAAK,CAAC,eAAK,CAAC,GAAG,CAAC,cAAc,CAAC,CAAC,CAAC;QACzC,IAAI,gBAAM,CAAC,MAAM,CAAC,KAAK,KAAK,OAAO,EAAE;YACnC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC;SAC7B;QACD,MAAM,CAAC,CAAC;KACT;YAAS;QACR,IAAI,CAAC,gBAAM,CAAC,WAAW,EAAE;YACvB,MAAM,kBAAE,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC;SAC7B;aAAM;YACL,OAAO,CAAC,KAAK,CAAC,eAAK,CAAC,MAAM,CAAC,qBAAqB,UAAU,oBAAoB,CAAC,CAAC,CAAC;SAClF;QACD,IAAI,GAAG,CAAC,cAAc,CAAC,IAAI,KAAK,iCAAiB,CAAC,IAAI,EAAE;YACtD,MAAM,kBAAE,CAAC,MAAM,CAAC,GAAG,CAAC,cAAc,CAAC,IAAI,CAAC,CAAC;SAC1C;KACF;AACH,CAAC;AAzED,gCAyEC","sourcesContent":["import path from 'path';\n\nimport { Job, Platform, ArchiveSourceType, Metadata, Workflow } from '@expo/eas-build-job';\nimport pickBy from 'lodash/pickBy';\nimport fs from 'fs-extra';\nimport chalk from 'chalk';\nimport { Artifacts, SkipNativeBuildError } from '@expo/build-tools';\nimport nullthrows from 'nullthrows';\n\nimport { buildAndroidAsync } from './android';\nimport config from './config';\nimport { buildIosAsync } from './ios';\nimport { prepareWorkingdirAsync } from './workingdir';\n\nexport async function buildAsync(job: Job, metadata: Metadata): Promise<void> {\n const workingdir = await prepareWorkingdirAsync();\n\n try {\n let username = metadata.username;\n if (!username && job.type === Workflow.MANAGED) {\n username = job.username;\n }\n\n // keep in sync with worker env vars\n // https://github.com/expo/turtle-v2/blob/main/src/services/worker/src/env.ts\n const unfilteredEnv: Record<string, string | undefined> = {\n ...process.env,\n ...job.builderEnvironment?.env,\n EAS_BUILD: '1',\n EAS_BUILD_RUNNER: 'local-build-plugin',\n EAS_BUILD_PLATFORM: job.platform,\n EAS_BUILD_WORKINGDIR: path.join(workingdir, 'build'),\n EAS_BUILD_PROFILE: metadata.buildProfile,\n EAS_BUILD_GIT_COMMIT_HASH: metadata.gitCommitHash,\n EAS_BUILD_USERNAME: username,\n ...(job.platform === Platform.ANDROID && {\n EAS_BUILD_ANDROID_VERSION_CODE: job.version?.versionCode,\n EAS_BUILD_ANDROID_VERSION_NAME: job.version?.versionName,\n }),\n ...(job.platform === Platform.IOS && {\n EAS_BUILD_IOS_BUILD_NUMBER: job.version?.buildNumber,\n EAS_BUILD_IOS_APP_VERSION: job.version?.appVersion,\n }),\n };\n const env = pickBy(unfilteredEnv, (val?: string): val is string => !!val);\n\n let artifacts: Artifacts | undefined;\n switch (job.platform) {\n case Platform.ANDROID: {\n artifacts = await buildAndroidAsync(job, { env, workingdir, metadata });\n break;\n }\n case Platform.IOS: {\n artifacts = await buildIosAsync(job, { env, workingdir, metadata });\n break;\n }\n }\n if (!config.skipNativeBuild) {\n console.log();\n console.log(chalk.green('Build successful'));\n console.log(\n chalk.green(\n `You can find the build artifacts in ${nullthrows(artifacts.APPLICATION_ARCHIVE)}`\n )\n );\n }\n } catch (e: any) {\n if (e instanceof SkipNativeBuildError) {\n console.log(e.message);\n return;\n }\n console.error();\n console.error(chalk.red(`Build failed`));\n if (config.logger.level === 'debug') {\n console.error(e.innerError);\n }\n throw e;\n } finally {\n if (!config.skipCleanup) {\n await fs.remove(workingdir);\n } else {\n console.error(chalk.yellow(`Skipping cleanup, ${workingdir} won't be removed.`));\n }\n if (job.projectArchive.type === ArchiveSourceType.PATH) {\n await fs.remove(job.projectArchive.path);\n }\n }\n}\n"]}
|
package/dist/ios.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
import { Ios } from '@expo/eas-build-job';
|
|
2
|
+
import { Artifacts } from '@expo/build-tools';
|
|
2
3
|
import { BuildParams } from './types';
|
|
3
|
-
export declare function buildIosAsync(job: Ios.Job, { workingdir, env: baseEnv, metadata }: BuildParams): Promise<
|
|
4
|
+
export declare function buildIosAsync(job: Ios.Job, { workingdir, env: baseEnv, metadata }: BuildParams): Promise<Artifacts>;
|
package/dist/ios.js
CHANGED
|
@@ -32,7 +32,7 @@ const build_tools_1 = require("@expo/build-tools");
|
|
|
32
32
|
const omit_1 = __importDefault(require("lodash/omit"));
|
|
33
33
|
const expoCli_1 = require("./expoCli");
|
|
34
34
|
const logger_1 = __importStar(require("./logger"));
|
|
35
|
-
const
|
|
35
|
+
const artifacts_1 = require("./artifacts");
|
|
36
36
|
const config_1 = __importDefault(require("./config"));
|
|
37
37
|
async function buildIosAsync(job, { workingdir, env: baseEnv, metadata }) {
|
|
38
38
|
var _a, _b;
|
|
@@ -44,7 +44,14 @@ async function buildIosAsync(job, { workingdir, env: baseEnv, metadata }) {
|
|
|
44
44
|
logger: logger_1.default,
|
|
45
45
|
logBuffer: logger_1.logBuffer,
|
|
46
46
|
runGlobalExpoCliCommand: expoCli_1.runGlobalExpoCliCommandAsync,
|
|
47
|
-
|
|
47
|
+
uploadArtifacts: async (type, paths, logger) => {
|
|
48
|
+
if (type !== build_tools_1.ArtifactType.APPLICATION_ARCHIVE) {
|
|
49
|
+
return null;
|
|
50
|
+
}
|
|
51
|
+
else {
|
|
52
|
+
return await (0, artifacts_1.prepareArtifacts)(paths, logger);
|
|
53
|
+
}
|
|
54
|
+
},
|
|
48
55
|
env,
|
|
49
56
|
metadata,
|
|
50
57
|
skipNativeBuild: config_1.default.skipNativeBuild,
|
package/dist/ios.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ios.js","sourceRoot":"","sources":["../src/ios.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,uDAA2D;AAC3D,
|
|
1
|
+
{"version":3,"file":"ios.js","sourceRoot":"","sources":["../src/ios.ts"],"names":[],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gBAAgB,CAAC,CAAC;IACvE,CAAC,CAAC,CAAC;IAEH,OAAO,MAAM,sBAAQ,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC;AACxC,CAAC;AAjCD,sCAiCC","sourcesContent":["import { Ios, BuildPhase, Env } from '@expo/eas-build-job';\nimport { Builders, BuildContext, ArtifactType, Artifacts } from '@expo/build-tools';\nimport { bunyan } from '@expo/logger';\nimport omit from 'lodash/omit';\n\nimport { runGlobalExpoCliCommandAsync } from './expoCli';\nimport logger, { logBuffer } from './logger';\nimport { BuildParams } from './types';\nimport { prepareArtifacts } from './artifacts';\nimport config from './config';\n\nexport async function buildIosAsync(\n job: Ios.Job,\n { workingdir, env: baseEnv, metadata }: BuildParams\n): Promise<Artifacts> {\n const buildNumber = job.version?.buildNumber;\n const appVersion = job.version?.appVersion;\n const env: Env = {\n ...baseEnv,\n ...(buildNumber && { EAS_BUILD_IOS_BUILD_NUMBER: buildNumber }),\n ...(appVersion && { EAS_BUILD_IOS_APP_VERSION: appVersion }),\n };\n const ctx = new BuildContext<Ios.Job>(job, {\n workingdir,\n logger,\n logBuffer,\n runGlobalExpoCliCommand: runGlobalExpoCliCommandAsync,\n uploadArtifacts: async (type: ArtifactType, paths: string[], logger?: bunyan) => {\n if (type !== ArtifactType.APPLICATION_ARCHIVE) {\n return null;\n } else {\n return await prepareArtifacts(paths, logger);\n }\n },\n env,\n metadata,\n skipNativeBuild: config.skipNativeBuild,\n });\n\n await ctx.runBuildPhase(BuildPhase.START_BUILD, async () => {\n ctx.logger.info({ job: omit(ctx.job, 'secrets') }, 'Starting build');\n });\n\n return await Builders.iosBuilder(ctx);\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "eas-cli-local-build-plugin",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.104",
|
|
4
4
|
"description": "Tool for running EAS compatible builds on a local machine.",
|
|
5
5
|
"main": "dist/main.js",
|
|
6
6
|
"bin": {
|
|
@@ -19,9 +19,9 @@
|
|
|
19
19
|
"bugs": "https://github.com/expo/eas-build/issues",
|
|
20
20
|
"license": "BUSL-1.1",
|
|
21
21
|
"dependencies": {
|
|
22
|
-
"@expo/build-tools": "0.1.
|
|
22
|
+
"@expo/build-tools": "0.1.147",
|
|
23
23
|
"@expo/bunyan": "^4.0.0",
|
|
24
|
-
"@expo/eas-build-job": "0.2.
|
|
24
|
+
"@expo/eas-build-job": "0.2.89",
|
|
25
25
|
"@expo/spawn-async": "^1.5.0",
|
|
26
26
|
"@expo/turtle-spawn": "0.0.25",
|
|
27
27
|
"chalk": "^4.1.0",
|
|
@@ -30,6 +30,7 @@
|
|
|
30
30
|
"fs-extra": "^10.0.1",
|
|
31
31
|
"joi": "^17.4.2",
|
|
32
32
|
"lodash": "^4.17.21",
|
|
33
|
+
"nullthrows": "^1.1.1",
|
|
33
34
|
"semver": "^7.3.5",
|
|
34
35
|
"tar": "^6.1.0",
|
|
35
36
|
"uuid": "^8.3.2"
|
package/src/android.ts
CHANGED
|
@@ -1,17 +1,18 @@
|
|
|
1
|
+
import { bunyan } from '@expo/logger';
|
|
1
2
|
import { Android, BuildPhase, Env } from '@expo/eas-build-job';
|
|
2
|
-
import { Builders, BuildContext } from '@expo/build-tools';
|
|
3
|
+
import { Builders, BuildContext, ArtifactType, Artifacts } from '@expo/build-tools';
|
|
3
4
|
import omit from 'lodash/omit';
|
|
4
5
|
|
|
5
6
|
import logger, { logBuffer } from './logger';
|
|
6
7
|
import { BuildParams } from './types';
|
|
7
|
-
import {
|
|
8
|
+
import { prepareArtifacts } from './artifacts';
|
|
8
9
|
import config from './config';
|
|
9
10
|
import { runGlobalExpoCliCommandAsync } from './expoCli';
|
|
10
11
|
|
|
11
12
|
export async function buildAndroidAsync(
|
|
12
13
|
job: Android.Job,
|
|
13
14
|
{ workingdir, env: baseEnv, metadata }: BuildParams
|
|
14
|
-
): Promise<
|
|
15
|
+
): Promise<Artifacts> {
|
|
15
16
|
const versionName = job.version?.versionName;
|
|
16
17
|
const versionCode = job.version?.versionCode;
|
|
17
18
|
const env: Env = {
|
|
@@ -24,7 +25,13 @@ export async function buildAndroidAsync(
|
|
|
24
25
|
logger,
|
|
25
26
|
logBuffer,
|
|
26
27
|
runGlobalExpoCliCommand: runGlobalExpoCliCommandAsync,
|
|
27
|
-
|
|
28
|
+
uploadArtifacts: async (type: ArtifactType, paths: string[], logger?: bunyan) => {
|
|
29
|
+
if (type !== ArtifactType.APPLICATION_ARCHIVE) {
|
|
30
|
+
return null;
|
|
31
|
+
} else {
|
|
32
|
+
return await prepareArtifacts(paths, logger);
|
|
33
|
+
}
|
|
34
|
+
},
|
|
28
35
|
env,
|
|
29
36
|
metadata,
|
|
30
37
|
skipNativeBuild: config.skipNativeBuild,
|
|
@@ -1,17 +1,14 @@
|
|
|
1
1
|
import path from 'path';
|
|
2
2
|
|
|
3
|
-
import {
|
|
4
|
-
import { Job } from '@expo/eas-build-job';
|
|
3
|
+
import { bunyan } from '@expo/logger';
|
|
5
4
|
import fs from 'fs-extra';
|
|
6
5
|
import tar from 'tar';
|
|
7
6
|
|
|
8
7
|
import config from './config';
|
|
9
8
|
|
|
10
|
-
export async function
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
): Promise<string> {
|
|
14
|
-
ctx.logger.info({ phase: 'PREPARE_ARTIFACTS' }, 'Archiving artifacts');
|
|
9
|
+
export async function prepareArtifacts(artifactPaths: string[], logger?: bunyan): Promise<string> {
|
|
10
|
+
const l = logger?.child({ phase: 'PREPARE_ARTIFACTS' });
|
|
11
|
+
l?.info('Preparing artifacts');
|
|
15
12
|
let suffix;
|
|
16
13
|
let localPath;
|
|
17
14
|
if (artifactPaths.length === 1 && !(await fs.lstat(artifactPaths[0])).isDirectory()) {
|
|
@@ -41,7 +38,7 @@ export async function prepareBuildArtifact(
|
|
|
41
38
|
const artifactName = `build-${Date.now()}${suffix}`;
|
|
42
39
|
const destPath = config.artifactPath ?? path.join(config.artifactsDir, artifactName);
|
|
43
40
|
await fs.copy(localPath, destPath);
|
|
44
|
-
|
|
41
|
+
l?.info({ phase: 'PREPARE_ARTIFACTS' }, `Writing artifacts to ${destPath}`);
|
|
45
42
|
return destPath;
|
|
46
43
|
}
|
|
47
44
|
|
package/src/build.ts
CHANGED
|
@@ -4,7 +4,8 @@ import { Job, Platform, ArchiveSourceType, Metadata, Workflow } from '@expo/eas-
|
|
|
4
4
|
import pickBy from 'lodash/pickBy';
|
|
5
5
|
import fs from 'fs-extra';
|
|
6
6
|
import chalk from 'chalk';
|
|
7
|
-
import { SkipNativeBuildError } from '@expo/build-tools';
|
|
7
|
+
import { Artifacts, SkipNativeBuildError } from '@expo/build-tools';
|
|
8
|
+
import nullthrows from 'nullthrows';
|
|
8
9
|
|
|
9
10
|
import { buildAndroidAsync } from './android';
|
|
10
11
|
import config from './config';
|
|
@@ -43,21 +44,25 @@ export async function buildAsync(job: Job, metadata: Metadata): Promise<void> {
|
|
|
43
44
|
};
|
|
44
45
|
const env = pickBy(unfilteredEnv, (val?: string): val is string => !!val);
|
|
45
46
|
|
|
46
|
-
let
|
|
47
|
+
let artifacts: Artifacts | undefined;
|
|
47
48
|
switch (job.platform) {
|
|
48
49
|
case Platform.ANDROID: {
|
|
49
|
-
|
|
50
|
+
artifacts = await buildAndroidAsync(job, { env, workingdir, metadata });
|
|
50
51
|
break;
|
|
51
52
|
}
|
|
52
53
|
case Platform.IOS: {
|
|
53
|
-
|
|
54
|
+
artifacts = await buildIosAsync(job, { env, workingdir, metadata });
|
|
54
55
|
break;
|
|
55
56
|
}
|
|
56
57
|
}
|
|
57
58
|
if (!config.skipNativeBuild) {
|
|
58
59
|
console.log();
|
|
59
60
|
console.log(chalk.green('Build successful'));
|
|
60
|
-
console.log(
|
|
61
|
+
console.log(
|
|
62
|
+
chalk.green(
|
|
63
|
+
`You can find the build artifacts in ${nullthrows(artifacts.APPLICATION_ARCHIVE)}`
|
|
64
|
+
)
|
|
65
|
+
);
|
|
61
66
|
}
|
|
62
67
|
} catch (e: any) {
|
|
63
68
|
if (e instanceof SkipNativeBuildError) {
|
package/src/ios.ts
CHANGED
|
@@ -1,17 +1,18 @@
|
|
|
1
1
|
import { Ios, BuildPhase, Env } from '@expo/eas-build-job';
|
|
2
|
-
import { Builders, BuildContext } from '@expo/build-tools';
|
|
2
|
+
import { Builders, BuildContext, ArtifactType, Artifacts } from '@expo/build-tools';
|
|
3
|
+
import { bunyan } from '@expo/logger';
|
|
3
4
|
import omit from 'lodash/omit';
|
|
4
5
|
|
|
5
6
|
import { runGlobalExpoCliCommandAsync } from './expoCli';
|
|
6
7
|
import logger, { logBuffer } from './logger';
|
|
7
8
|
import { BuildParams } from './types';
|
|
8
|
-
import {
|
|
9
|
+
import { prepareArtifacts } from './artifacts';
|
|
9
10
|
import config from './config';
|
|
10
11
|
|
|
11
12
|
export async function buildIosAsync(
|
|
12
13
|
job: Ios.Job,
|
|
13
14
|
{ workingdir, env: baseEnv, metadata }: BuildParams
|
|
14
|
-
): Promise<
|
|
15
|
+
): Promise<Artifacts> {
|
|
15
16
|
const buildNumber = job.version?.buildNumber;
|
|
16
17
|
const appVersion = job.version?.appVersion;
|
|
17
18
|
const env: Env = {
|
|
@@ -24,7 +25,13 @@ export async function buildIosAsync(
|
|
|
24
25
|
logger,
|
|
25
26
|
logBuffer,
|
|
26
27
|
runGlobalExpoCliCommand: runGlobalExpoCliCommandAsync,
|
|
27
|
-
|
|
28
|
+
uploadArtifacts: async (type: ArtifactType, paths: string[], logger?: bunyan) => {
|
|
29
|
+
if (type !== ArtifactType.APPLICATION_ARCHIVE) {
|
|
30
|
+
return null;
|
|
31
|
+
} else {
|
|
32
|
+
return await prepareArtifacts(paths, logger);
|
|
33
|
+
}
|
|
34
|
+
},
|
|
28
35
|
env,
|
|
29
36
|
metadata,
|
|
30
37
|
skipNativeBuild: config.skipNativeBuild,
|
package/dist/buildArtifact.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,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AAM,YAAY,GAAG,SAAS,IAAI,CAAC,GAAG,EAAE,GAAG,MAAM,EAAE,CAAC;IACpD,MAAM,QAAQ,GAAG,MAAA,gBAAM,CAAC,YAAY,mCAAI,cAAI,CAAC,IAAI,CAAC,gBAAM,CAAC,YAAY,EAAE,YAAY,CAAC,CAAC;IACrF,MAAM,kBAAE,CAAC,IAAI,CAAC,SAAS,EAAE,QAAQ,CAAC,CAAC;IACnC,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,mBAAmB,EAAE,EAAE,wBAAwB,QAAQ,EAAE,CAAC,CAAC;IACpF,OAAO,QAAQ,CAAC;AAClB,CAAC;AApCD,oDAoCC;AAED,SAAS,kBAAkB,CAAC,KAAa,EAAE,KAAa;IACtD,MAAM,eAAe,GAAG,cAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;IAC9C,MAAM,eAAe,GAAG,cAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;IAC9C,IAAI,OAAO,GAAG,cAAI,CAAC,OAAO,CAAC,eAAe,CAAC,CAAC;IAC5C,OAAO,OAAO,KAAK,GAAG,EAAE;QACtB,IAAI,eAAe,CAAC,UAAU,CAAC,OAAO,CAAC,EAAE;YACvC,OAAO,OAAO,CAAC;SAChB;QACD,OAAO,GAAG,cAAI,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;KACjC;IACD,OAAO,GAAG,CAAC;AACb,CAAC","sourcesContent":["import path from 'path';\n\nimport { BuildContext } from '@expo/build-tools';\nimport { Job } from '@expo/eas-build-job';\nimport fs from 'fs-extra';\nimport tar from 'tar';\n\nimport config from './config';\n\nexport async function prepareBuildArtifact(\n ctx: BuildContext<Job>,\n artifactPaths: string[]\n): Promise<string> {\n ctx.logger.info({ phase: 'PREPARE_ARTIFACTS' }, 'Archiving artifacts');\n let suffix;\n let localPath;\n if (artifactPaths.length === 1 && !(await fs.lstat(artifactPaths[0])).isDirectory()) {\n [localPath] = artifactPaths;\n suffix = path.extname(artifactPaths[0]);\n } else {\n const parentDir = artifactPaths.reduce(\n (acc, item) => getCommonParentDir(acc, item),\n artifactPaths[0]\n );\n const relativePathsToArchive = artifactPaths.map((absolute) =>\n path.relative(parentDir, absolute)\n );\n\n const archivePath = path.join(config.workingdir, 'artifacts.tar.gz');\n await tar.c(\n {\n gzip: true,\n file: archivePath,\n cwd: parentDir,\n },\n relativePathsToArchive\n );\n suffix = '.tar.gz';\n localPath = archivePath;\n }\n const artifactName = `build-${Date.now()}${suffix}`;\n const destPath = config.artifactPath ?? path.join(config.artifactsDir, artifactName);\n await fs.copy(localPath, destPath);\n ctx.logger.info({ phase: 'PREPARE_ARTIFACTS' }, `Writing artifacts to ${destPath}`);\n return destPath;\n}\n\nfunction getCommonParentDir(path1: string, path2: string): string {\n const normalizedPath1 = path.normalize(path1);\n const normalizedPath2 = path.normalize(path2);\n let current = path.dirname(normalizedPath1);\n while (current !== '/') {\n if (normalizedPath2.startsWith(current)) {\n return current;\n }\n current = path.dirname(current);\n }\n return '/';\n}\n"]}
|