stim 1.21.0 → 1.23.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.
- package/README.md +60 -7
- package/dist/{acquire-artifact-CD4lbiWE.mjs → acquire-artifact-ybouwJSR.mjs} +21 -3
- package/dist/{act-DHAw2A2S.mjs → act-DG54PWtJ.mjs} +298 -164
- package/dist/{activity-BzVfHSrY.mjs → activity-B5RtpFda.mjs} +33 -12
- package/dist/{agent-device-usage-output-zh1vhbLp.mjs → agent-device-usage-output-UJ5gC80l.mjs} +7 -7
- package/dist/{android-BLgbNqox.mjs → android-BoUJKbfz.mjs} +66 -52
- package/dist/{android-DUYkNF4u.mjs → android-C7sVmyI9.mjs} +160 -59
- package/dist/{android-CV_GCELZ.mjs → android-CHH4KLOR.mjs} +5 -5
- package/dist/{android-BEJ8Jpl7.mjs → android-DR5lZ2Az.mjs} +2 -2
- package/dist/android-cas-compiler.mjs +1 -1
- package/dist/{android-cas-Ct5b1xCK.mjs → android-cas-ngferVq2.mjs} +3 -3
- package/dist/{client-B7QVOlCr.d.mts → android-project-DVWyCbWU.d.mts} +145 -7
- package/dist/api.d.mts +132 -118
- package/dist/api.mjs +239 -42
- package/dist/{artifact-DAuZ-FNU.mjs → artifact-5RteZem7.mjs} +69 -40
- package/dist/{artifact-B8T3S5gi.mjs → artifact-Dwdo7k1E.mjs} +40 -35
- package/dist/artifact-platform-CXcmX_j3.mjs +27 -0
- package/dist/{browser-web-QQzVjz3O.mjs → browser-web-CeEVlGug.mjs} +187 -59
- package/dist/{budget-Bs6SxxzO.mjs → budget-DnPX3DXj.mjs} +830 -699
- package/dist/{build-CoPzQRNw.mjs → build-CqufZFqy.mjs} +34 -27
- package/dist/{build-cache-DmyR9Zzc.mjs → build-cache-Dv7RN200.mjs} +4 -4
- package/dist/{build-plan-CaFskB7_.mjs → build-plan-C8CIvRyi.mjs} +74 -14
- package/dist/{cache-manifest-DkkqguoK.mjs → cache-manifest-DSeQjt-Q.mjs} +1 -1
- package/dist/cache-manifest.mjs +1 -1
- package/dist/{ccache-BJRZ9pG3.mjs → ccache-RcAy92gH.mjs} +6 -6
- package/dist/{cdp-CWmIUMbw.mjs → cdp-3fwICjzi.mjs} +1 -1
- package/dist/{chrome-B6tfCta1.mjs → chrome-Bbw689-6.mjs} +1 -1
- package/dist/{cli-0DYf8QhQ.mjs → cli-D-J9fWGV.mjs} +20 -20
- package/dist/cli.mjs +1 -1
- package/dist/{client-UXD70ZbM.mjs → client-yyso1bwi.mjs} +218 -47
- package/dist/collector-run.d.mts +1 -1
- package/dist/collector-run.mjs +6 -6
- package/dist/{command-output-B1UrjZHL.mjs → command-output-Db8BqzxH.mjs} +1 -1
- package/dist/{config-CYcBF478.mjs → config-DlrsduwG.mjs} +17 -11
- package/dist/{created-devices-CqeBlrEn.mjs → created-devices-x9rN6bhs.mjs} +13 -3
- package/dist/{dependency-state-BbKQW83h.mjs → dependency-state-1I9KZT1Y.mjs} +2 -2
- package/dist/{detached-entry-DFRyG1_o.mjs → detached-entry-BwNEtIrP.mjs} +1 -1
- package/dist/{dev-client-UOeESKm6.mjs → dev-client-BnYSDiKa.mjs} +2 -2
- package/dist/{device-DCxH7_By.mjs → device-BvzPUBs3.mjs} +16 -16
- package/dist/{device-ExJq8Ei7.mjs → device-CCkWmkAA.mjs} +71 -14
- package/dist/{device-capacity-CMlqEcvw.mjs → device-capacity-CjaSdrhg.mjs} +9 -10
- package/dist/device-host-worker.mjs +25 -32
- package/dist/{device-ios-DRUeKaFV.mjs → device-ios-uOiEETX2.mjs} +39 -16
- package/dist/{device-lease-run-C8raGFoP.mjs → device-lease-run-BgwPHc6u.mjs} +5 -5
- package/dist/{device-pool-DMRpVX9a.mjs → device-pool-C-ptmZTa.mjs} +3 -3
- package/dist/{doctor-DTvaDOda.mjs → doctor-8sr2tFOL.mjs} +24 -37
- package/dist/{doctor-Dhqebm0q.mjs → doctor-D2SN3Ltx.mjs} +19 -16
- package/dist/doctor-fingerprint-DZLoYFVb.mjs +16 -0
- package/dist/doctor-fingerprint.mjs +1 -1
- package/dist/{doctor-BLHCYxzi.mjs → doctor-pxxvipYC.mjs} +1 -1
- package/dist/{doctor-watchman-Cv1F10Kj.mjs → doctor-watchman-sy_RNhFt.mjs} +5 -5
- package/dist/{eas-build-BomfRnFT.mjs → eas-build-CyjU5K7E.mjs} +4 -4
- package/dist/{eas-fallback-DJwZpy0c.mjs → eas-fallback-DV3Wytf1.mjs} +27 -18
- package/dist/{eas-session-ledger-op6A54yi.mjs → eas-session-ledger-BzzsX97d.mjs} +8 -7
- package/dist/{error-diagnostics-Bf0rZvG9.mjs → error-diagnostics-C6sVoeqO.mjs} +10 -10
- package/dist/{exec-_UbtCQcG.mjs → exec-DEoAhcze.mjs} +155 -47
- package/dist/{exec-H20xSg2T.d.mts → exec-DnYc4HGH.d.mts} +17 -4
- package/dist/{gc-_-dCXdyL.mjs → gc-CDoogxAI.mjs} +587 -313
- package/dist/gc-DLbzvTP2.mjs +3 -0
- package/dist/{guide-Yqwt2bd6.mjs → guide-BC37GcDG.mjs} +288 -59
- package/dist/{hosted-android-Bw-honsd.mjs → hosted-android-CkclQig_.mjs} +6 -6
- package/dist/{hosted-client-DB_gBPfY.mjs → hosted-client-ByuMMO5s.mjs} +4 -4
- package/dist/{hosted-ios-CUvOf4Vr.mjs → hosted-ios-DtYHeuYR.mjs} +1 -1
- package/dist/{hosted-logs-DL_P5AdN.mjs → hosted-logs-Br84qWy1.mjs} +5 -5
- package/dist/{hosted-macos-QI141yKk.mjs → hosted-macos-DdtYajZt.mjs} +21 -12
- package/dist/{hosted-native-Ksyjgzq-.mjs → hosted-native-UPI9zdZ4.mjs} +27 -14
- package/dist/{idle-BVeRGroT.d.mts → idle-C4cZ757K.d.mts} +3 -3
- package/dist/{idle-shutdown-DaKmZi0z.mjs → idle-shutdown-DO7oIRlc.mjs} +7 -7
- package/dist/ios-CDvlmUs7.d.mts +24 -0
- package/dist/{ios-ubFsBzwq.mjs → ios-DZZbNYlY.mjs} +59 -50
- package/dist/{ios-device-CXGP1bsD.mjs → ios-device-BXZ0c7Kb.mjs} +1 -1
- package/dist/{ios-device-CwFMehUS.mjs → ios-device-JC3uWM4K.mjs} +3 -3
- package/dist/{ios-CpByZy12.mjs → ios-hcBpnEGk.mjs} +81 -34
- package/dist/{ios-project-WuwwBdvW.mjs → ios-project-CVyNwjAF.mjs} +5 -5
- package/dist/{ios-signing-DTTIChGs.mjs → ios-signing-BtAffm0A.mjs} +2 -2
- package/dist/{ios-state-DvFX-K_l.mjs → ios-state-Dtw5K2aI.mjs} +1 -1
- package/dist/{ios-CQ68hG9s.mjs → ios-vbUOqGXu.mjs} +8 -8
- package/dist/{ios-qNJt4dFm.mjs → ios-xtlRHaeB.mjs} +1 -1
- package/dist/{js-swap-Cc1dttps.mjs → js-swap-C3QxUFJR.mjs} +7 -29
- package/dist/{launch-CD1yVc7U.mjs → launch-Bz7JtaC4.mjs} +16 -16
- package/dist/{launch-Zq2mOSDy.mjs → launch-CHY3p-yz.mjs} +40 -39
- package/dist/{logs-CMm05HxN.mjs → logs-CtNeNDuq.mjs} +10 -17
- package/dist/{logs-BS00Anxf.mjs → logs-mxqsWpJs.mjs} +151 -24
- package/dist/{macos-B65--pPd.mjs → macos-inNFbBWc.mjs} +1 -1
- package/dist/macos-run.mjs +1 -1
- package/dist/{macos-C-0qJ6zq.mjs → macos-u0BoHKnO.mjs} +143 -46
- package/dist/maintenance-run.mjs +8 -8
- package/dist/{metro-DEXpIhHC.mjs → metro-DiXtA3Ty.mjs} +59 -37
- package/dist/{metro-gateway-BMJNlj3E.mjs → metro-gateway-CKZqKqx7.mjs} +120 -22
- package/dist/{named-ports-BWTzt6mu.mjs → named-ports-DkEzOfzO.mjs} +40 -33
- package/dist/{native-android-JACyjTZs.mjs → native-android-CdCSylTn.mjs} +43 -242
- package/dist/native-gradle-artifact-inputs-DHFnmrVf.mjs +270 -0
- package/dist/{native-gradle-inputs-Bep9JcSF.mjs → native-gradle-inputs-Dnh84Zbd.mjs} +3 -129
- package/dist/{native-run-DY_RLx3C.mjs → native-run-BUTu8T7A.mjs} +4 -5
- package/dist/{native-runtime-Dg1Q7tfF.mjs → native-runtime-CRSOZxKY.mjs} +8 -7
- package/dist/native-source-Y0yLhFyQ.mjs +133 -0
- package/dist/{native-xcode-inputs-CB2iQeWq.mjs → native-xcode-inputs-G6rkkhxu.mjs} +2 -3
- package/dist/{native-xcode-ios-CXX39F7o.mjs → native-xcode-ios-_os2PlCD.mjs} +27 -32
- package/dist/offload-worker.d.mts +65 -2
- package/dist/offload-worker.mjs +305 -73
- package/dist/operation-exec-BW0em61G.mjs +171 -0
- package/dist/{ownership-DEmM5vhh.mjs → ownership-C5fo5Edb.mjs} +3 -3
- package/dist/{page-CPaHeYqj.mjs → page-DBL2PiUU.mjs} +8 -4
- package/dist/{placement-log-BqGbTa61.mjs → placement-log-BnGgJRRZ.mjs} +1 -1
- package/dist/{plan-placement-Bwj-IjY1.mjs → plan-placement-BU42oOyT.mjs} +12 -8
- package/dist/{ports-D-MmCTdv.mjs → ports-BSmQKzW7.mjs} +3 -3
- package/dist/{prebuild-uD_ipCxF.mjs → prebuild-BFm63bQ0.mjs} +63 -16
- package/dist/{project-BZNjmW_8.mjs → project-CTLNHCfE.mjs} +16 -16
- package/dist/{pull-request-Lfetn8Kr.mjs → pull-request-W1IuLXDt.mjs} +102 -20
- package/dist/{pull-request-zjCSAryH.d.mts → pull-request-eODyIqZF.d.mts} +6 -2
- package/dist/pull-requests.d.mts +2 -2
- package/dist/pull-requests.mjs +2 -2
- package/dist/{react-native-android-DuzH0cn3.mjs → react-native-android-CFgUroxW.mjs} +73 -53
- package/dist/{react-native-build-rhk4smwQ.mjs → react-native-build-CmJkTljQ.mjs} +8 -8
- package/dist/{react-native-doctor-CQpuIMso.mjs → react-native-doctor-LTF-Xt8l.mjs} +7 -7
- package/dist/{react-native-ios-Bhq1rJeV.mjs → react-native-ios-ChBF1MkB.mjs} +43 -29
- package/dist/{recordings-DYteQSu4.mjs → recordings-CQmfzAh7.mjs} +1 -1
- package/dist/registration-BcRgF6Ox.mjs +51 -0
- package/dist/{reload-CmTRFJaX.mjs → reload-DF9hqUUB.mjs} +16 -15
- package/dist/{reload-DzjSl5P_.mjs → reload-RBi1nj6Z.mjs} +1 -1
- package/dist/{remote-ByYkXdGD.mjs → remote-BmvMCcJw.mjs} +18 -15
- package/dist/{result-DNiS-tTP.mjs → result-Cx5CRLvS.mjs} +24 -23
- package/dist/{run-D23HmJMs.mjs → run-DidHghD1.mjs} +3 -2
- package/dist/{selection-CSl9i5qU.mjs → selection-DSMbWEX2.mjs} +6 -5
- package/dist/{server-bare-CxTrvDg8.mjs → server-bare-CafzuyFB.mjs} +2 -2
- package/dist/{server-command-CtzloH3v.mjs → server-command-BTiGPEjS.mjs} +5 -5
- package/dist/server-expo-C-Buqvn_.mjs +2 -0
- package/dist/{server-expo-DT_F_uVI.mjs → server-expo-D9lEz4aq.mjs} +7 -5
- package/dist/{settings-CsJDEXgK.mjs → settings-C7O8A6ZI.mjs} +223 -243
- package/dist/{settings-T1gtc3bf.mjs → settings-eKF_vJJs.mjs} +1 -1
- package/dist/{settings-write-HyVZ8eQ8.mjs → settings-write-79mQRr9C.mjs} +7 -6
- package/dist/settings.schema.json +13 -0
- package/dist/{simslim-Cgk17SXV.mjs → simslim-BNckWpXi.mjs} +2 -2
- package/dist/{slot-launch-DF8VfT64.mjs → slot-launch-D7M2nE4b.mjs} +6 -6
- package/dist/{stage-BIS0ydsV.mjs → stage-DKNM4ZPd.mjs} +21 -4
- package/dist/{start-RChynRDp.mjs → start-CRfN1kWV.mjs} +1 -1
- package/dist/{start-7lpH7hmN.mjs → start-bjfiScgz.mjs} +622 -393
- package/dist/{state-C4ZtUisW.mjs → state--smjFSTL.mjs} +22 -7
- package/dist/{state-XMziexv2.mjs → state-08I3hw3_.mjs} +2 -2
- package/dist/{stats-53T7OTb9.mjs → stats-DioA6cBU.mjs} +5 -5
- package/dist/{stats-report-BFfMpWWF.mjs → stats-report-BzaPrRm6.mjs} +1 -1
- package/dist/{status-DqEUSSxs.mjs → status-BRROykC8.mjs} +2 -2
- package/dist/{status-CSi6tlRq.mjs → status-Eqx_20WC.mjs} +1 -1
- package/dist/{status-BL7jVyAB.mjs → status-kzbeWk4x.mjs} +43 -29
- package/dist/{status-watch-GDCfqpTE.mjs → status-watch-BIqqbJ6q.mjs} +48 -16
- package/dist/status-worker.mjs +1 -1
- package/dist/{stim-desktop-C12we7lz.mjs → stim-desktop-D5OGpYZM.mjs} +2 -2
- package/dist/{stop-Bk_1qiV6.mjs → stop-B18d8KDw.mjs} +2 -2
- package/dist/{stop-CPzlM1L-.mjs → stop-B2uLQfoM.mjs} +15 -16
- package/dist/{stop-D7h6jAXQ.mjs → stop-DzLJc7Ei.mjs} +31 -22
- package/dist/supervisor-run.d.mts +3 -3
- package/dist/supervisor-run.mjs +28 -36
- package/dist/{support-Dlu37g6H.mjs → support-BTpZ6RAJ.mjs} +15 -11
- package/dist/{support-67vraa1Q.mjs → support-DTBV56gy.mjs} +8 -8
- package/dist/swiftpm-artifact-inputs-DFcGsXDP.mjs +153 -0
- package/dist/swiftpm-macos-r_WSKlXr.mjs +532 -0
- package/dist/{toolchain-Hp9sCpK4.mjs → toolchain-CWeGJgCc.mjs} +9 -6
- package/dist/toolchain-GVgnf8d1.mjs +2 -0
- package/dist/{trigger-BAahxUPq.mjs → trigger-Cbyc41d_.mjs} +3 -3
- package/dist/trigger-yb_nFzPF.mjs +2 -0
- package/dist/{warm-progress-BHX5r0Ei.mjs → warm-progress-CA3TgT3-.mjs} +29 -16
- package/dist/web-Cduk0NSE.mjs +2 -0
- package/dist/{web-CJmIj6AI.mjs → web-CwREhjD-.mjs} +11 -10
- package/dist/web-run.mjs +11 -9
- package/dist/windows-report.mjs +1 -1
- package/dist/{workspace-state-Cjuigeeu.mjs → workspace-state-U08dEzhG.mjs} +3 -3
- package/dist/{workspaces-BccMFmGQ.mjs → workspaces-BxzYlo3P.mjs} +594 -266
- package/dist/{worktree-DQ6Zi2Mv.mjs → worktree-8lqn_lBp.mjs} +850 -551
- package/dist/worktree-BxfVxG_b.mjs +2 -0
- package/dist/{xcode-Zlx3qjEs.mjs → xcode-iQnROM5o.mjs} +5 -5
- package/package.json +7 -7
- package/shim/android-audio/Main.java +24 -0
- package/shim/android-audio/README.md +17 -0
- package/shim/android-audio.jar +0 -0
- package/dist/gc-C-WwL0yi.mjs +0 -3
- package/dist/git-C3iTsJaZ.mjs +0 -73
- package/dist/server-expo-C-90EhcG.mjs +0 -2
- package/dist/settings-DkdmlelE.d.mts +0 -15
- package/dist/swiftpm-macos-p8WZbxKU.mjs +0 -130
- package/dist/toolchain-DhKwp9iI.mjs +0 -2
- package/dist/trigger-Bf3uDcpv.mjs +0 -2
- package/dist/web-DknQETPs.mjs +0 -2
- package/dist/workspace-process-lock-1_1OoVW5.mjs +0 -57
- package/dist/worktree-CK2MpJW5.mjs +0 -2
|
@@ -1,15 +1,17 @@
|
|
|
1
|
-
import { f as
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import { i as
|
|
1
|
+
import { c as declareSpawnsOn, f as stopDeclaringSpawnsOn, g as process_identity_exports, r as WorkspaceProcessCleanupError, t as getExecutor, x as ownership_claim_exports } from "./exec-DEoAhcze.mjs";
|
|
2
|
+
import { C as saveConfig, D as withConfigLock$1, G as projectDeviceSlots, H as deviceSlotPlatforms, K as removeSlotDevice, O as withConfigLockAsync$1, _ as loadConfig$1, c as ensureConfig, d as getConfigDir, f as getConfigPath$1, z as assignSlotDevice } from "./config-DlrsduwG.mjs";
|
|
3
|
+
import { n as runOperationFileQuiet, t as runOperationFile, u as cancellableSleep } from "./operation-exec-BW0em61G.mjs";
|
|
4
|
+
import { c as androidDataPartitionSizeBytes } from "./settings-C7O8A6ZI.mjs";
|
|
5
|
+
import { c as pidExists, p as signalProcessTreeAsync } from "./metro-DiXtA3Ty.mjs";
|
|
6
|
+
import { i as recordCreatedDevice, r as readCreatedDevices$1, t as forgetCreatedDevice } from "./created-devices-x9rN6bhs.mjs";
|
|
7
|
+
import { i as stimDesktopInstalledAsync, n as settingDefault, t as STIM_DESKTOP_OPEN_OPTIONS } from "./stim-desktop-D5OGpYZM.mjs";
|
|
7
8
|
import { isDeepStrictEqual } from "node:util";
|
|
8
9
|
import { join } from "node:path";
|
|
9
10
|
import { ambientEnv, ambientWrite } from "@stim-cli/core";
|
|
10
11
|
import { ANDROID_EMULATOR_APPS, getParkedMax, isJsonObject, loadConfig, settingDefinition } from "@stim-cli/core/state";
|
|
11
12
|
import { dirname as dirname$1, isAbsolute as isAbsolute$1, join as join$1, resolve as resolve$1 } from "path";
|
|
12
13
|
import { existsSync, lstatSync, mkdirSync, openSync, readFileSync, readdirSync, realpathSync, renameSync, rmSync, statSync, writeFileSync } from "fs";
|
|
14
|
+
import { rm } from "node:fs/promises";
|
|
13
15
|
import { homedir, tmpdir } from "os";
|
|
14
16
|
//#region src/devices/sim-pool.ts
|
|
15
17
|
const POOL_SETTING_REMEDY = "Run `stim guide settings` for the device pool bounds and where it can be set.";
|
|
@@ -124,11 +126,11 @@ function claimParkedOperation(platform, udid) {
|
|
|
124
126
|
if (attempt.pending) (0, ownership_claim_exports.releaseClaim)(attempt.pending);
|
|
125
127
|
return attempt.acquired ?? null;
|
|
126
128
|
}
|
|
127
|
-
function removeParkedAfter(platform, udid, beforeRemove) {
|
|
128
|
-
return settleParkedAfter(platform, udid, beforeRemove, null);
|
|
129
|
+
function removeParkedAfter(platform, udid, beforeRemove, operation) {
|
|
130
|
+
return settleParkedAfter(platform, udid, beforeRemove, null, operation);
|
|
129
131
|
}
|
|
130
|
-
function eraseParkedAfter(platform, udid, erase) {
|
|
131
|
-
return settleParkedAfter(platform, udid, erase, erasedRecord);
|
|
132
|
+
function eraseParkedAfter(platform, udid, erase, operation) {
|
|
133
|
+
return settleParkedAfter(platform, udid, erase, erasedRecord, operation);
|
|
132
134
|
}
|
|
133
135
|
function erasedRecord(record) {
|
|
134
136
|
const erased = { ...record };
|
|
@@ -138,9 +140,12 @@ function erasedRecord(record) {
|
|
|
138
140
|
delete erased.schemeApprovals;
|
|
139
141
|
return erased;
|
|
140
142
|
}
|
|
141
|
-
async function settleParkedAfter(platform, udid, action, keep) {
|
|
143
|
+
async function settleParkedAfter(platform, udid, action, keep, operation) {
|
|
144
|
+
operation?.signal.throwIfAborted();
|
|
142
145
|
const claim = claimParkedOperation(platform, udid);
|
|
143
146
|
if (!claim) return null;
|
|
147
|
+
let retained = false;
|
|
148
|
+
if (operation) declareSpawnsOn(operation, claim);
|
|
144
149
|
try {
|
|
145
150
|
const claimed = await withConfigLockAsync$1(() => {
|
|
146
151
|
const cfg = loadConfig$1();
|
|
@@ -164,23 +169,30 @@ async function settleParkedAfter(platform, udid, action, keep) {
|
|
|
164
169
|
record,
|
|
165
170
|
marked
|
|
166
171
|
};
|
|
167
|
-
});
|
|
172
|
+
}, operation?.signal);
|
|
168
173
|
if (!claimed) return null;
|
|
169
174
|
let completed = false;
|
|
170
175
|
let started = false;
|
|
171
176
|
let settled = null;
|
|
172
177
|
try {
|
|
178
|
+
operation?.signal.throwIfAborted();
|
|
173
179
|
(0, ownership_claim_exports.markClaimChildPending)(claim);
|
|
174
180
|
try {
|
|
175
181
|
await action(claimed.record, () => {
|
|
176
182
|
started = true;
|
|
177
183
|
});
|
|
184
|
+
} catch (cause) {
|
|
185
|
+
if (cause instanceof WorkspaceProcessCleanupError || cause instanceof Error && "reportCleanup" in cause) {
|
|
186
|
+
retained = true;
|
|
187
|
+
throw Object.assign(new WorkspaceProcessCleanupError([.../* @__PURE__ */ new Set([claim, ...cause instanceof WorkspaceProcessCleanupError ? cause.claims : []])], cause.message, "Verify the parked-device operation and its descendants have stopped."), { reportCleanup: true });
|
|
188
|
+
}
|
|
189
|
+
throw cause;
|
|
178
190
|
} finally {
|
|
179
|
-
(0, ownership_claim_exports.clearClaimChild)(claim);
|
|
191
|
+
if (!retained) (0, ownership_claim_exports.clearClaimChild)(claim);
|
|
180
192
|
}
|
|
181
193
|
completed = true;
|
|
182
194
|
} finally {
|
|
183
|
-
await withConfigLockAsync$1(() => {
|
|
195
|
+
if (!retained) await withConfigLockAsync$1(() => {
|
|
184
196
|
const cfg = loadConfig$1();
|
|
185
197
|
if (!cfg) return;
|
|
186
198
|
const records = readParked(platform, { config: cfg });
|
|
@@ -194,11 +206,12 @@ async function settleParkedAfter(platform, udid, action, keep) {
|
|
|
194
206
|
}
|
|
195
207
|
return settled;
|
|
196
208
|
} finally {
|
|
197
|
-
(
|
|
209
|
+
if (operation) stopDeclaringSpawnsOn(operation, claim);
|
|
210
|
+
if (!retained) (0, ownership_claim_exports.releaseClaim)(claim);
|
|
198
211
|
}
|
|
199
212
|
}
|
|
200
|
-
async function dropParked(platform, udid) {
|
|
201
|
-
return await removeParkedAfter(platform, udid, () => {}) !== null;
|
|
213
|
+
async function dropParked(platform, udid, operation) {
|
|
214
|
+
return await removeParkedAfter(platform, udid, () => {}, operation) !== null;
|
|
202
215
|
}
|
|
203
216
|
//#endregion
|
|
204
217
|
//#region src/devices/device-ownership.ts
|
|
@@ -487,6 +500,16 @@ function listAvdDeviceProfiles() {
|
|
|
487
500
|
"-c"
|
|
488
501
|
], { timeoutMs: AVDMANAGER_LIST_TIMEOUT_MS }));
|
|
489
502
|
}
|
|
503
|
+
async function listAvdDeviceProfilesAsync({ signal } = {}) {
|
|
504
|
+
return parseAvdList(await getExecutor().runFileAsync(androidToolPath("avdmanager"), [
|
|
505
|
+
"list",
|
|
506
|
+
"device",
|
|
507
|
+
"-c"
|
|
508
|
+
], {
|
|
509
|
+
signal,
|
|
510
|
+
timeoutMs: AVDMANAGER_LIST_TIMEOUT_MS
|
|
511
|
+
}));
|
|
512
|
+
}
|
|
490
513
|
function sanitizeAvdLabel(label) {
|
|
491
514
|
return String(label).replace(/[^A-Za-z0-9._-]+/g, "-").replace(/^-+|-+$/g, "");
|
|
492
515
|
}
|
|
@@ -503,10 +526,12 @@ function ownedAvdName(label) {
|
|
|
503
526
|
return `stim-${clean.startsWith("stim-") ? clean.slice(5) : clean}`;
|
|
504
527
|
}
|
|
505
528
|
const AVDMANAGER_DELETE_TIMEOUT_MS = 12e4;
|
|
506
|
-
async function deleteAvd(avdName) {
|
|
529
|
+
async function deleteAvd(avdName, operation) {
|
|
530
|
+
operation?.signal.throwIfAborted();
|
|
507
531
|
if (!isStimOwnedAvd(avdName)) throw new Error(`Refusing to delete AVD "${avdName}": not a Stim-owned AVD; Stim has no record of creating it.`);
|
|
508
|
-
const
|
|
509
|
-
|
|
532
|
+
const env = operation?.env ?? ambientEnv();
|
|
533
|
+
const root = env.ANDROID_AVD_HOME ? void 0 : avdStorageRoots(env).find((candidate) => avdPathExists(join$1(candidate, `${avdName}.ini`)));
|
|
534
|
+
await runOperationFile(operation, getExecutor(), androidToolPath("avdmanager", process.platform, env), [
|
|
510
535
|
"delete",
|
|
511
536
|
"avd",
|
|
512
537
|
"-n",
|
|
@@ -514,6 +539,7 @@ async function deleteAvd(avdName) {
|
|
|
514
539
|
], {
|
|
515
540
|
timeoutMs: AVDMANAGER_DELETE_TIMEOUT_MS,
|
|
516
541
|
killSignal: "SIGKILL",
|
|
542
|
+
cwd: operation?.cwd,
|
|
517
543
|
...root ? { env: { ANDROID_AVD_HOME: root } } : {}
|
|
518
544
|
});
|
|
519
545
|
forgetCreatedDevice("android", avdName);
|
|
@@ -566,10 +592,12 @@ function listAvds({ timeoutMs = ANDROID_LISTING_TIMEOUT_MS } = {}) {
|
|
|
566
592
|
killSignal: "SIGKILL"
|
|
567
593
|
}));
|
|
568
594
|
}
|
|
569
|
-
async function listAvdsAsync({ timeoutMs = ANDROID_LISTING_TIMEOUT_MS } = {}) {
|
|
570
|
-
return parseAvdList(await getExecutor()
|
|
595
|
+
async function listAvdsAsync({ timeoutMs = ANDROID_LISTING_TIMEOUT_MS, signal, operation } = {}) {
|
|
596
|
+
return parseAvdList(await runOperationFile(operation, getExecutor(), androidToolPath("emulator", process.platform, operation?.env), ["-list-avds"], {
|
|
571
597
|
timeoutMs,
|
|
572
|
-
killSignal: "SIGKILL"
|
|
598
|
+
killSignal: "SIGKILL",
|
|
599
|
+
signal,
|
|
600
|
+
cwd: operation?.cwd
|
|
573
601
|
}));
|
|
574
602
|
}
|
|
575
603
|
/**
|
|
@@ -590,11 +618,12 @@ function listAdbDevices({ timeoutMs = ANDROID_LISTING_TIMEOUT_MS, platform = pro
|
|
|
590
618
|
cwd: androidToolCwd(platform)
|
|
591
619
|
}));
|
|
592
620
|
}
|
|
593
|
-
async function listAdbDevicesAsync({ timeoutMs = ANDROID_LISTING_TIMEOUT_MS, platform = process.platform } = {}) {
|
|
594
|
-
return parseAdbDevices(await getExecutor()
|
|
621
|
+
async function listAdbDevicesAsync({ timeoutMs = ANDROID_LISTING_TIMEOUT_MS, platform = process.platform, signal, operation } = {}) {
|
|
622
|
+
return parseAdbDevices(await runOperationFile(operation, getExecutor(), androidToolPath("adb", platform, operation?.env), ["devices"], {
|
|
595
623
|
timeoutMs,
|
|
596
624
|
killSignal: "SIGKILL",
|
|
597
|
-
cwd: androidToolCwd(platform)
|
|
625
|
+
cwd: androidToolCwd(platform) ?? operation?.cwd,
|
|
626
|
+
signal
|
|
598
627
|
}));
|
|
599
628
|
}
|
|
600
629
|
const ADB_PROP_TIMEOUT_MS = 5e3;
|
|
@@ -851,11 +880,14 @@ const AVD_USER_DATA = [
|
|
|
851
880
|
"cache.img.qcow2",
|
|
852
881
|
"snapshots"
|
|
853
882
|
];
|
|
854
|
-
function wipeAvdUserData(directory) {
|
|
855
|
-
for (const name of AVD_USER_DATA)
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
883
|
+
async function wipeAvdUserData(directory, signal) {
|
|
884
|
+
for (const name of AVD_USER_DATA) {
|
|
885
|
+
signal?.throwIfAborted();
|
|
886
|
+
await rm(join$1(directory, name), {
|
|
887
|
+
recursive: true,
|
|
888
|
+
force: true
|
|
889
|
+
});
|
|
890
|
+
}
|
|
859
891
|
}
|
|
860
892
|
function withAvdConfigOverrides(contents, overrides) {
|
|
861
893
|
const newline = contents.includes("\r\n") ? "\r\n" : "\n";
|
|
@@ -1214,27 +1246,42 @@ async function waitForBoot(serial, timeoutMs = 6e4, { aborted = () => false, pol
|
|
|
1214
1246
|
}
|
|
1215
1247
|
const ANDROID_EMULATOR_SHUTDOWN_TIMEOUT_MS = 6e4;
|
|
1216
1248
|
const ANDROID_EMULATOR_SHUTDOWN_POLL_MS = 100;
|
|
1217
|
-
async function shutdownAndroidEmulator(serial, timeoutMs = ANDROID_EMULATOR_SHUTDOWN_TIMEOUT_MS) {
|
|
1249
|
+
async function shutdownAndroidEmulator(serial, timeoutMs = ANDROID_EMULATOR_SHUTDOWN_TIMEOUT_MS, operation) {
|
|
1218
1250
|
const exec = getExecutor();
|
|
1219
1251
|
const started = Date.now();
|
|
1220
|
-
|
|
1252
|
+
const run = async (args, budget) => {
|
|
1253
|
+
const options = {
|
|
1254
|
+
timeoutMs: budget,
|
|
1255
|
+
killSignal: "SIGKILL"
|
|
1256
|
+
};
|
|
1257
|
+
if (!operation) return exec.runFileQuietAsync(androidToolPath("adb"), args, options);
|
|
1258
|
+
try {
|
|
1259
|
+
return await runOperationFile(operation, exec, androidToolPath("adb", process.platform, operation.env), args, {
|
|
1260
|
+
...options,
|
|
1261
|
+
cwd: operation.cwd
|
|
1262
|
+
});
|
|
1263
|
+
} catch (cause) {
|
|
1264
|
+
if (cause instanceof WorkspaceProcessCleanupError) throw cause;
|
|
1265
|
+
operation.signal.throwIfAborted();
|
|
1266
|
+
return null;
|
|
1267
|
+
}
|
|
1268
|
+
};
|
|
1269
|
+
if (await run([
|
|
1221
1270
|
"-s",
|
|
1222
1271
|
serial,
|
|
1223
1272
|
"shell",
|
|
1224
1273
|
"sync"
|
|
1225
|
-
], {
|
|
1226
|
-
|
|
1227
|
-
|
|
1228
|
-
|
|
1229
|
-
|
|
1274
|
+
], Math.min(5e3, timeoutMs)) === null) {
|
|
1275
|
+
const warning = `warning: could not flush ${serial} before shutdown; shutting it down anyway\n`;
|
|
1276
|
+
if (operation) operation.output("stderr", warning);
|
|
1277
|
+
else ambientWrite("stderr", warning);
|
|
1278
|
+
}
|
|
1279
|
+
await run([
|
|
1230
1280
|
"-s",
|
|
1231
1281
|
serial,
|
|
1232
1282
|
"emu",
|
|
1233
1283
|
"kill"
|
|
1234
|
-
],
|
|
1235
|
-
timeoutMs: Math.max(1, timeoutMs - (Date.now() - started)),
|
|
1236
|
-
killSignal: "SIGKILL"
|
|
1237
|
-
});
|
|
1284
|
+
], Math.max(1, timeoutMs - (Date.now() - started)));
|
|
1238
1285
|
}
|
|
1239
1286
|
function avdProcessLockPaths(avdDirectory, platform) {
|
|
1240
1287
|
return ["hardware-qemu.ini.lock", "userdata-qemu.img.lock"].map((name) => join$1(avdDirectory, name, ...platform === "win32" ? ["pid"] : []));
|
|
@@ -1286,9 +1333,9 @@ function listAvdEmulatorProcesses(avdName, platform) {
|
|
|
1286
1333
|
], { timeoutMs: 5e3 });
|
|
1287
1334
|
return out === null ? null : parseAvdEmulatorProcesses(out, avdName);
|
|
1288
1335
|
}
|
|
1289
|
-
async function listAvdEmulatorProcessesAsync(avdName, platform) {
|
|
1336
|
+
async function listAvdEmulatorProcessesAsync(avdName, platform, operation) {
|
|
1290
1337
|
if (platform === "win32") return [];
|
|
1291
|
-
const out = await getExecutor()
|
|
1338
|
+
const out = await runOperationFileQuiet(operation, getExecutor(), "ps", [
|
|
1292
1339
|
"-axww",
|
|
1293
1340
|
"-o",
|
|
1294
1341
|
"pid=,command="
|
|
@@ -1320,14 +1367,36 @@ function assertOwnedAvdStopped(avdName, { processAlive = emulatorProcessRunning,
|
|
|
1320
1367
|
if (processId !== null && processAlive(processId)) live.add(processId);
|
|
1321
1368
|
if (live.size) throw new Error(`Owned AVD ${avdName} still has a live emulator process (${[...live].join(", ")}).`);
|
|
1322
1369
|
}
|
|
1370
|
+
/** Async stopped-emulator verification; cancellation and unresolved probe cleanup propagate. */
|
|
1371
|
+
async function assertOwnedAvdStoppedAsync(avdName, operation, resolveDirectory = ownedAvdDirectory) {
|
|
1372
|
+
operation?.signal.throwIfAborted();
|
|
1373
|
+
const { processId } = resolveAvdProcess(avdName, { resolveDirectory });
|
|
1374
|
+
const processes = await listAvdEmulatorProcessesAsync(avdName, process.platform, operation);
|
|
1375
|
+
if (processes === null) throw new Error(`Could not read the process table to verify that owned AVD ${avdName} stopped.`);
|
|
1376
|
+
const live = new Set(processes);
|
|
1377
|
+
if (processId !== null && pidExists(processId)) {
|
|
1378
|
+
const stat = process.platform === "win32" ? null : await runOperationFileQuiet(operation, getExecutor(), "ps", [
|
|
1379
|
+
"-o",
|
|
1380
|
+
"stat=",
|
|
1381
|
+
"-p",
|
|
1382
|
+
String(processId)
|
|
1383
|
+
], {
|
|
1384
|
+
timeoutMs: 5e3,
|
|
1385
|
+
killSignal: "SIGKILL",
|
|
1386
|
+
cwd: operation?.cwd
|
|
1387
|
+
});
|
|
1388
|
+
if (stat === null || !stat.trim().startsWith("Z")) live.add(processId);
|
|
1389
|
+
}
|
|
1390
|
+
if (live.size) throw new Error(`Owned AVD ${avdName} still has a live emulator process (${[...live].join(", ")}).`);
|
|
1391
|
+
}
|
|
1323
1392
|
const CRASH_HANDLER_EXIT_TIMEOUT_MS = 15e3;
|
|
1324
1393
|
/**
|
|
1325
1394
|
* The crashpad handler qemu forks on Windows. It outlives an emulator that crashes on exit while
|
|
1326
1395
|
* it writes the dump, so a `stop` that returns on qemu's exit leaves it running.
|
|
1327
1396
|
* https://github.com/appandflow/stim/issues/918
|
|
1328
1397
|
*/
|
|
1329
|
-
async function emulatorCrashHandlerPids(qemuPid) {
|
|
1330
|
-
const out = await getExecutor()
|
|
1398
|
+
async function emulatorCrashHandlerPids(qemuPid, operation) {
|
|
1399
|
+
const out = await runOperationFileQuiet(operation, getExecutor(), "powershell.exe", [
|
|
1331
1400
|
"-NoProfile",
|
|
1332
1401
|
"-NonInteractive",
|
|
1333
1402
|
"-Command",
|
|
@@ -1346,14 +1415,26 @@ const EMULATOR_SIGNAL_GRACE_MS = 5e3;
|
|
|
1346
1415
|
* grace, but only a process whose command line names this AVD and whose identity, captured before
|
|
1347
1416
|
* shutdown, still matches. Windows has no process-table scan, so there nothing is signalled.
|
|
1348
1417
|
*/
|
|
1349
|
-
async function waitForAndroidEmulatorShutdown(avdName, shutdown, { timeoutMs = ANDROID_EMULATOR_SHUTDOWN_TIMEOUT_MS, pollMs = ANDROID_EMULATOR_SHUTDOWN_POLL_MS, signalGraceMs = EMULATOR_SIGNAL_GRACE_MS, platform = process.platform, resolveDirectory = ownedAvdDirectory, readProcessId = readAvdProcessId, processAlive = pidExists, listProcesses = listAvdEmulatorProcessesAsync, captureIdentity = process_identity_exports.captureProcessIdentity, inspectIdentity = process_identity_exports.inspectProcessIdentity, signal = (pid, name) => signalProcessTreeAsync(pid, name, {
|
|
1418
|
+
async function waitForAndroidEmulatorShutdown(avdName, shutdown, { operation, timeoutMs = ANDROID_EMULATOR_SHUTDOWN_TIMEOUT_MS, pollMs = ANDROID_EMULATOR_SHUTDOWN_POLL_MS, signalGraceMs = EMULATOR_SIGNAL_GRACE_MS, platform = process.platform, resolveDirectory = ownedAvdDirectory, readProcessId = readAvdProcessId, processAlive = pidExists, listProcesses = (name, host) => listAvdEmulatorProcessesAsync(name, host, operation), captureIdentity = process_identity_exports.captureProcessIdentity, inspectIdentity = process_identity_exports.inspectProcessIdentity, signal = (pid, name) => signalProcessTreeAsync(pid, name, {
|
|
1419
|
+
platform,
|
|
1420
|
+
operation
|
|
1421
|
+
}), directoryExists = (path) => statSync(path).isDirectory(), crashHandlerPids = (pid) => emulatorCrashHandlerPids(pid, operation), killCrashHandler = (pid) => signalProcessTreeAsync(pid, "SIGKILL", {
|
|
1422
|
+
platform,
|
|
1423
|
+
operation
|
|
1424
|
+
}), now = Date.now, sleep = (ms) => cancellableSleep(ms, {
|
|
1425
|
+
signal: operation?.signal,
|
|
1426
|
+
what: "emulator shutdown"
|
|
1427
|
+
}) } = {}) {
|
|
1428
|
+
operation?.signal.throwIfAborted();
|
|
1350
1429
|
const { directory, processId } = resolveAvdProcess(avdName, {
|
|
1351
1430
|
platform,
|
|
1352
1431
|
resolveDirectory,
|
|
1353
1432
|
readProcessId
|
|
1354
1433
|
});
|
|
1355
1434
|
const scan = async () => {
|
|
1435
|
+
operation?.signal.throwIfAborted();
|
|
1356
1436
|
const pids = await listProcesses(avdName, platform);
|
|
1437
|
+
operation?.signal.throwIfAborted();
|
|
1357
1438
|
if (pids === null) throw new Error(`Could not read the process table to verify that owned AVD ${avdName} stopped.`);
|
|
1358
1439
|
return pids;
|
|
1359
1440
|
};
|
|
@@ -1382,6 +1463,7 @@ async function waitForAndroidEmulatorShutdown(avdName, shutdown, { timeoutMs = A
|
|
|
1382
1463
|
};
|
|
1383
1464
|
const waitUntil = async (until) => {
|
|
1384
1465
|
for (;;) {
|
|
1466
|
+
operation?.signal.throwIfAborted();
|
|
1385
1467
|
if (running().length === 0) return true;
|
|
1386
1468
|
const remaining = until - now();
|
|
1387
1469
|
if (remaining <= 0) return false;
|
|
@@ -1396,14 +1478,18 @@ async function waitForAndroidEmulatorShutdown(avdName, shutdown, { timeoutMs = A
|
|
|
1396
1478
|
await waitUntil(deadline);
|
|
1397
1479
|
}
|
|
1398
1480
|
for (const name of ["SIGTERM", "SIGKILL"]) {
|
|
1481
|
+
operation?.signal.throwIfAborted();
|
|
1399
1482
|
const verified = running().filter((pid) => {
|
|
1400
1483
|
const record = identities.get(pid);
|
|
1401
1484
|
return record && inspectIdentity(record) === "same";
|
|
1402
1485
|
});
|
|
1403
1486
|
if (verified.length === 0) break;
|
|
1404
|
-
for (const pid of verified)
|
|
1405
|
-
|
|
1406
|
-
|
|
1487
|
+
for (const pid of verified) {
|
|
1488
|
+
operation?.signal.throwIfAborted();
|
|
1489
|
+
try {
|
|
1490
|
+
await signal(pid, name);
|
|
1491
|
+
} catch {}
|
|
1492
|
+
}
|
|
1407
1493
|
const graceMs = name === "SIGTERM" && !shutdown ? timeoutMs : signalGraceMs;
|
|
1408
1494
|
if (await waitUntil(now() + graceMs)) break;
|
|
1409
1495
|
}
|
|
@@ -1424,7 +1510,11 @@ async function waitForAndroidEmulatorShutdown(avdName, shutdown, { timeoutMs = A
|
|
|
1424
1510
|
if (platform === "win32" && processId !== null) {
|
|
1425
1511
|
const handlerDeadline = now() + CRASH_HANDLER_EXIT_TIMEOUT_MS;
|
|
1426
1512
|
for (const handler of await crashHandlerPids(processId)) {
|
|
1427
|
-
while (processAlive(handler) && now() < handlerDeadline)
|
|
1513
|
+
while (processAlive(handler) && now() < handlerDeadline) {
|
|
1514
|
+
operation?.signal.throwIfAborted();
|
|
1515
|
+
await sleep(pollMs);
|
|
1516
|
+
}
|
|
1517
|
+
operation?.signal.throwIfAborted();
|
|
1428
1518
|
if (processAlive(handler)) {
|
|
1429
1519
|
await killCrashHandler(handler);
|
|
1430
1520
|
if (processAlive(handler)) throw new Error(`Crashpad handler ${handler} for owned AVD ${avdName} stayed alive.`);
|
|
@@ -1448,17 +1538,22 @@ function getAvdNameForSerial(serial, { timeoutMs = EMU_AVD_NAME_TIMEOUT_MS } = {
|
|
|
1448
1538
|
if (!out) return null;
|
|
1449
1539
|
return out.split("\n")[0]?.trim() || null;
|
|
1450
1540
|
}
|
|
1451
|
-
async function getAvdNameForSerialAsync(serial, { timeoutMs = EMU_AVD_NAME_TIMEOUT_MS } = {}) {
|
|
1452
|
-
const
|
|
1541
|
+
async function getAvdNameForSerialAsync(serial, { timeoutMs = EMU_AVD_NAME_TIMEOUT_MS, signal, operation } = {}) {
|
|
1542
|
+
const tool = androidToolPath("adb", process.platform, operation?.env);
|
|
1543
|
+
const args = [
|
|
1453
1544
|
"-s",
|
|
1454
1545
|
serial,
|
|
1455
1546
|
"emu",
|
|
1456
1547
|
"avd",
|
|
1457
1548
|
"name"
|
|
1458
|
-
]
|
|
1549
|
+
];
|
|
1550
|
+
const options = {
|
|
1459
1551
|
timeoutMs: Math.min(timeoutMs, EMU_AVD_NAME_TIMEOUT_MS),
|
|
1460
|
-
killSignal: "SIGKILL"
|
|
1461
|
-
|
|
1552
|
+
killSignal: "SIGKILL",
|
|
1553
|
+
signal,
|
|
1554
|
+
cwd: androidToolCwd() ?? operation?.cwd
|
|
1555
|
+
};
|
|
1556
|
+
const out = await runOperationFileQuiet(operation, getExecutor(), tool, args, options);
|
|
1462
1557
|
if (!out) return null;
|
|
1463
1558
|
return out.split("\n")[0]?.trim() || null;
|
|
1464
1559
|
}
|
|
@@ -1467,9 +1562,13 @@ async function resolveOwnedAvdSerialAsync(avdName, opts = {}) {
|
|
|
1467
1562
|
return ownedAvdSerialResolverAsync(opts)(avdName);
|
|
1468
1563
|
}
|
|
1469
1564
|
/** Shares bounded asynchronous AVD, adb and emulator-name reads across the requested AVDs. */
|
|
1470
|
-
function ownedAvdSerialResolverAsync({ timeoutMs } = {}) {
|
|
1565
|
+
function ownedAvdSerialResolverAsync({ timeoutMs, signal, operation } = {}) {
|
|
1471
1566
|
const started = Date.now();
|
|
1472
|
-
const remaining = () => ({
|
|
1567
|
+
const remaining = () => ({
|
|
1568
|
+
signal,
|
|
1569
|
+
operation,
|
|
1570
|
+
timeoutMs: timeoutMs === void 0 ? void 0 : Math.max(MIN_LOOKUP_TIMEOUT_MS, timeoutMs - (Date.now() - started))
|
|
1571
|
+
});
|
|
1473
1572
|
const avds = once(() => listAvdsAsync(remaining()));
|
|
1474
1573
|
const adb = once(() => listAdbDevicesAsync(remaining()));
|
|
1475
1574
|
const names = /* @__PURE__ */ new Map();
|
|
@@ -1482,9 +1581,11 @@ function ownedAvdSerialResolverAsync({ timeoutMs } = {}) {
|
|
|
1482
1581
|
return name;
|
|
1483
1582
|
};
|
|
1484
1583
|
return async (avdName) => {
|
|
1584
|
+
signal?.throwIfAborted();
|
|
1485
1585
|
if (!(await avds()).includes(avdName)) return { missing: true };
|
|
1486
1586
|
if (!isStimOwnedAvd(avdName)) return { notOwned: true };
|
|
1487
1587
|
const devices = await adb();
|
|
1588
|
+
signal?.throwIfAborted();
|
|
1488
1589
|
const candidates = [...devices.emulators, ...devices.unhealthy.filter((entry) => entry.kind === "emulator" && entry.consolePort !== void 0)];
|
|
1489
1590
|
for (const candidate of candidates) if (await avdNameOf(candidate.serial) === avdName) return { serial: candidate.serial };
|
|
1490
1591
|
return { notRunning: true };
|
|
@@ -1530,4 +1631,4 @@ function ownedAvdSerialResolver({ timeoutMs } = {}) {
|
|
|
1530
1631
|
};
|
|
1531
1632
|
}
|
|
1532
1633
|
//#endregion
|
|
1533
|
-
export {
|
|
1634
|
+
export { resetAdoptedAvd as $, listAdbDevices as A, ownedAvdDeviceProfile as B, emulatorDiskSpaceRemedy as C, getAvdNameForSerial as D, findBuildTool as E, listAvdsAsync as F, ownedAvdSerialResolverAsync as G, ownedAvdMatchesConfiguration as H, listInstalledSystemImages as I, parseAvdSystemImage as J, ownedAvdSystemImage as K, listOrphanedAvdDirectories as L, listAvdDeviceProfiles as M, listAvdDeviceProfilesAsync as N, getAvdNameForSerialAsync as O, listAvds as P, profileNeedsFoldFeature as Q, memoizeEmulatorProbe as R, deleteAvd as S, extractEmulatorFailure as T, ownedAvdName as U, ownedAvdDirectory as V, ownedAvdSerialResolver as W, pickDefaultSystemImage as X, physicalDeviceModel as Y, probeEmulatorSerial as Z, avdPoolConfiguration as _, parkedMaxSetting as _t, androidDeviceAbi as a, waitForAndroidEmulatorShutdown as at, configureNewOwnedAvd as b, selectParked as bt, androidPoolNoCandidatesRefusal as c, configuredAndroidEmulatorApp as ct, androidToolPath as d, POOL_SETTING_REMEDY as dt, resolveOwnedAvdSerialAsync as et, assertOwnedAvdStopped as f, adoptParked as ft, avdPathExists as g, parkSim as gt, avdNameAbsent as h, isLegacyDeletionClaim as ht, androidDataFreeBytes as i, trimAndroidCaches as it, listAdbDevicesAsync as j, hostSystemImageArch as k, androidSystemImageAbi as l, isStimOwnedAvd as lt, avdIniPaths as m, eraseParkedAfter as mt, OWNED_AVD_CONFIG_DEFAULTS as n, shutdownAndroidEmulator as nt, androidHome as o, waitForBoot as ot, assertOwnedAvdStoppedAsync as p, dropParked as pt, parseAvdDeviceProfile as q, androidBuildToolName as r, systemImageSupportsFold as rt, androidPoolCandidates as s, wipeAvdUserData as st, DEFAULT_AVD_DEVICE_PROFILE as t, resolvePhysicalDevice as tt, androidToolCwd as u, isStimOwnedSim as ut, avdStorageRoots as v, readParked as vt, emulatorFailureRemedy as w, createOwnedAvd as x, bootAndroidEmulator as y, removeParkedAfter as yt, nextConsolePort as z };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { i as formatDuration, l as phaseLine, m as shortHash } from "./command-output-
|
|
2
|
-
import { E as resolveVariant, T as resolveSystemImage, _ as findAapt, b as noDeviceDiagnostic, d as androidVariantSetting, f as apkDevClientFacts, g as dumpApkManifest, h as displayPath, i as NO_FINGERPRINT, p as apkPackage, r as NO_DEVICE, s as androidDevClientScheme, u as androidSystemImageSetting, x as parseXmltree, y as isReleaseVariant } from "./support-
|
|
3
|
-
import { r as lastBuildRecord, t as androidFacts } from "./result-
|
|
4
|
-
import { i as runAndroidOperation, n as registerAndroid, r as runAndroid, t as androidCommand } from "./android-
|
|
5
|
-
import { a as killPreviousCollector, i as collectorLogFile, o as startCollector } from "./launch-
|
|
1
|
+
import { i as formatDuration, l as phaseLine, m as shortHash } from "./command-output-Db8BqzxH.mjs";
|
|
2
|
+
import { E as resolveVariant, T as resolveSystemImage, _ as findAapt, b as noDeviceDiagnostic, d as androidVariantSetting, f as apkDevClientFacts, g as dumpApkManifest, h as displayPath, i as NO_FINGERPRINT, p as apkPackage, r as NO_DEVICE, s as androidDevClientScheme, u as androidSystemImageSetting, x as parseXmltree, y as isReleaseVariant } from "./support-DTBV56gy.mjs";
|
|
3
|
+
import { r as lastBuildRecord, t as androidFacts } from "./result-Cx5CRLvS.mjs";
|
|
4
|
+
import { i as runAndroidOperation, n as registerAndroid, r as runAndroid, t as androidCommand } from "./android-BoUJKbfz.mjs";
|
|
5
|
+
import { a as killPreviousCollector, i as collectorLogFile, o as startCollector } from "./launch-Bz7JtaC4.mjs";
|
|
6
6
|
export { NO_DEVICE, NO_FINGERPRINT, androidDevClientScheme, androidFacts, androidSystemImageSetting, androidVariantSetting, apkDevClientFacts, apkPackage, collectorLogFile, androidCommand as default, displayPath, dumpApkManifest, findAapt, formatDuration, isReleaseVariant, killPreviousCollector, lastBuildRecord, noDeviceDiagnostic, parseXmltree, phaseLine, registerAndroid, resolveSystemImage, resolveVariant, runAndroid, runAndroidOperation, shortHash, startCollector };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { t as getExecutor } from "./exec-
|
|
2
|
-
import { u as androidToolCwd } from "./android-
|
|
1
|
+
import { t as getExecutor } from "./exec-DEoAhcze.mjs";
|
|
2
|
+
import { u as androidToolCwd } from "./android-C7sVmyI9.mjs";
|
|
3
3
|
//#region src/collector/android.ts
|
|
4
4
|
const LEVEL_BY_LETTER = {
|
|
5
5
|
V: "debug",
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { t as getExecutor } from "./exec-
|
|
2
|
+
import { t as getExecutor } from "./exec-DEoAhcze.mjs";
|
|
3
3
|
import { createHash, randomUUID } from "node:crypto";
|
|
4
4
|
import { appendFileSync, existsSync, mkdirSync, readFileSync, renameSync, writeFileSync } from "node:fs";
|
|
5
5
|
import { join } from "node:path";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { n as ensureWorkspaceStorage, v as withDirLock$1 } from "./paths-DQtTgsBf.mjs";
|
|
2
|
-
import { d as getConfigDir } from "./config-
|
|
3
|
-
import { m as defaultAndroidLayout } from "./settings-
|
|
4
|
-
import { r as register } from "./cache-manifest-
|
|
2
|
+
import { d as getConfigDir } from "./config-DlrsduwG.mjs";
|
|
3
|
+
import { m as defaultAndroidLayout } from "./settings-C7O8A6ZI.mjs";
|
|
4
|
+
import { r as register } from "./cache-manifest-DSeQjt-Q.mjs";
|
|
5
5
|
import { createHash, randomUUID } from "node:crypto";
|
|
6
6
|
import { accessSync, constants, existsSync, mkdirSync, readFileSync, realpathSync, renameSync, statSync, writeFileSync } from "node:fs";
|
|
7
7
|
import { join } from "node:path";
|
|
@@ -1,11 +1,15 @@
|
|
|
1
|
-
import "./
|
|
2
|
-
import "./exec-
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
1
|
+
import { n as SettingsObject, t as AndroidLayout } from "./ios-CDvlmUs7.mjs";
|
|
2
|
+
import { r as createNdjsonWriter } from "./exec-DnYc4HGH.mjs";
|
|
3
|
+
import { readFileSync, writeFileSync } from "node:fs";
|
|
4
|
+
import { StimContext, hostSimulatorArch } from "@stim-cli/core";
|
|
5
|
+
import { ANDROID_EMULATOR_APPS, BuildPhase, BuildPlanPayload, Endpoint, RunEstimates, SettingScope, WebViewport, machineCapacity } from "@stim-cli/core/state";
|
|
5
6
|
import "@stim-cli/core/noise-session";
|
|
6
|
-
import { readFileSync } from "fs";
|
|
7
|
+
import { readFileSync as readFileSync$1 } from "fs";
|
|
8
|
+
import { Command } from "commander";
|
|
7
9
|
import "@expo/fingerprint";
|
|
8
|
-
import {
|
|
10
|
+
import { CacheProviderConfig, loadCacheProvider } from "@stim-cli/cache";
|
|
11
|
+
import { BuildReactNativeArtifactQuery, BuildSwiftpmArtifactQuery, GradleOffloadInputs, HelloResult } from "@stim-cli/core/protocol";
|
|
12
|
+
import { ChildProcess } from "node:child_process";
|
|
9
13
|
//#region src/engine/build-facts.d.ts
|
|
10
14
|
type CacheHitLevel = "local" | "remote" | false;
|
|
11
15
|
type LaunchStatus = boolean | "unverified" | "bundling";
|
|
@@ -143,6 +147,23 @@ interface CompilerCacheFallback {
|
|
|
143
147
|
fromEnvironment: boolean;
|
|
144
148
|
manifest: string | null;
|
|
145
149
|
}
|
|
150
|
+
declare function artifactCachePolicy(options: Optimizations, reuse: boolean, release: boolean): {
|
|
151
|
+
read: boolean;
|
|
152
|
+
write: boolean;
|
|
153
|
+
remote: boolean;
|
|
154
|
+
};
|
|
155
|
+
//#endregion
|
|
156
|
+
//#region src/engine/android-cas.d.ts
|
|
157
|
+
interface AndroidCasSetup {
|
|
158
|
+
id: string;
|
|
159
|
+
dir: string;
|
|
160
|
+
initScript: string;
|
|
161
|
+
env: Record<string, string>;
|
|
162
|
+
}
|
|
163
|
+
declare function resolveAndroidCas(root: string, env?: NodeJS.ProcessEnv, layout?: AndroidLayout): AndroidCasSetup | null;
|
|
164
|
+
//#endregion
|
|
165
|
+
//#region src/commands/android/types.d.ts
|
|
166
|
+
type AndroidWriter = ReturnType<typeof createNdjsonWriter>;
|
|
146
167
|
//#endregion
|
|
147
168
|
//#region src/diagnostics/doctor.d.ts
|
|
148
169
|
interface Finding {
|
|
@@ -154,7 +175,73 @@ interface Finding {
|
|
|
154
175
|
}
|
|
155
176
|
type DoctorPlatform = "ios" | "android";
|
|
156
177
|
//#endregion
|
|
178
|
+
//#region src/budget.d.ts
|
|
179
|
+
type ReclaimStepName = "idle-devices" | "idle-dev-servers" | "workspace-outputs" | "stale-cache-entries";
|
|
180
|
+
interface ReclaimedStep {
|
|
181
|
+
step: ReclaimStepName;
|
|
182
|
+
targets: string[];
|
|
183
|
+
failures: number;
|
|
184
|
+
freedMb?: number;
|
|
185
|
+
}
|
|
186
|
+
interface BudgetReport {
|
|
187
|
+
budget: {
|
|
188
|
+
minFreeDiskGb: number;
|
|
189
|
+
hardFloorDiskGb: number;
|
|
190
|
+
maxCommittedMemoryGb: number;
|
|
191
|
+
maxLiveWorkspaces: number;
|
|
192
|
+
};
|
|
193
|
+
volumes: {
|
|
194
|
+
volume: string;
|
|
195
|
+
freeGb: number;
|
|
196
|
+
}[];
|
|
197
|
+
memory: {
|
|
198
|
+
committedGb: number;
|
|
199
|
+
liveWorkspaces: number;
|
|
200
|
+
} | null;
|
|
201
|
+
plan: ReclaimedStep[];
|
|
202
|
+
}
|
|
203
|
+
//#endregion
|
|
204
|
+
//#region src/commands/android/plan.d.ts
|
|
205
|
+
interface AndroidBuildPlan {
|
|
206
|
+
readonly build: {
|
|
207
|
+
readonly variant: string | null;
|
|
208
|
+
readonly release: boolean;
|
|
209
|
+
readonly profile: string | undefined;
|
|
210
|
+
readonly cas: ReturnType<typeof resolveAndroidCas>;
|
|
211
|
+
readonly cache: Readonly<ReturnType<typeof artifactCachePolicy>>;
|
|
212
|
+
readonly compilerCache: Optimizations["android"]["compilerCache"];
|
|
213
|
+
readonly gradleBuildCache: boolean;
|
|
214
|
+
readonly pch: Optimizations["android"]["pch"];
|
|
215
|
+
readonly targetAbiOnly: boolean;
|
|
216
|
+
};
|
|
217
|
+
readonly metroWarmup: boolean;
|
|
218
|
+
readonly cacheProviderConfig: CacheProviderConfig | null;
|
|
219
|
+
}
|
|
220
|
+
//#endregion
|
|
157
221
|
//#region src/offload/toolchain.d.ts
|
|
222
|
+
/** What must be identical on this Mac and a remote Mac for an iOS simulator build to come out the same. */
|
|
223
|
+
interface IosToolchain {
|
|
224
|
+
/** A digest of Stim's built code, so both sides prove they run the same Stim. */
|
|
225
|
+
stimBuild: string | null;
|
|
226
|
+
arch: string;
|
|
227
|
+
xcode: string | null;
|
|
228
|
+
simulatorSdk: string | null;
|
|
229
|
+
cocoapods: string | null;
|
|
230
|
+
}
|
|
231
|
+
/** A remote machine's toolchain, the simulator runtimes it can build for, and its JDK and Android SDK packages. */
|
|
232
|
+
interface WorkerToolchain extends IosToolchain {
|
|
233
|
+
/** The OS stim-server runs on, as Node names it; absent from a stim-server older than this field. */
|
|
234
|
+
os?: string;
|
|
235
|
+
macosSdk: string | null;
|
|
236
|
+
bundler: string | null;
|
|
237
|
+
runtimes: string[];
|
|
238
|
+
jdk: string | null;
|
|
239
|
+
androidSdk: {
|
|
240
|
+
ndk: string[];
|
|
241
|
+
buildTools: string[];
|
|
242
|
+
platforms: string[];
|
|
243
|
+
} | null;
|
|
244
|
+
}
|
|
158
245
|
/** One reason a remote machine cannot take this build now, with a stable `code` for doctor's JSON. */
|
|
159
246
|
interface OffloadProblem {
|
|
160
247
|
code: "unreachable" | "checkout" | "stim-build" | "arch" | "xcode" | "macos-sdk" | "simulator-sdk" | "cocoapods" | "bundler" | "runtime" | "jdk" | "android-sdk" | "ndk" | "build-tools" | "compile-sdk" | "disk" | "busy" | "platform";
|
|
@@ -250,4 +337,55 @@ interface AndroidBuildOptions {
|
|
|
250
337
|
module?: string | null;
|
|
251
338
|
}
|
|
252
339
|
//#endregion
|
|
253
|
-
|
|
340
|
+
//#region src/integrations/swiftpm-artifact-inputs.d.ts
|
|
341
|
+
interface SwiftpmArtifactToolchain {
|
|
342
|
+
swift: string;
|
|
343
|
+
sdk: string;
|
|
344
|
+
arch: string;
|
|
345
|
+
xcode: string;
|
|
346
|
+
}
|
|
347
|
+
//#endregion
|
|
348
|
+
//#region src/web/launch.d.ts
|
|
349
|
+
type WebLaunched = true | "bundling" | "unverified";
|
|
350
|
+
//#endregion
|
|
351
|
+
//#region src/integrations/native-gradle-artifact-inputs.d.ts
|
|
352
|
+
interface GradleArtifactInputs extends GradleOffloadInputs {
|
|
353
|
+
localFiles: string[];
|
|
354
|
+
environment: string[];
|
|
355
|
+
}
|
|
356
|
+
type GradleArtifactBuild = Pick<AndroidArtifactContext["buildPlan"], "variant" | "compilerCache" | "gradleBuildCache" | "pch" | "cas">;
|
|
357
|
+
interface NativeGradleArtifactReceipt {
|
|
358
|
+
source: string;
|
|
359
|
+
declaration: GradleArtifactInputs;
|
|
360
|
+
build: GradleArtifactBuild;
|
|
361
|
+
abi: string | null;
|
|
362
|
+
}
|
|
363
|
+
//#endregion
|
|
364
|
+
//#region src/integrations/android-project.d.ts
|
|
365
|
+
interface AndroidBuildTarget {
|
|
366
|
+
abi: string | null;
|
|
367
|
+
}
|
|
368
|
+
interface AndroidArtifactIdentity {
|
|
369
|
+
hash: string;
|
|
370
|
+
key: string;
|
|
371
|
+
}
|
|
372
|
+
interface AndroidArtifactContext {
|
|
373
|
+
operation?: StimContext;
|
|
374
|
+
artifactScope?: {
|
|
375
|
+
key: string;
|
|
376
|
+
validate(): Promise<void>;
|
|
377
|
+
record?(identity: AndroidArtifactIdentity, receipt: NativeGradleArtifactReceipt): void;
|
|
378
|
+
};
|
|
379
|
+
root: string;
|
|
380
|
+
buildLog: string;
|
|
381
|
+
writer: AndroidWriter;
|
|
382
|
+
settings: SettingsObject;
|
|
383
|
+
buildPlan: AndroidBuildPlan["build"];
|
|
384
|
+
target: AndroidBuildTarget;
|
|
385
|
+
phase: (label: unknown, text: string) => void;
|
|
386
|
+
out: (line: string) => void;
|
|
387
|
+
step: (phase: BuildPhase) => void;
|
|
388
|
+
estimates: () => RunEstimates;
|
|
389
|
+
}
|
|
390
|
+
//#endregion
|
|
391
|
+
export { IosFacts as _, BuildMachinesInspection as a, IosToolchain as c, DoctorPlatform as d, Finding as f, CompilationCacheActivity as g, CcacheActivity as h, AndroidBuildOptions as i, WorkerToolchain as l, AndroidFacts as m, WebLaunched as n, GeneratedTickets as o, Optimizations as p, SwiftpmArtifactToolchain as r, TailnetMachineIo as s, NativeGradleArtifactReceipt as t, BudgetReport as u };
|