@expo/build-tools 1.0.250 → 1.0.252
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/android/gradleConfig.js +2 -2
- package/dist/android/gradleConfig.js.map +1 -1
- package/dist/builders/custom.js +14 -1
- package/dist/builders/custom.js.map +1 -1
- package/dist/common/projectSources.d.ts +1 -1
- package/dist/common/projectSources.js +1 -1
- package/dist/common/projectSources.js.map +1 -1
- package/dist/common/setup.js +11 -1
- package/dist/common/setup.js.map +1 -1
- package/dist/generic.js +17 -1
- package/dist/generic.js.map +1 -1
- package/dist/ios/fastfile.js +14 -9
- package/dist/ios/fastfile.js.map +1 -1
- package/dist/ios/gymfile.js +11 -7
- package/dist/ios/gymfile.js.map +1 -1
- package/dist/steps/functions/generateGymfileFromTemplate.js +5 -17
- package/dist/steps/functions/generateGymfileFromTemplate.js.map +1 -1
- package/dist/steps/functions/useNpmToken.js +3 -4
- package/dist/steps/functions/useNpmToken.js.map +1 -1
- package/dist/steps/utils/android/gradleConfig.js +11 -8
- package/dist/steps/utils/android/gradleConfig.js.map +1 -1
- package/dist/templates/EasBuildConfigureVersionGradle.d.ts +1 -0
- package/{templates/eas-build-configure-version.gradle.template → dist/templates/EasBuildConfigureVersionGradle.js} +6 -1
- package/dist/templates/EasBuildConfigureVersionGradle.js.map +1 -0
- package/dist/templates/EasBuildGradle.d.ts +1 -0
- package/{templates/eas-build.gradle → dist/templates/EasBuildGradle.js} +6 -2
- package/dist/templates/EasBuildGradle.js.map +1 -0
- package/dist/templates/EasBuildInjectAndroidCredentialsGradle.d.ts +1 -0
- package/{templates/eas-build-inject-android-credentials.gradle → dist/templates/EasBuildInjectAndroidCredentialsGradle.js} +6 -2
- package/dist/templates/EasBuildInjectAndroidCredentialsGradle.js.map +1 -0
- package/dist/templates/FastfileResign.d.ts +1 -0
- package/{templates/Fastfile.resign.template → dist/templates/FastfileResign.js} +6 -1
- package/dist/templates/FastfileResign.js.map +1 -0
- package/dist/templates/GymfileArchive.d.ts +1 -0
- package/{templates/Gymfile.archive.template → dist/templates/GymfileArchive.js} +7 -2
- package/dist/templates/GymfileArchive.js.map +1 -0
- package/dist/templates/GymfileSimulator.d.ts +1 -0
- package/{templates/Gymfile.simulator.template → dist/templates/GymfileSimulator.js} +6 -1
- package/dist/templates/GymfileSimulator.js.map +1 -0
- package/dist/templates/npmrc.d.ts +1 -0
- package/dist/templates/npmrc.js +7 -0
- package/dist/templates/npmrc.js.map +1 -0
- package/dist/utils/npmrc.js +3 -4
- package/dist/utils/npmrc.js.map +1 -1
- package/package.json +5 -5
- package/templates/npmrc +0 -2
|
@@ -7,7 +7,7 @@ exports.configureBuildGradle = configureBuildGradle;
|
|
|
7
7
|
const path_1 = __importDefault(require("path"));
|
|
8
8
|
const config_plugins_1 = require("@expo/config-plugins");
|
|
9
9
|
const fs_extra_1 = __importDefault(require("fs-extra"));
|
|
10
|
-
const
|
|
10
|
+
const EasBuildGradle_1 = require("../templates/EasBuildGradle");
|
|
11
11
|
const APPLY_EAS_BUILD_GRADLE_LINE = 'apply from: "./eas-build.gradle"';
|
|
12
12
|
async function configureBuildGradle(ctx) {
|
|
13
13
|
ctx.logger.info('Injecting signing config into build.gradle');
|
|
@@ -28,7 +28,7 @@ function getEasBuildGradlePath(projectRoot) {
|
|
|
28
28
|
}
|
|
29
29
|
async function createEasBuildGradle(projectRoot) {
|
|
30
30
|
const easBuildGradlePath = getEasBuildGradlePath(projectRoot);
|
|
31
|
-
await fs_extra_1.default.
|
|
31
|
+
await fs_extra_1.default.writeFile(easBuildGradlePath, EasBuildGradle_1.EasBuildGradle);
|
|
32
32
|
}
|
|
33
33
|
async function addApplyToBuildGradle(projectRoot) {
|
|
34
34
|
const buildGradlePath = config_plugins_1.AndroidConfig.Paths.getAppBuildGradleFilePath(projectRoot);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gradleConfig.js","sourceRoot":"","sources":["../../src/android/gradleConfig.ts"],"names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qBAAqB,CAAC,WAAmB;IACtD,MAAM,eAAe,GAAG,8BAAa,CAAC,KAAK,CAAC,yBAAyB,CAAC,WAAW,CAAC,CAAC;IACnF,MAAM,mBAAmB,GAAG,MAAM,kBAAE,CAAC,QAAQ,CAAC,cAAI,CAAC,IAAI,CAAC,eAAe,CAAC,EAAE,MAAM,CAAC,CAAC;IAElF,IAAI,OAAO,CAAC,mBAAmB,EAAE,2BAA2B,CAAC,EAAE,CAAC;QAC9D,OAAO;IACT,CAAC;IAED,MAAM,kBAAE,CAAC,SAAS,CAChB,eAAe,EACf,GAAG,mBAAmB,CAAC,IAAI,EAAE,KAAK,2BAA2B,IAAI,CAClE,CAAC;AACJ,CAAC;AAED,SAAS,OAAO,CAAC,QAAgB,EAAE,MAAc;IAC/C,OAAO,CACL,QAAQ;SACL,OAAO,CAAC,OAAO,EAAE,IAAI,CAAC;SACtB,KAAK,CAAC,IAAI,CAAC;QACZ,0CAA0C;SACzC,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,KAAK,MAAM,IAAI,IAAI,KAAK,MAAM,CAAC,OAAO,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC,CACzE,CAAC;AACJ,CAAC","sourcesContent":["import path from 'path';\n\nimport { AndroidConfig } from '@expo/config-plugins';\nimport { Android } from '@expo/eas-build-job';\nimport fs from 'fs-extra';\n\nimport { BuildContext } from '../context';\nimport { EasBuildGradle } from '../templates/EasBuildGradle';\nconst APPLY_EAS_BUILD_GRADLE_LINE = 'apply from: \"./eas-build.gradle\"';\n\nexport async function configureBuildGradle(ctx: BuildContext<Android.Job>): Promise<void> {\n ctx.logger.info('Injecting signing config into build.gradle');\n if (await fs.pathExists(getEasBuildGradlePath(ctx.getReactNativeProjectDirectory()))) {\n ctx.markBuildPhaseHasWarnings();\n ctx.logger.warn('eas-build.gradle script is deprecated, please remove it from your project.');\n }\n await deleteEasBuildGradle(ctx.getReactNativeProjectDirectory());\n await createEasBuildGradle(ctx.getReactNativeProjectDirectory());\n await addApplyToBuildGradle(ctx.getReactNativeProjectDirectory());\n}\n\nasync function deleteEasBuildGradle(projectRoot: string): Promise<void> {\n const easBuildGradlePath = getEasBuildGradlePath(projectRoot);\n await fs.remove(easBuildGradlePath);\n}\n\nfunction getEasBuildGradlePath(projectRoot: string): string {\n return path.join(projectRoot, 'android/app/eas-build.gradle');\n}\n\nasync function createEasBuildGradle(projectRoot: string): Promise<void> {\n const easBuildGradlePath = getEasBuildGradlePath(projectRoot);\n await fs.writeFile(easBuildGradlePath, EasBuildGradle);\n}\n\nasync function addApplyToBuildGradle(projectRoot: string): Promise<void> {\n const buildGradlePath = AndroidConfig.Paths.getAppBuildGradleFilePath(projectRoot);\n const buildGradleContents = await fs.readFile(path.join(buildGradlePath), 'utf8');\n\n if (hasLine(buildGradleContents, APPLY_EAS_BUILD_GRADLE_LINE)) {\n return;\n }\n\n await fs.writeFile(\n buildGradlePath,\n `${buildGradleContents.trim()}\\n${APPLY_EAS_BUILD_GRADLE_LINE}\\n`\n );\n}\n\nfunction hasLine(haystack: string, needle: string): boolean {\n return (\n haystack\n .replace(/\\r\\n/g, '\\n')\n .split('\\n')\n // Check for both single and double quotes\n .some((line) => line === needle || line === needle.replace(/\"/g, \"'\"))\n );\n}\n"]}
|
package/dist/builders/custom.js
CHANGED
|
@@ -6,6 +6,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
exports.runCustomBuildAsync = runCustomBuildAsync;
|
|
7
7
|
const assert_1 = __importDefault(require("assert"));
|
|
8
8
|
const path_1 = __importDefault(require("path"));
|
|
9
|
+
const promises_1 = __importDefault(require("fs/promises"));
|
|
9
10
|
const nullthrows_1 = __importDefault(require("nullthrows"));
|
|
10
11
|
const eas_build_job_1 = require("@expo/eas-build-job");
|
|
11
12
|
const steps_1 = require("@expo/steps");
|
|
@@ -15,10 +16,22 @@ const customBuildContext_1 = require("../customBuildContext");
|
|
|
15
16
|
const easBuildInternal_1 = require("../common/easBuildInternal");
|
|
16
17
|
const easFunctionGroups_1 = require("../steps/easFunctionGroups");
|
|
17
18
|
const xcodeBuildLogs_1 = require("../ios/xcodeBuildLogs");
|
|
19
|
+
const retry_1 = require("../utils/retry");
|
|
18
20
|
async function runCustomBuildAsync(ctx) {
|
|
19
21
|
var _a, _b;
|
|
20
22
|
const customBuildCtx = new customBuildContext_1.CustomBuildContext(ctx);
|
|
21
|
-
await (
|
|
23
|
+
await ctx.runBuildPhase(eas_build_job_1.BuildPhase.PREPARE_PROJECT, async () => {
|
|
24
|
+
await (0, retry_1.retryAsync)(async () => {
|
|
25
|
+
await promises_1.default.rm(customBuildCtx.projectSourceDirectory, { recursive: true, force: true });
|
|
26
|
+
await promises_1.default.mkdir(customBuildCtx.projectSourceDirectory, { recursive: true });
|
|
27
|
+
await (0, projectSources_1.prepareProjectSourcesAsync)(ctx, customBuildCtx.projectSourceDirectory);
|
|
28
|
+
}, {
|
|
29
|
+
retryOptions: {
|
|
30
|
+
retries: 3,
|
|
31
|
+
retryIntervalMs: 1000,
|
|
32
|
+
},
|
|
33
|
+
});
|
|
34
|
+
});
|
|
22
35
|
if (ctx.job.triggeredBy === eas_build_job_1.BuildTrigger.GIT_BASED_INTEGRATION) {
|
|
23
36
|
// We need to setup envs from eas.json
|
|
24
37
|
const env = await (0, easBuildInternal_1.resolveEnvFromBuildProfileAsync)(ctx, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"custom.js","sourceRoot":"","sources":["../../src/builders/custom.ts"],"names":[],"mappings":";;;;;
|
|
1
|
+
{"version":3,"file":"custom.js","sourceRoot":"","sources":["../../src/builders/custom.ts"],"names":[],"mappings":";;;;;AAiBA,kDAuFC;AAxGD,oDAA4B;AAC5B,gDAAwB;AACxB,2DAA6B;AAE7B,4DAAoC;AACpC,uDAAwF;AACxF,uCAAmG;AAGnG,6DAAsE;AACtE,wDAAwD;AACxD,8DAA2D;AAC3D,iEAA6E;AAC7E,kEAAkE;AAClE,0DAAyE;AACzE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ACD,MAAM,UAAU,CAAC;QACnB,CAAC;IACH,CAAC,CAAC,CAAC;IACH,IAAI,CAAC;QACH,IAAI,CAAC;YACH,MAAM,QAAQ,CAAC,YAAY,EAAE,CAAC;QAChC,CAAC;gBAAS,CAAC;YACT,IAAI,CAAC,GAAG,CAAC,SAAS,CAAC,gBAAgB,IAAI,GAAG,CAAC,GAAG,CAAC,QAAQ,KAAK,wBAAQ,CAAC,GAAG,EAAE,CAAC;gBACzE,IAAI,CAAC;oBACH,MAAM,IAAA,iDAAgC,EAAC,GAA4B,EAAE;wBACnE,MAAM,EAAE,GAAG,CAAC,MAAM;qBACnB,CAAC,CAAC;gBACL,CAAC;gBAAC,MAAM,CAAC;oBACP,yCAAyC;gBAC3C,CAAC;YACH,CAAC;QACH,CAAC;IACH,CAAC;IAAC,OAAO,GAAQ,EAAE,CAAC;QAClB,GAAG,CAAC,SAAS,GAAG,GAAG,CAAC,SAAS,CAAC;QAC9B,MAAM,GAAG,CAAC;IACZ,CAAC;IAED,OAAO,GAAG,CAAC,SAAS,CAAC;AACvB,CAAC","sourcesContent":["import assert from 'assert';\nimport path from 'path';\nimport fs from 'fs/promises';\n\nimport nullthrows from 'nullthrows';\nimport { BuildJob, BuildPhase, BuildTrigger, Ios, Platform } from '@expo/eas-build-job';\nimport { BuildConfigParser, BuildStepGlobalContext, StepsConfigParser, errors } from '@expo/steps';\n\nimport { Artifacts, BuildContext } from '../context';\nimport { prepareProjectSourcesAsync } from '../common/projectSources';\nimport { getEasFunctions } from '../steps/easFunctions';\nimport { CustomBuildContext } from '../customBuildContext';\nimport { resolveEnvFromBuildProfileAsync } from '../common/easBuildInternal';\nimport { getEasFunctionGroups } from '../steps/easFunctionGroups';\nimport { findAndUploadXcodeBuildLogsAsync } from '../ios/xcodeBuildLogs';\nimport { retryAsync } from '../utils/retry';\n\nexport async function runCustomBuildAsync(ctx: BuildContext<BuildJob>): Promise<Artifacts> {\n const customBuildCtx = new CustomBuildContext(ctx);\n\n await ctx.runBuildPhase(BuildPhase.PREPARE_PROJECT, async () => {\n await retryAsync(\n async () => {\n await fs.rm(customBuildCtx.projectSourceDirectory, { recursive: true, force: true });\n await fs.mkdir(customBuildCtx.projectSourceDirectory, { recursive: true });\n\n await prepareProjectSourcesAsync(ctx, customBuildCtx.projectSourceDirectory);\n },\n {\n retryOptions: {\n retries: 3,\n retryIntervalMs: 1_000,\n },\n }\n );\n });\n\n if (ctx.job.triggeredBy === BuildTrigger.GIT_BASED_INTEGRATION) {\n // We need to setup envs from eas.json\n const env = await resolveEnvFromBuildProfileAsync(ctx, {\n cwd: path.join(customBuildCtx.projectSourceDirectory, ctx.job.projectRootDirectory ?? '.'),\n });\n ctx.updateEnv(env);\n customBuildCtx.updateEnv(ctx.env);\n }\n\n assert(\n 'steps' in ctx.job || 'customBuildConfig' in ctx.job,\n 'Steps or custom build config path are required in custom jobs'\n );\n\n const globalContext = new BuildStepGlobalContext(customBuildCtx, false);\n const easFunctions = getEasFunctions(customBuildCtx);\n const easFunctionGroups = getEasFunctionGroups(customBuildCtx);\n const parser = ctx.job.steps\n ? new StepsConfigParser(globalContext, {\n externalFunctions: easFunctions,\n externalFunctionGroups: easFunctionGroups,\n steps: ctx.job.steps,\n })\n : new BuildConfigParser(globalContext, {\n externalFunctions: easFunctions,\n externalFunctionGroups: easFunctionGroups,\n configPath: path.join(\n ctx.getReactNativeProjectDirectory(customBuildCtx.projectSourceDirectory),\n nullthrows(\n ctx.job.customBuildConfig?.path,\n 'Steps or custom build config path are required in custom jobs'\n )\n ),\n });\n const workflow = await ctx.runBuildPhase(BuildPhase.PARSE_CUSTOM_WORKFLOW_CONFIG, async () => {\n try {\n return await parser.parseAsync();\n } catch (parseError: any) {\n ctx.logger.error('Failed to parse the custom build config file.');\n if (parseError instanceof errors.BuildWorkflowError) {\n for (const err of parseError.errors) {\n ctx.logger.error({ err });\n }\n }\n throw parseError;\n }\n });\n try {\n try {\n await workflow.executeAsync();\n } finally {\n if (!ctx.artifacts.XCODE_BUILD_LOGS && ctx.job.platform === Platform.IOS) {\n try {\n await findAndUploadXcodeBuildLogsAsync(ctx as BuildContext<Ios.Job>, {\n logger: ctx.logger,\n });\n } catch {\n // do nothing, it's a non-breaking error.\n }\n }\n }\n } catch (err: any) {\n err.artifacts = ctx.artifacts;\n throw err;\n }\n\n return ctx.artifacts;\n}\n"]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Job } from '@expo/eas-build-job';
|
|
2
2
|
import { BuildContext } from '../context';
|
|
3
|
-
export declare function prepareProjectSourcesAsync<TJob extends Job>(ctx: BuildContext<TJob>, destinationDirectory
|
|
3
|
+
export declare function prepareProjectSourcesAsync<TJob extends Job>(ctx: BuildContext<TJob>, destinationDirectory: string): Promise<{
|
|
4
4
|
handled: boolean;
|
|
5
5
|
}>;
|
|
6
6
|
export declare function downloadAndUnpackProjectFromTarGzAsync<TJob extends Job>(ctx: BuildContext<TJob>, projectArchiveUrl: string, destinationDirectory: string): Promise<void>;
|
|
@@ -17,7 +17,7 @@ const nullthrows_1 = __importDefault(require("nullthrows"));
|
|
|
17
17
|
const gql_tada_1 = require("gql.tada");
|
|
18
18
|
const turtleFetch_1 = require("../utils/turtleFetch");
|
|
19
19
|
const git_1 = require("./git");
|
|
20
|
-
async function prepareProjectSourcesAsync(ctx, destinationDirectory
|
|
20
|
+
async function prepareProjectSourcesAsync(ctx, destinationDirectory) {
|
|
21
21
|
var _a;
|
|
22
22
|
let projectArchive = ctx.job.projectArchive;
|
|
23
23
|
if (ctx.isLocal) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"projectSources.js","sourceRoot":"","sources":["../../src/common/projectSources.ts"],"names":[],"mappings":";;;;;AAkBA,gEAyDC;AAED,wFAoBC;AAjGD,gDAAwB;AACxB,2DAA6B;AAE7B,sEAAuC;AACvC,4DAA+B;AAC/B,uDAAkG;AAElG,kEAA4C;AAC5C,6BAAwB;AACxB,2CAA4C;AAC5C,4DAAoC;AACpC,uCAAmC;A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MAAM,IAAI,KAAK,CACb,gCAAgC,QAAQ,CAAC,MAAM,MAAM,OAAC,CAAC,aAAa,CAAC,UAAU,CAAC,KAAK,CAAC,EAAE,CACzF,CAAC;IACJ,CAAC;IAED,OAAO,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC;AAC9B,CAAC","sourcesContent":["import path from 'path';\nimport fs from 'fs/promises';\n\nimport spawn from '@expo/turtle-spawn';\nimport fetch from 'node-fetch';\nimport { ArchiveSourceType, Job, ArchiveSource, ArchiveSourceSchemaZ } from '@expo/eas-build-job';\nimport { bunyan } from '@expo/logger';\nimport downloadFile from '@expo/downloader';\nimport { z } from 'zod';\nimport { asyncResult } from '@expo/results';\nimport nullthrows from 'nullthrows';\nimport { graphql } from 'gql.tada';\n\nimport { BuildContext } from '../context';\nimport { turtleFetch } from '../utils/turtleFetch';\n\nimport { shallowCloneRepositoryAsync } from './git';\n\nexport async function prepareProjectSourcesAsync<TJob extends Job>(\n ctx: BuildContext<TJob>,\n destinationDirectory = ctx.buildDirectory\n): // Return type required to make switch exhaustive.\nPromise<{ handled: boolean }> {\n let projectArchive: ArchiveSource = ctx.job.projectArchive;\n if (ctx.isLocal) {\n console.warn('Local build, skipping project archive refresh');\n } else {\n const projectArchiveResult = await asyncResult(fetchProjectArchiveSourceAsync(ctx));\n\n if (!projectArchiveResult.ok) {\n ctx.logger.error(\n { err: projectArchiveResult.reason },\n 'Failed to refresh project archive, falling back to the original one'\n );\n }\n\n projectArchive = projectArchiveResult.value ?? ctx.job.projectArchive;\n }\n\n switch (projectArchive.type) {\n case ArchiveSourceType.R2:\n case ArchiveSourceType.GCS: {\n throw new Error('Remote project sources should be resolved earlier to URL');\n }\n\n case ArchiveSourceType.PATH: {\n await prepareProjectSourcesLocallyAsync(ctx, projectArchive.path, destinationDirectory); // used in eas build --local\n return { handled: true };\n }\n\n case ArchiveSourceType.NONE: {\n // May be used in no-sources jobs like submission jobs.\n return { handled: true };\n }\n\n case ArchiveSourceType.URL: {\n await downloadAndUnpackProjectFromTarGzAsync(ctx, projectArchive.url, destinationDirectory);\n\n uploadProjectMetadataAsFireAndForget(ctx, { projectDirectory: destinationDirectory });\n\n return { handled: true };\n }\n\n case ArchiveSourceType.GIT: {\n await shallowCloneRepositoryAsync({\n logger: ctx.logger,\n archiveSource: projectArchive,\n destinationDirectory,\n });\n\n uploadProjectMetadataAsFireAndForget(ctx, { projectDirectory: destinationDirectory });\n\n return { handled: true };\n }\n }\n}\n\nexport async function downloadAndUnpackProjectFromTarGzAsync<TJob extends Job>(\n ctx: BuildContext<TJob>,\n projectArchiveUrl: string,\n destinationDirectory: string\n): Promise<void> {\n const projectTarball = path.join(ctx.workingdir, 'project.tar.gz');\n try {\n await downloadFile(projectArchiveUrl, 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 await unpackTarGzAsync({\n destination: destinationDirectory,\n source: projectTarball,\n logger: ctx.logger,\n });\n}\n\nasync function prepareProjectSourcesLocallyAsync<TJob extends Job>(\n ctx: BuildContext<TJob>,\n projectArchivePath: string,\n destinationDirectory: string\n): Promise<void> {\n const projectTarball = path.join(ctx.workingdir, 'project.tar.gz');\n await fs.copyFile(projectArchivePath, projectTarball);\n\n await unpackTarGzAsync({\n destination: destinationDirectory,\n source: projectTarball,\n logger: ctx.logger,\n });\n}\n\nasync function unpackTarGzAsync({\n logger,\n source,\n destination,\n}: {\n logger: bunyan;\n source: string;\n destination: string;\n}): Promise<void> {\n await spawn('tar', ['-C', destination, '--strip-components', '1', '-zxf', source], {\n logger,\n });\n}\n\nfunction uploadProjectMetadataAsFireAndForget(\n ctx: BuildContext<Job>,\n { projectDirectory }: { projectDirectory: string }\n): void {\n void (async () => {\n const uploadResult = await asyncResult(uploadProjectMetadataAsync(ctx, { projectDirectory }));\n if (!uploadResult.ok) {\n ctx.logger.warn(`Failed to upload project metadata: ${uploadResult.reason}`);\n }\n })();\n}\n\nasync function uploadProjectMetadataAsync(\n ctx: BuildContext<Job>,\n { projectDirectory }: { projectDirectory: string }\n): Promise<void> {\n if (!ctx.job.platform) {\n // Not a build job, skip.\n return;\n } else if (\n ctx.job.projectArchive.type === ArchiveSourceType.GCS &&\n ctx.job.projectArchive.metadataLocation\n ) {\n // Build already has project metadata, skip.\n return;\n }\n\n const files: string[] = [];\n\n const directoriesToScan: { dir: string; relativePath: string }[] = [\n { dir: projectDirectory, relativePath: '' },\n ];\n\n while (directoriesToScan.length > 0) {\n const { dir, relativePath } = directoriesToScan.shift()!;\n\n if (relativePath === '.git') {\n // Do not include whole `.git` directory in the archive, just that it exists.\n files.push('.git/...');\n continue;\n }\n\n const entries = await fs.readdir(dir, { withFileTypes: true });\n\n for (const entry of entries) {\n const fullPath = path.join(dir, entry.name);\n const relativeFilePath = path.join(relativePath, entry.name);\n\n if (entry.isDirectory()) {\n directoriesToScan.push({ dir: fullPath, relativePath: relativeFilePath });\n } else {\n files.push(relativeFilePath);\n }\n }\n }\n const sortedFiles = files\n .map(\n // Prepend entries with \"project/\"\n (f) => path.join('project', f)\n )\n .sort(); // Sort for consistent ordering\n\n const result = await ctx.graphqlClient\n .mutation(\n graphql(`\n mutation {\n uploadSession {\n createUploadSession(type: EAS_BUILD_GCS_PROJECT_METADATA)\n }\n }\n `),\n {}\n )\n .toPromise();\n\n if (result.error) {\n throw result.error;\n }\n\n const uploadSession = result.data!.uploadSession.createUploadSession as {\n url: string;\n bucketKey: string;\n headers: Record<string, string>;\n };\n\n await fetch(uploadSession.url, {\n method: 'PUT',\n body: JSON.stringify({ archiveContent: sortedFiles }),\n headers: uploadSession.headers,\n });\n\n const updateMetadataResult = await ctx.graphqlClient\n .mutation(\n graphql(`\n mutation UpdateTurtleBuildMetadataMutation(\n $buildId: ID!\n $projectMetadataFile: ProjectMetadataFileInput!\n ) {\n build {\n updateBuildMetadata(\n buildId: $buildId\n metadata: { projectMetadataFile: $projectMetadataFile }\n ) {\n id\n }\n }\n }\n `),\n {\n buildId: ctx.env.EAS_BUILD_ID,\n projectMetadataFile: {\n type: 'GCS',\n bucketKey: uploadSession.bucketKey,\n },\n }\n )\n .toPromise();\n\n if (updateMetadataResult.error) {\n throw updateMetadataResult.error;\n }\n}\n\nasync function fetchProjectArchiveSourceAsync(ctx: BuildContext<Job>): Promise<ArchiveSource> {\n const taskId = nullthrows(ctx.env.EAS_BUILD_ID, 'EAS_BUILD_ID is not set');\n const expoApiServerURL = nullthrows(ctx.env.__API_SERVER_URL, '__API_SERVER_URL is not set');\n const robotAccessToken = nullthrows(\n ctx.job.secrets?.robotAccessToken,\n 'robot access token is not set'\n );\n\n const response = await turtleFetch(\n new URL(\n ctx.job.platform\n ? `/v2/turtle-builds/${taskId}/download-project-archive`\n : `/v2/turtle-job-runs/${taskId}/download-project-archive`,\n expoApiServerURL\n ).toString(),\n 'POST',\n {\n headers: {\n Authorization: `Bearer ${robotAccessToken}`,\n },\n timeout: 20000,\n retries: 3,\n logger: ctx.logger,\n }\n );\n\n if (!response.ok) {\n const textResult = await asyncResult(response.text());\n throw new Error(`Unexpected response from server (${response.status}): ${textResult.value}`);\n }\n\n const jsonResult = await asyncResult(response.json());\n if (!jsonResult.ok) {\n throw new Error(\n `Expected JSON response from server (${response.status}): ${jsonResult.reason}`\n );\n }\n\n const dataResult = z.object({ data: ArchiveSourceSchemaZ }).safeParse(jsonResult.value);\n if (!dataResult.success) {\n throw new Error(\n `Unexpected data from server (${response.status}): ${z.prettifyError(dataResult.error)}`\n );\n }\n\n return dataResult.data.data;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"projectSources.js","sourceRoot":"","sources":["../../src/common/projectSources.ts"],"names":[],"mappings":";;;;;AAkBA,gEAyDC;AAED,wFAoBC;AAjGD,gDAAwB;AACxB,2DAA6B;AAE7B,sEAAuC;AACvC,4DAA+B;AAC/B,uDAAkG;AAElG,kEAA4C;AAC5C,6BAAwB;AACxB,2CAA4C;AAC5C,4DAAoC;AACpC,uCAAm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b,gCAAgC,QAAQ,CAAC,MAAM,MAAM,OAAC,CAAC,aAAa,CAAC,UAAU,CAAC,KAAK,CAAC,EAAE,CACzF,CAAC;IACJ,CAAC;IAED,OAAO,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC;AAC9B,CAAC","sourcesContent":["import path from 'path';\nimport fs from 'fs/promises';\n\nimport spawn from '@expo/turtle-spawn';\nimport fetch from 'node-fetch';\nimport { ArchiveSourceType, Job, ArchiveSource, ArchiveSourceSchemaZ } from '@expo/eas-build-job';\nimport { bunyan } from '@expo/logger';\nimport downloadFile from '@expo/downloader';\nimport { z } from 'zod';\nimport { asyncResult } from '@expo/results';\nimport nullthrows from 'nullthrows';\nimport { graphql } from 'gql.tada';\n\nimport { BuildContext } from '../context';\nimport { turtleFetch } from '../utils/turtleFetch';\n\nimport { shallowCloneRepositoryAsync } from './git';\n\nexport async function prepareProjectSourcesAsync<TJob extends Job>(\n ctx: BuildContext<TJob>,\n destinationDirectory: string\n): // Return type required to make switch exhaustive.\nPromise<{ handled: boolean }> {\n let projectArchive: ArchiveSource = ctx.job.projectArchive;\n if (ctx.isLocal) {\n console.warn('Local build, skipping project archive refresh');\n } else {\n const projectArchiveResult = await asyncResult(fetchProjectArchiveSourceAsync(ctx));\n\n if (!projectArchiveResult.ok) {\n ctx.logger.error(\n { err: projectArchiveResult.reason },\n 'Failed to refresh project archive, falling back to the original one'\n );\n }\n\n projectArchive = projectArchiveResult.value ?? ctx.job.projectArchive;\n }\n\n switch (projectArchive.type) {\n case ArchiveSourceType.R2:\n case ArchiveSourceType.GCS: {\n throw new Error('Remote project sources should be resolved earlier to URL');\n }\n\n case ArchiveSourceType.PATH: {\n await prepareProjectSourcesLocallyAsync(ctx, projectArchive.path, destinationDirectory); // used in eas build --local\n return { handled: true };\n }\n\n case ArchiveSourceType.NONE: {\n // May be used in no-sources jobs like submission jobs.\n return { handled: true };\n }\n\n case ArchiveSourceType.URL: {\n await downloadAndUnpackProjectFromTarGzAsync(ctx, projectArchive.url, destinationDirectory);\n\n uploadProjectMetadataAsFireAndForget(ctx, { projectDirectory: destinationDirectory });\n\n return { handled: true };\n }\n\n case ArchiveSourceType.GIT: {\n await shallowCloneRepositoryAsync({\n logger: ctx.logger,\n archiveSource: projectArchive,\n destinationDirectory,\n });\n\n uploadProjectMetadataAsFireAndForget(ctx, { projectDirectory: destinationDirectory });\n\n return { handled: true };\n }\n }\n}\n\nexport async function downloadAndUnpackProjectFromTarGzAsync<TJob extends Job>(\n ctx: BuildContext<TJob>,\n projectArchiveUrl: string,\n destinationDirectory: string\n): Promise<void> {\n const projectTarball = path.join(ctx.workingdir, 'project.tar.gz');\n try {\n await downloadFile(projectArchiveUrl, 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 await unpackTarGzAsync({\n destination: destinationDirectory,\n source: projectTarball,\n logger: ctx.logger,\n });\n}\n\nasync function prepareProjectSourcesLocallyAsync<TJob extends Job>(\n ctx: BuildContext<TJob>,\n projectArchivePath: string,\n destinationDirectory: string\n): Promise<void> {\n const projectTarball = path.join(ctx.workingdir, 'project.tar.gz');\n await fs.copyFile(projectArchivePath, projectTarball);\n\n await unpackTarGzAsync({\n destination: destinationDirectory,\n source: projectTarball,\n logger: ctx.logger,\n });\n}\n\nasync function unpackTarGzAsync({\n logger,\n source,\n destination,\n}: {\n logger: bunyan;\n source: string;\n destination: string;\n}): Promise<void> {\n await spawn('tar', ['-C', destination, '--strip-components', '1', '-zxf', source], {\n logger,\n });\n}\n\nfunction uploadProjectMetadataAsFireAndForget(\n ctx: BuildContext<Job>,\n { projectDirectory }: { projectDirectory: string }\n): void {\n void (async () => {\n const uploadResult = await asyncResult(uploadProjectMetadataAsync(ctx, { projectDirectory }));\n if (!uploadResult.ok) {\n ctx.logger.warn(`Failed to upload project metadata: ${uploadResult.reason}`);\n }\n })();\n}\n\nasync function uploadProjectMetadataAsync(\n ctx: BuildContext<Job>,\n { projectDirectory }: { projectDirectory: string }\n): Promise<void> {\n if (!ctx.job.platform) {\n // Not a build job, skip.\n return;\n } else if (\n ctx.job.projectArchive.type === ArchiveSourceType.GCS &&\n ctx.job.projectArchive.metadataLocation\n ) {\n // Build already has project metadata, skip.\n return;\n }\n\n const files: string[] = [];\n\n const directoriesToScan: { dir: string; relativePath: string }[] = [\n { dir: projectDirectory, relativePath: '' },\n ];\n\n while (directoriesToScan.length > 0) {\n const { dir, relativePath } = directoriesToScan.shift()!;\n\n if (relativePath === '.git') {\n // Do not include whole `.git` directory in the archive, just that it exists.\n files.push('.git/...');\n continue;\n }\n\n const entries = await fs.readdir(dir, { withFileTypes: true });\n\n for (const entry of entries) {\n const fullPath = path.join(dir, entry.name);\n const relativeFilePath = path.join(relativePath, entry.name);\n\n if (entry.isDirectory()) {\n directoriesToScan.push({ dir: fullPath, relativePath: relativeFilePath });\n } else {\n files.push(relativeFilePath);\n }\n }\n }\n const sortedFiles = files\n .map(\n // Prepend entries with \"project/\"\n (f) => path.join('project', f)\n )\n .sort(); // Sort for consistent ordering\n\n const result = await ctx.graphqlClient\n .mutation(\n graphql(`\n mutation {\n uploadSession {\n createUploadSession(type: EAS_BUILD_GCS_PROJECT_METADATA)\n }\n }\n `),\n {}\n )\n .toPromise();\n\n if (result.error) {\n throw result.error;\n }\n\n const uploadSession = result.data!.uploadSession.createUploadSession as {\n url: string;\n bucketKey: string;\n headers: Record<string, string>;\n };\n\n await fetch(uploadSession.url, {\n method: 'PUT',\n body: JSON.stringify({ archiveContent: sortedFiles }),\n headers: uploadSession.headers,\n });\n\n const updateMetadataResult = await ctx.graphqlClient\n .mutation(\n graphql(`\n mutation UpdateTurtleBuildMetadataMutation(\n $buildId: ID!\n $projectMetadataFile: ProjectMetadataFileInput!\n ) {\n build {\n updateBuildMetadata(\n buildId: $buildId\n metadata: { projectMetadataFile: $projectMetadataFile }\n ) {\n id\n }\n }\n }\n `),\n {\n buildId: ctx.env.EAS_BUILD_ID,\n projectMetadataFile: {\n type: 'GCS',\n bucketKey: uploadSession.bucketKey,\n },\n }\n )\n .toPromise();\n\n if (updateMetadataResult.error) {\n throw updateMetadataResult.error;\n }\n}\n\nasync function fetchProjectArchiveSourceAsync(ctx: BuildContext<Job>): Promise<ArchiveSource> {\n const taskId = nullthrows(ctx.env.EAS_BUILD_ID, 'EAS_BUILD_ID is not set');\n const expoApiServerURL = nullthrows(ctx.env.__API_SERVER_URL, '__API_SERVER_URL is not set');\n const robotAccessToken = nullthrows(\n ctx.job.secrets?.robotAccessToken,\n 'robot access token is not set'\n );\n\n const response = await turtleFetch(\n new URL(\n ctx.job.platform\n ? `/v2/turtle-builds/${taskId}/download-project-archive`\n : `/v2/turtle-job-runs/${taskId}/download-project-archive`,\n expoApiServerURL\n ).toString(),\n 'POST',\n {\n headers: {\n Authorization: `Bearer ${robotAccessToken}`,\n },\n timeout: 20000,\n retries: 3,\n logger: ctx.logger,\n }\n );\n\n if (!response.ok) {\n const textResult = await asyncResult(response.text());\n throw new Error(`Unexpected response from server (${response.status}): ${textResult.value}`);\n }\n\n const jsonResult = await asyncResult(response.json());\n if (!jsonResult.ok) {\n throw new Error(\n `Expected JSON response from server (${response.status}): ${jsonResult.reason}`\n );\n }\n\n const dataResult = z.object({ data: ArchiveSourceSchemaZ }).safeParse(jsonResult.value);\n if (!dataResult.success) {\n throw new Error(\n `Unexpected data from server (${response.status}): ${z.prettifyError(dataResult.error)}`\n );\n }\n\n return dataResult.data.data;\n}\n"]}
|
package/dist/common/setup.js
CHANGED
|
@@ -17,6 +17,7 @@ const npmrc_1 = require("../utils/npmrc");
|
|
|
17
17
|
const packageManager_1 = require("../utils/packageManager");
|
|
18
18
|
const project_1 = require("../utils/project");
|
|
19
19
|
const processes_1 = require("../utils/processes");
|
|
20
|
+
const retry_1 = require("../utils/retry");
|
|
20
21
|
const projectSources_1 = require("./projectSources");
|
|
21
22
|
const installDependencies_1 = require("./installDependencies");
|
|
22
23
|
const easBuildInternal_1 = require("./easBuildInternal");
|
|
@@ -30,7 +31,16 @@ class InstallDependenciesTimeoutError extends Error {
|
|
|
30
31
|
async function setupAsync(ctx) {
|
|
31
32
|
var _a;
|
|
32
33
|
await ctx.runBuildPhase(eas_build_job_1.BuildPhase.PREPARE_PROJECT, async () => {
|
|
33
|
-
await (0,
|
|
34
|
+
await (0, retry_1.retryAsync)(async () => {
|
|
35
|
+
await fs_extra_1.default.rm(ctx.buildDirectory, { recursive: true, force: true });
|
|
36
|
+
await fs_extra_1.default.mkdir(ctx.buildDirectory, { recursive: true });
|
|
37
|
+
await (0, projectSources_1.prepareProjectSourcesAsync)(ctx, ctx.buildDirectory);
|
|
38
|
+
}, {
|
|
39
|
+
retryOptions: {
|
|
40
|
+
retries: 3,
|
|
41
|
+
retryIntervalMs: 1000,
|
|
42
|
+
},
|
|
43
|
+
});
|
|
34
44
|
await (0, npmrc_1.setUpNpmrcAsync)(ctx, ctx.logger);
|
|
35
45
|
if (ctx.job.platform === eas_build_job_1.Platform.IOS && ctx.env.EAS_BUILD_RUNNER === 'eas-build') {
|
|
36
46
|
await (0, xcodeEnv_1.deleteXcodeEnvLocalIfExistsAsync)(ctx);
|
package/dist/common/setup.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"setup.js","sourceRoot":"","sources":["../../src/common/setup.ts"],"names":[],"mappings":";;;;;AAiCA,gCAiGC;AAlID,gDAAwB;AAExB,sEAAwD;AACxD,wDAA0B;AAC1B,uDAA+E;AAC/E,4DAA+D;AAC/D,4DAAoC;AAEpC,4DAAkE;AAGlE,8CAAmE;AACnE,0CAAwD;AACxD,0CAAiD;AACjD,4DAIiC;AACjC,8CAAmD;AACnD,kDAA4E;AAE5E,qDAA8D;AAC9D,+DAAqF;AACrF,yDAA+F;AAE/F,MAAM,0BAA0B,GAAG,EAAE,GAAG,IAAI,CAAC;AAC7C,MAAM,oCAAoC,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC;A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oB,IAAI,CAAC,CAAA,MAAA,MAAA,SAAS,aAAT,SAAS,uBAAT,SAAS,CAAE,KAAK,0CAAE,GAAG,0CAAE,SAAS,CAAA,EAAE,CAAC;QAC7E,GAAG,CAAC,MAAM,CAAC,KAAK,CAAC,kEAAkE,CAAC,CAAC;QACrF,GAAG,CAAC,yBAAyB,EAAE,CAAC;IAClC,CAAC;AACH,CAAC","sourcesContent":["import path from 'path';\n\nimport spawn, { SpawnResult } from '@expo/turtle-spawn';\nimport fs from 'fs-extra';\nimport { BuildJob, BuildPhase, Ios, Job, Platform } from '@expo/eas-build-job';\nimport { BuildTrigger } from '@expo/eas-build-job/dist/common';\nimport nullthrows from 'nullthrows';\nimport { ExpoConfig } from '@expo/config';\nimport { UserFacingError } from '@expo/eas-build-job/dist/errors';\n\nimport { BuildContext } from '../context';\nimport { deleteXcodeEnvLocalIfExistsAsync } from '../ios/xcodeEnv';\nimport { Hook, runHookIfPresent } from '../utils/hooks';\nimport { setUpNpmrcAsync } from '../utils/npmrc';\nimport {\n shouldUseFrozenLockfile,\n isAtLeastNpm7Async,\n getPackageVersionFromPackageJson,\n} from '../utils/packageManager';\nimport { readPackageJson } from '../utils/project';\nimport { getParentAndDescendantProcessPidsAsync } from '../utils/processes';\n\nimport { prepareProjectSourcesAsync } from './projectSources';\nimport { installDependenciesAsync, resolvePackagerDir } from './installDependencies';\nimport { resolveEnvFromBuildProfileAsync, runEasBuildInternalAsync } from './easBuildInternal';\n\nconst MAX_EXPO_DOCTOR_TIMEOUT_MS = 30 * 1000;\nconst INSTALL_DEPENDENCIES_WARN_TIMEOUT_MS = 15 * 60 * 1000;\nconst INSTALL_DEPENDENCIES_KILL_TIMEOUT_MS = 30 * 60 * 1000;\n\nclass DoctorTimeoutError extends Error {}\nclass InstallDependenciesTimeoutError extends Error {}\n\nexport async function setupAsync<TJob extends BuildJob>(ctx: BuildContext<TJob>): Promise<void> {\n await ctx.runBuildPhase(BuildPhase.PREPARE_PROJECT, async () => {\n await prepareProjectSourcesAsync(ctx);\n await setUpNpmrcAsync(ctx, ctx.logger);\n if (ctx.job.platform === Platform.IOS && ctx.env.EAS_BUILD_RUNNER === 'eas-build') {\n await deleteXcodeEnvLocalIfExistsAsync(ctx as BuildContext<Ios.Job>);\n }\n if (ctx.job.triggeredBy === BuildTrigger.GIT_BASED_INTEGRATION) {\n // We need to setup envs from eas.json before\n // eas-build-pre-install hook is called.\n const env = await resolveEnvFromBuildProfileAsync(ctx, {\n cwd: ctx.getReactNativeProjectDirectory(),\n });\n ctx.updateEnv(env);\n }\n });\n\n await ctx.runBuildPhase(BuildPhase.PRE_INSTALL_HOOK, async () => {\n await runHookIfPresent(ctx, Hook.PRE_INSTALL);\n });\n\n const packageJson = await ctx.runBuildPhase(BuildPhase.READ_PACKAGE_JSON, async () => {\n ctx.logger.info('Using package.json:');\n const packageJson = readPackageJson(ctx.getReactNativeProjectDirectory());\n ctx.logger.info(JSON.stringify(packageJson, null, 2));\n return packageJson;\n });\n\n await ctx.runBuildPhase(BuildPhase.INSTALL_DEPENDENCIES, async () => {\n const expoVersion =\n ctx.metadata?.sdkVersion ??\n getPackageVersionFromPackageJson({\n packageJson,\n packageName: 'expo',\n });\n\n const reactNativeVersion =\n ctx.metadata?.reactNativeVersion ??\n getPackageVersionFromPackageJson({\n packageJson,\n packageName: 'react-native',\n });\n\n await runInstallDependenciesAsync(ctx, {\n useFrozenLockfile: shouldUseFrozenLockfile({\n env: ctx.env,\n sdkVersion: expoVersion,\n reactNativeVersion,\n }),\n });\n });\n\n await ctx.runBuildPhase(BuildPhase.READ_APP_CONFIG, async () => {\n const appConfig = ctx.appConfig;\n ctx.logger.info('Using app configuration:');\n ctx.logger.info(JSON.stringify(appConfig, null, 2));\n await validateAppConfigAsync(ctx, appConfig);\n });\n\n if (ctx.job.triggeredBy === BuildTrigger.GIT_BASED_INTEGRATION) {\n await ctx.runBuildPhase(BuildPhase.EAS_BUILD_INTERNAL, async () => {\n if (!ctx.appConfig.ios?.bundleIdentifier && ctx.job.platform === Platform.IOS) {\n throw new Error(\n 'The \"ios.bundleIdentifier\" is required to be set in app config for builds triggered by GitHub integration. Learn more: https://docs.expo.dev/versions/latest/config/app/#bundleidentifier.'\n );\n }\n if (!ctx.appConfig.android?.package && ctx.job.platform === Platform.ANDROID) {\n throw new Error(\n 'The \"android.package\" is required to be set in app config for builds triggered by GitHub integration. Learn more: https://docs.expo.dev/versions/latest/config/app/#package.'\n );\n }\n const { newJob, newMetadata } = await runEasBuildInternalAsync({\n job: ctx.job,\n env: ctx.env,\n logger: ctx.logger,\n cwd: ctx.getReactNativeProjectDirectory(),\n projectRootOverride: ctx.env.EAS_NO_VCS ? ctx.buildDirectory : undefined,\n });\n ctx.updateJobInformation(newJob, newMetadata);\n });\n }\n\n const hasExpoPackage = !!packageJson.dependencies?.expo;\n if (!ctx.env.EAS_BUILD_DISABLE_EXPO_DOCTOR_STEP && hasExpoPackage) {\n await ctx.runBuildPhase(BuildPhase.RUN_EXPO_DOCTOR, async () => {\n try {\n await runExpoDoctor(ctx);\n } catch (err) {\n if (err instanceof DoctorTimeoutError) {\n ctx.logger.error(err.message);\n } else {\n ctx.logger.error({ err }, 'Command \"expo doctor\" failed.');\n }\n ctx.markBuildPhaseHasWarnings();\n }\n });\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 let timedOut = false;\n const isAtLeastNpm7 = await isAtLeastNpm7Async();\n try {\n const argsPrefix = isAtLeastNpm7 ? ['-y'] : [];\n const promise = spawn('npx', [...argsPrefix, 'expo-doctor'], {\n cwd: ctx.getReactNativeProjectDirectory(),\n logger: ctx.logger,\n env: ctx.env,\n });\n timeout = setTimeout(async () => {\n timedOut = true;\n const ppid = nullthrows(promise.child.pid);\n const pids = await getParentAndDescendantProcessPidsAsync(ppid);\n pids.forEach((pid) => {\n process.kill(pid);\n });\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 } catch (err: any) {\n if (timedOut) {\n throw new DoctorTimeoutError('\"expo doctor\" timed out, skipping...');\n }\n throw err;\n } finally {\n if (timeout) {\n clearTimeout(timeout);\n }\n }\n}\n\nasync function runInstallDependenciesAsync<TJob extends Job>(\n ctx: BuildContext<TJob>,\n {\n useFrozenLockfile,\n }: {\n useFrozenLockfile: boolean;\n }\n): Promise<void> {\n let warnTimeout: NodeJS.Timeout | undefined;\n let killTimeout: NodeJS.Timeout | undefined;\n let killTimedOut: boolean = false;\n try {\n const installDependenciesSpawnPromise = (\n await installDependenciesAsync({\n packageManager: ctx.packageManager,\n env: ctx.env,\n logger: ctx.logger,\n infoCallbackFn: () => {\n if (warnTimeout) {\n warnTimeout.refresh();\n }\n if (killTimeout) {\n killTimeout.refresh();\n }\n },\n cwd: resolvePackagerDir(ctx),\n useFrozenLockfile,\n })\n ).spawnPromise;\n\n warnTimeout = setTimeout(() => {\n ctx.logger.warn(\n '\"Install dependencies\" phase takes longer then expected and it did not produce any logs in the past 15 minutes. Consider evaluating your package.json file for possible issues with dependencies'\n );\n }, INSTALL_DEPENDENCIES_WARN_TIMEOUT_MS);\n\n killTimeout = setTimeout(async () => {\n killTimedOut = true;\n ctx.logger.error(\n '\"Install dependencies\" phase takes a very long time and it did not produce any logs in the past 30 minutes. Most likely an unexpected error happened with your dependencies which caused the process to hang and it will be terminated'\n );\n const ppid = nullthrows(installDependenciesSpawnPromise.child.pid);\n const pids = await getParentAndDescendantProcessPidsAsync(ppid);\n pids.forEach((pid) => {\n process.kill(pid);\n });\n ctx.reportError?.('\"Install dependencies\" phase takes a very long time', undefined, {\n extras: { buildId: ctx.env.EAS_BUILD_ID },\n });\n }, INSTALL_DEPENDENCIES_KILL_TIMEOUT_MS);\n\n await installDependenciesSpawnPromise;\n } catch (err: any) {\n if (killTimedOut) {\n throw new InstallDependenciesTimeoutError(\n '\"Install dependencies\" phase was inactive for over 30 minutes. Please evaluate your package.json file'\n );\n }\n throw err;\n } finally {\n if (warnTimeout) {\n clearTimeout(warnTimeout);\n }\n if (killTimeout) {\n clearTimeout(killTimeout);\n }\n }\n}\n\nasync function validateAppConfigAsync(\n ctx: BuildContext<Job>,\n appConfig: ExpoConfig\n): Promise<void> {\n if (\n appConfig?.extra?.eas?.projectId &&\n ctx.env.EAS_BUILD_PROJECT_ID &&\n appConfig.extra.eas.projectId !== ctx.env.EAS_BUILD_PROJECT_ID\n ) {\n const isUsingDynamicConfig =\n (await fs.pathExists(path.join(ctx.getReactNativeProjectDirectory(), 'app.config.ts'))) ||\n (await fs.pathExists(path.join(ctx.getReactNativeProjectDirectory(), 'app.config.js')));\n const isGitHubBuild = ctx.job.triggeredBy === BuildTrigger.GIT_BASED_INTEGRATION;\n let extraMessage = '';\n if (isGitHubBuild && isUsingDynamicConfig) {\n extraMessage =\n 'Make sure you connected your GitHub repository to the correct Expo project and if you are using environment variables to switch between projects in app.config.js/app.config.ts remember to set those variables in eas.json too. ';\n } else if (isGitHubBuild) {\n extraMessage = 'Make sure you connected your GitHub repository to the correct Expo project. ';\n } else if (isUsingDynamicConfig) {\n extraMessage =\n 'If you are using environment variables to switch between projects in app.config.js/app.config.ts, make sure those variables are also set inside EAS Build. You can do that using \"env\" field in eas.json or EAS environment variables. ';\n }\n throw new UserFacingError(\n 'EAS_BUILD_PROJECT_ID_MISMATCH',\n `The value of the \"extra.eas.projectId\" field (${appConfig.extra.eas.projectId}) in the app config does not match the current project id (${ctx.env.EAS_BUILD_PROJECT_ID}). ${extraMessage}Learn more: https://expo.fyi/eas-config-mismatch.`\n );\n } else if (ctx.env.EAS_BUILD_PROJECT_ID && !appConfig?.extra?.eas?.projectId) {\n ctx.logger.error(`The \"extra.eas.projectId\" field is missing from your app config.`);\n ctx.markBuildPhaseHasWarnings();\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":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BAAoB,GACxB,CAAC,MAAM,kBAAE,CAAC,UAAU,CAAC,cAAI,CAAC,IAAI,CAAC,GAAG,CAAC,8BAA8B,EAAE,EAAE,eAAe,CAAC,CAAC,CAAC;YACvF,CAAC,MAAM,kBAAE,CAAC,UAAU,CAAC,cAAI,CAAC,IAAI,CAAC,GAAG,CAAC,8BAA8B,EAAE,EAAE,eAAe,CAAC,CAAC,CAAC,CAAC;QAC1F,MAAM,aAAa,GAAG,GAAG,CAAC,GAAG,CAAC,WAAW,KAAK,qBAAY,CAAC,qBAAqB,CAAC;QACjF,IAAI,YAAY,GAAG,EAAE,CAAC;QACtB,IAAI,aAAa,IAAI,oBAAoB,EAAE,CAAC;YAC1C,YAAY;gBACV,mOAAmO,CAAC;QACxO,CAAC;aAAM,IAAI,aAAa,EAAE,CAAC;YACzB,YAAY,GAAG,8EAA8E,CAAC;QAChG,CAAC;aAAM,IAAI,oBAAoB,EAAE,CAAC;YAChC,YAAY;gBACV,yOAAyO,CAAC;QAC9O,CAAC;QACD,MAAM,IAAI,wBAAe,CACvB,+BAA+B,EAC/B,iDAAiD,SAAS,CAAC,KAAK,CAAC,GAAG,CAAC,SAAS,8DAA8D,GAAG,CAAC,GAAG,CAAC,oBAAoB,MAAM,YAAY,mDAAmD,CAC9O,CAAC;IACJ,CAAC;SAAM,IAAI,GAAG,CAAC,GAAG,CAAC,oBAAoB,IAAI,CAAC,CAAA,MAAA,MAAA,SAAS,aAAT,SAAS,uBAAT,SAAS,CAAE,KAAK,0CAAE,GAAG,0CAAE,SAAS,CAAA,EAAE,CAAC;QAC7E,GAAG,CAAC,MAAM,CAAC,KAAK,CAAC,kEAAkE,CAAC,CAAC;QACrF,GAAG,CAAC,yBAAyB,EAAE,CAAC;IAClC,CAAC;AACH,CAAC","sourcesContent":["import path from 'path';\n\nimport spawn, { SpawnResult } from '@expo/turtle-spawn';\nimport fs from 'fs-extra';\nimport { BuildJob, BuildPhase, Ios, Job, Platform } from '@expo/eas-build-job';\nimport { BuildTrigger } from '@expo/eas-build-job/dist/common';\nimport nullthrows from 'nullthrows';\nimport { ExpoConfig } from '@expo/config';\nimport { UserFacingError } from '@expo/eas-build-job/dist/errors';\n\nimport { BuildContext } from '../context';\nimport { deleteXcodeEnvLocalIfExistsAsync } from '../ios/xcodeEnv';\nimport { Hook, runHookIfPresent } from '../utils/hooks';\nimport { setUpNpmrcAsync } from '../utils/npmrc';\nimport {\n shouldUseFrozenLockfile,\n isAtLeastNpm7Async,\n getPackageVersionFromPackageJson,\n} from '../utils/packageManager';\nimport { readPackageJson } from '../utils/project';\nimport { getParentAndDescendantProcessPidsAsync } from '../utils/processes';\nimport { retryAsync } from '../utils/retry';\n\nimport { prepareProjectSourcesAsync } from './projectSources';\nimport { installDependenciesAsync, resolvePackagerDir } from './installDependencies';\nimport { resolveEnvFromBuildProfileAsync, runEasBuildInternalAsync } from './easBuildInternal';\n\nconst MAX_EXPO_DOCTOR_TIMEOUT_MS = 30 * 1000;\nconst INSTALL_DEPENDENCIES_WARN_TIMEOUT_MS = 15 * 60 * 1000;\nconst INSTALL_DEPENDENCIES_KILL_TIMEOUT_MS = 30 * 60 * 1000;\n\nclass DoctorTimeoutError extends Error {}\nclass InstallDependenciesTimeoutError extends Error {}\n\nexport async function setupAsync<TJob extends BuildJob>(ctx: BuildContext<TJob>): Promise<void> {\n await ctx.runBuildPhase(BuildPhase.PREPARE_PROJECT, async () => {\n await retryAsync(\n async () => {\n await fs.rm(ctx.buildDirectory, { recursive: true, force: true });\n await fs.mkdir(ctx.buildDirectory, { recursive: true });\n\n await prepareProjectSourcesAsync(ctx, ctx.buildDirectory);\n },\n {\n retryOptions: {\n retries: 3,\n retryIntervalMs: 1_000,\n },\n }\n );\n\n await setUpNpmrcAsync(ctx, ctx.logger);\n if (ctx.job.platform === Platform.IOS && ctx.env.EAS_BUILD_RUNNER === 'eas-build') {\n await deleteXcodeEnvLocalIfExistsAsync(ctx as BuildContext<Ios.Job>);\n }\n if (ctx.job.triggeredBy === BuildTrigger.GIT_BASED_INTEGRATION) {\n // We need to setup envs from eas.json before\n // eas-build-pre-install hook is called.\n const env = await resolveEnvFromBuildProfileAsync(ctx, {\n cwd: ctx.getReactNativeProjectDirectory(),\n });\n ctx.updateEnv(env);\n }\n });\n\n await ctx.runBuildPhase(BuildPhase.PRE_INSTALL_HOOK, async () => {\n await runHookIfPresent(ctx, Hook.PRE_INSTALL);\n });\n\n const packageJson = await ctx.runBuildPhase(BuildPhase.READ_PACKAGE_JSON, async () => {\n ctx.logger.info('Using package.json:');\n const packageJson = readPackageJson(ctx.getReactNativeProjectDirectory());\n ctx.logger.info(JSON.stringify(packageJson, null, 2));\n return packageJson;\n });\n\n await ctx.runBuildPhase(BuildPhase.INSTALL_DEPENDENCIES, async () => {\n const expoVersion =\n ctx.metadata?.sdkVersion ??\n getPackageVersionFromPackageJson({\n packageJson,\n packageName: 'expo',\n });\n\n const reactNativeVersion =\n ctx.metadata?.reactNativeVersion ??\n getPackageVersionFromPackageJson({\n packageJson,\n packageName: 'react-native',\n });\n\n await runInstallDependenciesAsync(ctx, {\n useFrozenLockfile: shouldUseFrozenLockfile({\n env: ctx.env,\n sdkVersion: expoVersion,\n reactNativeVersion,\n }),\n });\n });\n\n await ctx.runBuildPhase(BuildPhase.READ_APP_CONFIG, async () => {\n const appConfig = ctx.appConfig;\n ctx.logger.info('Using app configuration:');\n ctx.logger.info(JSON.stringify(appConfig, null, 2));\n await validateAppConfigAsync(ctx, appConfig);\n });\n\n if (ctx.job.triggeredBy === BuildTrigger.GIT_BASED_INTEGRATION) {\n await ctx.runBuildPhase(BuildPhase.EAS_BUILD_INTERNAL, async () => {\n if (!ctx.appConfig.ios?.bundleIdentifier && ctx.job.platform === Platform.IOS) {\n throw new Error(\n 'The \"ios.bundleIdentifier\" is required to be set in app config for builds triggered by GitHub integration. Learn more: https://docs.expo.dev/versions/latest/config/app/#bundleidentifier.'\n );\n }\n if (!ctx.appConfig.android?.package && ctx.job.platform === Platform.ANDROID) {\n throw new Error(\n 'The \"android.package\" is required to be set in app config for builds triggered by GitHub integration. Learn more: https://docs.expo.dev/versions/latest/config/app/#package.'\n );\n }\n const { newJob, newMetadata } = await runEasBuildInternalAsync({\n job: ctx.job,\n env: ctx.env,\n logger: ctx.logger,\n cwd: ctx.getReactNativeProjectDirectory(),\n projectRootOverride: ctx.env.EAS_NO_VCS ? ctx.buildDirectory : undefined,\n });\n ctx.updateJobInformation(newJob, newMetadata);\n });\n }\n\n const hasExpoPackage = !!packageJson.dependencies?.expo;\n if (!ctx.env.EAS_BUILD_DISABLE_EXPO_DOCTOR_STEP && hasExpoPackage) {\n await ctx.runBuildPhase(BuildPhase.RUN_EXPO_DOCTOR, async () => {\n try {\n await runExpoDoctor(ctx);\n } catch (err) {\n if (err instanceof DoctorTimeoutError) {\n ctx.logger.error(err.message);\n } else {\n ctx.logger.error({ err }, 'Command \"expo doctor\" failed.');\n }\n ctx.markBuildPhaseHasWarnings();\n }\n });\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 let timedOut = false;\n const isAtLeastNpm7 = await isAtLeastNpm7Async();\n try {\n const argsPrefix = isAtLeastNpm7 ? ['-y'] : [];\n const promise = spawn('npx', [...argsPrefix, 'expo-doctor'], {\n cwd: ctx.getReactNativeProjectDirectory(),\n logger: ctx.logger,\n env: ctx.env,\n });\n timeout = setTimeout(async () => {\n timedOut = true;\n const ppid = nullthrows(promise.child.pid);\n const pids = await getParentAndDescendantProcessPidsAsync(ppid);\n pids.forEach((pid) => {\n process.kill(pid);\n });\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 } catch (err: any) {\n if (timedOut) {\n throw new DoctorTimeoutError('\"expo doctor\" timed out, skipping...');\n }\n throw err;\n } finally {\n if (timeout) {\n clearTimeout(timeout);\n }\n }\n}\n\nasync function runInstallDependenciesAsync<TJob extends Job>(\n ctx: BuildContext<TJob>,\n {\n useFrozenLockfile,\n }: {\n useFrozenLockfile: boolean;\n }\n): Promise<void> {\n let warnTimeout: NodeJS.Timeout | undefined;\n let killTimeout: NodeJS.Timeout | undefined;\n let killTimedOut: boolean = false;\n try {\n const installDependenciesSpawnPromise = (\n await installDependenciesAsync({\n packageManager: ctx.packageManager,\n env: ctx.env,\n logger: ctx.logger,\n infoCallbackFn: () => {\n if (warnTimeout) {\n warnTimeout.refresh();\n }\n if (killTimeout) {\n killTimeout.refresh();\n }\n },\n cwd: resolvePackagerDir(ctx),\n useFrozenLockfile,\n })\n ).spawnPromise;\n\n warnTimeout = setTimeout(() => {\n ctx.logger.warn(\n '\"Install dependencies\" phase takes longer then expected and it did not produce any logs in the past 15 minutes. Consider evaluating your package.json file for possible issues with dependencies'\n );\n }, INSTALL_DEPENDENCIES_WARN_TIMEOUT_MS);\n\n killTimeout = setTimeout(async () => {\n killTimedOut = true;\n ctx.logger.error(\n '\"Install dependencies\" phase takes a very long time and it did not produce any logs in the past 30 minutes. Most likely an unexpected error happened with your dependencies which caused the process to hang and it will be terminated'\n );\n const ppid = nullthrows(installDependenciesSpawnPromise.child.pid);\n const pids = await getParentAndDescendantProcessPidsAsync(ppid);\n pids.forEach((pid) => {\n process.kill(pid);\n });\n ctx.reportError?.('\"Install dependencies\" phase takes a very long time', undefined, {\n extras: { buildId: ctx.env.EAS_BUILD_ID },\n });\n }, INSTALL_DEPENDENCIES_KILL_TIMEOUT_MS);\n\n await installDependenciesSpawnPromise;\n } catch (err: any) {\n if (killTimedOut) {\n throw new InstallDependenciesTimeoutError(\n '\"Install dependencies\" phase was inactive for over 30 minutes. Please evaluate your package.json file'\n );\n }\n throw err;\n } finally {\n if (warnTimeout) {\n clearTimeout(warnTimeout);\n }\n if (killTimeout) {\n clearTimeout(killTimeout);\n }\n }\n}\n\nasync function validateAppConfigAsync(\n ctx: BuildContext<Job>,\n appConfig: ExpoConfig\n): Promise<void> {\n if (\n appConfig?.extra?.eas?.projectId &&\n ctx.env.EAS_BUILD_PROJECT_ID &&\n appConfig.extra.eas.projectId !== ctx.env.EAS_BUILD_PROJECT_ID\n ) {\n const isUsingDynamicConfig =\n (await fs.pathExists(path.join(ctx.getReactNativeProjectDirectory(), 'app.config.ts'))) ||\n (await fs.pathExists(path.join(ctx.getReactNativeProjectDirectory(), 'app.config.js')));\n const isGitHubBuild = ctx.job.triggeredBy === BuildTrigger.GIT_BASED_INTEGRATION;\n let extraMessage = '';\n if (isGitHubBuild && isUsingDynamicConfig) {\n extraMessage =\n 'Make sure you connected your GitHub repository to the correct Expo project and if you are using environment variables to switch between projects in app.config.js/app.config.ts remember to set those variables in eas.json too. ';\n } else if (isGitHubBuild) {\n extraMessage = 'Make sure you connected your GitHub repository to the correct Expo project. ';\n } else if (isUsingDynamicConfig) {\n extraMessage =\n 'If you are using environment variables to switch between projects in app.config.js/app.config.ts, make sure those variables are also set inside EAS Build. You can do that using \"env\" field in eas.json or EAS environment variables. ';\n }\n throw new UserFacingError(\n 'EAS_BUILD_PROJECT_ID_MISMATCH',\n `The value of the \"extra.eas.projectId\" field (${appConfig.extra.eas.projectId}) in the app config does not match the current project id (${ctx.env.EAS_BUILD_PROJECT_ID}). ${extraMessage}Learn more: https://expo.fyi/eas-config-mismatch.`\n );\n } else if (ctx.env.EAS_BUILD_PROJECT_ID && !appConfig?.extra?.eas?.projectId) {\n ctx.logger.error(`The \"extra.eas.projectId\" field is missing from your app config.`);\n ctx.markBuildPhaseHasWarnings();\n }\n}\n"]}
|
package/dist/generic.js
CHANGED
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
2
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
6
|
exports.runGenericJobAsync = runGenericJobAsync;
|
|
7
|
+
const promises_1 = __importDefault(require("fs/promises"));
|
|
4
8
|
const eas_build_job_1 = require("@expo/eas-build-job");
|
|
5
9
|
const steps_1 = require("@expo/steps");
|
|
6
10
|
const results_1 = require("@expo/results");
|
|
@@ -9,9 +13,21 @@ const easFunctions_1 = require("./steps/easFunctions");
|
|
|
9
13
|
const customBuildContext_1 = require("./customBuildContext");
|
|
10
14
|
const easFunctionGroups_1 = require("./steps/easFunctionGroups");
|
|
11
15
|
const outputs_1 = require("./utils/outputs");
|
|
16
|
+
const retry_1 = require("./utils/retry");
|
|
12
17
|
async function runGenericJobAsync(ctx, { expoApiV2BaseUrl }) {
|
|
13
18
|
const customBuildCtx = new customBuildContext_1.CustomBuildContext(ctx);
|
|
14
|
-
await (
|
|
19
|
+
await ctx.runBuildPhase(eas_build_job_1.BuildPhase.PREPARE_PROJECT, async () => {
|
|
20
|
+
await (0, retry_1.retryAsync)(async () => {
|
|
21
|
+
await promises_1.default.rm(customBuildCtx.projectSourceDirectory, { recursive: true, force: true });
|
|
22
|
+
await promises_1.default.mkdir(customBuildCtx.projectSourceDirectory, { recursive: true });
|
|
23
|
+
await (0, projectSources_1.prepareProjectSourcesAsync)(ctx, customBuildCtx.projectSourceDirectory);
|
|
24
|
+
}, {
|
|
25
|
+
retryOptions: {
|
|
26
|
+
retries: 3,
|
|
27
|
+
retryIntervalMs: 1000,
|
|
28
|
+
},
|
|
29
|
+
});
|
|
30
|
+
});
|
|
15
31
|
const globalContext = new steps_1.BuildStepGlobalContext(customBuildCtx, false);
|
|
16
32
|
const parser = new steps_1.StepsConfigParser(globalContext, {
|
|
17
33
|
externalFunctions: (0, easFunctions_1.getEasFunctions)(customBuildCtx),
|
package/dist/generic.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generic.js","sourceRoot":"","sources":["../src/generic.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"generic.js","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AAQ,GAAG,MAAM,GAAG,CAAC,aAAa,CAAC,0BAAU,CAAC,4BAA4B,EAAE,KAAK,IAAI,EAAE;QAC3F,IAAI,CAAC;YACH,OAAO,MAAM,MAAM,CAAC,UAAU,EAAE,CAAC;QACnC,CAAC;QAAC,OAAO,UAAe,EAAE,CAAC;YACzB,GAAG,CAAC,MAAM,CAAC,KAAK,CAAC,0CAA0C,CAAC,CAAC;YAC7D,IAAI,UAAU,YAAY,cAAM,CAAC,kBAAkB,EAAE,CAAC;gBACpD,KAAK,MAAM,GAAG,IAAI,UAAU,CAAC,MAAM,EAAE,CAAC;oBACpC,GAAG,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,GAAG,EAAE,CAAC,CAAC;gBAC5B,CAAC;YACH,CAAC;YACD,MAAM,UAAU,CAAC;QACnB,CAAC;IACH,CAAC,CAAC,CAAC;IAEH,MAAM,SAAS,GAAG,MAAM,IAAA,qBAAW,EAAC,QAAQ,CAAC,YAAY,EAAE,CAAC,CAAC;IAE7D,MAAM,GAAG,CAAC,aAAa,CAAC,0BAAU,CAAC,YAAY,EAAE,KAAK,IAAI,EAAE;QAC1D,MAAM,IAAA,oCAA0B,EAAC,aAAa,EAAE;YAC9C,MAAM,EAAE,GAAG,CAAC,MAAM;YAClB,gBAAgB;SACjB,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;IAEH,OAAO,EAAE,SAAS,EAAE,aAAa,EAAE,QAAQ,EAAE,CAAC;AAChD,CAAC","sourcesContent":["import fs from 'fs/promises';\n\nimport { BuildPhase, Generic } from '@expo/eas-build-job';\nimport { BuildStepGlobalContext, BuildWorkflow, errors, StepsConfigParser } from '@expo/steps';\nimport { Result, asyncResult } from '@expo/results';\n\nimport { BuildContext } from './context';\nimport { prepareProjectSourcesAsync } from './common/projectSources';\nimport { getEasFunctions } from './steps/easFunctions';\nimport { CustomBuildContext } from './customBuildContext';\nimport { getEasFunctionGroups } from './steps/easFunctionGroups';\nimport { uploadJobOutputsToWwwAsync } from './utils/outputs';\nimport { retryAsync } from './utils/retry';\n\nexport async function runGenericJobAsync(\n ctx: BuildContext<Generic.Job>,\n { expoApiV2BaseUrl }: { expoApiV2BaseUrl: string }\n): Promise<{ runResult: Result<void>; buildWorkflow: BuildWorkflow }> {\n const customBuildCtx = new CustomBuildContext(ctx);\n\n await ctx.runBuildPhase(BuildPhase.PREPARE_PROJECT, async () => {\n await retryAsync(\n async () => {\n await fs.rm(customBuildCtx.projectSourceDirectory, { recursive: true, force: true });\n await fs.mkdir(customBuildCtx.projectSourceDirectory, { recursive: true });\n\n await prepareProjectSourcesAsync(ctx, customBuildCtx.projectSourceDirectory);\n },\n {\n retryOptions: {\n retries: 3,\n retryIntervalMs: 1_000,\n },\n }\n );\n });\n\n const globalContext = new BuildStepGlobalContext(customBuildCtx, false);\n\n const parser = new StepsConfigParser(globalContext, {\n externalFunctions: getEasFunctions(customBuildCtx),\n externalFunctionGroups: getEasFunctionGroups(customBuildCtx),\n steps: ctx.job.steps,\n });\n\n const workflow = await ctx.runBuildPhase(BuildPhase.PARSE_CUSTOM_WORKFLOW_CONFIG, async () => {\n try {\n return await parser.parseAsync();\n } catch (parseError: any) {\n ctx.logger.error('Failed to parse the job definition file.');\n if (parseError instanceof errors.BuildWorkflowError) {\n for (const err of parseError.errors) {\n ctx.logger.error({ err });\n }\n }\n throw parseError;\n }\n });\n\n const runResult = await asyncResult(workflow.executeAsync());\n\n await ctx.runBuildPhase(BuildPhase.COMPLETE_JOB, async () => {\n await uploadJobOutputsToWwwAsync(globalContext, {\n logger: ctx.logger,\n expoApiV2BaseUrl,\n });\n });\n\n return { runResult, buildWorkflow: workflow };\n}\n"]}
|
package/dist/ios/fastfile.js
CHANGED
|
@@ -4,9 +4,9 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.createFastfileForResigningBuild = createFastfileForResigningBuild;
|
|
7
|
-
const
|
|
8
|
-
const
|
|
9
|
-
const
|
|
7
|
+
const template_file_1 = require("@expo/template-file");
|
|
8
|
+
const fs_extra_1 = __importDefault(require("fs-extra"));
|
|
9
|
+
const FastfileResign_1 = require("../templates/FastfileResign");
|
|
10
10
|
async function createFastfileForResigningBuild({ outputFile, ipaPath, signingIdentity, keychainPath, targetProvisioningProfiles, }) {
|
|
11
11
|
const PROFILES = [];
|
|
12
12
|
const targets = Object.keys(targetProvisioningProfiles);
|
|
@@ -17,11 +17,16 @@ async function createFastfileForResigningBuild({ outputFile, ipaPath, signingIde
|
|
|
17
17
|
PATH: profile.path,
|
|
18
18
|
});
|
|
19
19
|
}
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
20
|
+
const output = (0, template_file_1.templateString)({
|
|
21
|
+
input: FastfileResign_1.FastfileResignTemplate,
|
|
22
|
+
vars: {
|
|
23
|
+
IPA_PATH: ipaPath,
|
|
24
|
+
SIGNING_IDENTITY: signingIdentity,
|
|
25
|
+
PROFILES,
|
|
26
|
+
KEYCHAIN_PATH: keychainPath,
|
|
27
|
+
},
|
|
28
|
+
mustache: false,
|
|
29
|
+
});
|
|
30
|
+
await fs_extra_1.default.writeFile(outputFile, output);
|
|
26
31
|
}
|
|
27
32
|
//# sourceMappingURL=fastfile.js.map
|
package/dist/ios/fastfile.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fastfile.js","sourceRoot":"","sources":["../../src/ios/fastfile.ts"],"names":[],"mappings":";;;;;
|
|
1
|
+
{"version":3,"file":"fastfile.js","sourceRoot":"","sources":["../../src/ios/fastfile.ts"],"names":[],"mappings":";;;;;AAOA,0EAmCC;AA1CD,uDAAqD;AACrD,wDAA0B;AAE1B,gEAAqE;AAI9D,KAAK,UAAU,+BAA+B,CAAC,EACpD,UAAU,EACV,OAAO,EACP,eAAe,EACf,YAAY,EACZ,0BAA0B,GAO3B;IACC,MAAM,QAAQ,GAA0C,EAAE,CAAC;IAC3D,MAAM,OAAO,GAAG,MAAM,CAAC,IAAI,CAAC,0BAA0B,CAAC,CAAC;IACxD,KAAK,MAAM,MAAM,IAAI,OAAO,EAAE,CAAC;QAC7B,MAAM,OAAO,GAAG,0BAA0B,CAAC,MAAM,CAAC,CAAC;QACnD,QAAQ,CAAC,IAAI,CAAC;YACZ,SAAS,EAAE,OAAO,CAAC,gBAAgB;YACnC,IAAI,EAAE,OAAO,CAAC,IAAI;SACnB,CAAC,CAAC;IACL,CAAC;IAED,MAAM,MAAM,GAAG,IAAA,8BAAc,EAAC;QAC5B,KAAK,EAAE,uCAAsB;QAC7B,IAAI,EAAE;YACJ,QAAQ,EAAE,OAAO;YACjB,gBAAgB,EAAE,eAAe;YACjC,QAAQ;YACR,aAAa,EAAE,YAAY;SAC5B;QACD,QAAQ,EAAE,KAAK;KAChB,CAAC,CAAC;IAEH,MAAM,kBAAE,CAAC,SAAS,CAAC,UAAU,EAAE,MAAM,CAAC,CAAC;AACzC,CAAC","sourcesContent":["import { templateString } from '@expo/template-file';\nimport fs from 'fs-extra';\n\nimport { FastfileResignTemplate } from '../templates/FastfileResign';\n\nimport { TargetProvisioningProfiles } from './credentials/manager';\n\nexport async function createFastfileForResigningBuild({\n outputFile,\n ipaPath,\n signingIdentity,\n keychainPath,\n targetProvisioningProfiles,\n}: {\n outputFile: string;\n ipaPath: string;\n signingIdentity: string;\n keychainPath: string;\n targetProvisioningProfiles: TargetProvisioningProfiles;\n}): Promise<void> {\n const PROFILES: { BUNDLE_ID: string; PATH: string }[] = [];\n const targets = Object.keys(targetProvisioningProfiles);\n for (const target of targets) {\n const profile = targetProvisioningProfiles[target];\n PROFILES.push({\n BUNDLE_ID: profile.bundleIdentifier,\n PATH: profile.path,\n });\n }\n\n const output = templateString({\n input: FastfileResignTemplate,\n vars: {\n IPA_PATH: ipaPath,\n SIGNING_IDENTITY: signingIdentity,\n PROFILES,\n KEYCHAIN_PATH: keychainPath,\n },\n mustache: false,\n });\n\n await fs.writeFile(outputFile, output);\n}\n"]}
|
package/dist/ios/gymfile.js
CHANGED
|
@@ -5,11 +5,10 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.createGymfileForArchiveBuild = createGymfileForArchiveBuild;
|
|
7
7
|
exports.createGymfileForSimulatorBuild = createGymfileForSimulatorBuild;
|
|
8
|
-
const
|
|
9
|
-
const template_file_1 = __importDefault(require("@expo/template-file"));
|
|
8
|
+
const template_file_1 = require("@expo/template-file");
|
|
10
9
|
const fs_extra_1 = __importDefault(require("fs-extra"));
|
|
11
|
-
const
|
|
12
|
-
const
|
|
10
|
+
const GymfileArchive_1 = require("../templates/GymfileArchive");
|
|
11
|
+
const GymfileSimulator_1 = require("../templates/GymfileSimulator");
|
|
13
12
|
async function createGymfileForArchiveBuild({ outputFile, clean, credentials, scheme, buildConfiguration, entitlements, outputDirectory, logsDirectory, }) {
|
|
14
13
|
const PROFILES = [];
|
|
15
14
|
const targets = Object.keys(credentials.targetProvisioningProfiles);
|
|
@@ -23,7 +22,7 @@ async function createGymfileForArchiveBuild({ outputFile, clean, credentials, sc
|
|
|
23
22
|
const ICLOUD_CONTAINER_ENVIRONMENT = entitlements === null || entitlements === void 0 ? void 0 : entitlements['com.apple.developer.icloud-container-environment'];
|
|
24
23
|
await fs_extra_1.default.mkdirp(logsDirectory);
|
|
25
24
|
await createGymfile({
|
|
26
|
-
template:
|
|
25
|
+
template: GymfileArchive_1.GymfileArchiveTemplate,
|
|
27
26
|
outputFile,
|
|
28
27
|
vars: {
|
|
29
28
|
KEYCHAIN_PATH: credentials.keychainPath,
|
|
@@ -41,7 +40,7 @@ async function createGymfileForArchiveBuild({ outputFile, clean, credentials, sc
|
|
|
41
40
|
async function createGymfileForSimulatorBuild({ outputFile, clean, scheme, buildConfiguration, derivedDataPath, logsDirectory, simulatorDestination, }) {
|
|
42
41
|
await fs_extra_1.default.mkdirp(logsDirectory);
|
|
43
42
|
await createGymfile({
|
|
44
|
-
template:
|
|
43
|
+
template: GymfileSimulator_1.GymfileSimulatorTemplate,
|
|
45
44
|
outputFile,
|
|
46
45
|
vars: {
|
|
47
46
|
SCHEME: scheme,
|
|
@@ -54,6 +53,11 @@ async function createGymfileForSimulatorBuild({ outputFile, clean, scheme, build
|
|
|
54
53
|
});
|
|
55
54
|
}
|
|
56
55
|
async function createGymfile({ template, outputFile, vars, }) {
|
|
57
|
-
|
|
56
|
+
const output = (0, template_file_1.templateString)({
|
|
57
|
+
input: template,
|
|
58
|
+
vars,
|
|
59
|
+
mustache: false,
|
|
60
|
+
});
|
|
61
|
+
await fs_extra_1.default.writeFile(outputFile, output);
|
|
58
62
|
}
|
|
59
63
|
//# sourceMappingURL=gymfile.js.map
|
package/dist/ios/gymfile.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gymfile.js","sourceRoot":"","sources":["../../src/ios/gymfile.ts"],"names":[],"mappings":";;;;;
|
|
1
|
+
{"version":3,"file":"gymfile.js","sourceRoot":"","sources":["../../src/ios/gymfile.ts"],"names":[],"mappings":";;;;;AA6BA,oEAwCC;AAED,wEAsBC;AA7FD,uDAAqD;AACrD,wDAA0B;AAE1B,gEAAqE;AACrE,oEAAyE;AAyBlE,KAAK,UAAU,4BAA4B,CAAC,EACjD,UAAU,EACV,KAAK,EACL,WAAW,EACX,MAAM,EACN,kBAAkB,EAClB,YAAY,EACZ,eAAe,EACf,aAAa,GACO;IACpB,MAAM,QAAQ,GAA0C,EAAE,CAAC;IAC3D,MAAM,OAAO,GAAG,MAAM,CAAC,IAAI,CAAC,WAAW,CAAC,0BAA0B,CAAC,CAAC;IACpE,KAAK,MAAM,MAAM,IAAI,OAAO,EAAE,CAAC;QAC7B,MAAM,OAAO,GAAG,WAAW,CAAC,0BAA0B,CAAC,MAAM,CAAC,CAAC;QAC/D,QAAQ,CAAC,IAAI,CAAC;YACZ,SAAS,EAAE,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KAChB,CAAC,CAAC;IACH,MAAM,kBAAE,CAAC,SAAS,CAAC,UAAU,EAAE,MAAM,CAAC,CAAC;AACzC,CAAC","sourcesContent":["import { templateString } from '@expo/template-file';\nimport fs from 'fs-extra';\n\nimport { GymfileArchiveTemplate } from '../templates/GymfileArchive';\nimport { GymfileSimulatorTemplate } from '../templates/GymfileSimulator';\n\nimport { Credentials } from './credentials/manager';\n\ninterface ArchiveBuildOptions {\n outputFile: string;\n credentials: Credentials;\n scheme: string;\n buildConfiguration?: string;\n outputDirectory: string;\n clean: boolean;\n logsDirectory: string;\n entitlements?: object;\n}\n\ninterface SimulatorBuildOptions {\n outputFile: string;\n scheme: string;\n buildConfiguration?: string;\n derivedDataPath: string;\n clean: boolean;\n logsDirectory: string;\n simulatorDestination: string;\n}\n\nexport async function createGymfileForArchiveBuild({\n outputFile,\n clean,\n credentials,\n scheme,\n buildConfiguration,\n entitlements,\n outputDirectory,\n logsDirectory,\n}: ArchiveBuildOptions): Promise<void> {\n const PROFILES: { BUNDLE_ID: string; UUID: string }[] = [];\n const targets = Object.keys(credentials.targetProvisioningProfiles);\n for (const target of targets) {\n const profile = credentials.targetProvisioningProfiles[target];\n PROFILES.push({\n BUNDLE_ID: profile.bundleIdentifier,\n UUID: profile.uuid,\n });\n }\n\n const ICLOUD_CONTAINER_ENVIRONMENT = (\n entitlements as Record<string, string | Record<string, string>>\n )?.['com.apple.developer.icloud-container-environment'] as string | undefined;\n\n await fs.mkdirp(logsDirectory);\n await createGymfile({\n template: GymfileArchiveTemplate,\n outputFile,\n vars: {\n KEYCHAIN_PATH: credentials.keychainPath,\n SCHEME: scheme,\n SCHEME_BUILD_CONFIGURATION: buildConfiguration,\n OUTPUT_DIRECTORY: outputDirectory,\n EXPORT_METHOD: credentials.distributionType,\n CLEAN: String(clean),\n LOGS_DIRECTORY: logsDirectory,\n PROFILES,\n ICLOUD_CONTAINER_ENVIRONMENT,\n },\n });\n}\n\nexport async function createGymfileForSimulatorBuild({\n outputFile,\n clean,\n scheme,\n buildConfiguration,\n derivedDataPath,\n logsDirectory,\n simulatorDestination,\n}: SimulatorBuildOptions): Promise<void> {\n await fs.mkdirp(logsDirectory);\n await createGymfile({\n template: GymfileSimulatorTemplate,\n outputFile,\n vars: {\n SCHEME: scheme,\n SCHEME_BUILD_CONFIGURATION: buildConfiguration,\n SCHEME_SIMULATOR_DESTINATION: simulatorDestination,\n DERIVED_DATA_PATH: derivedDataPath,\n CLEAN: String(clean),\n LOGS_DIRECTORY: logsDirectory,\n },\n });\n}\n\nasync function createGymfile({\n template,\n outputFile,\n vars,\n}: {\n template: string;\n outputFile: string;\n vars: Record<string, string | number | any>;\n}): Promise<void> {\n const output = templateString({\n input: template,\n vars,\n mustache: false,\n });\n await fs.writeFile(outputFile, output);\n}\n"]}
|
|
@@ -6,13 +6,11 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
exports.generateGymfileFromTemplateFunction = generateGymfileFromTemplateFunction;
|
|
7
7
|
const assert_1 = __importDefault(require("assert"));
|
|
8
8
|
const path_1 = __importDefault(require("path"));
|
|
9
|
-
const os_1 = __importDefault(require("os"));
|
|
10
9
|
const fs_extra_1 = __importDefault(require("fs-extra"));
|
|
11
10
|
const steps_1 = require("@expo/steps");
|
|
12
11
|
const config_plugins_1 = require("@expo/config-plugins");
|
|
13
12
|
const plist_1 = __importDefault(require("@expo/plist"));
|
|
14
|
-
const template_file_1 =
|
|
15
|
-
const uuid_1 = require("uuid");
|
|
13
|
+
const template_file_1 = require("@expo/template-file");
|
|
16
14
|
const credentials_1 = require("../utils/ios/credentials/credentials");
|
|
17
15
|
const manager_1 = __importDefault(require("../utils/ios/credentials/manager"));
|
|
18
16
|
const resolve_1 = require("../utils/ios/resolve");
|
|
@@ -130,7 +128,6 @@ function generateGymfileFromTemplateFunction() {
|
|
|
130
128
|
const buildConfiguration = (0, resolve_1.resolveBuildConfiguration)(job, inputs.build_configuration.value);
|
|
131
129
|
const scheme = (0, resolve_1.resolveScheme)(stepCtx.workingDirectory, job, inputs.scheme.value);
|
|
132
130
|
const entitlements = await maybeReadEntitlementsAsync(stepCtx.logger, stepCtx.workingDirectory, scheme, buildConfiguration);
|
|
133
|
-
const templatePath = await saveTemplateToTemporaryFileAsync(template);
|
|
134
131
|
const gymfilePath = path_1.default.join(stepCtx.workingDirectory, 'ios/Gymfile');
|
|
135
132
|
const PROFILES = [];
|
|
136
133
|
if (credentials) {
|
|
@@ -150,9 +147,8 @@ function generateGymfileFromTemplateFunction() {
|
|
|
150
147
|
workingDir: stepCtx.workingDirectory,
|
|
151
148
|
});
|
|
152
149
|
const simulatorDestination = `generic/platform=${isTV ? 'tvOS' : 'iOS'} Simulator`;
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
outputFile: gymfilePath,
|
|
150
|
+
const output = (0, template_file_1.templateString)({
|
|
151
|
+
input: template,
|
|
156
152
|
vars: {
|
|
157
153
|
SCHEME: scheme,
|
|
158
154
|
BUILD_CONFIGURATION: buildConfiguration,
|
|
@@ -171,7 +167,9 @@ function generateGymfileFromTemplateFunction() {
|
|
|
171
167
|
: {}),
|
|
172
168
|
...extra,
|
|
173
169
|
},
|
|
170
|
+
mustache: false,
|
|
174
171
|
});
|
|
172
|
+
await fs_extra_1.default.writeFile(gymfilePath, output);
|
|
175
173
|
const gymfileContents = await fs_extra_1.default.readFile(gymfilePath, 'utf8');
|
|
176
174
|
stepCtx.logger.info(`Successfully generated Gymfile: ${gymfileContents}`);
|
|
177
175
|
},
|
|
@@ -195,14 +193,4 @@ async function maybeReadEntitlementsAsync(logger, workingDir, scheme, buildConfi
|
|
|
195
193
|
return null;
|
|
196
194
|
}
|
|
197
195
|
}
|
|
198
|
-
async function createGymfile({ template, outputFile, vars, }) {
|
|
199
|
-
await (0, template_file_1.default)(template, vars, outputFile, { mustache: false });
|
|
200
|
-
}
|
|
201
|
-
async function saveTemplateToTemporaryFileAsync(template) {
|
|
202
|
-
const directory = path_1.default.join(os_1.default.tmpdir(), `gymfile-template-${(0, uuid_1.v4)()}`);
|
|
203
|
-
await fs_extra_1.default.mkdir(directory, { recursive: true });
|
|
204
|
-
const templatePath = path_1.default.join(directory, 'Gymfile.template');
|
|
205
|
-
await fs_extra_1.default.writeFile(templatePath, template);
|
|
206
|
-
return templatePath;
|
|
207
|
-
}
|
|
208
196
|
//# sourceMappingURL=generateGymfileFromTemplate.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generateGymfileFromTemplate.js","sourceRoot":"","sources":["../../../src/steps/functions/generateGymfileFromTemplate.ts"],"names":[],"mappings":";;;;;AA8DA,kFA6IC;AA3MD,oDAA4B;AAC5B,gDAAwB;AACxB,4CAAoB;AAEpB,wDAA0B;AAC1B,uCAAyF;AAEzF,yDAAiD;AACjD,wDAAgC;AAEhC,wEAA+C;AAC/C,+BAAkC;AAElC,sEAAiF;AACjF,+EAAsF;AACtF,kDAAgF;AAChF,4CAA2C;AAE3C,MAAM,4BAA4B,GAAG;;;;;;;;;;;;;;;;;;;;;;;;CAwBpC,CAAC;AAEF,MAAM,0BAA0B,GAAG;;;;;;;;;;;;;;;;CAgBlC,CAAC;AAEF,SAAgB,mCAAmC;IACjD,OAAO,IAAI,qBAAa,CAAC;QACvB,SAAS,EAAE,KAAK;QAChB,EAAE,EAAE,gCAAgC;QACpC,IAAI,EAAE,gCAAgC;QACtC,cAAc,EAAE;YACd,sBAAc,CAAC,cAAc,CAAC;gBAC5B,EAAE,EAAE,UAAU;gBACd,QAAQ,EAAE,KAAK;gBACf,oBAAoB,EAAE,mCAA2B,CAAC,MAAM;aACzD,CAAC;YACF,sBAAc,CAAC,cAAc,CAAC;gBAC5B,EAAE,EAAE,aAAa;gBACjB,QAAQ,EAAE,KAAK;gBACf,oBAAoB,EAAE,mCAA2B,CAAC,IAAI;aACvD,CAAC;YACF,sBAAc,CAAC,cAAc,CAAC;gBAC5B,EAAE,EAAE,qBAAqB;gBACzB,QAAQ,EAAE,KAAK;gBACf,oBAAoB,EAAE,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AAY,GAAG,cAAI,CAAC,IAAI,CAAC,SAAS,EAAE,kBAAkB,CAAC,CAAC;IAC9D,MAAM,kBAAE,CAAC,SAAS,CAAC,YAAY,EAAE,QAAQ,CAAC,CAAC;IAC3C,OAAO,YAAY,CAAC;AACtB,CAAC","sourcesContent":["import assert from 'assert';\nimport path from 'path';\nimport os from 'os';\n\nimport fs from 'fs-extra';\nimport { BuildFunction, BuildStepInput, BuildStepInputValueTypeName } from '@expo/steps';\nimport { Ios } from '@expo/eas-build-job';\nimport { IOSConfig } from '@expo/config-plugins';\nimport plist from '@expo/plist';\nimport { bunyan } from '@expo/logger';\nimport templateFile from '@expo/template-file';\nimport { v4 as uuid } from 'uuid';\n\nimport { IosBuildCredentialsSchema } from '../utils/ios/credentials/credentials';\nimport IosCredentialsManager, { Credentials } from '../utils/ios/credentials/manager';\nimport { resolveBuildConfiguration, resolveScheme } from '../utils/ios/resolve';\nimport { isTVOS } from '../utils/ios/tvos';\n\nconst DEFAULT_CREDENTIALS_TEMPLATE = `\n suppress_xcode_output(true)\n clean(<%- CLEAN %>)\n\n scheme(\"<%- SCHEME %>\")\n <% if (BUILD_CONFIGURATION) { %>\n configuration(\"<%- BUILD_CONFIGURATION %>\")\n <% } %>\n\n export_options({\n method: \"<%- EXPORT_METHOD %>\",\n provisioningProfiles: {<% _.forEach(PROFILES, function(profile) { %>\n \"<%- profile.BUNDLE_ID %>\" => \"<%- profile.UUID %>\",<% }); %>\n }<% if (ICLOUD_CONTAINER_ENVIRONMENT) { %>,\n iCloudContainerEnvironment: \"<%- ICLOUD_CONTAINER_ENVIRONMENT %>\"\n <% } %>\n })\n\n export_xcargs \"OTHER_CODE_SIGN_FLAGS=\\\\\"--keychain <%- KEYCHAIN_PATH %>\\\\\"\"\n\n disable_xcpretty(true)\n buildlog_path(\"<%- LOGS_DIRECTORY %>\")\n\n output_directory(\"<%- OUTPUT_DIRECTORY %>\")\n`;\n\nconst DEFAULT_SIMULATOR_TEMPLATE = `\n suppress_xcode_output(true)\n clean(<%- CLEAN %>)\n\n scheme(\"<%- SCHEME %>\")\n <% if (BUILD_CONFIGURATION) { %>\n configuration(\"<%- BUILD_CONFIGURATION %>\")\n <% } %>\n\n derived_data_path(\"<%- DERIVED_DATA_PATH %>\")\n skip_package_ipa(true)\n skip_archive(true)\n destination(\"<%- SCHEME_SIMULATOR_DESTINATION %>\")\n\n disable_xcpretty(true)\n buildlog_path(\"<%- LOGS_DIRECTORY %>\")\n`;\n\nexport function generateGymfileFromTemplateFunction(): BuildFunction {\n return new BuildFunction({\n namespace: 'eas',\n id: 'generate_gymfile_from_template',\n name: 'Generate Gymfile from template',\n inputProviders: [\n BuildStepInput.createProvider({\n id: 'template',\n required: false,\n allowedValueTypeName: BuildStepInputValueTypeName.STRING,\n }),\n BuildStepInput.createProvider({\n id: 'credentials',\n required: false,\n allowedValueTypeName: BuildStepInputValueTypeName.JSON,\n }),\n BuildStepInput.createProvider({\n id: 'build_configuration',\n required: false,\n allowedValueTypeName: BuildStepInputValueTypeName.STRING,\n }),\n BuildStepInput.createProvider({\n id: 'scheme',\n required: false,\n allowedValueTypeName: BuildStepInputValueTypeName.STRING,\n }),\n BuildStepInput.createProvider({\n id: 'clean',\n required: true,\n allowedValueTypeName: BuildStepInputValueTypeName.BOOLEAN,\n defaultValue: false,\n }),\n BuildStepInput.createProvider({\n id: 'extra',\n required: false,\n allowedValueTypeName: BuildStepInputValueTypeName.JSON,\n }),\n ],\n fn: async (stepCtx, { inputs }) => {\n let credentials: Credentials | undefined = undefined;\n const rawCredentialsInput = inputs.credentials.value as Record<string, any> | undefined;\n if (rawCredentialsInput) {\n const { value, error } = IosBuildCredentialsSchema.validate(rawCredentialsInput, {\n stripUnknown: true,\n convert: true,\n abortEarly: false,\n });\n if (error) {\n throw error;\n }\n\n const credentialsManager = new IosCredentialsManager(value);\n credentials = await credentialsManager.prepare(stepCtx.logger);\n }\n\n const extra: Record<string, any> =\n (inputs.extra.value as Record<string, any> | undefined) ?? {};\n\n const templateInput = inputs.template.value as string | undefined;\n\n let template: string;\n if (templateInput) {\n template = templateInput;\n } else if (credentials) {\n template = DEFAULT_CREDENTIALS_TEMPLATE;\n } else {\n template = DEFAULT_SIMULATOR_TEMPLATE;\n }\n\n assert(stepCtx.global.staticContext.job, 'Job is not defined');\n const job = stepCtx.global.staticContext.job as Ios.Job;\n const buildConfiguration = resolveBuildConfiguration(\n job,\n inputs.build_configuration.value as string | undefined\n );\n const scheme = resolveScheme(\n stepCtx.workingDirectory,\n job,\n inputs.scheme.value as string | undefined\n );\n const entitlements = await maybeReadEntitlementsAsync(\n stepCtx.logger,\n stepCtx.workingDirectory,\n scheme,\n buildConfiguration\n );\n\n const templatePath = await saveTemplateToTemporaryFileAsync(template);\n\n const gymfilePath = path.join(stepCtx.workingDirectory, 'ios/Gymfile');\n\n const PROFILES: { BUNDLE_ID: string; UUID: string }[] = [];\n if (credentials) {\n const targets = Object.keys(credentials.targetProvisioningProfiles);\n for (const target of targets) {\n const profile = credentials.targetProvisioningProfiles[target];\n PROFILES.push({\n BUNDLE_ID: profile.bundleIdentifier,\n UUID: profile.uuid,\n });\n }\n }\n\n const ICLOUD_CONTAINER_ENVIRONMENT = (\n entitlements as Record<string, string | Record<string, string>>\n )?.['com.apple.developer.icloud-container-environment'] as string | undefined;\n\n const isTV = await isTVOS({\n scheme,\n buildConfiguration,\n workingDir: stepCtx.workingDirectory,\n });\n const simulatorDestination = `generic/platform=${isTV ? 'tvOS' : 'iOS'} Simulator`;\n\n await createGymfile({\n template: templatePath,\n outputFile: gymfilePath,\n vars: {\n SCHEME: scheme,\n BUILD_CONFIGURATION: buildConfiguration,\n OUTPUT_DIRECTORY: './build',\n CLEAN: String(inputs.clean.value),\n LOGS_DIRECTORY: stepCtx.global.buildLogsDirectory,\n ICLOUD_CONTAINER_ENVIRONMENT,\n SCHEME_SIMULATOR_DESTINATION: simulatorDestination,\n DERIVED_DATA_PATH: './build',\n ...(PROFILES ? { PROFILES } : {}),\n ...(credentials\n ? {\n KEYCHAIN_PATH: credentials.keychainPath,\n EXPORT_METHOD: credentials.distributionType,\n }\n : {}),\n ...extra,\n },\n });\n\n const gymfileContents = await fs.readFile(gymfilePath, 'utf8');\n stepCtx.logger.info(`Successfully generated Gymfile: ${gymfileContents}`);\n },\n });\n}\n\nasync function maybeReadEntitlementsAsync(\n logger: bunyan,\n workingDir: string,\n scheme: string,\n buildConfiguration: string\n): Promise<object | null> {\n try {\n const applicationTargetName =\n await IOSConfig.BuildScheme.getApplicationTargetNameForSchemeAsync(workingDir, scheme);\n const entitlementsPath = IOSConfig.Entitlements.getEntitlementsPath(workingDir, {\n buildConfiguration,\n targetName: applicationTargetName,\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 logger.warn({ err }, 'Failed to read entitlements');\n return null;\n }\n}\n\nasync function createGymfile({\n template,\n outputFile,\n vars,\n}: {\n template: string;\n outputFile: string;\n vars: Record<string, string | number | any>;\n}): Promise<void> {\n await templateFile(template, vars, outputFile, { mustache: false });\n}\n\nasync function saveTemplateToTemporaryFileAsync(template: string): Promise<string> {\n const directory = path.join(os.tmpdir(), `gymfile-template-${uuid()}`);\n await fs.mkdir(directory, { recursive: true });\n const templatePath = path.join(directory, 'Gymfile.template');\n await fs.writeFile(templatePath, template);\n return templatePath;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"generateGymfileFromTemplate.js","sourceRoot":"","sources":["../../../src/steps/functions/generateGymfileFromTemplate.ts"],"names":[],"mappings":";;;;;AA4DA,kFA4IC;AAxMD,oDAA4B;AAC5B,gDAAwB;AAExB,wDAA0B;AAC1B,uCAAyF;AAEzF,yDAAiD;AACjD,wDAAgC;AAEhC,uDAAqD;AAErD,sEAAiF;AACjF,+EAAsF;AACtF,kDAAgF;AAChF,4CAA2C;AAE3C,MAAM,4BAA4B,GAAG;;;;;;;;;;;;;;;;;;;;;;;;CAwBpC,CAAC;A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AAO,GAAG,EAAE,CAAC;QACb,MAAM,CAAC,IAAI,CAAC,EAAE,GAAG,EAAE,EAAE,6BAA6B,CAAC,CAAC;QACpD,OAAO,IAAI,CAAC;IACd,CAAC;AACH,CAAC","sourcesContent":["import assert from 'assert';\nimport path from 'path';\n\nimport fs from 'fs-extra';\nimport { BuildFunction, BuildStepInput, BuildStepInputValueTypeName } from '@expo/steps';\nimport { Ios } from '@expo/eas-build-job';\nimport { IOSConfig } from '@expo/config-plugins';\nimport plist from '@expo/plist';\nimport { bunyan } from '@expo/logger';\nimport { templateString } from '@expo/template-file';\n\nimport { IosBuildCredentialsSchema } from '../utils/ios/credentials/credentials';\nimport IosCredentialsManager, { Credentials } from '../utils/ios/credentials/manager';\nimport { resolveBuildConfiguration, resolveScheme } from '../utils/ios/resolve';\nimport { isTVOS } from '../utils/ios/tvos';\n\nconst DEFAULT_CREDENTIALS_TEMPLATE = `\n suppress_xcode_output(true)\n clean(<%- CLEAN %>)\n\n scheme(\"<%- SCHEME %>\")\n <% if (BUILD_CONFIGURATION) { %>\n configuration(\"<%- BUILD_CONFIGURATION %>\")\n <% } %>\n\n export_options({\n method: \"<%- EXPORT_METHOD %>\",\n provisioningProfiles: {<% _.forEach(PROFILES, function(profile) { %>\n \"<%- profile.BUNDLE_ID %>\" => \"<%- profile.UUID %>\",<% }); %>\n }<% if (ICLOUD_CONTAINER_ENVIRONMENT) { %>,\n iCloudContainerEnvironment: \"<%- ICLOUD_CONTAINER_ENVIRONMENT %>\"\n <% } %>\n })\n\n export_xcargs \"OTHER_CODE_SIGN_FLAGS=\\\\\"--keychain <%- KEYCHAIN_PATH %>\\\\\"\"\n\n disable_xcpretty(true)\n buildlog_path(\"<%- LOGS_DIRECTORY %>\")\n\n output_directory(\"<%- OUTPUT_DIRECTORY %>\")\n`;\n\nconst DEFAULT_SIMULATOR_TEMPLATE = `\n suppress_xcode_output(true)\n clean(<%- CLEAN %>)\n\n scheme(\"<%- SCHEME %>\")\n <% if (BUILD_CONFIGURATION) { %>\n configuration(\"<%- BUILD_CONFIGURATION %>\")\n <% } %>\n\n derived_data_path(\"<%- DERIVED_DATA_PATH %>\")\n skip_package_ipa(true)\n skip_archive(true)\n destination(\"<%- SCHEME_SIMULATOR_DESTINATION %>\")\n\n disable_xcpretty(true)\n buildlog_path(\"<%- LOGS_DIRECTORY %>\")\n`;\n\nexport function generateGymfileFromTemplateFunction(): BuildFunction {\n return new BuildFunction({\n namespace: 'eas',\n id: 'generate_gymfile_from_template',\n name: 'Generate Gymfile from template',\n inputProviders: [\n BuildStepInput.createProvider({\n id: 'template',\n required: false,\n allowedValueTypeName: BuildStepInputValueTypeName.STRING,\n }),\n BuildStepInput.createProvider({\n id: 'credentials',\n required: false,\n allowedValueTypeName: BuildStepInputValueTypeName.JSON,\n }),\n BuildStepInput.createProvider({\n id: 'build_configuration',\n required: false,\n allowedValueTypeName: BuildStepInputValueTypeName.STRING,\n }),\n BuildStepInput.createProvider({\n id: 'scheme',\n required: false,\n allowedValueTypeName: BuildStepInputValueTypeName.STRING,\n }),\n BuildStepInput.createProvider({\n id: 'clean',\n required: true,\n allowedValueTypeName: BuildStepInputValueTypeName.BOOLEAN,\n defaultValue: false,\n }),\n BuildStepInput.createProvider({\n id: 'extra',\n required: false,\n allowedValueTypeName: BuildStepInputValueTypeName.JSON,\n }),\n ],\n fn: async (stepCtx, { inputs }) => {\n let credentials: Credentials | undefined = undefined;\n const rawCredentialsInput = inputs.credentials.value as Record<string, any> | undefined;\n if (rawCredentialsInput) {\n const { value, error } = IosBuildCredentialsSchema.validate(rawCredentialsInput, {\n stripUnknown: true,\n convert: true,\n abortEarly: false,\n });\n if (error) {\n throw error;\n }\n\n const credentialsManager = new IosCredentialsManager(value);\n credentials = await credentialsManager.prepare(stepCtx.logger);\n }\n\n const extra: Record<string, any> =\n (inputs.extra.value as Record<string, any> | undefined) ?? {};\n\n const templateInput = inputs.template.value as string | undefined;\n\n let template: string;\n if (templateInput) {\n template = templateInput;\n } else if (credentials) {\n template = DEFAULT_CREDENTIALS_TEMPLATE;\n } else {\n template = DEFAULT_SIMULATOR_TEMPLATE;\n }\n\n assert(stepCtx.global.staticContext.job, 'Job is not defined');\n const job = stepCtx.global.staticContext.job as Ios.Job;\n const buildConfiguration = resolveBuildConfiguration(\n job,\n inputs.build_configuration.value as string | undefined\n );\n const scheme = resolveScheme(\n stepCtx.workingDirectory,\n job,\n inputs.scheme.value as string | undefined\n );\n const entitlements = await maybeReadEntitlementsAsync(\n stepCtx.logger,\n stepCtx.workingDirectory,\n scheme,\n buildConfiguration\n );\n\n const gymfilePath = path.join(stepCtx.workingDirectory, 'ios/Gymfile');\n\n const PROFILES: { BUNDLE_ID: string; UUID: string }[] = [];\n if (credentials) {\n const targets = Object.keys(credentials.targetProvisioningProfiles);\n for (const target of targets) {\n const profile = credentials.targetProvisioningProfiles[target];\n PROFILES.push({\n BUNDLE_ID: profile.bundleIdentifier,\n UUID: profile.uuid,\n });\n }\n }\n\n const ICLOUD_CONTAINER_ENVIRONMENT = (\n entitlements as Record<string, string | Record<string, string>>\n )?.['com.apple.developer.icloud-container-environment'] as string | undefined;\n\n const isTV = await isTVOS({\n scheme,\n buildConfiguration,\n workingDir: stepCtx.workingDirectory,\n });\n const simulatorDestination = `generic/platform=${isTV ? 'tvOS' : 'iOS'} Simulator`;\n\n const output = templateString({\n input: template,\n vars: {\n SCHEME: scheme,\n BUILD_CONFIGURATION: buildConfiguration,\n OUTPUT_DIRECTORY: './build',\n CLEAN: String(inputs.clean.value),\n LOGS_DIRECTORY: stepCtx.global.buildLogsDirectory,\n ICLOUD_CONTAINER_ENVIRONMENT,\n SCHEME_SIMULATOR_DESTINATION: simulatorDestination,\n DERIVED_DATA_PATH: './build',\n ...(PROFILES ? { PROFILES } : {}),\n ...(credentials\n ? {\n KEYCHAIN_PATH: credentials.keychainPath,\n EXPORT_METHOD: credentials.distributionType,\n }\n : {}),\n ...extra,\n },\n mustache: false,\n });\n await fs.writeFile(gymfilePath, output);\n\n const gymfileContents = await fs.readFile(gymfilePath, 'utf8');\n stepCtx.logger.info(`Successfully generated Gymfile: ${gymfileContents}`);\n },\n });\n}\n\nasync function maybeReadEntitlementsAsync(\n logger: bunyan,\n workingDir: string,\n scheme: string,\n buildConfiguration: string\n): Promise<object | null> {\n try {\n const applicationTargetName =\n await IOSConfig.BuildScheme.getApplicationTargetNameForSchemeAsync(workingDir, scheme);\n const entitlementsPath = IOSConfig.Entitlements.getEntitlementsPath(workingDir, {\n buildConfiguration,\n targetName: applicationTargetName,\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 logger.warn({ err }, 'Failed to read entitlements');\n return null;\n }\n}\n"]}
|
|
@@ -8,7 +8,7 @@ const path_1 = __importDefault(require("path"));
|
|
|
8
8
|
const fs_extra_1 = __importDefault(require("fs-extra"));
|
|
9
9
|
const steps_1 = require("@expo/steps");
|
|
10
10
|
const packageManager_1 = require("../../utils/packageManager");
|
|
11
|
-
const
|
|
11
|
+
const npmrc_1 = require("../../templates/npmrc");
|
|
12
12
|
function createSetUpNpmrcBuildFunction() {
|
|
13
13
|
return new steps_1.BuildFunction({
|
|
14
14
|
namespace: 'eas',
|
|
@@ -23,10 +23,9 @@ function createSetUpNpmrcBuildFunction() {
|
|
|
23
23
|
logger.info('.npmrc already exists in your project directory, skipping generation');
|
|
24
24
|
}
|
|
25
25
|
else {
|
|
26
|
-
const npmrcContents = await fs_extra_1.default.readFile(NPMRC_TEMPLATE_PATH, 'utf8');
|
|
27
26
|
logger.info('Creating .npmrc in your project directory with the following contents:');
|
|
28
|
-
logger.info(
|
|
29
|
-
await fs_extra_1.default.
|
|
27
|
+
logger.info(npmrc_1.NpmrcTemplate);
|
|
28
|
+
await fs_extra_1.default.writeFile(projectNpmrcPath, npmrc_1.NpmrcTemplate);
|
|
30
29
|
}
|
|
31
30
|
}
|
|
32
31
|
else {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useNpmToken.js","sourceRoot":"","sources":["../../../src/steps/functions/useNpmToken.ts"],"names":[],"mappings":";;;;;
|
|
1
|
+
{"version":3,"file":"useNpmToken.js","sourceRoot":"","sources":["../../../src/steps/functions/useNpmToken.ts"],"names":[],"mappings":";;;;;AAQA,sEA8BC;AAtCD,gDAAwB;AAExB,wDAA0B;AAC1B,uCAA4C;AAE5C,+DAAiE;AACjE,iDAAsD;AAEtD,SAAgB,6BAA6B;IAC3C,OAAO,IAAI,qBAAa,CAAC;QACvB,SAAS,EAAE,KAAK;QAChB,EAAE,EAAE,eAAe;QACnB,IAAI,EAAE,eAAe;QACrB,EAAE,EAAE,KAAK,EAAE,OAAO,EAAE,EAAE,GAAG,EAAE,EAAE,EAAE;YAC7B,MAAM,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC;YAC3B,IAAI,GAAG,CAAC,SAAS,EAAE,CAAC;gBAClB,MAAM,CAAC,IAAI,CAAC,6DAA6D,CAAC,CAAC;gBAC3E,MAAM,gBAAgB,GAAG,cAAI,CAAC,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,sBAAsB,EAAE,QAAQ,CAAC,CAAC;gBACpF,IAAI,MAAM,kBAAE,CAAC,UAAU,CAAC,gBAAgB,CAAC,EAAE,CAAC;oBAC1C,MAAM,CAAC,IAAI,CAAC,sEAAsE,CAAC,CAAC;gBACtF,CAAC;qBAAM,CAAC;oBACN,MAAM,CAAC,IAAI,CAAC,wEAAwE,CAAC,CAAC;oBACtF,MAAM,CAAC,IAAI,CAAC,qBAAa,CAAC,CAAC;oBAC3B,MAAM,kBAAE,CAAC,SAAS,CAAC,gBAAgB,EAAE,qBAAa,CAAC,CAAC;gBACtD,CAAC;YACH,CAAC;iBAAM,CAAC;gBACN,MAAM,gBAAgB,GAAG,cAAI,CAAC,IAAI,CAAC,IAAA,oCAAmB,EAAC,OAAO,CAAC,gBAAgB,CAAC,EAAE,QAAQ,CAAC,CAAC;gBAC5F,IAAI,MAAM,kBAAE,CAAC,UAAU,CAAC,gBAAgB,CAAC,EAAE,CAAC;oBAC1C,MAAM,CAAC,IAAI,CACT,mBAAmB,cAAI,CAAC,QAAQ,CAC9B,OAAO,CAAC,MAAM,CAAC,sBAAsB,EACrC,gBAAgB,CACjB,EAAE,CACJ,CAAC;gBACJ,CAAC;YACH,CAAC;QACH,CAAC;KACF,CAAC,CAAC;AACL,CAAC","sourcesContent":["import path from 'path';\n\nimport fs from 'fs-extra';\nimport { BuildFunction } from '@expo/steps';\n\nimport { findPackagerRootDir } from '../../utils/packageManager';\nimport { NpmrcTemplate } from '../../templates/npmrc';\n\nexport function createSetUpNpmrcBuildFunction(): BuildFunction {\n return new BuildFunction({\n namespace: 'eas',\n id: 'use_npm_token',\n name: 'Use NPM_TOKEN',\n fn: async (stepCtx, { env }) => {\n const { logger } = stepCtx;\n if (env.NPM_TOKEN) {\n logger.info('We detected that you set the NPM_TOKEN environment variable');\n const projectNpmrcPath = path.join(stepCtx.global.projectTargetDirectory, '.npmrc');\n if (await fs.pathExists(projectNpmrcPath)) {\n logger.info('.npmrc already exists in your project directory, skipping generation');\n } else {\n logger.info('Creating .npmrc in your project directory with the following contents:');\n logger.info(NpmrcTemplate);\n await fs.writeFile(projectNpmrcPath, NpmrcTemplate);\n }\n } else {\n const projectNpmrcPath = path.join(findPackagerRootDir(stepCtx.workingDirectory), '.npmrc');\n if (await fs.pathExists(projectNpmrcPath)) {\n logger.info(\n `.npmrc found at ${path.relative(\n stepCtx.global.projectTargetDirectory,\n projectNpmrcPath\n )}`\n );\n }\n }\n },\n });\n}\n"]}
|
|
@@ -8,9 +8,9 @@ exports.injectConfigureVersionGradleConfig = injectConfigureVersionGradleConfig;
|
|
|
8
8
|
const path_1 = __importDefault(require("path"));
|
|
9
9
|
const config_plugins_1 = require("@expo/config-plugins");
|
|
10
10
|
const fs_extra_1 = __importDefault(require("fs-extra"));
|
|
11
|
-
const template_file_1 =
|
|
12
|
-
const
|
|
13
|
-
const
|
|
11
|
+
const template_file_1 = require("@expo/template-file");
|
|
12
|
+
const EasBuildInjectAndroidCredentialsGradle_1 = require("../../../templates/EasBuildInjectAndroidCredentialsGradle");
|
|
13
|
+
const EasBuildConfigureVersionGradle_1 = require("../../../templates/EasBuildConfigureVersionGradle");
|
|
14
14
|
const APPLY_EAS_BUILD_INJECT_CREDENTIALS_GRADLE_LINE = 'apply from: "./eas-build-inject-android-credentials.gradle"';
|
|
15
15
|
const APPLY_EAS_BUILD_CONFIGURE_VERSION_GRADLE_LINE = 'apply from: "./eas-build-configure-version.gradle"';
|
|
16
16
|
async function injectCredentialsGradleConfig(logger, workingDir) {
|
|
@@ -49,16 +49,19 @@ function getEasBuildConfigureVersionGradlePath(workingDir) {
|
|
|
49
49
|
}
|
|
50
50
|
async function createEasBuildInjectCredentialsGradle(workingDir) {
|
|
51
51
|
const targetPath = getEasBuildInjectCredentialsGradlePath(workingDir);
|
|
52
|
-
await fs_extra_1.default.
|
|
52
|
+
await fs_extra_1.default.writeFile(targetPath, EasBuildInjectAndroidCredentialsGradle_1.EasBuildInjectAndroidCredentialsGradle);
|
|
53
53
|
}
|
|
54
54
|
async function createEasBuildConfigureVersionGradle(workingDir, { versionCode, versionName }) {
|
|
55
55
|
const targetPath = getEasBuildConfigureVersionGradlePath(workingDir);
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
56
|
+
const output = (0, template_file_1.templateString)({
|
|
57
|
+
input: EasBuildConfigureVersionGradle_1.EasBuildConfigureVersionGradleTemplate,
|
|
58
|
+
vars: {
|
|
59
|
+
VERSION_CODE: versionCode,
|
|
60
|
+
VERSION_NAME: versionName,
|
|
61
|
+
},
|
|
60
62
|
mustache: false,
|
|
61
63
|
});
|
|
64
|
+
await fs_extra_1.default.writeFile(targetPath, output);
|
|
62
65
|
}
|
|
63
66
|
async function addApplyInjectCredentialsConfigToBuildGradle(projectRoot) {
|
|
64
67
|
const buildGradlePath = config_plugins_1.AndroidConfig.Paths.getAppBuildGradleFilePath(projectRoot);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gradleConfig.js","sourceRoot":"","sources":["../../../../src/steps/utils/android/gradleConfig.ts"],"names":[],"mappings":";;;;;
|
|
1
|
+
{"version":3,"file":"gradleConfig.js","sourceRoot":"","sources":["../../../../src/steps/utils/android/gradleConfig.ts"],"names":[],"mappings":";;;;;AAeA,sEASC;AAED,gFAgBC;AA1CD,gDAAwB;AAExB,yDAAqD;AAErD,wDAA0B;AAC1B,uDAAqD;AAErD,sHAAmH;AACnH,sGAA2G;AAE3G,MAAM,8CAA8C,GAClD,6DAA6D,CAAC;AAChE,MAAM,6CAA6C,GACjD,oDAAoD,CAAC;AAEhD,KAAK,UAAU,6BAA6B,CACjD,MAAc,EACd,UAAkB;IAElB,MAAM,CAAC,IAAI,CAAC,4CAA4C,CAAC,CAAC;IAC1D,MAAM,qCAAqC,CAAC,UAAU,CAAC,CAAC;IACxD,MAAM,qCAAqC,CAAC,UAAU,CAAC,CAAC;IACxD,MAAM,4CAA4C,CAAC,UAAU,CAAC,CAAC;IAC/D,MAAM,CAAC,IAAI,CAAC,yBAAyB,CAAC,CAAC;AACzC,CAAC;AAEM,KAAK,UAAU,kCAAkC,CACtD,MAAc,EACd,UAAkB,EAClB,EAAE,WAAW,EAAE,WAAW,EAAkD;IAE5E,MAAM,CAAC,IAAI,CAAC,4CAA4C,CAAC,CAAC;IAC1D,IAAI,WAAW,EAAE,CAAC;QAChB,MAAM,CAAC,IAAI,CAAC,iBAAiB,WAAW,EAAE,CAAC,CAAC;IAC9C,CAAC;IACD,IAAI,WAAW,EAAE,CAAC;QAChB,MAAM,CAAC,IAAI,CAAC,iBAAiB,WAAW,EAAE,CAAC,CAAC;IAC9C,CAAC;IACD,MAAM,oCAAoC,CAAC,UAAU,CAAC,CAAC;IACvD,MAAM,oCAAoC,CAAC,UAAU,EAAE,EAAE,WAAW,EAAE,WAAW,EAAE,CAAC,CAAC;IACrF,M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path from 'path';\n\nimport { AndroidConfig } from '@expo/config-plugins';\nimport { bunyan } from '@expo/logger';\nimport fs from 'fs-extra';\nimport { templateString } from '@expo/template-file';\n\nimport { EasBuildInjectAndroidCredentialsGradle } from '../../../templates/EasBuildInjectAndroidCredentialsGradle';\nimport { EasBuildConfigureVersionGradleTemplate } from '../../../templates/EasBuildConfigureVersionGradle';\n\nconst APPLY_EAS_BUILD_INJECT_CREDENTIALS_GRADLE_LINE =\n 'apply from: \"./eas-build-inject-android-credentials.gradle\"';\nconst APPLY_EAS_BUILD_CONFIGURE_VERSION_GRADLE_LINE =\n 'apply from: \"./eas-build-configure-version.gradle\"';\n\nexport async function injectCredentialsGradleConfig(\n logger: bunyan,\n workingDir: string\n): Promise<void> {\n logger.info('Injecting signing config into build.gradle');\n await deleteEasBuildInjectCredentialsGradle(workingDir);\n await createEasBuildInjectCredentialsGradle(workingDir);\n await addApplyInjectCredentialsConfigToBuildGradle(workingDir);\n logger.info('Signing config injected');\n}\n\nexport async function injectConfigureVersionGradleConfig(\n logger: bunyan,\n workingDir: string,\n { versionCode, versionName }: { versionCode?: string; versionName?: string }\n): Promise<void> {\n logger.info('Injecting version config into build.gradle');\n if (versionCode) {\n logger.info(`Version code: ${versionCode}`);\n }\n if (versionName) {\n logger.info(`Version name: ${versionName}`);\n }\n await deleteEasBuildConfigureVersionGradle(workingDir);\n await createEasBuildConfigureVersionGradle(workingDir, { versionCode, versionName });\n await addApplyConfigureVersionConfigToBuildGradle(workingDir);\n logger.info('Version config injected');\n}\n\nasync function deleteEasBuildInjectCredentialsGradle(workingDir: string): Promise<void> {\n const targetPath = getEasBuildInjectCredentialsGradlePath(workingDir);\n await fs.remove(targetPath);\n}\n\nasync function deleteEasBuildConfigureVersionGradle(workingDir: string): Promise<void> {\n const targetPath = getEasBuildConfigureVersionGradlePath(workingDir);\n await fs.remove(targetPath);\n}\n\nfunction getEasBuildInjectCredentialsGradlePath(workingDir: string): string {\n return path.join(workingDir, 'android/app/eas-build-inject-android-credentials.gradle');\n}\n\nfunction getEasBuildConfigureVersionGradlePath(workingDir: string): string {\n return path.join(workingDir, 'android/app/eas-build-configure-version.gradle');\n}\n\nasync function createEasBuildInjectCredentialsGradle(workingDir: string): Promise<void> {\n const targetPath = getEasBuildInjectCredentialsGradlePath(workingDir);\n await fs.writeFile(targetPath, EasBuildInjectAndroidCredentialsGradle);\n}\n\nasync function createEasBuildConfigureVersionGradle(\n workingDir: string,\n { versionCode, versionName }: { versionCode?: string; versionName?: string }\n): Promise<void> {\n const targetPath = getEasBuildConfigureVersionGradlePath(workingDir);\n const output = templateString({\n input: EasBuildConfigureVersionGradleTemplate,\n vars: {\n VERSION_CODE: versionCode,\n VERSION_NAME: versionName,\n },\n mustache: false,\n });\n await fs.writeFile(targetPath, output);\n}\n\nasync function addApplyInjectCredentialsConfigToBuildGradle(projectRoot: string): Promise<void> {\n const buildGradlePath = AndroidConfig.Paths.getAppBuildGradleFilePath(projectRoot);\n const buildGradleContents = await fs.readFile(path.join(buildGradlePath), 'utf8');\n\n if (hasLine(buildGradleContents, APPLY_EAS_BUILD_INJECT_CREDENTIALS_GRADLE_LINE)) {\n return;\n }\n\n await fs.writeFile(\n buildGradlePath,\n `${buildGradleContents.trim()}\\n${APPLY_EAS_BUILD_INJECT_CREDENTIALS_GRADLE_LINE}\\n`\n );\n}\n\nasync function addApplyConfigureVersionConfigToBuildGradle(projectRoot: string): Promise<void> {\n const buildGradlePath = AndroidConfig.Paths.getAppBuildGradleFilePath(projectRoot);\n const buildGradleContents = await fs.readFile(path.join(buildGradlePath), 'utf8');\n\n if (hasLine(buildGradleContents, APPLY_EAS_BUILD_CONFIGURE_VERSION_GRADLE_LINE)) {\n return;\n }\n\n await fs.writeFile(\n buildGradlePath,\n `${buildGradleContents.trim()}\\n${APPLY_EAS_BUILD_CONFIGURE_VERSION_GRADLE_LINE}\\n`\n );\n}\n\nfunction hasLine(haystack: string, needle: string): boolean {\n return (\n haystack\n .replace(/\\r\\n/g, '\\n')\n .split('\\n')\n // Check for both single and double quotes\n .some((line) => line === needle || line === needle.replace(/\"/g, \"'\"))\n );\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const EasBuildConfigureVersionGradleTemplate = "// Build integration with EAS\n\nimport java.nio.file.Paths\n\ndef versionCodeVal = null\ndef versionNameVal = null\n<% if (VERSION_CODE) { %>\n versionCodeVal = \"<%- VERSION_CODE %>\"\n<% } %>\n<% if (VERSION_NAME) { %>\n versionNameVal = \"<%- VERSION_NAME %>\"\n<% } %>\n\nandroid {\n defaultConfig {\n if (versionCodeVal) {\n versionCode = Integer.parseInt(versionCodeVal)\n }\n if (versionNameVal) {\n versionName = versionNameVal\n }\n }\n applicationVariants.all { variant ->\n variant.outputs.each { output ->\n if (versionCodeVal) {\n output.versionCodeOverride = Integer.parseInt(versionCodeVal)\n }\n if (versionNameVal) {\n output.versionNameOverride = versionNameVal\n }\n }\n }\n}\n";
|
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.EasBuildConfigureVersionGradleTemplate = void 0;
|
|
4
|
+
exports.EasBuildConfigureVersionGradleTemplate = `// Build integration with EAS
|
|
2
5
|
|
|
3
6
|
import java.nio.file.Paths
|
|
4
7
|
|
|
@@ -31,3 +34,5 @@ android {
|
|
|
31
34
|
}
|
|
32
35
|
}
|
|
33
36
|
}
|
|
37
|
+
`;
|
|
38
|
+
//# sourceMappingURL=EasBuildConfigureVersionGradle.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"EasBuildConfigureVersionGradle.js","sourceRoot":"","sources":["../../src/templates/EasBuildConfigureVersionGradle.ts"],"names":[],"mappings":";;;AAAa,QAAA,sCAAsC,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAiCrD,CAAC","sourcesContent":["export const EasBuildConfigureVersionGradleTemplate = `// Build integration with EAS\n\nimport java.nio.file.Paths\n\ndef versionCodeVal = null\ndef versionNameVal = null\n<% if (VERSION_CODE) { %>\n versionCodeVal = \"<%- VERSION_CODE %>\"\n<% } %>\n<% if (VERSION_NAME) { %>\n versionNameVal = \"<%- VERSION_NAME %>\"\n<% } %>\n\nandroid {\n defaultConfig {\n if (versionCodeVal) {\n versionCode = Integer.parseInt(versionCodeVal)\n }\n if (versionNameVal) {\n versionName = versionNameVal\n }\n }\n applicationVariants.all { variant ->\n variant.outputs.each { output ->\n if (versionCodeVal) {\n output.versionCodeOverride = Integer.parseInt(versionCodeVal)\n }\n if (versionNameVal) {\n output.versionNameOverride = versionNameVal\n }\n }\n }\n}\n`;\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const EasBuildGradle = "// Build integration with EAS\n\nimport java.nio.file.Paths\n\ndef versionCodeFromEnv = System.getenv(\"EAS_BUILD_ANDROID_VERSION_CODE\")\ndef versionNameFromEnv = System.getenv(\"EAS_BUILD_ANDROID_VERSION_NAME\")\n\nandroid {\n defaultConfig {\n if (versionCodeFromEnv) {\n versionCode = Integer.parseInt(versionCodeFromEnv)\n }\n if (versionNameFromEnv) {\n versionName = versionNameFromEnv\n }\n }\n applicationVariants.all { variant ->\n variant.outputs.each { output ->\n if (versionCodeFromEnv) {\n output.versionCodeOverride = Integer.parseInt(versionCodeFromEnv)\n }\n if (versionNameFromEnv) {\n output.versionNameOverride = versionNameFromEnv\n }\n }\n }\n signingConfigs {\n release {\n def credentialsJson = Paths.get(System.getenv(\"EAS_BUILD_WORKINGDIR\")).resolve(\"credentials.json\").toFile();\n def credentials = new groovy.json.JsonSlurper().parse(credentialsJson)\n def keystorePath = Paths.get(credentials.android.keystore.keystorePath);\n\n storeFile keystorePath.toFile()\n storePassword credentials.android.keystore.keystorePassword\n keyAlias credentials.android.keystore.keyAlias\n if (credentials.android.keystore.containsKey(\"keyPassword\")) {\n keyPassword credentials.android.keystore.keyPassword\n } else {\n // key password is required by Gradle, but PKCS keystores don't have one\n // using the keystore password seems to satisfy the requirement\n keyPassword credentials.android.keystore.keystorePassword\n }\n }\n }\n\n buildTypes {\n release {\n signingConfig android.signingConfigs.release\n }\n debug {\n signingConfig android.signingConfigs.release\n }\n }\n}";
|
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.EasBuildGradle = void 0;
|
|
4
|
+
exports.EasBuildGradle = `// Build integration with EAS
|
|
2
5
|
|
|
3
6
|
import java.nio.file.Paths
|
|
4
7
|
|
|
@@ -51,4 +54,5 @@ android {
|
|
|
51
54
|
signingConfig android.signingConfigs.release
|
|
52
55
|
}
|
|
53
56
|
}
|
|
54
|
-
}
|
|
57
|
+
}`;
|
|
58
|
+
//# sourceMappingURL=EasBuildGradle.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"EasBuildGradle.js","sourceRoot":"","sources":["../../src/templates/EasBuildGradle.ts"],"names":[],"mappings":";;;AAAa,QAAA,cAAc,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAqD5B,CAAC","sourcesContent":["export const EasBuildGradle = `// Build integration with EAS\n\nimport java.nio.file.Paths\n\ndef versionCodeFromEnv = System.getenv(\"EAS_BUILD_ANDROID_VERSION_CODE\")\ndef versionNameFromEnv = System.getenv(\"EAS_BUILD_ANDROID_VERSION_NAME\")\n\nandroid {\n defaultConfig {\n if (versionCodeFromEnv) {\n versionCode = Integer.parseInt(versionCodeFromEnv)\n }\n if (versionNameFromEnv) {\n versionName = versionNameFromEnv\n }\n }\n applicationVariants.all { variant ->\n variant.outputs.each { output ->\n if (versionCodeFromEnv) {\n output.versionCodeOverride = Integer.parseInt(versionCodeFromEnv)\n }\n if (versionNameFromEnv) {\n output.versionNameOverride = versionNameFromEnv\n }\n }\n }\n signingConfigs {\n release {\n def credentialsJson = Paths.get(System.getenv(\"EAS_BUILD_WORKINGDIR\")).resolve(\"credentials.json\").toFile();\n def credentials = new groovy.json.JsonSlurper().parse(credentialsJson)\n def keystorePath = Paths.get(credentials.android.keystore.keystorePath);\n\n storeFile keystorePath.toFile()\n storePassword credentials.android.keystore.keystorePassword\n keyAlias credentials.android.keystore.keyAlias\n if (credentials.android.keystore.containsKey(\"keyPassword\")) {\n keyPassword credentials.android.keystore.keyPassword\n } else {\n // key password is required by Gradle, but PKCS keystores don't have one\n // using the keystore password seems to satisfy the requirement\n keyPassword credentials.android.keystore.keystorePassword\n }\n }\n }\n\n buildTypes {\n release {\n signingConfig android.signingConfigs.release\n }\n debug {\n signingConfig android.signingConfigs.release\n }\n }\n}`;\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const EasBuildInjectAndroidCredentialsGradle = "// Build integration with EAS\n\nimport java.nio.file.Paths\n\n\nandroid {\n signingConfigs {\n release {\n def credentialsJson = Paths.get(System.getenv(\"EAS_BUILD_WORKINGDIR\")).resolve(\"credentials.json\").toFile();\n def credentials = new groovy.json.JsonSlurper().parse(credentialsJson)\n def keystorePath = Paths.get(credentials.android.keystore.keystorePath);\n\n storeFile keystorePath.toFile()\n storePassword credentials.android.keystore.keystorePassword\n keyAlias credentials.android.keystore.keyAlias\n if (credentials.android.keystore.containsKey(\"keyPassword\")) {\n keyPassword credentials.android.keystore.keyPassword\n } else {\n // key password is required by Gradle, but PKCS keystores don't have one\n // using the keystore password seems to satisfy the requirement\n keyPassword credentials.android.keystore.keystorePassword\n }\n }\n }\n\n buildTypes {\n release {\n signingConfig android.signingConfigs.release\n }\n debug {\n signingConfig android.signingConfigs.release\n }\n }\n}";
|
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.EasBuildInjectAndroidCredentialsGradle = void 0;
|
|
4
|
+
exports.EasBuildInjectAndroidCredentialsGradle = `// Build integration with EAS
|
|
2
5
|
|
|
3
6
|
import java.nio.file.Paths
|
|
4
7
|
|
|
@@ -31,4 +34,5 @@ android {
|
|
|
31
34
|
signingConfig android.signingConfigs.release
|
|
32
35
|
}
|
|
33
36
|
}
|
|
34
|
-
}
|
|
37
|
+
}`;
|
|
38
|
+
//# sourceMappingURL=EasBuildInjectAndroidCredentialsGradle.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"EasBuildInjectAndroidCredentialsGradle.js","sourceRoot":"","sources":["../../src/templates/EasBuildInjectAndroidCredentialsGradle.ts"],"names":[],"mappings":";;;AAAa,QAAA,sCAAsC,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAiCpD,CAAC","sourcesContent":["export const EasBuildInjectAndroidCredentialsGradle = `// Build integration with EAS\n\nimport java.nio.file.Paths\n\n\nandroid {\n signingConfigs {\n release {\n def credentialsJson = Paths.get(System.getenv(\"EAS_BUILD_WORKINGDIR\")).resolve(\"credentials.json\").toFile();\n def credentials = new groovy.json.JsonSlurper().parse(credentialsJson)\n def keystorePath = Paths.get(credentials.android.keystore.keystorePath);\n\n storeFile keystorePath.toFile()\n storePassword credentials.android.keystore.keystorePassword\n keyAlias credentials.android.keystore.keyAlias\n if (credentials.android.keystore.containsKey(\"keyPassword\")) {\n keyPassword credentials.android.keystore.keyPassword\n } else {\n // key password is required by Gradle, but PKCS keystores don't have one\n // using the keystore password seems to satisfy the requirement\n keyPassword credentials.android.keystore.keystorePassword\n }\n }\n }\n\n buildTypes {\n release {\n signingConfig android.signingConfigs.release\n }\n debug {\n signingConfig android.signingConfigs.release\n }\n }\n}`;\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const FastfileResignTemplate = "lane :do_resign do\n resign(\n ipa: \"<%- IPA_PATH %>\",\n signing_identity: \"<%- SIGNING_IDENTITY %>\",\n provisioning_profile: {<% _.forEach(PROFILES, function(profile) { %>\n \"<%- profile.BUNDLE_ID %>\" => \"<%- profile.PATH %>\",<% }); %>\n },\n keychain_path: \"<%- KEYCHAIN_PATH %>\"\n )\nend\n";
|
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.FastfileResignTemplate = void 0;
|
|
4
|
+
exports.FastfileResignTemplate = `lane :do_resign do
|
|
2
5
|
resign(
|
|
3
6
|
ipa: "<%- IPA_PATH %>",
|
|
4
7
|
signing_identity: "<%- SIGNING_IDENTITY %>",
|
|
@@ -8,3 +11,5 @@ lane :do_resign do
|
|
|
8
11
|
keychain_path: "<%- KEYCHAIN_PATH %>"
|
|
9
12
|
)
|
|
10
13
|
end
|
|
14
|
+
`;
|
|
15
|
+
//# sourceMappingURL=FastfileResign.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FastfileResign.js","sourceRoot":"","sources":["../../src/templates/FastfileResign.ts"],"names":[],"mappings":";;;AAAa,QAAA,sBAAsB,GAAG;;;;;;;;;;CAUrC,CAAC","sourcesContent":["export const FastfileResignTemplate = `lane :do_resign do\n resign(\n ipa: \"<%- IPA_PATH %>\",\n signing_identity: \"<%- SIGNING_IDENTITY %>\",\n provisioning_profile: {<% _.forEach(PROFILES, function(profile) { %>\n \"<%- profile.BUNDLE_ID %>\" => \"<%- profile.PATH %>\",<% }); %>\n },\n keychain_path: \"<%- KEYCHAIN_PATH %>\"\n )\nend\n`;\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const GymfileArchiveTemplate = "suppress_xcode_output(true)\nclean(<%- CLEAN %>)\n\nscheme(\"<%- SCHEME %>\")\n<% if (SCHEME_BUILD_CONFIGURATION) { %>\nconfiguration(\"<%- SCHEME_BUILD_CONFIGURATION %>\")\n<% } %>\n\nexport_options({\n method: \"<%- EXPORT_METHOD %>\",\n provisioningProfiles: {<% _.forEach(PROFILES, function(profile) { %>\n \"<%- profile.BUNDLE_ID %>\" => \"<%- profile.UUID %>\",<% }); %>\n }<% if (ICLOUD_CONTAINER_ENVIRONMENT) { %>,\n iCloudContainerEnvironment: \"<%- ICLOUD_CONTAINER_ENVIRONMENT %>\"\n<% } %>\n})\n\nexport_xcargs \"OTHER_CODE_SIGN_FLAGS=\\\"--keychain <%- KEYCHAIN_PATH %>\\\"\"\n\ndisable_xcpretty(true)\nbuildlog_path(\"<%- LOGS_DIRECTORY %>\")\n\noutput_directory(\"<%- OUTPUT_DIRECTORY %>\")\n";
|
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.GymfileArchiveTemplate = void 0;
|
|
4
|
+
exports.GymfileArchiveTemplate = `suppress_xcode_output(true)
|
|
2
5
|
clean(<%- CLEAN %>)
|
|
3
6
|
|
|
4
7
|
scheme("<%- SCHEME %>")
|
|
@@ -15,9 +18,11 @@ export_options({
|
|
|
15
18
|
<% } %>
|
|
16
19
|
})
|
|
17
20
|
|
|
18
|
-
export_xcargs "OTHER_CODE_SIGN_FLAGS
|
|
21
|
+
export_xcargs "OTHER_CODE_SIGN_FLAGS=\\"--keychain <%- KEYCHAIN_PATH %>\\""
|
|
19
22
|
|
|
20
23
|
disable_xcpretty(true)
|
|
21
24
|
buildlog_path("<%- LOGS_DIRECTORY %>")
|
|
22
25
|
|
|
23
26
|
output_directory("<%- OUTPUT_DIRECTORY %>")
|
|
27
|
+
`;
|
|
28
|
+
//# sourceMappingURL=GymfileArchive.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"GymfileArchive.js","sourceRoot":"","sources":["../../src/templates/GymfileArchive.ts"],"names":[],"mappings":";;;AAAa,QAAA,sBAAsB,GAAG;;;;;;;;;;;;;;;;;;;;;;;CAuBrC,CAAC","sourcesContent":["export const GymfileArchiveTemplate = `suppress_xcode_output(true)\nclean(<%- CLEAN %>)\n\nscheme(\"<%- SCHEME %>\")\n<% if (SCHEME_BUILD_CONFIGURATION) { %>\nconfiguration(\"<%- SCHEME_BUILD_CONFIGURATION %>\")\n<% } %>\n\nexport_options({\n method: \"<%- EXPORT_METHOD %>\",\n provisioningProfiles: {<% _.forEach(PROFILES, function(profile) { %>\n \"<%- profile.BUNDLE_ID %>\" => \"<%- profile.UUID %>\",<% }); %>\n }<% if (ICLOUD_CONTAINER_ENVIRONMENT) { %>,\n iCloudContainerEnvironment: \"<%- ICLOUD_CONTAINER_ENVIRONMENT %>\"\n<% } %>\n})\n\nexport_xcargs \"OTHER_CODE_SIGN_FLAGS=\\\\\"--keychain <%- KEYCHAIN_PATH %>\\\\\"\"\n\ndisable_xcpretty(true)\nbuildlog_path(\"<%- LOGS_DIRECTORY %>\")\n\noutput_directory(\"<%- OUTPUT_DIRECTORY %>\")\n`;\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const GymfileSimulatorTemplate = "suppress_xcode_output(true)\nclean(<%- CLEAN %>)\n\nscheme(\"<%- SCHEME %>\")\n<% if (SCHEME_BUILD_CONFIGURATION) { %>\nconfiguration(\"<%- SCHEME_BUILD_CONFIGURATION %>\")\n<% } %>\n\nderived_data_path(\"<%- DERIVED_DATA_PATH %>\")\nskip_package_ipa(true)\nskip_archive(true)\ndestination(\"<%- SCHEME_SIMULATOR_DESTINATION %>\")\n\ndisable_xcpretty(true)\nbuildlog_path(\"<%- LOGS_DIRECTORY %>\")\n";
|
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.GymfileSimulatorTemplate = void 0;
|
|
4
|
+
exports.GymfileSimulatorTemplate = `suppress_xcode_output(true)
|
|
2
5
|
clean(<%- CLEAN %>)
|
|
3
6
|
|
|
4
7
|
scheme("<%- SCHEME %>")
|
|
@@ -13,3 +16,5 @@ destination("<%- SCHEME_SIMULATOR_DESTINATION %>")
|
|
|
13
16
|
|
|
14
17
|
disable_xcpretty(true)
|
|
15
18
|
buildlog_path("<%- LOGS_DIRECTORY %>")
|
|
19
|
+
`;
|
|
20
|
+
//# sourceMappingURL=GymfileSimulator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"GymfileSimulator.js","sourceRoot":"","sources":["../../src/templates/GymfileSimulator.ts"],"names":[],"mappings":";;;AAAa,QAAA,wBAAwB,GAAG;;;;;;;;;;;;;;;CAevC,CAAC","sourcesContent":["export const GymfileSimulatorTemplate = `suppress_xcode_output(true)\nclean(<%- CLEAN %>)\n\nscheme(\"<%- SCHEME %>\")\n<% if (SCHEME_BUILD_CONFIGURATION) { %>\nconfiguration(\"<%- SCHEME_BUILD_CONFIGURATION %>\")\n<% } %>\n\nderived_data_path(\"<%- DERIVED_DATA_PATH %>\")\nskip_package_ipa(true)\nskip_archive(true)\ndestination(\"<%- SCHEME_SIMULATOR_DESTINATION %>\")\n\ndisable_xcpretty(true)\nbuildlog_path(\"<%- LOGS_DIRECTORY %>\")\n`;\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const NpmrcTemplate = "//registry.npmjs.org/:_authToken=${NPM_TOKEN}\nregistry=https://registry.npmjs.org/\n";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"npmrc.js","sourceRoot":"","sources":["../../src/templates/npmrc.ts"],"names":[],"mappings":";;;AAAa,QAAA,aAAa,GAAG;;CAE5B,CAAC","sourcesContent":["export const NpmrcTemplate = `//registry.npmjs.org/:_authToken=\\${NPM_TOKEN}\nregistry=https://registry.npmjs.org/\n`;\n"]}
|
package/dist/utils/npmrc.js
CHANGED
|
@@ -6,8 +6,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
exports.setUpNpmrcAsync = setUpNpmrcAsync;
|
|
7
7
|
const path_1 = __importDefault(require("path"));
|
|
8
8
|
const fs_extra_1 = __importDefault(require("fs-extra"));
|
|
9
|
+
const npmrc_1 = require("../templates/npmrc");
|
|
9
10
|
const packageManager_1 = require("./packageManager");
|
|
10
|
-
const NPMRC_TEMPLATE_PATH = path_1.default.join(__dirname, '../../templates/npmrc');
|
|
11
11
|
async function setUpNpmrcAsync(ctx, logger) {
|
|
12
12
|
if (ctx.env.NPM_TOKEN) {
|
|
13
13
|
await createNpmrcIfNotExistsAsync(ctx, logger);
|
|
@@ -23,10 +23,9 @@ async function createNpmrcIfNotExistsAsync(ctx, logger) {
|
|
|
23
23
|
logger.info('.npmrc already exists in your project directory, skipping generation');
|
|
24
24
|
}
|
|
25
25
|
else {
|
|
26
|
-
const npmrcContents = await fs_extra_1.default.readFile(NPMRC_TEMPLATE_PATH, 'utf8');
|
|
27
26
|
logger.info('Creating .npmrc in your project directory with the following contents:');
|
|
28
|
-
logger.info(
|
|
29
|
-
await fs_extra_1.default.
|
|
27
|
+
logger.info(npmrc_1.NpmrcTemplate);
|
|
28
|
+
await fs_extra_1.default.writeFile(projectNpmrcPath, npmrc_1.NpmrcTemplate);
|
|
30
29
|
}
|
|
31
30
|
}
|
|
32
31
|
async function logIfNpmrcExistsAsync(ctx, logger) {
|
package/dist/utils/npmrc.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"npmrc.js","sourceRoot":"","sources":["../../src/utils/npmrc.ts"],"names":[],"mappings":";;;;;
|
|
1
|
+
{"version":3,"file":"npmrc.js","sourceRoot":"","sources":["../../src/utils/npmrc.ts"],"names":[],"mappings":";;;;;AAWA,0CAMC;AAjBD,gDAAwB;AAIxB,wDAA0B;AAG1B,8CAAmD;AAEnD,qDAAuD;AAEhD,KAAK,UAAU,eAAe,CAAC,GAAsB,EAAE,MAAc;IAC1E,IAAI,GAAG,CAAC,GAAG,CAAC,SAAS,EAAE,CAAC;QACtB,MAAM,2BAA2B,CAAC,GAAG,EAAE,MAAM,CAAC,CAAC;IACjD,CAAC;SAAM,CAAC;QACN,MAAM,qBAAqB,CAAC,GAAG,EAAE,MAAM,CAAC,CAAC;IAC3C,CAAC;AACH,CAAC;AAED,KAAK,UAAU,2BAA2B,CAAC,GAAsB,EAAE,MAAc;IAC/E,MAAM,CAAC,IAAI,CAAC,6DAA6D,CAAC,CAAC;IAC3E,MAAM,gBAAgB,GAAG,cAAI,CAAC,IAAI,CAAC,GAAG,CAAC,cAAc,EAAE,QAAQ,CAAC,CAAC;IACjE,IAAI,MAAM,kBAAE,CAAC,UAAU,CAAC,gBAAgB,CAAC,EAAE,CAAC;QAC1C,MAAM,CAAC,IAAI,CAAC,sEAAsE,CAAC,CAAC;IACtF,CAAC;SAAM,CAAC;QACN,MAAM,CAAC,IAAI,CAAC,wEAAwE,CAAC,CAAC;QACtF,MAAM,CAAC,IAAI,CAAC,qBAAa,CAAC,CAAC;QAC3B,MAAM,kBAAE,CAAC,SAAS,CAAC,gBAAgB,EAAE,qBAAa,CAAC,CAAC;IACtD,CAAC;AACH,CAAC;AAED,KAAK,UAAU,qBAAqB,CAAC,GAAsB,EAAE,MAAc;IACzE,MAAM,gBAAgB,GAAG,cAAI,CAAC,IAAI,CAChC,IAAA,oCAAmB,EAAC,GAAG,CAAC,8BAA8B,EAAE,CAAC,EACzD,QAAQ,CACT,CAAC;IACF,IAAI,MAAM,kBAAE,CAAC,UAAU,CAAC,gBAAgB,CAAC,EAAE,CAAC;QAC1C,MAAM,CAAC,IAAI,CAAC,mBAAmB,cAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,cAAc,EAAE,gBAAgB,CAAC,EAAE,CAAC,CAAC;IACxF,CAAC;AACH,CAAC","sourcesContent":["import path from 'path';\n\nimport { Job } from '@expo/eas-build-job';\nimport { bunyan } from '@expo/logger';\nimport fs from 'fs-extra';\n\nimport { BuildContext } from '../context';\nimport { NpmrcTemplate } from '../templates/npmrc';\n\nimport { findPackagerRootDir } from './packageManager';\n\nexport async function setUpNpmrcAsync(ctx: BuildContext<Job>, logger: bunyan): Promise<void> {\n if (ctx.env.NPM_TOKEN) {\n await createNpmrcIfNotExistsAsync(ctx, logger);\n } else {\n await logIfNpmrcExistsAsync(ctx, logger);\n }\n}\n\nasync function createNpmrcIfNotExistsAsync(ctx: BuildContext<Job>, logger: bunyan): Promise<void> {\n logger.info('We detected that you set the NPM_TOKEN environment variable');\n const projectNpmrcPath = path.join(ctx.buildDirectory, '.npmrc');\n if (await fs.pathExists(projectNpmrcPath)) {\n logger.info('.npmrc already exists in your project directory, skipping generation');\n } else {\n logger.info('Creating .npmrc in your project directory with the following contents:');\n logger.info(NpmrcTemplate);\n await fs.writeFile(projectNpmrcPath, NpmrcTemplate);\n }\n}\n\nasync function logIfNpmrcExistsAsync(ctx: BuildContext<Job>, logger: bunyan): Promise<void> {\n const projectNpmrcPath = path.join(\n findPackagerRootDir(ctx.getReactNativeProjectDirectory()),\n '.npmrc'\n );\n if (await fs.pathExists(projectNpmrcPath)) {\n logger.info(`.npmrc found at ${path.relative(ctx.buildDirectory, projectNpmrcPath)}`);\n }\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@expo/build-tools",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.252",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"types": "dist/index.d.ts",
|
|
6
6
|
"files": [
|
|
@@ -32,14 +32,14 @@
|
|
|
32
32
|
"@expo/config": "10.0.6",
|
|
33
33
|
"@expo/config-plugins": "9.0.12",
|
|
34
34
|
"@expo/downloader": "1.0.221",
|
|
35
|
-
"@expo/eas-build-job": "1.0.
|
|
35
|
+
"@expo/eas-build-job": "1.0.252",
|
|
36
36
|
"@expo/env": "^0.4.0",
|
|
37
37
|
"@expo/logger": "1.0.221",
|
|
38
38
|
"@expo/package-manager": "1.7.0",
|
|
39
39
|
"@expo/plist": "^0.2.0",
|
|
40
40
|
"@expo/results": "^1.0.0",
|
|
41
|
-
"@expo/steps": "1.0.
|
|
42
|
-
"@expo/template-file": "1.0.
|
|
41
|
+
"@expo/steps": "1.0.252",
|
|
42
|
+
"@expo/template-file": "1.0.252",
|
|
43
43
|
"@expo/turtle-spawn": "1.0.221",
|
|
44
44
|
"@expo/xcpretty": "^4.3.1",
|
|
45
45
|
"@google-cloud/storage": "^7.11.2",
|
|
@@ -86,5 +86,5 @@
|
|
|
86
86
|
"node": "20.14.0",
|
|
87
87
|
"yarn": "1.22.21"
|
|
88
88
|
},
|
|
89
|
-
"gitHead": "
|
|
89
|
+
"gitHead": "f729d1ec839100ebfdb45a05b63bf58b6800247b"
|
|
90
90
|
}
|
package/templates/npmrc
DELETED