stim 1.18.0 → 1.20.0

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.
Files changed (178) hide show
  1. package/README.md +21 -4
  2. package/dist/{activity-BxnkDZDi.mjs → activity-BrGh9EAI.mjs} +3 -3
  3. package/dist/{agent-device-usage-output-CZ66YA4T.mjs → agent-device-usage-output-DVyv_hWj.mjs} +7 -7
  4. package/dist/android-0vv-OruW.mjs +6 -0
  5. package/dist/android-Brx6EKvJ.mjs +1258 -0
  6. package/dist/{android-DC3ZLuw0.mjs → android-BsYNR81W.mjs} +103 -45
  7. package/dist/{android-CBwCNicO.mjs → android-CK3fpEyZ.mjs} +2 -2
  8. package/dist/{android-cas-BBFyr9CA.mjs → android-cas-DCAuXryb.mjs} +9 -5
  9. package/dist/android-cas-compiler.mjs +1 -1
  10. package/dist/api-run.mjs +159 -8
  11. package/dist/{api-D0VtFhqk.mjs → api-zuX3ynYN.mjs} +9 -7
  12. package/dist/api.d.mts +104 -4
  13. package/dist/api.mjs +1 -1
  14. package/dist/{app-install-D-PUENug.mjs → app-install-0LgaQRT7.mjs} +39 -18
  15. package/dist/artifact-CnC0mfov.mjs +807 -0
  16. package/dist/artifact-DClXJNWx.mjs +772 -0
  17. package/dist/artifact-lifecycle-DzPpBYvK.mjs +30 -0
  18. package/dist/{web-DTU0uiWj.mjs → browser-web-CzBmhmgs.mjs} +136 -174
  19. package/dist/{budget-DIhL2BKx.mjs → budget-BONq9vXY.mjs} +3096 -3244
  20. package/dist/build-BixRI6sB.mjs +462 -0
  21. package/dist/build-plan-CP0tckNU.mjs +553 -0
  22. package/dist/{cache-manifest-BI7ozfmH.mjs → cache-manifest-qA3dT2x2.mjs} +1 -1
  23. package/dist/cache-manifest.mjs +1 -1
  24. package/dist/ccache-CjHQ5F8g.mjs +142 -0
  25. package/dist/{chrome-DJnmnS5q.mjs → chrome-Dp2lMLBe.mjs} +1 -1
  26. package/dist/{cli-DNJMwADx.mjs → cli-B2R8wH1F.mjs} +20 -20
  27. package/dist/cli.mjs +1 -1
  28. package/dist/{client-DzhapoMB.mjs → client-BLy1Pw2V.mjs} +172 -165
  29. package/dist/collector-run.d.mts +10 -0
  30. package/dist/collector-run.mjs +7 -7
  31. package/dist/{command-output-CBtzyIgF.mjs → command-output-BjPN99ZB.mjs} +2 -2
  32. package/dist/{config-CgYMahz7.mjs → config-D0LhTY3S.mjs} +13 -13
  33. package/dist/{created-devices-DKbeWsiK.mjs → created-devices-HU_DAb_Q.mjs} +7 -6
  34. package/dist/{dependency-state-xKoOypBm.mjs → dependency-state-B2m8eqsS.mjs} +2 -2
  35. package/dist/{detached-entry-BLfcgc4O.mjs → detached-entry-BXq4fIl-.mjs} +1 -1
  36. package/dist/{dev-client-CLnIH02x.mjs → dev-client-ClATaJoH.mjs} +2 -2
  37. package/dist/{device-D7oCHGWi.mjs → device-B7lsC0K1.mjs} +8 -8
  38. package/dist/device-DVCwAFlX.mjs +727 -0
  39. package/dist/{device-capacity-EUOOYr8T.mjs → device-capacity-Ca_ke1LE.mjs} +25 -15
  40. package/dist/device-host-worker.mjs +38 -18
  41. package/dist/{device-ios-6MewKKnc.mjs → device-ios-CRUqPxKw.mjs} +12 -11
  42. package/dist/{device-lease-Co-EwifR.mjs → device-lease-DHOBXGgS.mjs} +135 -22
  43. package/dist/{device-lease-run-w1xhCqIW.mjs → device-lease-run-CvDeHTkG.mjs} +4 -4
  44. package/dist/{device-pool-F5WvRPtD.mjs → device-pool-L2-5GxMy.mjs} +3 -3
  45. package/dist/{device-remote-tHbd1fKy.mjs → device-remote-Bmg42063.mjs} +17 -69
  46. package/dist/doctor-C2MSuMMg.mjs +515 -0
  47. package/dist/{doctor-B9ckYUoU.mjs → doctor-DPAqhVCK.mjs} +334 -721
  48. package/dist/doctor-watchman-CB4NnVZm.mjs +260 -0
  49. package/dist/{simslim-EHBQ2R4G.mjs → eas-build-Dw_ec2Km.mjs} +6 -152
  50. package/dist/{stim-installations-aR_WsNOA.mjs → eas-session-ledger-DZlC-Fq3.mjs} +57 -4
  51. package/dist/{error-diagnostics-BRXOqDzG.mjs → error-diagnostics-Du7I_GuY.mjs} +17 -12
  52. package/dist/errors-DzkMYh8Q.mjs +205 -0
  53. package/dist/{exec-DWhCZDGm.mjs → exec-B81Qodjn.mjs} +69 -15
  54. package/dist/{gc-Dh6mXOKC.mjs → gc-PWp34zGb.mjs} +23 -22
  55. package/dist/{gradle-C6GKnunQ.mjs → gradle-C2OEKCCI.mjs} +50 -125
  56. package/dist/{guide-tm6igAaa.mjs → guide-Dai9lphv.mjs} +862 -538
  57. package/dist/{hosted-android-Bv285t_t.mjs → hosted-android-DQ-Agsd8.mjs} +5 -5
  58. package/dist/{hosted-client-C-rMtppF.mjs → hosted-client-Io01s5By.mjs} +9 -3
  59. package/dist/{hosted-ios-D5mNmtj4.mjs → hosted-ios-DIxFnYp-.mjs} +3 -3
  60. package/dist/{hosted-logs-DN8Iz4mJ.mjs → hosted-logs-DP-ABU_M.mjs} +8 -8
  61. package/dist/{hosted-macos-B-wEjlwG.mjs → hosted-macos-Aziw9T_9.mjs} +7 -6
  62. package/dist/{hosted-native-DeeOG8xZ.mjs → hosted-native-BdAQi21M.mjs} +23 -16
  63. package/dist/{idle-shutdown-jjtxAn5C.mjs → idle-shutdown-DdMqoSUB.mjs} +7 -7
  64. package/dist/ios-BZ9dg2Fr.mjs +9 -0
  65. package/dist/{ios-B3SbOWdw.mjs → ios-CXLIUxXJ.mjs} +180 -24
  66. package/dist/ios-CZuv6gRv.mjs +1112 -0
  67. package/dist/{ios-Bvbf0SGY.mjs → ios-VGvNdsv2.mjs} +1 -1
  68. package/dist/{ios-device-Bn7jWDB1.mjs → ios-device-B1B14xND.mjs} +1 -1
  69. package/dist/{ios-device-vOaByMhw.mjs → ios-device-BreZOpM0.mjs} +3 -3
  70. package/dist/ios-project-B9drt_aY.mjs +197 -0
  71. package/dist/{ios-state-B2pES6Vs.mjs → ios-state-CjrL2qv-.mjs} +1 -1
  72. package/dist/js-swap-C8icNYIY.mjs +432 -0
  73. package/dist/launch-DxH0THLP.mjs +745 -0
  74. package/dist/launch-YrbqaIFj.mjs +1530 -0
  75. package/dist/{launch-verify-hskNcWkZ.mjs → launch-verify-BzRdbuO1.mjs} +26 -7
  76. package/dist/{logs-1Ylc1Ri6.mjs → logs-DHaRNfg7.mjs} +11 -11
  77. package/dist/macos-C0iljhsN.mjs +2 -0
  78. package/dist/{macos-DF6C7wUU.mjs → macos-V_3Ui7g4.mjs} +125 -155
  79. package/dist/macos-run.mjs +1 -1
  80. package/dist/maintenance-run.mjs +13 -10
  81. package/dist/{metro-Dh8T4Ytd.mjs → metro-D_j9sN-B.mjs} +209 -43
  82. package/dist/{metro-gateway-CEUw9RMH.mjs → metro-gateway-BBJldOdi.mjs} +2 -2
  83. package/dist/miss-reason-BPAzZS0r.mjs +238 -0
  84. package/dist/{named-ports-BFIz1Shz.mjs → named-ports-C2lvoPsb.mjs} +12 -5
  85. package/dist/native-android-lHzaew7r.mjs +226 -0
  86. package/dist/native-gradle-inputs-BQnIdAlL.mjs +356 -0
  87. package/dist/{native-runtime-D_603JiC.mjs → native-runtime-BRmWL7ru.mjs} +9 -8
  88. package/dist/native-xcode-inputs-eutS19jU.mjs +307 -0
  89. package/dist/native-xcode-ios-DP3cHLwu.mjs +434 -0
  90. package/dist/{ndjson-LGZAMsqa.mjs → ndjson-GOnbyvso.mjs} +6 -6
  91. package/dist/offload-worker.d.mts +12 -6
  92. package/dist/offload-worker.mjs +409 -73
  93. package/dist/{ownership-D6Se7gg_.mjs → ownership-DXzMMSx6.mjs} +2 -2
  94. package/dist/{placement-log-BcPhRwR4.mjs → placement-log-reFbjqEr.mjs} +7 -3
  95. package/dist/plan-BDk2AeY_.mjs +260 -0
  96. package/dist/plan-placement-D_YYlE6N.mjs +73 -0
  97. package/dist/{ports-BLTtfBq-.mjs → ports-jzvAJXXL.mjs} +3 -3
  98. package/dist/{prebuild-juCyreaR.mjs → prebuild-Bw44QxVh.mjs} +4 -4
  99. package/dist/{preview-D5V07Nrl.mjs → preview-BaBJ72Al.mjs} +51 -34
  100. package/dist/project-B8_duAzW.mjs +1067 -0
  101. package/dist/project-plan-BPwbLwQu.mjs +10 -0
  102. package/dist/{pull-request-u4vp7zmK.mjs → pull-request-vOhLNmIb.mjs} +1 -1
  103. package/dist/pull-requests.mjs +1 -1
  104. package/dist/react-native-android-chm1DMlA.mjs +921 -0
  105. package/dist/react-native-build-oAw6gQeW.mjs +239 -0
  106. package/dist/react-native-doctor-DYXoh-6I.mjs +78 -0
  107. package/dist/react-native-ios-SCTK_CT5.mjs +595 -0
  108. package/dist/{recordings-BAWltsVt.mjs → recordings-Bk-VivUV.mjs} +1 -1
  109. package/dist/{reload-DvyWzVjJ.mjs → reload-D34GkY78.mjs} +17 -14
  110. package/dist/remote-BU9UyhCJ.mjs +192 -0
  111. package/dist/{remote-cache-BGg7aGIZ.mjs → remote-cache-Bsts6f6Y.mjs} +5 -5
  112. package/dist/result-BDoRk1k3.mjs +186 -0
  113. package/dist/{run-vhtDgpHO.mjs → run-qvff78hv.mjs} +3 -3
  114. package/dist/{server-bare-B9E7S1aR.mjs → server-bare-dWjAarki.mjs} +6 -6
  115. package/dist/server-command-7XIKlWtO.mjs +69 -0
  116. package/dist/{server-expo-DoBHhuzK.mjs → server-expo-CsYu2aKL.mjs} +107 -82
  117. package/dist/server-expo-DV43vep4.mjs +2 -0
  118. package/dist/settings-Bbztm4oV.mjs +1503 -0
  119. package/dist/{settings-Byp2AQ_E.mjs → settings-CT3E71-i.mjs} +6 -7
  120. package/dist/{state-lKh8shBp.d.mts → settings-vk3mJGSm.d.mts} +4 -2
  121. package/dist/settings.schema.json +156 -6
  122. package/dist/simslim-ChMfe8rg.mjs +149 -0
  123. package/dist/{slot-launch-C1nqh4mu.mjs → slot-launch-B9hn96wd.mjs} +6 -6
  124. package/dist/{stage-g_WqWeaE.mjs → stage-BNKKdDNc.mjs} +6 -3
  125. package/dist/start-CbQCSnXQ.mjs +2 -0
  126. package/dist/{start-D-IeOyoK.mjs → start-CdvcTaXr.mjs} +113 -77
  127. package/dist/{state-xnqpx3AD.mjs → state-Boo0IMJq.mjs} +4 -2
  128. package/dist/{state-BG-aAk4k.mjs → state-DI84A-uu.mjs} +29 -10
  129. package/dist/{stats-DY6ekz8F.mjs → stats-BIIDrjA8.mjs} +6 -6
  130. package/dist/{status-BEeL6IKz.mjs → status-BDGHwkCs.mjs} +3 -1
  131. package/dist/{status-DCjZeE-K.mjs → status-DARMkc9q.mjs} +80 -294
  132. package/dist/status-watch-DvmI3SmN.mjs +296 -0
  133. package/dist/{stim-desktop-Behws_fi.mjs → stim-desktop-8GQX2OV8.mjs} +1 -1
  134. package/dist/{stop-DIJtD2GL.mjs → stop-CCZS-C9m.mjs} +2 -2
  135. package/dist/stop-WQPQHLuy.mjs +72 -0
  136. package/dist/{stop-BTjs3xbc.mjs → stop-iNemHsJC.mjs} +81 -33
  137. package/dist/supervisor-run.d.mts +7 -2
  138. package/dist/supervisor-run.mjs +32 -20
  139. package/dist/{support-Bwvbrq5-.mjs → support-CnE_SIjt.mjs} +17 -7
  140. package/dist/{support-BaayeYCf.mjs → support-DCco5fut.mjs} +61 -8
  141. package/dist/swiftpm-macos-afeNUExW.mjs +119 -0
  142. package/dist/{native-run-B06FkmZx.mjs → tailnet-CoJUb2tB.mjs} +113 -6
  143. package/dist/toolchain-BIupIro1.mjs +2 -0
  144. package/dist/{toolchain-Bnyd_K3A.mjs → toolchain-DqyDXs30.mjs} +225 -315
  145. package/dist/{trigger-CJMhwXe8.mjs → trigger-C0MWBi8O.mjs} +3 -3
  146. package/dist/trigger-SHLOWJ4O.mjs +2 -0
  147. package/dist/{warm-progress-CjB-MP6H.mjs → warm-progress-C3ASD6z5.mjs} +134 -37
  148. package/dist/{status-Dcr0Qexd.mjs → watchman-CQl51YZu.mjs} +75 -7
  149. package/dist/web-B3eldHFH.mjs +123 -0
  150. package/dist/web-BLXpOe6b.mjs +2 -0
  151. package/dist/web-run.mjs +10 -10
  152. package/dist/{workspace-state-C59dqG-Z.mjs → workspace-state-CSIFuuDa.mjs} +33 -33
  153. package/dist/{workspaces-xXItD8Dj.mjs → workspaces-D2xSHBDY.mjs} +1297 -1211
  154. package/dist/{worktree-BSYlofkq.mjs → worktree-BxDqaTev.mjs} +102 -63
  155. package/dist/worktree-q7_OZNY0.mjs +2 -0
  156. package/package.json +8 -6
  157. package/shim/bundle-response.cjs +2 -1
  158. package/shim/bundle-response.d.cts +1 -1
  159. package/shim/expo-metro-config.cjs +1 -1
  160. package/shim/native-android.gradle +101 -0
  161. package/dist/android-BKA16DTf.mjs +0 -4
  162. package/dist/android-BvwuMUJ9.mjs +0 -3572
  163. package/dist/guide-status-Bhf9SJXc.mjs +0 -125
  164. package/dist/ios-CPdkoKaa.mjs +0 -3953
  165. package/dist/ios-DNpdygiv.mjs +0 -7
  166. package/dist/macos-Ck7OBMNY.mjs +0 -2
  167. package/dist/metro-store-BAHFcJm6.mjs +0 -106
  168. package/dist/plan-placement-CtxkCO54.mjs +0 -1859
  169. package/dist/project-C3ChRLZy.mjs +0 -212
  170. package/dist/projects-DD7dBTCj.mjs +0 -92
  171. package/dist/server-expo-Db9HBUoa.mjs +0 -2
  172. package/dist/settings-CQyMElEP.mjs +0 -701
  173. package/dist/start-NTc1Ifqs.mjs +0 -2
  174. package/dist/stop-BGhKMOuH.mjs +0 -48
  175. package/dist/trigger-DWAq9hkw.mjs +0 -2
  176. package/dist/web-B6_bFDn7.mjs +0 -2
  177. package/dist/worktree-BJfnU6r5.mjs +0 -2
  178. package/dist/worktree-CsKYexJM.mjs +0 -753
