@expo/build-tools 1.0.71 → 1.0.73

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.
@@ -2,8 +2,9 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getEasFunctionGroups = void 0;
4
4
  const build_1 = require("./functionGroups/build");
5
+ const maestroTest_1 = require("./functionGroups/maestroTest");
5
6
  function getEasFunctionGroups(ctx) {
6
- return [(0, build_1.createEasBuildBuildFunctionGroup)(ctx)];
7
+ return [(0, build_1.createEasBuildBuildFunctionGroup)(ctx), (0, maestroTest_1.createEasMaestroTestFunctionGroup)(ctx)];
7
8
  }
8
9
  exports.getEasFunctionGroups = getEasFunctionGroups;
9
10
  //# sourceMappingURL=easFunctionGroups.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"easFunctionGroups.js","sourceRoot":"","sources":["../../src/steps/easFunctionGroups.ts"],"names":[],"mappings":";;;AAIA,kDAA0E;AAE1E,SAAgB,oBAAoB,CAAC,GAAuB;IAC1D,OAAO,CAAC,IAAA,wCAAgC,EAAC,GAAG,CAAC,CAAC,CAAC;AACjD,CAAC;AAFD,oDAEC","sourcesContent":["import { BuildFunctionGroup } from '@expo/steps';\n\nimport { CustomBuildContext } from '../customBuildContext';\n\nimport { createEasBuildBuildFunctionGroup } from './functionGroups/build';\n\nexport function getEasFunctionGroups(ctx: CustomBuildContext): BuildFunctionGroup[] {\n return [createEasBuildBuildFunctionGroup(ctx)];\n}\n"]}
