@expo/build-tools 0.1.146 → 0.1.147
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/android.d.ts +2 -2
- package/dist/builders/android.js +7 -29
- package/dist/builders/android.js.map +1 -1
- package/dist/builders/common.d.ts +3 -0
- package/dist/builders/common.js +61 -0
- package/dist/builders/common.js.map +1 -0
- package/dist/builders/ios.d.ts +2 -2
- package/dist/builders/ios.js +8 -29
- package/dist/builders/ios.js.map +1 -1
- package/dist/context.d.ts +14 -2
- package/dist/context.js +21 -2
- package/dist/context.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +2 -1
- package/dist/index.js.map +1 -1
- package/dist/ios/fastlane.js +2 -3
- package/dist/ios/fastlane.js.map +1 -1
- package/dist/ios/resolve.js +2 -2
- package/dist/ios/resolve.js.map +1 -1
- package/dist/ios/xcodeBuildLogs.d.ts +3 -0
- package/dist/ios/xcodeBuildLogs.js +32 -0
- package/dist/ios/xcodeBuildLogs.js.map +1 -0
- package/dist/utils/artifacts.d.ts +2 -0
- package/dist/utils/{buildArtifacts.js → artifacts.js} +5 -5
- package/dist/utils/artifacts.js.map +1 -0
- package/package.json +2 -2
- package/dist/utils/buildArtifacts.d.ts +0 -2
- package/dist/utils/buildArtifacts.js.map +0 -1
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { Android } from '@expo/eas-build-job';
|
|
2
|
-
import { BuildContext } from '../context';
|
|
3
|
-
export default function androidBuilder(ctx: BuildContext<Android.Job>): Promise<
|
|
2
|
+
import { Artifacts, BuildContext } from '../context';
|
|
3
|
+
export default function androidBuilder(ctx: BuildContext<Android.Job>): Promise<Artifacts>;
|
package/dist/builders/android.js
CHANGED
|
@@ -6,36 +6,14 @@ const handleNpmError_1 = require("../utils/handleNpmError");
|
|
|
6
6
|
const expoUpdates_1 = require("../utils/expoUpdates");
|
|
7
7
|
const gradle_1 = require("../android/gradle");
|
|
8
8
|
const project_1 = require("../utils/project");
|
|
9
|
-
const
|
|
9
|
+
const artifacts_1 = require("../utils/artifacts");
|
|
10
10
|
const hooks_1 = require("../utils/hooks");
|
|
11
11
|
const credentials_1 = require("../android/credentials");
|
|
12
12
|
const gradleConfig_1 = require("../android/gradleConfig");
|
|
13
13
|
const prebuild_1 = require("../utils/prebuild");
|
|
14
|
+
const common_1 = require("./common");
|
|
14
15
|
async function androidBuilder(ctx) {
|
|
15
|
-
|
|
16
|
-
try {
|
|
17
|
-
const archiveLocation = await buildAsync(ctx);
|
|
18
|
-
await ctx.runBuildPhase(eas_build_job_1.BuildPhase.ON_BUILD_SUCCESS_HOOK, async () => {
|
|
19
|
-
await (0, hooks_1.runHookIfPresent)(ctx, hooks_1.Hook.ON_BUILD_SUCCESS);
|
|
20
|
-
});
|
|
21
|
-
return archiveLocation;
|
|
22
|
-
}
|
|
23
|
-
catch (err) {
|
|
24
|
-
buildSuccess = false;
|
|
25
|
-
await ctx.runBuildPhase(eas_build_job_1.BuildPhase.ON_BUILD_ERROR_HOOK, async () => {
|
|
26
|
-
await (0, hooks_1.runHookIfPresent)(ctx, hooks_1.Hook.ON_BUILD_ERROR);
|
|
27
|
-
});
|
|
28
|
-
throw err;
|
|
29
|
-
}
|
|
30
|
-
finally {
|
|
31
|
-
await ctx.runBuildPhase(eas_build_job_1.BuildPhase.ON_BUILD_COMPLETE_HOOK, async () => {
|
|
32
|
-
await (0, hooks_1.runHookIfPresent)(ctx, hooks_1.Hook.ON_BUILD_COMPLETE, {
|
|
33
|
-
extraEnvs: {
|
|
34
|
-
EAS_BUILD_STATUS: buildSuccess ? 'finished' : 'errored',
|
|
35
|
-
},
|
|
36
|
-
});
|
|
37
|
-
});
|
|
38
|
-
}
|
|
16
|
+
return await (0, common_1.runBuilderWithHooksAsync)(ctx, buildAsync);
|
|
39
17
|
}
|
|
40
18
|
exports.default = androidBuilder;
|
|
41
19
|
async function buildAsync(ctx) {
|
|
@@ -94,11 +72,11 @@ async function buildAsync(ctx) {
|
|
|
94
72
|
var _a;
|
|
95
73
|
await ((_a = ctx.cacheManager) === null || _a === void 0 ? void 0 : _a.saveCache(ctx));
|
|
96
74
|
});
|
|
97
|
-
|
|
75
|
+
await ctx.runBuildPhase(eas_build_job_1.BuildPhase.UPLOAD_APPLICATION_ARCHIVE, async () => {
|
|
98
76
|
var _a;
|
|
99
|
-
const
|
|
100
|
-
ctx.logger.info(`
|
|
101
|
-
|
|
77
|
+
const applicationArchives = await (0, artifacts_1.findArtifacts)(ctx.reactNativeProjectDirectory, (_a = ctx.job.applicationArchivePath) !== null && _a !== void 0 ? _a : 'android/app/build/outputs/**/*.{apk,aab}', ctx.logger);
|
|
78
|
+
ctx.logger.info(`Application archives: ${applicationArchives.join(', ')}`);
|
|
79
|
+
await ctx.uploadArtifacts(context_1.ArtifactType.APPLICATION_ARCHIVE, applicationArchives, ctx.logger);
|
|
102
80
|
});
|
|
103
81
|
}
|
|
104
82
|
function resolveGradleCommand(job) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"android.js","sourceRoot":"","sources":["../../src/builders/android.ts"],"names":[],"mappings":";;AAAA,uDAAoE;AAEpE,
|
|
1
|
+
{"version":3,"file":"android.js","sourceRoot":"","sources":["../../src/builders/android.ts"],"names":[],"mappings":";;AAAA,uDAAoE;AAEpE,wCAAyF;AACzF,4DAAgE;AAChE,sDAA4E;AAC5E,8CAAyF;AACzF,8CAAyC;AACzC,kDAAmD;AACnD,0CAAwD;AACxD,wDAA4D;AAC5D,0DAA+D;AAC/D,gDAAkD;AAElD,qCAAoD;AAErC,KAAK,UAAU,cAAc,CAAC,GAA8B;IACzE,OAAO,MAAM,IAAA,iCAAwB,EAAC,GAAG,EAAE,UAAU,CAAC,CAAC;AACzD,CAAC;AAFD,iCAEC;AAED,KAAK,UAAU,UAAU,CAAC,GAA8B;IACtD,MAAM,IAAA,eAAK,EAAC,GAAG,CAAC,CAAC;IACjB,MAAM,aAAa,GAAG,GAAG,CAAC,GAAG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MAAM,CAAA,MAAA,GAAG,CAAC,YAAY,0CAAE,SAAS,CAAC,GAAG,CAAC,CAAA,CAAC;IACzC,CAAC,CAAC,CAAC;IAEH,MAAM,GAAG,CAAC,aAAa,CAAC,0BAAU,CAAC,0BAA0B,EAAE,KAAK,IAAI,EAAE;;QACxE,MAAM,mBAAmB,GAAG,MAAM,IAAA,yBAAa,EAC7C,GAAG,CAAC,2BAA2B,EAC/B,MAAA,GAAG,CAAC,GAAG,CAAC,sBAAsB,mCAAI,0CAA0C,EAC5E,GAAG,CAAC,MAAM,CACX,CAAC;QACF,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,yBAAyB,mBAAmB,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;QAC3E,MAAM,GAAG,CAAC,eAAe,CAAC,sBAAY,CAAC,mBAAmB,EAAE,mBAAmB,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;IAC/F,CAAC,CAAC,CAAC;AACL,CAAC;AAED,SAAS,oBAAoB,CAAC,GAAgB;IAC5C,IAAI,GAAG,CAAC,aAAa,EAAE;QACrB,OAAO,GAAG,CAAC,aAAa,CAAC;KAC1B;SAAM,IAAI,GAAG,CAAC,iBAAiB,EAAE;QAChC,OAAO,oBAAoB,CAAC;KAC7B;SAAM,IAAI,CAAC,GAAG,CAAC,SAAS,EAAE;QACzB,OAAO,oBAAoB,CAAC;KAC7B;SAAM,IAAI,GAAG,CAAC,SAAS,KAAK,uBAAO,CAAC,SAAS,CAAC,GAAG,EAAE;QAClD,OAAO,sBAAsB,CAAC;KAC/B;SAAM;QACL,OAAO,oBAAoB,CAAC;KAC7B;AACH,CAAC","sourcesContent":["import { Android, BuildPhase, Workflow } from '@expo/eas-build-job';\n\nimport { Artifacts, ArtifactType, BuildContext, SkipNativeBuildError } from '../context';\nimport { createNpmErrorHandler } from '../utils/handleNpmError';\nimport { configureExpoUpdatesIfInstalledAsync } from '../utils/expoUpdates';\nimport { runGradleCommand, ensureLFLineEndingsInGradlewScript } from '../android/gradle';\nimport { setup } from '../utils/project';\nimport { findArtifacts } from '../utils/artifacts';\nimport { Hook, runHookIfPresent } from '../utils/hooks';\nimport { restoreCredentials } from '../android/credentials';\nimport { configureBuildGradle } from '../android/gradleConfig';\nimport { prebuildAsync } from '../utils/prebuild';\n\nimport { runBuilderWithHooksAsync } from './common';\n\nexport default async function androidBuilder(ctx: BuildContext<Android.Job>): Promise<Artifacts> {\n return await runBuilderWithHooksAsync(ctx, buildAsync);\n}\n\nasync function buildAsync(ctx: BuildContext<Android.Job>): Promise<void> {\n await setup(ctx);\n const hasNativeCode = ctx.job.type === Workflow.GENERIC;\n\n if (hasNativeCode) {\n await ctx.runBuildPhase(BuildPhase.FIX_GRADLEW, async () => {\n await ensureLFLineEndingsInGradlewScript(ctx);\n });\n }\n\n await ctx.runBuildPhase(\n BuildPhase.PREBUILD,\n async () => {\n if (hasNativeCode) {\n ctx.markBuildPhaseSkipped();\n ctx.logger.info(\n 'Skipped running \"expo prebuild\" because the \"android\" directory already exists. Learn more about the build process: https://docs.expo.dev/build-reference/android-builds/'\n );\n return;\n }\n await prebuildAsync(ctx);\n },\n { onError: createNpmErrorHandler(ctx) }\n );\n\n await ctx.runBuildPhase(BuildPhase.RESTORE_CACHE, async () => {\n await ctx.cacheManager?.restoreCache(ctx);\n });\n\n await ctx.runBuildPhase(BuildPhase.POST_INSTALL_HOOK, async () => {\n await runHookIfPresent(ctx, Hook.POST_INSTALL);\n });\n\n if (ctx.job.secrets.buildCredentials) {\n await ctx.runBuildPhase(BuildPhase.PREPARE_CREDENTIALS, async () => {\n await restoreCredentials(ctx);\n await configureBuildGradle(ctx);\n });\n }\n await ctx.runBuildPhase(BuildPhase.CONFIGURE_EXPO_UPDATES, async () => {\n await configureExpoUpdatesIfInstalledAsync(ctx);\n });\n\n if (ctx.skipNativeBuild) {\n throw new SkipNativeBuildError('Skipping Gradle build');\n }\n await ctx.runBuildPhase(\n BuildPhase.RUN_GRADLEW,\n async () => {\n const gradleCommand = resolveGradleCommand(ctx.job);\n await runGradleCommand(ctx, gradleCommand);\n },\n {\n onError: (err, logLines) => {\n if (\n ctx.env.EAS_BUILD_MAVEN_CACHE_URL &&\n logLines.some((line) => line.includes(ctx.env.EAS_BUILD_MAVEN_CACHE_URL))\n ) {\n ctx.reportError?.('Maven cache error', err, {\n extras: { buildId: ctx.env.EAS_BUILD_ID, logs: logLines.join('\\n') },\n });\n }\n },\n }\n );\n\n await ctx.runBuildPhase(BuildPhase.PRE_UPLOAD_ARTIFACTS_HOOK, async () => {\n await runHookIfPresent(ctx, Hook.PRE_UPLOAD_ARTIFACTS);\n });\n\n await ctx.runBuildPhase(BuildPhase.SAVE_CACHE, async () => {\n await ctx.cacheManager?.saveCache(ctx);\n });\n\n await ctx.runBuildPhase(BuildPhase.UPLOAD_APPLICATION_ARCHIVE, async () => {\n const applicationArchives = await findArtifacts(\n ctx.reactNativeProjectDirectory,\n ctx.job.applicationArchivePath ?? 'android/app/build/outputs/**/*.{apk,aab}',\n ctx.logger\n );\n ctx.logger.info(`Application archives: ${applicationArchives.join(', ')}`);\n await ctx.uploadArtifacts(ArtifactType.APPLICATION_ARCHIVE, applicationArchives, ctx.logger);\n });\n}\n\nfunction resolveGradleCommand(job: Android.Job): string {\n if (job.gradleCommand) {\n return job.gradleCommand;\n } else if (job.developmentClient) {\n return ':app:assembleDebug';\n } else if (!job.buildType) {\n return ':app:bundleRelease';\n } else if (job.buildType === Android.BuildType.APK) {\n return ':app:assembleRelease';\n } else {\n return ':app:bundleRelease';\n }\n}\n"]}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.runBuilderWithHooksAsync = void 0;
|
|
4
|
+
const eas_build_job_1 = require("@expo/eas-build-job");
|
|
5
|
+
const context_1 = require("../context");
|
|
6
|
+
const xcodeBuildLogs_1 = require("../ios/xcodeBuildLogs");
|
|
7
|
+
const artifacts_1 = require("../utils/artifacts");
|
|
8
|
+
const hooks_1 = require("../utils/hooks");
|
|
9
|
+
async function runBuilderWithHooksAsync(ctx, builderAsync) {
|
|
10
|
+
try {
|
|
11
|
+
let buildSuccess = true;
|
|
12
|
+
try {
|
|
13
|
+
await builderAsync(ctx);
|
|
14
|
+
await ctx.runBuildPhase(eas_build_job_1.BuildPhase.ON_BUILD_SUCCESS_HOOK, async () => {
|
|
15
|
+
await (0, hooks_1.runHookIfPresent)(ctx, hooks_1.Hook.ON_BUILD_SUCCESS);
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
catch (err) {
|
|
19
|
+
buildSuccess = false;
|
|
20
|
+
await ctx.runBuildPhase(eas_build_job_1.BuildPhase.ON_BUILD_ERROR_HOOK, async () => {
|
|
21
|
+
await (0, hooks_1.runHookIfPresent)(ctx, hooks_1.Hook.ON_BUILD_ERROR);
|
|
22
|
+
});
|
|
23
|
+
throw err;
|
|
24
|
+
}
|
|
25
|
+
finally {
|
|
26
|
+
await ctx.runBuildPhase(eas_build_job_1.BuildPhase.ON_BUILD_COMPLETE_HOOK, async () => {
|
|
27
|
+
await (0, hooks_1.runHookIfPresent)(ctx, hooks_1.Hook.ON_BUILD_COMPLETE, {
|
|
28
|
+
extraEnvs: {
|
|
29
|
+
EAS_BUILD_STATUS: buildSuccess ? 'finished' : 'errored',
|
|
30
|
+
},
|
|
31
|
+
});
|
|
32
|
+
});
|
|
33
|
+
if (ctx.job.platform === eas_build_job_1.Platform.IOS) {
|
|
34
|
+
await (0, xcodeBuildLogs_1.findAndUploadXcodeBuildLogsAsync)(ctx);
|
|
35
|
+
}
|
|
36
|
+
await ctx.runBuildPhase(eas_build_job_1.BuildPhase.UPLOAD_BUILD_ARTIFACTS, async () => {
|
|
37
|
+
if (!ctx.job.buildArtifactsPaths || ctx.job.buildArtifactsPaths.length === 0) {
|
|
38
|
+
return;
|
|
39
|
+
}
|
|
40
|
+
try {
|
|
41
|
+
const buildArtifacts = (await Promise.all(ctx.job.buildArtifactsPaths.map((path) => (0, artifacts_1.findArtifacts)(ctx.reactNativeProjectDirectory, path, ctx.logger)))).flat();
|
|
42
|
+
ctx.logger.info(`Uploading build artifacts: ${buildArtifacts.join(', ')}`);
|
|
43
|
+
await ctx.uploadArtifacts(context_1.ArtifactType.BUILD_ARTIFACTS, buildArtifacts, ctx.logger);
|
|
44
|
+
}
|
|
45
|
+
catch (err) {
|
|
46
|
+
ctx.logger.error({ err }, 'Failed to upload build artifacts');
|
|
47
|
+
}
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
catch (err) {
|
|
52
|
+
err.artifacts = ctx.artifacts;
|
|
53
|
+
throw err;
|
|
54
|
+
}
|
|
55
|
+
if (!ctx.artifacts.APPLICATION_ARCHIVE) {
|
|
56
|
+
throw new Error('Builder must upload application archive');
|
|
57
|
+
}
|
|
58
|
+
return ctx.artifacts;
|
|
59
|
+
}
|
|
60
|
+
exports.runBuilderWithHooksAsync = runBuilderWithHooksAsync;
|
|
61
|
+
//# sourceMappingURL=common.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"common.js","sourceRoot":"","sources":["../../src/builders/common.ts"],"names":[],"mappings":";;;AAAA,uDAAqE;AAErE,wCAAmE;AACnE,0DAAyE;AACzE,kDAAmD;AACnD,0CAAwD;AAEjD,KAAK,UAAU,wBAAwB,CAC5C,GAAoB,EACpB,YAAqD;IAErD,IAAI;QACF,IAAI,YAAY,GAAG,IAAI,CAAC;QACxB,IAAI;YACF,MAAM,YAAY,CAAC,GAAG,CAAC,CAAC;YACxB,MAAM,GAAG,CAAC,aAAa,CAAC,0BAAU,CAAC,qBAAqB,EAAE,KAAK,IAAI,EAAE;gBACnE,MAAM,IAAA,wBAAgB,EAAC,GAAG,EAAE,YAAI,CAAC,gBAAgB,CAAC,CAAC;YACrD,CAAC,CAAC,CAAC;SACJ;QAAC,OAAO,GAAQ,EAAE;YACjB,YAAY,GAAG,KAAK,CAAC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E,CAAC,CAAC;oBAC3E,MAAM,GAAG,CAAC,eAAe,CAAC,sBAAY,CAAC,eAAe,EAAE,cAAc,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;iBACrF;gBAAC,OAAO,GAAQ,EAAE;oBACjB,GAAG,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,GAAG,EAAE,EAAE,kCAAkC,CAAC,CAAC;iBAC/D;YACH,CAAC,CAAC,CAAC;SACJ;KACF;IAAC,OAAO,GAAQ,EAAE;QACjB,GAAG,CAAC,SAAS,GAAG,GAAG,CAAC,SAAS,CAAC;QAC9B,MAAM,GAAG,CAAC;KACX;IAED,IAAI,CAAC,GAAG,CAAC,SAAS,CAAC,mBAAmB,EAAE;QACtC,MAAM,IAAI,KAAK,CAAC,yCAAyC,CAAC,CAAC;KAC5D;IAED,OAAO,GAAG,CAAC,SAAS,CAAC;AACvB,CAAC;AA3DD,4DA2DC","sourcesContent":["import { BuildPhase, Ios, Job, Platform } from '@expo/eas-build-job';\n\nimport { Artifacts, ArtifactType, BuildContext } from '../context';\nimport { findAndUploadXcodeBuildLogsAsync } from '../ios/xcodeBuildLogs';\nimport { findArtifacts } from '../utils/artifacts';\nimport { Hook, runHookIfPresent } from '../utils/hooks';\n\nexport async function runBuilderWithHooksAsync<T extends Job>(\n ctx: BuildContext<T>,\n builderAsync: (ctx: BuildContext<T>) => Promise<void>\n): Promise<Artifacts> {\n try {\n let buildSuccess = true;\n try {\n await builderAsync(ctx);\n await ctx.runBuildPhase(BuildPhase.ON_BUILD_SUCCESS_HOOK, async () => {\n await runHookIfPresent(ctx, Hook.ON_BUILD_SUCCESS);\n });\n } catch (err: any) {\n buildSuccess = false;\n await ctx.runBuildPhase(BuildPhase.ON_BUILD_ERROR_HOOK, async () => {\n await runHookIfPresent(ctx, Hook.ON_BUILD_ERROR);\n });\n throw err;\n } finally {\n await ctx.runBuildPhase(BuildPhase.ON_BUILD_COMPLETE_HOOK, async () => {\n await runHookIfPresent(ctx, Hook.ON_BUILD_COMPLETE, {\n extraEnvs: {\n EAS_BUILD_STATUS: buildSuccess ? 'finished' : 'errored',\n },\n });\n });\n\n if (ctx.job.platform === Platform.IOS) {\n await findAndUploadXcodeBuildLogsAsync(ctx as BuildContext<Ios.Job>);\n }\n\n await ctx.runBuildPhase(BuildPhase.UPLOAD_BUILD_ARTIFACTS, async () => {\n if (!ctx.job.buildArtifactsPaths || ctx.job.buildArtifactsPaths.length === 0) {\n return;\n }\n try {\n const buildArtifacts = (\n await Promise.all(\n ctx.job.buildArtifactsPaths.map((path) =>\n findArtifacts(ctx.reactNativeProjectDirectory, path, ctx.logger)\n )\n )\n ).flat();\n ctx.logger.info(`Uploading build artifacts: ${buildArtifacts.join(', ')}`);\n await ctx.uploadArtifacts(ArtifactType.BUILD_ARTIFACTS, buildArtifacts, ctx.logger);\n } catch (err: any) {\n ctx.logger.error({ err }, 'Failed to upload build artifacts');\n }\n });\n }\n } catch (err: any) {\n err.artifacts = ctx.artifacts;\n throw err;\n }\n\n if (!ctx.artifacts.APPLICATION_ARCHIVE) {\n throw new Error('Builder must upload application archive');\n }\n\n return ctx.artifacts;\n}\n"]}
|
package/dist/builders/ios.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { Ios } from '@expo/eas-build-job';
|
|
2
|
-
import { BuildContext } from '../context';
|
|
3
|
-
export default function iosBuilder(ctx: BuildContext<Ios.Job>): Promise<
|
|
2
|
+
import { Artifacts, BuildContext } from '../context';
|
|
3
|
+
export default function iosBuilder(ctx: BuildContext<Ios.Job>): Promise<Artifacts>;
|
package/dist/builders/ios.js
CHANGED
|
@@ -7,10 +7,11 @@ const plist_1 = __importDefault(require("@expo/plist"));
|
|
|
7
7
|
const config_plugins_1 = require("@expo/config-plugins");
|
|
8
8
|
const eas_build_job_1 = require("@expo/eas-build-job");
|
|
9
9
|
const fs_extra_1 = __importDefault(require("fs-extra"));
|
|
10
|
+
const context_1 = require("../context");
|
|
10
11
|
const handleNpmError_1 = require("../utils/handleNpmError");
|
|
11
12
|
const expoUpdates_1 = require("../utils/expoUpdates");
|
|
12
13
|
const project_1 = require("../utils/project");
|
|
13
|
-
const
|
|
14
|
+
const artifacts_1 = require("../utils/artifacts");
|
|
14
15
|
const hooks_1 = require("../utils/hooks");
|
|
15
16
|
const configure_1 = require("../ios/configure");
|
|
16
17
|
const manager_1 = __importDefault(require("../ios/credentials/manager"));
|
|
@@ -18,31 +19,9 @@ const fastlane_1 = require("../ios/fastlane");
|
|
|
18
19
|
const pod_1 = require("../ios/pod");
|
|
19
20
|
const prebuild_1 = require("../utils/prebuild");
|
|
20
21
|
const resolve_1 = require("../ios/resolve");
|
|
22
|
+
const common_1 = require("./common");
|
|
21
23
|
async function iosBuilder(ctx) {
|
|
22
|
-
|
|
23
|
-
try {
|
|
24
|
-
const archiveLocation = await buildAsync(ctx);
|
|
25
|
-
await ctx.runBuildPhase(eas_build_job_1.BuildPhase.ON_BUILD_SUCCESS_HOOK, async () => {
|
|
26
|
-
await (0, hooks_1.runHookIfPresent)(ctx, hooks_1.Hook.ON_BUILD_SUCCESS);
|
|
27
|
-
});
|
|
28
|
-
return archiveLocation;
|
|
29
|
-
}
|
|
30
|
-
catch (err) {
|
|
31
|
-
buildSuccess = false;
|
|
32
|
-
await ctx.runBuildPhase(eas_build_job_1.BuildPhase.ON_BUILD_ERROR_HOOK, async () => {
|
|
33
|
-
await (0, hooks_1.runHookIfPresent)(ctx, hooks_1.Hook.ON_BUILD_ERROR);
|
|
34
|
-
});
|
|
35
|
-
throw err;
|
|
36
|
-
}
|
|
37
|
-
finally {
|
|
38
|
-
await ctx.runBuildPhase(eas_build_job_1.BuildPhase.ON_BUILD_COMPLETE_HOOK, async () => {
|
|
39
|
-
await (0, hooks_1.runHookIfPresent)(ctx, hooks_1.Hook.ON_BUILD_COMPLETE, {
|
|
40
|
-
extraEnvs: {
|
|
41
|
-
EAS_BUILD_STATUS: buildSuccess ? 'finished' : 'errored',
|
|
42
|
-
},
|
|
43
|
-
});
|
|
44
|
-
});
|
|
45
|
-
}
|
|
24
|
+
return await (0, common_1.runBuilderWithHooksAsync)(ctx, buildAsync);
|
|
46
25
|
}
|
|
47
26
|
exports.default = iosBuilder;
|
|
48
27
|
async function buildAsync(ctx) {
|
|
@@ -106,10 +85,10 @@ async function buildAsync(ctx) {
|
|
|
106
85
|
var _a;
|
|
107
86
|
await ((_a = ctx.cacheManager) === null || _a === void 0 ? void 0 : _a.saveCache(ctx));
|
|
108
87
|
});
|
|
109
|
-
|
|
110
|
-
const
|
|
111
|
-
ctx.logger.info(`
|
|
112
|
-
|
|
88
|
+
await ctx.runBuildPhase(eas_build_job_1.BuildPhase.UPLOAD_APPLICATION_ARCHIVE, async () => {
|
|
89
|
+
const applicationArchives = await (0, artifacts_1.findArtifacts)(ctx.reactNativeProjectDirectory, (0, resolve_1.resolveArtifactPath)(ctx), ctx.logger);
|
|
90
|
+
ctx.logger.info(`Application archives: ${applicationArchives.join(', ')}`);
|
|
91
|
+
await ctx.uploadArtifacts(context_1.ArtifactType.APPLICATION_ARCHIVE, applicationArchives, ctx.logger);
|
|
113
92
|
});
|
|
114
93
|
}
|
|
115
94
|
async function readEntitlementsAsync(ctx, { scheme, buildConfiguration }) {
|
package/dist/builders/ios.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ios.js","sourceRoot":"","sources":["../../src/builders/ios.ts"],"names":[],"mappings":";;;;;AAAA,wDAAgC;AAChC,yDAAiD;AACjD,uDAAgE;AAChE,wDAA0B;AAG1B,4DAAgE;AAChE,sDAA4E;AAC5E,8CAAyC;AACzC,4DAA6D;AAC7D,0CAAwD;AACxD,gDAAyD;AACzD,yEAA4D;AAC5D,8CAAiD;AACjD,oCAAyC;AACzC,gDAAkD;AAClD,4CAA+F;AAEhF,KAAK,UAAU,UAAU,CAAC,GAA0B;IACjE,IAAI,YAAY,GAAG,IAAI,CAAC;IACxB,IAAI;QACF,MAAM,eAAe,GAAG,MAAM,UAAU,C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{ IOSConfig } from '@expo/config-plugins';\nimport { BuildPhase, Ios, Workflow } from '@expo/eas-build-job';\nimport fs from 'fs-extra';\n\nimport { BuildContext } from '../context';\nimport { createNpmErrorHandler } from '../utils/handleNpmError';\nimport { configureExpoUpdatesIfInstalledAsync } from '../utils/expoUpdates';\nimport { setup } from '../utils/project';\nimport { findBuildArtifacts } from '../utils/buildArtifacts';\nimport { Hook, runHookIfPresent } from '../utils/hooks';\nimport { configureXcodeProject } from '../ios/configure';\nimport CredentialsManager from '../ios/credentials/manager';\nimport { runFastlaneGym } from '../ios/fastlane';\nimport { installPods } from '../ios/pod';\nimport { prebuildAsync } from '../utils/prebuild';\nimport { resolveArtifactPath, resolveBuildConfiguration, resolveScheme } from '../ios/resolve';\n\nexport default async function iosBuilder(ctx: BuildContext<Ios.Job>): Promise<string> {\n let buildSuccess = true;\n try {\n const archiveLocation = await buildAsync(ctx);\n await ctx.runBuildPhase(BuildPhase.ON_BUILD_SUCCESS_HOOK, async () => {\n await runHookIfPresent(ctx, Hook.ON_BUILD_SUCCESS);\n });\n return archiveLocation;\n } catch (err: any) {\n buildSuccess = false;\n await ctx.runBuildPhase(BuildPhase.ON_BUILD_ERROR_HOOK, async () => {\n await runHookIfPresent(ctx, Hook.ON_BUILD_ERROR);\n });\n throw err;\n } finally {\n await ctx.runBuildPhase(BuildPhase.ON_BUILD_COMPLETE_HOOK, async () => {\n await runHookIfPresent(ctx, Hook.ON_BUILD_COMPLETE, {\n extraEnvs: {\n EAS_BUILD_STATUS: buildSuccess ? 'finished' : 'errored',\n },\n });\n });\n }\n}\n\nasync function buildAsync(ctx: BuildContext<Ios.Job>): Promise<string> {\n await setup(ctx);\n const hasNativeCode = ctx.job.type === Workflow.GENERIC;\n\n const credentialsManager = new CredentialsManager(ctx);\n try {\n const credentials = await ctx.runBuildPhase(BuildPhase.PREPARE_CREDENTIALS, async () => {\n return await credentialsManager.prepare();\n });\n\n await ctx.runBuildPhase(\n BuildPhase.PREBUILD,\n async () => {\n if (hasNativeCode) {\n ctx.markBuildPhaseSkipped();\n ctx.logger.info(\n 'Skipped running \"expo prebuild\" because the \"ios\" directory already exists. Learn more about the build process: https://docs.expo.dev/build-reference/ios-builds/'\n );\n return;\n }\n const extraEnvs: Record<string, string> = credentials?.teamId\n ? { APPLE_TEAM_ID: credentials.teamId }\n : {};\n await prebuildAsync(ctx, { extraEnvs });\n },\n { onError: createNpmErrorHandler(ctx) }\n );\n\n await ctx.runBuildPhase(BuildPhase.RESTORE_CACHE, async () => {\n await ctx.cacheManager?.restoreCache(ctx);\n });\n\n await ctx.runBuildPhase(BuildPhase.INSTALL_PODS, async () => {\n await installPods(ctx);\n });\n\n await ctx.runBuildPhase(BuildPhase.POST_INSTALL_HOOK, async () => {\n await runHookIfPresent(ctx, Hook.POST_INSTALL);\n });\n\n const buildConfiguration = resolveBuildConfiguration(ctx);\n if (credentials) {\n await ctx.runBuildPhase(BuildPhase.CONFIGURE_XCODE_PROJECT, async () => {\n await configureXcodeProject(ctx, { credentials, buildConfiguration });\n });\n }\n\n await ctx.runBuildPhase(BuildPhase.CONFIGURE_EXPO_UPDATES, async () => {\n await configureExpoUpdatesIfInstalledAsync(ctx);\n });\n\n await ctx.runBuildPhase(BuildPhase.RUN_FASTLANE, async () => {\n const scheme = resolveScheme(ctx);\n const entitlements = await readEntitlementsAsync(ctx, { scheme, buildConfiguration });\n await runFastlaneGym(ctx, {\n credentials,\n scheme,\n buildConfiguration,\n entitlements,\n });\n });\n } finally {\n await ctx.runBuildPhase(BuildPhase.CLEAN_UP_CREDENTIALS, async () => {\n await credentialsManager.cleanUp();\n });\n }\n\n await ctx.runBuildPhase(BuildPhase.PRE_UPLOAD_ARTIFACTS_HOOK, async () => {\n await runHookIfPresent(ctx, Hook.PRE_UPLOAD_ARTIFACTS);\n });\n\n await ctx.runBuildPhase(BuildPhase.SAVE_CACHE, async () => {\n await ctx.cacheManager?.saveCache(ctx);\n });\n\n return await ctx.runBuildPhase(BuildPhase.UPLOAD_ARTIFACTS, async () => {\n const buildArtifacts = await findBuildArtifacts(\n ctx.reactNativeProjectDirectory,\n resolveArtifactPath(ctx),\n ctx.logger\n );\n ctx.logger.info(`Build artifacts: ${buildArtifacts.join(', ')}`);\n return await ctx.uploadBuildArtifacts(ctx, buildArtifacts);\n });\n}\n\nasync function readEntitlementsAsync(\n ctx: BuildContext<Ios.Job>,\n { scheme, buildConfiguration }: { scheme: string; buildConfiguration: string }\n): Promise<object | null> {\n try {\n const applicationTargetName = await IOSConfig.BuildScheme.getApplicationTargetNameForSchemeAsync(\n ctx.reactNativeProjectDirectory,\n scheme\n );\n const entitlementsPath = IOSConfig.Entitlements.getEntitlementsPath(\n ctx.reactNativeProjectDirectory,\n {\n buildConfiguration,\n targetName: applicationTargetName,\n }\n );\n if (!entitlementsPath) {\n return null;\n }\n const entitlementsRaw = await fs.readFile(entitlementsPath, 'utf8');\n return plist.parse(entitlementsRaw);\n } catch (err) {\n ctx.logger.warn({ err }, 'Failed to read entitlements');\n ctx.markBuildPhaseHasWarnings();\n return null;\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"ios.js","sourceRoot":"","sources":["../../src/builders/ios.ts"],"names":[],"mappings":";;;;;AAAA,wDAAgC;AAChC,yDAAiD;AACjD,uDAAgE;AAChE,wDAA0B;AAE1B,wCAAmE;AACnE,4DAAgE;AAChE,sDAA4E;AAC5E,8CAAyC;AACzC,kDAAmD;AACnD,0CAAwD;AACxD,gDAAyD;AACzD,yEAA4D;AAC5D,8CAAiD;AACjD,oCAAyC;AACzC,gDAAkD;AAClD,4CAA+F;AAE/F,qCAAoD;AAErC,KAAK,UAAU,UAAU,CAAC,GAA0B;IACjE,OAAO,MAAM,IAAA,iCAAwB,EAAC,GAAG,EAAE,UAAU,CAAC,CAAC;AACzD,CAAC;AAFD,6BAEC;AAED,KAAK,UAAU,UAAU,CAAC,GAA0B;IAClD,MAAM,IAAA,eAAK,EAAC,GAAG,CAAC,CAAC;IACjB,MAAM,aAAa,GAAG,GA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QAAQ,CAAC,gBAAgB,EAAE,MAAM,CAAC,CAAC;QACpE,OAAO,eAAK,CAAC,KAAK,CAAC,eAAe,CAAC,CAAC;KACrC;IAAC,OAAO,GAAG,EAAE;QACZ,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,GAAG,EAAE,EAAE,6BAA6B,CAAC,CAAC;QACxD,GAAG,CAAC,yBAAyB,EAAE,CAAC;QAChC,OAAO,IAAI,CAAC;KACb;AACH,CAAC","sourcesContent":["import plist from '@expo/plist';\nimport { IOSConfig } from '@expo/config-plugins';\nimport { BuildPhase, Ios, Workflow } from '@expo/eas-build-job';\nimport fs from 'fs-extra';\n\nimport { Artifacts, ArtifactType, BuildContext } from '../context';\nimport { createNpmErrorHandler } from '../utils/handleNpmError';\nimport { configureExpoUpdatesIfInstalledAsync } from '../utils/expoUpdates';\nimport { setup } from '../utils/project';\nimport { findArtifacts } from '../utils/artifacts';\nimport { Hook, runHookIfPresent } from '../utils/hooks';\nimport { configureXcodeProject } from '../ios/configure';\nimport CredentialsManager from '../ios/credentials/manager';\nimport { runFastlaneGym } from '../ios/fastlane';\nimport { installPods } from '../ios/pod';\nimport { prebuildAsync } from '../utils/prebuild';\nimport { resolveArtifactPath, resolveBuildConfiguration, resolveScheme } from '../ios/resolve';\n\nimport { runBuilderWithHooksAsync } from './common';\n\nexport default async function iosBuilder(ctx: BuildContext<Ios.Job>): Promise<Artifacts> {\n return await runBuilderWithHooksAsync(ctx, buildAsync);\n}\n\nasync function buildAsync(ctx: BuildContext<Ios.Job>): Promise<void> {\n await setup(ctx);\n const hasNativeCode = ctx.job.type === Workflow.GENERIC;\n\n const credentialsManager = new CredentialsManager(ctx);\n try {\n const credentials = await ctx.runBuildPhase(BuildPhase.PREPARE_CREDENTIALS, async () => {\n return await credentialsManager.prepare();\n });\n\n await ctx.runBuildPhase(\n BuildPhase.PREBUILD,\n async () => {\n if (hasNativeCode) {\n ctx.markBuildPhaseSkipped();\n ctx.logger.info(\n 'Skipped running \"expo prebuild\" because the \"ios\" directory already exists. Learn more about the build process: https://docs.expo.dev/build-reference/ios-builds/'\n );\n return;\n }\n const extraEnvs: Record<string, string> = credentials?.teamId\n ? { APPLE_TEAM_ID: credentials.teamId }\n : {};\n await prebuildAsync(ctx, { extraEnvs });\n },\n { onError: createNpmErrorHandler(ctx) }\n );\n\n await ctx.runBuildPhase(BuildPhase.RESTORE_CACHE, async () => {\n await ctx.cacheManager?.restoreCache(ctx);\n });\n\n await ctx.runBuildPhase(BuildPhase.INSTALL_PODS, async () => {\n await installPods(ctx);\n });\n\n await ctx.runBuildPhase(BuildPhase.POST_INSTALL_HOOK, async () => {\n await runHookIfPresent(ctx, Hook.POST_INSTALL);\n });\n\n const buildConfiguration = resolveBuildConfiguration(ctx);\n if (credentials) {\n await ctx.runBuildPhase(BuildPhase.CONFIGURE_XCODE_PROJECT, async () => {\n await configureXcodeProject(ctx, { credentials, buildConfiguration });\n });\n }\n\n await ctx.runBuildPhase(BuildPhase.CONFIGURE_EXPO_UPDATES, async () => {\n await configureExpoUpdatesIfInstalledAsync(ctx);\n });\n\n await ctx.runBuildPhase(BuildPhase.RUN_FASTLANE, async () => {\n const scheme = resolveScheme(ctx);\n const entitlements = await readEntitlementsAsync(ctx, { scheme, buildConfiguration });\n await runFastlaneGym(ctx, {\n credentials,\n scheme,\n buildConfiguration,\n entitlements,\n });\n });\n } finally {\n await ctx.runBuildPhase(BuildPhase.CLEAN_UP_CREDENTIALS, async () => {\n await credentialsManager.cleanUp();\n });\n }\n\n await ctx.runBuildPhase(BuildPhase.PRE_UPLOAD_ARTIFACTS_HOOK, async () => {\n await runHookIfPresent(ctx, Hook.PRE_UPLOAD_ARTIFACTS);\n });\n\n await ctx.runBuildPhase(BuildPhase.SAVE_CACHE, async () => {\n await ctx.cacheManager?.saveCache(ctx);\n });\n\n await ctx.runBuildPhase(BuildPhase.UPLOAD_APPLICATION_ARCHIVE, async () => {\n const applicationArchives = await findArtifacts(\n ctx.reactNativeProjectDirectory,\n resolveArtifactPath(ctx),\n ctx.logger\n );\n ctx.logger.info(`Application archives: ${applicationArchives.join(', ')}`);\n await ctx.uploadArtifacts(ArtifactType.APPLICATION_ARCHIVE, applicationArchives, ctx.logger);\n });\n}\n\nasync function readEntitlementsAsync(\n ctx: BuildContext<Ios.Job>,\n { scheme, buildConfiguration }: { scheme: string; buildConfiguration: string }\n): Promise<object | null> {\n try {\n const applicationTargetName = await IOSConfig.BuildScheme.getApplicationTargetNameForSchemeAsync(\n ctx.reactNativeProjectDirectory,\n scheme\n );\n const entitlementsPath = IOSConfig.Entitlements.getEntitlementsPath(\n ctx.reactNativeProjectDirectory,\n {\n buildConfiguration,\n targetName: applicationTargetName,\n }\n );\n if (!entitlementsPath) {\n return null;\n }\n const entitlementsRaw = await fs.readFile(entitlementsPath, 'utf8');\n return plist.parse(entitlementsRaw);\n } catch (err) {\n ctx.logger.warn({ err }, 'Failed to read entitlements');\n ctx.markBuildPhaseHasWarnings();\n return null;\n }\n}\n"]}
|
package/dist/context.d.ts
CHANGED
|
@@ -3,6 +3,15 @@ import { ExpoConfig } from '@expo/config';
|
|
|
3
3
|
import { bunyan } from '@expo/logger';
|
|
4
4
|
import { SpawnPromise, SpawnOptions, SpawnResult } from '@expo/turtle-spawn';
|
|
5
5
|
import { PackageManager } from './utils/packageManager';
|
|
6
|
+
export declare enum ArtifactType {
|
|
7
|
+
APPLICATION_ARCHIVE = "APPLICATION_ARCHIVE",
|
|
8
|
+
BUILD_ARTIFACTS = "BUILD_ARTIFACTS",
|
|
9
|
+
/**
|
|
10
|
+
* @deprecated
|
|
11
|
+
*/
|
|
12
|
+
XCODE_BUILD_LOGS = "XCODE_BUILD_LOGS"
|
|
13
|
+
}
|
|
14
|
+
export declare type Artifacts = Partial<Record<ArtifactType, string>>;
|
|
6
15
|
export interface CacheManager {
|
|
7
16
|
saveCache(ctx: BuildContext<Job>): Promise<void>;
|
|
8
17
|
restoreCache(ctx: BuildContext<Job>): Promise<void>;
|
|
@@ -21,7 +30,7 @@ export interface BuildContextOptions {
|
|
|
21
30
|
* @deprecated
|
|
22
31
|
*/
|
|
23
32
|
runGlobalExpoCliCommand: (args: string, options: SpawnOptions) => SpawnPromise<SpawnResult>;
|
|
24
|
-
|
|
33
|
+
uploadArtifacts: (type: ArtifactType, paths: string[], logger?: bunyan) => Promise<string | null>;
|
|
25
34
|
reportError?: (msg: string, err?: Error, options?: {
|
|
26
35
|
tags?: Record<string, string>;
|
|
27
36
|
extras?: Record<string, string>;
|
|
@@ -42,20 +51,22 @@ export declare class BuildContext<TJob extends Job> {
|
|
|
42
51
|
* @deprecated
|
|
43
52
|
*/
|
|
44
53
|
readonly runGlobalExpoCliCommand: (args: string, options: SpawnOptions) => SpawnPromise<SpawnResult>;
|
|
45
|
-
readonly uploadBuildArtifacts: (ctx: BuildContext<Job>, archivePaths: string[]) => Promise<string>;
|
|
46
54
|
readonly reportError?: (msg: string, err?: Error, options?: {
|
|
47
55
|
tags?: Record<string, string>;
|
|
48
56
|
extras?: Record<string, string>;
|
|
49
57
|
}) => void;
|
|
50
58
|
readonly metadata?: Metadata;
|
|
51
59
|
readonly skipNativeBuild?: boolean;
|
|
60
|
+
artifacts: Artifacts;
|
|
52
61
|
private readonly defaultLogger;
|
|
62
|
+
private readonly _uploadArtifacts;
|
|
53
63
|
private buildPhase?;
|
|
54
64
|
private buildPhaseSkipped;
|
|
55
65
|
private buildPhaseHasWarnings;
|
|
56
66
|
private _appConfig?;
|
|
57
67
|
constructor(job: TJob, options: BuildContextOptions);
|
|
58
68
|
get buildDirectory(): string;
|
|
69
|
+
get buildLogsDirectory(): string;
|
|
59
70
|
get reactNativeProjectDirectory(): string;
|
|
60
71
|
get packageManager(): PackageManager;
|
|
61
72
|
get appConfig(): ExpoConfig;
|
|
@@ -66,6 +77,7 @@ export declare class BuildContext<TJob extends Job> {
|
|
|
66
77
|
}): Promise<T>;
|
|
67
78
|
markBuildPhaseSkipped(): void;
|
|
68
79
|
markBuildPhaseHasWarnings(): void;
|
|
80
|
+
uploadArtifacts(type: ArtifactType, paths: string[], logger?: bunyan): Promise<void>;
|
|
69
81
|
private setBuildPhase;
|
|
70
82
|
private endCurrentBuildPhase;
|
|
71
83
|
}
|
package/dist/context.js
CHANGED
|
@@ -3,12 +3,21 @@ 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.BuildContext = exports.SkipNativeBuildError = void 0;
|
|
6
|
+
exports.BuildContext = exports.SkipNativeBuildError = exports.ArtifactType = void 0;
|
|
7
7
|
const path_1 = __importDefault(require("path"));
|
|
8
8
|
const eas_build_job_1 = require("@expo/eas-build-job");
|
|
9
9
|
const packageManager_1 = require("./utils/packageManager");
|
|
10
10
|
const detectUserError_1 = require("./utils/detectUserError");
|
|
11
11
|
const appConfig_1 = require("./utils/appConfig");
|
|
12
|
+
var ArtifactType;
|
|
13
|
+
(function (ArtifactType) {
|
|
14
|
+
ArtifactType["APPLICATION_ARCHIVE"] = "APPLICATION_ARCHIVE";
|
|
15
|
+
ArtifactType["BUILD_ARTIFACTS"] = "BUILD_ARTIFACTS";
|
|
16
|
+
/**
|
|
17
|
+
* @deprecated
|
|
18
|
+
*/
|
|
19
|
+
ArtifactType["XCODE_BUILD_LOGS"] = "XCODE_BUILD_LOGS";
|
|
20
|
+
})(ArtifactType = exports.ArtifactType || (exports.ArtifactType = {}));
|
|
12
21
|
class SkipNativeBuildError extends Error {
|
|
13
22
|
}
|
|
14
23
|
exports.SkipNativeBuildError = SkipNativeBuildError;
|
|
@@ -16,6 +25,7 @@ class BuildContext {
|
|
|
16
25
|
constructor(job, options) {
|
|
17
26
|
var _a, _b;
|
|
18
27
|
this.job = job;
|
|
28
|
+
this.artifacts = {};
|
|
19
29
|
this.buildPhaseSkipped = false;
|
|
20
30
|
this.buildPhaseHasWarnings = false;
|
|
21
31
|
this.workingdir = options.workingdir;
|
|
@@ -24,7 +34,7 @@ class BuildContext {
|
|
|
24
34
|
this.logBuffer = options.logBuffer;
|
|
25
35
|
this.cacheManager = options.cacheManager;
|
|
26
36
|
this.runGlobalExpoCliCommand = options.runGlobalExpoCliCommand;
|
|
27
|
-
this.
|
|
37
|
+
this._uploadArtifacts = options.uploadArtifacts;
|
|
28
38
|
this.reportError = options.reportError;
|
|
29
39
|
this.metadata = options.metadata;
|
|
30
40
|
this.skipNativeBuild = options.skipNativeBuild;
|
|
@@ -33,6 +43,9 @@ class BuildContext {
|
|
|
33
43
|
get buildDirectory() {
|
|
34
44
|
return path_1.default.join(this.workingdir, 'build');
|
|
35
45
|
}
|
|
46
|
+
get buildLogsDirectory() {
|
|
47
|
+
return path_1.default.join(this.workingdir, 'logs');
|
|
48
|
+
}
|
|
36
49
|
get reactNativeProjectDirectory() {
|
|
37
50
|
return path_1.default.join(this.buildDirectory, this.job.projectRootDirectory);
|
|
38
51
|
}
|
|
@@ -92,6 +105,12 @@ class BuildContext {
|
|
|
92
105
|
markBuildPhaseHasWarnings() {
|
|
93
106
|
this.buildPhaseHasWarnings = true;
|
|
94
107
|
}
|
|
108
|
+
async uploadArtifacts(type, paths, logger) {
|
|
109
|
+
const url = await this._uploadArtifacts(type, paths, logger);
|
|
110
|
+
if (url) {
|
|
111
|
+
this.artifacts[type] = url;
|
|
112
|
+
}
|
|
113
|
+
}
|
|
95
114
|
setBuildPhase(buildPhase, { doNotMarkStart = false } = {}) {
|
|
96
115
|
if (this.buildPhase) {
|
|
97
116
|
if (this.buildPhase === buildPhase) {
|
package/dist/context.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"context.js","sourceRoot":"","sources":["../src/context.ts"],"names":[],"mappings":";;;;;;AAAA,gDAAwB;AAExB,uDAQ6B;AAK7B,2DAA+E;AAC/E,6DAA0D;AAC1D,iDAAkD;AAgClD,MAAa,oBAAqB,SAAQ,KAAK;CAAG;AAAlD,oD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AAG,UAAU,CAAC;QAC7B,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,aAAa,CAAC,KAAK,CAAC,EAAE,KAAK,EAAE,UAAU,EAAE,CAAC,CAAC;QAC9D,IAAI,CAAC,cAAc,EAAE;YACnB,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,yBAAS,CAAC,WAAW,EAAE,EAAE,gBAAgB,IAAI,CAAC,UAAU,EAAE,CAAC,CAAC;SACxF;IACH,CAAC;IAEO,oBAAoB,CAAC,EAC3B,MAAM,EACN,YAAY,GAAG,KAAK,GAIrB;QACC,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE;YACpB,OAAO;SACR;QACD,IAAI,CAAC,YAAY,EAAE;YACjB,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,yBAAS,CAAC,SAAS,EAAE,MAAM,EAAE,EAAE,cAAc,IAAI,CAAC,UAAU,EAAE,CAAC,CAAC;SAC5F;QACD,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,aAAa,CAAC;QACjC,IAAI,CAAC,UAAU,GAAG,SAAS,CAAC;QAC5B,IAAI,CAAC,iBAAiB,GAAG,KAAK,CAAC;QAC/B,IAAI,CAAC,qBAAqB,GAAG,KAAK,CAAC;IACrC,CAAC;CACF;AAjKD,oCAiKC","sourcesContent":["import path from 'path';\n\nimport {\n BuildPhase,\n BuildPhaseResult,\n Job,\n LogMarker,\n Env,\n errors,\n Metadata,\n} from '@expo/eas-build-job';\nimport { ExpoConfig } from '@expo/config';\nimport { bunyan } from '@expo/logger';\nimport { SpawnPromise, SpawnOptions, SpawnResult } from '@expo/turtle-spawn';\n\nimport { PackageManager, resolvePackageManager } from './utils/packageManager';\nimport { detectUserError } from './utils/detectUserError';\nimport { readAppConfig } from './utils/appConfig';\n\nexport interface CacheManager {\n saveCache(ctx: BuildContext<Job>): Promise<void>;\n restoreCache(ctx: BuildContext<Job>): Promise<void>;\n}\n\nexport interface LogBuffer {\n getLogs(): string[];\n getPhaseLogs(buildPhase: string): string[];\n}\n\nexport interface BuildContextOptions {\n workingdir: string;\n logger: bunyan;\n logBuffer: LogBuffer;\n env: Env;\n cacheManager?: CacheManager;\n /**\n * @deprecated\n */\n runGlobalExpoCliCommand: (args: string, options: SpawnOptions) => SpawnPromise<SpawnResult>;\n uploadBuildArtifacts: (ctx: BuildContext<Job>, archivePaths: string[]) => Promise<string>;\n reportError?: (\n msg: string,\n err?: Error,\n options?: { tags?: Record<string, string>; extras?: Record<string, string> }\n ) => void;\n skipNativeBuild?: boolean;\n metadata?: Metadata;\n}\n\nexport class SkipNativeBuildError extends Error {}\n\nexport class BuildContext<TJob extends Job> {\n public readonly workingdir: string;\n public logger: bunyan;\n public readonly logBuffer: LogBuffer;\n public readonly env: Env;\n public readonly cacheManager?: CacheManager;\n /**\n * @deprecated\n */\n public readonly runGlobalExpoCliCommand: (\n args: string,\n options: SpawnOptions\n ) => SpawnPromise<SpawnResult>;\n public readonly uploadBuildArtifacts: (\n ctx: BuildContext<Job>,\n archivePaths: string[]\n ) => Promise<string>;\n public readonly reportError?: (\n msg: string,\n err?: Error,\n options?: { tags?: Record<string, string>; extras?: Record<string, string> }\n ) => void;\n public readonly metadata?: Metadata;\n public readonly skipNativeBuild?: boolean;\n\n private readonly defaultLogger: bunyan;\n private buildPhase?: BuildPhase;\n private buildPhaseSkipped = false;\n private buildPhaseHasWarnings = false;\n private _appConfig?: ExpoConfig;\n\n constructor(public readonly job: TJob, options: BuildContextOptions) {\n this.workingdir = options.workingdir;\n this.defaultLogger = options.logger;\n this.logger = this.defaultLogger;\n this.logBuffer = options.logBuffer;\n this.cacheManager = options.cacheManager;\n this.runGlobalExpoCliCommand = options.runGlobalExpoCliCommand;\n this.uploadBuildArtifacts = options.uploadBuildArtifacts;\n this.reportError = options.reportError;\n this.metadata = options.metadata;\n this.skipNativeBuild = options.skipNativeBuild;\n this.env = {\n ...options.env,\n ...job?.builderEnvironment?.env,\n ...job?.secrets?.environmentSecrets,\n };\n }\n\n public get buildDirectory(): string {\n return path.join(this.workingdir, 'build');\n }\n public get reactNativeProjectDirectory(): string {\n return path.join(this.buildDirectory, this.job.projectRootDirectory);\n }\n public get packageManager(): PackageManager {\n return resolvePackageManager(this.reactNativeProjectDirectory);\n }\n public get appConfig(): ExpoConfig {\n if (!this._appConfig) {\n this._appConfig = readAppConfig(this.reactNativeProjectDirectory, this.env, this.logger).exp;\n }\n return this._appConfig;\n }\n\n public async runBuildPhase<T>(\n buildPhase: BuildPhase,\n phase: () => Promise<T>,\n {\n doNotMarkStart = false,\n doNotMarkEnd = false,\n onError,\n }: {\n doNotMarkStart?: boolean;\n doNotMarkEnd?: boolean;\n onError?: (err: Error, logLines: string[]) => void;\n } = {}\n ): Promise<T> {\n try {\n this.setBuildPhase(buildPhase, { doNotMarkStart });\n const result = await phase();\n const buildPhaseResult: BuildPhaseResult = this.buildPhaseSkipped\n ? BuildPhaseResult.SKIPPED\n : this.buildPhaseHasWarnings\n ? BuildPhaseResult.WARNING\n : BuildPhaseResult.SUCCESS;\n this.endCurrentBuildPhase({ result: buildPhaseResult, doNotMarkEnd });\n return result;\n } catch (err: any) {\n let userError: errors.UserError | undefined;\n if (err instanceof errors.UserError) {\n userError = err;\n } else {\n const detectedError = detectUserError(this.logBuffer.getPhaseLogs(buildPhase), {\n job: this.job,\n phase: buildPhase,\n });\n if (detectedError) {\n detectedError.innerError = err;\n userError = detectedError;\n }\n }\n if (userError) {\n this.logger.error(`Error: ${userError.message}`);\n } else {\n // leaving message empty, website will display err.stack which already includes err.message\n this.logger.error({ err }, '');\n }\n if (onError) {\n onError(userError ?? err, this.logBuffer.getPhaseLogs(buildPhase));\n }\n this.endCurrentBuildPhase({ result: BuildPhaseResult.FAIL });\n throw userError ?? err;\n }\n }\n\n public markBuildPhaseSkipped(): void {\n this.buildPhaseSkipped = true;\n }\n\n public markBuildPhaseHasWarnings(): void {\n this.buildPhaseHasWarnings = true;\n }\n\n private setBuildPhase(buildPhase: BuildPhase, { doNotMarkStart = false } = {}): void {\n if (this.buildPhase) {\n if (this.buildPhase === buildPhase) {\n return;\n } else {\n this.logger.info(\n { marker: LogMarker.END_PHASE, result: BuildPhaseResult.UNKNOWN },\n `End phase: ${this.buildPhase}`\n );\n this.logger = this.defaultLogger;\n }\n }\n this.buildPhase = buildPhase;\n this.logger = this.defaultLogger.child({ phase: buildPhase });\n if (!doNotMarkStart) {\n this.logger.info({ marker: LogMarker.START_PHASE }, `Start phase: ${this.buildPhase}`);\n }\n }\n\n private endCurrentBuildPhase({\n result,\n doNotMarkEnd = false,\n }: {\n result: BuildPhaseResult;\n doNotMarkEnd?: boolean;\n }): void {\n if (!this.buildPhase) {\n return;\n }\n if (!doNotMarkEnd) {\n this.logger.info({ marker: LogMarker.END_PHASE, result }, `End phase: ${this.buildPhase}`);\n }\n this.logger = this.defaultLogger;\n this.buildPhase = undefined;\n this.buildPhaseSkipped = false;\n this.buildPhaseHasWarnings = false;\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"context.js","sourceRoot":"","sources":["../src/context.ts"],"names":[],"mappings":";;;;;;AAAA,gDAAwB;AAExB,uDAQ6B;AAK7B,2DAA+E;AAC/E,6DAA0D;AAC1D,iDAAkD;AAElD,IAAY,YAOX;AAPD,WAAY,YAAY;IACtB,2DAA2C,CAAA;IAC3C,mDAAmC,CAAA;IACnC;;OAEG;IACH,qDAAqC,CAAA;AACvC,CAAC,EAPW,YAAY,GAAZ,oBAAY,KAAZ,oBAAY,QAOvB;AAkCD,MAAa,oBAAqB,SAAQ,KAAK;CAAG;AAAlD,oDAAkD;AAElD,MAAa,YAAY;IAiCvB,YAA4B,GAAS,EAAE,OAA4B;;QAAvC,QAAG,GAAH,GAAG,CAAM;QAb9B,cAAS,GAAc,EAAE,CAAC;QASzB,sBAAiB,GAAG,KAAK,CAAC;QAC1B,0BAAqB,GAAG,KAAK,CAAC;QAIpC,IAAI,CAAC,UAAU,GAAG,OAAO,CAAC,UAAU,CA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AgB,CAAC,OAAO,EAAE,EACjE,cAAc,IAAI,CAAC,UAAU,EAAE,CAChC,CAAC;gBACF,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,aAAa,CAAC;aAClC;SACF;QACD,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;QAC7B,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,aAAa,CAAC,KAAK,CAAC,EAAE,KAAK,EAAE,UAAU,EAAE,CAAC,CAAC;QAC9D,IAAI,CAAC,cAAc,EAAE;YACnB,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,yBAAS,CAAC,WAAW,EAAE,EAAE,gBAAgB,IAAI,CAAC,UAAU,EAAE,CAAC,CAAC;SACxF;IACH,CAAC;IAEO,oBAAoB,CAAC,EAC3B,MAAM,EACN,YAAY,GAAG,KAAK,GAIrB;QACC,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE;YACpB,OAAO;SACR;QACD,IAAI,CAAC,YAAY,EAAE;YACjB,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,yBAAS,CAAC,SAAS,EAAE,MAAM,EAAE,EAAE,cAAc,IAAI,CAAC,UAAU,EAAE,CAAC,CAAC;SAC5F;QACD,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,aAAa,CAAC;QACjC,IAAI,CAAC,UAAU,GAAG,SAAS,CAAC;QAC5B,IAAI,CAAC,iBAAiB,GAAG,KAAK,CAAC;QAC/B,IAAI,CAAC,qBAAqB,GAAG,KAAK,CAAC;IACrC,CAAC;CACF;AAjLD,oCAiLC","sourcesContent":["import path from 'path';\n\nimport {\n BuildPhase,\n BuildPhaseResult,\n Job,\n LogMarker,\n Env,\n errors,\n Metadata,\n} from '@expo/eas-build-job';\nimport { ExpoConfig } from '@expo/config';\nimport { bunyan } from '@expo/logger';\nimport { SpawnPromise, SpawnOptions, SpawnResult } from '@expo/turtle-spawn';\n\nimport { PackageManager, resolvePackageManager } from './utils/packageManager';\nimport { detectUserError } from './utils/detectUserError';\nimport { readAppConfig } from './utils/appConfig';\n\nexport enum ArtifactType {\n APPLICATION_ARCHIVE = 'APPLICATION_ARCHIVE',\n BUILD_ARTIFACTS = 'BUILD_ARTIFACTS',\n /**\n * @deprecated\n */\n XCODE_BUILD_LOGS = 'XCODE_BUILD_LOGS',\n}\n\nexport type Artifacts = Partial<Record<ArtifactType, string>>;\n\nexport interface CacheManager {\n saveCache(ctx: BuildContext<Job>): Promise<void>;\n restoreCache(ctx: BuildContext<Job>): Promise<void>;\n}\n\nexport interface LogBuffer {\n getLogs(): string[];\n getPhaseLogs(buildPhase: string): string[];\n}\n\nexport interface BuildContextOptions {\n workingdir: string;\n logger: bunyan;\n logBuffer: LogBuffer;\n env: Env;\n cacheManager?: CacheManager;\n /**\n * @deprecated\n */\n runGlobalExpoCliCommand: (args: string, options: SpawnOptions) => SpawnPromise<SpawnResult>;\n uploadArtifacts: (type: ArtifactType, paths: string[], logger?: bunyan) => Promise<string | null>;\n reportError?: (\n msg: string,\n err?: Error,\n options?: { tags?: Record<string, string>; extras?: Record<string, string> }\n ) => void;\n skipNativeBuild?: boolean;\n metadata?: Metadata;\n}\n\nexport class SkipNativeBuildError extends Error {}\n\nexport class BuildContext<TJob extends Job> {\n public readonly workingdir: string;\n public logger: bunyan;\n public readonly logBuffer: LogBuffer;\n public readonly env: Env;\n public readonly cacheManager?: CacheManager;\n /**\n * @deprecated\n */\n public readonly runGlobalExpoCliCommand: (\n args: string,\n options: SpawnOptions\n ) => SpawnPromise<SpawnResult>;\n public readonly reportError?: (\n msg: string,\n err?: Error,\n options?: { tags?: Record<string, string>; extras?: Record<string, string> }\n ) => void;\n public readonly metadata?: Metadata;\n public readonly skipNativeBuild?: boolean;\n public artifacts: Artifacts = {};\n\n private readonly defaultLogger: bunyan;\n private readonly _uploadArtifacts: (\n type: ArtifactType,\n paths: string[],\n logger?: bunyan\n ) => Promise<string | null>;\n private buildPhase?: BuildPhase;\n private buildPhaseSkipped = false;\n private buildPhaseHasWarnings = false;\n private _appConfig?: ExpoConfig;\n\n constructor(public readonly job: TJob, options: BuildContextOptions) {\n this.workingdir = options.workingdir;\n this.defaultLogger = options.logger;\n this.logger = this.defaultLogger;\n this.logBuffer = options.logBuffer;\n this.cacheManager = options.cacheManager;\n this.runGlobalExpoCliCommand = options.runGlobalExpoCliCommand;\n this._uploadArtifacts = options.uploadArtifacts;\n this.reportError = options.reportError;\n this.metadata = options.metadata;\n this.skipNativeBuild = options.skipNativeBuild;\n this.env = {\n ...options.env,\n ...job?.builderEnvironment?.env,\n ...job?.secrets?.environmentSecrets,\n };\n }\n\n public get buildDirectory(): string {\n return path.join(this.workingdir, 'build');\n }\n public get buildLogsDirectory(): string {\n return path.join(this.workingdir, 'logs');\n }\n public get reactNativeProjectDirectory(): string {\n return path.join(this.buildDirectory, this.job.projectRootDirectory);\n }\n public get packageManager(): PackageManager {\n return resolvePackageManager(this.reactNativeProjectDirectory);\n }\n public get appConfig(): ExpoConfig {\n if (!this._appConfig) {\n this._appConfig = readAppConfig(this.reactNativeProjectDirectory, this.env, this.logger).exp;\n }\n return this._appConfig;\n }\n\n public async runBuildPhase<T>(\n buildPhase: BuildPhase,\n phase: () => Promise<T>,\n {\n doNotMarkStart = false,\n doNotMarkEnd = false,\n onError,\n }: {\n doNotMarkStart?: boolean;\n doNotMarkEnd?: boolean;\n onError?: (err: Error, logLines: string[]) => void;\n } = {}\n ): Promise<T> {\n try {\n this.setBuildPhase(buildPhase, { doNotMarkStart });\n const result = await phase();\n const buildPhaseResult: BuildPhaseResult = this.buildPhaseSkipped\n ? BuildPhaseResult.SKIPPED\n : this.buildPhaseHasWarnings\n ? BuildPhaseResult.WARNING\n : BuildPhaseResult.SUCCESS;\n this.endCurrentBuildPhase({ result: buildPhaseResult, doNotMarkEnd });\n return result;\n } catch (err: any) {\n let userError: errors.UserError | undefined;\n if (err instanceof errors.UserError) {\n userError = err;\n } else {\n const detectedError = detectUserError(this.logBuffer.getPhaseLogs(buildPhase), {\n job: this.job,\n phase: buildPhase,\n });\n if (detectedError) {\n detectedError.innerError = err;\n userError = detectedError;\n }\n }\n if (userError) {\n this.logger.error(`Error: ${userError.message}`);\n } else {\n // leaving message empty, website will display err.stack which already includes err.message\n this.logger.error({ err }, '');\n }\n if (onError) {\n onError(userError ?? err, this.logBuffer.getPhaseLogs(buildPhase));\n }\n this.endCurrentBuildPhase({ result: BuildPhaseResult.FAIL });\n throw userError ?? err;\n }\n }\n\n public markBuildPhaseSkipped(): void {\n this.buildPhaseSkipped = true;\n }\n\n public markBuildPhaseHasWarnings(): void {\n this.buildPhaseHasWarnings = true;\n }\n\n public async uploadArtifacts(\n type: ArtifactType,\n paths: string[],\n logger?: bunyan\n ): Promise<void> {\n const url = await this._uploadArtifacts(type, paths, logger);\n if (url) {\n this.artifacts[type] = url;\n }\n }\n\n private setBuildPhase(buildPhase: BuildPhase, { doNotMarkStart = false } = {}): void {\n if (this.buildPhase) {\n if (this.buildPhase === buildPhase) {\n return;\n } else {\n this.logger.info(\n { marker: LogMarker.END_PHASE, result: BuildPhaseResult.UNKNOWN },\n `End phase: ${this.buildPhase}`\n );\n this.logger = this.defaultLogger;\n }\n }\n this.buildPhase = buildPhase;\n this.logger = this.defaultLogger.child({ phase: buildPhase });\n if (!doNotMarkStart) {\n this.logger.info({ marker: LogMarker.START_PHASE }, `Start phase: ${this.buildPhase}`);\n }\n }\n\n private endCurrentBuildPhase({\n result,\n doNotMarkEnd = false,\n }: {\n result: BuildPhaseResult;\n doNotMarkEnd?: boolean;\n }): void {\n if (!this.buildPhase) {\n return;\n }\n if (!doNotMarkEnd) {\n this.logger.info({ marker: LogMarker.END_PHASE, result }, `End phase: ${this.buildPhase}`);\n }\n this.logger = this.defaultLogger;\n this.buildPhase = undefined;\n this.buildPhaseSkipped = false;\n this.buildPhaseHasWarnings = false;\n }\n}\n"]}
|
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -23,10 +23,11 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
23
23
|
return result;
|
|
24
24
|
};
|
|
25
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
-
exports.SkipNativeBuildError = exports.BuildContext = exports.Builders = void 0;
|
|
26
|
+
exports.SkipNativeBuildError = exports.BuildContext = exports.ArtifactType = exports.Builders = void 0;
|
|
27
27
|
const Builders = __importStar(require("./builders"));
|
|
28
28
|
exports.Builders = Builders;
|
|
29
29
|
var context_1 = require("./context");
|
|
30
|
+
Object.defineProperty(exports, "ArtifactType", { enumerable: true, get: function () { return context_1.ArtifactType; } });
|
|
30
31
|
Object.defineProperty(exports, "BuildContext", { enumerable: true, get: function () { return context_1.BuildContext; } });
|
|
31
32
|
Object.defineProperty(exports, "SkipNativeBuildError", { enumerable: true, get: function () { return context_1.SkipNativeBuildError; } });
|
|
32
33
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,qDAAuC;AAE9B,4BAAQ;AAEjB,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,qDAAuC;AAE9B,4BAAQ;AAEjB,qCAOmB;AALjB,uGAAA,YAAY,OAAA;AACZ,uGAAA,YAAY,OAAA;AAGZ,+GAAA,oBAAoB,OAAA","sourcesContent":["import * as Builders from './builders';\n\nexport { Builders };\n\nexport {\n Artifacts,\n ArtifactType,\n BuildContext,\n CacheManager,\n LogBuffer,\n SkipNativeBuildError,\n} from './context';\n"]}
|
package/dist/ios/fastlane.js
CHANGED
|
@@ -13,19 +13,18 @@ const gymfile_1 = require("./gymfile");
|
|
|
13
13
|
const xcpretty_1 = require("./xcpretty");
|
|
14
14
|
const tvos_1 = require("./tvos");
|
|
15
15
|
async function runFastlaneGym(ctx, { scheme, buildConfiguration, credentials, entitlements, }) {
|
|
16
|
-
const logsDirectory = path_1.default.join(ctx.workingdir, 'logs');
|
|
17
16
|
await ensureGymfileExists(ctx, {
|
|
18
17
|
scheme,
|
|
19
18
|
buildConfiguration,
|
|
20
19
|
credentials,
|
|
21
|
-
logsDirectory,
|
|
20
|
+
logsDirectory: ctx.buildLogsDirectory,
|
|
22
21
|
entitlements,
|
|
23
22
|
});
|
|
24
23
|
if (ctx.skipNativeBuild) {
|
|
25
24
|
throw new context_1.SkipNativeBuildError('Skipping fastlane build');
|
|
26
25
|
}
|
|
27
26
|
const buildLogger = new xcpretty_1.XcodeBuildLogger(ctx.logger, ctx.reactNativeProjectDirectory);
|
|
28
|
-
void buildLogger.watchLogFiles(
|
|
27
|
+
void buildLogger.watchLogFiles(ctx.buildLogsDirectory);
|
|
29
28
|
try {
|
|
30
29
|
await runFastlane(['gym'], {
|
|
31
30
|
cwd: path_1.default.join(ctx.reactNativeProjectDirectory, 'ios'),
|
package/dist/ios/fastlane.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fastlane.js","sourceRoot":"","sources":["../../src/ios/fastlane.ts"],"names":[],"mappings":";;;;;;AAAA,gDAAwB;AAIxB,sEAAwD;AACxD,wDAA0B;AAC1B,4DAAoC;AAEpC,wCAAgE;AAEhE,uCAAyF;AAEzF,yCAA8C;AAC9C,iCAAgC;AAEzB,KAAK,UAAU,cAAc,CAClC,GAAuB,EACvB,EACE,MAAM,EACN,kBAAkB,EAClB,WAAW,EACX,YAAY,GAMb;IAED,MAAM,
|
|
1
|
+
{"version":3,"file":"fastlane.js","sourceRoot":"","sources":["../../src/ios/fastlane.ts"],"names":[],"mappings":";;;;;;AAAA,gDAAwB;AAIxB,sEAAwD;AACxD,wDAA0B;AAC1B,4DAAoC;AAEpC,wCAAgE;AAEhE,uCAAyF;AAEzF,yCAA8C;AAC9C,iCAAgC;AAEzB,KAAK,UAA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C,IAAI,CAAC,iBAAiB,CAAC,CAAC;AACrC,CAAC","sourcesContent":["import path from 'path';\n\nimport { Ios } from '@expo/eas-build-job';\nimport { bunyan } from '@expo/logger';\nimport spawn, { SpawnResult } from '@expo/turtle-spawn';\nimport fs from 'fs-extra';\nimport nullthrows from 'nullthrows';\n\nimport { BuildContext, SkipNativeBuildError } from '../context';\n\nimport { createGymfileForArchiveBuild, createGymfileForSimulatorBuild } from './gymfile';\nimport { Credentials } from './credentials/manager';\nimport { XcodeBuildLogger } from './xcpretty';\nimport { isTVOS } from './tvos';\n\nexport async function runFastlaneGym<TJob extends Ios.Job>(\n ctx: BuildContext<TJob>,\n {\n scheme,\n buildConfiguration,\n credentials,\n entitlements,\n }: {\n scheme: string;\n buildConfiguration?: string;\n credentials: Credentials | null;\n entitlements: object | null;\n }\n): Promise<void> {\n await ensureGymfileExists(ctx, {\n scheme,\n buildConfiguration,\n credentials,\n logsDirectory: ctx.buildLogsDirectory,\n entitlements,\n });\n if (ctx.skipNativeBuild) {\n throw new SkipNativeBuildError('Skipping fastlane build');\n }\n const buildLogger = new XcodeBuildLogger(ctx.logger, ctx.reactNativeProjectDirectory);\n void buildLogger.watchLogFiles(ctx.buildLogsDirectory);\n try {\n await runFastlane(['gym'], {\n cwd: path.join(ctx.reactNativeProjectDirectory, 'ios'),\n logger: ctx.logger,\n env: ctx.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\nasync function ensureGymfileExists<TJob extends Ios.Job>(\n ctx: BuildContext<TJob>,\n {\n scheme,\n buildConfiguration,\n credentials,\n logsDirectory,\n entitlements,\n }: {\n scheme: string;\n buildConfiguration?: string;\n credentials: Credentials | null;\n logsDirectory: string;\n entitlements: object | null;\n }\n): Promise<void> {\n const gymfilePath = path.join(ctx.reactNativeProjectDirectory, 'ios/Gymfile');\n\n if (await fs.pathExists(gymfilePath)) {\n ctx.logger.info('Gymfile already exists');\n return;\n }\n\n ctx.logger.info('Creating Gymfile');\n if (ctx.job.simulator) {\n const isTV = await isTVOS(ctx);\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 } else {\n await createGymfileForArchiveBuild({\n outputFile: gymfilePath,\n credentials: nullthrows(credentials, 'credentials must exist for non-simulator builds'),\n scheme,\n buildConfiguration,\n outputDirectory: './build',\n clean: false,\n logsDirectory,\n entitlements: entitlements ?? undefined,\n });\n }\n\n ctx.logger.info('Gymfile created');\n}\n"]}
|
package/dist/ios/resolve.js
CHANGED
|
@@ -16,8 +16,8 @@ function resolveScheme(ctx) {
|
|
|
16
16
|
}
|
|
17
17
|
exports.resolveScheme = resolveScheme;
|
|
18
18
|
function resolveArtifactPath(ctx) {
|
|
19
|
-
if (ctx.job.
|
|
20
|
-
return ctx.job.
|
|
19
|
+
if (ctx.job.applicationArchivePath) {
|
|
20
|
+
return ctx.job.applicationArchivePath;
|
|
21
21
|
}
|
|
22
22
|
else if (ctx.job.simulator) {
|
|
23
23
|
return 'ios/build/Build/Products/*simulator/*.app';
|
package/dist/ios/resolve.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resolve.js","sourceRoot":"","sources":["../../src/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ACpD;SAAM;QACL,OAAO,iBAAiB,CAAC;KAC1B;AACH,CAAC;AARD,kDAQC;AAED,SAAgB,yBAAyB,CAAC,GAA0B;IAClE,IAAI,GAAG,CAAC,GAAG,CAAC,kBAAkB,EAAE;QAC9B,OAAO,GAAG,CAAC,GAAG,CAAC,kBAAkB,CAAC;KACnC;SAAM,IAAI,GAAG,CAAC,GAAG,CAAC,iBAAiB,EAAE;QACpC,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\nimport { BuildContext } from '../context';\n\nexport function resolveScheme(ctx: BuildContext<Ios.Job>): string {\n if (ctx.job.scheme) {\n return ctx.job.scheme;\n }\n const schemes = IOSConfig.BuildScheme.getSchemesFromXcodeproj(ctx.reactNativeProjectDirectory);\n assert(schemes.length === 1, 'Ejected project should have exactly one scheme');\n return schemes[0];\n}\n\nexport function resolveArtifactPath(ctx: BuildContext<Ios.Job>): string {\n if (ctx.job.applicationArchivePath) {\n return ctx.job.applicationArchivePath;\n } else if (ctx.job.simulator) {\n return 'ios/build/Build/Products/*simulator/*.app';\n } else {\n return 'ios/build/*.ipa';\n }\n}\n\nexport function resolveBuildConfiguration(ctx: BuildContext<Ios.Job>): string {\n if (ctx.job.buildConfiguration) {\n return ctx.job.buildConfiguration;\n } else if (ctx.job.developmentClient) {\n return 'Debug';\n } else {\n return 'Release';\n }\n}\n"]}
|
|
@@ -0,0 +1,32 @@
|
|
|
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.findAndUploadXcodeBuildLogsAsync = void 0;
|
|
7
|
+
const os_1 = __importDefault(require("os"));
|
|
8
|
+
const path_1 = __importDefault(require("path"));
|
|
9
|
+
const fast_glob_1 = __importDefault(require("fast-glob"));
|
|
10
|
+
const context_1 = require("../context");
|
|
11
|
+
async function findAndUploadXcodeBuildLogsAsync(ctx) {
|
|
12
|
+
try {
|
|
13
|
+
const xcodeBuildLogsPath = await findXcodeBuildLogsPathAsync(ctx);
|
|
14
|
+
if (xcodeBuildLogsPath) {
|
|
15
|
+
await ctx.uploadArtifacts(context_1.ArtifactType.XCODE_BUILD_LOGS, [xcodeBuildLogsPath], ctx.logger);
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
catch (err) {
|
|
19
|
+
ctx.logger.debug({ err }, 'Failed to upload Xcode build logs');
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
exports.findAndUploadXcodeBuildLogsAsync = findAndUploadXcodeBuildLogsAsync;
|
|
23
|
+
async function findXcodeBuildLogsPathAsync(ctx) {
|
|
24
|
+
var _a, _b;
|
|
25
|
+
const customLogPaths = (await (0, fast_glob_1.default)('*.log', { cwd: ctx.buildLogsDirectory })).map((filename) => path_1.default.join(ctx.buildLogsDirectory, filename));
|
|
26
|
+
if (customLogPaths[0]) {
|
|
27
|
+
return customLogPaths[0];
|
|
28
|
+
}
|
|
29
|
+
const fallbackLogPaths = (await (0, fast_glob_1.default)('Library/Logs/gym/*.log', { cwd: os_1.default.homedir() })).map((relativePath) => path_1.default.join(os_1.default.homedir(), relativePath));
|
|
30
|
+
return (_b = (_a = customLogPaths[0]) !== null && _a !== void 0 ? _a : fallbackLogPaths[0]) !== null && _b !== void 0 ? _b : undefined;
|
|
31
|
+
}
|
|
32
|
+
//# sourceMappingURL=xcodeBuildLogs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"xcodeBuildLogs.js","sourceRoot":"","sources":["../../src/ios/xcodeBuildLogs.ts"],"names":[],"mappings":";;;;;;AAAA,4CAAoB;AACpB,gDAAwB;AAGxB,0DAA2B;AAE3B,wCA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build-job';\nimport fg from 'fast-glob';\n\nimport { ArtifactType, BuildContext } from '../context';\n\nexport async function findAndUploadXcodeBuildLogsAsync(ctx: BuildContext<Ios.Job>): Promise<void> {\n try {\n const xcodeBuildLogsPath = await findXcodeBuildLogsPathAsync(ctx);\n if (xcodeBuildLogsPath) {\n await ctx.uploadArtifacts(ArtifactType.XCODE_BUILD_LOGS, [xcodeBuildLogsPath], ctx.logger);\n }\n } catch (err: any) {\n ctx.logger.debug({ err }, 'Failed to upload Xcode build logs');\n }\n}\n\nasync function findXcodeBuildLogsPathAsync(\n ctx: BuildContext<Ios.Job>\n): Promise<string | undefined> {\n const customLogPaths = (await fg('*.log', { cwd: ctx.buildLogsDirectory })).map((filename) =>\n path.join(ctx.buildLogsDirectory, filename)\n );\n if (customLogPaths[0]) {\n return customLogPaths[0];\n }\n const fallbackLogPaths = (\n await fg('Library/Logs/gym/*.log', { cwd: os.homedir() })\n ).map((relativePath) => path.join(os.homedir(), relativePath));\n\n return customLogPaths[0] ?? fallbackLogPaths[0] ?? undefined;\n}\n"]}
|
|
@@ -3,15 +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.findArtifacts = void 0;
|
|
7
7
|
const path_1 = __importDefault(require("path"));
|
|
8
8
|
const fs_extra_1 = __importDefault(require("fs-extra"));
|
|
9
9
|
const fast_glob_1 = __importDefault(require("fast-glob"));
|
|
10
|
-
async function
|
|
10
|
+
async function findArtifacts(rootDir, patternOrPath, buildLogger) {
|
|
11
11
|
const files = await (0, fast_glob_1.default)(patternOrPath, { cwd: rootDir, onlyFiles: false });
|
|
12
12
|
if (files.length === 0) {
|
|
13
13
|
if (fast_glob_1.default.isDynamicPattern(patternOrPath)) {
|
|
14
|
-
throw new Error(`There are no files matching pattern
|
|
14
|
+
throw new Error(`There are no files matching pattern "${patternOrPath}"`);
|
|
15
15
|
}
|
|
16
16
|
else {
|
|
17
17
|
await logMissingFileError(path_1.default.join(rootDir, patternOrPath), buildLogger);
|
|
@@ -20,7 +20,7 @@ async function findBuildArtifacts(rootDir, patternOrPath, buildLogger) {
|
|
|
20
20
|
}
|
|
21
21
|
return files.map((relativePath) => path_1.default.join(rootDir, relativePath));
|
|
22
22
|
}
|
|
23
|
-
exports.
|
|
23
|
+
exports.findArtifacts = findArtifacts;
|
|
24
24
|
async function logMissingFileError(artifactPath, buildLogger) {
|
|
25
25
|
let currentPath = artifactPath;
|
|
26
26
|
while (!(await fs_extra_1.default.pathExists(currentPath))) {
|
|
@@ -38,4 +38,4 @@ async function logMissingFileError(artifactPath, buildLogger) {
|
|
|
38
38
|
buildLogger.error(`There is no such file or directory "${artifactPath}". Directory "${currentPath}" contains [${dirContent.join(', ')}].`);
|
|
39
39
|
}
|
|
40
40
|
}
|
|
41
|
-
//# sourceMappingURL=
|
|
41
|
+
//# sourceMappingURL=artifacts.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"artifacts.js","sourceRoot":"","sources":["../../src/utils/artifacts.ts"],"names":[],"mappings":";;;;;;AAAA,gDAAwB;AAExB,wDAA0B;AAC1B,0DAA2B;AAGpB,KAAK,UAAU,aAAa,CACjC,OAAe,EACf,aAAqB,EACrB,WAAmB;IAEnB,MAAM,KAAK,GAAG,MAAM,IAAA,mBAAE,EAAC,aAAa,EAAE,EAAE,GAAG,EAAE,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC,CAAC;IAC1E,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC,EAAE;QACtB,IAAI,mBAAE,CAAC,gBAAgB,CAAC,aAAa,CAAC,EAAE;YACtC,MAAM,IAAI,KAAK,CAAC,wCAAwC,aAAa,GAAG,CAAC,CAAC;SAC3E;aAAM;YACL,MAAM,mBAAmB,CAAC,cAAI,CAAC,IAAI,CAAC,OAAO,EAAE,aAAa,CAAC,EAAE,WAAW,CAAC,CAAC;YAC1E,MAAM,IAAI,KAAK,CAAC,6BAA6B,aAAa,EAAE,CAAC,CAAC;SAC/D;KACF;IACD,OAAO,KAAK,CAAC,GAAG,CAAC,CAAC,YAAY,EAAE,EAAE,CAAC,cAAI,CAAC,IAAI,CAAC,OAAO,EAAE,YAAY,CAAC,CAAC,CAAC;AACvE,CAAC;AAfD,sCAeC;AAED,KAAK,UAAU,mBAAmB,CAAC,YAAoB,EAAE,WAAmB;IAC1E,IAAI,WAAW,GAAG,YAAY,CAAC;IAC/B,OAAO,CAAC,CAAC,MAAM,kBAAE,CAAC,UAAU,CAAC,WAAW,CAAC,CAAC,EAAE;QAC1C,WAAW,GAAG,cAAI,CAAC,OAAO,CAAC,WAAW,EAAE,IAAI,CAAC,CAAC;KAC/C;IACD,IAAI,WAAW,KAAK,cAAI,CAAC,OAAO,CAAC,WAAW,EAAE,IAAI,CAAC,EAAE;QACnD,WAAW,CAAC,KAAK,CAAC,uCAAuC,YAAY,IAAI,CAAC,CAAC;QAC3E,OAAO;KACR;IACD,MAAM,UAAU,GAAG,MAAM,kBAAE,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC;IACjD,IAAI,UAAU,CAAC,MAAM,KAAK,CAAC,EAAE;QAC3B,WAAW,CAAC,KAAK,CACf,uCAAuC,YAAY,iBAAiB,WAAW,aAAa,CAC7F,CAAC;KACH;SAAM;QACL,WAAW,CAAC,KAAK,CACf,uCAAuC,YAAY,iBAAiB,WAAW,eAAe,UAAU,CAAC,IAAI,CAC3G,IAAI,CACL,IAAI,CACN,CAAC;KACH;AACH,CAAC","sourcesContent":["import path from 'path';\n\nimport fs from 'fs-extra';\nimport fg from 'fast-glob';\nimport { bunyan } from '@expo/logger';\n\nexport async function findArtifacts(\n rootDir: string,\n patternOrPath: string,\n buildLogger: bunyan\n): Promise<string[]> {\n const files = await fg(patternOrPath, { cwd: rootDir, onlyFiles: false });\n if (files.length === 0) {\n if (fg.isDynamicPattern(patternOrPath)) {\n throw new Error(`There are no files matching pattern \"${patternOrPath}\"`);\n } else {\n await logMissingFileError(path.join(rootDir, patternOrPath), buildLogger);\n throw new Error(`No such file or directory ${patternOrPath}`);\n }\n }\n return files.map((relativePath) => path.join(rootDir, relativePath));\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"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@expo/build-tools",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.147",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"types": "dist/index.d.ts",
|
|
6
6
|
"files": [
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
"@expo/config": "7.0.1",
|
|
23
23
|
"@expo/config-plugins": "5.0.1",
|
|
24
24
|
"@expo/downloader": "0.0.21",
|
|
25
|
-
"@expo/eas-build-job": "0.2.
|
|
25
|
+
"@expo/eas-build-job": "0.2.89",
|
|
26
26
|
"@expo/logger": "0.0.24",
|
|
27
27
|
"@expo/package-manager": "0.0.54",
|
|
28
28
|
"@expo/plist": "^0.0.11",
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"buildArtifacts.js","sourceRoot":"","sources":["../../src/utils/buildArtifacts.ts"],"names":[],"mappings":";;;;;;AAAA,gDAAwB;AAExB,wD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KAAK,CAAC,EAAE;QAC3B,WAAW,CAAC,KAAK,CACf,uCAAuC,YAAY,iBAAiB,WAAW,aAAa,CAC7F,CAAC;KACH;SAAM;QACL,WAAW,CAAC,KAAK,CACf,uCAAuC,YAAY,iBAAiB,WAAW,eAAe,UAAU,CAAC,IAAI,CAC3G,IAAI,CACL,IAAI,CACN,CAAC;KACH;AACH,CAAC","sourcesContent":["import path from 'path';\n\nimport fs from 'fs-extra';\nimport fg from 'fast-glob';\nimport { bunyan } from '@expo/logger';\n\nexport async function findBuildArtifacts(\n rootDir: string,\n patternOrPath: string,\n buildLogger: bunyan\n): Promise<string[]> {\n const files = await fg(patternOrPath, { cwd: rootDir, onlyFiles: false });\n if (files.length === 0) {\n if (fg.isDynamicPattern(patternOrPath)) {\n throw new Error(`There are no files matching pattern: ${patternOrPath}`);\n } else {\n await logMissingFileError(path.join(rootDir, patternOrPath), buildLogger);\n throw new Error(`No such file or directory ${patternOrPath}`);\n }\n }\n return files.map((relativePath) => path.join(rootDir, relativePath));\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"]}
|