@expo/build-tools 20.5.1 → 21.0.1
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/gradle.d.ts +5 -0
- package/dist/android/gradle.js +13 -33
- package/dist/builders/custom.js +1 -0
- package/dist/common/installDependencies.js +21 -18
- package/dist/context.js +31 -1
- package/dist/customBuildContext.d.ts +2 -1
- package/dist/customBuildContext.js +4 -0
- package/dist/generic.js +1 -0
- package/dist/steps/easFunctions.js +18 -0
- package/dist/steps/functions/capturePosthogEvent.d.ts +2 -0
- package/dist/steps/functions/capturePosthogEvent.js +79 -0
- package/dist/steps/functions/checkout.js +1 -0
- package/dist/steps/functions/createPosthogAnnotation.d.ts +2 -0
- package/dist/steps/functions/createPosthogAnnotation.js +75 -0
- package/dist/steps/functions/finishIosSimulatorRecordings.d.ts +2 -0
- package/dist/steps/functions/finishIosSimulatorRecordings.js +24 -0
- package/dist/steps/functions/installNodeModules.js +1 -0
- package/dist/steps/functions/maestroTests.js +1 -0
- package/dist/steps/functions/rolloutPosthogFlag.d.ts +2 -0
- package/dist/steps/functions/rolloutPosthogFlag.js +208 -0
- package/dist/steps/functions/startAgentDeviceRemoteSession.js +21 -8
- package/dist/steps/functions/startArgentRemoteSession.d.ts +14 -0
- package/dist/steps/functions/startArgentRemoteSession.js +105 -44
- package/dist/steps/functions/startIosSimulatorRecordings.d.ts +2 -0
- package/dist/steps/functions/startIosSimulatorRecordings.js +20 -0
- package/dist/steps/functions/startServeSimRemoteSession.js +7 -5
- package/dist/steps/functions/uploadDeviceRunSessionScreenRecordings.d.ts +3 -0
- package/dist/steps/functions/uploadDeviceRunSessionScreenRecordings.js +91 -0
- package/dist/steps/functions/uploadPosthogSourcemaps.d.ts +2 -0
- package/dist/steps/functions/uploadPosthogSourcemaps.js +83 -0
- package/dist/steps/functions/uploadToAsc.js +1 -0
- package/dist/steps/functions/waitForPosthogMetric.d.ts +2 -0
- package/dist/steps/functions/waitForPosthogMetric.js +135 -0
- package/dist/steps/functions/waitForPosthogQuery.d.ts +2 -0
- package/dist/steps/functions/waitForPosthogQuery.js +95 -0
- package/dist/steps/utils/IosSimulatorRecordingUtils.d.ts +17 -0
- package/dist/steps/utils/IosSimulatorRecordingUtils.js +218 -0
- package/dist/steps/utils/PosthogClient.d.ts +46 -0
- package/dist/steps/utils/PosthogClient.js +156 -0
- package/dist/steps/utils/PosthogUtils.d.ts +41 -0
- package/dist/steps/utils/PosthogUtils.js +65 -0
- package/dist/steps/utils/agentDeviceArtifacts.d.ts +27 -0
- package/dist/steps/utils/agentDeviceArtifacts.js +133 -0
- package/dist/steps/utils/android/gradle.d.ts +5 -0
- package/dist/steps/utils/android/gradle.js +13 -62
- package/dist/steps/utils/argentArtifacts.d.ts +5 -3
- package/dist/steps/utils/argentArtifacts.js +95 -23
- package/dist/steps/utils/deviceRunSessionArtifacts.d.ts +3 -1
- package/dist/steps/utils/deviceRunSessionArtifacts.js +6 -2
- package/dist/steps/utils/remoteDeviceRunSession.d.ts +8 -0
- package/dist/steps/utils/remoteDeviceRunSession.js +62 -1
- package/dist/utils/AndroidEmulatorUtils.js +3 -0
- package/dist/utils/IosSimulatorUtils.d.ts +1 -0
- package/dist/utils/IosSimulatorUtils.js +41 -2
- package/dist/utils/expoUpdatesEmbedded.js +4 -0
- package/dist/utils/hookMetrics.d.ts +8 -0
- package/dist/utils/hookMetrics.js +18 -0
- package/dist/utils/processes.d.ts +1 -0
- package/dist/utils/processes.js +23 -0
- package/package.json +10 -9
- package/resources/record-sim/Package.swift +28 -0
- package/resources/record-sim/README.md +79 -0
- package/resources/record-sim/Sources/RecordSim/FramebufferDisplaySource.swift +192 -0
- package/resources/record-sim/Sources/RecordSim/PrivateSimulatorServices.swift +96 -0
- package/resources/record-sim/Sources/RecordSim/RecordingModels.swift +70 -0
- package/resources/record-sim/Sources/RecordSim/RecordingOutputWriter.swift +136 -0
- package/resources/record-sim/Sources/RecordSim/SimulatorRecorder.swift +632 -0
- package/resources/record-sim/Sources/RecordSim/Utilities.swift +60 -0
- package/resources/record-sim/Sources/record-sim/main.swift +143 -0
package/dist/android/gradle.d.ts
CHANGED
|
@@ -8,4 +8,9 @@ export declare function runGradleCommand(ctx: BuildContext<Job>, { logger, gradl
|
|
|
8
8
|
androidDir: string;
|
|
9
9
|
extraEnv?: Env;
|
|
10
10
|
}): Promise<void>;
|
|
11
|
+
export declare function getGradleShellCommand({ gradleCommand, oomScoreAdj, verboseFlag, }: {
|
|
12
|
+
gradleCommand: string;
|
|
13
|
+
oomScoreAdj?: number;
|
|
14
|
+
verboseFlag: string;
|
|
15
|
+
}): string;
|
|
11
16
|
export declare function resolveGradleCommand(job: Android.Job): string;
|
package/dist/android/gradle.js
CHANGED
|
@@ -5,13 +5,12 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.ensureLFLineEndingsInGradlewScript = ensureLFLineEndingsInGradlewScript;
|
|
7
7
|
exports.runGradleCommand = runGradleCommand;
|
|
8
|
+
exports.getGradleShellCommand = getGradleShellCommand;
|
|
8
9
|
exports.resolveGradleCommand = resolveGradleCommand;
|
|
9
10
|
const eas_build_job_1 = require("@expo/eas-build-job");
|
|
10
11
|
const turtle_spawn_1 = __importDefault(require("@expo/turtle-spawn"));
|
|
11
|
-
const assert_1 = __importDefault(require("assert"));
|
|
12
12
|
const fs_extra_1 = __importDefault(require("fs-extra"));
|
|
13
13
|
const path_1 = __importDefault(require("path"));
|
|
14
|
-
const processes_1 = require("../utils/processes");
|
|
15
14
|
async function ensureLFLineEndingsInGradlewScript(ctx) {
|
|
16
15
|
const gradlewPath = path_1.default.join(ctx.getReactNativeProjectDirectory(), 'android', 'gradlew');
|
|
17
16
|
const gradlewContent = await fs_extra_1.default.readFile(gradlewPath, 'utf8');
|
|
@@ -24,7 +23,15 @@ async function runGradleCommand(ctx, { logger, gradleCommand, androidDir, extraE
|
|
|
24
23
|
logger.info(`Running 'gradlew ${gradleCommand}' in ${androidDir}`);
|
|
25
24
|
await fs_extra_1.default.chmod(path_1.default.join(androidDir, 'gradlew'), 0o755);
|
|
26
25
|
const verboseFlag = ctx.env['EAS_VERBOSE'] === '1' ? '--info' : '';
|
|
27
|
-
const
|
|
26
|
+
const shouldResetOOMScore = ctx.env.EAS_BUILD_RUNNER === 'eas-build' && process.platform === 'linux';
|
|
27
|
+
await (0, turtle_spawn_1.default)('bash', [
|
|
28
|
+
'-c',
|
|
29
|
+
getGradleShellCommand({
|
|
30
|
+
gradleCommand,
|
|
31
|
+
oomScoreAdj: shouldResetOOMScore ? 0 : undefined,
|
|
32
|
+
verboseFlag,
|
|
33
|
+
}),
|
|
34
|
+
], {
|
|
28
35
|
cwd: androidDir,
|
|
29
36
|
logger,
|
|
30
37
|
lineTransformer: (line) => {
|
|
@@ -42,37 +49,10 @@ async function runGradleCommand(ctx, { logger, gradleCommand, androidDir, extraE
|
|
|
42
49
|
LC_ALL: 'C.UTF-8',
|
|
43
50
|
},
|
|
44
51
|
});
|
|
45
|
-
if (ctx.env.EAS_BUILD_RUNNER === 'eas-build' && process.platform === 'linux') {
|
|
46
|
-
adjustOOMScore(spawnPromise, logger);
|
|
47
|
-
}
|
|
48
|
-
await spawnPromise;
|
|
49
52
|
}
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
* It defines which process is more likely to get killed (higher value more likely).
|
|
54
|
-
*
|
|
55
|
-
* This function sets oom_score_adj for Gradle process and all its child processes.
|
|
56
|
-
*/
|
|
57
|
-
function adjustOOMScore(spawnPromise, logger) {
|
|
58
|
-
setTimeout(async () => {
|
|
59
|
-
try {
|
|
60
|
-
(0, assert_1.default)(spawnPromise.child.pid);
|
|
61
|
-
const pids = await (0, processes_1.getParentAndDescendantProcessPidsAsync)(spawnPromise.child.pid);
|
|
62
|
-
await Promise.all(pids.map(async (pid) => {
|
|
63
|
-
// Value 800 is just a guess here. It's probably higher than most other
|
|
64
|
-
// process. I didn't want to set it any higher, because I'm not sure if OOM Killer
|
|
65
|
-
// can start killing processes when there is still enough memory left.
|
|
66
|
-
const oomScoreOverride = 800;
|
|
67
|
-
await fs_extra_1.default.writeFile(`/proc/${pid}/oom_score_adj`, `${oomScoreOverride}\n`);
|
|
68
|
-
}));
|
|
69
|
-
}
|
|
70
|
-
catch (err) {
|
|
71
|
-
logger.debug({ err, stderr: err?.stderr }, 'Failed to override oom_score_adj');
|
|
72
|
-
}
|
|
73
|
-
},
|
|
74
|
-
// Wait 20 seconds to make sure all child processes are started
|
|
75
|
-
20000);
|
|
53
|
+
function getGradleShellCommand({ gradleCommand, oomScoreAdj, verboseFlag, }) {
|
|
54
|
+
const oomScoreAdjPrefix = oomScoreAdj === undefined ? '' : `echo ${oomScoreAdj} > /proc/$$/oom_score_adj || true; `;
|
|
55
|
+
return `${oomScoreAdjPrefix}exec ./gradlew ${gradleCommand} --profile ${verboseFlag}`;
|
|
76
56
|
}
|
|
77
57
|
// Version envs should be set at the beginning of the build, but when building
|
|
78
58
|
// from github those values are resolved later.
|
package/dist/builders/custom.js
CHANGED
|
@@ -49,6 +49,7 @@ async function runCustomBuildAsync(ctx) {
|
|
|
49
49
|
externalFunctions: easFunctions,
|
|
50
50
|
externalFunctionGroups: easFunctionGroups,
|
|
51
51
|
steps: ctx.job.steps,
|
|
52
|
+
hooks: ctx.job.hooks,
|
|
52
53
|
})
|
|
53
54
|
: new steps_1.BuildConfigParser(globalContext, {
|
|
54
55
|
externalFunctions: easFunctions,
|
|
@@ -69,17 +69,29 @@ async function installDependenciesAsync({ packageManager, env, logger, infoCallb
|
|
|
69
69
|
};
|
|
70
70
|
}
|
|
71
71
|
async function installDependenciesWithNpmCacheFallbackAsync({ packageManager, env, logger, infoCallbackFn, cwd, useFrozenLockfile, }) {
|
|
72
|
-
const npmCacheUrl = env.
|
|
72
|
+
const npmCacheUrl = env.EAS_BUILD_NPM_CACHE_URL;
|
|
73
|
+
if (!npmCacheUrl) {
|
|
74
|
+
await (await installDependenciesAsync({
|
|
75
|
+
packageManager,
|
|
76
|
+
env,
|
|
77
|
+
logger,
|
|
78
|
+
infoCallbackFn,
|
|
79
|
+
cwd,
|
|
80
|
+
useFrozenLockfile,
|
|
81
|
+
})).spawnPromise;
|
|
82
|
+
return;
|
|
83
|
+
}
|
|
84
|
+
logger.info(`Installing dependencies using the npm cache registry (${npmCacheUrl}).`);
|
|
73
85
|
let firstErrorLine;
|
|
74
86
|
let errorLineCount = 0;
|
|
75
87
|
try {
|
|
76
88
|
await (await installDependenciesAsync({
|
|
77
89
|
packageManager,
|
|
78
|
-
env,
|
|
90
|
+
env: { ...env, NPM_CONFIG_REGISTRY: npmCacheUrl },
|
|
79
91
|
logger,
|
|
80
92
|
infoCallbackFn,
|
|
81
93
|
lineTransformer: (line) => {
|
|
82
|
-
if (isNpmCacheRegistryErrorLine(line,
|
|
94
|
+
if (isNpmCacheRegistryErrorLine(line, npmCacheUrl)) {
|
|
83
95
|
firstErrorLine ??= line;
|
|
84
96
|
errorLineCount += 1;
|
|
85
97
|
}
|
|
@@ -97,7 +109,7 @@ async function installDependenciesWithNpmCacheFallbackAsync({ packageManager, en
|
|
|
97
109
|
}
|
|
98
110
|
}
|
|
99
111
|
catch (err) {
|
|
100
|
-
if (!isNpmCacheInstallFailure(err,
|
|
112
|
+
if (!isNpmCacheInstallFailure(err, npmCacheUrl)) {
|
|
101
113
|
throw err;
|
|
102
114
|
}
|
|
103
115
|
logger.warn(`Failed to install dependencies using the npm cache registry (${npmCacheUrl}). Retrying without the npm cache registry.`);
|
|
@@ -113,10 +125,9 @@ async function installDependenciesWithNpmCacheFallbackAsync({ packageManager, en
|
|
|
113
125
|
signal: err instanceof Error ? err.signal : undefined,
|
|
114
126
|
},
|
|
115
127
|
});
|
|
116
|
-
const { NPM_CONFIG_REGISTRY: _NPM_CONFIG_REGISTRY, ...fallbackEnv } = env;
|
|
117
128
|
await (await installDependenciesAsync({
|
|
118
129
|
packageManager,
|
|
119
|
-
env
|
|
130
|
+
env,
|
|
120
131
|
logger,
|
|
121
132
|
infoCallbackFn,
|
|
122
133
|
cwd,
|
|
@@ -132,21 +143,13 @@ function resolvePackagerDir(ctx) {
|
|
|
132
143
|
}
|
|
133
144
|
return packagerRunDir;
|
|
134
145
|
}
|
|
135
|
-
function isNpmCacheInstallFailure(err,
|
|
136
|
-
|
|
137
|
-
return false;
|
|
138
|
-
}
|
|
139
|
-
const errorOutput = getErrorOutput(err);
|
|
140
|
-
return errorOutput.includes(npmCacheUrl);
|
|
146
|
+
function isNpmCacheInstallFailure(err, npmCacheUrl) {
|
|
147
|
+
return getErrorOutput(err).includes(npmCacheUrl);
|
|
141
148
|
}
|
|
142
|
-
function isNpmCacheRegistryErrorLine(line,
|
|
143
|
-
return (
|
|
144
|
-
line.includes(npmCacheUrl) &&
|
|
149
|
+
function isNpmCacheRegistryErrorLine(line, npmCacheUrl) {
|
|
150
|
+
return (line.includes(npmCacheUrl) &&
|
|
145
151
|
/(?:error|failed|ENOTFOUND|ECONN|ETIMEDOUT|EAI_AGAIN|FetchError)/i.test(line));
|
|
146
152
|
}
|
|
147
|
-
function isNpmCacheRegistryEnabled(env, npmCacheUrl) {
|
|
148
|
-
return env.EAS_USE_NPM_CACHE === '1' && !!npmCacheUrl;
|
|
149
|
-
}
|
|
150
153
|
function getErrorOutput(err) {
|
|
151
154
|
if (!(err instanceof Error)) {
|
|
152
155
|
return '';
|
package/dist/context.js
CHANGED
|
@@ -17,6 +17,26 @@ const packageManager_1 = require("./utils/packageManager");
|
|
|
17
17
|
class SkipNativeBuildError extends Error {
|
|
18
18
|
}
|
|
19
19
|
exports.SkipNativeBuildError = SkipNativeBuildError;
|
|
20
|
+
function logEnvComparison({ oldMergeOrderEnv, newMergeOrderEnv, }) {
|
|
21
|
+
const envNames = new Set([...Object.keys(oldMergeOrderEnv), ...Object.keys(newMergeOrderEnv)]);
|
|
22
|
+
const sameEnvNames = [];
|
|
23
|
+
const differentEnvNames = [];
|
|
24
|
+
for (const key of envNames) {
|
|
25
|
+
const hasOldValue = key in oldMergeOrderEnv;
|
|
26
|
+
const hasNewValue = key in newMergeOrderEnv;
|
|
27
|
+
if (hasOldValue === hasNewValue && oldMergeOrderEnv[key] === newMergeOrderEnv[key]) {
|
|
28
|
+
sameEnvNames.push(key);
|
|
29
|
+
}
|
|
30
|
+
else {
|
|
31
|
+
differentEnvNames.push(key);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
if (differentEnvNames.length === 0) {
|
|
35
|
+
datadog_1.Datadog.log('BuildContext.updateEnv merge order produced same env');
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
38
|
+
datadog_1.Datadog.log(`BuildContext.updateEnv merge order produced different env: compared_env_count=${envNames.size} different_env_count=${differentEnvNames.length} different_env_names=${differentEnvNames.join(',')} same_env_count=${sameEnvNames.length} same_env_names=${sameEnvNames.join(',')}`);
|
|
39
|
+
}
|
|
20
40
|
class BuildContext {
|
|
21
41
|
workingdir;
|
|
22
42
|
logger;
|
|
@@ -157,11 +177,21 @@ class BuildContext {
|
|
|
157
177
|
if (this._job.triggeredBy !== common_1.BuildTrigger.GIT_BASED_INTEGRATION) {
|
|
158
178
|
throw new Error('Updating environment variables is only allowed when build was triggered by a git-based integration.');
|
|
159
179
|
}
|
|
160
|
-
|
|
180
|
+
const oldMergeOrderEnv = {
|
|
161
181
|
...env,
|
|
162
182
|
...this._env,
|
|
163
183
|
__EAS_BUILD_ENVS_DIR: this.buildEnvsDirectory,
|
|
164
184
|
};
|
|
185
|
+
const newMergeOrderEnv = {
|
|
186
|
+
...this._env,
|
|
187
|
+
...env,
|
|
188
|
+
__EAS_BUILD_ENVS_DIR: this.buildEnvsDirectory,
|
|
189
|
+
};
|
|
190
|
+
logEnvComparison({
|
|
191
|
+
oldMergeOrderEnv,
|
|
192
|
+
newMergeOrderEnv,
|
|
193
|
+
});
|
|
194
|
+
this._env = newMergeOrderEnv;
|
|
165
195
|
this._env.PATH = this._env.PATH
|
|
166
196
|
? [this.buildExecutablesDirectory, this._env.PATH].join(':')
|
|
167
197
|
: this.buildExecutablesDirectory;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { BuildJob, Env, Job, Metadata, StaticJobInterpolationContext } from '@expo/eas-build-job';
|
|
2
2
|
import { bunyan } from '@expo/logger';
|
|
3
|
-
import { BuildRuntimePlatform, ExternalBuildContextProvider, StepMetric } from '@expo/steps';
|
|
3
|
+
import { BuildRuntimePlatform, ExternalBuildContextProvider, StepMetric, WorkflowHookMetric } from '@expo/steps';
|
|
4
4
|
import { Client } from '@urql/core';
|
|
5
5
|
import { ArtifactToUpload, BuildContext } from './context';
|
|
6
6
|
export interface BuilderRuntimeApi {
|
|
@@ -36,5 +36,6 @@ export declare class CustomBuildContext<TJob extends Job = Job> implements Exter
|
|
|
36
36
|
updateEnv(env: Env): void;
|
|
37
37
|
updateJobInformation(job: TJob, metadata: Metadata): void;
|
|
38
38
|
reportStepMetric(metric: StepMetric): void;
|
|
39
|
+
reportWorkflowHookMetric(metric: WorkflowHookMetric): void;
|
|
39
40
|
drainPendingMetricUploads(): Promise<void>;
|
|
40
41
|
}
|
|
@@ -8,6 +8,7 @@ const eas_build_job_1 = require("@expo/eas-build-job");
|
|
|
8
8
|
const steps_1 = require("@expo/steps");
|
|
9
9
|
const assert_1 = __importDefault(require("assert"));
|
|
10
10
|
const path_1 = __importDefault(require("path"));
|
|
11
|
+
const hookMetrics_1 = require("./utils/hookMetrics");
|
|
11
12
|
const stepMetrics_1 = require("./utils/stepMetrics");
|
|
12
13
|
const platformToBuildRuntimePlatform = {
|
|
13
14
|
[eas_build_job_1.Platform.ANDROID]: steps_1.BuildRuntimePlatform.LINUX,
|
|
@@ -125,6 +126,9 @@ class CustomBuildContext {
|
|
|
125
126
|
});
|
|
126
127
|
this.pendingMetricUploads.push(p);
|
|
127
128
|
}
|
|
129
|
+
reportWorkflowHookMetric(metric) {
|
|
130
|
+
(0, hookMetrics_1.reportWorkflowHookMetricToDatadog)(metric);
|
|
131
|
+
}
|
|
128
132
|
async drainPendingMetricUploads() {
|
|
129
133
|
await Promise.allSettled(this.pendingMetricUploads);
|
|
130
134
|
}
|
package/dist/generic.js
CHANGED
|
@@ -37,6 +37,7 @@ async function runGenericJobAsync(ctx) {
|
|
|
37
37
|
externalFunctions: (0, easFunctions_1.getEasFunctions)(customBuildCtx),
|
|
38
38
|
externalFunctionGroups: (0, easFunctionGroups_1.getEasFunctionGroups)(customBuildCtx),
|
|
39
39
|
steps: ctx.job.steps,
|
|
40
|
+
hooks: ctx.job.hooks,
|
|
40
41
|
});
|
|
41
42
|
const workflow = await ctx.runBuildPhase(eas_build_job_1.BuildPhase.PARSE_CUSTOM_WORKFLOW_CONFIG, async () => {
|
|
42
43
|
try {
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.getEasFunctions = getEasFunctions;
|
|
4
4
|
const calculateEASUpdateRuntimeVersion_1 = require("./functions/calculateEASUpdateRuntimeVersion");
|
|
5
|
+
const capturePosthogEvent_1 = require("./functions/capturePosthogEvent");
|
|
5
6
|
const checkout_1 = require("./functions/checkout");
|
|
6
7
|
const configureAndroidVersion_1 = require("./functions/configureAndroidVersion");
|
|
7
8
|
const configureEASUpdateIfInstalled_1 = require("./functions/configureEASUpdateIfInstalled");
|
|
@@ -14,6 +15,7 @@ const deploy_1 = require("./functions/deploy");
|
|
|
14
15
|
const export_1 = require("./functions/export");
|
|
15
16
|
const eagerBundle_1 = require("./functions/eagerBundle");
|
|
16
17
|
const findAndUploadBuildArtifacts_1 = require("./functions/findAndUploadBuildArtifacts");
|
|
18
|
+
const finishIosSimulatorRecordings_1 = require("./functions/finishIosSimulatorRecordings");
|
|
17
19
|
const generateGymfileFromTemplate_1 = require("./functions/generateGymfileFromTemplate");
|
|
18
20
|
const getCredentialsForBuildTriggeredByGitHubIntegration_1 = require("./functions/getCredentialsForBuildTriggeredByGitHubIntegration");
|
|
19
21
|
const injectAndroidCredentials_1 = require("./functions/injectAndroidCredentials");
|
|
@@ -35,6 +37,7 @@ const runFastlane_1 = require("./functions/runFastlane");
|
|
|
35
37
|
const runGradle_1 = require("./functions/runGradle");
|
|
36
38
|
const maestroTests_1 = require("./functions/maestroTests");
|
|
37
39
|
const saveBuildCache_1 = require("./functions/saveBuildCache");
|
|
40
|
+
const rolloutPosthogFlag_1 = require("./functions/rolloutPosthogFlag");
|
|
38
41
|
const saveCache_1 = require("./functions/saveCache");
|
|
39
42
|
const sendSlackMessage_1 = require("./functions/sendSlackMessage");
|
|
40
43
|
const startAgentDeviceRemoteSession_1 = require("./functions/startAgentDeviceRemoteSession");
|
|
@@ -42,10 +45,16 @@ const startAndroidEmulator_1 = require("./functions/startAndroidEmulator");
|
|
|
42
45
|
const startArgentRemoteSession_1 = require("./functions/startArgentRemoteSession");
|
|
43
46
|
const startCuttlefishDevice_1 = require("./functions/startCuttlefishDevice");
|
|
44
47
|
const startIosSimulator_1 = require("./functions/startIosSimulator");
|
|
48
|
+
const startIosSimulatorRecordings_1 = require("./functions/startIosSimulatorRecordings");
|
|
45
49
|
const startServeSimRemoteSession_1 = require("./functions/startServeSimRemoteSession");
|
|
46
50
|
const uploadArtifact_1 = require("./functions/uploadArtifact");
|
|
51
|
+
const uploadDeviceRunSessionScreenRecordings_1 = require("./functions/uploadDeviceRunSessionScreenRecordings");
|
|
47
52
|
const uploadToAsc_1 = require("./functions/uploadToAsc");
|
|
48
53
|
const useNpmToken_1 = require("./functions/useNpmToken");
|
|
54
|
+
const waitForPosthogMetric_1 = require("./functions/waitForPosthogMetric");
|
|
55
|
+
const uploadPosthogSourcemaps_1 = require("./functions/uploadPosthogSourcemaps");
|
|
56
|
+
const createPosthogAnnotation_1 = require("./functions/createPosthogAnnotation");
|
|
57
|
+
const waitForPosthogQuery_1 = require("./functions/waitForPosthogQuery");
|
|
49
58
|
function getEasFunctions(ctx) {
|
|
50
59
|
const functions = [
|
|
51
60
|
(0, checkout_1.createCheckoutBuildFunction)(),
|
|
@@ -82,10 +91,19 @@ function getEasFunctions(ctx) {
|
|
|
82
91
|
(0, startAndroidEmulator_1.createStartAndroidEmulatorBuildFunction)(),
|
|
83
92
|
(0, startCuttlefishDevice_1.createStartCuttlefishDeviceBuildFunction)(),
|
|
84
93
|
(0, startIosSimulator_1.createStartIosSimulatorBuildFunction)(),
|
|
94
|
+
(0, startIosSimulatorRecordings_1.createStartIosSimulatorRecordingsBuildFunction)(),
|
|
95
|
+
(0, finishIosSimulatorRecordings_1.createFinishIosSimulatorRecordingsBuildFunction)(),
|
|
96
|
+
(0, uploadDeviceRunSessionScreenRecordings_1.createUploadDeviceRunSessionScreenRecordingsBuildFunction)(ctx),
|
|
85
97
|
(0, startServeSimRemoteSession_1.createStartServeSimRemoteSessionBuildFunction)(ctx),
|
|
86
98
|
(0, installMaestro_1.createInstallMaestroBuildFunction)(),
|
|
87
99
|
(0, installPods_1.createInstallPodsBuildFunction)(),
|
|
88
100
|
(0, sendSlackMessage_1.createSendSlackMessageFunction)(),
|
|
101
|
+
(0, capturePosthogEvent_1.createCapturePosthogEventFunction)(),
|
|
102
|
+
(0, rolloutPosthogFlag_1.createRolloutPosthogFlagFunction)(),
|
|
103
|
+
(0, waitForPosthogMetric_1.createWaitForPosthogMetricFunction)(),
|
|
104
|
+
(0, uploadPosthogSourcemaps_1.createUploadPosthogSourcemapsFunction)(),
|
|
105
|
+
(0, createPosthogAnnotation_1.createPosthogAnnotationFunction)(),
|
|
106
|
+
(0, waitForPosthogQuery_1.createWaitForPosthogQueryFunction)(),
|
|
89
107
|
(0, calculateEASUpdateRuntimeVersion_1.calculateEASUpdateRuntimeVersionFunction)(),
|
|
90
108
|
(0, createSubmissionEntity_1.createSubmissionEntityFunction)(),
|
|
91
109
|
(0, uploadToAsc_1.createUploadToAscBuildFunction)(),
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createCapturePosthogEventFunction = createCapturePosthogEventFunction;
|
|
4
|
+
const eas_build_job_1 = require("@expo/eas-build-job");
|
|
5
|
+
const steps_1 = require("@expo/steps");
|
|
6
|
+
const PosthogClient_1 = require("../utils/PosthogClient");
|
|
7
|
+
const PosthogUtils_1 = require("../utils/PosthogUtils");
|
|
8
|
+
function createCapturePosthogEventFunction() {
|
|
9
|
+
return new steps_1.BuildFunction({
|
|
10
|
+
namespace: 'eas',
|
|
11
|
+
id: 'posthog_capture_event',
|
|
12
|
+
name: 'Capture PostHog event',
|
|
13
|
+
__metricsId: 'eas/posthog_capture_event',
|
|
14
|
+
inputProviders: [
|
|
15
|
+
steps_1.BuildStepInput.createProvider({
|
|
16
|
+
id: 'event',
|
|
17
|
+
allowedValueTypeName: steps_1.BuildStepInputValueTypeName.STRING,
|
|
18
|
+
required: true,
|
|
19
|
+
}),
|
|
20
|
+
steps_1.BuildStepInput.createProvider({
|
|
21
|
+
id: 'distinct_id',
|
|
22
|
+
allowedValueTypeName: steps_1.BuildStepInputValueTypeName.STRING,
|
|
23
|
+
required: false,
|
|
24
|
+
}),
|
|
25
|
+
steps_1.BuildStepInput.createProvider({
|
|
26
|
+
id: 'properties',
|
|
27
|
+
allowedValueTypeName: steps_1.BuildStepInputValueTypeName.JSON,
|
|
28
|
+
required: false,
|
|
29
|
+
}),
|
|
30
|
+
steps_1.BuildStepInput.createProvider({
|
|
31
|
+
id: 'api_key',
|
|
32
|
+
allowedValueTypeName: steps_1.BuildStepInputValueTypeName.STRING,
|
|
33
|
+
required: false,
|
|
34
|
+
}),
|
|
35
|
+
steps_1.BuildStepInput.createProvider({
|
|
36
|
+
id: 'host',
|
|
37
|
+
allowedValueTypeName: steps_1.BuildStepInputValueTypeName.STRING,
|
|
38
|
+
required: false,
|
|
39
|
+
}),
|
|
40
|
+
steps_1.BuildStepInput.createProvider({
|
|
41
|
+
id: 'ignore_error',
|
|
42
|
+
allowedValueTypeName: steps_1.BuildStepInputValueTypeName.BOOLEAN,
|
|
43
|
+
required: false,
|
|
44
|
+
}),
|
|
45
|
+
],
|
|
46
|
+
fn: async (stepCtx, { inputs, env, signal }) => {
|
|
47
|
+
const { logger } = stepCtx;
|
|
48
|
+
const ignoreError = Boolean(inputs.ignore_error.value);
|
|
49
|
+
const event = inputs.event.value;
|
|
50
|
+
const client = PosthogClient_1.PosthogClient.forIngestion({
|
|
51
|
+
apiKeyOverride: inputs.api_key.value,
|
|
52
|
+
hostOverride: inputs.host.value,
|
|
53
|
+
env,
|
|
54
|
+
});
|
|
55
|
+
if (!client) {
|
|
56
|
+
PosthogUtils_1.PosthogUtils.failOrLogError({
|
|
57
|
+
logger,
|
|
58
|
+
ignoreError,
|
|
59
|
+
error: new eas_build_job_1.UserError('EAS_POSTHOG_MISSING_API_KEY', 'PostHog API key not provided. Set the "api_key" input or the EXPO_PUBLIC_POSTHOG_API_KEY environment variable.'),
|
|
60
|
+
});
|
|
61
|
+
return;
|
|
62
|
+
}
|
|
63
|
+
logger.info(`Sending PostHog event "${event}"`);
|
|
64
|
+
try {
|
|
65
|
+
await client.captureEventAsync({
|
|
66
|
+
event,
|
|
67
|
+
distinctId: inputs.distinct_id.value,
|
|
68
|
+
properties: inputs.properties.value,
|
|
69
|
+
signal,
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
catch (error) {
|
|
73
|
+
PosthogUtils_1.PosthogUtils.failOrLogError({ logger, ignoreError, error });
|
|
74
|
+
return;
|
|
75
|
+
}
|
|
76
|
+
logger.info(`Sent PostHog event "${event}"`);
|
|
77
|
+
},
|
|
78
|
+
});
|
|
79
|
+
}
|
|
@@ -12,6 +12,7 @@ function createCheckoutBuildFunction() {
|
|
|
12
12
|
id: 'checkout',
|
|
13
13
|
name: 'Checkout',
|
|
14
14
|
__metricsId: 'eas/checkout',
|
|
15
|
+
__hookId: 'checkout',
|
|
15
16
|
fn: async (stepsCtx) => {
|
|
16
17
|
if (stepsCtx.global.wasCheckedOut()) {
|
|
17
18
|
stepsCtx.logger.info('Project directory is already checked out');
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createPosthogAnnotationFunction = createPosthogAnnotationFunction;
|
|
4
|
+
const steps_1 = require("@expo/steps");
|
|
5
|
+
const PosthogClient_1 = require("../utils/PosthogClient");
|
|
6
|
+
const PosthogUtils_1 = require("../utils/PosthogUtils");
|
|
7
|
+
function createPosthogAnnotationFunction() {
|
|
8
|
+
return new steps_1.BuildFunction({
|
|
9
|
+
namespace: 'eas',
|
|
10
|
+
id: 'posthog_annotation',
|
|
11
|
+
name: 'Create a PostHog annotation',
|
|
12
|
+
__metricsId: 'eas/posthog_annotation',
|
|
13
|
+
inputProviders: [
|
|
14
|
+
steps_1.BuildStepInput.createProvider({
|
|
15
|
+
id: 'content',
|
|
16
|
+
allowedValueTypeName: steps_1.BuildStepInputValueTypeName.STRING,
|
|
17
|
+
required: true,
|
|
18
|
+
}),
|
|
19
|
+
steps_1.BuildStepInput.createProvider({
|
|
20
|
+
id: 'date_marker',
|
|
21
|
+
allowedValueTypeName: steps_1.BuildStepInputValueTypeName.STRING,
|
|
22
|
+
required: false,
|
|
23
|
+
}),
|
|
24
|
+
steps_1.BuildStepInput.createProvider({
|
|
25
|
+
id: 'api_key',
|
|
26
|
+
allowedValueTypeName: steps_1.BuildStepInputValueTypeName.STRING,
|
|
27
|
+
required: false,
|
|
28
|
+
}),
|
|
29
|
+
steps_1.BuildStepInput.createProvider({
|
|
30
|
+
id: 'project_id',
|
|
31
|
+
allowedValueTypeName: steps_1.BuildStepInputValueTypeName.STRING,
|
|
32
|
+
required: false,
|
|
33
|
+
}),
|
|
34
|
+
steps_1.BuildStepInput.createProvider({
|
|
35
|
+
id: 'ignore_error',
|
|
36
|
+
allowedValueTypeName: steps_1.BuildStepInputValueTypeName.BOOLEAN,
|
|
37
|
+
required: false,
|
|
38
|
+
}),
|
|
39
|
+
],
|
|
40
|
+
fn: async (stepCtx, { inputs, env, signal }) => {
|
|
41
|
+
const { logger } = stepCtx;
|
|
42
|
+
const ignoreError = Boolean(inputs.ignore_error.value);
|
|
43
|
+
const result = PosthogClient_1.PosthogClient.fromEnv({
|
|
44
|
+
apiKeyOverride: inputs.api_key.value,
|
|
45
|
+
projectIdOverride: inputs.project_id.value,
|
|
46
|
+
env,
|
|
47
|
+
});
|
|
48
|
+
if (!result.client) {
|
|
49
|
+
PosthogUtils_1.PosthogUtils.failOrLogError({
|
|
50
|
+
logger,
|
|
51
|
+
ignoreError,
|
|
52
|
+
error: PosthogUtils_1.PosthogUtils.missingCredentialsError(result.missing),
|
|
53
|
+
});
|
|
54
|
+
return;
|
|
55
|
+
}
|
|
56
|
+
const client = result.client;
|
|
57
|
+
const content = inputs.content.value;
|
|
58
|
+
const dateMarker = inputs.date_marker.value ?? new Date().toISOString();
|
|
59
|
+
logger.info(`Creating PostHog annotation "${content}"`);
|
|
60
|
+
try {
|
|
61
|
+
await client.requestAsync('POST', '/annotations/', {
|
|
62
|
+
action: 'Creating the PostHog annotation',
|
|
63
|
+
forbiddenScope: 'annotation:write',
|
|
64
|
+
body: { content, date_marker: dateMarker },
|
|
65
|
+
signal,
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
catch (error) {
|
|
69
|
+
PosthogUtils_1.PosthogUtils.failOrLogError({ logger, ignoreError, error });
|
|
70
|
+
return;
|
|
71
|
+
}
|
|
72
|
+
logger.info('Created PostHog annotation');
|
|
73
|
+
},
|
|
74
|
+
});
|
|
75
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createFinishIosSimulatorRecordingsBuildFunction = createFinishIosSimulatorRecordingsBuildFunction;
|
|
4
|
+
const steps_1 = require("@expo/steps");
|
|
5
|
+
const IosSimulatorRecordingUtils_1 = require("../utils/IosSimulatorRecordingUtils");
|
|
6
|
+
function createFinishIosSimulatorRecordingsBuildFunction() {
|
|
7
|
+
return new steps_1.BuildFunction({
|
|
8
|
+
namespace: 'eas',
|
|
9
|
+
id: 'finish_ios_simulator_recordings',
|
|
10
|
+
name: 'Finish iOS Simulator recordings',
|
|
11
|
+
__metricsId: 'eas/finish_ios_simulator_recordings',
|
|
12
|
+
supportedRuntimePlatforms: [steps_1.BuildRuntimePlatform.DARWIN],
|
|
13
|
+
outputProviders: [
|
|
14
|
+
steps_1.BuildStepOutput.createProvider({
|
|
15
|
+
id: 'recordings_json',
|
|
16
|
+
required: true,
|
|
17
|
+
}),
|
|
18
|
+
],
|
|
19
|
+
fn: async ({ logger }, { outputs }) => {
|
|
20
|
+
const recordings = await IosSimulatorRecordingUtils_1.IosSimulatorRecordingUtils.finishAsync({ logger });
|
|
21
|
+
outputs.recordings_json.set(JSON.stringify(recordings));
|
|
22
|
+
},
|
|
23
|
+
});
|
|
24
|
+
}
|
|
@@ -16,6 +16,7 @@ function createInstallNodeModulesBuildFunction() {
|
|
|
16
16
|
id: 'install_node_modules',
|
|
17
17
|
name: 'Install node modules',
|
|
18
18
|
__metricsId: 'eas/install_node_modules',
|
|
19
|
+
__hookId: 'install_node_modules',
|
|
19
20
|
fn: async (stepCtx, { env }) => {
|
|
20
21
|
await installNodeModules(stepCtx, env);
|
|
21
22
|
},
|