1
+ {"version":3,"file":"easFunctionGroups.js","sourceRoot":"","sources":["../../src/steps/easFunctionGroups.ts"],"names":[],"mappings":";;;AAIA,kDAA0E;AAC1E,8DAAiF;AAEjF,SAAgB,oBAAoB,CAAC,GAAuB;IAC1D,OAAO,CAAC,IAAA,wCAAgC,EAAC,GAAG,CAAC,EAAE,IAAA,+CAAiC,EAAC,GAAG,CAAC,CAAC,CAAC;AACzF,CAAC;AAFD,oDAEC","sourcesContent":["import { BuildFunctionGroup } from '@expo/steps';\n\nimport { CustomBuildContext } from '../customBuildContext';\n\nimport { createEasBuildBuildFunctionGroup } from './functionGroups/build';\nimport { createEasMaestroTestFunctionGroup } from './functionGroups/maestroTest';\n\nexport function getEasFunctionGroups(ctx: CustomBuildContext): BuildFunctionGroup[] {\n return [createEasBuildBuildFunctionGroup(ctx), createEasMaestroTestFunctionGroup(ctx)];\n}\n"]}
@@ -0,0 +1,3 @@
1
+ import { BuildFunctionGroup } from '@expo/steps';
2
+ import { CustomBuildContext } from '../../customBuildContext';
3
+ export declare function createEasMaestroTestFunctionGroup(buildToolsContext: CustomBuildContext): BuildFunctionGroup;
@@ -0,0 +1,79 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.createEasMaestroTestFunctionGroup = void 0;
4
+ const steps_1 = require("@expo/steps");
5
+ const eas_build_job_1 = require("@expo/eas-build-job");
6
+ const installMaestro_1 = require("../functions/installMaestro");
7
+ const startIosSimulator_1 = require("../functions/startIosSimulator");
8
+ const startAndroidEmulator_1 = require("../functions/startAndroidEmulator");
9
+ const uploadArtifact_1 = require("../functions/uploadArtifact");
10
+ function createEasMaestroTestFunctionGroup(buildToolsContext) {
11
+ return new steps_1.BuildFunctionGroup({
12
+ namespace: 'eas',
13
+ id: 'maestro_test',
14
+ inputProviders: [
15
+ steps_1.BuildStepInput.createProvider({
16
+ allowedValueTypeName: steps_1.BuildStepInputValueTypeName.STRING,
17
+ id: 'flow_path',
18
+ required: true,
19
+ }),
20
+ ],
21
+ createBuildStepsFromFunctionGroupCall: (globalCtx, { inputs }) => {
22
+ const steps = [
23
+ (0, installMaestro_1.createInstallMaestroBuildFunction)().createBuildStepFromFunctionCall(globalCtx),
24
+ ];
25
+ if (buildToolsContext.job.platform === eas_build_job_1.Platform.IOS) {
26
+ steps.push((0, startIosSimulator_1.createStartIosSimulatorBuildFunction)().createBuildStepFromFunctionCall(globalCtx));
27
+ steps.push(new steps_1.BuildStep(globalCtx, {
28
+ id: steps_1.BuildStep.getNewId(),
29
+ name: 'install_app',
30
+ displayName: `Install app to Simulator`,
31
+ command: `
32
+ for APP_PATH in ios/build/Build/Products/*simulator/*.app; do
33
+ xcrun simctl install booted $APP_PATH
34
+ done
35
+ `,
36
+ }));
37
+ }
38
+ else if (buildToolsContext.job.platform === eas_build_job_1.Platform.ANDROID) {
39
+ steps.push((0, startAndroidEmulator_1.createStartAndroidEmulatorBuildFunction)().createBuildStepFromFunctionCall(globalCtx));
40
+ steps.push(new steps_1.BuildStep(globalCtx, {
41
+ id: steps_1.BuildStep.getNewId(),
42
+ name: 'install_app',
43
+ displayName: `Install app to Emulator`,
44
+ // shopt -s globstar is necessary to add /**/ support
45
+ command: `
46
+ shopt -s globstar
47
+ for APP_PATH in android/app/build/outputs/**/*.apk; do
48
+ adb install $APP_PATH
49
+ done
50
+ `,
51
+ }));
52
+ }
53
+ const flowPaths = `${inputs.flow_path.value}`
54
+ .split('\n') // It's easy to get an empty line with YAML
55
+ .filter((entry) => entry);
56
+ for (const flowPath of flowPaths) {
57
+ steps.push(new steps_1.BuildStep(globalCtx, {
58
+ id: steps_1.BuildStep.getNewId(),
59
+ name: 'maestro_test',
60
+ ifCondition: '${ always() }',
61
+ displayName: `maestro test ${flowPath}`,
62
+ command: `maestro test ${flowPath}`,
63
+ }));
64
+ }
65
+ steps.push((0, uploadArtifact_1.createUploadArtifactBuildFunction)(buildToolsContext).createBuildStepFromFunctionCall(globalCtx, {
66
+ ifCondition: '${ always() }',
67
+ name: 'Upload Maestro test results',
68
+ callInputs: {
69
+ path: '${ eas.env.HOME }/.maestro/',
70
+ ignore_error: true,
71
+ type: 'build-artifact',
72
+ },
73
+ }));
74
+ return steps;
75
+ },
76
+ });
77
+ }
78
+ exports.createEasMaestroTestFunctionGroup = createEasMaestroTestFunctionGroup;
79
+ //# sourceMappingURL=maestroTest.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"maestroTest.js","sourceRoot":"","sources":["../../../src/steps/functionG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AS,CAAC,QAAQ,EAAE;oBACxB,IAAI,EAAE,aAAa;oBACnB,WAAW,EAAE,yBAAyB;oBACtC,qDAAqD;oBACrD,OAAO,EAAE;;;;;aAKR;iBACF,CAAC,CACH,CAAC;YACJ,CAAC;YAED,MAAM,SAAS,GAAG,GAAG,MAAM,CAAC,SAAS,CAAC,KAAK,EAAE;iBAC1C,KAAK,CAAC,IAAI,CAAC,CAAC,2CAA2C;iBACvD,MAAM,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,CAAC;YAC5B,KAAK,MAAM,QAAQ,IAAI,SAAS,EAAE,CAAC;gBACjC,KAAK,CAAC,IAAI,CACR,IAAI,iBAAS,CAAC,SAAS,EAAE;oBACvB,EAAE,EAAE,iBAAS,CAAC,QAAQ,EAAE;oBACxB,IAAI,EAAE,cAAc;oBACpB,WAAW,EAAE,eAAe;oBAC5B,WAAW,EAAE,gBAAgB,QAAQ,EAAE;oBACvC,OAAO,EAAE,gBAAgB,QAAQ,EAAE;iBACpC,CAAC,CACH,CAAC;YACJ,CAAC;YAED,KAAK,CAAC,IAAI,CACR,IAAA,kDAAiC,EAAC,iBAAiB,CAAC,CAAC,+BAA+B,CAClF,SAAS,EACT;gBACE,WAAW,EAAE,eAAe;gBAC5B,IAAI,EAAE,6BAA6B;gBACnC,UAAU,EAAE;oBACV,IAAI,EAAE,6BAA6B;oBACnC,YAAY,EAAE,IAAI;oBAClB,IAAI,EAAE,gBAAgB;iBACvB;aACF,CACF,CACF,CAAC;YAEF,OAAO,KAAK,CAAC;QACf,CAAC;KACF,CAAC,CAAC;AACL,CAAC;AAvFD,8EAuFC","sourcesContent":["import {\n BuildFunctionGroup,\n BuildStep,\n BuildStepInput,\n BuildStepInputValueTypeName,\n} from '@expo/steps';\nimport { Platform } from '@expo/eas-build-job';\n\nimport { CustomBuildContext } from '../../customBuildContext';\nimport { createInstallMaestroBuildFunction } from '../functions/installMaestro';\nimport { createStartIosSimulatorBuildFunction } from '../functions/startIosSimulator';\nimport { createStartAndroidEmulatorBuildFunction } from '../functions/startAndroidEmulator';\nimport { createUploadArtifactBuildFunction } from '../functions/uploadArtifact';\n\nexport function createEasMaestroTestFunctionGroup(\n buildToolsContext: CustomBuildContext\n): BuildFunctionGroup {\n return new BuildFunctionGroup({\n namespace: 'eas',\n id: 'maestro_test',\n inputProviders: [\n BuildStepInput.createProvider({\n allowedValueTypeName: BuildStepInputValueTypeName.STRING,\n id: 'flow_path',\n required: true,\n }),\n ],\n createBuildStepsFromFunctionGroupCall: (globalCtx, { inputs }) => {\n const steps: BuildStep[] = [\n createInstallMaestroBuildFunction().createBuildStepFromFunctionCall(globalCtx),\n ];\n\n if (buildToolsContext.job.platform === Platform.IOS) {\n steps.push(\n createStartIosSimulatorBuildFunction().createBuildStepFromFunctionCall(globalCtx)\n );\n steps.push(\n new BuildStep(globalCtx, {\n id: BuildStep.getNewId(),\n name: 'install_app',\n displayName: `Install app to Simulator`,\n command: `\n for APP_PATH in ios/build/Build/Products/*simulator/*.app; do\n xcrun simctl install booted $APP_PATH\n done\n `,\n })\n );\n } else if (buildToolsContext.job.platform === Platform.ANDROID) {\n steps.push(\n createStartAndroidEmulatorBuildFunction().createBuildStepFromFunctionCall(globalCtx)\n );\n steps.push(\n new BuildStep(globalCtx, {\n id: BuildStep.getNewId(),\n name: 'install_app',\n displayName: `Install app to Emulator`,\n // shopt -s globstar is necessary to add /**/ support\n command: `\n shopt -s globstar\n for APP_PATH in android/app/build/outputs/**/*.apk; do\n adb install $APP_PATH\n done\n `,\n })\n );\n }\n\n const flowPaths = `${inputs.flow_path.value}`\n .split('\\n') // It's easy to get an empty line with YAML\n .filter((entry) => entry);\n for (const flowPath of flowPaths) {\n steps.push(\n new BuildStep(globalCtx, {\n id: BuildStep.getNewId(),\n name: 'maestro_test',\n ifCondition: '${ always() }',\n displayName: `maestro test ${flowPath}`,\n command: `maestro test ${flowPath}`,\n })\n );\n }\n\n steps.push(\n createUploadArtifactBuildFunction(buildToolsContext).createBuildStepFromFunctionCall(\n globalCtx,\n {\n ifCondition: '${ always() }',\n name: 'Upload Maestro test results',\n callInputs: {\n path: '${ eas.env.HOME }/.maestro/',\n ignore_error: true,\n type: 'build-artifact',\n },\n }\n )\n );\n\n return steps;\n },\n });\n}\n"]}
@@ -16,9 +16,13 @@ function createFindAndUploadBuildArtifactsBuildFunction(ctx) {
16
16
  const applicationArchivePatternOrPath = ctx.job.platform === eas_build_job_1.Platform.ANDROID
17
17
  ? (_a = ctx.job.applicationArchivePath) !== null && _a !== void 0 ? _a : 'android/app/build/outputs/**/*.{apk,aab}'
18
18
  : resolveIosArtifactPath(ctx.job);
19
- const applicationArchives = await (0, artifacts_1.findArtifacts)(stepCtx.workingDirectory, applicationArchivePatternOrPath, logger);
19
+ const applicationArchives = await (0, artifacts_1.findArtifacts)({
20
+ rootDir: stepCtx.workingDirectory,
21
+ patternOrPath: applicationArchivePatternOrPath,
22
+ logger,
23
+ });
20
24
  logger.info(`Application archive${applicationArchives.length > 1 ? 's' : ''}: ${applicationArchives.join(', ')}`);
21
- const buildArtifacts = (await Promise.all(((_b = ctx.job.buildArtifactPaths) !== null && _b !== void 0 ? _b : []).map((path) => (0, artifacts_1.findArtifacts)(ctx.projectTargetDirectory, path, logger)))).flat();
25
+ const buildArtifacts = (await Promise.all(((_b = ctx.job.buildArtifactPaths) !== null && _b !== void 0 ? _b : []).map((path) => (0, artifacts_1.findArtifacts)({ rootDir: ctx.projectTargetDirectory, patternOrPath: path, logger })))).flat();
22
26
  if (buildArtifacts.length > 0) {
23
27
  logger.info(`Found additional build artifacts: ${buildArtifacts.join(', ')}`);
24
28
  }
@@ -1 +1 @@
1
- {"version":3,"file":"findAndUploadBuildArtifacts.js","sourceRoot":"","sources":["../../../src/steps/functions/findAndUploadBuildArtifacts.ts"],"names":[],"mappings":";;;AAAA,uDAAyE;AACzE,uCAA4C;AAE5C,qDAAsD;AACtD,6DAAuE;AAGvE,SAAgB,8CAA8C,CAC5D,GAAuB;IAEvB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AAE,CAAC;gBAC1C,MAAM,CAAC,KAAK,CAAC,mCAAmC,CAAC,CAAC;gBAClD,MAAM,eAAe,CAAC,MAAM,CAAC;YAC/B,CAAC;YACD,IAAI,oBAAoB,CAAC,MAAM,KAAK,UAAU,EAAE,CAAC;gBAC/C,MAAM,CAAC,KAAK,CAAC,sCAAsC,oBAAoB,CAAC,MAAM,EAAE,CAAC,CAAC;YACpF,CAAC;YACD,MAAM,CAAC,IAAI,CAAC,iBAAiB,CAAC,CAAC;QACjC,CAAC;KACF,CAAC,CAAC;AACL,CAAC;AAtFD,wGAsFC;AAED,SAAS,sBAAsB,CAAC,GAAY;IAC1C,IAAI,GAAG,CAAC,sBAAsB,EAAE,CAAC;QAC/B,OAAO,GAAG,CAAC,sBAAsB,CAAC;IACpC,CAAC;SAAM,IAAI,GAAG,CAAC,SAAS,EAAE,CAAC;QACzB,OAAO,2CAA2C,CAAC;IACrD,CAAC;SAAM,CAAC;QACN,OAAO,iBAAiB,CAAC;IAC3B,CAAC;AACH,CAAC","sourcesContent":["import { ManagedArtifactType, Ios, Platform } from '@expo/eas-build-job';\nimport { BuildFunction } from '@expo/steps';\n\nimport { findArtifacts } from '../../utils/artifacts';\nimport { findXcodeBuildLogsPathAsync } from '../../ios/xcodeBuildLogs';\nimport { CustomBuildContext } from '../../customBuildContext';\n\nexport function createFindAndUploadBuildArtifactsBuildFunction(\n ctx: CustomBuildContext\n): BuildFunction {\n return new BuildFunction({\n namespace: 'eas',\n id: 'find_and_upload_build_artifacts',\n name: 'Find and upload build artifacts',\n fn: async (stepCtx) => {\n const { logger } = stepCtx;\n const applicationArchivePatternOrPath =\n ctx.job.platform === Platform.ANDROID\n ? ctx.job.applicationArchivePath ?? 'android/app/build/outputs/**/*.{apk,aab}'\n : resolveIosArtifactPath(ctx.job);\n const applicationArchives = await findArtifacts(\n stepCtx.workingDirectory,\n applicationArchivePatternOrPath,\n logger\n );\n logger.info(\n `Application archive${\n applicationArchives.length > 1 ? 's' : ''\n }: ${applicationArchives.join(', ')}`\n );\n const buildArtifacts = (\n await Promise.all(\n (ctx.job.buildArtifactPaths ?? []).map((path) =>\n findArtifacts(ctx.projectTargetDirectory, path, logger)\n )\n )\n ).flat();\n if (buildArtifacts.length > 0) {\n logger.info(`Found additional build artifacts: ${buildArtifacts.join(', ')}`);\n }\n\n logger.info('Uploading...');\n const [archiveUpload, artifactsUpload, xcodeBuildLogsUpload] = await Promise.allSettled([\n ctx.runtimeApi.uploadArtifact({\n artifact: {\n type: ManagedArtifactType.APPLICATION_ARCHIVE,\n paths: applicationArchives,\n },\n logger,\n }),\n (async () => {\n if (buildArtifacts.length > 0) {\n await ctx.runtimeApi.uploadArtifact({\n artifact: {\n type: ManagedArtifactType.BUILD_ARTIFACTS,\n paths: buildArtifacts,\n },\n logger,\n });\n }\n })(),\n (async () => {\n if (ctx.job.platform !== Platform.IOS) {\n return;\n }\n const xcodeBuildLogsPath = await findXcodeBuildLogsPathAsync(\n stepCtx.global.buildLogsDirectory\n );\n if (xcodeBuildLogsPath) {\n await ctx.runtimeApi.uploadArtifact({\n artifact: {\n type: ManagedArtifactType.XCODE_BUILD_LOGS,\n paths: [xcodeBuildLogsPath],\n },\n logger,\n });\n }\n })(),\n ]);\n if (archiveUpload.status === 'rejected') {\n logger.error('Failed to upload application archive.');\n throw archiveUpload.reason;\n }\n if (artifactsUpload.status === 'rejected') {\n logger.error('Failed to upload build artifacts.');\n throw artifactsUpload.reason;\n }\n if (xcodeBuildLogsUpload.status === 'rejected') {\n logger.error(`Failed to upload Xcode build logs. ${xcodeBuildLogsUpload.reason}`);\n }\n logger.info('Upload finished');\n },\n });\n}\n\nfunction resolveIosArtifactPath(job: Ios.Job): string {\n if (job.applicationArchivePath) {\n return job.applicationArchivePath;\n } else if (job.simulator) {\n return 'ios/build/Build/Products/*simulator/*.app';\n } else {\n return 'ios/build/*.ipa';\n }\n}\n"]}
1
+ {"version":3,"file":"findAndUploadBuildArtifacts.js","sourceRoot":"","sources":["../../../src/steps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,EAAE;aACL,CAAC,CAAC;YACH,IAAI,aAAa,CAAC,MAAM,KAAK,UAAU,EAAE,CAAC;gBACxC,MAAM,CAAC,KAAK,CAAC,uCAAuC,CAAC,CAAC;gBACtD,MAAM,aAAa,CAAC,MAAM,CAAC;YAC7B,CAAC;YACD,IAAI,eAAe,CAAC,MAAM,KAAK,UAAU,EAAE,CAAC;gBAC1C,MAAM,CAAC,KAAK,CAAC,mCAAmC,CAAC,CAAC;gBAClD,MAAM,eAAe,CAAC,MAAM,CAAC;YAC/B,CAAC;YACD,IAAI,oBAAoB,CAAC,MAAM,KAAK,UAAU,EAAE,CAAC;gBAC/C,MAAM,CAAC,KAAK,CAAC,sCAAsC,oBAAoB,CAAC,MAAM,EAAE,CAAC,CAAC;YACpF,CAAC;YACD,MAAM,CAAC,IAAI,CAAC,iBAAiB,CAAC,CAAC;QACjC,CAAC;KACF,CAAC,CAAC;AACL,CAAC;AAtFD,wGAsFC;AAED,SAAS,sBAAsB,CAAC,GAAY;IAC1C,IAAI,GAAG,CAAC,sBAAsB,EAAE,CAAC;QAC/B,OAAO,GAAG,CAAC,sBAAsB,CAAC;IACpC,CAAC;SAAM,IAAI,GAAG,CAAC,SAAS,EAAE,CAAC;QACzB,OAAO,2CAA2C,CAAC;IACrD,CAAC;SAAM,CAAC;QACN,OAAO,iBAAiB,CAAC;IAC3B,CAAC;AACH,CAAC","sourcesContent":["import { ManagedArtifactType, Ios, Platform } from '@expo/eas-build-job';\nimport { BuildFunction } from '@expo/steps';\n\nimport { findArtifacts } from '../../utils/artifacts';\nimport { findXcodeBuildLogsPathAsync } from '../../ios/xcodeBuildLogs';\nimport { CustomBuildContext } from '../../customBuildContext';\n\nexport function createFindAndUploadBuildArtifactsBuildFunction(\n ctx: CustomBuildContext\n): BuildFunction {\n return new BuildFunction({\n namespace: 'eas',\n id: 'find_and_upload_build_artifacts',\n name: 'Find and upload build artifacts',\n fn: async (stepCtx) => {\n const { logger } = stepCtx;\n const applicationArchivePatternOrPath =\n ctx.job.platform === Platform.ANDROID\n ? ctx.job.applicationArchivePath ?? 'android/app/build/outputs/**/*.{apk,aab}'\n : resolveIosArtifactPath(ctx.job);\n const applicationArchives = await findArtifacts({\n rootDir: stepCtx.workingDirectory,\n patternOrPath: applicationArchivePatternOrPath,\n logger,\n });\n logger.info(\n `Application archive${\n applicationArchives.length > 1 ? 's' : ''\n }: ${applicationArchives.join(', ')}`\n );\n const buildArtifacts = (\n await Promise.all(\n (ctx.job.buildArtifactPaths ?? []).map((path) =>\n findArtifacts({ rootDir: ctx.projectTargetDirectory, patternOrPath: path, logger })\n )\n )\n ).flat();\n if (buildArtifacts.length > 0) {\n logger.info(`Found additional build artifacts: ${buildArtifacts.join(', ')}`);\n }\n\n logger.info('Uploading...');\n const [archiveUpload, artifactsUpload, xcodeBuildLogsUpload] = await Promise.allSettled([\n ctx.runtimeApi.uploadArtifact({\n artifact: {\n type: ManagedArtifactType.APPLICATION_ARCHIVE,\n paths: applicationArchives,\n },\n logger,\n }),\n (async () => {\n if (buildArtifacts.length > 0) {\n await ctx.runtimeApi.uploadArtifact({\n artifact: {\n type: ManagedArtifactType.BUILD_ARTIFACTS,\n paths: buildArtifacts,\n },\n logger,\n });\n }\n })(),\n (async () => {\n if (ctx.job.platform !== Platform.IOS) {\n return;\n }\n const xcodeBuildLogsPath = await findXcodeBuildLogsPathAsync(\n stepCtx.global.buildLogsDirectory\n );\n if (xcodeBuildLogsPath) {\n await ctx.runtimeApi.uploadArtifact({\n artifact: {\n type: ManagedArtifactType.XCODE_BUILD_LOGS,\n paths: [xcodeBuildLogsPath],\n },\n logger,\n });\n }\n })(),\n ]);\n if (archiveUpload.status === 'rejected') {\n logger.error('Failed to upload application archive.');\n throw archiveUpload.reason;\n }\n if (artifactsUpload.status === 'rejected') {\n logger.error('Failed to upload build artifacts.');\n throw artifactsUpload.reason;\n }\n if (xcodeBuildLogsUpload.status === 'rejected') {\n logger.error(`Failed to upload Xcode build logs. ${xcodeBuildLogsUpload.reason}`);\n }\n logger.info('Upload finished');\n },\n });\n}\n\nfunction resolveIosArtifactPath(job: Ios.Job): string {\n if (job.applicationArchivePath) {\n return job.applicationArchivePath;\n } else if (job.simulator) {\n return 'ios/build/Build/Products/*simulator/*.app';\n } else {\n return 'ios/build/*.ipa';\n }\n}\n"]}
@@ -4,10 +4,10 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.createUploadArtifactBuildFunction = void 0;
7
- const path_1 = __importDefault(require("path"));
7
+ const assert_1 = __importDefault(require("assert"));
8
8
  const eas_build_job_1 = require("@expo/eas-build-job");
9
9
  const steps_1 = require("@expo/steps");
10
- const nullthrows_1 = __importDefault(require("nullthrows"));
10
+ const artifacts_1 = require("../../utils/artifacts");
11
11
  const artifactTypeInputToManagedArtifactType = {
12
12
  'application-archive': eas_build_job_1.ManagedArtifactType.APPLICATION_ARCHIVE,
13
13
  'build-artifact': eas_build_job_1.ManagedArtifactType.BUILD_ARTIFACTS,
@@ -36,23 +36,70 @@ function createUploadArtifactBuildFunction(ctx) {
36
36
  required: false,
37
37
  allowedValueTypeName: steps_1.BuildStepInputValueTypeName.STRING,
38
38
  }),
39
+ /**
40
+ * path inputs expects a list of newline-delimited search paths.
41
+ * Valid examples include:
42
+ * - path: app/artifact.app
43
+ * - path: app/*.app
44
+ * - path: |
45
+ * assets/*.png
46
+ * assets/*.jpg
47
+ * public/another-photo.jpg
48
+ */
39
49
  steps_1.BuildStepInput.createProvider({
40
50
  id: 'path',
41
51
  required: true,
42
52
  allowedValueTypeName: steps_1.BuildStepInputValueTypeName.STRING,
43
53
  }),
54
+ steps_1.BuildStepInput.createProvider({
55
+ id: 'ignore_error',
56
+ required: false,
57
+ allowedValueTypeName: steps_1.BuildStepInputValueTypeName.BOOLEAN,
58
+ }),
44
59
  ],
45
- fn: async (stepsCtx, { inputs }) => {
46
- const filePath = path_1.default.resolve(stepsCtx.workingDirectory, (0, nullthrows_1.default)(inputs.path.value).toString());
60
+ fn: async ({ logger, global }, { inputs }) => {
61
+ (0, assert_1.default)(inputs.path.value, 'Path input cannot be empty.');
62
+ const artifactSearchPaths = inputs.path.value
63
+ .toString()
64
+ .split('\n')
65
+ // It's easy to get an empty line with YAML
66
+ .filter((entry) => entry);
67
+ const artifactsSearchResults = await Promise.allSettled(artifactSearchPaths.map((patternOrPath) => (0, artifacts_1.findArtifacts)({
68
+ rootDir: global.projectTargetDirectory,
69
+ patternOrPath,
70
+ // We're logging the error ourselves.
71
+ logger: null,
72
+ })));
73
+ const artifactPaths = artifactsSearchResults.flatMap((result, index) => {
74
+ if (result.status === 'fulfilled') {
75
+ logger.info(`Found ${result.value.length} paths matching "${artifactSearchPaths[index]}".`);
76
+ return result.value;
77
+ }
78
+ if (result.status === 'rejected' && result.reason instanceof artifacts_1.FindArtifactsError) {
79
+ logger.warn(`Did not find any paths matching "${artifactSearchPaths[index]}. Ignoring.`);
80
+ return [];
81
+ }
82
+ throw result.reason;
83
+ });
47
84
  const artifact = {
48
85
  type: parseArtifactTypeInput(`${inputs.type.value}`),
49
- paths: [filePath],
86
+ paths: artifactPaths,
50
87
  key: inputs.key.value,
51
88
  };
52
- await ctx.runtimeApi.uploadArtifact({
53
- artifact,
54
- logger: stepsCtx.logger,
55
- });
89
+ try {
90
+ await ctx.runtimeApi.uploadArtifact({
91
+ artifact,
92
+ logger,
93
+ });
94
+ }
95
+ catch (error) {
96
+ if (inputs.ignore_error.value) {
97
+ logger.error(`Failed to upload ${artifact.type}. Ignoring error.`, error);
98
+ // Ignoring error.
99
+ return;
100
+ }
101
+ throw error;
102
+ }
56
103
  },
57
104
  });
