stim 1.14.0 → 1.16.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 +2 -0
- package/dist/activity-BxwdD81S.mjs +609 -0
- package/dist/agent-device-usage-output-Dpih1Tfa.mjs +411 -0
- package/dist/{android-d6rGq1pA.mjs → android-B_NumVyQ.mjs} +169 -81
- package/dist/{android-LbPFRWVL.mjs → android-Ift4kVvt.mjs} +517 -413
- package/dist/android-cas-8U4DPqeR.mjs +167 -0
- package/dist/android-cas-compiler.mjs +2 -2
- package/dist/{android-XpvCrV7q.mjs → android-r2rBL8kV.mjs} +2 -2
- package/dist/{app-install-BpgSgkJj.mjs → app-install-CKWdbXIX.mjs} +128 -151
- package/dist/attempt-Bk2ouQVL.mjs +39 -0
- package/dist/budget-DjrURfQn.mjs +2700 -0
- package/dist/{build-plan-Dcr-3ie0.mjs → build-plan-DjeSb2Xl.mjs} +192 -653
- package/dist/build-slots-rUk77xqh.mjs +132 -0
- package/dist/{cache-manifest-C68QQ0ua.mjs → cache-manifest-DnUHBJaU.mjs} +2 -2
- package/dist/cache-manifest.mjs +1 -1
- package/dist/{chrome-BPCiC3ZX.mjs → chrome-BrcVWQyD.mjs} +1 -1
- package/dist/cli-BkYZ_6hy.mjs +51 -0
- package/dist/cli.mjs +6 -42
- package/dist/client-BTY686R6.mjs +1368 -0
- package/dist/collector-run.mjs +9 -195
- package/dist/{command-output-DVcpw6eE.mjs → command-output-DnJMdEY-.mjs} +1 -1
- package/dist/{config-lvc7d3C2.mjs → config-D0DbpZtM.mjs} +28 -29
- package/dist/{created-devices-CllH_8eb.mjs → created-devices-D5owjN4C.mjs} +2 -2
- package/dist/{dependency-state-DsT7aKeo.mjs → dependency-state-B6cMXZab.mjs} +2 -2
- package/dist/{deps-D9IcKqXS.mjs → deps-urbmfXig.mjs} +3 -3
- package/dist/{detached-entry-DJHoca49.mjs → detached-entry-CiTEgMR1.mjs} +1 -1
- package/dist/dev-client-CroAIjjj.mjs +43 -0
- package/dist/{device-CjuuAJjQ.mjs → device-DZQjF7H5.mjs} +8 -7
- package/dist/device-capacity-BHwxNBlu.mjs +136 -0
- package/dist/device-host-worker.d.mts +1 -0
- package/dist/device-host-worker.mjs +964 -0
- package/dist/device-ios-BadmeL2V.mjs +381 -0
- package/dist/{device-lease-5c3WrVRm.mjs → device-lease-D-hLqx1b.mjs} +43 -36
- package/dist/{device-pool-BiyDyPP-.mjs → device-lease-run-CqjShqWW.mjs} +6 -126
- package/dist/device-pool-CUaEWMMm.mjs +125 -0
- package/dist/{device-remote-D87zEzaq.mjs → device-remote-D5WVWqOq.mjs} +69 -163
- package/dist/{doctor-x9pnU9fq.mjs → doctor-Cimf-gGB.mjs} +241 -103
- package/dist/{error-diagnostics-C5HzcwCW.mjs → error-diagnostics-B9L4Ae0x.mjs} +15 -18
- package/dist/{exec-DK8KaVHK.mjs → exec-CaErVv7t.mjs} +5 -1
- package/dist/{gc-ko6mUAYD.mjs → gc-Bqy4bjEu.mjs} +599 -108
- package/dist/{android-cas-iZK3DOCr.mjs → gradle-BsO1MdsH.mjs} +8 -294
- package/dist/{guide-6R0VNFqI.mjs → guide-B_uyKTxW.mjs} +2511 -239
- package/dist/{guide-status-BZrFPIA_.mjs → guide-status-CjEZMAD4.mjs} +3 -3
- package/dist/hosted-client-a-WmqE2L.mjs +197 -0
- package/dist/hosted-ios-CIWelIqf.mjs +220 -0
- package/dist/hosted-logs-D5g041Q3.mjs +187 -0
- package/dist/hosted-macos-BSZyIb3y.mjs +135 -0
- package/dist/idle-DYVymG92.mjs +1099 -0
- package/dist/idle-shutdown-CTsDnAde.mjs +122 -0
- package/dist/in-use-DvBw0Kxo.mjs +130 -0
- package/dist/{ios-BwDPrnYQ.mjs → ios-BaInn3sW.mjs} +201 -10
- package/dist/ios-Cr1h5gnO.mjs +189 -0
- package/dist/{ios-P1f5nm2n.mjs → ios-aq3QoGI3.mjs} +1159 -633
- package/dist/{ios-device-BiOsSVzd.mjs → ios-device-Ee7sDXfp.mjs} +1 -1
- package/dist/{ios-device-DGglU3E_.mjs → ios-device-FfCN_C8p.mjs} +12 -7
- package/dist/ios-state-DS5UpYTH.mjs +48 -0
- package/dist/{launch-verify-Deg4tB3Z.mjs → launch-verify-2DBRizjo.mjs} +5 -5
- package/dist/logs-CHEVK8zD.mjs +371 -0
- package/dist/machines-BIBUdhpj.mjs +265 -0
- package/dist/macos-CSYEAFmF.mjs +473 -0
- package/dist/macos-run.d.mts +5 -0
- package/dist/macos-run.mjs +2 -0
- package/dist/maintenance-run.d.mts +4 -0
- package/dist/maintenance-run.mjs +254 -0
- package/dist/{metro-CcEo8Fl8.mjs → metro-BeK1ZPz1.mjs} +20 -120
- package/dist/metro-gateway-BJ-rxQAB.mjs +84 -0
- package/dist/{named-ports-Blg8IxOh.mjs → named-ports-Bk_YXEmE.mjs} +6 -59
- package/dist/native-run-NaBrRFtQ.mjs +147 -0
- package/dist/{native-runtime-DjBHRg5m.mjs → native-runtime-DBzRnEKS.mjs} +9 -5
- package/dist/{ndjson-CDY9IkVC.mjs → ndjson-PclOIwVY.mjs} +2 -2
- package/dist/offload-worker.d.mts +122 -0
- package/dist/offload-worker.mjs +606 -0
- package/dist/{ownership-DyYDF5ww.mjs → ownership-DiA16AsN.mjs} +3 -2
- package/dist/ownership-hCkPzGmr.mjs +571 -0
- package/dist/{page-BHUzTDFt.mjs → page-QF_Ke10s.mjs} +7 -2
- package/dist/{ports-BguS83ex.mjs → ports-R2k4Knz3.mjs} +3 -3
- package/dist/prebuild-D2fsca_Z.mjs +213 -0
- package/dist/preview-DhVbvPAZ.mjs +318 -0
- package/dist/process-identity-BmRm1qV0.mjs +12 -0
- package/dist/{project-CWlvEaeN.mjs → project-Du91Ilvc.mjs} +74 -19
- package/dist/pull-request-pxnDCQzn.mjs +322 -0
- package/dist/pull-requests.d.mts +120 -0
- package/dist/pull-requests.mjs +2 -0
- package/dist/recordings-BIXOzVnr.mjs +37 -0
- package/dist/{reload-BiniwsSZ.mjs → reload-rM9jV1fz.mjs} +109 -24
- package/dist/{remote-cache-CcR6o6lI.mjs → remote-cache-C8-V13XN.mjs} +5 -5
- package/dist/run-f4vI6EnK.mjs +119 -0
- package/dist/{server-bare-DGfgyJ5J.mjs → server-bare-CpPGmnmO.mjs} +33 -15
- package/dist/server-expo-CVqO2c35.mjs +2 -0
- package/dist/{server-expo-BVuwQ65v.mjs → server-expo-MC0rHlOC.mjs} +8 -12
- package/dist/settings-BBpMcDbD.mjs +25 -0
- package/dist/{settings-B-fsC-Om.mjs → settings-ZkDzkzvB.mjs} +22 -10
- package/dist/settings-oTSkkNrM.mjs +1439 -0
- package/dist/settings.schema.json +845 -97
- package/dist/{simslim-DrDN4WuV.mjs → simslim-B8-7AoTI.mjs} +8 -132
- package/dist/{slot-launch-D5t8EiMf.mjs → slot-launch-B8VrHxn1.mjs} +11 -8
- package/dist/{spawn-claims-Drw_o-Fb.mjs → spawn-claims-D0XfSe8u.mjs} +1 -1
- package/dist/spawn-entry-jw19m8Nl.mjs +17 -0
- package/dist/stage-CzaiwFsI.mjs +143 -0
- package/dist/start-CX8Ig-U2.mjs +2 -0
- package/dist/{start-s4RXp1wy.mjs → start-ClDfwXa4.mjs} +116 -65
- package/dist/state-3DwSQIBK.mjs +41 -0
- package/dist/state-B4PQFXMW.d.mts +12 -0
- package/dist/{state-Dk9RVXI7.mjs → state-C1jB7Q8q.mjs} +70 -8
- package/dist/{state-DHqvsbqC.mjs → state-DcW6vOd_.mjs} +7 -4
- package/dist/stats-CEZ_i5je.mjs +77 -0
- package/dist/{status-BgAuxESg.mjs → status-BuvBFeII.mjs} +118 -20
- package/dist/{status-BsPAnfOI.mjs → status-Cs7VLg9D.mjs} +542 -283
- package/dist/status-DlKvVJBE.mjs +49 -0
- package/dist/stdout-reader-C8yjre1x.mjs +23 -0
- package/dist/stim-desktop-Cnz8CPnl.mjs +63 -0
- package/dist/stim-footprint.swift +32 -0
- package/dist/{stim-installations-CINXy_su.mjs → stim-installations-QMEI32v1.mjs} +1 -1
- package/dist/stop-B0Yxtmiy.mjs +48 -0
- package/dist/{stop-BzreOWJp.mjs → stop-Bffozsac.mjs} +83 -16
- package/dist/{stop-BWIF_6BK.mjs → stop-Dt_dM16A.mjs} +2 -2
- package/dist/stop-cause-CidxIqup.mjs +97 -0
- package/dist/supervisor-run.d.mts +43 -11
- package/dist/supervisor-run.mjs +363 -24
- package/dist/support-CAP8qDUF.mjs +316 -0
- package/dist/support-D4aYJniO.mjs +201 -0
- package/dist/teardown-CL6vDs2Y.mjs +727 -0
- package/dist/{xcode-Cp5KvK9x.mjs → toolchain-DkUflduf.mjs} +364 -14
- package/dist/trigger-Bemu8ytw.mjs +65 -0
- package/dist/trigger-CXts6qt1.mjs +2 -0
- package/dist/warm-progress-CpGv3Wb6.mjs +732 -0
- package/dist/{web-BsQs1WlO.mjs → web-DWUaMp8P.mjs} +37 -21
- package/dist/web-run.mjs +310 -13
- package/dist/workspace-process-lock-BL7Q0HCO.mjs +57 -0
- package/dist/workspace-state-B8-aJ1_5.mjs +371 -0
- package/dist/workspaces-BV4pdHFz.mjs +306 -0
- package/dist/{worktree-UrQWXSeb.mjs → worktree-K-xj9Db0.mjs} +625 -256
- package/dist/worktree-jnG8Iph5.mjs +2 -0
- package/package.json +10 -5
- package/shim/bundle-response.cjs +28 -12
- package/dist/activity-CYVDcrt3.mjs +0 -356
- package/dist/budget-CGDkhvv_.mjs +0 -1745
- package/dist/build-progress-DxKpwnaS.mjs +0 -247
- package/dist/idle-DXtx3RbX.mjs +0 -191
- package/dist/in-use-DlqBDKqY.mjs +0 -249
- package/dist/logs-Civ4gbBH.mjs +0 -486
- package/dist/merge-state-ytFQCeh4.mjs +0 -262
- package/dist/server-expo-DIHDhvGg.mjs +0 -2
- package/dist/settings-D61iNOsB.mjs +0 -629
- package/dist/start-Cetfvy8l.mjs +0 -2
- package/dist/stats-CFpFGlJV.mjs +0 -62
- package/dist/stats-CX1Z8Tca.mjs +0 -368
- package/dist/stim-desktop-CXt8-Z3J.mjs +0 -40
- package/dist/stop-cause-hjGBOZTG.mjs +0 -1231
- package/dist/worktree-BVrHsYZG.mjs +0 -752
- package/dist/worktree-CHWWvm5v.mjs +0 -2
- package/dist/{metro-store-DzeWkfqW.mjs → metro-store-CDDZHtPl.mjs} +1 -1
|
@@ -1,16 +1,12 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { t as getExecutor } from "./exec-DK8KaVHK.mjs";
|
|
3
|
-
import { r as register } from "./cache-manifest-C68QQ0ua.mjs";
|
|
4
|
-
import { F as withDirLock, M as workspaceLogsDir, S as ensureWorkspaceStorage, w as sharedCcache } from "./metro-CcEo8Fl8.mjs";
|
|
5
|
-
import { a as spawnDeclared } from "./spawn-claims-Drw_o-Fb.mjs";
|
|
1
|
+
import { t as getExecutor } from "./exec-CaErVv7t.mjs";
|
|
6
2
|
import { n as stripAnsi, r as waitForChild, t as createLineReader } from "./process-output-Fpl8PYi8.mjs";
|
|
7
|
-
import { l as phaseLine } from "./command-output-
|
|
8
|
-
import { a as
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
3
|
+
import { l as phaseLine } from "./command-output-DnJMdEY-.mjs";
|
|
4
|
+
import { a as spawnDeclared } from "./spawn-claims-D0XfSe8u.mjs";
|
|
5
|
+
import { o as androidHome } from "./android-B_NumVyQ.mjs";
|
|
6
|
+
import { O as readCcacheActivity, T as CCACHE_UNAVAILABLE, u as HEARTBEAT_INTERVAL_MS, y as startBuildHeartbeat } from "./toolchain-DkUflduf.mjs";
|
|
7
|
+
import { createHash } from "node:crypto";
|
|
8
|
+
import { existsSync, mkdirSync, readFileSync, readdirSync, rmSync, statSync } from "node:fs";
|
|
12
9
|
import { dirname, isAbsolute, join, relative, sep } from "node:path";
|
|
13
|
-
import { createHash, randomUUID } from "node:crypto";
|
|
14
10
|
import { fileURLToPath } from "node:url";
|
|
15
11
|
import chalk from "chalk";
|
|
16
12
|
/** The ABI name a build for every ABI has to fit; `stim android` narrows a build to the device's. */
|
|
@@ -283,130 +279,6 @@ function clip(message) {
|
|
|
283
279
|
if (text.length <= MAX_MESSAGE_LENGTH) return text;
|
|
284
280
|
return `${text.slice(0, 297)}...`;
|
|
285
281
|
}
|
|
286
|
-
const CCACHE_SLOPPINESS = "pch_defines,time_macros";
|
|
287
|
-
const STATS_LOG_FILE = "ccache-stats.log";
|
|
288
|
-
const CCACHE_UNAVAILABLE = {
|
|
289
|
-
status: "unavailable",
|
|
290
|
-
hits: null,
|
|
291
|
-
misses: null,
|
|
292
|
-
hitRatePercent: null
|
|
293
|
-
};
|
|
294
|
-
const CCACHE_NOT_RUN = {
|
|
295
|
-
status: "not-run",
|
|
296
|
-
hits: null,
|
|
297
|
-
misses: null,
|
|
298
|
-
hitRatePercent: null
|
|
299
|
-
};
|
|
300
|
-
function ccacheStatsLog(root) {
|
|
301
|
-
return join(workspaceLogsDir(root), STATS_LOG_FILE);
|
|
302
|
-
}
|
|
303
|
-
function ccacheEnvironment({ binary, dir, workspaceRoot, statsLog }) {
|
|
304
|
-
return {
|
|
305
|
-
CMAKE_C_COMPILER_LAUNCHER: binary,
|
|
306
|
-
CMAKE_CXX_COMPILER_LAUNCHER: binary,
|
|
307
|
-
CCACHE_DIR: dir,
|
|
308
|
-
CCACHE_BASEDIR: workspaceRoot,
|
|
309
|
-
CCACHE_NOHASHDIR: "true",
|
|
310
|
-
CCACHE_SLOPPINESS,
|
|
311
|
-
CCACHE_MAXSIZE: "5G",
|
|
312
|
-
CCACHE_STATSLOG: statsLog
|
|
313
|
-
};
|
|
314
|
-
}
|
|
315
|
-
function parseCcacheBinary(output) {
|
|
316
|
-
const first = String(output ?? "").split("\n")[0]?.trim();
|
|
317
|
-
if (!first || !isAbsolute(first)) return null;
|
|
318
|
-
return first;
|
|
319
|
-
}
|
|
320
|
-
const CMAKE_LAUNCHER = /CMAKE_(C|CXX)_COMPILER_LAUNCHER\b/;
|
|
321
|
-
function projectCmakeLauncher(source) {
|
|
322
|
-
if (typeof source !== "string") return null;
|
|
323
|
-
const match = CMAKE_LAUNCHER.exec(source);
|
|
324
|
-
return match ? `CMAKE_${match[1]}_COMPILER_LAUNCHER` : null;
|
|
325
|
-
}
|
|
326
|
-
const HIT_COUNTERS = /* @__PURE__ */ new Set(["direct_cache_hit", "preprocessed_cache_hit"]);
|
|
327
|
-
function parseCcacheStatsLog(text) {
|
|
328
|
-
if (typeof text !== "string") return null;
|
|
329
|
-
let hits = 0;
|
|
330
|
-
let misses = 0;
|
|
331
|
-
for (const raw of text.split("\n")) {
|
|
332
|
-
const line = raw.trim();
|
|
333
|
-
if (HIT_COUNTERS.has(line)) hits += 1;
|
|
334
|
-
else if (line === "cache_miss") misses += 1;
|
|
335
|
-
}
|
|
336
|
-
const total = hits + misses;
|
|
337
|
-
if (total === 0) return null;
|
|
338
|
-
return {
|
|
339
|
-
status: "reported",
|
|
340
|
-
hits,
|
|
341
|
-
misses,
|
|
342
|
-
hitRatePercent: Math.round(hits / total * 1e3) / 10
|
|
343
|
-
};
|
|
344
|
-
}
|
|
345
|
-
function readCcacheActivity(statsLog) {
|
|
346
|
-
let text;
|
|
347
|
-
try {
|
|
348
|
-
text = readFileSync(statsLog, "utf-8");
|
|
349
|
-
} catch {
|
|
350
|
-
return CCACHE_UNAVAILABLE;
|
|
351
|
-
}
|
|
352
|
-
return parseCcacheStatsLog(text) ?? CCACHE_UNAVAILABLE;
|
|
353
|
-
}
|
|
354
|
-
function ccacheActivityLine(activity) {
|
|
355
|
-
if (activity.status === "reported") return `${activity.hits} hits / ${activity.misses} misses (${activity.hitRatePercent}%)`;
|
|
356
|
-
if (activity.status === "not-run") return "not run; artifact cache supplied the app";
|
|
357
|
-
return "unavailable; no C++ compile went through ccache";
|
|
358
|
-
}
|
|
359
|
-
function lookupCcache() {
|
|
360
|
-
try {
|
|
361
|
-
return parseCcacheBinary(getExecutor().findExecutable("ccache"));
|
|
362
|
-
} catch {
|
|
363
|
-
return null;
|
|
364
|
-
}
|
|
365
|
-
}
|
|
366
|
-
function readOrNull$1(file) {
|
|
367
|
-
try {
|
|
368
|
-
return readFileSync(file, "utf-8");
|
|
369
|
-
} catch {
|
|
370
|
-
return null;
|
|
371
|
-
}
|
|
372
|
-
}
|
|
373
|
-
function canonical(root) {
|
|
374
|
-
try {
|
|
375
|
-
return realpathSync(root);
|
|
376
|
-
} catch {
|
|
377
|
-
return root;
|
|
378
|
-
}
|
|
379
|
-
}
|
|
380
|
-
function resolveCcache({ root, dir = sharedCcache(), lookup = lookupCcache, onNote = (line) => console.error(line) }) {
|
|
381
|
-
const binary = lookup();
|
|
382
|
-
if (!binary) {
|
|
383
|
-
onNote(chalk.dim(phaseLine("cache", "ccache off (not installed; brew install ccache)")));
|
|
384
|
-
return null;
|
|
385
|
-
}
|
|
386
|
-
const declared = projectCmakeLauncher(readOrNull$1(join(root, "android", "app", "build.gradle")));
|
|
387
|
-
if (declared) {
|
|
388
|
-
onNote(chalk.dim(phaseLine("cache", `ccache off (android/app/build.gradle sets ${declared} itself)`)));
|
|
389
|
-
return null;
|
|
390
|
-
}
|
|
391
|
-
const statsLog = ccacheStatsLog(root);
|
|
392
|
-
register({
|
|
393
|
-
dir,
|
|
394
|
-
name: "ccache",
|
|
395
|
-
prune: "atomic",
|
|
396
|
-
note: "ccache keeps itself under CCACHE_MAXSIZE, so it is emptied whole or not at all"
|
|
397
|
-
});
|
|
398
|
-
onNote(chalk.dim(phaseLine("cache", `ccache on (${dir})`)));
|
|
399
|
-
return {
|
|
400
|
-
dir,
|
|
401
|
-
statsLog,
|
|
402
|
-
env: ccacheEnvironment({
|
|
403
|
-
binary,
|
|
404
|
-
dir,
|
|
405
|
-
workspaceRoot: canonical(root),
|
|
406
|
-
statsLog
|
|
407
|
-
})
|
|
408
|
-
};
|
|
409
|
-
}
|
|
410
282
|
//#endregion
|
|
411
283
|
//#region src/engine/gradle.ts
|
|
412
284
|
const BUILD_ERROR = "STIM_BUILD_FAILED";
|
|
@@ -966,162 +838,4 @@ function readOrNull(file) {
|
|
|
966
838
|
}
|
|
967
839
|
}
|
|
968
840
|
//#endregion
|
|
969
|
-
|
|
970
|
-
const CAS_TOOLCHAIN_FIELDS = [
|
|
971
|
-
"clang",
|
|
972
|
-
"clangxx",
|
|
973
|
-
"lld",
|
|
974
|
-
"ar",
|
|
975
|
-
"ranlib",
|
|
976
|
-
"ndk",
|
|
977
|
-
"resourceDir"
|
|
978
|
-
];
|
|
979
|
-
const CAS_TOOLCHAIN_BINARIES = [
|
|
980
|
-
"clang",
|
|
981
|
-
"clangxx",
|
|
982
|
-
"lld",
|
|
983
|
-
"ar",
|
|
984
|
-
"ranlib"
|
|
985
|
-
];
|
|
986
|
-
function executableFile(path) {
|
|
987
|
-
try {
|
|
988
|
-
accessSync(path, constants.X_OK);
|
|
989
|
-
return statSync(path).isFile();
|
|
990
|
-
} catch {
|
|
991
|
-
return false;
|
|
992
|
-
}
|
|
993
|
-
}
|
|
994
|
-
function directory(path) {
|
|
995
|
-
try {
|
|
996
|
-
return statSync(path).isDirectory();
|
|
997
|
-
} catch {
|
|
998
|
-
return false;
|
|
999
|
-
}
|
|
1000
|
-
}
|
|
1001
|
-
function isAndroidCasToolchain(value) {
|
|
1002
|
-
return CAS_TOOLCHAIN_FIELDS.every((field) => typeof value[field] === "string");
|
|
1003
|
-
}
|
|
1004
|
-
function readAndroidCasToolchain(manifest) {
|
|
1005
|
-
const parsed = readJsonFile(manifest);
|
|
1006
|
-
const toolchain = isJsonObject(parsed) ? parsed : {};
|
|
1007
|
-
if (!isAndroidCasToolchain(toolchain)) {
|
|
1008
|
-
const missing = CAS_TOOLCHAIN_FIELDS.filter((field) => typeof toolchain[field] !== "string");
|
|
1009
|
-
throw new Error(`${manifest} declares no ${missing.join(", ")}.`);
|
|
1010
|
-
}
|
|
1011
|
-
const notExecutable = CAS_TOOLCHAIN_BINARIES.filter((field) => !executableFile(toolchain[field]));
|
|
1012
|
-
if (notExecutable.length > 0) throw new Error(`${manifest} names no executable ${notExecutable.join(", ")}.`);
|
|
1013
|
-
if (!directory(toolchain.resourceDir)) throw new Error(`${manifest} names resourceDir ${toolchain.resourceDir}, which is not a directory.`);
|
|
1014
|
-
const ndkProperties = readFileSync(join(toolchain.ndk, "source.properties"), "utf8");
|
|
1015
|
-
const ndkVersion = /Pkg.Revision\s*=\s*([^\r\n]+)/.exec(ndkProperties)?.[1]?.trim();
|
|
1016
|
-
if (!ndkVersion) throw new Error(`Missing NDK version in ${toolchain.ndk}/source.properties.`);
|
|
1017
|
-
return {
|
|
1018
|
-
toolchain,
|
|
1019
|
-
ndkVersion,
|
|
1020
|
-
ndkProperties
|
|
1021
|
-
};
|
|
1022
|
-
}
|
|
1023
|
-
function resolveAndroidCompilerCache({ optimizations, use, env = process.env }) {
|
|
1024
|
-
if (optimizations.android.compilerCache !== "cas") return {
|
|
1025
|
-
cas: null,
|
|
1026
|
-
optimizations
|
|
1027
|
-
};
|
|
1028
|
-
const manifest = optimizations.android.casToolchain;
|
|
1029
|
-
try {
|
|
1030
|
-
return {
|
|
1031
|
-
cas: use(manifest),
|
|
1032
|
-
optimizations
|
|
1033
|
-
};
|
|
1034
|
-
} catch (error) {
|
|
1035
|
-
const fromEnvironment = Boolean(env.STIM_ANDROID_CAS_TOOLCHAIN);
|
|
1036
|
-
return {
|
|
1037
|
-
cas: null,
|
|
1038
|
-
optimizations: {
|
|
1039
|
-
...optimizations,
|
|
1040
|
-
android: {
|
|
1041
|
-
...optimizations.android,
|
|
1042
|
-
compilerCache: "ccache",
|
|
1043
|
-
compilerCacheFallback: {
|
|
1044
|
-
key: fromEnvironment ? "STIM_ANDROID_CAS_TOOLCHAIN" : "optimizations.android.casToolchain",
|
|
1045
|
-
reason: `could not be used: ${error.message.replace(/\.$/, "")}`,
|
|
1046
|
-
fromEnvironment,
|
|
1047
|
-
manifest
|
|
1048
|
-
}
|
|
1049
|
-
}
|
|
1050
|
-
}
|
|
1051
|
-
};
|
|
1052
|
-
}
|
|
1053
|
-
}
|
|
1054
|
-
function resolveAndroidCas(root, env = process.env) {
|
|
1055
|
-
const manifest = env.STIM_ANDROID_CAS_TOOLCHAIN;
|
|
1056
|
-
if (!manifest) return null;
|
|
1057
|
-
const { toolchain, ndkVersion, ndkProperties } = readAndroidCasToolchain(manifest);
|
|
1058
|
-
const scripts = [
|
|
1059
|
-
"shim/android-cas.gradle",
|
|
1060
|
-
"shim/android-cas.toolchain.cmake",
|
|
1061
|
-
"shim/android-cas-pch.cmake",
|
|
1062
|
-
"dist/android-cas-compiler.mjs"
|
|
1063
|
-
].map((name) => {
|
|
1064
|
-
const path = [`../${name}`, `../../${name}`].map((candidate) => fileURLToPath(new URL(candidate, import.meta.url))).find((candidate) => existsSync(candidate));
|
|
1065
|
-
if (!path) throw new Error(`Stim installation is missing ${name}.`);
|
|
1066
|
-
return path;
|
|
1067
|
-
});
|
|
1068
|
-
const hash = createHash("sha256").update(JSON.stringify(toolchain));
|
|
1069
|
-
for (const path of [
|
|
1070
|
-
...scripts,
|
|
1071
|
-
toolchain.clang,
|
|
1072
|
-
toolchain.clangxx,
|
|
1073
|
-
toolchain.lld,
|
|
1074
|
-
toolchain.ar,
|
|
1075
|
-
toolchain.ranlib
|
|
1076
|
-
]) hash.update(readFileSync(path));
|
|
1077
|
-
hash.update(ndkProperties);
|
|
1078
|
-
const id = `apple-cas-${hash.digest("hex")}`;
|
|
1079
|
-
const dir = join(getConfigDir(), "android-cas", id);
|
|
1080
|
-
const state = join(ensureWorkspaceStorage(root), "android-cas", id);
|
|
1081
|
-
const context = join(state, "context.json");
|
|
1082
|
-
mkdirSync(state, { recursive: true });
|
|
1083
|
-
mkdirSync(dir, { recursive: true });
|
|
1084
|
-
withDirLock(join(state, "setup.lock"), () => {
|
|
1085
|
-
for (const name of ["clang", "clang++"]) {
|
|
1086
|
-
const path = join(state, name);
|
|
1087
|
-
const temporary = `${path}.${randomUUID()}.tmp`;
|
|
1088
|
-
symlinkSync(scripts[3], temporary);
|
|
1089
|
-
renameSync(temporary, path);
|
|
1090
|
-
}
|
|
1091
|
-
const temporary = `${context}.${process.pid}.tmp`;
|
|
1092
|
-
writeFileSync(temporary, JSON.stringify({
|
|
1093
|
-
...toolchain,
|
|
1094
|
-
source: realpathSync(root),
|
|
1095
|
-
state,
|
|
1096
|
-
cache: dir
|
|
1097
|
-
}));
|
|
1098
|
-
renameSync(temporary, context);
|
|
1099
|
-
});
|
|
1100
|
-
register({
|
|
1101
|
-
dir,
|
|
1102
|
-
name: "android-cas",
|
|
1103
|
-
prune: "atomic",
|
|
1104
|
-
note: "Experimental Android compiler CAS"
|
|
1105
|
-
});
|
|
1106
|
-
return {
|
|
1107
|
-
id,
|
|
1108
|
-
dir,
|
|
1109
|
-
initScript: scripts[0],
|
|
1110
|
-
env: {
|
|
1111
|
-
STIM_ANDROID_CAS_CONTEXT: context,
|
|
1112
|
-
STIM_ANDROID_CAS_SOURCE_ROOT: realpathSync(root),
|
|
1113
|
-
STIM_ANDROID_CAS_STATE: state,
|
|
1114
|
-
STIM_ANDROID_CAS_NDK: toolchain.ndk,
|
|
1115
|
-
STIM_ANDROID_CAS_NDK_VERSION: ndkVersion,
|
|
1116
|
-
STIM_ANDROID_CAS_AR: toolchain.ar,
|
|
1117
|
-
STIM_ANDROID_CAS_RANLIB: toolchain.ranlib,
|
|
1118
|
-
STIM_ANDROID_CAS_CMAKE_TOOLCHAIN: scripts[1],
|
|
1119
|
-
STIM_ANDROID_CAS_CMAKE_PCH: scripts[2],
|
|
1120
|
-
CMAKE_C_COMPILER_LAUNCHER: "",
|
|
1121
|
-
CMAKE_CXX_COMPILER_LAUNCHER: "",
|
|
1122
|
-
CCACHE_DISABLE: "1"
|
|
1123
|
-
}
|
|
1124
|
-
};
|
|
1125
|
-
}
|
|
1126
|
-
//#endregion
|
|
1127
|
-
export { androidPathRoomRemedy as _, apkOutputsDir as a, readProductFlavors as c, ccacheActivityLine as d, projectCmakeLauncher as f, androidPathRoomMessage as g, androidPathRoom as h, androidSdkRefusal as i, CCACHE_NOT_RUN as l, formatDiagnostic as m, resolveAndroidCas as n, buildAndroid as o, resolveCcache as p, resolveAndroidCompilerCache as r, productFlavorRefusal as s, readAndroidCasToolchain as t, CCACHE_UNAVAILABLE as u };
|
|
841
|
+
export { gradlewPath as a, formatDiagnostic as c, androidPathRoomRemedy as d, buildAndroid as i, androidPathRoom as l, apkOutputsDir as n, productFlavorRefusal as o, assembleTaskFor as r, readProductFlavors as s, androidSdkRefusal as t, androidPathRoomMessage as u };
|