@@ -0,0 +1,462 @@
1
+ import { E as upsertProject, p as getProject, u as getConcurrencyLimits } from "./config-D0LhTY3S.mjs";
2
+ import { K as resolveProjectSettings, W as resolveCacheProviderConfig, a as SETTING_SHAPE_REMEDY } from "./settings-Bbztm4oV.mjs";
3
+ import { _ as waitForBuild, g as releaseBuildLock, j as providerUploadOutcome, m as acquireBuildLock } from "./device-lease-DHOBXGgS.mjs";
4
+ import { i as recordWorkspaceUse, w as workspaceLogsDir, x as workspaceDir } from "./workspace-state-CSIFuuDa.mjs";
5
+ import { l as phaseLine } from "./command-output-BjPN99ZB.mjs";
6
+ import { _ as detectIsExpo, d as projectRegistry } from "./project-B8_duAzW.mjs";
7
+ import { D as hostSystemImageArch } from "./android-BsYNR81W.mjs";
8
+ import { F as acquireBuildSlot, L as releaseBuildSlot } from "./workspaces-D2xSHBDY.mjs";
9
+ import { At as createRunRecorder, Dt as recordFinishedBuild, Ft as recordRunStats, It as statsProjectKey, Ot as startBuildProgress, jt as readRunEstimates, kt as tapBuildLog } from "./budget-BONq9vXY.mjs";
10
+ import { S as withNativeBuildRun, x as runCancellationSignal } from "./tailnet-CoJUb2tB.mjs";
11
+ import { r as createNdjsonWriter } from "./ndjson-GOnbyvso.mjs";
12
+ import { d as optimizationBuildProfile, l as artifactCachePolicy } from "./errors-DzkMYh8Q.mjs";
13
+ import { i as checkEasAuth, m as uploadRemote, p as resolveRemote } from "./remote-cache-Bsts6f6Y.mjs";
14
+ import { f as setRemoteLogSink, y as resolveBuildPlacement } from "./client-BLy1Pw2V.mjs";
15
+ import { m as listIosRuntimes } from "./ios-CXLIUxXJ.mjs";
16
+ import { n as ensureWorkspaceStorageSafely } from "./native-runtime-BRmWL7ru.mjs";
17
+ import { A as readBundleId } from "./toolchain-DqyDXs30.mjs";
18
+ import { n as resolveAndroidBuildPlan } from "./plan-BDk2AeY_.mjs";
19
+ import { t as acquireAndroidArtifact } from "./artifact-DClXJNWx.mjs";
20
+ import { i as persistLastBuild, n as finishAndroidUpload } from "./result-BDoRk1k3.mjs";
21
+ import { c as iosProjectPathError, g as resolveIosBuildSetup, m as resolveConfiguration, x as simulatorBuildArch, y as resolveSchemeSelection } from "./support-DCco5fut.mjs";
22
+ import { a as lastBuildRecord } from "./ios-project-B9drt_aY.mjs";
23
+ import { t as acquireIosArtifact } from "./artifact-CnC0mfov.mjs";
24
+ import { constants, copyFileSync, cpSync, mkdirSync, mkdtempSync, rmSync } from "node:fs";
25
+ import { basename, join } from "node:path";
26
+ import { loadCacheProvider } from "@stim-cli/cache";
27
+ import { hostSimulatorArch } from "@stim-cli/core";
28
+ //#region src/commands/android/build.ts
29
+ const note$1 = (line) => console.error(line);
30
+ async function buildAndroidOperation(root, options) {
31
+ const selected = projectRegistry.selectAndroid(root);
32
+ if ("problem" in selected) throw Object.assign(new Error(selected.problem.message), {
33
+ code: "STIM_NO_PROJECT",
34
+ remedy: selected.problem.remedy
35
+ });
36
+ const { context: settingsContext, settings } = resolveProjectSettings(root);
37
+ const integration = await selected.load({
38
+ context: settingsContext,
39
+ settings
40
+ });
41
+ const phase = (label, line) => note$1(phaseLine(label, line));
42
+ const plan = resolveAndroidBuildPlan({
43
+ settings,
44
+ settingsContext,
45
+ variant: options.variant ?? null,
46
+ buildCache: options.buildCache !== false
47
+ }, {
48
+ warn: phase,
49
+ runtimeKind: integration.runtimeKind,
50
+ variantProblem: integration.variantProblem,
51
+ detectExpo: () => integration.isExpo
52
+ });
53
+ if (!plan.ok) throw Object.assign(new Error(plan.message), plan, { details: { lines: plan.lines } });
54
+ const placement = resolveBuildPlacement(options.remoteBuild);
55
+ if (placement.failure) throw Object.assign(new Error(placement.failure.message), placement.failure);
56
+ if (options.abi !== void 0 && ![
57
+ "arm64-v8a",
58
+ "armeabi-v7a",
59
+ "x86",
60
+ "x86_64",
61
+ "all"
62
+ ].includes(options.abi)) throw Object.assign(/* @__PURE__ */ new Error("Android build abi must be arm64-v8a, armeabi-v7a, x86, x86_64 or all."), { code: "STIM_BAD_ARG" });
63
+ const abi = options.abi === "all" ? null : options.abi ?? (plan.plan.build.targetAbiOnly && !plan.plan.build.release ? hostSystemImageArch() : null);
64
+ await ensureWorkspaceStorageSafely(root, { note: note$1 });
65
+ return withNativeBuildRun(root, {
66
+ command: "build",
67
+ platform: "android"
68
+ }, async (claim) => {
69
+ if (!getProject(root)) upsertProject(root, {});
70
+ recordWorkspaceUse(root);
71
+ const started = Date.now();
72
+ const startedAt = new Date(started).toISOString();
73
+ const progress = startBuildProgress({
74
+ root,
75
+ platform: "android",
76
+ slot: "default",
77
+ claim,
78
+ note: note$1
79
+ });
80
+ const logs = workspaceLogsDir(root);
81
+ const buildLog = join(logs, "build-artifact-android.ndjson");
82
+ const writer = tapBuildLog(createNdjsonWriter(buildLog, {
83
+ truncate: true,
84
+ fields: { platform: "android" }
85
+ }), progress);
86
+ setRemoteLogSink((entry) => writer.write(entry));
87
+ const projectKey = statsProjectKey({
88
+ root,
89
+ commonDir: settingsContext.gitCommonDir,
90
+ repoRoot: settingsContext.repoRoot
91
+ });
92
+ const stats = createRunRecorder({
93
+ platform: "android",
94
+ write: recordRunStats,
95
+ now: Date.now,
96
+ note: note$1,
97
+ phases: () => progress.durations(),
98
+ deviceSetup: () => false
99
+ });
100
+ stats.setProject(projectKey);
101
+ progress.estimate(projectKey);
102
+ const record = {
103
+ buildMachine: placement.selected,
104
+ configuration: plan.plan.build.variant
105
+ };
106
+ let artifact;
107
+ let directory;
108
+ let succeeded = false;
109
+ const finishRecord = (status, errorCode) => persistLastBuild({
110
+ root,
111
+ record,
112
+ startedAt,
113
+ durationMs: Date.now() - started,
114
+ status,
115
+ errorCode,
116
+ out: note$1,
117
+ recordBuild: (at, entry) => recordFinishedBuild(at, entry, { artifactOnly: true })
118
+ });
119
+ try {
120
+ const acquired = await acquireAndroidArtifact({
121
+ root,
122
+ buildLog,
123
+ writer,
124
+ recipe: integration.artifact({
125
+ root,
126
+ buildLog,
127
+ writer,
128
+ settings,
129
+ buildPlan: plan.plan.build,
130
+ target: { abi },
131
+ phase,
132
+ out: note$1,
133
+ step: progress.step,
134
+ estimates: () => readRunEstimates({
135
+ projectKey,
136
+ platform: "android"
137
+ })
138
+ }),
139
+ targetOffloadRefusal: null,
140
+ buildPlan: plan.plan.build,
141
+ cacheProviderConfig: plan.plan.cacheProviderConfig,
142
+ requestedBuildCache: options.buildCache !== false,
143
+ easBuild: null,
144
+ androidPackage: integration.appIds().androidPackage,
145
+ record,
146
+ maxBuilds: getConcurrencyLimits().maxBuilds,
147
+ progress: {
148
+ phase,
149
+ out: note$1,
150
+ stats,
151
+ step: progress.step,
152
+ miss: progress.miss,
153
+ hit: progress.hit,
154
+ place: progress.place,
155
+ waitingOn: progress.waitingOn,
156
+ waitingFor: progress.waitingFor
157
+ }
158
+ }, {
159
+ acquireLock: acquireBuildLock,
160
+ releaseLock: releaseBuildLock,
161
+ waitForBuild,
162
+ easAuth: checkEasAuth,
163
+ resolveRemoteBuild: resolveRemote,
164
+ uploadRemoteBuild: uploadRemote,
165
+ loadCacheProviderModule: loadCacheProvider,
166
+ acquireSlot: acquireBuildSlot,
167
+ releaseSlot: releaseBuildSlot,
168
+ now: Date.now
169
+ });
170
+ if (!acquired.ok) throw Object.assign(new Error(acquired.failure.message ?? "Android build failed."), acquired.failure, { details: acquired.failure.extra });
171
+ artifact = acquired.artifact;
172
+ if (runCancellationSignal()?.aborted) throw Object.assign(/* @__PURE__ */ new Error("The Android build was cancelled."), { code: "STIM_CANCELLED" });
173
+ if (!artifact.apkPath) throw Object.assign(/* @__PURE__ */ new Error("The Android build produced no APK."), { code: "STIM_BUILD_FAILED" });
174
+ const artifacts = join(workspaceDir(root), "artifacts");
175
+ mkdirSync(artifacts, { recursive: true });
176
+ directory = mkdtempSync(join(artifacts, "android-"));
177
+ const apkPath = join(directory, "app.apk");
178
+ copyFileSync(artifact.apkPath, apkPath, constants.COPYFILE_FICLONE);
179
+ await finishAndroidUpload(artifact.uploadPending, artifact.remote, phase);
180
+ const uploaded = providerUploadOutcome(artifact.providerUpload ? await artifact.providerUpload : null, artifact.providerName);
181
+ if (uploaded) phase("cache", uploaded.line);
182
+ if (runCancellationSignal()?.aborted) throw Object.assign(/* @__PURE__ */ new Error("The Android build was cancelled."), { code: "STIM_CANCELLED" });
183
+ record.appPath = apkPath;
184
+ record.bundleId = artifact.androidPackage;
185
+ finishRecord("ok");
186
+ stats.record({
187
+ failed: false,
188
+ cacheHit: record.cacheHit === "local" || record.cacheHit === "remote" ? record.cacheHit : false,
189
+ durationMs: Date.now() - started,
190
+ offloadedTo: record.offloadedTo,
191
+ waited: artifact.waitedForBuild
192
+ });
193
+ succeeded = true;
194
+ return {
195
+ apkPath,
196
+ androidPackage: artifact.androidPackage,
197
+ variant: plan.plan.build.variant ?? "debug",
198
+ abi,
199
+ cacheKey: record.cacheKey ?? null,
200
+ cacheHit: record.cacheHit ?? false,
201
+ cacheSkipped: record.cacheSkipped ?? false,
202
+ buildMachine: placement.selected,
203
+ builtOn: record.builtOn ?? null,
204
+ ccache: artifact.ccache,
205
+ durationMs: Date.now() - started,
206
+ logs: { dir: logs }
207
+ };
208
+ } catch (error) {
209
+ const failure = runCancellationSignal()?.aborted ? Object.assign(/* @__PURE__ */ new Error("The Android build was cancelled."), {
210
+ code: "STIM_CANCELLED",
211
+ cause: error
212
+ }) : error;
213
+ finishRecord("failed", failure.code);
214
+ stats.record({
215
+ failed: true,
216
+ durationMs: Date.now() - started
217
+ });
218
+ throw failure;
219
+ } finally {
220
+ artifact?.release();
221
+ if (!succeeded && directory) rmSync(directory, {
222
+ recursive: true,
223
+ force: true
224
+ });
225
+ writer.close();
226
+ progress.clear();
227
+ }
228
+ }, { write: (line) => phase("lock", line) });
229
+ }
230
+ //#endregion
231
+ //#region src/commands/ios/build.ts
232
+ const note = (line) => console.error(line);
233
+ async function buildIosOperation(root, options) {
234
+ const selected = projectRegistry.selectIos(root);
235
+ if ("problem" in selected) throw Object.assign(new Error(selected.problem.message), {
236
+ code: "STIM_NO_PROJECT",
237
+ remedy: selected.problem.remedy
238
+ });
239
+ const { context, settings } = resolveProjectSettings(root);
240
+ const projectPathError = iosProjectPathError(settings, root, () => detectIsExpo(root));
241
+ if (projectPathError) throw Object.assign(new Error(projectPathError), {
242
+ code: "STIM_BAD_ARG",
243
+ remedy: SETTING_SHAPE_REMEDY
244
+ });
245
+ const integration = await selected.load(settings);
246
+ const setup = resolveIosBuildSetup(options.remoteBuild, settings, (label, message) => note(phaseLine(label, message)));
247
+ if (!setup.ok) {
248
+ const { failure } = setup;
249
+ throw Object.assign(new Error(failure.message ?? failure.code), failure, { details: failure });
250
+ }
251
+ const { buildMachine, optimizations } = setup;
252
+ const configuration = resolveConfiguration(options.configuration, settings);
253
+ const buildScheme = resolveSchemeSelection(options, settings);
254
+ const problem = integration.schemeProblem(buildScheme, configuration);
255
+ if (problem) throw Object.assign(new Error(problem.message ?? problem.code), problem);
256
+ if (options.arch !== void 0 && ![
257
+ "arm64",
258
+ "x86_64",
259
+ "all"
260
+ ].includes(options.arch)) throw Object.assign(/* @__PURE__ */ new Error("iOS build arch must be arm64, x86_64 or all."), { code: "STIM_BAD_ARG" });
261
+ const arch = options.arch === "all" ? null : options.arch ?? simulatorBuildArch({
262
+ physical: false,
263
+ remoteArch: null,
264
+ hostArch: hostSimulatorArch(),
265
+ configuration
266
+ });
267
+ const cache = artifactCachePolicy(optimizations, options.buildCache !== false, integration.runtimeKind(configuration) === "embedded-js");
268
+ const phase = (label, line) => note(phaseLine(label, line));
269
+ await ensureWorkspaceStorageSafely(root, { note });
270
+ return withNativeBuildRun(root, {
271
+ command: "build",
272
+ platform: "ios"
273
+ }, async (claim) => {
274
+ if (!getProject(root)) upsertProject(root, {});
275
+ recordWorkspaceUse(root);
276
+ const started = Date.now();
277
+ const startedAt = new Date(started).toISOString();
278
+ const progress = startBuildProgress({
279
+ root,
280
+ platform: "ios",
281
+ slot: "default",
282
+ claim,
283
+ note
284
+ });
285
+ const logs = workspaceLogsDir(root);
286
+ const logFile = join(logs, "build-artifact-ios.ndjson");
287
+ const writer = tapBuildLog(createNdjsonWriter(logFile, {
288
+ truncate: true,
289
+ fields: { platform: "ios" }
290
+ }), progress);
291
+ setRemoteLogSink((entry) => writer.write(entry));
292
+ const projectKey = statsProjectKey({
293
+ root,
294
+ commonDir: context.gitCommonDir,
295
+ repoRoot: context.repoRoot
296
+ });
297
+ const stats = createRunRecorder({
298
+ platform: "ios",
299
+ write: recordRunStats,
300
+ now: Date.now,
301
+ note,
302
+ phases: () => progress.durations(),
303
+ deviceSetup: () => false
304
+ });
305
+ stats.setProject(projectKey);
306
+ progress.estimate(projectKey);
307
+ let artifact;
308
+ let directory;
309
+ let succeeded = false;
310
+ const finish = (status, appPath, errorCode) => {
311
+ try {
312
+ recordFinishedBuild(root, lastBuildRecord({
313
+ startedAt,
314
+ status,
315
+ appPath,
316
+ errorCode,
317
+ configuration,
318
+ durationMs: Date.now() - started,
319
+ fingerprint: artifact?.cache.identity?.fingerprint,
320
+ cacheKey: artifact?.cache.identity?.key,
321
+ cacheHit: artifact?.cache.hit,
322
+ cacheSkipped: artifact ? !artifact.cache.readEnabled : !cache.read,
323
+ bundleId: artifact?.bundleId,
324
+ buildMachine,
325
+ builtOn: artifact?.cache.builtOn,
326
+ offloadedTo: artifact?.cache.offloadedTo,
327
+ offloadFallback: artifact?.cache.offloadFallback
328
+ }), { artifactOnly: true });
329
+ } catch (error) {
330
+ note(phaseLine("state", `could not record the build: ${error?.message || error}`));
331
+ }
332
+ };
333
+ try {
334
+ const acquired = await acquireIosArtifact({
335
+ root,
336
+ logFile,
337
+ configuration,
338
+ buildMachine,
339
+ physical: false,
340
+ recipe: integration.artifact({
341
+ root,
342
+ logFile,
343
+ configuration,
344
+ buildScheme,
345
+ buildProfile: optimizationBuildProfile("ios", optimizations),
346
+ target: {
347
+ udid: null,
348
+ destination: "generic/platform=iOS Simulator",
349
+ sdk: "iphonesimulator",
350
+ arch,
351
+ keyArch: arch,
352
+ offloadRuntime: () => listIosRuntimes().toSorted((a, b) => b.version.localeCompare(a.version, void 0, { numeric: true }))[0]?.identifier ?? null,
353
+ ...arch ? { hostedArchitecture: arch } : {},
354
+ offloadRefusal: null
355
+ },
356
+ device: null,
357
+ optimizations: optimizations.ios,
358
+ cache,
359
+ phase,
360
+ note,
361
+ logWriter: () => writer,
362
+ estimates: () => readRunEstimates({
363
+ projectKey,
364
+ platform: "ios"
365
+ }),
366
+ step: progress.step,
367
+ setPodsMs: (ms) => stats.setPodsMs(ms)
368
+ }),
369
+ cache: {
370
+ policy: cache,
371
+ providerConfig: resolveCacheProviderConfig(context),
372
+ disabledByFlag: options.buildCache === false
373
+ },
374
+ easBuild: null,
375
+ maxBuilds: getConcurrencyLimits().maxBuilds,
376
+ progress: {
377
+ phase,
378
+ note,
379
+ logWriter: () => writer,
380
+ stats,
381
+ step: progress.step,
382
+ miss: progress.miss,
383
+ hit: progress.hit,
384
+ place: progress.place,
385
+ waitingOn: progress.waitingOn,
386
+ waitingFor: progress.waitingFor
387
+ }
388
+ }, {
389
+ loadCacheProvider,
390
+ checkEasAuth,
391
+ resolveRemote,
392
+ uploadRemote,
393
+ acquireBuildLock,
394
+ releaseBuildLock,
395
+ waitForBuild,
396
+ acquireBuildSlot,
397
+ releaseBuildSlot,
398
+ now: Date.now
399
+ });
400
+ if (!acquired.ok) throw Object.assign(new Error(acquired.failure.message ?? "The iOS build failed."), acquired.failure);
401
+ artifact = acquired.artifact;
402
+ artifact.bundleId ??= readBundleId(artifact.path) ?? integration.bundleId();
403
+ if (runCancellationSignal()?.aborted) throw Object.assign(/* @__PURE__ */ new Error("The iOS build was cancelled."), { code: "STIM_CANCELLED" });
404
+ const artifacts = join(workspaceDir(root), "artifacts");
405
+ mkdirSync(artifacts, { recursive: true });
406
+ directory = mkdtempSync(join(artifacts, "ios-"));
407
+ const appPath = join(directory, basename(artifact.path));
408
+ cpSync(artifact.path, appPath, {
409
+ recursive: true,
410
+ verbatimSymlinks: true,
411
+ mode: constants.COPYFILE_FICLONE
412
+ });
413
+ await artifact.completeUploads();
414
+ if (runCancellationSignal()?.aborted) throw Object.assign(/* @__PURE__ */ new Error("The iOS build was cancelled."), { code: "STIM_CANCELLED" });
415
+ finish("ok", appPath);
416
+ stats.record({
417
+ failed: false,
418
+ durationMs: Date.now() - started,
419
+ cacheHit: artifact.cache.hit === "local" || artifact.cache.hit === "remote" ? artifact.cache.hit : false,
420
+ offloadedTo: artifact.cache.offloadedTo,
421
+ waited: artifact.cache.waitedForBuild
422
+ });
423
+ succeeded = true;
424
+ return {
425
+ appPath,
426
+ bundleId: artifact.bundleId,
427
+ configuration: configuration ?? "Debug",
428
+ scheme: buildScheme ?? null,
429
+ arch,
430
+ cacheKey: artifact.cache.identity?.key ?? null,
431
+ cacheHit: artifact.cache.hit,
432
+ cacheSkipped: !artifact.cache.readEnabled,
433
+ buildMachine,
434
+ builtOn: artifact.cache.builtOn ?? null,
435
+ compilationCache: artifact.cache.compilation,
436
+ durationMs: Date.now() - started,
437
+ logs: { dir: logs }
438
+ };
439
+ } catch (error) {
440
+ const failure = runCancellationSignal()?.aborted ? Object.assign(/* @__PURE__ */ new Error("The iOS build was cancelled."), {
441
+ code: "STIM_CANCELLED",
442
+ cause: error
443
+ }) : error;
444
+ finish("failed", void 0, failure.code);
445
+ stats.record({
446
+ failed: true,
447
+ durationMs: Date.now() - started
448
+ });
449
+ throw failure;
450
+ } finally {
451
+ artifact?.release();
452
+ if (!succeeded && directory) rmSync(directory, {
453
+ recursive: true,
454
+ force: true
455
+ });
456
+ writer.close();
457
+ progress.clear();
458
+ }
459
+ }, { write: (line) => phase("lock", line) });
460
+ }
461
+ //#endregion
462
+ export { buildAndroidOperation as n, buildIosOperation as t };