58
105
  }
@@ -1 +1 @@
1
- {"version":3,"file":"uploadArtifact.js","sourceRoot":"","sources":["../../../src/steps/functions/uploadArtifact.ts"],"names":[],"mappings":";;;;;;AAAA,gDAAwB;AAExB,uDAA+E;AAC/E,uCAAyF;AACzF,4DAAoC;AAIpC,MAAM,sCAAsC,GAAoD;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C,IAAI,CAAC,KAAK,EAAE,CAAC;gBACpD,KAAK,EAAE,CAAC,QAAQ,CAAC;gBACjB,GAAG,EAAE,MAAM,CAAC,GAAG,CAAC,KAAe;aAChC,CAAC;YAEF,MAAM,GAAG,CAAC,UAAU,CAAC,cAAc,CAAC;gBAClC,QAAQ;gBACR,MAAM,EAAE,QAAQ,CAAC,MAAM;aACxB,CAAC,CAAC;QACL,CAAC;KACF,CAAC,CAAC;AACL,CAAC;AAhDD,8EAgDC;AAED;;;;;;;GAOG;AACH,SAAS,sBAAsB,CAAC,KAAa;IAC3C,+CAA+C;IAC/C,kDAAkD;IAClD,kCAAkC;IAClC,MAAM,6BAA6B,GAAG,sCAAsC,CAAC,KAAK,CAAC,CAAC;IACpF,IAAI,6BAA6B,EAAE,CAAC;QAClC,OAAO,6BAA6B,CAAC;IACvC,CAAC;IAED,OAAO,KAAkD,CAAC;AAC5D,CAAC","sourcesContent":["import path from 'path';\n\nimport { GenericArtifactType, ManagedArtifactType } from '@expo/eas-build-job';\nimport { BuildFunction, BuildStepInput, BuildStepInputValueTypeName } from '@expo/steps';\nimport nullthrows from 'nullthrows';\n\nimport { CustomBuildContext } from '../../customBuildContext';\n\nconst artifactTypeInputToManagedArtifactType: Record<string, ManagedArtifactType | undefined> = {\n 'application-archive': ManagedArtifactType.APPLICATION_ARCHIVE,\n 'build-artifact': ManagedArtifactType.BUILD_ARTIFACTS,\n};\n\nexport function createUploadArtifactBuildFunction(ctx: CustomBuildContext): BuildFunction {\n return new BuildFunction({\n namespace: 'eas',\n id: 'upload_artifact',\n name: 'Upload artifact',\n inputProviders: [\n BuildStepInput.createProvider({\n id: 'type',\n defaultValue: ManagedArtifactType.APPLICATION_ARCHIVE,\n allowedValues: [\n ManagedArtifactType.APPLICATION_ARCHIVE,\n ManagedArtifactType.BUILD_ARTIFACTS,\n ...Object.keys(artifactTypeInputToManagedArtifactType),\n ...Object.values(GenericArtifactType),\n ],\n required: true,\n allowedValueTypeName: BuildStepInputValueTypeName.STRING,\n }),\n BuildStepInput.createProvider({\n id: 'key',\n defaultValue: '',\n required: false,\n allowedValueTypeName: BuildStepInputValueTypeName.STRING,\n }),\n BuildStepInput.createProvider({\n id: 'path',\n required: true,\n allowedValueTypeName: BuildStepInputValueTypeName.STRING,\n }),\n ],\n fn: async (stepsCtx, { inputs }) => {\n const filePath = path.resolve(\n stepsCtx.workingDirectory,\n nullthrows(inputs.path.value).toString()\n );\n\n const artifact = {\n type: parseArtifactTypeInput(`${inputs.type.value}`),\n paths: [filePath],\n key: inputs.key.value as string,\n };\n\n await ctx.runtimeApi.uploadArtifact({\n artifact,\n logger: stepsCtx.logger,\n });\n },\n });\n}\n\n/**\n * Initially, upload_artifact supported application-archive and build-artifact.\n * Then, mistakenly, support for it was removed in favor of supporting ManagedArtifactType\n * values. This makes sure we support all:\n * - kebab-case managed artifact types (the original)\n * - snake-caps-case managed artifact types (the mistake)\n * - generic artifact types.\n */\nfunction parseArtifactTypeInput(input: string): GenericArtifactType | ManagedArtifactType {\n // Step's allowedValues ensures input is either\n // a key of artifactTypeInputToManagedArtifactType\n // or a value of an artifact type.\n const translatedManagedArtifactType = artifactTypeInputToManagedArtifactType[input];\n if (translatedManagedArtifactType) {\n return translatedManagedArtifactType;\n }\n\n return input as GenericArtifactType | ManagedArtifactType;\n}\n"]}
1
+ {"version":3,"file":"uploadArtifact.js","sourceRoot":"","sources":["../../../src/steps/functions/uploadArtifact.ts"],"names":[],"mappings":";;;;;;AAAA,oDAA4B;AAE5B,uDAA+E;AAC/E,uCAAyF;AAGzF,qDAA0E;AAE1E,MAAM,sCAAsC,GAAoD;IAC9F,qBAAqB,EAAE,mCAAmB,CAAC,mBAAmB;IAC9D,gBAAgB,EAAE,mCAAmB,CAAC,eAAe;CACtD,CAAC;AAEF,SAAgB,iCAAiC,CAAC,GAAuB;IACvE,OAAO,IAAI,qBAAa,CAAC;QACvB,SAAS,EAAE,KAAK;QAChB,EAAE,EAAE,iBAAiB;QACrB,IAAI,EAA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,MAAM,CAAC,KAAK,CAAC,oBAAoB,QAAQ,CAAC,IAAI,mBAAmB,EAAE,KAAK,CAAC,CAAC;oBAC1E,kBAAkB;oBAClB,OAAO;gBACT,CAAC;gBAED,MAAM,KAAK,CAAC;YACd,CAAC;QACH,CAAC;KACF,CAAC,CAAC;AACL,CAAC;AAvGD,8EAuGC;AAED;;;;;;;GAOG;AACH,SAAS,sBAAsB,CAAC,KAAa;IAC3C,+CAA+C;IAC/C,kDAAkD;IAClD,kCAAkC;IAClC,MAAM,6BAA6B,GAAG,sCAAsC,CAAC,KAAK,CAAC,CAAC;IACpF,IAAI,6BAA6B,EAAE,CAAC;QAClC,OAAO,6BAA6B,CAAC;IACvC,CAAC;IAED,OAAO,KAAkD,CAAC;AAC5D,CAAC","sourcesContent":["import assert from 'assert';\n\nimport { GenericArtifactType, ManagedArtifactType } from '@expo/eas-build-job';\nimport { BuildFunction, BuildStepInput, BuildStepInputValueTypeName } from '@expo/steps';\n\nimport { CustomBuildContext } from '../../customBuildContext';\nimport { FindArtifactsError, findArtifacts } from '../../utils/artifacts';\n\nconst artifactTypeInputToManagedArtifactType: Record<string, ManagedArtifactType | undefined> = {\n 'application-archive': ManagedArtifactType.APPLICATION_ARCHIVE,\n 'build-artifact': ManagedArtifactType.BUILD_ARTIFACTS,\n};\n\nexport function createUploadArtifactBuildFunction(ctx: CustomBuildContext): BuildFunction {\n return new BuildFunction({\n namespace: 'eas',\n id: 'upload_artifact',\n name: 'Upload artifact',\n inputProviders: [\n BuildStepInput.createProvider({\n id: 'type',\n defaultValue: ManagedArtifactType.APPLICATION_ARCHIVE,\n allowedValues: [\n ManagedArtifactType.APPLICATION_ARCHIVE,\n ManagedArtifactType.BUILD_ARTIFACTS,\n ...Object.keys(artifactTypeInputToManagedArtifactType),\n ...Object.values(GenericArtifactType),\n ],\n required: true,\n allowedValueTypeName: BuildStepInputValueTypeName.STRING,\n }),\n BuildStepInput.createProvider({\n id: 'key',\n defaultValue: '',\n required: false,\n allowedValueTypeName: BuildStepInputValueTypeName.STRING,\n }),\n /**\n * path inputs expects a list of newline-delimited search paths.\n * Valid examples include:\n * - path: app/artifact.app\n * - path: app/*.app\n * - path: |\n * assets/*.png\n * assets/*.jpg\n * public/another-photo.jpg\n */\n BuildStepInput.createProvider({\n id: 'path',\n required: true,\n allowedValueTypeName: BuildStepInputValueTypeName.STRING,\n }),\n BuildStepInput.createProvider({\n id: 'ignore_error',\n required: false,\n allowedValueTypeName: BuildStepInputValueTypeName.BOOLEAN,\n }),\n ],\n fn: async ({ logger, global }, { inputs }) => {\n assert(inputs.path.value, 'Path input cannot be empty.');\n\n const artifactSearchPaths = inputs.path.value\n .toString()\n .split('\\n')\n // It's easy to get an empty line with YAML\n .filter((entry) => entry);\n\n const artifactsSearchResults = await Promise.allSettled(\n artifactSearchPaths.map((patternOrPath) =>\n findArtifacts({\n rootDir: global.projectTargetDirectory,\n patternOrPath,\n // We're logging the error ourselves.\n logger: null,\n })\n )\n );\n\n const artifactPaths = artifactsSearchResults.flatMap((result, index) => {\n if (result.status === 'fulfilled') {\n logger.info(\n `Found ${result.value.length} paths matching \"${artifactSearchPaths[index]}\".`\n );\n return result.value;\n }\n\n if (result.status === 'rejected' && result.reason instanceof FindArtifactsError) {\n logger.warn(`Did not find any paths matching \"${artifactSearchPaths[index]}. Ignoring.`);\n return [];\n }\n\n throw result.reason;\n });\n\n const artifact = {\n type: parseArtifactTypeInput(`${inputs.type.value}`),\n paths: artifactPaths,\n key: inputs.key.value as string,\n };\n\n try {\n await ctx.runtimeApi.uploadArtifact({\n artifact,\n logger,\n });\n } catch (error) {\n if (inputs.ignore_error.value) {\n logger.error(`Failed to upload ${artifact.type}. Ignoring error.`, error);\n // Ignoring error.\n return;\n }\n\n throw error;\n }\n },\n });\n}\n\n/**\n * Initially, upload_artifact supported application-archive and build-artifact.\n * Then, mistakenly, support for it was removed in favor of supporting ManagedArtifactType\n * values. This makes sure we support all:\n * - kebab-case managed artifact types (the original)\n * - snake-caps-case managed artifact types (the mistake)\n * - generic artifact types.\n */\nfunction parseArtifactTypeInput(input: string): GenericArtifactType | ManagedArtifactType {\n // Step's allowedValues ensures input is either\n // a key of artifactTypeInputToManagedArtifactType\n // or a value of an artifact type.\n const translatedManagedArtifactType = artifactTypeInputToManagedArtifactType[input];\n if (translatedManagedArtifactType) {\n return translatedManagedArtifactType;\n }\n\n return input as GenericArtifactType | ManagedArtifactType;\n}\n"]}
@@ -2,7 +2,14 @@
2
2
  import { bunyan } from '@expo/logger';
