@expo/build-tools 0.1.149 → 0.1.151
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/buildErrors/buildErrorHandlers.d.ts +7 -0
- package/dist/buildErrors/buildErrorHandlers.js +85 -0
- package/dist/buildErrors/buildErrorHandlers.js.map +1 -0
- package/dist/buildErrors/detectError.d.ts +3 -0
- package/dist/buildErrors/detectError.js +54 -0
- package/dist/buildErrors/detectError.js.map +1 -0
- package/dist/buildErrors/errors.types.d.ts +12 -0
- package/dist/buildErrors/errors.types.js +3 -0
- package/dist/buildErrors/errors.types.js.map +1 -0
- package/dist/buildErrors/userErrorHandlers.d.ts +4 -0
- package/dist/{utils/detectUserError.js → buildErrors/userErrorHandlers.js} +38 -44
- package/dist/buildErrors/userErrorHandlers.js.map +1 -0
- package/dist/builders/android.js +1 -12
- package/dist/builders/android.js.map +1 -1
- package/dist/builders/ios.js +1 -12
- package/dist/builders/ios.js.map +1 -1
- package/dist/context.d.ts +4 -2
- package/dist/context.js +47 -29
- package/dist/context.js.map +1 -1
- package/dist/utils/environmentSecrets.d.ts +1 -0
- package/dist/utils/environmentSecrets.js +16 -0
- package/dist/utils/environmentSecrets.js.map +1 -0
- package/dist/utils/project.js +1 -2
- package/dist/utils/project.js.map +1 -1
- package/package.json +2 -2
- package/dist/utils/detectUserError.d.ts +0 -7
- package/dist/utils/detectUserError.js.map +0 -1
- package/dist/utils/handleNpmError.d.ts +0 -3
- package/dist/utils/handleNpmError.js +0 -32
- package/dist/utils/handleNpmError.js.map +0 -1
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { ErrorHandler } from './errors.types';
|
|
2
|
+
export declare class TrackedBuildError extends Error {
|
|
3
|
+
errorCode: string;
|
|
4
|
+
message: string;
|
|
5
|
+
constructor(errorCode: string, message: string);
|
|
6
|
+
}
|
|
7
|
+
export declare const buildErrorHandlers: ErrorHandler<TrackedBuildError>[];
|
|
@@ -0,0 +1,85 @@
|
|
|
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.buildErrorHandlers = exports.TrackedBuildError = void 0;
|
|
7
|
+
const eas_build_job_1 = require("@expo/eas-build-job");
|
|
8
|
+
const escapeRegExp_1 = __importDefault(require("lodash/escapeRegExp"));
|
|
9
|
+
class TrackedBuildError extends Error {
|
|
10
|
+
constructor(errorCode, message) {
|
|
11
|
+
super(message);
|
|
12
|
+
this.errorCode = errorCode;
|
|
13
|
+
this.message = message;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
exports.TrackedBuildError = TrackedBuildError;
|
|
17
|
+
exports.buildErrorHandlers = [
|
|
18
|
+
{
|
|
19
|
+
platform: eas_build_job_1.Platform.IOS,
|
|
20
|
+
phase: eas_build_job_1.BuildPhase.INSTALL_PODS,
|
|
21
|
+
// example log:
|
|
22
|
+
// CDN: trunk URL couldn't be downloaded: https://cdn.jsdelivr.net/cocoa/Specs/2/a/e/MultiplatformBleAdapter/0.0.3/MultiplatformBleAdapter.podspec.json Response: 429 429: Too Many Requests
|
|
23
|
+
regexp: /CDN: trunk URL couldn't be downloaded.* Response: 429 429: Too Many Requests/,
|
|
24
|
+
createError: () => new TrackedBuildError('COCOAPODS_TO_MANY_REQUEST', 'cocoapods: too many requests'),
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
phase: eas_build_job_1.BuildPhase.PREBUILD,
|
|
28
|
+
regexp: /Input is required, but Expo CLI is in non-interactive mode/,
|
|
29
|
+
createError: () => new TrackedBuildError('EXPO_CLI_INPUT_REQUIRED_ERROR', `expo-cli: input required in non-interactive mode`),
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
platform: eas_build_job_1.Platform.IOS,
|
|
33
|
+
phase: eas_build_job_1.BuildPhase.PREBUILD,
|
|
34
|
+
// [03:03:05] [ios.infoPlist]: withIosInfoPlistBaseMod: GoogleService-Info.plist is empty
|
|
35
|
+
regexp: /withIosInfoPlistBaseMod: GoogleService-Info\.plist is empty/,
|
|
36
|
+
createError: () => new TrackedBuildError('EXPO_CLI_EMPTY_GOOGLE_SERVICES_PLIST_ERROR', `expo-cli: empty GoogleService-Info.plist`),
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
platform: eas_build_job_1.Platform.IOS,
|
|
40
|
+
phase: eas_build_job_1.BuildPhase.PREBUILD,
|
|
41
|
+
// [01:52:04] [ios.xcodeproj]: withIosXcodeprojBaseMod: Path to GoogleService-Info.plist is not defined. Please specify the `expo.ios.googleServicesFile` field in app.json.
|
|
42
|
+
regexp: /withIosXcodeprojBaseMod: Path to GoogleService-Info\.plist is not defined/,
|
|
43
|
+
createError: () => new TrackedBuildError('EXPO_CLI_NOT_DEFINED_GOOGLE_SERVICES_PLIST_ERROR', `expo-cli: path to GoogleService-Info.plist not defined`),
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
platform: eas_build_job_1.Platform.IOS,
|
|
47
|
+
phase: eas_build_job_1.BuildPhase.INSTALL_PODS,
|
|
48
|
+
// Adding spec repo `24-repository-cocoapods-proxy` with CDN `http://10.254.24.7:8081/repository/cocoapods-proxy/`
|
|
49
|
+
// [!] No podspec exists at path `/Users/expo/.cocoapods/repos/24-repository-cocoapods-proxy/Specs/1/9/2/libwebp/1.2.0/libwebp.podspec.json`.
|
|
50
|
+
regexp: /Adding spec repo .* with CDN .*\n\s*\[!\] No podspec exists at path `(.*)`/,
|
|
51
|
+
// Some pods are hosted on git registries that are not supported e.g. chromium.googlesource.com
|
|
52
|
+
createError: (match) => new TrackedBuildError('COCOAPODS_CACHE_INCOMPATIBLE_REPO_ERROR', `cocoapods: missing podspec ${match[1]}`),
|
|
53
|
+
},
|
|
54
|
+
...[eas_build_job_1.BuildPhase.INSTALL_DEPENDENCIES, eas_build_job_1.BuildPhase.PREBUILD].map((phase) => ({
|
|
55
|
+
phase,
|
|
56
|
+
// example log:
|
|
57
|
+
// [stderr] WARN tarball tarball data for @typescript-eslint/typescript-estree@5.26.0 (sha512-cozo/GbwixVR0sgfHItz3t1yXu521yn71Wj6PlYCFA3WPhy51CUPkifFKfBis91bDclGmAY45hhaAXVjdn4new==) seems to be corrupted. Trying again.
|
|
58
|
+
regexp: /tarball tarball data for ([^ ]*) .* seems to be corrupted. Trying again/,
|
|
59
|
+
createError: (match) => new TrackedBuildError('NPM_CORRUPTED_PACKAGE', `npm: corrupted package ${match[1]}`),
|
|
60
|
+
})),
|
|
61
|
+
...[eas_build_job_1.BuildPhase.INSTALL_DEPENDENCIES, eas_build_job_1.BuildPhase.PREBUILD].map((phase) => ({
|
|
62
|
+
phase,
|
|
63
|
+
regexp: ({ env }) => env.EAS_BUILD_NPM_CACHE_URL
|
|
64
|
+
? new RegExp((0, escapeRegExp_1.default)(env.EAS_BUILD_NPM_CACHE_URL))
|
|
65
|
+
: undefined,
|
|
66
|
+
createError: () => new TrackedBuildError('NPM_CACHE_ERROR', `npm: cache error`),
|
|
67
|
+
})),
|
|
68
|
+
{
|
|
69
|
+
platform: eas_build_job_1.Platform.ANDROID,
|
|
70
|
+
phase: eas_build_job_1.BuildPhase.RUN_GRADLEW,
|
|
71
|
+
regexp: ({ env }) => env.EAS_BUILD_MAVEN_CACHE_URL
|
|
72
|
+
? new RegExp((0, escapeRegExp_1.default)(env.EAS_BUILD_MAVEN_CACHE_URL))
|
|
73
|
+
: undefined,
|
|
74
|
+
createError: () => new TrackedBuildError('MAVEN_CACHE_ERROR', `maven: cache error`),
|
|
75
|
+
},
|
|
76
|
+
{
|
|
77
|
+
platform: eas_build_job_1.Platform.IOS,
|
|
78
|
+
phase: eas_build_job_1.BuildPhase.INSTALL_PODS,
|
|
79
|
+
regexp: ({ env }) => env.EAS_BUILD_COCOAPODS_CACHE_URL
|
|
80
|
+
? new RegExp((0, escapeRegExp_1.default)(env.EAS_BUILD_COCOAPODS_CACHE_URL))
|
|
81
|
+
: undefined,
|
|
82
|
+
createError: () => new TrackedBuildError('COCOAPODS_CACHE_ERROR', `cocoapods: cache error`),
|
|
83
|
+
},
|
|
84
|
+
];
|
|
85
|
+
//# sourceMappingURL=buildErrorHandlers.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"buildErrorHandlers.js","sourceRoot":"","sources":["../../src/buildErrors/buildErrorHandlers.ts"],"names":[],"mappings":";;;;;;AAAA,uDAA2D;AAC3D,uEAA+C;AAI/C,MAAa,iBAAkB,SAAQ,KAAK;IAC1C,YAAmB,SAAiB,EAAS,OAAe;QAC1D,KAAK,CAAC,OAAO,CAAC,CAAC;QADE,cAAS,GAAT,SAAS,CAAQ;QAAS,YAAO,GAAP,OAAO,CAAQ;IAE5D,CAAC;CACF;AAJD,8CAIC;AAEY,QAAA,kBAAkB,GAAsC;IACnE;QACE,QAAQ,EAAE,wBAAQ,CAAC,GAAG;QACtB,KAAK,EAAE,0BAAU,CAAC,YAAY;QAC9B,eAAe;QACf,4LAA4L;QAC5L,MAAM,EAAE,8EAA8E;QACtF,WAAW,EAAE,GAAG,EAAE,CAChB,IAAI,iBAAiB,CAAC,2BAA2B,EAAE,8BAA8B,CAAC;KACrF;IACD;QACE,KAAK,EAAE,0BAAU,CAAC,QAAQ;QAC1B,MAAM,EAAE,4DAA4D;QACpE,WAAW,EAAE,GAAG,EAAE,CAChB,IAAI,iBAAiB,CACnB,+BAA+B,EAC/B,kDAAkD,CACnD;KACJ;IACD;QACE,QAAQ,EAAE,wBAAQ,CAAC,GAAG;QACtB,KAAK,EAAE,0BAAU,CAAC,QAAQ;QAC1B,yFAAyF;QACzF,MAAM,EAAE,6DAA6D;QACrE,WAAW,EAAE,GAAG,EAAE,CAChB,IAAI,iBAAiB,CACnB,4CAA4C,EAC5C,0CAA0C,CAC3C;KACJ;IACD;QACE,QAAQ,EAAE,wBAAQ,CAAC,GAAG;QACtB,KA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AAQ,EAAE,wBAAQ,CAAC,OAAO;QAC1B,KAAK,EAAE,0BAAU,CAAC,WAAW;QAC7B,MAAM,EAAE,CAAC,EAAE,GAAG,EAAgB,EAAE,EAAE,CAChC,GAAG,CAAC,yBAAyB;YAC3B,CAAC,CAAC,IAAI,MAAM,CAAC,IAAA,sBAAY,EAAC,GAAG,CAAC,yBAAyB,CAAC,CAAC;YACzD,CAAC,CAAC,SAAS;QACf,WAAW,EAAE,GAAG,EAAE,CAAC,IAAI,iBAAiB,CAAC,mBAAmB,EAAE,oBAAoB,CAAC;KACpF;IACD;QACE,QAAQ,EAAE,wBAAQ,CAAC,GAAG;QACtB,KAAK,EAAE,0BAAU,CAAC,YAAY;QAC9B,MAAM,EAAE,CAAC,EAAE,GAAG,EAAgB,EAAE,EAAE,CAChC,GAAG,CAAC,6BAA6B;YAC/B,CAAC,CAAC,IAAI,MAAM,CAAC,IAAA,sBAAY,EAAC,GAAG,CAAC,6BAA6B,CAAC,CAAC;YAC7D,CAAC,CAAC,SAAS;QACf,WAAW,EAAE,GAAG,EAAE,CAAC,IAAI,iBAAiB,CAAC,uBAAuB,EAAE,wBAAwB,CAAC;KAC5F;CACF,CAAC","sourcesContent":["import { BuildPhase, Platform } from '@expo/eas-build-job';\nimport escapeRegExp from 'lodash/escapeRegExp';\n\nimport { ErrorContext, ErrorHandler } from './errors.types';\n\nexport class TrackedBuildError extends Error {\n constructor(public errorCode: string, public message: string) {\n super(message);\n }\n}\n\nexport const buildErrorHandlers: ErrorHandler<TrackedBuildError>[] = [\n {\n platform: Platform.IOS,\n phase: BuildPhase.INSTALL_PODS,\n // example log:\n // CDN: trunk URL couldn't be downloaded: https://cdn.jsdelivr.net/cocoa/Specs/2/a/e/MultiplatformBleAdapter/0.0.3/MultiplatformBleAdapter.podspec.json Response: 429 429: Too Many Requests\n regexp: /CDN: trunk URL couldn't be downloaded.* Response: 429 429: Too Many Requests/,\n createError: () =>\n new TrackedBuildError('COCOAPODS_TO_MANY_REQUEST', 'cocoapods: too many requests'),\n },\n {\n phase: BuildPhase.PREBUILD,\n regexp: /Input is required, but Expo CLI is in non-interactive mode/,\n createError: () =>\n new TrackedBuildError(\n 'EXPO_CLI_INPUT_REQUIRED_ERROR',\n `expo-cli: input required in non-interactive mode`\n ),\n },\n {\n platform: Platform.IOS,\n phase: BuildPhase.PREBUILD,\n // [03:03:05] [ios.infoPlist]: withIosInfoPlistBaseMod: GoogleService-Info.plist is empty\n regexp: /withIosInfoPlistBaseMod: GoogleService-Info\\.plist is empty/,\n createError: () =>\n new TrackedBuildError(\n 'EXPO_CLI_EMPTY_GOOGLE_SERVICES_PLIST_ERROR',\n `expo-cli: empty GoogleService-Info.plist`\n ),\n },\n {\n platform: Platform.IOS,\n phase: BuildPhase.PREBUILD,\n // [01:52:04] [ios.xcodeproj]: withIosXcodeprojBaseMod: Path to GoogleService-Info.plist is not defined. Please specify the `expo.ios.googleServicesFile` field in app.json.\n regexp: /withIosXcodeprojBaseMod: Path to GoogleService-Info\\.plist is not defined/,\n createError: () =>\n new TrackedBuildError(\n 'EXPO_CLI_NOT_DEFINED_GOOGLE_SERVICES_PLIST_ERROR',\n `expo-cli: path to GoogleService-Info.plist not defined`\n ),\n },\n {\n platform: Platform.IOS,\n phase: BuildPhase.INSTALL_PODS,\n // Adding spec repo `24-repository-cocoapods-proxy` with CDN `http://10.254.24.7:8081/repository/cocoapods-proxy/`\n // [!] No podspec exists at path `/Users/expo/.cocoapods/repos/24-repository-cocoapods-proxy/Specs/1/9/2/libwebp/1.2.0/libwebp.podspec.json`.\n regexp: /Adding spec repo .* with CDN .*\\n\\s*\\[!\\] No podspec exists at path `(.*)`/,\n // Some pods are hosted on git registries that are not supported e.g. chromium.googlesource.com\n createError: (match: RegExpMatchArray) =>\n new TrackedBuildError(\n 'COCOAPODS_CACHE_INCOMPATIBLE_REPO_ERROR',\n `cocoapods: missing podspec ${match[1]}`\n ),\n },\n ...[BuildPhase.INSTALL_DEPENDENCIES, BuildPhase.PREBUILD].map((phase) => ({\n phase,\n // example log:\n // [stderr] WARN tarball tarball data for @typescript-eslint/typescript-estree@5.26.0 (sha512-cozo/GbwixVR0sgfHItz3t1yXu521yn71Wj6PlYCFA3WPhy51CUPkifFKfBis91bDclGmAY45hhaAXVjdn4new==) seems to be corrupted. Trying again.\n regexp: /tarball tarball data for ([^ ]*) .* seems to be corrupted. Trying again/,\n createError: (match: RegExpMatchArray) =>\n new TrackedBuildError('NPM_CORRUPTED_PACKAGE', `npm: corrupted package ${match[1]}`),\n })),\n ...[BuildPhase.INSTALL_DEPENDENCIES, BuildPhase.PREBUILD].map((phase) => ({\n phase,\n regexp: ({ env }: ErrorContext) =>\n env.EAS_BUILD_NPM_CACHE_URL\n ? new RegExp(escapeRegExp(env.EAS_BUILD_NPM_CACHE_URL))\n : undefined,\n createError: () => new TrackedBuildError('NPM_CACHE_ERROR', `npm: cache error`),\n })),\n {\n platform: Platform.ANDROID,\n phase: BuildPhase.RUN_GRADLEW,\n regexp: ({ env }: ErrorContext) =>\n env.EAS_BUILD_MAVEN_CACHE_URL\n ? new RegExp(escapeRegExp(env.EAS_BUILD_MAVEN_CACHE_URL))\n : undefined,\n createError: () => new TrackedBuildError('MAVEN_CACHE_ERROR', `maven: cache error`),\n },\n {\n platform: Platform.IOS,\n phase: BuildPhase.INSTALL_PODS,\n regexp: ({ env }: ErrorContext) =>\n env.EAS_BUILD_COCOAPODS_CACHE_URL\n ? new RegExp(escapeRegExp(env.EAS_BUILD_COCOAPODS_CACHE_URL))\n : undefined,\n createError: () => new TrackedBuildError('COCOAPODS_CACHE_ERROR', `cocoapods: cache error`),\n },\n];\n"]}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.resolveBuildPhaseError = void 0;
|
|
4
|
+
const eas_build_job_1 = require("@expo/eas-build-job");
|
|
5
|
+
const userErrorHandlers_1 = require("./userErrorHandlers");
|
|
6
|
+
const buildErrorHandlers_1 = require("./buildErrorHandlers");
|
|
7
|
+
function resolveError(errorHandlers, logLines, errorContext) {
|
|
8
|
+
const { job, phase } = errorContext;
|
|
9
|
+
const { platform } = job;
|
|
10
|
+
const logs = logLines.join('\n');
|
|
11
|
+
const handlers = errorHandlers
|
|
12
|
+
.filter((handler) => handler.platform === platform || !handler.platform)
|
|
13
|
+
.filter((handler) => handler.phase === phase || !handler.phase);
|
|
14
|
+
for (const handler of handlers) {
|
|
15
|
+
const regexp = typeof handler.regexp === 'function' ? handler.regexp(errorContext) : handler.regexp;
|
|
16
|
+
if (!regexp) {
|
|
17
|
+
continue;
|
|
18
|
+
}
|
|
19
|
+
const match = logs.match(regexp);
|
|
20
|
+
if (match) {
|
|
21
|
+
return handler.createError(match, errorContext);
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
return undefined;
|
|
25
|
+
}
|
|
26
|
+
function resolveBuildPhaseError(error, logLines, errorContext) {
|
|
27
|
+
var _a, _b, _c;
|
|
28
|
+
const { phase } = errorContext;
|
|
29
|
+
if (error instanceof eas_build_job_1.errors.BuildError) {
|
|
30
|
+
return error;
|
|
31
|
+
}
|
|
32
|
+
const userFacingError = error instanceof eas_build_job_1.errors.UserFacingError
|
|
33
|
+
? error
|
|
34
|
+
: (_a = resolveError(userErrorHandlers_1.userErrorHandlers, logLines, errorContext)) !== null && _a !== void 0 ? _a : new eas_build_job_1.errors.UnknownError();
|
|
35
|
+
const buildError = resolveError(buildErrorHandlers_1.buildErrorHandlers, logLines, errorContext);
|
|
36
|
+
const isUnknownUserError = !userFacingError ||
|
|
37
|
+
[
|
|
38
|
+
eas_build_job_1.errors.ErrorCode.UNKNOWN_ERROR,
|
|
39
|
+
eas_build_job_1.errors.ErrorCode.UNKNOWN_GRADLE_ERROR,
|
|
40
|
+
eas_build_job_1.errors.ErrorCode.UNKNOWN_FASTLANE_ERROR,
|
|
41
|
+
].includes(userFacingError.errorCode);
|
|
42
|
+
const message = (_b = (isUnknownUserError ? buildError === null || buildError === void 0 ? void 0 : buildError.message : userFacingError.message)) !== null && _b !== void 0 ? _b : userFacingError.message;
|
|
43
|
+
const errorCode = (_c = (isUnknownUserError ? buildError === null || buildError === void 0 ? void 0 : buildError.errorCode : userFacingError.errorCode)) !== null && _c !== void 0 ? _c : userFacingError.errorCode;
|
|
44
|
+
return new eas_build_job_1.errors.BuildError(message, {
|
|
45
|
+
errorCode,
|
|
46
|
+
userFacingErrorCode: userFacingError.errorCode,
|
|
47
|
+
userFacingMessage: userFacingError.message,
|
|
48
|
+
docsUrl: userFacingError.docsUrl,
|
|
49
|
+
innerError: error,
|
|
50
|
+
buildPhase: phase,
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
exports.resolveBuildPhaseError = resolveBuildPhaseError;
|
|
54
|
+
//# sourceMappingURL=detectError.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"detectError.js","sourceRoot":"","sources":["../../src/buildErrors/detectError.ts"],"names":[],"mappings":";;;AAAA,uDAA6C;AAG7C,2DAAwD;AACxD,6DAA0D;AAE1D,SAAS,YAAY,CACnB,aAAgC,EAChC,QAAkB,EAClB,YAA0B;IAE1B,MAAM,EAAE,GAAG,EAAE,KAAK,EAAE,GAAG,YAAY,CAAC;IACpC,MAAM,EAAE,QAAQ,EAAE,GAAG,GAAG,CAAC;IACzB,MAAM,IAAI,GAAG,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACjC,MAAM,QAAQ,GAAG,aAAa;SAC3B,MAAM,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,QAAQ,KAAK,QAAQ,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC;SACvE,MAAM,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,KAAK,KAAK,KAAK,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;IAClE,KAAK,MAAM,OAAO,IAAI,QAAQ,EAAE;QAC9B,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I,eAAe,CAAC,OAAO,CAAC;IAClG,MAAM,SAAS,GACb,MAAA,CAAC,kBAAkB,CAAC,CAAC,CAAC,UAAU,aAAV,UAAU,uBAAV,UAAU,CAAE,SAAS,CAAC,CAAC,CAAC,eAAe,CAAC,SAAS,CAAC,mCACxE,eAAe,CAAC,SAAS,CAAC;IAE5B,OAAO,IAAI,sBAAM,CAAC,UAAU,CAAC,OAAO,EAAE;QACpC,SAAS;QACT,mBAAmB,EAAE,eAAe,CAAC,SAAS;QAC9C,iBAAiB,EAAE,eAAe,CAAC,OAAO;QAC1C,OAAO,EAAE,eAAe,CAAC,OAAO;QAChC,UAAU,EAAE,KAAK;QACjB,UAAU,EAAE,KAAK;KAClB,CAAC,CAAC;AACL,CAAC;AApCD,wDAoCC","sourcesContent":["import { errors } from '@expo/eas-build-job';\n\nimport { ErrorContext, ErrorHandler } from './errors.types';\nimport { userErrorHandlers } from './userErrorHandlers';\nimport { buildErrorHandlers } from './buildErrorHandlers';\n\nfunction resolveError<T extends Error>(\n errorHandlers: ErrorHandler<T>[],\n logLines: string[],\n errorContext: ErrorContext\n): T | undefined {\n const { job, phase } = errorContext;\n const { platform } = job;\n const logs = logLines.join('\\n');\n const handlers = errorHandlers\n .filter((handler) => handler.platform === platform || !handler.platform)\n .filter((handler) => handler.phase === phase || !handler.phase);\n for (const handler of handlers) {\n const regexp =\n typeof handler.regexp === 'function' ? handler.regexp(errorContext) : handler.regexp;\n if (!regexp) {\n continue;\n }\n const match = logs.match(regexp);\n if (match) {\n return handler.createError(match, errorContext);\n }\n }\n return undefined;\n}\n\nexport function resolveBuildPhaseError(\n error: any,\n logLines: string[],\n errorContext: ErrorContext\n): errors.BuildError {\n const { phase } = errorContext;\n if (error instanceof errors.BuildError) {\n return error;\n }\n const userFacingError =\n error instanceof errors.UserFacingError\n ? error\n : resolveError(userErrorHandlers, logLines, errorContext) ?? new errors.UnknownError();\n const buildError = resolveError(buildErrorHandlers, logLines, errorContext);\n\n const isUnknownUserError =\n !userFacingError ||\n ([\n errors.ErrorCode.UNKNOWN_ERROR,\n errors.ErrorCode.UNKNOWN_GRADLE_ERROR,\n errors.ErrorCode.UNKNOWN_FASTLANE_ERROR,\n ] as string[]).includes(userFacingError.errorCode);\n const message =\n (isUnknownUserError ? buildError?.message : userFacingError.message) ?? userFacingError.message;\n const errorCode =\n (isUnknownUserError ? buildError?.errorCode : userFacingError.errorCode) ??\n userFacingError.errorCode;\n\n return new errors.BuildError(message, {\n errorCode,\n userFacingErrorCode: userFacingError.errorCode,\n userFacingMessage: userFacingError.message,\n docsUrl: userFacingError.docsUrl,\n innerError: error,\n buildPhase: phase,\n });\n}\n"]}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { BuildPhase, Env, Job, Platform } from '@expo/eas-build-job';
|
|
2
|
+
export interface ErrorContext {
|
|
3
|
+
phase: BuildPhase;
|
|
4
|
+
job: Job;
|
|
5
|
+
env: Env;
|
|
6
|
+
}
|
|
7
|
+
export interface ErrorHandler<T extends Error> {
|
|
8
|
+
regexp: RegExp | ((ctx: ErrorContext) => RegExp | undefined);
|
|
9
|
+
platform?: Platform;
|
|
10
|
+
phase?: BuildPhase;
|
|
11
|
+
createError: (matchResult: RegExpMatchArray, errCtx: ErrorContext) => T | undefined;
|
|
12
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.types.js","sourceRoot":"","sources":["../../src/buildErrors/errors.types.ts"],"names":[],"mappings":"","sourcesContent":["import { BuildPhase, Env, Job, Platform } from '@expo/eas-build-job';\n\nexport interface ErrorContext {\n phase: BuildPhase;\n job: Job;\n env: Env;\n}\n\nexport interface ErrorHandler<T extends Error> {\n regexp: RegExp | ((ctx: ErrorContext) => RegExp | undefined);\n platform?: Platform;\n phase?: BuildPhase;\n createError: (matchResult: RegExpMatchArray, errCtx: ErrorContext) => T | undefined;\n}\n"]}
|
|
@@ -1,15 +1,18 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.userErrorHandlers = void 0;
|
|
4
4
|
const eas_build_job_1 = require("@expo/eas-build-job");
|
|
5
|
-
|
|
5
|
+
var UserFacingError = eas_build_job_1.errors.UserFacingError;
|
|
6
|
+
exports.userErrorHandlers = [
|
|
6
7
|
{
|
|
7
8
|
platform: eas_build_job_1.Platform.IOS,
|
|
8
9
|
phase: eas_build_job_1.BuildPhase.INSTALL_PODS,
|
|
9
10
|
regexp: /requires CocoaPods version/,
|
|
10
11
|
// example log:
|
|
11
12
|
// [!] `React` requires CocoaPods version `>= 1.10.1`, which is not satisfied by your current version, `1.10.0`.
|
|
12
|
-
createError: () => new
|
|
13
|
+
createError: () => new UserFacingError('EAS_BUILD_UNSUPPORTED_COCOAPODS_VERSION_ERROR', `Your project requires a newer version of CocoaPods. You can update it in the build profile in eas.json by either:
|
|
14
|
+
- changing the current version under key "cocoapods"
|
|
15
|
+
- switching to an image that supports that version under key "image"`, 'https://docs.expo.dev/build-reference/eas-json/'),
|
|
13
16
|
},
|
|
14
17
|
{
|
|
15
18
|
platform: eas_build_job_1.Platform.IOS,
|
|
@@ -17,7 +20,7 @@ const errorHandlers = [
|
|
|
17
20
|
regexp: /Could not find 'bundler' (.*) required by your/,
|
|
18
21
|
// example log:
|
|
19
22
|
// /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/dependency.rb:313:in `to_specs': Could not find 'bundler' (2.2.3) required by your /Users/expo/project/build/ios/Gemfile.lock. (Gem::MissingSpecVersionError)
|
|
20
|
-
createError: () => new
|
|
23
|
+
createError: () => new UserFacingError('EAS_BUILD_UNSUPPORTED_BUNDLER_VERSION_ERROR', `Your project requires a different version of the Ruby "bundler" program than the version installed in this EAS Build environment. You can specify which version of "bundler" to install by specifying the version under "build"→[buildProfileName]→"ios"→"bundler" in eas.json.`, 'https://docs.expo.dev/build-reference/eas-json/'),
|
|
21
24
|
},
|
|
22
25
|
{
|
|
23
26
|
platform: eas_build_job_1.Platform.ANDROID,
|
|
@@ -25,7 +28,7 @@ const errorHandlers = [
|
|
|
25
28
|
// example log:
|
|
26
29
|
// > Failed to read key keyalias from store "/build/workingdir/build/generic/keystore-5787e6af-3002-4cb7-8a57-3e73d13313c2.jks": Invalid keystore format
|
|
27
30
|
regexp: /Invalid keystore format/,
|
|
28
|
-
createError: () => new
|
|
31
|
+
createError: () => new UserFacingError('EAS_BUILD_INVALID_KEYSTORE_FORMAT_ERROR', 'The keystore used in this build is malformed or it has an unsupported type. Make sure you provided the correct file.'),
|
|
29
32
|
},
|
|
30
33
|
{
|
|
31
34
|
platform: eas_build_job_1.Platform.ANDROID,
|
|
@@ -33,15 +36,18 @@ const errorHandlers = [
|
|
|
33
36
|
// example log:
|
|
34
37
|
// > Failed to read key keyalias from store "/build/workingdir/build/generic/keystore-286069a8-4bb9-48a6-add9-acf6b58ea06d.jks": null
|
|
35
38
|
regexp: /Failed to read key[^\n]+from store/,
|
|
36
|
-
createError: () => new
|
|
39
|
+
createError: () => new UserFacingError('EAS_BUILD_INVALID_KEYSTORE_ALIAS_ERROR', 'The alias specified for this keystore does not exist. Make sure you specified the correct value.'),
|
|
37
40
|
},
|
|
38
41
|
{
|
|
39
42
|
platform: eas_build_job_1.Platform.ANDROID,
|
|
40
43
|
phase: eas_build_job_1.BuildPhase.PREBUILD,
|
|
41
44
|
// example log:
|
|
42
45
|
// [15:42:05] Error: Cannot copy google-services.json from /build/workingdir/build/managed/abc to /build/workingdir/build/managed/android/app/google-services.json
|
|
43
|
-
|
|
44
|
-
|
|
46
|
+
// or
|
|
47
|
+
// [11:17:29] [android.dangerous]: withAndroidDangerousBaseMod: Cannot copy google-services.json from /home/expo/workingdir/build/test/test-google-services.json to /home/expo/workingdir/build/android/app/google-services.json. Please make sure the source and destination paths exist.
|
|
48
|
+
// [11:17:29] Error: [android.dangerous]: withAndroidDangerousBaseMod: Cannot copy google-services.json from /home/expo/workingdir/build/test/test-google-services.json to /home/expo/workingdir/build/android/app/google-services.json. Please make sure the source and destination paths exist.
|
|
49
|
+
regexp: /Cannot copy google-services\.json/,
|
|
50
|
+
createError: () => new UserFacingError('EAS_BUILD_MISSING_GOOGLE_SERVICES_JSON_ERROR', '"google-services.json" is missing, make sure that file exists. Remember that EAS Build only uploads the files tracked by git.'),
|
|
45
51
|
},
|
|
46
52
|
{
|
|
47
53
|
platform: eas_build_job_1.Platform.IOS,
|
|
@@ -49,20 +55,7 @@ const errorHandlers = [
|
|
|
49
55
|
// example log:
|
|
50
56
|
// [08:44:18] ENOENT: no such file or directory, copyfile '/Users/expo/workingdir/build/managed/abc' -> '/Users/expo/workingdir/build/managed/ios/testapp/GoogleService-Info.plist'
|
|
51
57
|
regexp: /ENOENT: no such file or directory, copyfile .*GoogleService-Info.plist/,
|
|
52
|
-
createError: () => new
|
|
53
|
-
},
|
|
54
|
-
{
|
|
55
|
-
platform: eas_build_job_1.Platform.IOS,
|
|
56
|
-
phase: eas_build_job_1.BuildPhase.INSTALL_PODS,
|
|
57
|
-
// example log:
|
|
58
|
-
// CDN: trunk URL couldn't be downloaded: https://cdn.jsdelivr.net/cocoa/Specs/2/a/e/MultiplatformBleAdapter/0.0.3/MultiplatformBleAdapter.podspec.json Response: 429 429: Too Many Requests
|
|
59
|
-
regexp: /CDN: trunk URL couldn't be downloaded.* Response: 429 429: Too Many Requests/,
|
|
60
|
-
createError: () => {
|
|
61
|
-
// do not report it to user, just send to sentry
|
|
62
|
-
const error = new eas_build_job_1.errors.UnknownError();
|
|
63
|
-
error.innerError = Error('cocoapods: Too Many Requests');
|
|
64
|
-
return error;
|
|
65
|
-
},
|
|
58
|
+
createError: () => new UserFacingError('EAS_BUILD_MISSING_GOOGLE_SERVICES_PLIST_ERROR', '"GoogleService-Info.plist" is missing, make sure that file exists. Remember that EAS Build only uploads the files tracked by git.'),
|
|
66
59
|
},
|
|
67
60
|
{
|
|
68
61
|
platform: eas_build_job_1.Platform.IOS,
|
|
@@ -82,8 +75,20 @@ const errorHandlers = [
|
|
|
82
75
|
createError: (_, { job }) => {
|
|
83
76
|
const usingDefaultCacheConfig = job.cache.key === '' || !job.cache.key;
|
|
84
77
|
return job.type === eas_build_job_1.Workflow.MANAGED
|
|
85
|
-
? new
|
|
86
|
-
|
|
78
|
+
? new UserFacingError('EAS_BUILD_INCOMPATIBLE_PODS_MANAGED_WORKFLOW_ERROR', `Compatible versions of some pods could not be resolved.
|
|
79
|
+
You are seeing this error because either:
|
|
80
|
+
- Versions in the Podfile.lock cached by EAS do not match required values in Podspecs of some of the libraries. To fix that ${usingDefaultCacheConfig
|
|
81
|
+
? 'add the "cache.key" field (it can be set to any value) in the build profile in eas.json to invalidate the cache.'
|
|
82
|
+
: 'update value of the "cache.key" field in the build profile in eas.json to invalidate the cache.'}
|
|
83
|
+
- Some of the pods used in your project depend on different versions of the same pod. See logs for more information.
|
|
84
|
+
`)
|
|
85
|
+
: new UserFacingError('EAS_BUILD_INCOMPATIBLE_PODS_GENERIC_WORKFLOW_ERROR', `Compatible versions of some pods could not be resolved.
|
|
86
|
+
You are seeing this error because either:
|
|
87
|
+
- Versions in the Podfile.lock cached by EAS do not match required values in Podspecs of some of the libraries. To fix that ${usingDefaultCacheConfig
|
|
88
|
+
? 'add the "cache.key" field (it can be set to any value) in the build profile in eas.json to invalidate the cache.'
|
|
89
|
+
: 'update value of the "cache.key" field in the build profile in eas.json to invalidate the cache.'}
|
|
90
|
+
- Some of the pods used in your project depend on different versions of the same pod. See logs for more information.
|
|
91
|
+
`);
|
|
87
92
|
},
|
|
88
93
|
},
|
|
89
94
|
{
|
|
@@ -93,7 +98,10 @@ const errorHandlers = [
|
|
|
93
98
|
regexp: /Integrity check failed for "(.*)" \(computed integrity doesn't match our records, got/,
|
|
94
99
|
createError: (matchResult) => {
|
|
95
100
|
if (matchResult.length >= 2) {
|
|
96
|
-
return new
|
|
101
|
+
return new UserFacingError('EAS_BUILD_YARN_LOCK_CHECKSUM_ERROR', `Checksum for package "${matchResult[1]}" does not match value in registry. To fix that:
|
|
102
|
+
- run "yarn cache clean"
|
|
103
|
+
- remove yarn.lock (or only the section for that package)
|
|
104
|
+
- run "yarn install --force"`);
|
|
97
105
|
}
|
|
98
106
|
return undefined;
|
|
99
107
|
},
|
|
@@ -110,7 +118,7 @@ const errorHandlers = [
|
|
|
110
118
|
regexp: /\[1\/4\] Resolving packages...\s*\[2\/4\] Fetching packages...\s*\[1\/4\] Resolving packages...\s*\[2\/4\] Fetching packages.../,
|
|
111
119
|
createError: (matchResult) => {
|
|
112
120
|
if (matchResult) {
|
|
113
|
-
return new
|
|
121
|
+
return new UserFacingError('EAS_BUILD_YARN_MULTIPLE_INSTANCES_ERROR', `One of project dependencies is starting new install process while the main one is still in progress, which might result in corrupted packages. Most likely the reason for error is "prepare" script in git-referenced dependency of your project. Learn more: https://github.com/yarnpkg/yarn/issues/7212#issuecomment-493720324`);
|
|
114
122
|
}
|
|
115
123
|
return undefined;
|
|
116
124
|
},
|
|
@@ -119,28 +127,14 @@ const errorHandlers = [
|
|
|
119
127
|
platform: eas_build_job_1.Platform.ANDROID,
|
|
120
128
|
phase: eas_build_job_1.BuildPhase.RUN_GRADLEW,
|
|
121
129
|
regexp: /.*/,
|
|
122
|
-
createError: () => new eas_build_job_1.errors.
|
|
130
|
+
createError: () => new UserFacingError(eas_build_job_1.errors.ErrorCode.UNKNOWN_GRADLE_ERROR, 'Gradle build failed with unknown error. See logs for the "Run gradlew" phase for more information.'),
|
|
123
131
|
},
|
|
124
132
|
{
|
|
125
133
|
platform: eas_build_job_1.Platform.IOS,
|
|
126
134
|
phase: eas_build_job_1.BuildPhase.RUN_FASTLANE,
|
|
127
135
|
regexp: /.*/,
|
|
128
|
-
createError: () => new eas_build_job_1.errors.
|
|
136
|
+
createError: () => new UserFacingError(eas_build_job_1.errors.ErrorCode.UNKNOWN_FASTLANE_ERROR, `Fastlane build failed with unknown error. See logs for the "Run fastlane" and "Xcode Logs" phases for more information.
|
|
137
|
+
Fastlane errors in most cases are not printed at the end of the output, so you may not find any useful information in the last lines of output when looking for an error message.`),
|
|
129
138
|
},
|
|
130
139
|
];
|
|
131
|
-
|
|
132
|
-
const { platform } = job;
|
|
133
|
-
const logs = logLines.join('\n');
|
|
134
|
-
const handlers = errorHandlers
|
|
135
|
-
.filter((handler) => handler.platform === platform || !handler.platform)
|
|
136
|
-
.filter((handler) => handler.phase === phase || !handler.phase);
|
|
137
|
-
for (const handler of handlers) {
|
|
138
|
-
const match = logs.match(handler.regexp);
|
|
139
|
-
if (match) {
|
|
140
|
-
return handler.createError(match, { job, phase });
|
|
141
|
-
}
|
|
142
|
-
}
|
|
143
|
-
return undefined;
|
|
144
|
-
}
|
|
145
|
-
exports.detectUserError = detectUserError;
|
|
146
|
-
//# sourceMappingURL=detectUserError.js.map
|
|
140
|
+
//# sourceMappingURL=userErrorHandlers.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"userErrorHandlers.js","sourceRoot":"","sources":["../../src/buildErrors/userErrorHandlers.ts"],"names":[],"mappings":";;;AAAA,uDAA6E;AAI7E,IAAO,eAAe,GAAG,sBAAM,CAAC,eAAe,CAAC;AAEnC,QAAA,iBAAiB,GAAoC;IAChE;QACE,QAAQ,EAAE,wBAAQ,CAAC,GAAG;QACtB,KAAK,EAAE,0BAAU,CAAC,YAAY;QAC9B,MAAM,EAAE,4BAA4B;QACpC,eAAe;QACf,gHAAgH;QAChH,WAAW,EAAE,GAAG,EAAE,CAChB,IAAI,eAAe,CACjB,+CAA+C,EAC/C;;qEAE6D,EAC7D,iDAAiD,CAClD;KACJ;IACD;QACE,QAAQ,EAAE,wBAAQ,CAAC,GAAG;QACtB,KAAK,EAAE,0BAAU,CAAC,YAAY;QAC9B,MAAM,EAAE,gDAAgD;QACxD,eAAe;QACf,mPAAmP;QACnP,WAAW,EAAE,GAAG,EAAE,CAChB,IAAI,eAAe,CACjB,6CAA6C,EAC7C,iRAAiR,EACjR,iDAAiD,CAClD;KACJ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,OAAO;QAC1B,KAAK,EAAE,0BAAU,CAAC,WAAW;QAC7B,MAAM,EAAE,IAAI;QACZ,WAAW,EAAE,GAAG,EAAE,CAChB,IAAI,eAAe,CACjB,sBAAM,CAAC,SAAS,CAAC,oBAAoB,EACrC,oGAAoG,CACrG;KACJ;IACD;QACE,QAAQ,EAAE,wBAAQ,CAAC,GAAG;QACtB,KAAK,EAAE,0BAAU,CAAC,YAAY;QAC9B,MAAM,EAAE,IAAI;QACZ,WAAW,EAAE,GAAG,EAAE,CAChB,IAAI,eAAe,CACjB,sBAAM,CAAC,SAAS,CAAC,sBAAsB,EACvC;kLAC0K,CAC3K;KACJ;CACF,CAAC","sourcesContent":["import { BuildPhase, errors, Platform, Workflow } from '@expo/eas-build-job';\n\nimport { ErrorHandler } from './errors.types';\n\nimport UserFacingError = errors.UserFacingError;\n\nexport const userErrorHandlers: ErrorHandler<UserFacingError>[] = [\n {\n platform: Platform.IOS,\n phase: BuildPhase.INSTALL_PODS,\n regexp: /requires CocoaPods version/,\n // example log:\n // [!] `React` requires CocoaPods version `>= 1.10.1`, which is not satisfied by your current version, `1.10.0`.\n createError: () =>\n new UserFacingError(\n 'EAS_BUILD_UNSUPPORTED_COCOAPODS_VERSION_ERROR',\n `Your project requires a newer version of CocoaPods. You can update it in the build profile in eas.json by either:\n- changing the current version under key \"cocoapods\"\n- switching to an image that supports that version under key \"image\"`,\n 'https://docs.expo.dev/build-reference/eas-json/'\n ),\n },\n {\n platform: Platform.IOS,\n phase: BuildPhase.RUN_FASTLANE,\n regexp: /Could not find 'bundler' (.*) required by your/,\n // example log:\n // /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/dependency.rb:313:in `to_specs': Could not find 'bundler' (2.2.3) required by your /Users/expo/project/build/ios/Gemfile.lock. (Gem::MissingSpecVersionError)\n createError: () =>\n new UserFacingError(\n 'EAS_BUILD_UNSUPPORTED_BUNDLER_VERSION_ERROR',\n `Your project requires a different version of the Ruby \"bundler\" program than the version installed in this EAS Build environment. You can specify which version of \"bundler\" to install by specifying the version under \"build\"→[buildProfileName]→\"ios\"→\"bundler\" in eas.json.`,\n 'https://docs.expo.dev/build-reference/eas-json/'\n ),\n },\n {\n platform: Platform.ANDROID,\n phase: BuildPhase.RUN_GRADLEW,\n // example log:\n // > Failed to read key keyalias from store \"/build/workingdir/build/generic/keystore-5787e6af-3002-4cb7-8a57-3e73d13313c2.jks\": Invalid keystore format\n regexp: /Invalid keystore format/,\n createError: () =>\n new UserFacingError(\n 'EAS_BUILD_INVALID_KEYSTORE_FORMAT_ERROR',\n 'The keystore used in this build is malformed or it has an unsupported type. Make sure you provided the correct file.'\n ),\n },\n {\n platform: Platform.ANDROID,\n phase: BuildPhase.RUN_GRADLEW,\n // example log:\n // > Failed to read key keyalias from store \"/build/workingdir/build/generic/keystore-286069a8-4bb9-48a6-add9-acf6b58ea06d.jks\": null\n regexp: /Failed to read key[^\\n]+from store/,\n createError: () =>\n new UserFacingError(\n 'EAS_BUILD_INVALID_KEYSTORE_ALIAS_ERROR',\n 'The alias specified for this keystore does not exist. Make sure you specified the correct value.'\n ),\n },\n {\n platform: Platform.ANDROID,\n phase: BuildPhase.PREBUILD,\n // example log:\n // [15:42:05] Error: Cannot copy google-services.json from /build/workingdir/build/managed/abc to /build/workingdir/build/managed/android/app/google-services.json\n // or\n // [11:17:29] [android.dangerous]: withAndroidDangerousBaseMod: Cannot copy google-services.json from /home/expo/workingdir/build/test/test-google-services.json to /home/expo/workingdir/build/android/app/google-services.json. Please make sure the source and destination paths exist.\n // [11:17:29] Error: [android.dangerous]: withAndroidDangerousBaseMod: Cannot copy google-services.json from /home/expo/workingdir/build/test/test-google-services.json to /home/expo/workingdir/build/android/app/google-services.json. Please make sure the source and destination paths exist.\n regexp: /Cannot copy google-services\\.json/,\n createError: () =>\n new UserFacingError(\n 'EAS_BUILD_MISSING_GOOGLE_SERVICES_JSON_ERROR',\n '\"google-services.json\" is missing, make sure that file exists. Remember that EAS Build only uploads the files tracked by git.'\n ),\n },\n {\n platform: Platform.IOS,\n phase: BuildPhase.PREBUILD,\n // example log:\n // [08:44:18] ENOENT: no such file or directory, copyfile '/Users/expo/workingdir/build/managed/abc' -> '/Users/expo/workingdir/build/managed/ios/testapp/GoogleService-Info.plist'\n regexp: /ENOENT: no such file or directory, copyfile .*GoogleService-Info.plist/,\n createError: () =>\n new UserFacingError(\n 'EAS_BUILD_MISSING_GOOGLE_SERVICES_PLIST_ERROR',\n '\"GoogleService-Info.plist\" is missing, make sure that file exists. Remember that EAS Build only uploads the files tracked by git.'\n ),\n },\n {\n platform: Platform.IOS,\n phase: BuildPhase.INSTALL_PODS,\n // example log:\n // [!] CocoaPods could not find compatible versions for pod \"Firebase/Core\":\n // In snapshot (Podfile.lock):\n // Firebase/Core (= 6.14.0)\n // In Podfile:\n // EXFirebaseCore (from `../node_modules/expo-firebase-core/ios`) was resolved to 3.0.0, which depends on\n // Firebase/Core (= 7.7.0)\n // You have either:\n // * out-of-date source repos which you can update with `pod repo update` or with `pod install --repo-update`.\n // * changed the constraints of dependency `Firebase/Core` inside your development pod `EXFirebaseCore`.\n // You should run `pod update Firebase/Core` to apply changes you've made.\n regexp: /CocoaPods could not find compatible versions for pod /,\n createError: (_, { job }) => {\n const usingDefaultCacheConfig = job.cache.key === '' || !job.cache.key;\n return job.type === Workflow.MANAGED\n ? new UserFacingError(\n 'EAS_BUILD_INCOMPATIBLE_PODS_MANAGED_WORKFLOW_ERROR',\n `Compatible versions of some pods could not be resolved.\nYou are seeing this error because either:\n - Versions in the Podfile.lock cached by EAS do not match required values in Podspecs of some of the libraries. To fix that ${\n usingDefaultCacheConfig\n ? 'add the \"cache.key\" field (it can be set to any value) in the build profile in eas.json to invalidate the cache.'\n : 'update value of the \"cache.key\" field in the build profile in eas.json to invalidate the cache.'\n }\n - Some of the pods used in your project depend on different versions of the same pod. See logs for more information.\n`\n )\n : new UserFacingError(\n 'EAS_BUILD_INCOMPATIBLE_PODS_GENERIC_WORKFLOW_ERROR',\n `Compatible versions of some pods could not be resolved.\nYou are seeing this error because either:\n - Versions in the Podfile.lock cached by EAS do not match required values in Podspecs of some of the libraries. To fix that ${\n usingDefaultCacheConfig\n ? 'add the \"cache.key\" field (it can be set to any value) in the build profile in eas.json to invalidate the cache.'\n : 'update value of the \"cache.key\" field in the build profile in eas.json to invalidate the cache.'\n }\n - Some of the pods used in your project depend on different versions of the same pod. See logs for more information.\n`\n );\n },\n },\n {\n phase: BuildPhase.INSTALL_DEPENDENCIES,\n // example log:\n // [stderr] error https://github.com/expo/react-native/archive/sdk-41.0.0.tar.gz: Integrity check failed for \"react-native\" (computed integrity doesn't match our records, got \"sha512-3jHI2YufrJi7eIABRf/DN/I2yOkmIZ0vAyezTz+PAUJiEs4v//5LLojWEU+W53AZsnuaEMcl/4fVy4bd+OuUbA== sha1-o9QuQTXIkc8VozXPaZIullB9a40=\")\n regexp: /Integrity check failed for \"(.*)\" \\(computed integrity doesn't match our records, got/,\n createError: (matchResult: RegExpMatchArray) => {\n if (matchResult.length >= 2) {\n return new UserFacingError(\n 'EAS_BUILD_YARN_LOCK_CHECKSUM_ERROR',\n `Checksum for package \"${matchResult[1]}\" does not match value in registry. To fix that:\n- run \"yarn cache clean\"\n- remove yarn.lock (or only the section for that package)\n- run \"yarn install --force\"`\n );\n }\n return undefined;\n },\n },\n {\n phase: BuildPhase.INSTALL_DEPENDENCIES,\n // example log:\n // yarn install v1.22.17\n // [1/4] Resolving packages...\n // [2/4] Fetching packages...\n // [1/4] Resolving packages...\n // [2/4] Fetching packages...\n // [stderr] error https://registry.yarnpkg.com/jest-util/-/jest-util-26.6.2.tgz: Extracting tar content of undefined failed, the file appears to be corrupt: \"ENOENT: no such file or directory, chmod '/Users/expo/Library/Caches/Yarn/v6/npm-jest-util-26.6.2-907535dbe4d5a6cb4c47ac9b926f6af29576cbc1-integrity/node_modules/jest-util/build/pluralize.d.ts'\"\n regexp: /\\[1\\/4\\] Resolving packages...\\s*\\[2\\/4\\] Fetching packages...\\s*\\[1\\/4\\] Resolving packages...\\s*\\[2\\/4\\] Fetching packages.../,\n createError: (matchResult: RegExpMatchArray) => {\n if (matchResult) {\n return new UserFacingError(\n 'EAS_BUILD_YARN_MULTIPLE_INSTANCES_ERROR',\n `One of project dependencies is starting new install process while the main one is still in progress, which might result in corrupted packages. Most likely the reason for error is \"prepare\" script in git-referenced dependency of your project. Learn more: https://github.com/yarnpkg/yarn/issues/7212#issuecomment-493720324`\n );\n }\n return undefined;\n },\n },\n {\n platform: Platform.ANDROID,\n phase: BuildPhase.RUN_GRADLEW,\n regexp: /.*/,\n createError: () =>\n new UserFacingError(\n errors.ErrorCode.UNKNOWN_GRADLE_ERROR,\n 'Gradle build failed with unknown error. See logs for the \"Run gradlew\" phase for more information.'\n ),\n },\n {\n platform: Platform.IOS,\n phase: BuildPhase.RUN_FASTLANE,\n regexp: /.*/,\n createError: () =>\n new UserFacingError(\n errors.ErrorCode.UNKNOWN_FASTLANE_ERROR,\n `Fastlane build failed with unknown error. See logs for the \"Run fastlane\" and \"Xcode Logs\" phases for more information.\nFastlane errors in most cases are not printed at the end of the output, so you may not find any useful information in the last lines of output when looking for an error message.`\n ),\n },\n];\n"]}
|
package/dist/builders/android.js
CHANGED
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const eas_build_job_1 = require("@expo/eas-build-job");
|
|
4
4
|
const context_1 = require("../context");
|
|
5
|
-
const handleNpmError_1 = require("../utils/handleNpmError");
|
|
6
5
|
const expoUpdates_1 = require("../utils/expoUpdates");
|
|
7
6
|
const gradle_1 = require("../android/gradle");
|
|
8
7
|
const project_1 = require("../utils/project");
|
|
@@ -31,7 +30,7 @@ async function buildAsync(ctx) {
|
|
|
31
30
|
return;
|
|
32
31
|
}
|
|
33
32
|
await (0, prebuild_1.prebuildAsync)(ctx);
|
|
34
|
-
}
|
|
33
|
+
});
|
|
35
34
|
await ctx.runBuildPhase(eas_build_job_1.BuildPhase.RESTORE_CACHE, async () => {
|
|
36
35
|
var _a;
|
|
37
36
|
await ((_a = ctx.cacheManager) === null || _a === void 0 ? void 0 : _a.restoreCache(ctx));
|
|
@@ -54,16 +53,6 @@ async function buildAsync(ctx) {
|
|
|
54
53
|
await ctx.runBuildPhase(eas_build_job_1.BuildPhase.RUN_GRADLEW, async () => {
|
|
55
54
|
const gradleCommand = resolveGradleCommand(ctx.job);
|
|
56
55
|
await (0, gradle_1.runGradleCommand)(ctx, gradleCommand);
|
|
57
|
-
}, {
|
|
58
|
-
onError: (err, logLines) => {
|
|
59
|
-
var _a;
|
|
60
|
-
if (ctx.env.EAS_BUILD_MAVEN_CACHE_URL &&
|
|
61
|
-
logLines.some((line) => line.includes(ctx.env.EAS_BUILD_MAVEN_CACHE_URL))) {
|
|
62
|
-
(_a = ctx.reportError) === null || _a === void 0 ? void 0 : _a.call(ctx, 'Maven cache error', err, {
|
|
63
|
-
extras: { buildId: ctx.env.EAS_BUILD_ID, logs: logLines.join('\n') },
|
|
64
|
-
});
|
|
65
|
-
}
|
|
66
|
-
},
|
|
67
56
|
});
|
|
68
57
|
await ctx.runBuildPhase(eas_build_job_1.BuildPhase.PRE_UPLOAD_ARTIFACTS_HOOK, async () => {
|
|
69
58
|
await (0, hooks_1.runHookIfPresent)(ctx, hooks_1.Hook.PRE_UPLOAD_ARTIFACTS);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"android.js","sourceRoot":"","sources":["../../src/builders/android.ts"],"names":[],"mappings":";;AAAA,uDAAoE;AAEpE,wCAAyF;AACzF,
|
|
1
|
+
{"version":3,"file":"android.js","sourceRoot":"","sources":["../../src/builders/android.ts"],"names":[],"mappings":";;AAAA,uDAAoE;AAEpE,wCAAyF;AACzF,sDAA4E;AAC5E,8CAAyF;AACzF,8CAAyC;AACzC,kDAAmD;AACnD,0CAAwD;AACxD,wDAA4D;AAC5D,0DAA+D;AAC/D,gDAAkD;AAElD,qCAAoD;AAErC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C,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 { 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(BuildPhase.PREBUILD, 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\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(BuildPhase.RUN_GRADLEW, async () => {\n const gradleCommand = resolveGradleCommand(ctx.job);\n await runGradleCommand(ctx, gradleCommand);\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"]}
|
package/dist/builders/ios.js
CHANGED
|
@@ -8,7 +8,6 @@ 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
10
|
const context_1 = require("../context");
|
|
11
|
-
const handleNpmError_1 = require("../utils/handleNpmError");
|
|
12
11
|
const expoUpdates_1 = require("../utils/expoUpdates");
|
|
13
12
|
const project_1 = require("../utils/project");
|
|
14
13
|
const artifacts_1 = require("../utils/artifacts");
|
|
@@ -42,23 +41,13 @@ async function buildAsync(ctx) {
|
|
|
42
41
|
? { APPLE_TEAM_ID: credentials.teamId }
|
|
43
42
|
: {};
|
|
44
43
|
await (0, prebuild_1.prebuildAsync)(ctx, { extraEnvs });
|
|
45
|
-
}
|
|
44
|
+
});
|
|
46
45
|
await ctx.runBuildPhase(eas_build_job_1.BuildPhase.RESTORE_CACHE, async () => {
|
|
47
46
|
var _a;
|
|
48
47
|
await ((_a = ctx.cacheManager) === null || _a === void 0 ? void 0 : _a.restoreCache(ctx));
|
|
49
48
|
});
|
|
50
49
|
await ctx.runBuildPhase(eas_build_job_1.BuildPhase.INSTALL_PODS, async () => {
|
|
51
50
|
await (0, pod_1.installPods)(ctx);
|
|
52
|
-
}, {
|
|
53
|
-
onError: (err, logLines) => {
|
|
54
|
-
var _a;
|
|
55
|
-
if (ctx.env.EAS_BUILD_COCOAPODS_CACHE_URL &&
|
|
56
|
-
logLines.some((line) => line.includes(ctx.env.EAS_BUILD_COCOAPODS_CACHE_URL))) {
|
|
57
|
-
(_a = ctx.reportError) === null || _a === void 0 ? void 0 : _a.call(ctx, 'Cocoapods cache error', err, {
|
|
58
|
-
extras: { buildId: ctx.env.EAS_BUILD_ID, logs: logLines.join('\n') },
|
|
59
|
-
});
|
|
60
|
-
}
|
|
61
|
-
},
|
|
62
51
|
});
|
|
63
52
|
await ctx.runBuildPhase(eas_build_job_1.BuildPhase.POST_INSTALL_HOOK, async () => {
|
|
64
53
|
await (0, hooks_1.runHookIfPresent)(ctx, hooks_1.Hook.POST_INSTALL);
|
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;AAE1B,wCAAmE;AACnE,
|
|
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,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,GAAG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,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 { 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(BuildPhase.PREBUILD, 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\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
|
@@ -67,17 +67,19 @@ export declare class BuildContext<TJob extends Job> {
|
|
|
67
67
|
constructor(job: TJob, options: BuildContextOptions);
|
|
68
68
|
get buildDirectory(): string;
|
|
69
69
|
get buildLogsDirectory(): string;
|
|
70
|
+
get environmentSecrectsDirectory(): string;
|
|
70
71
|
get reactNativeProjectDirectory(): string;
|
|
71
72
|
get packageManager(): PackageManager;
|
|
72
73
|
get appConfig(): ExpoConfig;
|
|
73
|
-
runBuildPhase<T>(buildPhase: BuildPhase, phase: () => Promise<T>, { doNotMarkStart, doNotMarkEnd,
|
|
74
|
+
runBuildPhase<T>(buildPhase: BuildPhase, phase: () => Promise<T>, { doNotMarkStart, doNotMarkEnd, }?: {
|
|
74
75
|
doNotMarkStart?: boolean;
|
|
75
76
|
doNotMarkEnd?: boolean;
|
|
76
|
-
onError?: (err: Error, logLines: string[]) => void;
|
|
77
77
|
}): Promise<T>;
|
|
78
78
|
markBuildPhaseSkipped(): void;
|
|
79
79
|
markBuildPhaseHasWarnings(): void;
|
|
80
80
|
uploadArtifacts(type: ArtifactType, paths: string[], logger?: bunyan): Promise<void>;
|
|
81
|
+
private handleBuildPhaseError;
|
|
81
82
|
private setBuildPhase;
|
|
82
83
|
private endCurrentBuildPhase;
|
|
84
|
+
private getEnvironmentSecrets;
|
|
83
85
|
}
|
package/dist/context.js
CHANGED
|
@@ -7,8 +7,9 @@ exports.BuildContext = exports.SkipNativeBuildError = exports.ArtifactType = voi
|
|
|
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
|
-
const
|
|
10
|
+
const detectError_1 = require("./buildErrors/detectError");
|
|
11
11
|
const appConfig_1 = require("./utils/appConfig");
|
|
12
|
+
const environmentSecrets_1 = require("./utils/environmentSecrets");
|
|
12
13
|
var ArtifactType;
|
|
13
14
|
(function (ArtifactType) {
|
|
14
15
|
ArtifactType["APPLICATION_ARCHIVE"] = "APPLICATION_ARCHIVE";
|
|
@@ -23,7 +24,7 @@ class SkipNativeBuildError extends Error {
|
|
|
23
24
|
exports.SkipNativeBuildError = SkipNativeBuildError;
|
|
24
25
|
class BuildContext {
|
|
25
26
|
constructor(job, options) {
|
|
26
|
-
var _a
|
|
27
|
+
var _a;
|
|
27
28
|
this.job = job;
|
|
28
29
|
this.artifacts = {};
|
|
29
30
|
this.buildPhaseSkipped = false;
|
|
@@ -38,7 +39,8 @@ class BuildContext {
|
|
|
38
39
|
this.reportError = options.reportError;
|
|
39
40
|
this.metadata = options.metadata;
|
|
40
41
|
this.skipNativeBuild = options.skipNativeBuild;
|
|
41
|
-
|
|
42
|
+
const environmentSecrets = this.getEnvironmentSecrets(job);
|
|
43
|
+
this.env = Object.assign(Object.assign(Object.assign({}, options.env), (_a = job === null || job === void 0 ? void 0 : job.builderEnvironment) === null || _a === void 0 ? void 0 : _a.env), environmentSecrets);
|
|
42
44
|
}
|
|
43
45
|
get buildDirectory() {
|
|
44
46
|
return path_1.default.join(this.workingdir, 'build');
|
|
@@ -46,6 +48,9 @@ class BuildContext {
|
|
|
46
48
|
get buildLogsDirectory() {
|
|
47
49
|
return path_1.default.join(this.workingdir, 'logs');
|
|
48
50
|
}
|
|
51
|
+
get environmentSecrectsDirectory() {
|
|
52
|
+
return path_1.default.join(this.workingdir, 'environment-secrets');
|
|
53
|
+
}
|
|
49
54
|
get reactNativeProjectDirectory() {
|
|
50
55
|
return path_1.default.join(this.buildDirectory, this.job.projectRootDirectory);
|
|
51
56
|
}
|
|
@@ -58,7 +63,7 @@ class BuildContext {
|
|
|
58
63
|
}
|
|
59
64
|
return this._appConfig;
|
|
60
65
|
}
|
|
61
|
-
async runBuildPhase(buildPhase, phase, { doNotMarkStart = false, doNotMarkEnd = false,
|
|
66
|
+
async runBuildPhase(buildPhase, phase, { doNotMarkStart = false, doNotMarkEnd = false, } = {}) {
|
|
62
67
|
try {
|
|
63
68
|
this.setBuildPhase(buildPhase, { doNotMarkStart });
|
|
64
69
|
const result = await phase();
|
|
@@ -71,32 +76,9 @@ class BuildContext {
|
|
|
71
76
|
return result;
|
|
72
77
|
}
|
|
73
78
|
catch (err) {
|
|
74
|
-
|
|
75
|
-
if (err instanceof eas_build_job_1.errors.UserError) {
|
|
76
|
-
userError = err;
|
|
77
|
-
}
|
|
78
|
-
else {
|
|
79
|
-
const detectedError = (0, detectUserError_1.detectUserError)(this.logBuffer.getPhaseLogs(buildPhase), {
|
|
80
|
-
job: this.job,
|
|
81
|
-
phase: buildPhase,
|
|
82
|
-
});
|
|
83
|
-
if (detectedError) {
|
|
84
|
-
detectedError.innerError = err;
|
|
85
|
-
userError = detectedError;
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
if (userError) {
|
|
89
|
-
this.logger.error(`Error: ${userError.message}`);
|
|
90
|
-
}
|
|
91
|
-
else {
|
|
92
|
-
// leaving message empty, website will display err.stack which already includes err.message
|
|
93
|
-
this.logger.error({ err }, '');
|
|
94
|
-
}
|
|
95
|
-
if (onError) {
|
|
96
|
-
onError(userError !== null && userError !== void 0 ? userError : err, this.logBuffer.getPhaseLogs(buildPhase));
|
|
97
|
-
}
|
|
79
|
+
const resolvedError = this.handleBuildPhaseError(err, buildPhase);
|
|
98
80
|
this.endCurrentBuildPhase({ result: eas_build_job_1.BuildPhaseResult.FAIL });
|
|
99
|
-
throw
|
|
81
|
+
throw resolvedError;
|
|
100
82
|
}
|
|
101
83
|
}
|
|
102
84
|
markBuildPhaseSkipped() {
|
|
@@ -111,6 +93,21 @@ class BuildContext {
|
|
|
111
93
|
this.artifacts[type] = url;
|
|
112
94
|
}
|
|
113
95
|
}
|
|
96
|
+
handleBuildPhaseError(err, buildPhase) {
|
|
97
|
+
const buildError = (0, detectError_1.resolveBuildPhaseError)(err, this.logBuffer.getPhaseLogs(buildPhase), {
|
|
98
|
+
job: this.job,
|
|
99
|
+
phase: buildPhase,
|
|
100
|
+
env: this.env,
|
|
101
|
+
});
|
|
102
|
+
if (buildError.errorCode === eas_build_job_1.errors.ErrorCode.UNKNOWN_ERROR) {
|
|
103
|
+
// leaving message empty, website will display err.stack which already includes err.message
|
|
104
|
+
this.logger.error({ err }, '');
|
|
105
|
+
}
|
|
106
|
+
else {
|
|
107
|
+
this.logger.error(`Error: ${buildError.userFacingMessage}`);
|
|
108
|
+
}
|
|
109
|
+
return buildError;
|
|
110
|
+
}
|
|
114
111
|
setBuildPhase(buildPhase, { doNotMarkStart = false } = {}) {
|
|
115
112
|
if (this.buildPhase) {
|
|
116
113
|
if (this.buildPhase === buildPhase) {
|
|
@@ -139,6 +136,27 @@ class BuildContext {
|
|
|
139
136
|
this.buildPhaseSkipped = false;
|
|
140
137
|
this.buildPhaseHasWarnings = false;
|
|
141
138
|
}
|
|
139
|
+
getEnvironmentSecrets(job) {
|
|
140
|
+
var _a, _b;
|
|
141
|
+
if (Array.isArray((_a = job === null || job === void 0 ? void 0 : job.secrets) === null || _a === void 0 ? void 0 : _a.environmentSecrets)) {
|
|
142
|
+
const environmentSecrets = {};
|
|
143
|
+
for (const { name, type, value } of job.secrets.environmentSecrets) {
|
|
144
|
+
if (type === eas_build_job_1.EnvironmentSecretType.STRING) {
|
|
145
|
+
environmentSecrets[name] = value;
|
|
146
|
+
}
|
|
147
|
+
else {
|
|
148
|
+
environmentSecrets[name] = (0, environmentSecrets_1.createTemporaryEnvironmentSecretFile)(this.environmentSecrectsDirectory, value);
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
return environmentSecrets;
|
|
152
|
+
}
|
|
153
|
+
else if ((_b = job === null || job === void 0 ? void 0 : job.secrets) === null || _b === void 0 ? void 0 : _b.environmentSecrets) {
|
|
154
|
+
return Object.assign({}, job.secrets.environmentSecrets);
|
|
155
|
+
}
|
|
156
|
+
else {
|
|
157
|
+
return {};
|
|
158
|
+
}
|
|
159
|
+
}
|
|
142
160
|
}
|
|
143
161
|
exports.BuildContext = BuildContext;
|
|
144
162
|
//# sourceMappingURL=context.js.map
|
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;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,CAAC;QACrC,IAAI,CAAC,aAAa,GAAG,OAAO,CAAC,MAAM,CAAC;QACpC,IAA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AC;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"]}
|
|
1
|
+
{"version":3,"file":"context.js","sourceRoot":"","sources":["../src/context.ts"],"names":[],"mappings":";;;;;;AAAA,gDAAwB;AAExB,uDAS6B;AAK7B,2DAA+E;AAC/E,2DAAmE;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,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;IAEO,qBAAqB,CAAC,GAAS;;QACrC,IAAI,KAAK,CAAC,OAAO,CAAC,MAAA,GAAG,aAAH,GAAG,uBAAH,GAAG,CAAE,OAAO,0CAAE,kBAAkB,CAAC,EAAE;YACnD,MAAM,kBAAkB,GAA2B,EAAE,CAAC;YACtD,KAAK,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,GAAG,CAAC,OAAO,CAAC,kBAAkB,EAAE;gBAClE,IAAI,IAAI,KAAK,qCAAqB,CAAC,MAAM,EAAE;oBACzC,kBAAkB,CAAC,IAAI,CAAC,GAAG,KAAK,CAAC;iBAClC;qBAAM;oBACL,kBAAkB,CAAC,IAAI,CAAC,GAAG,IAAA,yDAAoC,EAC7D,IAAI,CAAC,4BAA4B,EACjC,KAAK,CACN,CAAC;iBACH;aACF;YACD,OAAO,kBAAkB,CAAC;SAC3B;aAAM,IAAI,MAAA,GAAG,aAAH,GAAG,uBAAH,GAAG,CAAE,OAAO,0CAAE,kBAAkB,EAAE;YAC3C,yBAAY,GAAG,CAAC,OAAO,CAAC,kBAAkB,EAAG;SAC9C;aAAM;YACL,OAAO,EAAE,CAAC;SACX;IACH,CAAC;CACF;AAnMD,oCAmMC","sourcesContent":["import path from 'path';\n\nimport {\n BuildPhase,\n BuildPhaseResult,\n Job,\n LogMarker,\n Env,\n errors,\n Metadata,\n EnvironmentSecretType,\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 { resolveBuildPhaseError } from './buildErrors/detectError';\nimport { readAppConfig } from './utils/appConfig';\nimport { createTemporaryEnvironmentSecretFile } from './utils/environmentSecrets';\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\n const environmentSecrets = this.getEnvironmentSecrets(job);\n this.env = {\n ...options.env,\n ...job?.builderEnvironment?.env,\n ...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 environmentSecrectsDirectory(): string {\n return path.join(this.workingdir, 'environment-secrets');\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 }: {\n doNotMarkStart?: boolean;\n doNotMarkEnd?: boolean;\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 const resolvedError = this.handleBuildPhaseError(err, buildPhase);\n this.endCurrentBuildPhase({ result: BuildPhaseResult.FAIL });\n throw resolvedError;\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 handleBuildPhaseError(err: any, buildPhase: BuildPhase): errors.BuildError {\n const buildError = resolveBuildPhaseError(err, this.logBuffer.getPhaseLogs(buildPhase), {\n job: this.job,\n phase: buildPhase,\n env: this.env,\n });\n if (buildError.errorCode === errors.ErrorCode.UNKNOWN_ERROR) {\n // leaving message empty, website will display err.stack which already includes err.message\n this.logger.error({ err }, '');\n } else {\n this.logger.error(`Error: ${buildError.userFacingMessage}`);\n }\n return buildError;\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 private getEnvironmentSecrets(job: TJob): Record<string, string> {\n if (Array.isArray(job?.secrets?.environmentSecrets)) {\n const environmentSecrets: Record<string, string> = {};\n for (const { name, type, value } of job.secrets.environmentSecrets) {\n if (type === EnvironmentSecretType.STRING) {\n environmentSecrets[name] = value;\n } else {\n environmentSecrets[name] = createTemporaryEnvironmentSecretFile(\n this.environmentSecrectsDirectory,\n value\n );\n }\n }\n return environmentSecrets;\n } else if (job?.secrets?.environmentSecrets) {\n return { ...job.secrets.environmentSecrets };\n } else {\n return {};\n }\n }\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function createTemporaryEnvironmentSecretFile(secretsDir: string, value: string): string;
|
|
@@ -0,0 +1,16 @@
|
|
|
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.createTemporaryEnvironmentSecretFile = void 0;
|
|
7
|
+
const fs_1 = __importDefault(require("fs"));
|
|
8
|
+
const path_1 = __importDefault(require("path"));
|
|
9
|
+
const uuid_1 = require("uuid");
|
|
10
|
+
function createTemporaryEnvironmentSecretFile(secretsDir, value) {
|
|
11
|
+
const randomFilePath = path_1.default.join(secretsDir, (0, uuid_1.v4)());
|
|
12
|
+
fs_1.default.writeFileSync(randomFilePath, Buffer.from(value, 'base64'));
|
|
13
|
+
return randomFilePath;
|
|
14
|
+
}
|
|
15
|
+
exports.createTemporaryEnvironmentSecretFile = createTemporaryEnvironmentSecretFile;
|
|
16
|
+
//# sourceMappingURL=environmentSecrets.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"environmentSecrets.js","sourceRoot":"","sources":["../../src/utils/environmentSecrets.ts"],"names":[],"mappings":";;;;;;AAAA,4CAAoB;AACpB,gDAAwB;AAExB,+BAAkC;AAElC,SAAgB,oCAAoC,CAAC,UAAkB,EAAE,KAAa;IACpF,MAAM,cAAc,GAAG,cAAI,CAAC,IAAI,CAAC,UAAU,EAAE,IAAA,SAAI,GAAE,CAAC,CAAC;IACrD,YAAE,CAAC,aAAa,CAAC,cAAc,EAAE,MAAM,CAAC,IAAI,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC,CAAC;IAC/D,OAAO,cAAc,CAAC;AACxB,CAAC;AAJD,oFAIC","sourcesContent":["import fs from 'fs';\nimport path from 'path';\n\nimport { v4 as uuid } from 'uuid';\n\nexport function createTemporaryEnvironmentSecretFile(secretsDir: string, value: string): string {\n const randomFilePath = path.join(secretsDir, uuid());\n fs.writeFileSync(randomFilePath, Buffer.from(value, 'base64'));\n return randomFilePath;\n}\n"]}
|
package/dist/utils/project.js
CHANGED
|
@@ -11,7 +11,6 @@ const turtle_spawn_1 = __importDefault(require("@expo/turtle-spawn"));
|
|
|
11
11
|
const fs_extra_1 = __importDefault(require("fs-extra"));
|
|
12
12
|
const semver_1 = __importDefault(require("semver"));
|
|
13
13
|
const xcodeEnv_1 = require("../ios/xcodeEnv");
|
|
14
|
-
const handleNpmError_1 = require("../utils/handleNpmError");
|
|
15
14
|
const hooks_1 = require("./hooks");
|
|
16
15
|
const npmrc_1 = require("./npmrc");
|
|
17
16
|
const packageManager_1 = require("./packageManager");
|
|
@@ -34,7 +33,7 @@ async function setup(ctx) {
|
|
|
34
33
|
});
|
|
35
34
|
await ctx.runBuildPhase(eas_build_job_1.BuildPhase.INSTALL_DEPENDENCIES, async () => {
|
|
36
35
|
await installDependencies(ctx);
|
|
37
|
-
}
|
|
36
|
+
});
|
|
38
37
|
await ctx.runBuildPhase(eas_build_job_1.BuildPhase.READ_PACKAGE_JSON, async () => {
|
|
39
38
|
ctx.logger.info('Using package.json:');
|
|
40
39
|
ctx.logger.info(JSON.stringify(packageJson, null, 2));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"project.js","sourceRoot":"","sources":["../../src/utils/project.ts"],"names":[],"mappings":";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AM,IAAI,KAAK,CAAC,kCAAkC,UAAU,EAAE,CAAC,CAAC;KACjE;IACD,IAAI;QACF,OAAO,kBAAE,CAAC,YAAY,CAAC,eAAe,CAAC,CAAC;KACzC;IAAC,OAAO,GAAQ,EAAE;QACjB,MAAM,IAAI,KAAK,CAAC,yCAAyC,GAAG,CAAC,OAAO,EAAE,CAAC,CAAC;KACzE;AACH,CAAC;AAVD,0CAUC","sourcesContent":["import path from 'path';\n\nimport downloadFile from '@expo/downloader';\nimport { ArchiveSourceType, BuildPhase, Ios, Job, Platform } from '@expo/eas-build-job';\nimport spawn, { SpawnOptions, SpawnPromise, SpawnResult } from '@expo/turtle-spawn';\nimport fs from 'fs-extra';\nimport semver from 'semver';\n\nimport { BuildContext } from '../context';\nimport { deleteXcodeEnvLocalIfExistsAsync } from '../ios/xcodeEnv';\nimport { createNpmErrorHandler } from '../utils/handleNpmError';\n\nimport { Hook, runHookIfPresent } from './hooks';\nimport { createNpmrcIfNotExistsAsync } from './npmrc';\nimport { findPackagerRootDir, PackageManager } from './packageManager';\n\nconst MAX_EXPO_DOCTOR_TIMEOUT_MS = 20 * 1000;\n\nexport async function setup<TJob extends Job>(ctx: BuildContext<TJob>): Promise<void> {\n const packageJson = await ctx.runBuildPhase(BuildPhase.PREPARE_PROJECT, async () => {\n await downloadAndUnpackProject(ctx);\n if (ctx.env.NPM_TOKEN) {\n await createNpmrcIfNotExistsAsync(ctx);\n }\n if (ctx.job.platform === Platform.IOS && ctx.env.EAS_BUILD_RUNNER === 'eas-build') {\n await deleteXcodeEnvLocalIfExistsAsync(ctx as BuildContext<Ios.Job>);\n }\n // try to read package.json to see if it exists and is valid\n return readPackageJson(ctx.reactNativeProjectDirectory);\n });\n\n await ctx.runBuildPhase(BuildPhase.PRE_INSTALL_HOOK, async () => {\n await runHookIfPresent(ctx, Hook.PRE_INSTALL);\n });\n\n await ctx.runBuildPhase(\n BuildPhase.INSTALL_DEPENDENCIES,\n async () => {\n await installDependencies(ctx);\n },\n { onError: createNpmErrorHandler(ctx) }\n );\n\n await ctx.runBuildPhase(BuildPhase.READ_PACKAGE_JSON, async () => {\n ctx.logger.info('Using package.json:');\n ctx.logger.info(JSON.stringify(packageJson, null, 2));\n });\n\n await ctx.runBuildPhase(BuildPhase.READ_APP_CONFIG, async () => {\n ctx.logger.info('Using app configuration:');\n ctx.logger.info(JSON.stringify(ctx.appConfig, null, 2));\n });\n\n const hasExpoPackage = !!packageJson.dependencies?.expo;\n if (hasExpoPackage) {\n await ctx.runBuildPhase(BuildPhase.RUN_EXPO_DOCTOR, async () => {\n try {\n const { stdout } = await runExpoDoctor(ctx);\n if (!stdout.match(/Didn't find any issues with the project/)) {\n ctx.markBuildPhaseHasWarnings();\n }\n } catch (err) {\n ctx.logger.error({ err }, 'Command \"expo doctor\" failed.');\n ctx.markBuildPhaseHasWarnings();\n }\n });\n }\n}\n\nasync function downloadAndUnpackProject<TJob extends Job>(ctx: BuildContext<TJob>): Promise<void> {\n const projectTarball = path.join(ctx.workingdir, 'project.tar.gz');\n if (ctx.job.projectArchive.type === ArchiveSourceType.S3) {\n throw new Error('ArchiveSourceType.S3 should be resolved earlier to url');\n } else if (ctx.job.projectArchive.type === ArchiveSourceType.PATH) {\n await fs.copy(ctx.job.projectArchive.path, projectTarball); // used in eas-build-cli\n } else if (ctx.job.projectArchive.type === ArchiveSourceType.URL) {\n try {\n await downloadFile(ctx.job.projectArchive.url, projectTarball, { retry: 3 });\n } catch (err: any) {\n ctx.reportError?.('Failed to download project archive', err, {\n extras: { buildId: ctx.env.EAS_BUILD_ID },\n });\n throw err;\n }\n }\n\n await spawn(\n 'tar',\n ['--strip-components', '1', '-zxf', 'project.tar.gz', '-C', ctx.buildDirectory],\n {\n cwd: ctx.workingdir,\n logger: ctx.logger,\n }\n );\n}\n\nexport async function installDependencies<TJob extends Job>(\n ctx: BuildContext<TJob>\n): Promise<void> {\n const packagerRunDir = findPackagerRootDir(ctx.reactNativeProjectDirectory);\n if (packagerRunDir !== ctx.reactNativeProjectDirectory) {\n const relativeReactNativeProjectDirectory = path.relative(\n ctx.buildDirectory,\n ctx.reactNativeProjectDirectory\n );\n ctx.logger.info(\n `We detected that '${relativeReactNativeProjectDirectory}' is a ${ctx.packageManager} workspace`\n );\n }\n\n const relativePackagerRunDir = path.relative(ctx.buildDirectory, packagerRunDir);\n let args = ['install'];\n if (ctx.packageManager === PackageManager.PNPM) {\n args = ['install', '--no-frozen-lockfile'];\n } else if (ctx.packageManager === PackageManager.YARN) {\n const isYarn2 = await isUsingYarn2(ctx.reactNativeProjectDirectory);\n if (isYarn2) {\n args = ['install', '--no-immutable'];\n }\n }\n ctx.logger.info(\n `Running \"${ctx.packageManager} ${args.join(' ')}\" in ${\n relativePackagerRunDir\n ? `directory '${relativePackagerRunDir}'`\n : 'the root dir of your repository'\n } `\n );\n await spawn(ctx.packageManager, args, {\n cwd: packagerRunDir,\n logger: ctx.logger,\n env: ctx.env,\n });\n}\n\n/**\n * check if .yarnrc.yml exists in the project dir or in the workspace root dir\n */\nexport async function isUsingYarn2(projectDir: string): Promise<boolean> {\n const yarnrcPath = path.join(projectDir, '.yarnrc.yml');\n const yarnrcRootPath = path.join(findPackagerRootDir(projectDir), '.yarnrc.yml');\n return (await fs.pathExists(yarnrcPath)) || (await fs.pathExists(yarnrcRootPath));\n}\n\nexport function runExpoCliCommand<TJob extends Job>(\n ctx: BuildContext<TJob>,\n args: string[],\n options: SpawnOptions,\n { forceUseGlobalExpoCli = false } = {}\n): SpawnPromise<SpawnResult> {\n if (shouldUseGlobalExpoCli(ctx, forceUseGlobalExpoCli)) {\n return ctx.runGlobalExpoCliCommand(args.join(' '), options);\n } else {\n const argsWithExpo = ['expo', ...args];\n if (ctx.packageManager === PackageManager.NPM) {\n return spawn('npx', argsWithExpo, options);\n } else if (ctx.packageManager === PackageManager.YARN) {\n return spawn('yarn', argsWithExpo, options);\n } else if (ctx.packageManager === PackageManager.PNPM) {\n return spawn('pnpm', argsWithExpo, options);\n } else {\n throw new Error(`Unsupported package manager: ${ctx.packageManager}`);\n }\n }\n}\n\nexport function shouldUseGlobalExpoCli<TJob extends Job>(\n ctx: BuildContext<TJob>,\n forceUseGlobalExpoCli = false\n): boolean {\n return (\n forceUseGlobalExpoCli ||\n ctx.env.EXPO_USE_LOCAL_CLI === '0' ||\n !ctx.appConfig.sdkVersion ||\n semver.satisfies(ctx.appConfig.sdkVersion, '<46')\n );\n}\n\nasync function runExpoDoctor<TJob extends Job>(ctx: BuildContext<TJob>): Promise<SpawnResult> {\n ctx.logger.info('Running \"expo doctor\"');\n let timeout: NodeJS.Timeout | undefined;\n try {\n const promise = runExpoCliCommand(\n ctx,\n ['doctor'],\n {\n cwd: ctx.reactNativeProjectDirectory,\n logger: ctx.logger,\n env: ctx.env,\n },\n // local Expo CLI does not have \"doctor\" for now\n { forceUseGlobalExpoCli: true }\n );\n timeout = setTimeout(() => {\n promise.child.kill();\n ctx.reportError?.(`\"expo doctor\" timed out`, undefined, {\n extras: { buildId: ctx.env.EAS_BUILD_ID },\n });\n }, MAX_EXPO_DOCTOR_TIMEOUT_MS);\n return await promise;\n } finally {\n if (timeout) {\n clearTimeout(timeout);\n }\n }\n}\n\nexport function readPackageJson(projectDir: string): any {\n const packageJsonPath = path.join(projectDir, 'package.json');\n if (!fs.pathExistsSync(packageJsonPath)) {\n throw new Error(`package.json does not exist in ${projectDir}`);\n }\n try {\n return fs.readJSONSync(packageJsonPath);\n } catch (err: any) {\n throw new Error(`Failed to parse or read package.json: ${err.message}`);\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"project.js","sourceRoot":"","sources":["../../src/utils/project.ts"],"names":[],"mappings":";;;;;;AAAA,gDAAwB;AAExB,kEAA4C;AAC5C,uDAAwF;AACxF,sEAAoF;AACpF,wDAA0B;AAC1B,oDAA4B;AAG5B,8CAAmE;AAEnE,mCAAiD;AACjD,mCAAsD;AACtD,qDAAuE;AAEvE,MAAM,0BAA0B,GAAG,EAAE,GAAG,IAAI,CAAC;AAEtC,K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ile from '@expo/downloader';\nimport { ArchiveSourceType, BuildPhase, Ios, Job, Platform } from '@expo/eas-build-job';\nimport spawn, { SpawnOptions, SpawnPromise, SpawnResult } from '@expo/turtle-spawn';\nimport fs from 'fs-extra';\nimport semver from 'semver';\n\nimport { BuildContext } from '../context';\nimport { deleteXcodeEnvLocalIfExistsAsync } from '../ios/xcodeEnv';\n\nimport { Hook, runHookIfPresent } from './hooks';\nimport { createNpmrcIfNotExistsAsync } from './npmrc';\nimport { findPackagerRootDir, PackageManager } from './packageManager';\n\nconst MAX_EXPO_DOCTOR_TIMEOUT_MS = 20 * 1000;\n\nexport async function setup<TJob extends Job>(ctx: BuildContext<TJob>): Promise<void> {\n const packageJson = await ctx.runBuildPhase(BuildPhase.PREPARE_PROJECT, async () => {\n await downloadAndUnpackProject(ctx);\n if (ctx.env.NPM_TOKEN) {\n await createNpmrcIfNotExistsAsync(ctx);\n }\n if (ctx.job.platform === Platform.IOS && ctx.env.EAS_BUILD_RUNNER === 'eas-build') {\n await deleteXcodeEnvLocalIfExistsAsync(ctx as BuildContext<Ios.Job>);\n }\n // try to read package.json to see if it exists and is valid\n return readPackageJson(ctx.reactNativeProjectDirectory);\n });\n\n await ctx.runBuildPhase(BuildPhase.PRE_INSTALL_HOOK, async () => {\n await runHookIfPresent(ctx, Hook.PRE_INSTALL);\n });\n\n await ctx.runBuildPhase(BuildPhase.INSTALL_DEPENDENCIES, async () => {\n await installDependencies(ctx);\n });\n\n await ctx.runBuildPhase(BuildPhase.READ_PACKAGE_JSON, async () => {\n ctx.logger.info('Using package.json:');\n ctx.logger.info(JSON.stringify(packageJson, null, 2));\n });\n\n await ctx.runBuildPhase(BuildPhase.READ_APP_CONFIG, async () => {\n ctx.logger.info('Using app configuration:');\n ctx.logger.info(JSON.stringify(ctx.appConfig, null, 2));\n });\n\n const hasExpoPackage = !!packageJson.dependencies?.expo;\n if (hasExpoPackage) {\n await ctx.runBuildPhase(BuildPhase.RUN_EXPO_DOCTOR, async () => {\n try {\n const { stdout } = await runExpoDoctor(ctx);\n if (!stdout.match(/Didn't find any issues with the project/)) {\n ctx.markBuildPhaseHasWarnings();\n }\n } catch (err) {\n ctx.logger.error({ err }, 'Command \"expo doctor\" failed.');\n ctx.markBuildPhaseHasWarnings();\n }\n });\n }\n}\n\nasync function downloadAndUnpackProject<TJob extends Job>(ctx: BuildContext<TJob>): Promise<void> {\n const projectTarball = path.join(ctx.workingdir, 'project.tar.gz');\n if (ctx.job.projectArchive.type === ArchiveSourceType.S3) {\n throw new Error('ArchiveSourceType.S3 should be resolved earlier to url');\n } else if (ctx.job.projectArchive.type === ArchiveSourceType.PATH) {\n await fs.copy(ctx.job.projectArchive.path, projectTarball); // used in eas-build-cli\n } else if (ctx.job.projectArchive.type === ArchiveSourceType.URL) {\n try {\n await downloadFile(ctx.job.projectArchive.url, projectTarball, { retry: 3 });\n } catch (err: any) {\n ctx.reportError?.('Failed to download project archive', err, {\n extras: { buildId: ctx.env.EAS_BUILD_ID },\n });\n throw err;\n }\n }\n\n await spawn(\n 'tar',\n ['--strip-components', '1', '-zxf', 'project.tar.gz', '-C', ctx.buildDirectory],\n {\n cwd: ctx.workingdir,\n logger: ctx.logger,\n }\n );\n}\n\nexport async function installDependencies<TJob extends Job>(\n ctx: BuildContext<TJob>\n): Promise<void> {\n const packagerRunDir = findPackagerRootDir(ctx.reactNativeProjectDirectory);\n if (packagerRunDir !== ctx.reactNativeProjectDirectory) {\n const relativeReactNativeProjectDirectory = path.relative(\n ctx.buildDirectory,\n ctx.reactNativeProjectDirectory\n );\n ctx.logger.info(\n `We detected that '${relativeReactNativeProjectDirectory}' is a ${ctx.packageManager} workspace`\n );\n }\n\n const relativePackagerRunDir = path.relative(ctx.buildDirectory, packagerRunDir);\n let args = ['install'];\n if (ctx.packageManager === PackageManager.PNPM) {\n args = ['install', '--no-frozen-lockfile'];\n } else if (ctx.packageManager === PackageManager.YARN) {\n const isYarn2 = await isUsingYarn2(ctx.reactNativeProjectDirectory);\n if (isYarn2) {\n args = ['install', '--no-immutable'];\n }\n }\n ctx.logger.info(\n `Running \"${ctx.packageManager} ${args.join(' ')}\" in ${\n relativePackagerRunDir\n ? `directory '${relativePackagerRunDir}'`\n : 'the root dir of your repository'\n } `\n );\n await spawn(ctx.packageManager, args, {\n cwd: packagerRunDir,\n logger: ctx.logger,\n env: ctx.env,\n });\n}\n\n/**\n * check if .yarnrc.yml exists in the project dir or in the workspace root dir\n */\nexport async function isUsingYarn2(projectDir: string): Promise<boolean> {\n const yarnrcPath = path.join(projectDir, '.yarnrc.yml');\n const yarnrcRootPath = path.join(findPackagerRootDir(projectDir), '.yarnrc.yml');\n return (await fs.pathExists(yarnrcPath)) || (await fs.pathExists(yarnrcRootPath));\n}\n\nexport function runExpoCliCommand<TJob extends Job>(\n ctx: BuildContext<TJob>,\n args: string[],\n options: SpawnOptions,\n { forceUseGlobalExpoCli = false } = {}\n): SpawnPromise<SpawnResult> {\n if (shouldUseGlobalExpoCli(ctx, forceUseGlobalExpoCli)) {\n return ctx.runGlobalExpoCliCommand(args.join(' '), options);\n } else {\n const argsWithExpo = ['expo', ...args];\n if (ctx.packageManager === PackageManager.NPM) {\n return spawn('npx', argsWithExpo, options);\n } else if (ctx.packageManager === PackageManager.YARN) {\n return spawn('yarn', argsWithExpo, options);\n } else if (ctx.packageManager === PackageManager.PNPM) {\n return spawn('pnpm', argsWithExpo, options);\n } else {\n throw new Error(`Unsupported package manager: ${ctx.packageManager}`);\n }\n }\n}\n\nexport function shouldUseGlobalExpoCli<TJob extends Job>(\n ctx: BuildContext<TJob>,\n forceUseGlobalExpoCli = false\n): boolean {\n return (\n forceUseGlobalExpoCli ||\n ctx.env.EXPO_USE_LOCAL_CLI === '0' ||\n !ctx.appConfig.sdkVersion ||\n semver.satisfies(ctx.appConfig.sdkVersion, '<46')\n );\n}\n\nasync function runExpoDoctor<TJob extends Job>(ctx: BuildContext<TJob>): Promise<SpawnResult> {\n ctx.logger.info('Running \"expo doctor\"');\n let timeout: NodeJS.Timeout | undefined;\n try {\n const promise = runExpoCliCommand(\n ctx,\n ['doctor'],\n {\n cwd: ctx.reactNativeProjectDirectory,\n logger: ctx.logger,\n env: ctx.env,\n },\n // local Expo CLI does not have \"doctor\" for now\n { forceUseGlobalExpoCli: true }\n );\n timeout = setTimeout(() => {\n promise.child.kill();\n ctx.reportError?.(`\"expo doctor\" timed out`, undefined, {\n extras: { buildId: ctx.env.EAS_BUILD_ID },\n });\n }, MAX_EXPO_DOCTOR_TIMEOUT_MS);\n return await promise;\n } finally {\n if (timeout) {\n clearTimeout(timeout);\n }\n }\n}\n\nexport function readPackageJson(projectDir: string): any {\n const packageJsonPath = path.join(projectDir, 'package.json');\n if (!fs.pathExistsSync(packageJsonPath)) {\n throw new Error(`package.json does not exist in ${projectDir}`);\n }\n try {\n return fs.readJSONSync(packageJsonPath);\n } catch (err: any) {\n throw new Error(`Failed to parse or read package.json: ${err.message}`);\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.151",
|
|
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.92",
|
|
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":"detectUserError.js","sourceRoot":"","sources":["../../src/utils/detectUserError.ts"],"names":[],"mappings":";;;AAAA,uDAAkF;AAiBlF,MAAM,aAAa,GAAmB;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EAAE,CAAC,OAAO,CAAC,KAAK,KAAK,KAAK,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;IAClE,KAAK,MAAM,OAAO,IAAI,QAAQ,EAAE;QAC9B,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;QACzC,IAAI,KAAK,EAAE;YACT,OAAO,OAAO,CAAC,WAAW,CAAC,KAAK,EAAE,EAAE,GAAG,EAAE,KAAK,EAAE,CAAC,CAAC;SACnD;KACF;IACD,OAAO,SAAS,CAAC;AACnB,CAAC;AAhBD,0CAgBC","sourcesContent":["import { Job, errors, Platform, BuildPhase, Workflow } from '@expo/eas-build-job';\n\ninterface ErrorContext {\n phase: BuildPhase;\n job: Job;\n}\n\ninterface ErrorHandler {\n regexp: RegExp;\n platform?: Platform;\n phase?: BuildPhase;\n createError: (\n matchResult: RegExpMatchArray,\n errCtx: ErrorContext\n ) => errors.UserError | undefined;\n}\n\nconst errorHandlers: ErrorHandler[] = [\n {\n platform: Platform.IOS,\n phase: BuildPhase.INSTALL_PODS,\n regexp: /requires CocoaPods version/,\n // example log:\n // [!] `React` requires CocoaPods version `>= 1.10.1`, which is not satisfied by your current version, `1.10.0`.\n createError: () => new errors.UnsupportedCocoaPodsVersion(),\n },\n {\n platform: Platform.IOS,\n phase: BuildPhase.RUN_FASTLANE,\n regexp: /Could not find 'bundler' (.*) required by your/,\n // example log:\n // /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/dependency.rb:313:in `to_specs': Could not find 'bundler' (2.2.3) required by your /Users/expo/project/build/ios/Gemfile.lock. (Gem::MissingSpecVersionError)\n createError: () => new errors.UnsupportedBundlerVersion(),\n },\n {\n platform: Platform.ANDROID,\n phase: BuildPhase.RUN_GRADLEW,\n // example log:\n // > Failed to read key keyalias from store \"/build/workingdir/build/generic/keystore-5787e6af-3002-4cb7-8a57-3e73d13313c2.jks\": Invalid keystore format\n regexp: /Invalid keystore format/,\n createError: () => new errors.InvalidKeystoreFormatError(),\n },\n {\n platform: Platform.ANDROID,\n phase: BuildPhase.RUN_GRADLEW,\n // example log:\n // > Failed to read key keyalias from store \"/build/workingdir/build/generic/keystore-286069a8-4bb9-48a6-add9-acf6b58ea06d.jks\": null\n regexp: /Failed to read key[^\\n]+from store/,\n createError: () => new errors.InvalidKeystoreAliasError(),\n },\n {\n platform: Platform.ANDROID,\n phase: BuildPhase.PREBUILD,\n // example log:\n // [15:42:05] Error: Cannot copy google-services.json from /build/workingdir/build/managed/abc to /build/workingdir/build/managed/android/app/google-services.json\n regexp: /Error: Cannot copy google-services\\.json/,\n createError: () => new errors.MissingGoogleServicesJson(),\n },\n {\n platform: Platform.IOS,\n phase: BuildPhase.PREBUILD,\n // example log:\n // [08:44:18] ENOENT: no such file or directory, copyfile '/Users/expo/workingdir/build/managed/abc' -> '/Users/expo/workingdir/build/managed/ios/testapp/GoogleService-Info.plist'\n regexp: /ENOENT: no such file or directory, copyfile .*GoogleService-Info.plist/,\n createError: () => new errors.MissingGoogleServicesPlist(),\n },\n {\n platform: Platform.IOS,\n phase: BuildPhase.INSTALL_PODS,\n // example log:\n // CDN: trunk URL couldn't be downloaded: https://cdn.jsdelivr.net/cocoa/Specs/2/a/e/MultiplatformBleAdapter/0.0.3/MultiplatformBleAdapter.podspec.json Response: 429 429: Too Many Requests\n regexp: /CDN: trunk URL couldn't be downloaded.* Response: 429 429: Too Many Requests/,\n createError: () => {\n // do not report it to user, just send to sentry\n const error = new errors.UnknownError();\n error.innerError = Error('cocoapods: Too Many Requests');\n return error;\n },\n },\n {\n platform: Platform.IOS,\n phase: BuildPhase.INSTALL_PODS,\n // example log:\n // [!] CocoaPods could not find compatible versions for pod \"Firebase/Core\":\n // In snapshot (Podfile.lock):\n // Firebase/Core (= 6.14.0)\n // In Podfile:\n // EXFirebaseCore (from `../node_modules/expo-firebase-core/ios`) was resolved to 3.0.0, which depends on\n // Firebase/Core (= 7.7.0)\n // You have either:\n // * out-of-date source repos which you can update with `pod repo update` or with `pod install --repo-update`.\n // * changed the constraints of dependency `Firebase/Core` inside your development pod `EXFirebaseCore`.\n // You should run `pod update Firebase/Core` to apply changes you've made.\n regexp: /CocoaPods could not find compatible versions for pod /,\n createError: (_, { job }) => {\n const usingDefaultCacheConfig = job.cache.key === '' || !job.cache.key;\n return job.type === Workflow.MANAGED\n ? new errors.IncompatiblePodsManagedWorkflowError(usingDefaultCacheConfig)\n : new errors.IncompatiblePodsGenericWorkflowError(usingDefaultCacheConfig);\n },\n },\n {\n phase: BuildPhase.INSTALL_DEPENDENCIES,\n // example log:\n // [stderr] error https://github.com/expo/react-native/archive/sdk-41.0.0.tar.gz: Integrity check failed for \"react-native\" (computed integrity doesn't match our records, got \"sha512-3jHI2YufrJi7eIABRf/DN/I2yOkmIZ0vAyezTz+PAUJiEs4v//5LLojWEU+W53AZsnuaEMcl/4fVy4bd+OuUbA== sha1-o9QuQTXIkc8VozXPaZIullB9a40=\")\n regexp: /Integrity check failed for \"(.*)\" \\(computed integrity doesn't match our records, got/,\n createError: (matchResult: RegExpMatchArray) => {\n if (matchResult.length >= 2) {\n return new errors.YarnLockChecksumError(matchResult[1]);\n }\n return undefined;\n },\n },\n {\n phase: BuildPhase.INSTALL_DEPENDENCIES,\n // example log:\n // yarn install v1.22.17\n // [1/4] Resolving packages...\n // [2/4] Fetching packages...\n // [1/4] Resolving packages...\n // [2/4] Fetching packages...\n // [stderr] error https://registry.yarnpkg.com/jest-util/-/jest-util-26.6.2.tgz: Extracting tar content of undefined failed, the file appears to be corrupt: \"ENOENT: no such file or directory, chmod '/Users/expo/Library/Caches/Yarn/v6/npm-jest-util-26.6.2-907535dbe4d5a6cb4c47ac9b926f6af29576cbc1-integrity/node_modules/jest-util/build/pluralize.d.ts'\"\n regexp: /\\[1\\/4\\] Resolving packages...\\s*\\[2\\/4\\] Fetching packages...\\s*\\[1\\/4\\] Resolving packages...\\s*\\[2\\/4\\] Fetching packages.../,\n createError: (matchResult: RegExpMatchArray) => {\n if (matchResult) {\n return new errors.YarnMultipleInstancesError();\n }\n return undefined;\n },\n },\n {\n platform: Platform.ANDROID,\n phase: BuildPhase.RUN_GRADLEW,\n regexp: /.*/,\n createError: () => new errors.UnknownGradleError(),\n },\n {\n platform: Platform.IOS,\n phase: BuildPhase.RUN_FASTLANE,\n regexp: /.*/,\n createError: () => new errors.UnknownFastlaneError(),\n },\n];\n\nexport function detectUserError(\n logLines: string[],\n { job, phase }: ErrorContext\n): errors.UserError | undefined {\n const { platform } = job;\n const logs = logLines.join('\\n');\n const handlers = errorHandlers\n .filter((handler) => handler.platform === platform || !handler.platform)\n .filter((handler) => handler.phase === phase || !handler.phase);\n for (const handler of handlers) {\n const match = logs.match(handler.regexp);\n if (match) {\n return handler.createError(match, { job, phase });\n }\n }\n return undefined;\n}\n"]}
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.createNpmErrorHandler = void 0;
|
|
4
|
-
function createNpmErrorHandler(ctx) {
|
|
5
|
-
return (err, logLines) => {
|
|
6
|
-
var _a, _b;
|
|
7
|
-
// 1) corrupted npm package
|
|
8
|
-
let matchedTarball = null;
|
|
9
|
-
for (const logLine of logLines) {
|
|
10
|
-
// [stderr] WARN tarball tarball data for @typescript-eslint/typescript-estree@5.26.0 (sha512-cozo/GbwixVR0sgfHItz3t1yXu521yn71Wj6PlYCFA3WPhy51CUPkifFKfBis91bDclGmAY45hhaAXVjdn4new==) seems to be corrupted. Trying again.
|
|
11
|
-
matchedTarball = logLine.match(/tarball tarball data for ([^ ]*) .* seems to be corrupted. Trying again/);
|
|
12
|
-
if (matchedTarball) {
|
|
13
|
-
break;
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
if (matchedTarball) {
|
|
17
|
-
(_a = ctx.reportError) === null || _a === void 0 ? void 0 : _a.call(ctx, 'Corrupted npm package', err, {
|
|
18
|
-
extras: { buildId: ctx.env.EAS_BUILD_ID, logs: logLines.join('\n') },
|
|
19
|
-
});
|
|
20
|
-
return;
|
|
21
|
-
}
|
|
22
|
-
// 2) generic cache error
|
|
23
|
-
if (ctx.env.EAS_BUILD_NPM_CACHE_URL &&
|
|
24
|
-
logLines.some((line) => line.includes(ctx.env.EAS_BUILD_NPM_CACHE_URL))) {
|
|
25
|
-
(_b = ctx.reportError) === null || _b === void 0 ? void 0 : _b.call(ctx, 'npm cache error', err, {
|
|
26
|
-
extras: { buildId: ctx.env.EAS_BUILD_ID, logs: logLines.join('\n') },
|
|
27
|
-
});
|
|
28
|
-
}
|
|
29
|
-
};
|
|
30
|
-
}
|
|
31
|
-
exports.createNpmErrorHandler = createNpmErrorHandler;
|
|
32
|
-
//# sourceMappingURL=handleNpmError.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"handleNpmError.js","sourceRoot":"","sources":["../../src/utils/handleNpmError.ts"],"names":[],"mappings":";;;AAIA,SAAgB,qBAAqB,CACnC,GAAuB;IAEvB,OAAO,CAAC,GAAU,EAAE,QAAkB,EAAE,EAAE;;QACxC,2BAA2B;QAC3B,IAAI,cAAc,GAA4B,IAAI,CAAC;QACnD,KAAK,MAAM,OAAO,IAAI,QAAQ,EAAE;YAC9B,4NAA4N;YAC5N,cAAc,GAAG,OAAO,CAAC,KAAK,CAC5B,yEAAyE,CAC1E,CAAC;YACF,IAAI,cAAc,EAAE;gBAClB,MAAM;aACP;SACF;QACD,IAAI,cAAc,EAAE;YAClB,MAAA,GAAG,CAAC,WAAW,oDAAG,uBAAuB,EAAE,GAAG,EAAE;gBAC9C,MAAM,EAAE,EAAE,OAAO,EAAE,GAAG,CAAC,GAAG,CAAC,YAAY,EAAE,IAAI,EAAE,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE;aACrE,CAAC,CAAC;YACH,OAAO;SACR;QAED,yBAAyB;QACzB,IACE,GAAG,CAAC,GAAG,CAAC,uBAAuB;YAC/B,QAAQ,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,GAAG,CAAC,uBAAuB,CAAC,CAAC,EACvE;YACA,MAAA,GAAG,CAAC,WAAW,oDAAG,iBAAiB,EAAE,GAAG,EAAE;gBACxC,MAAM,EAAE,EAAE,OAAO,EAAE,GAAG,CAAC,GAAG,CAAC,YAAY,EAAE,IAAI,EAAE,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE;aACrE,CAAC,CAAC;SACJ;IACH,CAAC,CAAC;AACJ,CAAC;AAhCD,sDAgCC","sourcesContent":["import { Job } from '@expo/eas-build-job';\n\nimport { BuildContext } from '../context';\n\nexport function createNpmErrorHandler<TJob extends Job>(\n ctx: BuildContext<TJob>\n): (err: Error, logLines: string[]) => void {\n return (err: Error, logLines: string[]) => {\n // 1) corrupted npm package\n let matchedTarball: RegExpMatchArray | null = null;\n for (const logLine of logLines) {\n // [stderr] WARN tarball tarball data for @typescript-eslint/typescript-estree@5.26.0 (sha512-cozo/GbwixVR0sgfHItz3t1yXu521yn71Wj6PlYCFA3WPhy51CUPkifFKfBis91bDclGmAY45hhaAXVjdn4new==) seems to be corrupted. Trying again.\n matchedTarball = logLine.match(\n /tarball tarball data for ([^ ]*) .* seems to be corrupted. Trying again/\n );\n if (matchedTarball) {\n break;\n }\n }\n if (matchedTarball) {\n ctx.reportError?.('Corrupted npm package', err, {\n extras: { buildId: ctx.env.EAS_BUILD_ID, logs: logLines.join('\\n') },\n });\n return;\n }\n\n // 2) generic cache error\n if (\n ctx.env.EAS_BUILD_NPM_CACHE_URL &&\n logLines.some((line) => line.includes(ctx.env.EAS_BUILD_NPM_CACHE_URL))\n ) {\n ctx.reportError?.('npm cache error', err, {\n extras: { buildId: ctx.env.EAS_BUILD_ID, logs: logLines.join('\\n') },\n });\n }\n };\n}\n"]}
|