@expo/build-tools 1.0.2 → 1.0.4
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/LICENSE +1 -1
- package/dist/android/gradle.js +3 -20
- package/dist/android/gradle.js.map +1 -1
- package/dist/common/setup.js +26 -9
- package/dist/common/setup.js.map +1 -1
- package/dist/steps/functions/uploadArtifact.js +1 -2
- package/dist/steps/functions/uploadArtifact.js.map +1 -1
- package/dist/utils/processes.d.ts +1 -0
- package/dist/utils/processes.js +34 -0
- package/dist/utils/processes.js.map +1 -0
- package/package.json +3 -3
package/LICENSE
CHANGED
|
@@ -12,7 +12,7 @@ Additional Use Grant: You may make use of the Licensed Work, provided that you d
|
|
|
12
12
|
to access the functionality of and directly benefit from the
|
|
13
13
|
functionality of the Licensed Work.
|
|
14
14
|
|
|
15
|
-
Change Date: 2026-
|
|
15
|
+
Change Date: 2026-04-01
|
|
16
16
|
|
|
17
17
|
Change License: MIT
|
|
18
18
|
|
package/dist/android/gradle.js
CHANGED
|
@@ -8,6 +8,7 @@ const path_1 = __importDefault(require("path"));
|
|
|
8
8
|
const assert_1 = __importDefault(require("assert"));
|
|
9
9
|
const turtle_spawn_1 = __importDefault(require("@expo/turtle-spawn"));
|
|
10
10
|
const fs_extra_1 = __importDefault(require("fs-extra"));
|
|
11
|
+
const processes_1 = require("../utils/processes");
|
|
11
12
|
async function ensureLFLineEndingsInGradlewScript(ctx) {
|
|
12
13
|
const gradlewPath = path_1.default.join(ctx.reactNativeProjectDirectory, 'android', 'gradlew');
|
|
13
14
|
const gradlewContent = await fs_extra_1.default.readFile(gradlewPath, 'utf8');
|
|
@@ -50,26 +51,8 @@ function adjustOOMScore(spawnPromise, logger) {
|
|
|
50
51
|
setTimeout(async () => {
|
|
51
52
|
try {
|
|
52
53
|
(0, assert_1.default)(spawnPromise.child.pid);
|
|
53
|
-
const
|
|
54
|
-
|
|
55
|
-
while (shouldRetry) {
|
|
56
|
-
const result = await (0, turtle_spawn_1.default)('pgrep', ['-P', children.join(',')], {
|
|
57
|
-
stdio: 'pipe',
|
|
58
|
-
});
|
|
59
|
-
const pids = result.stdout
|
|
60
|
-
.toString()
|
|
61
|
-
.split('\n')
|
|
62
|
-
.map((i) => Number(i.trim()))
|
|
63
|
-
.filter((i) => i);
|
|
64
|
-
shouldRetry = false;
|
|
65
|
-
for (const pid of pids) {
|
|
66
|
-
if (!children.includes(pid)) {
|
|
67
|
-
shouldRetry = true;
|
|
68
|
-
children.push(pid);
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
await Promise.all(children.map(async (pid) => {
|
|
54
|
+
const pids = await (0, processes_1.getParentAndDescendantProcessPidsAsync)(spawnPromise.child.pid);
|
|
55
|
+
await Promise.all(pids.map(async (pid) => {
|
|
73
56
|
// Value 800 is just a guess here. It's probably higher than most other
|
|
74
57
|
// process. I didn't want to set it any higher, because I'm not sure if OOM Killer
|
|
75
58
|
// can start killing processes when there is still enough memory left.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gradle.js","sourceRoot":"","sources":["../../src/android/gradle.ts"],"names":[],"mappings":";;;;;;AAAA,gDAAwB;AACxB,oDAA4B;AAE5B,sEAAsE;AAEtE,wDAA0B;
|
|
1
|
+
{"version":3,"file":"gradle.js","sourceRoot":"","sources":["../../src/android/gradle.ts"],"names":[],"mappings":";;;;;;AAAA,gDAAwB;AACxB,oDAA4B;AAE5B,sEAAsE;AAEtE,wDAA0B;AAI1B,kDAA4E;AAErE,KAAK,UAAU,kCAAkC,CACtD,GAAuB;IAEvB,MAAM,WAAW,GAAG,cAAI,CAAC,IAAI,CAAC,GAAG,CAAC,2BAA2B,EAAE,SAAS,EAAE,SAAS,CAAC,CAAC;IACrF,MAAM,cAAc,GAAG,MAAM,kBAAE,CAAC,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC,CAAC;IAC9D,IAAI,cAAc,CAAC,QAAQ,CAAC,IAAI,CAAC,EA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G,CAAC,CAAC;YAC/B,MAAM,IAAI,GAAG,MAAM,IAAA,kDAAsC,EAAC,YAAY,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;YAClF,MAAM,OAAO,CAAC,GAAG,CACf,IAAI,CAAC,GAAG,CAAC,KAAK,EAAE,GAAW,EAAE,EAAE;gBAC7B,uEAAuE;gBACvE,kFAAkF;gBAClF,sEAAsE;gBACtE,MAAM,gBAAgB,GAAG,GAAG,CAAC;gBAC7B,MAAM,kBAAE,CAAC,SAAS,CAAC,SAAS,GAAG,gBAAgB,EAAE,GAAG,gBAAgB,IAAI,CAAC,CAAC;YAC5E,CAAC,CAAC,CACH,CAAC;SACH;QAAC,OAAO,GAAQ,EAAE;YACjB,MAAM,CAAC,KAAK,CAAC,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,aAAH,GAAG,uBAAH,GAAG,CAAE,MAAM,EAAE,EAAE,kCAAkC,CAAC,CAAC;SAChF;IACH,CAAC;IACD,+DAA+D;IAC/D,KAAK,CACN,CAAC;AACJ,CAAC","sourcesContent":["import path from 'path';\nimport assert from 'assert';\n\nimport spawn, { SpawnPromise, SpawnResult } from '@expo/turtle-spawn';\nimport { Android, Job } from '@expo/eas-build-job';\nimport fs from 'fs-extra';\nimport { bunyan } from '@expo/logger';\n\nimport { BuildContext } from '../context';\nimport { getParentAndDescendantProcessPidsAsync } from '../utils/processes';\n\nexport async function ensureLFLineEndingsInGradlewScript<TJob extends Job>(\n ctx: BuildContext<TJob>\n): Promise<void> {\n const gradlewPath = path.join(ctx.reactNativeProjectDirectory, 'android', 'gradlew');\n const gradlewContent = await fs.readFile(gradlewPath, 'utf8');\n if (gradlewContent.includes('\\r')) {\n ctx.logger.info('Replacing CRLF line endings with LF in gradlew script');\n await fs.writeFile(gradlewPath, gradlewContent.replace(/\\r\\n/g, '\\n'), 'utf8');\n }\n}\n\nexport async function runGradleCommand(\n ctx: BuildContext<Android.Job>,\n gradleCommand: string\n): Promise<void> {\n const androidDir = path.join(ctx.reactNativeProjectDirectory, 'android');\n ctx.logger.info(`Running 'gradlew ${gradleCommand}' in ${androidDir}`);\n const spawnPromise = spawn('bash', ['-c', `sh gradlew ${gradleCommand}`], {\n cwd: androidDir,\n logger: ctx.logger,\n lineTransformer: (line?: string) => {\n if (!line || /^\\.+$/.exec(line)) {\n return null;\n } else {\n return line;\n }\n },\n env: ctx.env,\n });\n if (ctx.env.EAS_BUILD_RUNNER === 'eas-build' && process.platform === 'linux') {\n adjustOOMScore(spawnPromise, ctx.logger);\n }\n\n await spawnPromise;\n}\n\n/**\n * OOM Killer sometimes kills worker server while build is exceeding memory limits.\n * `oom_score_adj` is a value between -1000 and 1000 and it defaults to 0.\n * It defines which process is more likely to get killed (higher value more likely).\n *\n * This function sets oom_score_adj for Gradle process and all its child processes.\n */\nfunction adjustOOMScore(spawnPromise: SpawnPromise<SpawnResult>, logger: bunyan): void {\n setTimeout(\n async () => {\n try {\n assert(spawnPromise.child.pid);\n const pids = await getParentAndDescendantProcessPidsAsync(spawnPromise.child.pid);\n await Promise.all(\n pids.map(async (pid: number) => {\n // Value 800 is just a guess here. It's probably higher than most other\n // process. I didn't want to set it any higher, because I'm not sure if OOM Killer\n // can start killing processes when there is still enough memory left.\n const oomScoreOverride = 800;\n await fs.writeFile(`/proc/${pid}/oom_score_adj`, `${oomScoreOverride}\\n`);\n })\n );\n } catch (err: any) {\n logger.debug({ err, stderr: err?.stderr }, 'Failed to override oom_score_adj');\n }\n },\n // Wait 20 seconds to make sure all child processes are started\n 20000\n );\n}\n"]}
|
package/dist/common/setup.js
CHANGED
|
@@ -7,15 +7,17 @@ exports.setupAsync = void 0;
|
|
|
7
7
|
const turtle_spawn_1 = __importDefault(require("@expo/turtle-spawn"));
|
|
8
8
|
const eas_build_job_1 = require("@expo/eas-build-job");
|
|
9
9
|
const common_1 = require("@expo/eas-build-job/dist/common");
|
|
10
|
+
const nullthrows_1 = __importDefault(require("nullthrows"));
|
|
10
11
|
const xcodeEnv_1 = require("../ios/xcodeEnv");
|
|
11
12
|
const hooks_1 = require("../utils/hooks");
|
|
12
13
|
const npmrc_1 = require("../utils/npmrc");
|
|
13
14
|
const packageManager_1 = require("../utils/packageManager");
|
|
14
15
|
const project_1 = require("../utils/project");
|
|
16
|
+
const processes_1 = require("../utils/processes");
|
|
15
17
|
const projectSources_1 = require("./projectSources");
|
|
16
18
|
const installDependencies_1 = require("./installDependencies");
|
|
17
19
|
const easBuildInternal_1 = require("./easBuildInternal");
|
|
18
|
-
const MAX_EXPO_DOCTOR_TIMEOUT_MS =
|
|
20
|
+
const MAX_EXPO_DOCTOR_TIMEOUT_MS = 30 * 1000;
|
|
19
21
|
class DoctorTimeoutError extends Error {
|
|
20
22
|
}
|
|
21
23
|
async function setupAsync(ctx) {
|
|
@@ -84,17 +86,32 @@ async function runExpoDoctor(ctx) {
|
|
|
84
86
|
ctx.logger.info('Running "expo doctor"');
|
|
85
87
|
let timeout;
|
|
86
88
|
let timedOut = false;
|
|
87
|
-
const
|
|
89
|
+
const isAtLeastNpm7 = await (0, packageManager_1.isAtLeastNpm7Async)();
|
|
88
90
|
try {
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
91
|
+
let promise;
|
|
92
|
+
if (!(0, project_1.shouldUseGlobalExpoCli)(ctx)) {
|
|
93
|
+
const argsPrefix = isAtLeastNpm7 ? ['-y'] : [];
|
|
94
|
+
promise = (0, turtle_spawn_1.default)('npx', [...argsPrefix, 'expo-doctor'], {
|
|
95
|
+
cwd: ctx.reactNativeProjectDirectory,
|
|
96
|
+
logger: ctx.logger,
|
|
97
|
+
env: ctx.env,
|
|
98
|
+
});
|
|
99
|
+
}
|
|
100
|
+
else {
|
|
101
|
+
promise = ctx.runGlobalExpoCliCommand(['doctor'], {
|
|
102
|
+
cwd: ctx.reactNativeProjectDirectory,
|
|
103
|
+
logger: ctx.logger,
|
|
104
|
+
env: ctx.env,
|
|
105
|
+
}, isAtLeastNpm7);
|
|
106
|
+
}
|
|
107
|
+
timeout = setTimeout(async () => {
|
|
95
108
|
var _a;
|
|
96
109
|
timedOut = true;
|
|
97
|
-
promise.child.
|
|
110
|
+
const ppid = (0, nullthrows_1.default)(promise.child.pid);
|
|
111
|
+
const pids = await (0, processes_1.getParentAndDescendantProcessPidsAsync)(ppid);
|
|
112
|
+
pids.forEach((pid) => {
|
|
113
|
+
process.kill(pid);
|
|
114
|
+
});
|
|
98
115
|
(_a = ctx.reportError) === null || _a === void 0 ? void 0 : _a.call(ctx, `"expo doctor" timed out`, undefined, {
|
|
99
116
|
extras: { buildId: ctx.env.EAS_BUILD_ID },
|
|
100
117
|
});
|
package/dist/common/setup.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"setup.js","sourceRoot":"","sources":["../../src/common/setup.ts"],"names":[],"mappings":";;;;;;AAAA,
|
|
1
|
+
{"version":3,"file":"setup.js","sourceRoot":"","sources":["../../src/common/setup.ts"],"names":[],"mappings":";;;;;;AAAA,sEAAsE;AACtE,uDAAqE;AACrE,4DAA+D;AAC/D,4DAAoC;AAGpC,8CAAmE;AACnE,0CAAwD;AACxD,0CAAoF;AACpF,4DAA6D;AAC7D,8CAA2E;AAC3E,kDAA4E;AAE5E,qDAA8D;AAC9D,+DAAiE;AACjE,yDAAiG;AAEjG,MAAM,0BAA0B,GAAG,EAAE,GAAG,IAAI,CAAC;AAE7C,MAAM,kBAAmB,SAAQ,KAAK;CAAG;AAElC,KAAK,UAAU,UAAU,CAAmB,GAAuB;;IACxE,MAAM,WAAW,GAAG,MAAM,GAAG,CAAC,aAAa,CAAC,0BAAU,CAAC,eAAe,EAAE,KAAK,IAAI,EAAE;QACjF,MAAM,IAAA,2CAA0B,EAAC,GAAG,CAAC,CAAC;QACtC,IAAI,GAAG,CAAC,GAAG,CAAC,SAAS,EAAE;YACrB,MAAM,IAAA,mCAA2B,EAAC,GAAG,CAAC,CAAC;SACxC;aAAM;YACL,MAAM,IAAA,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,OAAO,EAAE,GAAG,CAAC,GAAG,CAAC,YAAY,EAAE;aAC1C,CAAC,CAAC;QACL,CAAC,EAAE,0BAA0B,CAAC,CAAC;QAC/B,OAAO,MAAM,OAAO,CAAC;KACtB;IAAC,OAAO,GAAQ,EAAE;QACjB,IAAI,QAAQ,EAAE;YACZ,MAAM,IAAI,kBAAkB,CAAC,sCAAsC,CAAC,CAAC;SACtE;QACD,MAAM,GAAG,CAAC;KACX;YAAS;QACR,IAAI,OAAO,EAAE;YACX,YAAY,CAAC,OAAO,CAAC,CAAC;SACvB;KACF;AACH,CAAC","sourcesContent":["import spawn, { SpawnPromise, SpawnResult } from '@expo/turtle-spawn';\nimport { BuildPhase, Ios, Job, Platform } from '@expo/eas-build-job';\nimport { BuildTrigger } from '@expo/eas-build-job/dist/common';\nimport nullthrows from 'nullthrows';\n\nimport { BuildContext } from '../context';\nimport { deleteXcodeEnvLocalIfExistsAsync } from '../ios/xcodeEnv';\nimport { Hook, runHookIfPresent } from '../utils/hooks';\nimport { createNpmrcIfNotExistsAsync, logIfNpmrcExistsAsync } from '../utils/npmrc';\nimport { isAtLeastNpm7Async } from '../utils/packageManager';\nimport { readPackageJson, shouldUseGlobalExpoCli } from '../utils/project';\nimport { getParentAndDescendantProcessPidsAsync } from '../utils/processes';\n\nimport { prepareProjectSourcesAsync } from './projectSources';\nimport { installDependenciesAsync } from './installDependencies';\nimport { configureEnvFromBuildProfileAsync, runEasBuildInternalAsync } from './easBuildInternal';\n\nconst MAX_EXPO_DOCTOR_TIMEOUT_MS = 30 * 1000;\n\nclass DoctorTimeoutError extends Error {}\n\nexport async function setupAsync<TJob extends Job>(ctx: BuildContext<TJob>): Promise<void> {\n const packageJson = await ctx.runBuildPhase(BuildPhase.PREPARE_PROJECT, async () => {\n await prepareProjectSourcesAsync(ctx);\n if (ctx.env.NPM_TOKEN) {\n await createNpmrcIfNotExistsAsync(ctx);\n } else {\n await logIfNpmrcExistsAsync(ctx);\n }\n if (ctx.job.platform === Platform.IOS && ctx.env.EAS_BUILD_RUNNER === 'eas-build') {\n await deleteXcodeEnvLocalIfExistsAsync(ctx as BuildContext<Ios.Job>);\n }\n 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 await configureEnvFromBuildProfileAsync(ctx);\n }\n // try to read package.json to see if it exists and is valid\n return readPackageJson(ctx.reactNativeProjectDirectory);\n });\n\n await ctx.runBuildPhase(BuildPhase.PRE_INSTALL_HOOK, async () => {\n await runHookIfPresent(ctx, Hook.PRE_INSTALL);\n });\n\n await ctx.runBuildPhase(BuildPhase.READ_PACKAGE_JSON, async () => {\n ctx.logger.info('Using package.json:');\n ctx.logger.info(JSON.stringify(packageJson, null, 2));\n });\n\n await ctx.runBuildPhase(BuildPhase.INSTALL_DEPENDENCIES, async () => {\n await installDependenciesAsync(ctx);\n });\n\n if (ctx.job.triggeredBy === BuildTrigger.GIT_BASED_INTEGRATION) {\n await ctx.runBuildPhase(BuildPhase.EAS_BUILD_INTERNAL, async () => {\n await runEasBuildInternalAsync(ctx);\n });\n }\n\n await ctx.runBuildPhase(BuildPhase.READ_APP_CONFIG, async () => {\n ctx.logger.info('Using app configuration:');\n ctx.logger.info(JSON.stringify(ctx.appConfig, null, 2));\n });\n\n const hasExpoPackage = !!packageJson.dependencies?.expo;\n if (hasExpoPackage) {\n await ctx.runBuildPhase(BuildPhase.RUN_EXPO_DOCTOR, async () => {\n try {\n const { stdout } = await runExpoDoctor(ctx);\n if (!stdout.match(/Didn't find any issues with the project/)) {\n ctx.markBuildPhaseHasWarnings();\n }\n } catch (err) {\n 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 let promise: SpawnPromise<SpawnResult>;\n if (!shouldUseGlobalExpoCli(ctx)) {\n const argsPrefix = isAtLeastNpm7 ? ['-y'] : [];\n promise = spawn('npx', [...argsPrefix, 'expo-doctor'], {\n cwd: ctx.reactNativeProjectDirectory,\n logger: ctx.logger,\n env: ctx.env,\n });\n } else {\n promise = ctx.runGlobalExpoCliCommand(\n ['doctor'],\n {\n cwd: ctx.reactNativeProjectDirectory,\n logger: ctx.logger,\n env: ctx.env,\n },\n isAtLeastNpm7\n );\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"]}
|
|
@@ -19,11 +19,10 @@ function createUploadArtifactStepsFunction(ctx) {
|
|
|
19
19
|
id: 'upload_artifact',
|
|
20
20
|
name: 'Upload artifact',
|
|
21
21
|
inputProviders: [
|
|
22
|
-
// TODO: refactor when BuildStepInput supports "allowedValues" option
|
|
23
|
-
// either "application-archive" or "build-artifact"
|
|
24
22
|
steps_1.BuildStepInput.createProvider({
|
|
25
23
|
id: 'type',
|
|
26
24
|
defaultValue: BuildArtifactType.APPLICATION_ARCHIVE,
|
|
25
|
+
allowedValues: [BuildArtifactType.APPLICATION_ARCHIVE, BuildArtifactType.BUILD_ARTIFACT],
|
|
27
26
|
}),
|
|
28
27
|
steps_1.BuildStepInput.createProvider({ id: 'path', required: true }),
|
|
29
28
|
],
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"uploadArtifact.js","sourceRoot":"","sources":["../../../src/steps/functions/uploadArtifact.ts"],"names":[],"mappings":";;;;;;AAAA,gDAAwB;AAGxB,uCAA4D;AAC5D,4DAAoC;AAEpC,2CAA2D;AAE3D,IAAK,iBAGJ;AAHD,WAAK,iBAAiB;IACpB,gEAA2C,CAAA;IAC3C,sDAAiC,CAAA;AACnC,CAAC,EAHI,iBAAiB,KAAjB,iBAAiB,QAGrB;AAED,SAAgB,iCAAiC,CAC/C,GAAoB;IAEpB,OAAO,IAAI,qBAAa,CAAC;QACvB,SAAS,EAAE,KAAK;QAChB,EAAE,EAAE,iBAAiB;QACrB,IAAI,EAAE,iBAAiB;QACvB,cAAc,EAAE;YACd,
|
|
1
|
+
{"version":3,"file":"uploadArtifact.js","sourceRoot":"","sources":["../../../src/steps/functions/uploadArtifact.ts"],"names":[],"mappings":";;;;;;AAAA,gDAAwB;AAGxB,uCAA4D;AAC5D,4DAAoC;AAEpC,2CAA2D;AAE3D,IAAK,iBAGJ;AAHD,WAAK,iBAAiB;IACpB,gEAA2C,CAAA;IAC3C,sDAAiC,CAAA;AACnC,CAAC,EAHI,iBAAiB,KAAjB,iBAAiB,QAGrB;AAED,SAAgB,iCAAiC,CAC/C,GAAoB;IAEpB,OAAO,IAAI,qBAAa,CAAC;QACvB,SAAS,EAAE,KAAK;QAChB,EAAE,EAAE,iBAAiB;QACrB,IAAI,EAAE,iBAAiB;QACvB,cAAc,EAAE;YACd,sBAAc,CAAC,cAAc,CAAC;gBAC5B,EAAE,EAAE,MAAM;gBACV,YAAY,EAAE,iBAAiB,CAAC,mBAAmB;gBACnD,aAAa,EAAE,CAAC,iBAAiB,CAAC,mBAAmB,EAAE,iBAAiB,CAAC,cAAc,CAAC;aACzF,CAAC;YACF,sBAAc,CAAC,cAAc,CAAC,EAAE,EAAE,EAAE,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;SAC9D;QACD,EAAE,EAAE,KAAK,EAAE,QAAQ,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE;YACjC,MAAM,YAAY,GAAG,mCAAmC,CAAC,IAAA,oBAAU,EAAC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC;YACxF,MAAM,QAAQ,GAAG,cAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,gBAAgB,EAAE,IAAA,oBAAU,EAAC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC;YACxF,MAAM,GAAG,CAAC,eAAe,CAAC,YAAY,EAAE,CAAC,QAAQ,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,CAAC;QACvE,CAAC;KACF,CAAC,CAAC;AACL,CAAC;AArBD,8EAqBC;AAED,SAAS,mCAAmC,CAAC,KAAa;IACxD,MAAM,aAAa,GAAa,MAAM,CAAC,MAAM,CAAC,iBAAiB,CAAC,CAAC;IACjE,IAAI,CAAC,aAAa,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE;QAClC,MAAM,IAAI,KAAK,CACb,IAAI,KAAK,mDAAmD,aAAa;aACtE,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,IAAI,CAAC,GAAG,CAAC;aACpB,IAAI,CAAC,IAAI,CAAC,EAAE,CAChB,CAAC;KACH;IACD,OAAO,KAAK,KAAK,iBAAiB,CAAC,mBAAmB;QACpD,CAAC,CAAC,sBAAY,CAAC,mBAAmB;QAClC,CAAC,CAAC,sBAAY,CAAC,eAAe,CAAC;AACnC,CAAC","sourcesContent":["import path from 'path';\n\nimport { Job } from '@expo/eas-build-job';\nimport { BuildFunction, BuildStepInput } from '@expo/steps';\nimport nullthrows from 'nullthrows';\n\nimport { ArtifactType, BuildContext } from '../../context';\n\nenum BuildArtifactType {\n APPLICATION_ARCHIVE = 'application-archive',\n BUILD_ARTIFACT = 'build-artifact',\n}\n\nexport function createUploadArtifactStepsFunction<T extends Job>(\n ctx: BuildContext<T>\n): BuildFunction {\n return new BuildFunction({\n namespace: 'eas',\n id: 'upload_artifact',\n name: 'Upload artifact',\n inputProviders: [\n BuildStepInput.createProvider({\n id: 'type',\n defaultValue: BuildArtifactType.APPLICATION_ARCHIVE,\n allowedValues: [BuildArtifactType.APPLICATION_ARCHIVE, BuildArtifactType.BUILD_ARTIFACT],\n }),\n BuildStepInput.createProvider({ id: 'path', required: true }),\n ],\n fn: async (stepsCtx, { inputs }) => {\n const artifactType = validateAndConvertBuildArtifactType(nullthrows(inputs.type.value));\n const filePath = path.resolve(stepsCtx.workingDirectory, nullthrows(inputs.path.value));\n await ctx.uploadArtifacts(artifactType, [filePath], stepsCtx.logger);\n },\n });\n}\n\nfunction validateAndConvertBuildArtifactType(input: string): ArtifactType {\n const allowedValues: string[] = Object.values(BuildArtifactType);\n if (!allowedValues.includes(input)) {\n throw new Error(\n `\"${input}\" is not allowed artifact type, allowed values: ${allowedValues\n .map((i) => `\"${i}\"`)\n .join(', ')}`\n );\n }\n return input === BuildArtifactType.APPLICATION_ARCHIVE\n ? ArtifactType.APPLICATION_ARCHIVE\n : ArtifactType.BUILD_ARTIFACTS;\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function getParentAndDescendantProcessPidsAsync(ppid: number): Promise<number[]>;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.getParentAndDescendantProcessPidsAsync = void 0;
|
|
7
|
+
const turtle_spawn_1 = __importDefault(require("@expo/turtle-spawn"));
|
|
8
|
+
async function getChildrenPidsAsync(parentPids) {
|
|
9
|
+
const result = await (0, turtle_spawn_1.default)('pgrep', ['-P', parentPids.join(',')], {
|
|
10
|
+
stdio: 'pipe',
|
|
11
|
+
});
|
|
12
|
+
return result.stdout
|
|
13
|
+
.toString()
|
|
14
|
+
.split('\n')
|
|
15
|
+
.map((i) => Number(i.trim()))
|
|
16
|
+
.filter((i) => i);
|
|
17
|
+
}
|
|
18
|
+
async function getParentAndDescendantProcessPidsAsync(ppid) {
|
|
19
|
+
const children = new Set([ppid]);
|
|
20
|
+
let shouldCheckAgain = true;
|
|
21
|
+
while (shouldCheckAgain) {
|
|
22
|
+
const pids = await getChildrenPidsAsync([...children]);
|
|
23
|
+
shouldCheckAgain = false;
|
|
24
|
+
for (const pid of pids) {
|
|
25
|
+
if (!children.has(pid)) {
|
|
26
|
+
shouldCheckAgain = true;
|
|
27
|
+
children.add(pid);
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
return [...children];
|
|
32
|
+
}
|
|
33
|
+
exports.getParentAndDescendantProcessPidsAsync = getParentAndDescendantProcessPidsAsync;
|
|
34
|
+
//# sourceMappingURL=processes.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"processes.js","sourceRoot":"","sources":["../../src/utils/processes.ts"],"names":[],"mappings":";;;;;;AAAA,sEAAuC;AAEvC,KAAK,UAAU,oBAAoB,CAAC,UAAoB;IACtD,MAAM,MAAM,GAAG,MAAM,IAAA,sBAAK,EAAC,OAAO,EAAE,CAAC,IAAI,EAAE,UAAU,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE;QAChE,KAAK,EAAE,MAAM;KACd,CAAC,CAAC;IACH,OAAO,MAAM,CAAC,MAAM;SACjB,QAAQ,EAAE;SACV,KAAK,CAAC,IAAI,CAAC;SACX,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC;SAC5B,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC;AACtB,CAAC;AAEM,KAAK,UAAU,sCAAsC,CAAC,IAAY;IACvE,MAAM,QAAQ,GAAG,IAAI,GAAG,CAAS,CAAC,IAAI,CAAC,CAAC,CAAC;IACzC,IAAI,gBAAgB,GAAG,IAAI,CAAC;IAC5B,OAAO,gBAAgB,EAAE;QACvB,MAAM,IAAI,GAAG,MAAM,oBAAoB,CAAC,CAAC,GAAG,QAAQ,CAAC,CAAC,CAAC;QACvD,gBAAgB,GAAG,KAAK,CAAC;QACzB,KAAK,MAAM,GAAG,IAAI,IAAI,EAAE;YACtB,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE;gBACtB,gBAAgB,GAAG,IAAI,CAAC;gBACxB,QAAQ,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;aACnB;SACF;KACF;IACD,OAAO,CAAC,GAAG,QAAQ,CAAC,CAAC;AACvB,CAAC;AAdD,wFAcC","sourcesContent":["import spawn from '@expo/turtle-spawn';\n\nasync function getChildrenPidsAsync(parentPids: number[]): Promise<number[]> {\n const result = await spawn('pgrep', ['-P', parentPids.join(',')], {\n stdio: 'pipe',\n });\n return result.stdout\n .toString()\n .split('\\n')\n .map((i) => Number(i.trim()))\n .filter((i) => i);\n}\n\nexport async function getParentAndDescendantProcessPidsAsync(ppid: number): Promise<number[]> {\n const children = new Set<number>([ppid]);\n let shouldCheckAgain = true;\n while (shouldCheckAgain) {\n const pids = await getChildrenPidsAsync([...children]);\n shouldCheckAgain = false;\n for (const pid of pids) {\n if (!children.has(pid)) {\n shouldCheckAgain = true;\n children.add(pid);\n }\n }\n }\n return [...children];\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.4",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"types": "dist/index.d.ts",
|
|
6
6
|
"files": [
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
"@expo/logger": "1.0.0",
|
|
28
28
|
"@expo/package-manager": "^0.0.57",
|
|
29
29
|
"@expo/plist": "^0.0.20",
|
|
30
|
-
"@expo/steps": "1.0.
|
|
30
|
+
"@expo/steps": "1.0.4",
|
|
31
31
|
"@expo/template-file": "1.0.0",
|
|
32
32
|
"@expo/turtle-spawn": "1.0.0",
|
|
33
33
|
"@expo/xcpretty": "^4.2.2",
|
|
@@ -61,5 +61,5 @@
|
|
|
61
61
|
"node": "18.13.0",
|
|
62
62
|
"yarn": "1.22.19"
|
|
63
63
|
},
|
|
64
|
-
"gitHead": "
|
|
64
|
+
"gitHead": "70bc03aa69788a3df0caee2174dfbaf8bc8af5f9"
|
|
65
65
|
}
|