3
3
  import { Job } from '@expo/eas-build-job';
4
4
  import { BuildContext } from '../context';
5
- export declare function findArtifacts(rootDir: string, patternOrPath: string, buildLogger: bunyan): Promise<string[]>;
5
+ export declare class FindArtifactsError extends Error {
6
+ }
7
+ export declare function findArtifacts({ rootDir, patternOrPath, logger, }: {
8
+ rootDir: string;
9
+ patternOrPath: string;
10
+ /** If provided, will log error suggesting possible files to upload. */
11
+ logger: bunyan | null;
12
+ }): Promise<string[]>;
6
13
  export declare function maybeFindAndUploadBuildArtifacts(ctx: BuildContext<Job>, { logger }: {
7
14
  logger: bunyan;
8
15
  }): Promise<void>;
@@ -3,20 +3,25 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.uploadApplicationArchive = exports.maybeFindAndUploadBuildArtifacts = exports.findArtifacts = void 0;
6
+ exports.uploadApplicationArchive = exports.maybeFindAndUploadBuildArtifacts = exports.findArtifacts = exports.FindArtifactsError = void 0;
7
7
  const path_1 = __importDefault(require("path"));
8
8
  const fs_extra_1 = __importDefault(require("fs-extra"));
9
9
  const fast_glob_1 = __importDefault(require("fast-glob"));
10
10
  const eas_build_job_1 = require("@expo/eas-build-job");
11
- async function findArtifacts(rootDir, patternOrPath, buildLogger) {
11
+ class FindArtifactsError extends Error {
12
+ }
13
+ exports.FindArtifactsError = FindArtifactsError;
14
+ async function findArtifacts({ rootDir, patternOrPath, logger, }) {
12
15
  const files = await (0, fast_glob_1.default)(patternOrPath, { cwd: rootDir, onlyFiles: false });
13
16
  if (files.length === 0) {
14
17
  if (fast_glob_1.default.isDynamicPattern(patternOrPath)) {
15
- throw new Error(`There are no files matching pattern "${patternOrPath}"`);
18
+ throw new FindArtifactsError(`There are no files matching pattern "${patternOrPath}"`);
16
19
  }
17
20
  else {
18
- await logMissingFileError(path_1.default.join(rootDir, patternOrPath), buildLogger);
19
- throw new Error(`No such file or directory ${patternOrPath}`);
21
+ if (logger) {
22
+ await logMissingFileError(path_1.default.join(rootDir, patternOrPath), logger);
23
+ }
24
+ throw new FindArtifactsError(`No such file or directory ${patternOrPath}`);
20
25
  }
21
26
  }
22
27
  return files.map((relativePath) => path_1.default.join(rootDir, relativePath));
@@ -44,7 +49,11 @@ async function maybeFindAndUploadBuildArtifacts(ctx, { logger }) {
44
49
  return;
45
50
  }
46
51
  try {
47
- const buildArtifacts = (await Promise.all(ctx.job.buildArtifactPaths.map((path) => findArtifacts(ctx.getReactNativeProjectDirectory(), path, logger)))).flat();
52
+ const buildArtifacts = (await Promise.all(ctx.job.buildArtifactPaths.map((path) => findArtifacts({
53
+ rootDir: ctx.getReactNativeProjectDirectory(),
54
+ patternOrPath: path,
55
+ logger,
56
+ })))).flat();
48
57
  logger.info(`Build artifacts: ${buildArtifacts.join(', ')}`);
49
58
  logger.info('Uploading build artifacts...');
50
59
  await ctx.uploadArtifact({
@@ -61,7 +70,7 @@ async function maybeFindAndUploadBuildArtifacts(ctx, { logger }) {
61
70
  }
62
71
  exports.maybeFindAndUploadBuildArtifacts = maybeFindAndUploadBuildArtifacts;
63
72
  async function uploadApplicationArchive(ctx, { logger, patternOrPath, rootDir, }) {
64
- const applicationArchives = await findArtifacts(rootDir, patternOrPath, logger);
73
+ const applicationArchives = await findArtifacts({ rootDir, patternOrPath, logger });
65
74
  logger.info(`Application archives: ${applicationArchives.join(', ')}`);
66
75
  logger.info('Uploading application archive...');
67
76
  await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AAC,CAAC;IACL,CAAC;IAAC,OAAO,GAAQ,EAAE,CAAC;QAClB,MAAM,CAAC,KAAK,CAAC,EAAE,GAAG,EAAE,EAAE,kCAAkC,CAAC,CAAC;IAC5D,CAAC;AACH,CAAC;AA3BD,4EA2BC;AAEM,KAAK,UAAU,wBAAwB,CAC5C,GAAsB,EACtB,EACE,MAAM,EACN,aAAa,EACb,OAAO,GAKR;IAED,MAAM,mBAAmB,GAAG,MAAM,aAAa,CAAC,OAAO,EAAE,aAAa,EAAE,MAAM,CAAC,CAAC;IAChF,MAAM,CAAC,IAAI,CAAC,yBAAyB,mBAAmB,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IACvE,MAAM,CAAC,IAAI,CAAC,kCAAkC,CAAC,CAAC;IAChD,MAAM,GAAG,CAAC,cAAc,CAAC;QACvB,QAAQ,EAAE;YACR,IAAI,EAAE,mCAAmB,CAAC,mBAAmB;YAC7C,KAAK,EAAE,mBAAmB;SAC3B;QACD,MAAM;KACP,CAAC,CAAC;AACL,CAAC;AAtBD,4DAsBC","sourcesContent":["import path from 'path';\n\nimport fs from 'fs-extra';\nimport fg from 'fast-glob';\nimport { bunyan } from '@expo/logger';\nimport { ManagedArtifactType, Job } from '@expo/eas-build-job';\n\nimport { BuildContext } from '../context';\n\nexport async function findArtifacts(\n rootDir: string,\n patternOrPath: string,\n buildLogger: bunyan\n): Promise<string[]> {\n const files = await fg(patternOrPath, { cwd: rootDir, onlyFiles: false });\n if (files.length === 0) {\n if (fg.isDynamicPattern(patternOrPath)) {\n throw new Error(`There are no files matching pattern \"${patternOrPath}\"`);\n } else {\n await logMissingFileError(path.join(rootDir, patternOrPath), buildLogger);\n throw new Error(`No such file or directory ${patternOrPath}`);\n }\n }\n return files.map((relativePath) => path.join(rootDir, relativePath));\n}\n\nasync function logMissingFileError(artifactPath: string, buildLogger: bunyan): Promise<void> {\n let currentPath = artifactPath;\n while (!(await fs.pathExists(currentPath))) {\n currentPath = path.resolve(currentPath, '..');\n }\n if (currentPath === path.resolve(currentPath, '..')) {\n buildLogger.error(`There is no such file or directory \"${artifactPath}\".`);\n return;\n }\n const dirContent = await fs.readdir(currentPath);\n if (dirContent.length === 0) {\n buildLogger.error(\n `There is no such file or directory \"${artifactPath}\". Directory \"${currentPath}\" is empty.`\n );\n } else {\n buildLogger.error(\n `There is no such file or directory \"${artifactPath}\". Directory \"${currentPath}\" contains [${dirContent.join(\n ', '\n )}].`\n );\n }\n}\n\nexport async function maybeFindAndUploadBuildArtifacts(\n ctx: BuildContext<Job>,\n { logger }: { logger: bunyan }\n): Promise<void> {\n if (!ctx.job.buildArtifactPaths || ctx.job.buildArtifactPaths.length === 0) {\n return;\n }\n try {\n const buildArtifacts = (\n await Promise.all(\n ctx.job.buildArtifactPaths.map((path) =>\n findArtifacts(ctx.getReactNativeProjectDirectory(), path, logger)\n )\n )\n ).flat();\n logger.info(`Build artifacts: ${buildArtifacts.join(', ')}`);\n logger.info('Uploading build artifacts...');\n await ctx.uploadArtifact({\n artifact: {\n type: ManagedArtifactType.BUILD_ARTIFACTS,\n paths: buildArtifacts,\n },\n logger,\n });\n } catch (err: any) {\n logger.error({ err }, 'Failed to upload build artifacts');\n }\n}\n\nexport async function uploadApplicationArchive(\n ctx: BuildContext<Job>,\n {\n logger,\n patternOrPath,\n rootDir,\n }: {\n logger: bunyan;\n patternOrPath: string;\n rootDir: string;\n }\n): Promise<void> {\n const applicationArchives = await findArtifacts(rootDir, patternOrPath, logger);\n logger.info(`Application archives: ${applicationArchives.join(', ')}`);\n logger.info('Uploading application archive...');\n await ctx.uploadArtifact({\n artifact: {\n type: ManagedArtifactType.APPLICATION_ARCHIVE,\n paths: applicationArchives,\n },\n logger,\n });\n}\n"]}
1
+ {"version":3,"file":"artifacts.js","sourceRoot":"","sources":["../../src/utils/artifacts.ts"],"names":[],"mappings":";;;;;;AAAA,gDAAwB;AAExB,wDAA0B;AAC1B,0DAA2B;AAE3B,uDAA+D;AAI/D,MAAa,kBA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EAAE,CAAC;QAClB,MAAM,CAAC,KAAK,CAAC,EAAE,GAAG,EAAE,EAAE,kCAAkC,CAAC,CAAC;IAC5D,CAAC;AACH,CAAC;AA/BD,4EA+BC;AAEM,KAAK,UAAU,wBAAwB,CAC5C,GAAsB,EACtB,EACE,MAAM,EACN,aAAa,EACb,OAAO,GAKR;IAED,MAAM,mBAAmB,GAAG,MAAM,aAAa,CAAC,EAAE,OAAO,EAAE,aAAa,EAAE,MAAM,EAAE,CAAC,CAAC;IACpF,MAAM,CAAC,IAAI,CAAC,yBAAyB,mBAAmB,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IACvE,MAAM,CAAC,IAAI,CAAC,kCAAkC,CAAC,CAAC;IAChD,MAAM,GAAG,CAAC,cAAc,CAAC;QACvB,QAAQ,EAAE;YACR,IAAI,EAAE,mCAAmB,CAAC,mBAAmB;YAC7C,KAAK,EAAE,mBAAmB;SAC3B;QACD,MAAM;KACP,CAAC,CAAC;AACL,CAAC;AAtBD,4DAsBC","sourcesContent":["import path from 'path';\n\nimport fs from 'fs-extra';\nimport fg from 'fast-glob';\nimport { bunyan } from '@expo/logger';\nimport { ManagedArtifactType, Job } from '@expo/eas-build-job';\n\nimport { BuildContext } from '../context';\n\nexport class FindArtifactsError extends Error {}\n\nexport async function findArtifacts({\n rootDir,\n patternOrPath,\n logger,\n}: {\n rootDir: string;\n patternOrPath: string;\n /** If provided, will log error suggesting possible files to upload. */\n logger: bunyan | null;\n}): Promise<string[]> {\n const files = await fg(patternOrPath, { cwd: rootDir, onlyFiles: false });\n if (files.length === 0) {\n if (fg.isDynamicPattern(patternOrPath)) {\n throw new FindArtifactsError(`There are no files matching pattern \"${patternOrPath}\"`);\n } else {\n if (logger) {\n await logMissingFileError(path.join(rootDir, patternOrPath), logger);\n }\n throw new FindArtifactsError(`No such file or directory ${patternOrPath}`);\n }\n }\n return files.map((relativePath) => path.join(rootDir, relativePath));\n}\n\nasync function logMissingFileError(artifactPath: string, buildLogger: bunyan): Promise<void> {\n let currentPath = artifactPath;\n while (!(await fs.pathExists(currentPath))) {\n currentPath = path.resolve(currentPath, '..');\n }\n if (currentPath === path.resolve(currentPath, '..')) {\n buildLogger.error(`There is no such file or directory \"${artifactPath}\".`);\n return;\n }\n const dirContent = await fs.readdir(currentPath);\n if (dirContent.length === 0) {\n buildLogger.error(\n `There is no such file or directory \"${artifactPath}\". Directory \"${currentPath}\" is empty.`\n );\n } else {\n buildLogger.error(\n `There is no such file or directory \"${artifactPath}\". Directory \"${currentPath}\" contains [${dirContent.join(\n ', '\n )}].`\n );\n }\n}\n\nexport async function maybeFindAndUploadBuildArtifacts(\n ctx: BuildContext<Job>,\n { logger }: { logger: bunyan }\n): Promise<void> {\n if (!ctx.job.buildArtifactPaths || ctx.job.buildArtifactPaths.length === 0) {\n return;\n }\n try {\n const buildArtifacts = (\n await Promise.all(\n ctx.job.buildArtifactPaths.map((path) =>\n findArtifacts({\n rootDir: ctx.getReactNativeProjectDirectory(),\n patternOrPath: path,\n logger,\n })\n )\n )\n ).flat();\n logger.info(`Build artifacts: ${buildArtifacts.join(', ')}`);\n logger.info('Uploading build artifacts...');\n await ctx.uploadArtifact({\n artifact: {\n type: ManagedArtifactType.BUILD_ARTIFACTS,\n paths: buildArtifacts,\n },\n logger,\n });\n } catch (err: any) {\n logger.error({ err }, 'Failed to upload build artifacts');\n }\n}\n\nexport async function uploadApplicationArchive(\n ctx: BuildContext<Job>,\n {\n logger,\n patternOrPath,\n rootDir,\n }: {\n logger: bunyan;\n patternOrPath: string;\n rootDir: string;\n }\n): Promise<void> {\n const applicationArchives = await findArtifacts({ rootDir, patternOrPath, logger });\n logger.info(`Application archives: ${applicationArchives.join(', ')}`);\n logger.info('Uploading application archive...');\n await ctx.uploadArtifact({\n artifact: {\n type: ManagedArtifactType.APPLICATION_ARCHIVE,\n paths: applicationArchives,\n },\n logger,\n });\n}\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@expo/build-tools",
3
- "version": "1.0.71",
3
+ "version": "1.0.73",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "files": [
@@ -29,7 +29,7 @@
29
29
  "@expo/logger": "1.0.57",
30
30
  "@expo/package-manager": "1.1.2",
31
31
  "@expo/plist": "^0.0.20",
32
- "@expo/steps": "1.0.70",
32
+ "@expo/steps": "1.0.72",
33
33
  "@expo/template-file": "1.0.57",
34
34
  "@expo/turtle-spawn": "1.0.57",
35
35
  "@expo/xcpretty": "^4.3.0",
@@ -69,5 +69,5 @@
69
69
  "node": "20.11.0",
70
70
  "yarn": "1.22.21"
71
71
  },
72
- "gitHead": "93f70d347dfe4edda628d6969d51c36b485ee9fd"
72
+ "gitHead": "823319c71b5a72a51776b501f2ba771b2c8dc2cc"
73
73
  }