peachsim 0.1.2606 → 0.1.2608
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/cli/commands/package.ts +71 -39
- package/cli/commands/perf-native.ts +259 -6
- package/cli/commands/shell-url.ts +1 -0
- package/dist-lib/agent-daemon-client.cjs +1 -1
- package/dist-lib/agent-events.cjs +1 -1
- package/dist-lib/attached-projects.cjs +1 -1
- package/dist-lib/auth/shared-session.cjs +1 -1
- package/dist-lib/backend-origin.cjs +1 -1
- package/dist-lib/beta.cjs +1 -1
- package/dist-lib/beta.mjs +2 -2
- package/dist-lib/bridge-constants.cjs +1 -1
- package/dist-lib/bridge-contract-input.cjs +1 -1
- package/dist-lib/bridge-contract-input.mjs +5 -5
- package/dist-lib/bridge-contract.cjs +1 -1
- package/dist-lib/bridge-contract.mjs +3 -3
- package/dist-lib/bundle-channel.cjs +815 -674
- package/dist-lib/capture-contract.cjs +1 -1
- package/dist-lib/capture-contract.mjs +3 -3
- package/dist-lib/cloud-contract.cjs +1 -1
- package/dist-lib/cloud-contract.mjs +3 -3
- package/dist-lib/cloud-test-args.cjs +1 -1
- package/dist-lib/cloud-test-args.mjs +2 -2
- package/dist-lib/cloud.cjs +1 -1
- package/dist-lib/cloud.mjs +7 -7
- package/dist-lib/config.cjs +1 -1
- package/dist-lib/config.mjs +5 -5
- package/dist-lib/detox/index.cjs +1 -1
- package/dist-lib/dev-bundle-resolution.cjs +1 -1
- package/dist-lib/esm-chunks/{acorn-UL7Z3WUQ.mjs → acorn-4QDEL7IO.mjs} +3 -3
- package/dist-lib/esm-chunks/{chunk-5ANQR24T.mjs → chunk-3DUFAH5J.mjs} +1 -1
- package/dist-lib/esm-chunks/{chunk-OB5XSLW6.mjs → chunk-4C57RZXG.mjs} +3 -2
- package/dist-lib/esm-chunks/{chunk-QFASF6EH.mjs → chunk-7KU5ROOE.mjs} +5 -5
- package/dist-lib/esm-chunks/{chunk-EXB4QSQI.mjs → chunk-BEWJL2LY.mjs} +1 -1
- package/dist-lib/esm-chunks/{chunk-O6NRI4T2.mjs → chunk-F2FHFORX.mjs} +1 -1
- package/dist-lib/esm-chunks/{chunk-66ESCMV3.mjs → chunk-F724FZHJ.mjs} +818 -678
- package/dist-lib/esm-chunks/{chunk-VTZJPPTE.mjs → chunk-GPPOU5DO.mjs} +1 -1
- package/dist-lib/esm-chunks/{chunk-WJKACRMG.mjs → chunk-H3QASOKR.mjs} +1 -1
- package/dist-lib/esm-chunks/{chunk-TVICD24H.mjs → chunk-IJX7PBNG.mjs} +1 -1
- package/dist-lib/esm-chunks/{chunk-25LYRBSX.mjs → chunk-IKFFQXJN.mjs} +1 -1
- package/dist-lib/esm-chunks/{chunk-O6ZNRBLB.mjs → chunk-JIW4PICV.mjs} +1 -1
- package/dist-lib/esm-chunks/{chunk-5JMW5G3U.mjs → chunk-KNCWQQZG.mjs} +1 -1
- package/dist-lib/esm-chunks/{chunk-MBCSJQRY.mjs → chunk-NXG27NGU.mjs} +1 -1
- package/dist-lib/esm-chunks/{chunk-PLOV7VQQ.mjs → chunk-R25MOOFS.mjs} +1 -1
- package/dist-lib/esm-chunks/{chunk-34CIYRB7.mjs → chunk-RTXAZMTP.mjs} +4 -4
- package/dist-lib/esm-chunks/{chunk-B7AXR7WA.mjs → chunk-RZLGVWHK.mjs} +1 -1
- package/dist-lib/esm-chunks/{chunk-RTPUFY2K.mjs → chunk-UHYHEJ3N.mjs} +5 -5
- package/dist-lib/esm-chunks/{chunk-KWLQDES2.mjs → chunk-VICI67J5.mjs} +1 -1
- package/dist-lib/esm-chunks/{chunk-CPMK3DA6.mjs → chunk-W5EHCHDD.mjs} +3 -3
- package/dist-lib/esm-chunks/{chunk-E2TASYAA.mjs → chunk-X6CONUT6.mjs} +1 -1
- package/dist-lib/esm-chunks/{chunk-XUWYWP35.mjs → chunk-YBMBAXAZ.mjs} +1 -1
- package/dist-lib/esm-chunks/{chunk-L7FPUZZO.mjs → chunk-ZFI5OF6U.mjs} +1 -1
- package/dist-lib/esm-chunks/{metro-layout-parser-OMUFYOJI.mjs → metro-layout-parser-YWPJI3L6.mjs} +3 -3
- package/dist-lib/esm-chunks/{swift-package-prebuilt-X7EZCX34.mjs → swift-package-prebuilt-MWTLCMQD.mjs} +10 -10
- package/dist-lib/esm-chunks/{swift-sdk-app-module-E3IF2XPD.mjs → swift-sdk-app-module-PF5QMK5X.mjs} +14 -14
- package/dist-lib/esm-chunks/{swift-sdk-image-57YYLNU6.mjs → swift-sdk-image-5IMAACRF.mjs} +14 -14
- package/dist-lib/esm-chunks/{swift-sdk-image-producer-DZOZTTDZ.mjs → swift-sdk-image-producer-JPIJI25U.mjs} +4 -4
- package/dist-lib/expo-swift-bundle.cjs +814 -673
- package/dist-lib/expo-swift-metadata.cjs +1 -1
- package/dist-lib/expo-swift-metadata.mjs +7 -7
- package/dist-lib/home-paths.cjs +1 -1
- package/dist-lib/host/bridge-host.cjs +959 -676
- package/dist-lib/host/fetch-proxy-handler.cjs +6 -5
- package/dist-lib/host/fetch-proxy-overrides.cjs +1 -1
- package/dist-lib/host/fetch-proxy-overrides.mjs +2 -2
- package/dist-lib/host/replacement-module-handler.cjs +1 -1
- package/dist-lib/host/websocket-proxy.cjs +1 -1
- package/dist-lib/index.cjs +1 -1
- package/dist-lib/kotlin-host.cjs +1 -1
- package/dist-lib/menu.cjs +1 -1
- package/dist-lib/menu.mjs +3 -3
- package/dist-lib/metro-fingerprint-registry.cjs +1 -1
- package/dist-lib/metro-fingerprint-registry.mjs +3 -3
- package/dist-lib/metro-production-bundle.cjs +1 -1
- package/dist-lib/metro-production-bundle.mjs +4 -4
- package/dist-lib/native-app-identity-project.cjs +6 -4
- package/dist-lib/native-app-identity-project.mjs +17 -17
- package/dist-lib/native-app-identity.cjs +1 -1
- package/dist-lib/native-app-identity.mjs +6 -6
- package/dist-lib/native-firebase-metadata.cjs +1 -1
- package/dist-lib/native-firebase-metadata.mjs +3 -3
- package/dist-lib/pdfium-raster.cjs +1 -1
- package/dist-lib/pdfium-raster.mjs +2 -2
- package/dist-lib/plist.cjs +1 -1
- package/dist-lib/plist.mjs +3 -3
- package/dist-lib/profiles.cjs +1 -1
- package/dist-lib/public-brand.cjs +1 -1
- package/dist-lib/public-origins-lib-esm.json +81 -81
- package/dist-lib/public-origins-lib.json +64 -64
- package/dist-lib/react-native-host-modules.cjs +1 -1
- package/dist-lib/react-native-host-modules.mjs +2 -2
- package/dist-lib/reap-browser.cjs +1 -1
- package/dist-lib/scripts/dev-server-scanner.cjs +1 -1
- package/dist-lib/sdk.cjs +1 -1
- package/dist-lib/sdk.mjs +8 -8
- package/dist-lib/skills.cjs +959 -676
- package/dist-lib/swift-compile.cjs +811 -670
- package/dist-lib/swift-compile.mjs +10 -10
- package/dist-lib/swift-package.cjs +1 -1
- package/dist-lib/swift-package.mjs +3 -3
- package/dist-lib/swift-submit.cjs +1 -1
- package/dist-lib/swift-submit.mjs +6 -6
- package/dist-lib/swift-svg-raster.cjs +1 -1
- package/dist-lib/swift-svg-raster.mjs +2 -2
- package/dist-lib/swift-toolchain.cjs +3 -2
- package/dist-lib/swift.cjs +1 -1
- package/dist-lib/vendor/@peculiar/x509.cjs +1 -1
- package/dist-lib/vendor/@ruby/prism/src/nodes.js.cjs +1 -1
- package/dist-lib/vendor/@ruby/prism/src/parsePrism.js.cjs +1 -1
- package/dist-lib/vendor/acorn.cjs +1 -1
- package/dist-lib/vendor/magic-string.cjs +1 -1
- package/dist-lib/vendor/stream-json.cjs +1 -1
- package/dist-lib/vendor/sucrase/dist/index.js.cjs +1 -1
- package/dist-lib/vendor/sucrase/dist/parser/index.js.cjs +1 -1
- package/dist-lib/vendor/sucrase/dist/parser/tokenizer/index.js.cjs +1 -1
- package/dist-lib/vendor/sucrase/dist/parser/tokenizer/types.js.cjs +1 -1
- package/dist-lib/vendor/sucrase.cjs +1 -1
- package/dist-lib/vendor/terser.cjs +1 -1
- package/dist-lib/vendor/valibot.cjs +1 -1
- package/dist-lib/vendor/ws.cjs +1 -1
- package/dist-lib/vendor/zod.cjs +1 -1
- package/dist-lib/worklet-executable.cjs +1 -1
- package/dist-lib/worklet-executable.mjs +3 -3
- package/dist-types/packages/peach-engine/src/ios/apps/canvas-map-data.d.ts +38 -2
- package/dist-types/packages/peach-globals/src/canvasAgentContract.d.ts +8 -0
- package/dist-types/packages/peach-globals/src/index.d.ts +1 -1
- package/install.sh +3 -2
- package/package.json +1 -1
- package/src/agent-prompt.ts +5 -1
- package/src/one-native-controls-package.ts +143 -1
- package/src/oneNativeControlsContract.ts +1 -0
- package/src/swift-compile-budget.ts +28 -7
- package/src/swift-compile.ts +968 -803
- package/src/swift-guest-compile.ts +3 -0
- package/src/swift-toolchain.ts +4 -1
package/dist-lib/skills.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! peach v0.1.
|
|
1
|
+
/*! peach v0.1.2608 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
|
|
2
2
|
let __sootsim_import_meta_url = '', __sootsim_import_meta_dirname = '', __sootsim_import_meta_filename = ''; try { __sootsim_import_meta_url = require('url').pathToFileURL(__filename).href; __sootsim_import_meta_dirname = __dirname; __sootsim_import_meta_filename = __filename; } catch {}
|
|
3
3
|
"use strict";
|
|
4
4
|
var __create = Object.create;
|
|
@@ -35850,13 +35850,13 @@ var init_swift_standin_digest = __esm({
|
|
|
35850
35850
|
STANDIN_DIGEST_ENTRYPOINTS = ["swift-standins.ts", "swift-objc-compile.ts"];
|
|
35851
35851
|
SPECIFIER = /from\s*['"]([^'"]+)['"]|import\s*\(\s*['"]([^'"]+)['"]\s*\)/g;
|
|
35852
35852
|
standinSourceDigest = (srcDir = __sootsim_import_meta_dirname) => sourceClosureDigest(srcDir, STANDIN_DIGEST_ENTRYPOINTS);
|
|
35853
|
-
STANDIN_SOURCE_DIGEST = true ? "
|
|
35853
|
+
STANDIN_SOURCE_DIGEST = true ? "fde0b0b7ddf441a32e71680bc17ba12f69f2cbaed1a0a024505e7f4a5394772d" : standinSourceDigest();
|
|
35854
35854
|
}
|
|
35855
35855
|
});
|
|
35856
35856
|
|
|
35857
35857
|
// src/expo-native-compiler-digest.ts
|
|
35858
35858
|
function expoNativeCompilerDigestValue() {
|
|
35859
|
-
return true ? "
|
|
35859
|
+
return true ? "0eb8b57c26c74de660f5dc029f1ae0ffa0af503b67afa64e2c93b02b517a2e68" : expoNativeCompilerDigest(__sootsim_import_meta_dirname);
|
|
35860
35860
|
}
|
|
35861
35861
|
var import_node_crypto12;
|
|
35862
35862
|
var init_expo_native_compiler_digest = __esm({
|
|
@@ -43217,7 +43217,8 @@ function swiftCompilerRelease(release) {
|
|
|
43217
43217
|
}
|
|
43218
43218
|
function swiftToolchainBin(release) {
|
|
43219
43219
|
if (process.platform === "darwin") {
|
|
43220
|
-
const
|
|
43220
|
+
const bases = [.../* @__PURE__ */ new Set([import_node_os8.default.homedir(), import_node_path33.default.dirname(peachHome()), "/"])];
|
|
43221
|
+
const dirs = bases.map(
|
|
43221
43222
|
(base2) => import_node_path33.default.join(base2, `Library/Developer/Toolchains/${release}.xctoolchain/usr/bin`)
|
|
43222
43223
|
);
|
|
43223
43224
|
const found2 = dirs.find((dir) => import_node_fs37.default.existsSync(import_node_path33.default.join(dir, "swift")));
|
|
@@ -56427,24 +56428,37 @@ function swiftBuilderHopTimeoutMs(compileTimeoutMs) {
|
|
|
56427
56428
|
async function withSwiftCompileBudget(compileTimeoutMs, signal, work) {
|
|
56428
56429
|
const deadline = new AbortController();
|
|
56429
56430
|
const combined = signal ? AbortSignal.any([signal, deadline.signal]) : deadline.signal;
|
|
56431
|
+
const stallMs = compileTimeoutMs ?? SWIFT_COMPILE_TIMEOUT_MS;
|
|
56432
|
+
let compiling2 = false;
|
|
56430
56433
|
let timer = setTimeout(
|
|
56431
56434
|
() => deadline.abort(new Error("Swift build lock wait timed out")),
|
|
56432
56435
|
SWIFT_LOCK_WAIT_TIMEOUT_MS
|
|
56433
56436
|
);
|
|
56437
|
+
const restart = () => {
|
|
56438
|
+
clearTimeout(timer);
|
|
56439
|
+
timer = setTimeout(
|
|
56440
|
+
() => deadline.abort(
|
|
56441
|
+
new Error(
|
|
56442
|
+
`Swift compilation made no progress for ${Math.round(stallMs / 1e3)}s`
|
|
56443
|
+
)
|
|
56444
|
+
),
|
|
56445
|
+
stallMs
|
|
56446
|
+
);
|
|
56447
|
+
};
|
|
56434
56448
|
try {
|
|
56435
56449
|
combined.throwIfAborted();
|
|
56436
56450
|
const result = await work({
|
|
56437
56451
|
signal: combined,
|
|
56438
56452
|
startCompile() {
|
|
56439
56453
|
combined.throwIfAborted();
|
|
56440
|
-
|
|
56441
|
-
|
|
56442
|
-
|
|
56443
|
-
|
|
56444
|
-
);
|
|
56454
|
+
compiling2 = true;
|
|
56455
|
+
restart();
|
|
56456
|
+
},
|
|
56457
|
+
progress() {
|
|
56458
|
+
if (compiling2 && !deadline.signal.aborted) restart();
|
|
56445
56459
|
}
|
|
56446
56460
|
});
|
|
56447
|
-
|
|
56461
|
+
signal?.throwIfAborted();
|
|
56448
56462
|
return result;
|
|
56449
56463
|
} finally {
|
|
56450
56464
|
clearTimeout(timer);
|
|
@@ -74450,6 +74464,7 @@ async function compileGuestLink(options2) {
|
|
|
74450
74464
|
);
|
|
74451
74465
|
continue;
|
|
74452
74466
|
}
|
|
74467
|
+
options2.onStage("lowering the app image");
|
|
74453
74468
|
const lowerPromise = link.lower();
|
|
74454
74469
|
await new Promise((resolve16) => setImmediate(resolve16));
|
|
74455
74470
|
let binding;
|
|
@@ -74480,6 +74495,7 @@ async function compileGuestLink(options2) {
|
|
|
74480
74495
|
return binding;
|
|
74481
74496
|
}
|
|
74482
74497
|
}
|
|
74498
|
+
options2.onStage("lowering the app image");
|
|
74483
74499
|
await lowerWasm(options2.output, options2.optimized, {
|
|
74484
74500
|
optimize: options2.optimize,
|
|
74485
74501
|
skipPasses: ["duplicate-function-elimination"],
|
|
@@ -75903,8 +75919,18 @@ async function runCompiler(command, args, options2, stream = false, quiet) {
|
|
|
75903
75919
|
void stopping.catch(() => {
|
|
75904
75920
|
});
|
|
75905
75921
|
};
|
|
75922
|
+
const restartTimeout = () => {
|
|
75923
|
+
if (!options2.timeout) return;
|
|
75924
|
+
clearTimeout(timeout);
|
|
75925
|
+
timeout = setTimeout(() => {
|
|
75926
|
+
failure3 = new Error(`Swift compiler was silent for ${options2.timeout}ms`);
|
|
75927
|
+
stop2();
|
|
75928
|
+
}, options2.timeout);
|
|
75929
|
+
};
|
|
75906
75930
|
for (const name3 of ["stdout", "stderr"]) {
|
|
75907
75931
|
child[name3].on("data", (bytes) => {
|
|
75932
|
+
restartTimeout();
|
|
75933
|
+
options2.onOutput?.();
|
|
75908
75934
|
if (stream === true) process[name3].write(bytes);
|
|
75909
75935
|
else if (stream) {
|
|
75910
75936
|
const lines = (partial[name3] + bytes.toString()).split("\n");
|
|
@@ -75953,11 +75979,7 @@ async function runCompiler(command, args, options2, stream = false, quiet) {
|
|
|
75953
75979
|
resolve16(Buffer.concat(chunks.stdout).toString());
|
|
75954
75980
|
}
|
|
75955
75981
|
});
|
|
75956
|
-
|
|
75957
|
-
timeout = setTimeout(() => {
|
|
75958
|
-
failure3 = new Error("Swift compiler timed out");
|
|
75959
|
-
stop2();
|
|
75960
|
-
}, options2.timeout);
|
|
75982
|
+
restartTimeout();
|
|
75961
75983
|
if (signal?.aborted) stop2();
|
|
75962
75984
|
});
|
|
75963
75985
|
} finally {
|
|
@@ -80844,24 +80866,18 @@ function readFrameworkProductsReceipt(scratch2, receiptKey) {
|
|
|
80844
80866
|
} catch {
|
|
80845
80867
|
return null;
|
|
80846
80868
|
}
|
|
80847
|
-
const
|
|
80848
|
-
|
|
80849
|
-
const archiveMatches = (0, import_node_fs81.existsSync)(archiveStamp) && (0, import_node_fs81.readFileSync)(archiveStamp, "utf8") === receiptKey;
|
|
80869
|
+
const archiveRoot = import_node_path81.default.join(scratch2, "products-lib", receiptKey);
|
|
80870
|
+
if (parsed2.root !== archiveRoot) return null;
|
|
80850
80871
|
if (!(0, import_node_fs81.existsSync)(parsed2.modules)) return null;
|
|
80851
|
-
for (const [object9] of parsed2.archived)
|
|
80872
|
+
for (const [object9, rel] of parsed2.archived) {
|
|
80873
|
+
if (!(0, import_node_fs81.existsSync)(object9) || !(0, import_node_fs81.existsSync)(import_node_path81.default.join(archiveRoot, rel))) return null;
|
|
80874
|
+
}
|
|
80852
80875
|
for (const file of parsed2.providers) if (!(0, import_node_fs81.existsSync)(file)) return null;
|
|
80853
80876
|
for (const file of parsed2.moduleMaps) if (!(0, import_node_fs81.existsSync)(file)) return null;
|
|
80854
|
-
if (!archiveMatches) {
|
|
80855
|
-
(0, import_node_fs81.rmSync)(archive, { recursive: true, force: true });
|
|
80856
|
-
(0, import_node_fs81.mkdirSync)(archive, { recursive: true });
|
|
80857
|
-
for (const [object9, rel] of parsed2.archived)
|
|
80858
|
-
(0, import_node_fs81.symlinkSync)(object9, import_node_path81.default.join(scratch2, rel));
|
|
80859
|
-
(0, import_node_fs81.writeFileSync)(archiveStamp, receiptKey);
|
|
80860
|
-
}
|
|
80861
80877
|
for (const file of parsed2.objects) if (!(0, import_node_fs81.existsSync)(file)) return null;
|
|
80862
80878
|
for (const file of parsed2.lazyObjects) if (!(0, import_node_fs81.existsSync)(file)) return null;
|
|
80863
80879
|
return {
|
|
80864
|
-
root:
|
|
80880
|
+
root: parsed2.root,
|
|
80865
80881
|
modules: parsed2.modules,
|
|
80866
80882
|
objects: parsed2.objects,
|
|
80867
80883
|
lazyObjects: parsed2.lazyObjects,
|
|
@@ -80879,7 +80895,7 @@ async function buildFrameworkProducts(scratch2, args) {
|
|
|
80879
80895
|
const selectorOptions = swiftObjCSelectorOptions(args.moduleRoot);
|
|
80880
80896
|
const receiptKey = (0, import_node_crypto48.createHash)("sha256").update(
|
|
80881
80897
|
JSON.stringify([
|
|
80882
|
-
"framework-products/
|
|
80898
|
+
"framework-products/v2",
|
|
80883
80899
|
args.frameworkKey,
|
|
80884
80900
|
unoptimized,
|
|
80885
80901
|
args.sdk,
|
|
@@ -81037,28 +81053,40 @@ async function buildFrameworkProducts(scratch2, args) {
|
|
|
81037
81053
|
}
|
|
81038
81054
|
const providers = (0, import_node_fs81.readdirSync)(providerDir).filter((file) => file.endsWith(".o")).sort().map((file) => import_node_path81.default.join(providerDir, file));
|
|
81039
81055
|
for (const provider of providers) linked.owners.set(provider, "DarwinRecords");
|
|
81040
|
-
const
|
|
81041
|
-
(0, import_node_fs81.
|
|
81042
|
-
(
|
|
81056
|
+
const archiveBase = import_node_path81.default.join(scratch2, "products-lib");
|
|
81057
|
+
(0, import_node_fs81.mkdirSync)(archiveBase, { recursive: true });
|
|
81058
|
+
const archiveRoot = import_node_path81.default.join(archiveBase, receiptKey);
|
|
81059
|
+
const stagedArchiveRoot = `${archiveRoot}.tmp-${process.pid}-${(0, import_node_crypto48.randomUUID)()}`;
|
|
81060
|
+
const stagedArchive = import_node_path81.default.join(stagedArchiveRoot, "lib");
|
|
81061
|
+
(0, import_node_fs81.mkdirSync)(stagedArchive, { recursive: true });
|
|
81043
81062
|
const archived = /* @__PURE__ */ new Map();
|
|
81044
|
-
|
|
81045
|
-
const
|
|
81046
|
-
|
|
81047
|
-
|
|
81048
|
-
|
|
81049
|
-
|
|
81050
|
-
|
|
81051
|
-
|
|
81052
|
-
|
|
81053
|
-
|
|
81054
|
-
|
|
81055
|
-
|
|
81063
|
+
try {
|
|
81064
|
+
for (const object9 of objects) {
|
|
81065
|
+
const target = linked.owners.get(object9);
|
|
81066
|
+
const dir = import_node_path81.default.join(release, `${target}.build`);
|
|
81067
|
+
if (!target || target === "Darwin" || !object9.startsWith(dir + import_node_path81.default.sep)) continue;
|
|
81068
|
+
const name3 = `${target}-${import_node_path81.default.relative(dir, object9).replaceAll(import_node_path81.default.sep, "-").replace(/\.swift\.o$/, ".o")}`;
|
|
81069
|
+
(0, import_node_fs81.symlinkSync)(object9, import_node_path81.default.join(stagedArchive, name3));
|
|
81070
|
+
archived.set(object9, `lib/${name3}`);
|
|
81071
|
+
}
|
|
81072
|
+
(0, import_node_fs81.rmSync)(archiveRoot, { recursive: true, force: true });
|
|
81073
|
+
(0, import_node_fs81.renameSync)(stagedArchiveRoot, archiveRoot);
|
|
81074
|
+
} catch (error) {
|
|
81075
|
+
(0, import_node_fs81.rmSync)(stagedArchiveRoot, { recursive: true, force: true });
|
|
81076
|
+
throw error;
|
|
81077
|
+
}
|
|
81078
|
+
const roots = swiftObjcRootObjects(
|
|
81079
|
+
`${archiveRoot}
|
|
81080
|
+
${args.frameworkKey}`,
|
|
81081
|
+
archiveRoot,
|
|
81082
|
+
[...archived.values()]
|
|
81083
|
+
);
|
|
81056
81084
|
const linkedObjects = objects.map((object9) => {
|
|
81057
81085
|
const name3 = archived.get(object9);
|
|
81058
|
-
return name3 ? { path: import_node_path81.default.join(
|
|
81086
|
+
return name3 ? { path: import_node_path81.default.join(archiveRoot, name3), lazy: !roots.has(name3) } : { path: object9, lazy: false };
|
|
81059
81087
|
});
|
|
81060
81088
|
const result = {
|
|
81061
|
-
root:
|
|
81089
|
+
root: archiveRoot,
|
|
81062
81090
|
modules: import_node_path81.default.join(release, "Modules"),
|
|
81063
81091
|
objects: linkedObjects.filter((object9) => !object9.lazy).map((object9) => object9.path),
|
|
81064
81092
|
lazyObjects: linkedObjects.filter((object9) => object9.lazy).map((object9) => object9.path),
|
|
@@ -81068,7 +81096,6 @@ ${args.frameworkKey}`, scratch2, [
|
|
|
81068
81096
|
moduleMaps: linked.moduleMaps,
|
|
81069
81097
|
objcHeaders: linked.objcHeaders
|
|
81070
81098
|
};
|
|
81071
|
-
(0, import_node_fs81.writeFileSync)(import_node_path81.default.join(archive, ".receipt"), receiptKey);
|
|
81072
81099
|
const receiptsDir = import_node_path81.default.join(scratch2, "products-ready");
|
|
81073
81100
|
(0, import_node_fs81.mkdirSync)(receiptsDir, { recursive: true });
|
|
81074
81101
|
const receiptFile2 = import_node_path81.default.join(receiptsDir, `${receiptKey}.json`);
|
|
@@ -81076,6 +81103,7 @@ ${args.frameworkKey}`, scratch2, [
|
|
|
81076
81103
|
(0, import_node_fs81.writeFileSync)(
|
|
81077
81104
|
partialReceipt,
|
|
81078
81105
|
JSON.stringify({
|
|
81106
|
+
root: result.root,
|
|
81079
81107
|
modules: result.modules,
|
|
81080
81108
|
objects: result.objects,
|
|
81081
81109
|
lazyObjects: result.lazyObjects,
|
|
@@ -81107,7 +81135,10 @@ function swiftFrameworkSlotRecord(slot, record6) {
|
|
|
81107
81135
|
function swiftFrameworkSlotKey(slot) {
|
|
81108
81136
|
return swiftFrameworkSlotRecord(slot, SWIFT_FRAMEWORK_SLOT_KEY);
|
|
81109
81137
|
}
|
|
81110
|
-
|
|
81138
|
+
function swiftFrameworkSlotRelease(slot) {
|
|
81139
|
+
return swiftFrameworkSlotRecord(slot, SWIFT_FRAMEWORK_SLOT_RELEASE);
|
|
81140
|
+
}
|
|
81141
|
+
async function withSwiftFrameworkSlot(frameworkKey, release, moduleRoot, signal, work, unoptimized = false) {
|
|
81111
81142
|
const slotCount = unoptimized ? SWIFT_FRAMEWORK_UNOPTIMIZED_SLOTS : SWIFT_FRAMEWORK_SLOTS;
|
|
81112
81143
|
const slotsDir = swiftFrameworksDir(unoptimized);
|
|
81113
81144
|
const slots = Array.from({ length: slotCount }, (_, index) => {
|
|
@@ -81130,9 +81161,12 @@ async function withSwiftFrameworkSlot(frameworkKey, moduleRoot, signal, work, un
|
|
|
81130
81161
|
(0, import_node_fs81.readFileSync)(import_node_path81.default.join(moduleRoot, file))
|
|
81131
81162
|
])
|
|
81132
81163
|
);
|
|
81133
|
-
const ranked = slots.map((slot) => {
|
|
81164
|
+
const ranked = slots.map((slot, index) => {
|
|
81165
|
+
const slotKey = swiftFrameworkSlotKey(slot);
|
|
81166
|
+
if (slotKey === null) return { slot, index, tier: 1, changes: Infinity };
|
|
81167
|
+
if (swiftFrameworkSlotRelease(slot) !== release)
|
|
81168
|
+
return { slot, index, tier: 2, changes: Infinity };
|
|
81134
81169
|
let changes = 0;
|
|
81135
|
-
if (swiftFrameworkSlotKey(slot) === null) return { slot, changes: Infinity };
|
|
81136
81170
|
const source = import_node_path81.default.join(slot, "source", "packages", import_node_path81.default.basename(moduleRoot));
|
|
81137
81171
|
for (const [file, contents2] of inputs2) {
|
|
81138
81172
|
try {
|
|
@@ -81144,18 +81178,22 @@ async function withSwiftFrameworkSlot(frameworkKey, moduleRoot, signal, work, un
|
|
|
81144
81178
|
changes++;
|
|
81145
81179
|
}
|
|
81146
81180
|
}
|
|
81147
|
-
return { slot, changes };
|
|
81148
|
-
}).sort(
|
|
81149
|
-
(left
|
|
81150
|
-
|
|
81151
|
-
|
|
81181
|
+
return { slot, index, tier: 0, changes };
|
|
81182
|
+
}).sort((left, right) => {
|
|
81183
|
+
if (left.tier !== right.tier) return left.tier - right.tier;
|
|
81184
|
+
if (left.tier === 0)
|
|
81185
|
+
return left.changes - right.changes || Number(own2(right.slot)) - Number(own2(left.slot)) || (built2.get(right.slot) ?? 0) - (built2.get(left.slot) ?? 0);
|
|
81186
|
+
if (left.tier === 1) return left.index - right.index;
|
|
81187
|
+
return (built2.get(left.slot) ?? 0) - (built2.get(right.slot) ?? 0);
|
|
81188
|
+
});
|
|
81189
|
+
for (const { slot, tier, changes } of ranked) {
|
|
81152
81190
|
if (await hasLiveSwiftRootReaders(slot, signal)) continue;
|
|
81153
81191
|
const result = await withSwiftRootLock(
|
|
81154
81192
|
slot,
|
|
81155
81193
|
async (lease) => {
|
|
81156
81194
|
if (await hasLiveSwiftRootReaders(slot, signal)) return void 0;
|
|
81157
81195
|
console.error(
|
|
81158
|
-
`[swift-framework-cache] ${import_node_path81.default.basename(slot)} changedInputs=${changes} totalInputs=${inputs2.size}`
|
|
81196
|
+
`[swift-framework-cache] ${import_node_path81.default.basename(slot)} release=${release} tier=${tier} changedInputs=${changes} totalInputs=${inputs2.size}`
|
|
81159
81197
|
);
|
|
81160
81198
|
return { value: await run18(slot)(lease) };
|
|
81161
81199
|
},
|
|
@@ -81167,6 +81205,43 @@ async function withSwiftFrameworkSlot(frameworkKey, moduleRoot, signal, work, un
|
|
|
81167
81205
|
const nearest = ranked[0].slot;
|
|
81168
81206
|
return withSwiftRootLock(nearest, run18(nearest), signal);
|
|
81169
81207
|
}
|
|
81208
|
+
async function withSwiftBuildRootSlot(baseRoot, buildShape, signal, work) {
|
|
81209
|
+
const slots = Array.from({ length: SWIFT_BUILD_ROOT_SLOTS }, (_, index) => {
|
|
81210
|
+
const slot = index === 0 ? baseRoot : `${baseRoot}-s${index}`;
|
|
81211
|
+
(0, import_node_fs81.mkdirSync)(slot, { recursive: true });
|
|
81212
|
+
return slot;
|
|
81213
|
+
});
|
|
81214
|
+
const runInSlot = (slot, waitStart2) => (lease) => {
|
|
81215
|
+
const waitedMs = Date.now() - waitStart2;
|
|
81216
|
+
const now = /* @__PURE__ */ new Date();
|
|
81217
|
+
(0, import_node_fs81.utimesSync)(slot, now, now);
|
|
81218
|
+
return work(slot, lease, waitedMs);
|
|
81219
|
+
};
|
|
81220
|
+
const built2 = new Map(slots.map((slot) => [slot, (0, import_node_fs81.statSync)(slot).mtimeMs]));
|
|
81221
|
+
const ranked = slots.map((slot, index) => {
|
|
81222
|
+
const shape = swiftFrameworkSlotRecord(slot, SWIFT_BUILD_ROOT_SHAPE);
|
|
81223
|
+
const tier = shape === buildShape ? 0 : shape === null ? 1 : 2;
|
|
81224
|
+
return { slot, index, tier };
|
|
81225
|
+
}).sort((left, right) => {
|
|
81226
|
+
if (left.tier !== right.tier) return left.tier - right.tier;
|
|
81227
|
+
if (left.tier === 0)
|
|
81228
|
+
return (built2.get(right.slot) ?? 0) - (built2.get(left.slot) ?? 0);
|
|
81229
|
+
if (left.tier === 1) return left.index - right.index;
|
|
81230
|
+
return (built2.get(left.slot) ?? 0) - (built2.get(right.slot) ?? 0);
|
|
81231
|
+
});
|
|
81232
|
+
for (const { slot } of ranked) {
|
|
81233
|
+
const result = await withSwiftRootLock(
|
|
81234
|
+
slot,
|
|
81235
|
+
async (lease) => ({ value: await runInSlot(slot, Date.now())(lease) }),
|
|
81236
|
+
signal,
|
|
81237
|
+
false
|
|
81238
|
+
);
|
|
81239
|
+
if (result) return result.value;
|
|
81240
|
+
}
|
|
81241
|
+
const nearest = ranked[0].slot;
|
|
81242
|
+
const waitStart = Date.now();
|
|
81243
|
+
return withSwiftRootLock(nearest, runInSlot(nearest, waitStart), signal);
|
|
81244
|
+
}
|
|
81170
81245
|
function mirrorTree2(source, target, skip) {
|
|
81171
81246
|
(0, import_node_fs81.mkdirSync)(target, { recursive: true });
|
|
81172
81247
|
const wanted = /* @__PURE__ */ new Set();
|
|
@@ -81216,8 +81291,10 @@ function stageFrameworkSource(moduleRoot, slot, frameworkKey, release) {
|
|
|
81216
81291
|
const hadKey = swiftFrameworkSlotKey(slot);
|
|
81217
81292
|
if (hadKey !== frameworkKey) {
|
|
81218
81293
|
(0, import_node_fs81.rmSync)(import_node_path81.default.join(slot, SWIFT_FRAMEWORK_SLOT_KEY), { force: true });
|
|
81294
|
+
(0, import_node_fs81.rmSync)(import_node_path81.default.join(slot, SWIFT_FRAMEWORK_SLOT_RELEASE), { force: true });
|
|
81219
81295
|
(0, import_node_fs81.rmSync)(import_node_path81.default.join(slot, "products-ready"), { recursive: true, force: true });
|
|
81220
|
-
(0, import_node_fs81.rmSync)(import_node_path81.default.join(slot, "lib"
|
|
81296
|
+
(0, import_node_fs81.rmSync)(import_node_path81.default.join(slot, "products-lib"), { recursive: true, force: true });
|
|
81297
|
+
(0, import_node_fs81.rmSync)(import_node_path81.default.join(slot, "lib"), { recursive: true, force: true });
|
|
81221
81298
|
const moduleRestructured = mirrorTree2(moduleRoot, stagedModule, ".build");
|
|
81222
81299
|
const sdkRestructured = mirrorTree2(
|
|
81223
81300
|
swiftSharedSdkRoot(moduleRoot, false),
|
|
@@ -81245,8 +81322,11 @@ function stageFrameworkSource(moduleRoot, slot, frameworkKey, release) {
|
|
|
81245
81322
|
(0, import_node_fs81.rmSync)(modules, { recursive: true, force: true });
|
|
81246
81323
|
(0, import_node_fs81.symlinkSync)(target, modules);
|
|
81247
81324
|
}
|
|
81325
|
+
(0, import_node_fs81.writeFileSync)(import_node_path81.default.join(slot, SWIFT_FRAMEWORK_SLOT_RELEASE), release);
|
|
81248
81326
|
(0, import_node_fs81.writeFileSync)(import_node_path81.default.join(slot, SWIFT_FRAMEWORK_SLOT_KEY), frameworkKey);
|
|
81249
81327
|
(0, import_node_fs81.writeFileSync)(import_node_path81.default.join(slot, SWIFT_FRAMEWORK_SLOT_ORIGIN), moduleRoot);
|
|
81328
|
+
} else if (swiftFrameworkSlotRelease(slot) !== release) {
|
|
81329
|
+
(0, import_node_fs81.writeFileSync)(import_node_path81.default.join(slot, SWIFT_FRAMEWORK_SLOT_RELEASE), release);
|
|
81250
81330
|
}
|
|
81251
81331
|
return stagedModule;
|
|
81252
81332
|
}
|
|
@@ -81474,660 +81554,717 @@ ${cap}` : "";
|
|
|
81474
81554
|
(0, import_node_fs81.rmSync)(requestRoot, { recursive: true, force: true });
|
|
81475
81555
|
}
|
|
81476
81556
|
}
|
|
81557
|
+
const baseRoot = root;
|
|
81558
|
+
const canPoolBuildRoot = !options2.intermediates && !options2.project && !options2.linkOnly && import_node_path81.default.basename(import_node_path81.default.dirname(baseRoot)) === "swift-builds";
|
|
81559
|
+
const buildShape = canPoolBuildRoot ? (0, import_node_crypto48.createHash)("sha256").update(
|
|
81560
|
+
JSON.stringify([
|
|
81561
|
+
frameworkKey,
|
|
81562
|
+
Boolean(sdkImage),
|
|
81563
|
+
compileTargets(input).map((target) => target.name).sort(),
|
|
81564
|
+
input.oneModule === true,
|
|
81565
|
+
input.optimize === true,
|
|
81566
|
+
input.unoptimized === true,
|
|
81567
|
+
Object.keys(input.files).sort()
|
|
81568
|
+
])
|
|
81569
|
+
).digest("hex").slice(0, 16) : "";
|
|
81477
81570
|
return withSwiftCompileBudget(options2.timeoutMs, options2.signal, async (budget) => {
|
|
81478
|
-
|
|
81479
|
-
|
|
81480
|
-
|
|
81481
|
-
|
|
81482
|
-
|
|
81483
|
-
|
|
81484
|
-
|
|
81485
|
-
|
|
81486
|
-
|
|
81487
|
-
|
|
81488
|
-
|
|
81489
|
-
|
|
81490
|
-
|
|
81491
|
-
|
|
81492
|
-
|
|
81571
|
+
const stage = (message) => {
|
|
81572
|
+
budget.progress();
|
|
81573
|
+
report(message);
|
|
81574
|
+
};
|
|
81575
|
+
const runLocked = (work) => {
|
|
81576
|
+
if (canPoolBuildRoot) {
|
|
81577
|
+
(0, import_node_fs81.mkdirSync)(sharedRoot, { recursive: true });
|
|
81578
|
+
return withSwiftRootLock(
|
|
81579
|
+
sharedRoot,
|
|
81580
|
+
async () => {
|
|
81581
|
+
const built2 = readCompiledArtifact(
|
|
81582
|
+
import_node_path81.default.join(sharedRoot, "artifact"),
|
|
81583
|
+
hash
|
|
81584
|
+
);
|
|
81585
|
+
if (built2) {
|
|
81586
|
+
stage("reusing verified disk artifact");
|
|
81587
|
+
return retain(baseRoot, built2);
|
|
81588
|
+
}
|
|
81589
|
+
return withSwiftBuildRootSlot(baseRoot, buildShape, budget.signal, work);
|
|
81590
|
+
},
|
|
81591
|
+
budget.signal
|
|
81592
|
+
);
|
|
81593
|
+
}
|
|
81594
|
+
const waitStart = Date.now();
|
|
81595
|
+
return withSwiftRootLock(
|
|
81596
|
+
baseRoot,
|
|
81597
|
+
(lease) => work(baseRoot, lease, Date.now() - waitStart),
|
|
81598
|
+
budget.signal
|
|
81599
|
+
);
|
|
81600
|
+
};
|
|
81601
|
+
return runLocked(async (slotRoot, lease, waitedMs) => {
|
|
81602
|
+
const root2 = slotRoot;
|
|
81603
|
+
const layout3 = {
|
|
81604
|
+
root: root2,
|
|
81605
|
+
sources: import_node_path81.default.join(root2, "Sources", "App"),
|
|
81606
|
+
multi: compileTargets(input).length > 0
|
|
81607
|
+
};
|
|
81608
|
+
if (!options2.intermediates) {
|
|
81609
|
+
const built2 = readCompiledArtifact(import_node_path81.default.join(sharedRoot, "artifact"), hash);
|
|
81610
|
+
if (built2) {
|
|
81611
|
+
stage("reusing verified disk artifact");
|
|
81612
|
+
return retain(baseRoot, built2);
|
|
81493
81613
|
}
|
|
81494
|
-
|
|
81495
|
-
|
|
81496
|
-
|
|
81497
|
-
|
|
81614
|
+
}
|
|
81615
|
+
if (waitedMs >= 1e3)
|
|
81616
|
+
report(`acquired build root ${import_node_path81.default.basename(root2)} after ${waitedMs}ms`);
|
|
81617
|
+
if (canPoolBuildRoot) {
|
|
81618
|
+
refreshSwiftCacheHold(root2);
|
|
81619
|
+
(0, import_node_fs81.writeFileSync)(import_node_path81.default.join(root2, SWIFT_BUILD_ROOT_SHAPE), buildShape);
|
|
81620
|
+
}
|
|
81621
|
+
const swift = import_node_path81.default.join(options2.toolchainBin, "swift");
|
|
81622
|
+
if (!(0, import_node_fs81.existsSync)(swift)) {
|
|
81623
|
+
throw new Error(
|
|
81624
|
+
`swift-compile: no swift.org toolchain at ${options2.toolchainBin}; install ${options2.release} and its matching wasm sdk`
|
|
81625
|
+
);
|
|
81626
|
+
}
|
|
81627
|
+
const unoptimized = input.unoptimized === true;
|
|
81628
|
+
const withFrameworkLock = (work) => distribution ? work(null) : withSwiftFrameworkSlot(
|
|
81629
|
+
frameworkKey,
|
|
81630
|
+
options2.release,
|
|
81631
|
+
moduleRoot,
|
|
81632
|
+
budget.signal,
|
|
81633
|
+
work,
|
|
81634
|
+
unoptimized
|
|
81635
|
+
);
|
|
81636
|
+
const baseBuildEnv = options2.project?.env ? {
|
|
81637
|
+
...options2.project.env,
|
|
81638
|
+
// shipped host plugins resolve against the selected compiler's runtime.
|
|
81639
|
+
...process.platform === "linux" ? {
|
|
81640
|
+
LD_LIBRARY_PATH: [
|
|
81641
|
+
import_node_path81.default.resolve(options2.toolchainBin, "../lib/swift/linux"),
|
|
81642
|
+
import_node_path81.default.resolve(options2.toolchainBin, "../lib/swift/host"),
|
|
81643
|
+
process.env.LD_LIBRARY_PATH
|
|
81644
|
+
].filter(Boolean).join(":")
|
|
81645
|
+
} : {},
|
|
81646
|
+
PEACH_DEFER_WASM_LINK: "1"
|
|
81647
|
+
} : swiftCompilerBaseEnv(options2.toolchainBin, process.env);
|
|
81648
|
+
const {
|
|
81649
|
+
frameworkRoot,
|
|
81650
|
+
compileFrameworkRoot,
|
|
81651
|
+
macroPlugins,
|
|
81652
|
+
sdk: sdk2,
|
|
81653
|
+
icu,
|
|
81654
|
+
prebuilt,
|
|
81655
|
+
readHold
|
|
81656
|
+
} = await withFrameworkLock(async (slot, frameworkLease) => {
|
|
81657
|
+
budget.startCompile();
|
|
81658
|
+
if (slot && swiftFrameworkSlotKey(slot) !== frameworkKey)
|
|
81659
|
+
await waitForNoSwiftRootReaders(slot, budget.signal);
|
|
81660
|
+
const frameworkRoot2 = mirrorDistribution ? syncSwiftDistributionMirror(root2, moduleRoot, mirrorDistribution) : distribution ? moduleRoot : stageFrameworkSource(moduleRoot, slot, frameworkKey, options2.release);
|
|
81661
|
+
if (!swiftModuleDigest(frameworkRoot2).equals(moduleDigest))
|
|
81662
|
+
throw new Error("Swift staged project source differs from the caller");
|
|
81663
|
+
stage("preparing compiler plugins");
|
|
81664
|
+
const macroPlugins2 = await ensureMacroPlugins(
|
|
81665
|
+
frameworkRoot2,
|
|
81666
|
+
options2.toolchainBin,
|
|
81667
|
+
options2.release,
|
|
81498
81668
|
budget.signal,
|
|
81499
|
-
|
|
81500
|
-
unoptimized
|
|
81669
|
+
frameworkLease
|
|
81501
81670
|
);
|
|
81502
|
-
const
|
|
81503
|
-
|
|
81504
|
-
|
|
81505
|
-
|
|
81506
|
-
|
|
81507
|
-
|
|
81508
|
-
|
|
81509
|
-
|
|
81510
|
-
|
|
81511
|
-
|
|
81512
|
-
|
|
81513
|
-
|
|
81514
|
-
|
|
81671
|
+
const compileFrameworkRoot2 = distribution ? swiftDistributionCompileView(frameworkRoot2, distribution) : frameworkRoot2;
|
|
81672
|
+
const sdk3 = swiftModuleSdk(frameworkRoot2).wasmSdkId;
|
|
81673
|
+
const icu2 = options2.linkOnly ? null : swiftIcuAsset(options2.toolchainBin, sdk3);
|
|
81674
|
+
let prebuilt2;
|
|
81675
|
+
if (!distribution) {
|
|
81676
|
+
stage("compiling framework products");
|
|
81677
|
+
prebuilt2 = await buildFrameworkProducts(slot, {
|
|
81678
|
+
moduleRoot: frameworkRoot2,
|
|
81679
|
+
frameworkKey,
|
|
81680
|
+
input,
|
|
81681
|
+
swift,
|
|
81682
|
+
sdk: sdk3,
|
|
81683
|
+
toolchainBin: options2.toolchainBin,
|
|
81684
|
+
plugins: macroPlugins2,
|
|
81685
|
+
buildOptions: {
|
|
81686
|
+
env: baseBuildEnv,
|
|
81687
|
+
maxBuffer: 64 * 1024 * 1024,
|
|
81688
|
+
signal: budget.signal,
|
|
81689
|
+
onOutput: budget.progress,
|
|
81690
|
+
lease,
|
|
81691
|
+
frameworkLease
|
|
81692
|
+
}
|
|
81693
|
+
});
|
|
81694
|
+
}
|
|
81695
|
+
const readHold2 = slot ? acquireSwiftRootReadHold(slot) : void 0;
|
|
81696
|
+
return {
|
|
81697
|
+
frameworkRoot: frameworkRoot2,
|
|
81698
|
+
compileFrameworkRoot: compileFrameworkRoot2,
|
|
81699
|
+
macroPlugins: macroPlugins2,
|
|
81700
|
+
sdk: sdk3,
|
|
81701
|
+
icu: icu2,
|
|
81702
|
+
prebuilt: prebuilt2,
|
|
81703
|
+
readHold: readHold2
|
|
81704
|
+
};
|
|
81705
|
+
});
|
|
81706
|
+
const buildOptions = {
|
|
81707
|
+
env: baseBuildEnv,
|
|
81708
|
+
maxBuffer: 64 * 1024 * 1024,
|
|
81709
|
+
signal: budget.signal,
|
|
81710
|
+
onOutput: budget.progress,
|
|
81711
|
+
lease
|
|
81712
|
+
};
|
|
81713
|
+
try {
|
|
81714
|
+
if (options2.project) removeProjectLinks(root2);
|
|
81715
|
+
const packageHostMacros = process.platform === "linux" ? input.packageHostMacros : void 0;
|
|
81716
|
+
if (retireStaleSwiftLink(
|
|
81717
|
+
root2,
|
|
81718
|
+
swiftLinkStamp({
|
|
81719
|
+
frameworkKey: `${options2.release}\0${Boolean(distribution)}\0${swiftModuleSdk(frameworkRoot).wasmSdkId}`,
|
|
81720
|
+
packageHostMacros
|
|
81721
|
+
}),
|
|
81722
|
+
swiftLinkStamp({
|
|
81723
|
+
// a distribution's objects reach only the deferred link, and
|
|
81724
|
+
// the root's mirror keeps its compile inputs at fixed paths
|
|
81725
|
+
frameworkKey: distribution ? `${options2.release}\0${distribution.wasmSdkChecksum}` : frameworkKey,
|
|
81726
|
+
prebuilt,
|
|
81727
|
+
packageHostMacros
|
|
81728
|
+
}),
|
|
81729
|
+
Boolean(options2.linkOnly)
|
|
81730
|
+
))
|
|
81731
|
+
stage("framework revision changed; rebuilding the app link");
|
|
81732
|
+
const nativeToolset = needsNativeToolset(input, prebuilt);
|
|
81733
|
+
const preparation = writeSwiftProject(
|
|
81734
|
+
layout3,
|
|
81735
|
+
input,
|
|
81515
81736
|
frameworkRoot,
|
|
81516
|
-
compileFrameworkRoot,
|
|
81517
|
-
macroPlugins,
|
|
81518
|
-
sdk: sdk2,
|
|
81519
|
-
icu,
|
|
81520
81737
|
prebuilt,
|
|
81521
|
-
|
|
81522
|
-
|
|
81523
|
-
|
|
81524
|
-
|
|
81525
|
-
|
|
81526
|
-
|
|
81527
|
-
|
|
81528
|
-
|
|
81529
|
-
|
|
81530
|
-
|
|
81531
|
-
|
|
81532
|
-
|
|
81533
|
-
|
|
81534
|
-
|
|
81535
|
-
|
|
81738
|
+
!options2.project,
|
|
81739
|
+
options2.project ? false : options2.objcPrebuiltStage ?? (options2.intermediates ? false : void 0)
|
|
81740
|
+
);
|
|
81741
|
+
const productFile = import_node_path81.default.join(frameworkRoot, SWIFT_FRAMEWORK_PRODUCT_FILE);
|
|
81742
|
+
writeSwiftAutolinkLinker(
|
|
81743
|
+
root2,
|
|
81744
|
+
options2.toolchainBin,
|
|
81745
|
+
(0, import_node_fs81.existsSync)(productFile) ? [
|
|
81746
|
+
v6.parse(
|
|
81747
|
+
swiftFrameworkProductSchema,
|
|
81748
|
+
JSON.parse((0, import_node_fs81.readFileSync)(productFile, "utf8"))
|
|
81749
|
+
).product.name
|
|
81750
|
+
] : []
|
|
81751
|
+
);
|
|
81752
|
+
const compiler = preparation.targetToolset ? { CC: import_node_path81.default.join(root2, CLANG_TARGET_MODULE_WRAPPER) } : {};
|
|
81753
|
+
if (packageHostMacros?.length) {
|
|
81754
|
+
const swiftc = import_node_path81.default.join(root2, SWIFT_HOST_COMPILER_WRAPPER);
|
|
81755
|
+
writeBuildFile(
|
|
81756
|
+
swiftc,
|
|
81757
|
+
[
|
|
81758
|
+
"#!/bin/sh",
|
|
81759
|
+
"target=",
|
|
81760
|
+
"module=",
|
|
81761
|
+
"compile=",
|
|
81762
|
+
"previous=",
|
|
81763
|
+
"for argument do",
|
|
81764
|
+
' case "$previous" in -target) target=$argument ;; -module-name) module=$argument ;; esac',
|
|
81765
|
+
' case "$argument" in -c|-emit-module|-scan-dependencies|-typecheck) compile=1 ;; esac',
|
|
81766
|
+
" previous=$argument",
|
|
81767
|
+
"done",
|
|
81768
|
+
'case "$target/$compile" in',
|
|
81769
|
+
" *-*-linux*/1)",
|
|
81770
|
+
' case ",$PEACH_SWIFT_HOST_MACROS," in',
|
|
81771
|
+
' *",$module,"*) set -- "$@" -Xfrontend -import-module -Xfrontend Foundation ;;',
|
|
81772
|
+
" esac ;;",
|
|
81773
|
+
"esac",
|
|
81774
|
+
'exec "$PEACH_SWIFTC" "$@"',
|
|
81775
|
+
""
|
|
81776
|
+
].join("\n")
|
|
81536
81777
|
);
|
|
81537
|
-
|
|
81538
|
-
|
|
81539
|
-
|
|
81540
|
-
|
|
81541
|
-
|
|
81542
|
-
|
|
81543
|
-
|
|
81544
|
-
|
|
81545
|
-
|
|
81546
|
-
|
|
81547
|
-
|
|
81548
|
-
|
|
81549
|
-
|
|
81550
|
-
|
|
81551
|
-
|
|
81552
|
-
|
|
81553
|
-
|
|
81554
|
-
|
|
81555
|
-
|
|
81556
|
-
frameworkLease
|
|
81557
|
-
}
|
|
81558
|
-
});
|
|
81778
|
+
(0, import_node_fs81.chmodSync)(swiftc, 493);
|
|
81779
|
+
compiler.SWIFT_EXEC = swiftc;
|
|
81780
|
+
compiler.PEACH_SWIFT_HOST_MACROS = packageHostMacros.join(",");
|
|
81781
|
+
compiler.PEACH_SWIFTC = import_node_path81.default.join(options2.toolchainBin, "swiftc");
|
|
81782
|
+
}
|
|
81783
|
+
const projectProcess = options2.project ? prepareSwiftProjectProcess(root2, options2.project) : void 0;
|
|
81784
|
+
const temporaryDirectory = projectProcess ? void 0 : import_node_path81.default.join(root2, ".build", "peach-compiler-tmp");
|
|
81785
|
+
const appOptions = projectProcess ? {
|
|
81786
|
+
...buildOptions,
|
|
81787
|
+
uid: projectProcess.uid,
|
|
81788
|
+
gid: projectProcess.gid,
|
|
81789
|
+
confined: { ...projectProcess.env, ...compiler }
|
|
81790
|
+
} : {
|
|
81791
|
+
...buildOptions,
|
|
81792
|
+
temporaryDirectory,
|
|
81793
|
+
env: {
|
|
81794
|
+
...buildOptions.env,
|
|
81795
|
+
...preparation.usesObjcPrebuilt && process.env.PEACH_HOME !== void 0 ? { PEACH_HOME: process.env.PEACH_HOME } : {},
|
|
81796
|
+
...compiler
|
|
81559
81797
|
}
|
|
81560
|
-
const readHold2 = slot ? acquireSwiftRootReadHold(slot) : void 0;
|
|
81561
|
-
return {
|
|
81562
|
-
frameworkRoot: frameworkRoot2,
|
|
81563
|
-
compileFrameworkRoot: compileFrameworkRoot2,
|
|
81564
|
-
macroPlugins: macroPlugins2,
|
|
81565
|
-
sdk: sdk3,
|
|
81566
|
-
icu: icu2,
|
|
81567
|
-
prebuilt: prebuilt2,
|
|
81568
|
-
readHold: readHold2
|
|
81569
|
-
};
|
|
81570
|
-
});
|
|
81571
|
-
const buildOptions = {
|
|
81572
|
-
env: baseBuildEnv,
|
|
81573
|
-
maxBuffer: 64 * 1024 * 1024,
|
|
81574
|
-
signal: budget.signal,
|
|
81575
|
-
lease
|
|
81576
81798
|
};
|
|
81577
|
-
|
|
81578
|
-
|
|
81579
|
-
|
|
81580
|
-
|
|
81581
|
-
|
|
81582
|
-
|
|
81583
|
-
|
|
81584
|
-
|
|
81585
|
-
|
|
81586
|
-
|
|
81587
|
-
|
|
81588
|
-
// the root's mirror keeps its compile inputs at fixed paths
|
|
81589
|
-
frameworkKey: distribution ? `${options2.release}\0${distribution.wasmSdkChecksum}` : frameworkKey,
|
|
81590
|
-
prebuilt,
|
|
81591
|
-
packageHostMacros
|
|
81592
|
-
}),
|
|
81593
|
-
Boolean(options2.linkOnly)
|
|
81594
|
-
))
|
|
81595
|
-
report("framework revision changed; rebuilding the app link");
|
|
81596
|
-
const nativeToolset = needsNativeToolset(input, prebuilt);
|
|
81597
|
-
const preparation = writeSwiftProject(
|
|
81598
|
-
layout2,
|
|
81599
|
-
input,
|
|
81600
|
-
frameworkRoot,
|
|
81601
|
-
prebuilt,
|
|
81602
|
-
!options2.project,
|
|
81603
|
-
options2.project ? false : options2.objcPrebuiltStage ?? (options2.intermediates ? false : void 0)
|
|
81799
|
+
const unprepared = preparation.targetFailures.map(
|
|
81800
|
+
(failure3) => `error: target ${failure3}`
|
|
81801
|
+
);
|
|
81802
|
+
const forwarders = /* @__PURE__ */ new Map();
|
|
81803
|
+
for (const [file, text7] of Object.entries(input.files)) {
|
|
81804
|
+
const parents = /^#include "((?:\.\.\/)+)[^"\n]+"\n$/.exec(text7)?.[1];
|
|
81805
|
+
if (!parents) continue;
|
|
81806
|
+
const directory2 = import_node_path81.default.posix.dirname(file);
|
|
81807
|
+
forwarders.set(
|
|
81808
|
+
`${import_node_path81.default.join(root2, directory2)}/${parents.slice(0, -1)}`,
|
|
81809
|
+
import_node_path81.default.posix.join("build", directory2, parents).replace(/\/$/, "")
|
|
81604
81810
|
);
|
|
81605
|
-
|
|
81606
|
-
|
|
81607
|
-
|
|
81608
|
-
|
|
81609
|
-
|
|
81610
|
-
|
|
81611
|
-
|
|
81612
|
-
|
|
81613
|
-
|
|
81614
|
-
|
|
81811
|
+
}
|
|
81812
|
+
const jobs = swiftCompilerJobs();
|
|
81813
|
+
const incrementalPreview = sdkImage !== void 0 && !guestGraph && !options2.project && !input.optimize && !input.unoptimized;
|
|
81814
|
+
const perFile = input.unoptimized || incrementalPreview;
|
|
81815
|
+
const buildArgs = [
|
|
81816
|
+
"build",
|
|
81817
|
+
...projectProcess?.cacheOptions ?? swiftPackageCacheOptions(),
|
|
81818
|
+
"--build-system",
|
|
81819
|
+
"native",
|
|
81820
|
+
"-j",
|
|
81821
|
+
String(jobs),
|
|
81822
|
+
"--package-path",
|
|
81823
|
+
root2,
|
|
81824
|
+
...swiftCompileSdkOptions(frameworkRoot, options2.toolchainBin),
|
|
81825
|
+
...swiftObjCSelectorOptions(frameworkRoot),
|
|
81826
|
+
"--swift-sdk",
|
|
81827
|
+
sdk2,
|
|
81828
|
+
...preparation.targetToolset ? ["--toolset", import_node_path81.default.join(root2, ".peach-target-toolset.json")] : [],
|
|
81829
|
+
"-c",
|
|
81830
|
+
"release",
|
|
81831
|
+
...input.unoptimized ? ["-Xswiftc", "-Onone"] : [],
|
|
81832
|
+
...perFile ? [
|
|
81833
|
+
"-Xswiftc",
|
|
81834
|
+
"-no-whole-module-optimization",
|
|
81835
|
+
"-Xswiftc",
|
|
81836
|
+
"-j",
|
|
81837
|
+
"-Xswiftc",
|
|
81838
|
+
String(jobs)
|
|
81839
|
+
] : [],
|
|
81840
|
+
...incrementalPreview ? ["-Xswiftc", "-incremental", "-Xswiftc", "-enable-batch-mode"] : [],
|
|
81841
|
+
// the mirror finds a changed sdk header's readers in their
|
|
81842
|
+
// dependency files, which omit system headers by default
|
|
81843
|
+
...mirrorDistribution ? ["-Xswiftc", "-track-system-dependencies"] : [],
|
|
81844
|
+
// the link strips debug info, so none is generated (as for the framework).
|
|
81845
|
+
// keep -num-threads fixed across caller core caps so llbuild does not
|
|
81846
|
+
// rebuild every target when callers alternate --cores, and bound backend
|
|
81847
|
+
// fan-out under high -j.
|
|
81848
|
+
"-Xswiftc",
|
|
81849
|
+
"-gnone",
|
|
81850
|
+
...incrementalPreview ? [] : [
|
|
81851
|
+
"-Xswiftc",
|
|
81852
|
+
"-num-threads",
|
|
81853
|
+
"-Xswiftc",
|
|
81854
|
+
String(perFile ? 1 : Math.min(8, import_node_os16.default.availableParallelism()))
|
|
81855
|
+
],
|
|
81856
|
+
...swiftReproducibleBuildFlags([
|
|
81857
|
+
[import_node_path81.default.dirname(options2.toolchainBin), "toolchain"],
|
|
81858
|
+
[compileFrameworkRoot, "framework"],
|
|
81859
|
+
[root2, "build"],
|
|
81860
|
+
...forwarders
|
|
81861
|
+
]).flatMap((flag, index, flags) => {
|
|
81862
|
+
if (!nativeToolset || !flag.startsWith("-ffile-prefix-map="))
|
|
81863
|
+
return [flag];
|
|
81864
|
+
const toolchainDir = import_node_path81.default.dirname(options2.toolchainBin);
|
|
81865
|
+
let mapped = flag;
|
|
81866
|
+
for (const [dir, target] of [
|
|
81867
|
+
[root2, "/peach/build"],
|
|
81868
|
+
[compileFrameworkRoot, "/peach/framework"],
|
|
81869
|
+
[(0, import_node_fs81.realpathSync)(compileFrameworkRoot), "/peach/framework"],
|
|
81870
|
+
[toolchainDir, "/peach/toolchain"],
|
|
81871
|
+
[(0, import_node_fs81.realpathSync)(toolchainDir), "/peach/toolchain"]
|
|
81872
|
+
]) {
|
|
81873
|
+
mapped = mapped.replaceAll(dir, target);
|
|
81874
|
+
}
|
|
81875
|
+
const [, from, to] = /^-ffile-prefix-map=([^=]+)=(.+)$/.exec(mapped) ?? [];
|
|
81876
|
+
const tool = flags[index - 1];
|
|
81877
|
+
return mapped !== flag && from !== to ? [flag, tool, mapped] : [flag];
|
|
81878
|
+
}),
|
|
81879
|
+
...macroPlugins.libraries.flatMap((plugin) => [
|
|
81880
|
+
"-Xswiftc",
|
|
81881
|
+
"-load-plugin-library",
|
|
81882
|
+
"-Xswiftc",
|
|
81883
|
+
plugin
|
|
81884
|
+
]),
|
|
81885
|
+
...macroPlugins.executables.flatMap((plugin) => [
|
|
81886
|
+
"-Xswiftc",
|
|
81887
|
+
"-load-plugin-executable",
|
|
81888
|
+
"-Xswiftc",
|
|
81889
|
+
`${plugin}#ExpoModulesMacros`
|
|
81890
|
+
])
|
|
81891
|
+
];
|
|
81892
|
+
const linked = builtArtifact(layout3);
|
|
81893
|
+
(0, import_node_fs81.rmSync)(import_node_path81.default.join(root2, ".peach-link.rsp"), { force: true });
|
|
81894
|
+
if (options2.linkOnly || (0, import_node_fs81.existsSync)(linked) && (0, import_node_fs81.statSync)(linked).size <= 8)
|
|
81895
|
+
(0, import_node_fs81.rmSync)(linked, { force: true });
|
|
81896
|
+
stage("compiling and linking Swift modules");
|
|
81897
|
+
const frameworkInterfaces = /* @__PURE__ */ new Map();
|
|
81898
|
+
const sdkFrameworks = import_node_path81.default.join(
|
|
81899
|
+
swiftSdkPaths(frameworkRoot, options2.toolchainBin).darwin,
|
|
81900
|
+
"System/Library/Frameworks"
|
|
81901
|
+
);
|
|
81902
|
+
const generatedInterface = (source) => withoutImportedSdkEnumForwards(
|
|
81903
|
+
clangInterfaceHeader((0, import_node_fs81.readFileSync)(source, "utf8"), frameworkRoot),
|
|
81904
|
+
sdkObjCDeclarationOwners(sdkFrameworks)
|
|
81905
|
+
);
|
|
81906
|
+
const nativeDeclarations = /* @__PURE__ */ new Map();
|
|
81907
|
+
const nativeHeaders = Object.entries(input.files).filter(([name3]) => name3.endsWith(".h") && !name3.endsWith("-Swift.h")).map(([, source]) => source);
|
|
81908
|
+
for (const [file, contents2] of Object.entries(input.files)) {
|
|
81909
|
+
if (!file.endsWith(".modulemap")) continue;
|
|
81910
|
+
const name3 = moduleMapName(contents2);
|
|
81911
|
+
const umbrella = /\bumbrella\s+header\s+"([^"]+)"/.exec(contents2)?.[1];
|
|
81912
|
+
if (!name3 || !umbrella) continue;
|
|
81913
|
+
const header = input.files[import_node_path81.default.posix.join(import_node_path81.default.posix.dirname(file), umbrella)];
|
|
81914
|
+
if (header === void 0) continue;
|
|
81915
|
+
const included = new Set(
|
|
81916
|
+
[
|
|
81917
|
+
...header.matchAll(/^\s*#\s*(?:import|include)\s*[<"]([^">]+)[">]/gm)
|
|
81918
|
+
].map((match) => import_node_path81.default.posix.basename(match[1]))
|
|
81615
81919
|
);
|
|
81616
|
-
const
|
|
81617
|
-
|
|
81618
|
-
|
|
81619
|
-
|
|
81620
|
-
|
|
81621
|
-
|
|
81622
|
-
|
|
81623
|
-
|
|
81624
|
-
|
|
81625
|
-
|
|
81626
|
-
|
|
81627
|
-
|
|
81628
|
-
|
|
81629
|
-
|
|
81630
|
-
|
|
81631
|
-
"done",
|
|
81632
|
-
'case "$target/$compile" in',
|
|
81633
|
-
" *-*-linux*/1)",
|
|
81634
|
-
' case ",$PEACH_SWIFT_HOST_MACROS," in',
|
|
81635
|
-
' *",$module,"*) set -- "$@" -Xfrontend -import-module -Xfrontend Foundation ;;',
|
|
81636
|
-
" esac ;;",
|
|
81637
|
-
"esac",
|
|
81638
|
-
'exec "$PEACH_SWIFTC" "$@"',
|
|
81639
|
-
""
|
|
81640
|
-
].join("\n")
|
|
81641
|
-
);
|
|
81642
|
-
(0, import_node_fs81.chmodSync)(swiftc, 493);
|
|
81643
|
-
compiler.SWIFT_EXEC = swiftc;
|
|
81644
|
-
compiler.PEACH_SWIFT_HOST_MACROS = packageHostMacros.join(",");
|
|
81645
|
-
compiler.PEACH_SWIFTC = import_node_path81.default.join(options2.toolchainBin, "swiftc");
|
|
81920
|
+
const declarations = nativeDeclarations.get(name3) ?? /* @__PURE__ */ new Set();
|
|
81921
|
+
for (const declaration of swiftInterfaceDeclarations(header))
|
|
81922
|
+
declarations.add(declaration);
|
|
81923
|
+
for (const [candidate, source] of Object.entries(input.files))
|
|
81924
|
+
if (included.has(import_node_path81.default.posix.basename(candidate)))
|
|
81925
|
+
for (const declaration of swiftInterfaceDeclarations(source))
|
|
81926
|
+
declarations.add(declaration);
|
|
81927
|
+
nativeDeclarations.set(name3, declarations);
|
|
81928
|
+
}
|
|
81929
|
+
const frameworkInterface = (name3) => {
|
|
81930
|
+
if (frameworkInterfaces.has(name3)) return frameworkInterfaces.get(name3);
|
|
81931
|
+
const source = distribution ? import_node_path81.default.join(frameworkRoot, "modules", `${name3}-Swift.h`) : prebuilt.objcHeaders.get(name3);
|
|
81932
|
+
if (!source || !(0, import_node_fs81.existsSync)(source)) {
|
|
81933
|
+
frameworkInterfaces.set(name3, null);
|
|
81934
|
+
return null;
|
|
81646
81935
|
}
|
|
81647
|
-
const
|
|
81648
|
-
const
|
|
81649
|
-
|
|
81650
|
-
|
|
81651
|
-
|
|
81652
|
-
|
|
81653
|
-
|
|
81654
|
-
|
|
81655
|
-
|
|
81656
|
-
|
|
81657
|
-
|
|
81658
|
-
|
|
81659
|
-
|
|
81660
|
-
|
|
81661
|
-
|
|
81662
|
-
|
|
81663
|
-
|
|
81664
|
-
|
|
81936
|
+
const headers = import_node_path81.default.join(sdkFrameworks, `${name3}.framework/Headers`);
|
|
81937
|
+
const declared = /* @__PURE__ */ new Set();
|
|
81938
|
+
if ((0, import_node_fs81.existsSync)(headers)) {
|
|
81939
|
+
for (const file of (0, import_node_fs81.readdirSync)(headers, {
|
|
81940
|
+
recursive: true,
|
|
81941
|
+
encoding: "utf8"
|
|
81942
|
+
}))
|
|
81943
|
+
if (file.endsWith(".h"))
|
|
81944
|
+
for (const name4 of swiftInterfaceDeclarations(
|
|
81945
|
+
(0, import_node_fs81.readFileSync)(import_node_path81.default.join(headers, file), "utf8")
|
|
81946
|
+
))
|
|
81947
|
+
declared.add(name4);
|
|
81948
|
+
}
|
|
81949
|
+
for (const declaration of nativeDeclarations.get(name3) ?? [])
|
|
81950
|
+
declared.add(declaration);
|
|
81951
|
+
const own2 = withoutSwiftDeclarations(
|
|
81952
|
+
generatedInterface(source),
|
|
81953
|
+
declared,
|
|
81954
|
+
nativeDeclarations.has(name3) ? `@import ${name3};` : `#import <${name3}/${name3}.h>`
|
|
81665
81955
|
);
|
|
81666
|
-
const
|
|
81667
|
-
|
|
81668
|
-
|
|
81669
|
-
|
|
81670
|
-
|
|
81671
|
-
|
|
81672
|
-
|
|
81673
|
-
|
|
81674
|
-
|
|
81956
|
+
const owners = sdkObjCDeclarationOwners(sdkFrameworks);
|
|
81957
|
+
const foreign = /* @__PURE__ */ new Map();
|
|
81958
|
+
for (const declaration of [
|
|
81959
|
+
...swiftInterfaceDeclarations(own2),
|
|
81960
|
+
...objcEnumerations(own2),
|
|
81961
|
+
...[...own2.matchAll(/^\s*SWIFT_EXTERN\b[^(\n]*?\b(\w+)\s*\(/gm)].map(
|
|
81962
|
+
(match) => match[1]
|
|
81963
|
+
)
|
|
81964
|
+
]) {
|
|
81965
|
+
const owner = owners.get(declaration);
|
|
81966
|
+
if (owner && owner !== name3) foreign.set(declaration, owner);
|
|
81675
81967
|
}
|
|
81676
|
-
const
|
|
81677
|
-
|
|
81678
|
-
|
|
81679
|
-
|
|
81680
|
-
|
|
81681
|
-
|
|
81682
|
-
"
|
|
81683
|
-
|
|
81684
|
-
|
|
81685
|
-
|
|
81686
|
-
|
|
81687
|
-
|
|
81688
|
-
|
|
81689
|
-
|
|
81690
|
-
|
|
81691
|
-
sdk2,
|
|
81692
|
-
...preparation.targetToolset ? ["--toolset", import_node_path81.default.join(root, ".peach-target-toolset.json")] : [],
|
|
81693
|
-
"-c",
|
|
81694
|
-
"release",
|
|
81695
|
-
...input.unoptimized ? ["-Xswiftc", "-Onone"] : [],
|
|
81696
|
-
...perFile ? [
|
|
81697
|
-
"-Xswiftc",
|
|
81698
|
-
"-no-whole-module-optimization",
|
|
81699
|
-
"-Xswiftc",
|
|
81700
|
-
"-j",
|
|
81701
|
-
"-Xswiftc",
|
|
81702
|
-
String(jobs)
|
|
81703
|
-
] : [],
|
|
81704
|
-
...incrementalPreview ? ["-Xswiftc", "-incremental", "-Xswiftc", "-enable-batch-mode"] : [],
|
|
81705
|
-
// the mirror finds a changed sdk header's readers in their
|
|
81706
|
-
// dependency files, which omit system headers by default
|
|
81707
|
-
...mirrorDistribution ? ["-Xswiftc", "-track-system-dependencies"] : [],
|
|
81708
|
-
// the link strips debug info, so none is generated (as for the framework).
|
|
81709
|
-
// keep -num-threads fixed across caller core caps so llbuild does not
|
|
81710
|
-
// rebuild every target when callers alternate --cores, and bound backend
|
|
81711
|
-
// fan-out under high -j.
|
|
81712
|
-
"-Xswiftc",
|
|
81713
|
-
"-gnone",
|
|
81714
|
-
...incrementalPreview ? [] : [
|
|
81715
|
-
"-Xswiftc",
|
|
81716
|
-
"-num-threads",
|
|
81717
|
-
"-Xswiftc",
|
|
81718
|
-
String(perFile ? 1 : Math.min(8, import_node_os16.default.availableParallelism()))
|
|
81719
|
-
],
|
|
81720
|
-
...swiftReproducibleBuildFlags([
|
|
81721
|
-
[import_node_path81.default.dirname(options2.toolchainBin), "toolchain"],
|
|
81722
|
-
[compileFrameworkRoot, "framework"],
|
|
81723
|
-
[root, "build"],
|
|
81724
|
-
...forwarders
|
|
81725
|
-
]).flatMap((flag, index, flags) => {
|
|
81726
|
-
if (!nativeToolset || !flag.startsWith("-ffile-prefix-map="))
|
|
81727
|
-
return [flag];
|
|
81728
|
-
const toolchainDir = import_node_path81.default.dirname(options2.toolchainBin);
|
|
81729
|
-
let mapped = flag;
|
|
81730
|
-
for (const [dir, target] of [
|
|
81731
|
-
[root, "/peach/build"],
|
|
81732
|
-
[compileFrameworkRoot, "/peach/framework"],
|
|
81733
|
-
[(0, import_node_fs81.realpathSync)(compileFrameworkRoot), "/peach/framework"],
|
|
81734
|
-
[toolchainDir, "/peach/toolchain"],
|
|
81735
|
-
[(0, import_node_fs81.realpathSync)(toolchainDir), "/peach/toolchain"]
|
|
81736
|
-
]) {
|
|
81737
|
-
mapped = mapped.replaceAll(dir, target);
|
|
81738
|
-
}
|
|
81739
|
-
const [, from, to] = /^-ffile-prefix-map=([^=]+)=(.+)$/.exec(mapped) ?? [];
|
|
81740
|
-
const tool = flags[index - 1];
|
|
81741
|
-
return mapped !== flag && from !== to ? [flag, tool, mapped] : [flag];
|
|
81742
|
-
}),
|
|
81743
|
-
...macroPlugins.libraries.flatMap((plugin) => [
|
|
81744
|
-
"-Xswiftc",
|
|
81745
|
-
"-load-plugin-library",
|
|
81746
|
-
"-Xswiftc",
|
|
81747
|
-
plugin
|
|
81748
|
-
]),
|
|
81749
|
-
...macroPlugins.executables.flatMap((plugin) => [
|
|
81750
|
-
"-Xswiftc",
|
|
81751
|
-
"-load-plugin-executable",
|
|
81752
|
-
"-Xswiftc",
|
|
81753
|
-
`${plugin}#ExpoModulesMacros`
|
|
81754
|
-
])
|
|
81755
|
-
];
|
|
81756
|
-
const linked = builtArtifact(layout2);
|
|
81757
|
-
(0, import_node_fs81.rmSync)(import_node_path81.default.join(root, ".peach-link.rsp"), { force: true });
|
|
81758
|
-
if (options2.linkOnly || (0, import_node_fs81.existsSync)(linked) && (0, import_node_fs81.statSync)(linked).size <= 8)
|
|
81759
|
-
(0, import_node_fs81.rmSync)(linked, { force: true });
|
|
81760
|
-
report("compiling and linking Swift modules");
|
|
81761
|
-
const frameworkInterfaces = /* @__PURE__ */ new Map();
|
|
81762
|
-
const sdkFrameworks = import_node_path81.default.join(
|
|
81763
|
-
swiftSdkPaths(frameworkRoot, options2.toolchainBin).darwin,
|
|
81764
|
-
"System/Library/Frameworks"
|
|
81968
|
+
const header = foreign.size ? withoutSwiftDeclarations(
|
|
81969
|
+
own2,
|
|
81970
|
+
new Set(foreign.keys()),
|
|
81971
|
+
[...new Set(foreign.values())].map((owner) => `#import <${owner}/${owner}.h>`).join("\n")
|
|
81972
|
+
) : own2;
|
|
81973
|
+
const value = {
|
|
81974
|
+
file: import_node_path81.default.join(root2, ".build/peach-framework-objc", `${name3}-Swift.h`),
|
|
81975
|
+
header,
|
|
81976
|
+
module: (0, import_node_fs81.existsSync)(headers)
|
|
81977
|
+
};
|
|
81978
|
+
frameworkInterfaces.set(name3, value);
|
|
81979
|
+
writeBuildFile(
|
|
81980
|
+
value.file,
|
|
81981
|
+
((0, import_node_fs81.existsSync)(import_node_path81.default.join(headers, `${name3}.h`)) ? `#import <${name3}/${name3}.h>
|
|
81982
|
+
` : "") + swiftHeaderWithSuperclassImports(header, frameworkInterface)
|
|
81765
81983
|
);
|
|
81766
|
-
|
|
81767
|
-
|
|
81768
|
-
|
|
81984
|
+
return value;
|
|
81985
|
+
};
|
|
81986
|
+
const headerPaths = (producer) => {
|
|
81987
|
+
const stem2 = import_node_path81.default.join(
|
|
81988
|
+
root2,
|
|
81989
|
+
".build",
|
|
81990
|
+
"peach-cxx-headers",
|
|
81991
|
+
`${producer}-Swift`
|
|
81769
81992
|
);
|
|
81770
|
-
|
|
81771
|
-
|
|
81772
|
-
|
|
81773
|
-
|
|
81774
|
-
|
|
81775
|
-
|
|
81776
|
-
|
|
81777
|
-
|
|
81778
|
-
|
|
81779
|
-
|
|
81780
|
-
|
|
81781
|
-
|
|
81782
|
-
|
|
81783
|
-
|
|
81784
|
-
|
|
81785
|
-
|
|
81786
|
-
|
|
81787
|
-
|
|
81788
|
-
|
|
81789
|
-
|
|
81790
|
-
|
|
81791
|
-
|
|
81792
|
-
|
|
81793
|
-
|
|
81794
|
-
|
|
81795
|
-
|
|
81796
|
-
|
|
81797
|
-
|
|
81798
|
-
|
|
81799
|
-
}
|
|
81800
|
-
|
|
81801
|
-
|
|
81802
|
-
|
|
81803
|
-
|
|
81804
|
-
|
|
81805
|
-
|
|
81806
|
-
|
|
81807
|
-
|
|
81808
|
-
|
|
81809
|
-
|
|
81810
|
-
|
|
81811
|
-
|
|
81812
|
-
|
|
81813
|
-
|
|
81814
|
-
|
|
81815
|
-
|
|
81816
|
-
|
|
81817
|
-
|
|
81818
|
-
nativeDeclarations.has(name3) ? `@import ${name3};` : `#import <${name3}/${name3}.h>`
|
|
81819
|
-
);
|
|
81820
|
-
const owners = sdkObjCDeclarationOwners(sdkFrameworks);
|
|
81821
|
-
const foreign = /* @__PURE__ */ new Map();
|
|
81822
|
-
for (const declaration of [
|
|
81823
|
-
...swiftInterfaceDeclarations(own2),
|
|
81824
|
-
...objcEnumerations(own2),
|
|
81825
|
-
...[...own2.matchAll(/^\s*SWIFT_EXTERN\b[^(\n]*?\b(\w+)\s*\(/gm)].map(
|
|
81826
|
-
(match) => match[1]
|
|
81827
|
-
)
|
|
81828
|
-
]) {
|
|
81829
|
-
const owner = owners.get(declaration);
|
|
81830
|
-
if (owner && owner !== name3) foreign.set(declaration, owner);
|
|
81993
|
+
return { producer, original: `${stem2}.original.h`, emitted: `${stem2}.h` };
|
|
81994
|
+
};
|
|
81995
|
+
const publishHeader = ({
|
|
81996
|
+
producer,
|
|
81997
|
+
original,
|
|
81998
|
+
emitted
|
|
81999
|
+
}) => {
|
|
82000
|
+
const generated = generatedInterface(original);
|
|
82001
|
+
writeBuildFile(
|
|
82002
|
+
emitted,
|
|
82003
|
+
withoutSwiftDeclarations(
|
|
82004
|
+
swiftHeaderWithSuperclassImports(generated, frameworkInterface),
|
|
82005
|
+
/* @__PURE__ */ new Set([
|
|
82006
|
+
...preparation.nativeHeaderDeclarations[producer] ?? [],
|
|
82007
|
+
...nativelyDeclaredFunctions(generated, nativeHeaders)
|
|
82008
|
+
]),
|
|
82009
|
+
`#import <${producer}/${producer}.h>`
|
|
82010
|
+
)
|
|
82011
|
+
);
|
|
82012
|
+
};
|
|
82013
|
+
const recipe2 = inputHash.copy().update(
|
|
82014
|
+
distribution ? swiftCompileSurfaceDigest(frameworkRoot) : moduleDigest
|
|
82015
|
+
).update((0, import_node_fs81.readFileSync)(import_node_path81.default.join(root2, "Package.swift"))).update(JSON.stringify(buildArgs)).digest("hex");
|
|
82016
|
+
const runApp = async (compiler2) => {
|
|
82017
|
+
const optionsWithCompiler = compiler2 ? { ...appOptions, env: { ...appOptions.env, ...compiler2 } } : appOptions;
|
|
82018
|
+
const stages = [
|
|
82019
|
+
...(preparation.nativePrerequisiteTargets ?? []).map((target) => ({
|
|
82020
|
+
target,
|
|
82021
|
+
producers: []
|
|
82022
|
+
})),
|
|
82023
|
+
...preparation.headerBuilds,
|
|
82024
|
+
...(preparation.nativeProductTargets ?? []).map((target) => ({
|
|
82025
|
+
target,
|
|
82026
|
+
producers: []
|
|
82027
|
+
}))
|
|
82028
|
+
];
|
|
82029
|
+
const checkpoints = import_node_path81.default.join(root2, ".build", "peach-product-checkpoints");
|
|
82030
|
+
const buildDbExists = (0, import_node_fs81.existsSync)(import_node_path81.default.join(root2, ".build", "build.db"));
|
|
82031
|
+
const releaseDir = import_node_path81.default.dirname(linked);
|
|
82032
|
+
for (const { target, producers } of stages) {
|
|
82033
|
+
if (!options2.project && producers.length === 0 && buildDbExists) {
|
|
82034
|
+
const expectedObjects = preparation.nativeStageObjects.get(target);
|
|
82035
|
+
if (expectedObjects && expectedObjects.length > 0 && expectedObjects.every(
|
|
82036
|
+
(relative7) => (0, import_node_fs81.statSync)(import_node_path81.default.join(releaseDir, relative7), {
|
|
82037
|
+
throwIfNoEntry: false
|
|
82038
|
+
})?.isFile()
|
|
82039
|
+
))
|
|
82040
|
+
continue;
|
|
81831
82041
|
}
|
|
81832
|
-
const
|
|
81833
|
-
|
|
81834
|
-
|
|
81835
|
-
[...new Set(foreign.values())].map((owner) => `#import <${owner}/${owner}.h>`).join("\n")
|
|
81836
|
-
) : own2;
|
|
81837
|
-
const value = {
|
|
81838
|
-
file: import_node_path81.default.join(root, ".build/peach-framework-objc", `${name3}-Swift.h`),
|
|
81839
|
-
header,
|
|
81840
|
-
module: (0, import_node_fs81.existsSync)(headers)
|
|
81841
|
-
};
|
|
81842
|
-
frameworkInterfaces.set(name3, value);
|
|
81843
|
-
writeBuildFile(
|
|
81844
|
-
value.file,
|
|
81845
|
-
((0, import_node_fs81.existsSync)(import_node_path81.default.join(headers, `${name3}.h`)) ? `#import <${name3}/${name3}.h>
|
|
81846
|
-
` : "") + swiftHeaderWithSuperclassImports(header, frameworkInterface)
|
|
82042
|
+
const receipt = import_node_path81.default.join(
|
|
82043
|
+
checkpoints,
|
|
82044
|
+
(0, import_node_crypto48.createHash)("sha256").update(target).digest("hex")
|
|
81847
82045
|
);
|
|
81848
|
-
|
|
81849
|
-
|
|
81850
|
-
|
|
81851
|
-
const
|
|
81852
|
-
|
|
81853
|
-
|
|
81854
|
-
|
|
81855
|
-
|
|
81856
|
-
|
|
81857
|
-
|
|
81858
|
-
};
|
|
81859
|
-
const publishHeader = ({
|
|
81860
|
-
producer,
|
|
81861
|
-
original,
|
|
81862
|
-
emitted
|
|
81863
|
-
}) => {
|
|
81864
|
-
const generated = generatedInterface(original);
|
|
81865
|
-
writeBuildFile(
|
|
81866
|
-
emitted,
|
|
81867
|
-
withoutSwiftDeclarations(
|
|
81868
|
-
swiftHeaderWithSuperclassImports(generated, frameworkInterface),
|
|
81869
|
-
/* @__PURE__ */ new Set([
|
|
81870
|
-
...preparation.nativeHeaderDeclarations[producer] ?? [],
|
|
81871
|
-
...nativelyDeclaredFunctions(generated, nativeHeaders)
|
|
81872
|
-
]),
|
|
81873
|
-
`#import <${producer}/${producer}.h>`
|
|
81874
|
-
)
|
|
81875
|
-
);
|
|
81876
|
-
};
|
|
81877
|
-
const recipe2 = inputHash.copy().update(
|
|
81878
|
-
distribution ? swiftCompileSurfaceDigest(frameworkRoot) : moduleDigest
|
|
81879
|
-
).update((0, import_node_fs81.readFileSync)(import_node_path81.default.join(root, "Package.swift"))).update(JSON.stringify(buildArgs)).digest("hex");
|
|
81880
|
-
const runApp = async (compiler2) => {
|
|
81881
|
-
const optionsWithCompiler = compiler2 ? { ...appOptions, env: { ...appOptions.env, ...compiler2 } } : appOptions;
|
|
81882
|
-
const stages = [
|
|
81883
|
-
...(preparation.nativePrerequisiteTargets ?? []).map((target) => ({
|
|
81884
|
-
target,
|
|
81885
|
-
producers: []
|
|
81886
|
-
})),
|
|
81887
|
-
...preparation.headerBuilds,
|
|
81888
|
-
...(preparation.nativeProductTargets ?? []).map((target) => ({
|
|
81889
|
-
target,
|
|
81890
|
-
producers: []
|
|
81891
|
-
}))
|
|
81892
|
-
];
|
|
81893
|
-
const checkpoints = import_node_path81.default.join(root, ".build", "peach-product-checkpoints");
|
|
81894
|
-
const buildDbExists = (0, import_node_fs81.existsSync)(import_node_path81.default.join(root, ".build", "build.db"));
|
|
81895
|
-
const releaseDir = import_node_path81.default.dirname(linked);
|
|
81896
|
-
for (const { target, producers } of stages) {
|
|
81897
|
-
if (!options2.project && producers.length === 0 && buildDbExists) {
|
|
81898
|
-
const expectedObjects = preparation.nativeStageObjects.get(target);
|
|
81899
|
-
if (expectedObjects && expectedObjects.length > 0 && expectedObjects.every(
|
|
81900
|
-
(relative7) => (0, import_node_fs81.statSync)(import_node_path81.default.join(releaseDir, relative7), {
|
|
81901
|
-
throwIfNoEntry: false
|
|
81902
|
-
})?.isFile()
|
|
81903
|
-
))
|
|
81904
|
-
continue;
|
|
81905
|
-
}
|
|
81906
|
-
const receipt = import_node_path81.default.join(
|
|
81907
|
-
checkpoints,
|
|
81908
|
-
(0, import_node_crypto48.createHash)("sha256").update(target).digest("hex")
|
|
81909
|
-
);
|
|
81910
|
-
const headers = producers.map(headerPaths);
|
|
81911
|
-
for (const header of headers)
|
|
81912
|
-
if ((0, import_node_fs81.existsSync)(header.original)) publishHeader(header);
|
|
81913
|
-
const fingerprint = () => {
|
|
81914
|
-
const digest3 = (0, import_node_crypto48.createHash)("sha256").update(recipe2);
|
|
81915
|
-
for (const { original, emitted } of headers) {
|
|
81916
|
-
if (!(0, import_node_fs81.existsSync)(original) || !(0, import_node_fs81.existsSync)(emitted)) return;
|
|
81917
|
-
digest3.update(
|
|
81918
|
-
(0, import_node_crypto48.createHash)("sha256").update((0, import_node_fs81.readFileSync)(emitted)).digest()
|
|
81919
|
-
);
|
|
81920
|
-
}
|
|
81921
|
-
return digest3.digest("hex");
|
|
81922
|
-
};
|
|
81923
|
-
if (!options2.project && (0, import_node_fs81.existsSync)(receipt) && (0, import_node_fs81.readFileSync)(receipt, "utf8") === fingerprint())
|
|
81924
|
-
continue;
|
|
81925
|
-
if (!options2.project) (0, import_node_fs81.rmSync)(receipt, { force: true });
|
|
81926
|
-
for (const header of headers) {
|
|
81927
|
-
if (!(0, import_node_fs81.existsSync)(header.original))
|
|
81928
|
-
(0, import_node_fs81.rmSync)(
|
|
81929
|
-
import_node_path81.default.join(
|
|
81930
|
-
import_node_path81.default.dirname(linked),
|
|
81931
|
-
"Modules",
|
|
81932
|
-
`${swiftTargetModuleName(header.producer)}.swiftmodule`
|
|
81933
|
-
),
|
|
81934
|
-
{ force: true }
|
|
81935
|
-
);
|
|
81936
|
-
}
|
|
81937
|
-
await runCompiler(
|
|
81938
|
-
swift,
|
|
81939
|
-
[...buildArgs, "--target", target],
|
|
81940
|
-
optionsWithCompiler,
|
|
81941
|
-
/^(?:\[swift-prebuilt\]|\[\d+\/\d+\] )/,
|
|
81942
|
-
SWIFTPM_NOISE
|
|
81943
|
-
);
|
|
81944
|
-
if (!compiler2) for (const header of headers) publishHeader(header);
|
|
81945
|
-
if (!options2.project) {
|
|
81946
|
-
const checkpoint = fingerprint();
|
|
81947
|
-
if (checkpoint === void 0)
|
|
81948
|
-
throw new Error(`missing Swift headers after building ${target}`);
|
|
81949
|
-
(0, import_node_fs81.mkdirSync)(checkpoints, { recursive: true });
|
|
81950
|
-
(0, import_node_fs81.writeFileSync)(`${receipt}.partial`, checkpoint);
|
|
81951
|
-
(0, import_node_fs81.renameSync)(`${receipt}.partial`, receipt);
|
|
82046
|
+
const headers = producers.map(headerPaths);
|
|
82047
|
+
for (const header of headers)
|
|
82048
|
+
if ((0, import_node_fs81.existsSync)(header.original)) publishHeader(header);
|
|
82049
|
+
const fingerprint = () => {
|
|
82050
|
+
const digest3 = (0, import_node_crypto48.createHash)("sha256").update(recipe2);
|
|
82051
|
+
for (const { original, emitted } of headers) {
|
|
82052
|
+
if (!(0, import_node_fs81.existsSync)(original) || !(0, import_node_fs81.existsSync)(emitted)) return;
|
|
82053
|
+
digest3.update(
|
|
82054
|
+
(0, import_node_crypto48.createHash)("sha256").update((0, import_node_fs81.readFileSync)(emitted)).digest()
|
|
82055
|
+
);
|
|
81952
82056
|
}
|
|
82057
|
+
return digest3.digest("hex");
|
|
82058
|
+
};
|
|
82059
|
+
if (!options2.project && (0, import_node_fs81.existsSync)(receipt) && (0, import_node_fs81.readFileSync)(receipt, "utf8") === fingerprint())
|
|
82060
|
+
continue;
|
|
82061
|
+
if (!options2.project) (0, import_node_fs81.rmSync)(receipt, { force: true });
|
|
82062
|
+
for (const header of headers) {
|
|
82063
|
+
if (!(0, import_node_fs81.existsSync)(header.original))
|
|
82064
|
+
(0, import_node_fs81.rmSync)(
|
|
82065
|
+
import_node_path81.default.join(
|
|
82066
|
+
import_node_path81.default.dirname(linked),
|
|
82067
|
+
"Modules",
|
|
82068
|
+
`${swiftTargetModuleName(header.producer)}.swiftmodule`
|
|
82069
|
+
),
|
|
82070
|
+
{ force: true }
|
|
82071
|
+
);
|
|
81953
82072
|
}
|
|
81954
82073
|
await runCompiler(
|
|
81955
82074
|
swift,
|
|
81956
|
-
buildArgs,
|
|
82075
|
+
[...buildArgs, "--target", target],
|
|
81957
82076
|
optionsWithCompiler,
|
|
81958
|
-
|
|
82077
|
+
/^(?:\[swift-prebuilt\]|\[\d+\/\d+\] )/,
|
|
81959
82078
|
SWIFTPM_NOISE
|
|
81960
82079
|
);
|
|
81961
|
-
|
|
81962
|
-
|
|
81963
|
-
|
|
81964
|
-
|
|
81965
|
-
|
|
81966
|
-
|
|
81967
|
-
|
|
81968
|
-
|
|
81969
|
-
|
|
81970
|
-
|
|
81971
|
-
|
|
81972
|
-
|
|
81973
|
-
|
|
81974
|
-
|
|
81975
|
-
|
|
81976
|
-
|
|
81977
|
-
|
|
81978
|
-
|
|
81979
|
-
|
|
81980
|
-
|
|
81981
|
-
|
|
81982
|
-
|
|
81983
|
-
|
|
81984
|
-
|
|
81985
|
-
|
|
81986
|
-
|
|
81987
|
-
|
|
81988
|
-
|
|
81989
|
-
|
|
81990
|
-
|
|
81991
|
-
|
|
81992
|
-
|
|
81993
|
-
|
|
81994
|
-
|
|
81995
|
-
|
|
81996
|
-
|
|
81997
|
-
|
|
81998
|
-
|
|
81999
|
-
|
|
82000
|
-
|
|
82001
|
-
|
|
82002
|
-
|
|
82003
|
-
|
|
82004
|
-
|
|
82005
|
-
|
|
82080
|
+
if (!compiler2) for (const header of headers) publishHeader(header);
|
|
82081
|
+
if (!options2.project) {
|
|
82082
|
+
const checkpoint = fingerprint();
|
|
82083
|
+
if (checkpoint === void 0)
|
|
82084
|
+
throw new Error(`missing Swift headers after building ${target}`);
|
|
82085
|
+
(0, import_node_fs81.mkdirSync)(checkpoints, { recursive: true });
|
|
82086
|
+
(0, import_node_fs81.writeFileSync)(`${receipt}.partial`, checkpoint);
|
|
82087
|
+
(0, import_node_fs81.renameSync)(`${receipt}.partial`, receipt);
|
|
82088
|
+
}
|
|
82089
|
+
}
|
|
82090
|
+
await runCompiler(
|
|
82091
|
+
swift,
|
|
82092
|
+
buildArgs,
|
|
82093
|
+
optionsWithCompiler,
|
|
82094
|
+
SWIFTPM_PROGRESS,
|
|
82095
|
+
SWIFTPM_NOISE
|
|
82096
|
+
);
|
|
82097
|
+
};
|
|
82098
|
+
const compileApp = () => preparation.headerCompiler ? withSwiftHeaderCompiler(
|
|
82099
|
+
root2,
|
|
82100
|
+
options2.toolchainBin,
|
|
82101
|
+
recipe2,
|
|
82102
|
+
new Map(
|
|
82103
|
+
preparation.headerBuilds[0].producers.map((producer) => {
|
|
82104
|
+
const paths = headerPaths(producer);
|
|
82105
|
+
return [
|
|
82106
|
+
swiftTargetModuleName(producer),
|
|
82107
|
+
{
|
|
82108
|
+
header: paths.original,
|
|
82109
|
+
publish: () => publishHeader(paths)
|
|
82110
|
+
}
|
|
82111
|
+
];
|
|
82112
|
+
})
|
|
82113
|
+
),
|
|
82114
|
+
runApp
|
|
82115
|
+
) : runApp();
|
|
82116
|
+
try {
|
|
82117
|
+
if (temporaryDirectory) (0, import_node_fs81.mkdirSync)(temporaryDirectory, { recursive: true });
|
|
82118
|
+
await compileApp();
|
|
82119
|
+
} catch (error) {
|
|
82120
|
+
const output2 = outputOf(error);
|
|
82121
|
+
const moduleCache = import_node_path81.default.join(
|
|
82122
|
+
root2,
|
|
82123
|
+
".build",
|
|
82124
|
+
WASM_TRIPLE,
|
|
82125
|
+
"release",
|
|
82126
|
+
"ModuleCache"
|
|
82127
|
+
);
|
|
82128
|
+
if (output2.includes("was compiled with module cache path") && (0, import_node_fs81.existsSync)(moduleCache)) {
|
|
82129
|
+
(0, import_node_fs81.rmSync)(moduleCache, { recursive: true, force: true });
|
|
82130
|
+
try {
|
|
82131
|
+
await compileApp();
|
|
82132
|
+
} catch (retryError) {
|
|
82006
82133
|
throw new Error(
|
|
82007
|
-
[
|
|
82008
|
-
|
|
82009
|
-
|
|
82010
|
-
|
|
82134
|
+
[
|
|
82135
|
+
...unprepared,
|
|
82136
|
+
projectDiagnostic(outputOf(retryError), layout3, input.files)
|
|
82137
|
+
].join("\n"),
|
|
82138
|
+
{ cause: retryError }
|
|
82011
82139
|
);
|
|
82012
82140
|
}
|
|
82013
|
-
}
|
|
82014
|
-
if (temporaryDirectory)
|
|
82015
|
-
(0, import_node_fs81.rmSync)(temporaryDirectory, { recursive: true, force: true });
|
|
82016
|
-
if (options2.project) endSwiftProjectProcesses(options2.project);
|
|
82017
|
-
}
|
|
82018
|
-
if (unprepared.length) throw new Error(unprepared.join("\n"));
|
|
82019
|
-
if (!(0, import_node_fs81.existsSync)(linked)) {
|
|
82020
|
-
const binDir = import_node_path81.default.dirname(linked);
|
|
82021
|
-
const found2 = (0, import_node_fs81.existsSync)(binDir) ? (0, import_node_fs81.readdirSync)(binDir).filter((name3) => name3.endsWith(".wasm")).sort() : [];
|
|
82141
|
+
} else {
|
|
82022
82142
|
throw new Error(
|
|
82023
|
-
|
|
82143
|
+
[...unprepared, projectDiagnostic(output2, layout3, input.files)].join(
|
|
82144
|
+
"\n"
|
|
82145
|
+
),
|
|
82146
|
+
{ cause: error }
|
|
82024
82147
|
);
|
|
82025
82148
|
}
|
|
82026
|
-
|
|
82027
|
-
|
|
82028
|
-
(
|
|
82149
|
+
} finally {
|
|
82150
|
+
if (temporaryDirectory)
|
|
82151
|
+
(0, import_node_fs81.rmSync)(temporaryDirectory, { recursive: true, force: true });
|
|
82152
|
+
if (options2.project) endSwiftProjectProcesses(options2.project);
|
|
82153
|
+
}
|
|
82154
|
+
if (unprepared.length) throw new Error(unprepared.join("\n"));
|
|
82155
|
+
if (!(0, import_node_fs81.existsSync)(linked)) {
|
|
82156
|
+
const binDir = import_node_path81.default.dirname(linked);
|
|
82157
|
+
const found2 = (0, import_node_fs81.existsSync)(binDir) ? (0, import_node_fs81.readdirSync)(binDir).filter((name3) => name3.endsWith(".wasm")).sort() : [];
|
|
82158
|
+
throw new Error(
|
|
82159
|
+
`swift-compile: the build produced no ${import_node_path81.default.basename(linked)} (found: ${found2.join(", ") || "none"})`
|
|
82029
82160
|
);
|
|
82030
|
-
|
|
82031
|
-
|
|
82032
|
-
|
|
82033
|
-
|
|
82034
|
-
|
|
82035
|
-
|
|
82036
|
-
|
|
82037
|
-
|
|
82038
|
-
|
|
82039
|
-
|
|
82040
|
-
|
|
82041
|
-
|
|
82042
|
-
|
|
82043
|
-
|
|
82044
|
-
|
|
82045
|
-
|
|
82046
|
-
|
|
82047
|
-
const optimized = `${output}.optimized`;
|
|
82048
|
-
if (sdkImage && options2.project) (0, import_node_fs81.rmSync)(optimized, { force: true });
|
|
82049
|
-
let sdkAsset;
|
|
82050
|
-
if (guestGraph) {
|
|
82051
|
-
const binding = await compileGuestLink({
|
|
82052
|
-
graph: guestGraph,
|
|
82053
|
-
buildDirectory: root,
|
|
82054
|
-
releaseDirectory: import_node_path81.default.dirname(linked),
|
|
82055
|
-
moduleRoot: frameworkRoot,
|
|
82056
|
-
toolchainBin: options2.toolchainBin,
|
|
82057
|
-
swiftCompiler: preparation.headerCompiler ? import_node_path81.default.join(root, SWIFT_HEADER_COMPILER_WRAPPER) : compiler.SWIFT_EXEC ?? import_node_path81.default.join(options2.toolchainBin, "swiftc"),
|
|
82058
|
-
sysroot: swiftSdkPaths(frameworkRoot, options2.toolchainBin).sysroot,
|
|
82059
|
-
sdk: swiftModuleSdk(frameworkRoot),
|
|
82060
|
-
sdkImage,
|
|
82061
|
-
compilerDigest: compilerSourceDigest,
|
|
82062
|
-
project: options2.project && {
|
|
82063
|
-
...options2.project,
|
|
82064
|
-
env: { ...options2.project.env, ...projectProcess?.env }
|
|
82065
|
-
},
|
|
82066
|
-
staticClangTargets: input.staticClangTargets ?? [],
|
|
82067
|
-
resourceReferences,
|
|
82068
|
-
resourceBundles: input.resourceBundles ?? [],
|
|
82069
|
-
generatedOwners: preparation.generatedOwners,
|
|
82070
|
-
output,
|
|
82071
|
-
optimized,
|
|
82072
|
-
optimize: input.optimize === true,
|
|
82073
|
-
jobs: swiftBuildJobs()
|
|
82074
|
-
});
|
|
82075
|
-
if (sdkImage && binding)
|
|
82076
|
-
sdkAsset = { key: sdkImage.key, sha256: sdkImage.sha256, binding };
|
|
82077
|
-
} else if (sdkImage) {
|
|
82078
|
-
const { buildSwiftAppModule: buildSwiftAppModule2 } = await Promise.resolve().then(() => (init_swift_sdk_app_module(), swift_sdk_app_module_exports));
|
|
82079
|
-
const binding = await buildSwiftAppModule2({
|
|
82080
|
-
buildRoot: root,
|
|
82081
|
-
toolchainBin: options2.toolchainBin,
|
|
82082
|
-
sdk: sdkImage,
|
|
82083
|
-
output: optimized,
|
|
82084
|
-
optimize: input.optimize === true,
|
|
82085
|
-
project: options2.project && {
|
|
82086
|
-
...options2.project,
|
|
82087
|
-
env: { ...options2.project.env, ...projectProcess?.env },
|
|
82088
|
-
sdkRoot: import_node_path81.default.dirname(
|
|
82089
|
-
swiftSdkPaths(frameworkRoot, options2.toolchainBin).sysroot
|
|
82090
|
-
),
|
|
82091
|
-
linked: output
|
|
82092
|
-
}
|
|
82093
|
-
});
|
|
82094
|
-
sdkAsset = { key: sdkImage.key, sha256: sdkImage.sha256, binding };
|
|
82095
|
-
} else {
|
|
82096
|
-
const bytes = (0, import_node_fs81.readFileSync)(output);
|
|
82097
|
-
const ordered = orderObjCConstructors(bytes);
|
|
82098
|
-
if (ordered !== bytes) (0, import_node_fs81.writeFileSync)(output, ordered);
|
|
82099
|
-
await lowerWasm(output, optimized, { optimize: input.optimize === true });
|
|
82100
|
-
}
|
|
82101
|
-
if (!sdkImage)
|
|
82102
|
-
await runCompiler(
|
|
82103
|
-
import_node_path81.default.join(options2.toolchainBin, "llvm-objcopy"),
|
|
82104
|
-
["--remove-section=.swift1_autolink_entries", optimized],
|
|
82105
|
-
buildOptions
|
|
82106
|
-
);
|
|
82107
|
-
const artifact = {
|
|
82108
|
-
hash,
|
|
82109
|
-
bytes: (0, import_node_fs81.readFileSync)(optimized),
|
|
82110
|
-
icu: await icu,
|
|
82111
|
-
sdk: sdkAsset
|
|
82112
|
-
};
|
|
82113
|
-
if (artifact.bytes.length <= 8)
|
|
82161
|
+
}
|
|
82162
|
+
if (options2.project) removeProjectLinks(root2);
|
|
82163
|
+
const resourceReferences = Object.values(input.resources ?? {}).map(
|
|
82164
|
+
(value) => Buffer.from(value, "base64")
|
|
82165
|
+
);
|
|
82166
|
+
if (!guestGraph)
|
|
82167
|
+
pruneSwiftWasmLink(
|
|
82168
|
+
root2,
|
|
82169
|
+
options2.toolchainBin,
|
|
82170
|
+
prebuilt?.root ?? frameworkRoot,
|
|
82171
|
+
input.staticClangTargets,
|
|
82172
|
+
options2.project,
|
|
82173
|
+
void 0,
|
|
82174
|
+
resourceReferences
|
|
82175
|
+
);
|
|
82176
|
+
if (options2.linkOnly) {
|
|
82177
|
+
if ((0, import_node_fs81.statSync)(linked).size <= 8)
|
|
82114
82178
|
throw new Error("swift-compile: deferred linker produced no executable");
|
|
82115
|
-
|
|
82116
|
-
|
|
82117
|
-
report("compiled artifact verified");
|
|
82118
|
-
return retain(root, artifact);
|
|
82119
|
-
} finally {
|
|
82120
|
-
readHold?.release();
|
|
82179
|
+
stage("project link verified");
|
|
82180
|
+
return;
|
|
82121
82181
|
}
|
|
82122
|
-
|
|
82123
|
-
|
|
82124
|
-
|
|
82182
|
+
const output = options2.project ? projectOutputFile(root2, linked, options2.project) : linked;
|
|
82183
|
+
const optimized = `${output}.optimized`;
|
|
82184
|
+
if (sdkImage && options2.project) (0, import_node_fs81.rmSync)(optimized, { force: true });
|
|
82185
|
+
let sdkAsset;
|
|
82186
|
+
stage("linking the app image");
|
|
82187
|
+
if (guestGraph) {
|
|
82188
|
+
const binding = await compileGuestLink({
|
|
82189
|
+
graph: guestGraph,
|
|
82190
|
+
buildDirectory: root2,
|
|
82191
|
+
releaseDirectory: import_node_path81.default.dirname(linked),
|
|
82192
|
+
moduleRoot: frameworkRoot,
|
|
82193
|
+
toolchainBin: options2.toolchainBin,
|
|
82194
|
+
swiftCompiler: preparation.headerCompiler ? import_node_path81.default.join(root2, SWIFT_HEADER_COMPILER_WRAPPER) : compiler.SWIFT_EXEC ?? import_node_path81.default.join(options2.toolchainBin, "swiftc"),
|
|
82195
|
+
sysroot: swiftSdkPaths(frameworkRoot, options2.toolchainBin).sysroot,
|
|
82196
|
+
sdk: swiftModuleSdk(frameworkRoot),
|
|
82197
|
+
sdkImage,
|
|
82198
|
+
compilerDigest: compilerSourceDigest,
|
|
82199
|
+
project: options2.project && {
|
|
82200
|
+
...options2.project,
|
|
82201
|
+
env: { ...options2.project.env, ...projectProcess?.env }
|
|
82202
|
+
},
|
|
82203
|
+
staticClangTargets: input.staticClangTargets ?? [],
|
|
82204
|
+
resourceReferences,
|
|
82205
|
+
resourceBundles: input.resourceBundles ?? [],
|
|
82206
|
+
generatedOwners: preparation.generatedOwners,
|
|
82207
|
+
output,
|
|
82208
|
+
optimized,
|
|
82209
|
+
optimize: input.optimize === true,
|
|
82210
|
+
jobs: swiftBuildJobs(),
|
|
82211
|
+
onStage: stage
|
|
82212
|
+
});
|
|
82213
|
+
if (sdkImage && binding)
|
|
82214
|
+
sdkAsset = { key: sdkImage.key, sha256: sdkImage.sha256, binding };
|
|
82215
|
+
} else if (sdkImage) {
|
|
82216
|
+
const { buildSwiftAppModule: buildSwiftAppModule2 } = await Promise.resolve().then(() => (init_swift_sdk_app_module(), swift_sdk_app_module_exports));
|
|
82217
|
+
const binding = await buildSwiftAppModule2({
|
|
82218
|
+
buildRoot: root2,
|
|
82219
|
+
toolchainBin: options2.toolchainBin,
|
|
82220
|
+
sdk: sdkImage,
|
|
82221
|
+
output: optimized,
|
|
82222
|
+
optimize: input.optimize === true,
|
|
82223
|
+
project: options2.project && {
|
|
82224
|
+
...options2.project,
|
|
82225
|
+
env: { ...options2.project.env, ...projectProcess?.env },
|
|
82226
|
+
sdkRoot: import_node_path81.default.dirname(
|
|
82227
|
+
swiftSdkPaths(frameworkRoot, options2.toolchainBin).sysroot
|
|
82228
|
+
),
|
|
82229
|
+
linked: output
|
|
82230
|
+
}
|
|
82231
|
+
});
|
|
82232
|
+
sdkAsset = { key: sdkImage.key, sha256: sdkImage.sha256, binding };
|
|
82233
|
+
} else {
|
|
82234
|
+
const bytes = (0, import_node_fs81.readFileSync)(output);
|
|
82235
|
+
const ordered = orderObjCConstructors(bytes);
|
|
82236
|
+
if (ordered !== bytes) (0, import_node_fs81.writeFileSync)(output, ordered);
|
|
82237
|
+
stage("lowering the app image");
|
|
82238
|
+
await lowerWasm(output, optimized, { optimize: input.optimize === true });
|
|
82239
|
+
}
|
|
82240
|
+
if (!sdkImage)
|
|
82241
|
+
await runCompiler(
|
|
82242
|
+
import_node_path81.default.join(options2.toolchainBin, "llvm-objcopy"),
|
|
82243
|
+
["--remove-section=.swift1_autolink_entries", optimized],
|
|
82244
|
+
buildOptions
|
|
82245
|
+
);
|
|
82246
|
+
const artifact = {
|
|
82247
|
+
hash,
|
|
82248
|
+
bytes: (0, import_node_fs81.readFileSync)(optimized),
|
|
82249
|
+
icu: await icu,
|
|
82250
|
+
sdk: sdkAsset
|
|
82251
|
+
};
|
|
82252
|
+
if (artifact.bytes.length <= 8)
|
|
82253
|
+
throw new Error("swift-compile: deferred linker produced no executable");
|
|
82254
|
+
if (!options2.project) saveCompiledArtifact(root2, artifact);
|
|
82255
|
+
saveSharedArtifact(sharedRoot, artifact);
|
|
82256
|
+
stage("compiled artifact verified");
|
|
82257
|
+
return retain(baseRoot, artifact);
|
|
82258
|
+
} finally {
|
|
82259
|
+
readHold?.release();
|
|
82260
|
+
}
|
|
82261
|
+
});
|
|
82125
82262
|
});
|
|
82126
82263
|
},
|
|
82127
82264
|
options2.signal
|
|
82128
82265
|
);
|
|
82129
82266
|
}
|
|
82130
|
-
var import_node_child_process42, import_node_crypto48, import_node_fs81, import_node_os16, import_node_path81, v6, WASM_TRIPLE, SWIFTPM_PROGRESS, SWIFTPM_NOISE, SWIFT_COMPILER_ENV_KEYS, distributionManifests, distributionCompileViews, REACH_STAGED_FRAMEWORKS, objcEnumerations, clangDeclarationEnumCache, objcEnumForward, sdkDeclarationOwners, swiftInterfaceDeclarations, linkedModuleDigests, compileSurfaces, SYSTEM_MODULE_LIBRARIES, SYSTEM_MODULE_IMPORT, OPTIONAL_FRAMEWORK_DEPENDENCIES, OPTIONAL_FRAMEWORKS, SWIFT_IMPORT, kleeneNot, kleeneAnd, kleeneOr, NON_IOS_MODULES, sdkPaths, availableModules, sdkOverlayFrameworks, DISTRIBUTION_CLANG_MODULES, CLANG_DISTRIBUTION_MODULES, ONE_PRODUCT, GAME_FAMILY, gameProducts, gameProduct, GAME_REACH, FOUNDATION_IMPLICIT_MODULES, FRAMEWORK_COMPANION_IMPORT, ONE_IMPLICIT_FLAGS, executableLinkFlags, darwinRecordsRegion, REACTOR_FLAG, MULTI_MANIFEST_VERSION, SWIFT_HEADER_PRODUCTS_TARGET, compilerSourceDigest, nativeCxxCompilerFlags, MODULE_MAP_RESPONSE_FILE_RUN, cFlagArray, cxxFlagArray, SWIFTPM_DEFAULT_IOS_DEPLOYMENT_TARGET, OS_IOS, ARCH_ARM64, NOT_ON_IOS, DELEGATE_CLASS, ARM64_MACRO, WASM_MACRO, ARCH_WASM32, C_WORDS, archEnvironments, codeMasks, codeMaskChars, CODE_MASK_CACHE_CHARS, FOUNDATION_NETWORKING_TYPES, FOUNDATION_OVERLAY_TYPES, FOUNDATION_OVERLAY_GLOBALS, CORE_FOUNDATION_OVERLAY_GLOBALS, CORE_FOUNDATION_GEOMETRY_TYPES, CORE_FOUNDATION_GRAPHICS_TYPES, CORE_FOUNDATION_HANDLE_IMPORTS, emptyMacroEnvironment, wasmMacroEnvironment, cPredefineTable, cPredefineCache, HIDDEN_UNITS, FIRST_WINS_PAIRS, LAST_WINS_PAIRS, VALUE_FLAGS, LIBXML_REFERENCE, LIBXML_SOURCE, ROOT_LOCKS, host, rootLocks, SHARED_ARTIFACT_BUDGET_BYTES, SHARED_ARTIFACT_GRACE_MS, RETIRED_PREFIX, retainedArtifacts, FRAMEWORK_LINK_TARGET, frameworkProductsReceiptSchema, SWIFT_LINK_STAMP, SWIFT_HOST_COMPILER_WRAPPER, SWIFT_FRAMEWORK_SLOTS, SWIFT_FRAMEWORK_UNOPTIMIZED_SLOTS, SWIFT_FRAMEWORK_SLOT_KEY, SWIFT_FRAMEWORK_SLOT_ORIGIN;
|
|
82267
|
+
var import_node_child_process42, import_node_crypto48, import_node_fs81, import_node_os16, import_node_path81, v6, WASM_TRIPLE, SWIFTPM_PROGRESS, SWIFTPM_NOISE, SWIFT_COMPILER_ENV_KEYS, distributionManifests, distributionCompileViews, REACH_STAGED_FRAMEWORKS, objcEnumerations, clangDeclarationEnumCache, objcEnumForward, sdkDeclarationOwners, swiftInterfaceDeclarations, linkedModuleDigests, compileSurfaces, SYSTEM_MODULE_LIBRARIES, SYSTEM_MODULE_IMPORT, OPTIONAL_FRAMEWORK_DEPENDENCIES, OPTIONAL_FRAMEWORKS, SWIFT_IMPORT, kleeneNot, kleeneAnd, kleeneOr, NON_IOS_MODULES, sdkPaths, availableModules, sdkOverlayFrameworks, DISTRIBUTION_CLANG_MODULES, CLANG_DISTRIBUTION_MODULES, ONE_PRODUCT, GAME_FAMILY, gameProducts, gameProduct, GAME_REACH, FOUNDATION_IMPLICIT_MODULES, FRAMEWORK_COMPANION_IMPORT, ONE_IMPLICIT_FLAGS, executableLinkFlags, darwinRecordsRegion, REACTOR_FLAG, MULTI_MANIFEST_VERSION, SWIFT_HEADER_PRODUCTS_TARGET, compilerSourceDigest, nativeCxxCompilerFlags, MODULE_MAP_RESPONSE_FILE_RUN, cFlagArray, cxxFlagArray, SWIFTPM_DEFAULT_IOS_DEPLOYMENT_TARGET, OS_IOS, ARCH_ARM64, NOT_ON_IOS, DELEGATE_CLASS, ARM64_MACRO, WASM_MACRO, ARCH_WASM32, C_WORDS, archEnvironments, codeMasks, codeMaskChars, CODE_MASK_CACHE_CHARS, FOUNDATION_NETWORKING_TYPES, FOUNDATION_OVERLAY_TYPES, FOUNDATION_OVERLAY_GLOBALS, CORE_FOUNDATION_OVERLAY_GLOBALS, CORE_FOUNDATION_GEOMETRY_TYPES, CORE_FOUNDATION_GRAPHICS_TYPES, CORE_FOUNDATION_HANDLE_IMPORTS, emptyMacroEnvironment, wasmMacroEnvironment, cPredefineTable, cPredefineCache, HIDDEN_UNITS, FIRST_WINS_PAIRS, LAST_WINS_PAIRS, VALUE_FLAGS, LIBXML_REFERENCE, LIBXML_SOURCE, ROOT_LOCKS, host, rootLocks, SHARED_ARTIFACT_BUDGET_BYTES, SHARED_ARTIFACT_GRACE_MS, RETIRED_PREFIX, retainedArtifacts, FRAMEWORK_LINK_TARGET, frameworkProductsReceiptSchema, SWIFT_LINK_STAMP, SWIFT_HOST_COMPILER_WRAPPER, SWIFT_FRAMEWORK_SLOTS, SWIFT_FRAMEWORK_UNOPTIMIZED_SLOTS, SWIFT_FRAMEWORK_SLOT_KEY, SWIFT_FRAMEWORK_SLOT_ORIGIN, SWIFT_FRAMEWORK_SLOT_RELEASE, SWIFT_BUILD_ROOT_SLOTS, SWIFT_BUILD_ROOT_SHAPE;
|
|
82131
82268
|
var init_swift_compile = __esm({
|
|
82132
82269
|
"src/swift-compile.ts"() {
|
|
82133
82270
|
"use strict";
|
|
@@ -82398,7 +82535,7 @@ ${wasmThreadLinkFlags.map((flag) => ` "-Xlinker", ${JSON.stringify(flag
|
|
|
82398
82535
|
REACTOR_FLAG = '"-Xclang-linker", "-mexec-model=reactor",\n';
|
|
82399
82536
|
MULTI_MANIFEST_VERSION = 76;
|
|
82400
82537
|
SWIFT_HEADER_PRODUCTS_TARGET = "PeachHeaderProducts";
|
|
82401
|
-
compilerSourceDigest = true ? "
|
|
82538
|
+
compilerSourceDigest = true ? "203439fc20df8d328b0c245496fc6db90092265409adb61b593725e82ce837de" : swiftCompilerSourceDigest2(__sootsim_import_meta_dirname);
|
|
82402
82539
|
nativeCxxCompilerFlags = ["-fno-cxx-modules"];
|
|
82403
82540
|
MODULE_MAP_RESPONSE_FILE_RUN = 16;
|
|
82404
82541
|
cFlagArray = (flags) => JSON.stringify(withoutGlogModuleMap(flags));
|
|
@@ -82822,6 +82959,7 @@ ${wasmThreadLinkFlags.map((flag) => ` "-Xlinker", ${JSON.stringify(flag
|
|
|
82822
82959
|
retainedArtifacts = /* @__PURE__ */ new Map();
|
|
82823
82960
|
FRAMEWORK_LINK_TARGET = "PeachFrameworkLink";
|
|
82824
82961
|
frameworkProductsReceiptSchema = v6.object({
|
|
82962
|
+
root: v6.string(),
|
|
82825
82963
|
modules: v6.string(),
|
|
82826
82964
|
objects: v6.array(v6.string()),
|
|
82827
82965
|
lazyObjects: v6.array(v6.string()),
|
|
@@ -82838,6 +82976,9 @@ ${wasmThreadLinkFlags.map((flag) => ` "-Xlinker", ${JSON.stringify(flag
|
|
|
82838
82976
|
SWIFT_FRAMEWORK_UNOPTIMIZED_SLOTS = 4;
|
|
82839
82977
|
SWIFT_FRAMEWORK_SLOT_KEY = ".peach-framework-key";
|
|
82840
82978
|
SWIFT_FRAMEWORK_SLOT_ORIGIN = ".peach-framework-origin";
|
|
82979
|
+
SWIFT_FRAMEWORK_SLOT_RELEASE = ".peach-framework-release";
|
|
82980
|
+
SWIFT_BUILD_ROOT_SLOTS = 4;
|
|
82981
|
+
SWIFT_BUILD_ROOT_SHAPE = ".peach-build-shape";
|
|
82841
82982
|
}
|
|
82842
82983
|
});
|
|
82843
82984
|
|
|
@@ -95838,7 +95979,7 @@ var init_provenance = __esm({
|
|
|
95838
95979
|
import_node_crypto54 = require("node:crypto");
|
|
95839
95980
|
import_node_fs95 = require("node:fs");
|
|
95840
95981
|
import_node_path96 = require("node:path");
|
|
95841
|
-
swiftCoverageProvenance = true ? JSON.parse('{"swift-coverage/indexdump.ts":"0d82d8eeb96bf377f409ea7e33274c341a710c0e071f6b6e17571a23d8d92412","swift-coverage/indexing.ts":"633ccf19eec1f382a8847d0ee1dca42a2792a3c60aafd43622ed5152b09b8272","swift-coverage/types.ts":"bd8fae54ea6c53e110cd8a5d7b57c1d532dd0166e09fdaea63c4f270c3780dd1","swift-coverage/source.ts":"c151758a9f67631bc61473c375df0dc017da6902a34533b2cf4fc4fd7d19b6ee","swift-coverage/package.ts":"1f0068be7461fa7c5a7a891faf318f305cbed2e94c19667ba76627f7e5be260b","swift-coverage/xcode.ts":"d6a3228567a46c6d5280895383093889d9b868958a117881061bdd74729a225f","swift-coverage/xcode-assets.ts":"d98d6294b359528f7733b26db6f80f554782354faa235605f9562be4ad98b8a3","swift-coverage/xcode-asset-symbols.ts":"1b2a67733bc9d139b351466270205452a6172140bc25080d72619e2952c44671","swift-coverage/xcode-bridging.ts":"33184be8c5daf6646aa5a1276a4e15531f1be27b7c26f56550e0fbb1fc678a11","swift-coverage/xcode-packages.ts":"5c83f56357d880243ab485b260d23abd0094583ffa2287dac6e9e7eb18c3673d","swift-coverage/xcode-strings.ts":"facdbeb9de6bb12da4ab4954553edfaadd0e486f1181443138be70c3d8396236","swift-coverage/reader.ts":"da559b67ecd1161dea70c980b5f98f2c55af3550f0714479100fa5e9e813625c","swift-coverage/provenance.ts":"f5039c16e63c6129e22b71203f58982c68cef6e282a4f236b93da28edd39c108","swift-package-manifest.ts":"c64b677c93e48d61c71b371d887e9db8506c32ef968ed50d9468de1f67fe5d8d","swift-package.ts":"05c6cf101fbc944f6684a70db0a9c5aede846b2f0482a6b4a5a0abed737d4658","swift-source-file.ts":"8becce5e73b76a61d9d202c1ecfb39b1238e9bbf0e77841f1c51c98fa9ac7bd3","swift-toolchain.ts":"
|
|
95982
|
+
swiftCoverageProvenance = true ? JSON.parse('{"swift-coverage/indexdump.ts":"0d82d8eeb96bf377f409ea7e33274c341a710c0e071f6b6e17571a23d8d92412","swift-coverage/indexing.ts":"633ccf19eec1f382a8847d0ee1dca42a2792a3c60aafd43622ed5152b09b8272","swift-coverage/types.ts":"bd8fae54ea6c53e110cd8a5d7b57c1d532dd0166e09fdaea63c4f270c3780dd1","swift-coverage/source.ts":"c151758a9f67631bc61473c375df0dc017da6902a34533b2cf4fc4fd7d19b6ee","swift-coverage/package.ts":"1f0068be7461fa7c5a7a891faf318f305cbed2e94c19667ba76627f7e5be260b","swift-coverage/xcode.ts":"d6a3228567a46c6d5280895383093889d9b868958a117881061bdd74729a225f","swift-coverage/xcode-assets.ts":"d98d6294b359528f7733b26db6f80f554782354faa235605f9562be4ad98b8a3","swift-coverage/xcode-asset-symbols.ts":"1b2a67733bc9d139b351466270205452a6172140bc25080d72619e2952c44671","swift-coverage/xcode-bridging.ts":"33184be8c5daf6646aa5a1276a4e15531f1be27b7c26f56550e0fbb1fc678a11","swift-coverage/xcode-packages.ts":"5c83f56357d880243ab485b260d23abd0094583ffa2287dac6e9e7eb18c3673d","swift-coverage/xcode-strings.ts":"facdbeb9de6bb12da4ab4954553edfaadd0e486f1181443138be70c3d8396236","swift-coverage/reader.ts":"da559b67ecd1161dea70c980b5f98f2c55af3550f0714479100fa5e9e813625c","swift-coverage/provenance.ts":"f5039c16e63c6129e22b71203f58982c68cef6e282a4f236b93da28edd39c108","swift-package-manifest.ts":"c64b677c93e48d61c71b371d887e9db8506c32ef968ed50d9468de1f67fe5d8d","swift-package.ts":"05c6cf101fbc944f6684a70db0a9c5aede846b2f0482a6b4a5a0abed737d4658","swift-source-file.ts":"8becce5e73b76a61d9d202c1ecfb39b1238e9bbf0e77841f1c51c98fa9ac7bd3","swift-toolchain.ts":"32bf10d6f3396dd1a20ff6d415499a5990ec2550c63306fd9ef071bdf4a58f1e","home-paths.ts":"d1606390f0e8e50f0ff72544eadb3d49dfabf08e004c1218f2998c36fb8995dd","xcode-header-search.ts":"c72b724fc497e4cf603c355f86eb3c07c929ad299758cffbc6ff88ed241654c6","xcode-project.ts":"fe50b74f53082e75bb32393ada42bbbcb0ff982024a026b4b673f2004dd404d8","xcode-target-members.ts":"96f6a9f5567a4fbd9806252229b35b9a451a112b20f70f8c20189ffd428815fd","xcode-json-project.ts":"df6d6db28e0c8cfdf1f480e1e32d35f12c9cf1936642d5dda923889fb18a8fd6","openstep-plist.ts":"da11f86885ef1e25979ad989f332195c113c4b7a43f108e8d36646973430b81b"}') : swiftCoverageSourceDigests((0, import_node_path96.join)(__sootsim_import_meta_dirname, ".."));
|
|
95842
95983
|
}
|
|
95843
95984
|
});
|
|
95844
95985
|
|
|
@@ -140362,7 +140503,7 @@ public func peachOneSDK(_ pointer: UnsafePointer<UInt8>, _ length: Int32) -> Uns
|
|
|
140362
140503
|
});
|
|
140363
140504
|
|
|
140364
140505
|
// ../peach-globals/src/oneNativeControlsContract.ts
|
|
140365
|
-
var ONE_NATIVE_CONTROLS_PACKAGE, ONE_NATIVE_CONTROLS_CONTRACT, ONE_NATIVE_CONTROLS_NAVIGATION_STACK_VIEW, ONE_NATIVE_CONTROLS_NAVIGATION_SPLIT_VIEW, ONE_NATIVE_CONTROLS_VISUAL_VIEWS;
|
|
140506
|
+
var ONE_NATIVE_CONTROLS_PACKAGE, ONE_NATIVE_CONTROLS_CONTRACT, ONE_NATIVE_CONTROLS_NAVIGATION_STACK_VIEW, ONE_NATIVE_CONTROLS_NAVIGATION_SPLIT_VIEW, ONE_NATIVE_CONTROLS_VISUAL_VIEWS, ONE_NATIVE_CONTROLS_TAB_VIEW;
|
|
140366
140507
|
var init_oneNativeControlsContract = __esm({
|
|
140367
140508
|
"../peach-globals/src/oneNativeControlsContract.ts"() {
|
|
140368
140509
|
"use strict";
|
|
@@ -140375,6 +140516,7 @@ var init_oneNativeControlsContract = __esm({
|
|
|
140375
140516
|
"OneNativeLinearGradient",
|
|
140376
140517
|
"OneNativeGlass"
|
|
140377
140518
|
];
|
|
140519
|
+
ONE_NATIVE_CONTROLS_TAB_VIEW = "OneNativeTabView";
|
|
140378
140520
|
}
|
|
140379
140521
|
});
|
|
140380
140522
|
|
|
@@ -140575,12 +140717,33 @@ var init_one_native_controls_package = __esm({
|
|
|
140575
140717
|
init_swift_submit();
|
|
140576
140718
|
init_swift_toolchain();
|
|
140577
140719
|
ONE_SDK_DEFINES = ["ONE_IOS_26_SDK", "ONE_IOS_27_SDK", "ONE_IOS_27_1_SDK"];
|
|
140578
|
-
BRIDGE_SWIFT =
|
|
140720
|
+
BRIDGE_SWIFT = `@_spi(Peach) import SwiftUI
|
|
140579
140721
|
@_spi(Peach) import UIKit
|
|
140580
140722
|
import PeachJSON
|
|
140581
140723
|
|
|
140582
140724
|
typealias Spec = [String: Any]
|
|
140583
140725
|
|
|
140726
|
+
private final class OneContentHost: UIView, _PeachToolbarTitleMenuProvider {
|
|
140727
|
+
var titleMenu: [Spec] = []
|
|
140728
|
+
var onTitleMenuAction: ((Int) -> Void)?
|
|
140729
|
+
|
|
140730
|
+
var _peachToolbarTitleMenuContent: AnyView? {
|
|
140731
|
+
guard !titleMenu.isEmpty else { return nil }
|
|
140732
|
+
return AnyView(ForEach(Array(titleMenu.enumerated()), id: \\.offset) { index, item in
|
|
140733
|
+
let label = item["label"] as! String
|
|
140734
|
+
Button(role: item["role"] as? String == "destructive" ? .destructive : nil) { [weak self] in
|
|
140735
|
+
self?.onTitleMenuAction?(index)
|
|
140736
|
+
} label: {
|
|
140737
|
+
if let symbol = item["systemImage"] as? String {
|
|
140738
|
+
Label(label, systemImage: symbol)
|
|
140739
|
+
} else {
|
|
140740
|
+
Text(label)
|
|
140741
|
+
}
|
|
140742
|
+
}
|
|
140743
|
+
})
|
|
140744
|
+
}
|
|
140745
|
+
}
|
|
140746
|
+
|
|
140584
140747
|
private func platformColor(named name: String) -> UIColor? {
|
|
140585
140748
|
switch name {
|
|
140586
140749
|
case "label", "-apple-system-label": return UIColor.label
|
|
@@ -141197,6 +141360,122 @@ private struct NavigationSplitViewBridge: UIViewRepresentable {
|
|
|
141197
141360
|
}
|
|
141198
141361
|
}
|
|
141199
141362
|
|
|
141363
|
+
private struct TabViewBridge: UIViewRepresentable {
|
|
141364
|
+
let spec: Spec
|
|
141365
|
+
let emit: (String, String) -> Void
|
|
141366
|
+
|
|
141367
|
+
final class Coordinator: ControlComposition {
|
|
141368
|
+
var pageHosts: [String: OneContentHost] = [:]
|
|
141369
|
+
var toolbars: [OneNativeToolbarView] = []
|
|
141370
|
+
var tabSelectionSequence = 0
|
|
141371
|
+
|
|
141372
|
+
func host(_ id: String, name: String?, titleMenu: [Spec]) -> UIView {
|
|
141373
|
+
let host = pageHosts[id] ?? OneContentHost(frame: .zero)
|
|
141374
|
+
pageHosts[id] = host
|
|
141375
|
+
host._peachReactContentHost = name
|
|
141376
|
+
host.titleMenu = titleMenu
|
|
141377
|
+
host.onTitleMenuAction = { [weak self] index in
|
|
141378
|
+
self?.send(id, "onNativeTitleMenuAction", ["index": index])
|
|
141379
|
+
}
|
|
141380
|
+
return host
|
|
141381
|
+
}
|
|
141382
|
+
}
|
|
141383
|
+
|
|
141384
|
+
func makeCoordinator() -> Coordinator { Coordinator() }
|
|
141385
|
+
func makeUIView(context: Context) -> OneNativeTabViewView { OneNativeTabViewView(frame: .zero) }
|
|
141386
|
+
|
|
141387
|
+
func updateUIView(_ tabs: OneNativeTabViewView, context: Context) {
|
|
141388
|
+
let state = context.coordinator
|
|
141389
|
+
state.emit = emit
|
|
141390
|
+
let root = self.spec["root"] as! Spec
|
|
141391
|
+
let id = root["id"] as! String
|
|
141392
|
+
let spec = root["spec"] as! Spec
|
|
141393
|
+
let nodes = root["children"] as? [Spec] ?? []
|
|
141394
|
+
var visited = Set<String>()
|
|
141395
|
+
tabs.onSelection = { [weak state] selection, count, revision in
|
|
141396
|
+
state?.send(id, "onNativeTabViewSelectionChange", ["selection": selection, "eventCount": count, "revision": revision])
|
|
141397
|
+
}
|
|
141398
|
+
tabs.onAction = { [weak state] tabId in
|
|
141399
|
+
state?.send(id, "onNativeTabViewAction", ["tabId": tabId])
|
|
141400
|
+
}
|
|
141401
|
+
tabs.onCustomization = { [weak state] customization in
|
|
141402
|
+
state?.send(id, "onNativeTabViewCustomizationChange", ["customization": customization])
|
|
141403
|
+
}
|
|
141404
|
+
tabs.onSDKEvent = { [weak state] name, value in
|
|
141405
|
+
state?.send(id, "onNativeSDKEvent", ["name": name, "value": value])
|
|
141406
|
+
}
|
|
141407
|
+
tabs.configureStyle(normalizeStyle(spec["swiftStyle"] as? Spec))
|
|
141408
|
+
tabs.configure(
|
|
141409
|
+
tabViewStyle: spec["tabViewStyle"] as? String ?? "automatic",
|
|
141410
|
+
tabBarVisibility: spec["tabBarVisibility"] as? String ?? "automatic",
|
|
141411
|
+
customization: spec["customization"] as? String ?? "",
|
|
141412
|
+
customizable: spec["customizable"] as? Bool ?? false,
|
|
141413
|
+
bottomAccessoryEnabled: spec["bottomAccessoryEnabled"] as? Bool ?? true
|
|
141414
|
+
)
|
|
141415
|
+
var pages: [OneNativeTabItem] = []
|
|
141416
|
+
var toolbars: [Spec] = []
|
|
141417
|
+
for node in nodes {
|
|
141418
|
+
let page = node["spec"] as! Spec
|
|
141419
|
+
if page["control"] as? String == "OneNativeToolbar" {
|
|
141420
|
+
toolbars.append(node)
|
|
141421
|
+
continue
|
|
141422
|
+
}
|
|
141423
|
+
precondition(page["control"] as? String == "OneNativeTab", "Swift.TabView requires Swift.Tab or Swift.Toolbar children")
|
|
141424
|
+
let owner = node["id"] as! String
|
|
141425
|
+
visited.insert(owner)
|
|
141426
|
+
let item = OneNativeTabItem(
|
|
141427
|
+
id: page["tabId"] as! String,
|
|
141428
|
+
kind: page["kind"] as? String ?? "page",
|
|
141429
|
+
title: page["title"] as? String ?? "",
|
|
141430
|
+
systemImage: page["systemImage"] as? String ?? "",
|
|
141431
|
+
badge: page["badge"] as? String ?? "",
|
|
141432
|
+
role: page["tabRole"] as? String ?? "",
|
|
141433
|
+
slotHeight: page["slotHeight"] as? Double ?? 0,
|
|
141434
|
+
tabModifiers: page["tabModifiers"] as? String ?? "{}",
|
|
141435
|
+
view: state.host(owner, name: node["contentHost"] as? String, titleMenu: page["titleMenu"] as? [Spec] ?? []),
|
|
141436
|
+
onLayout: { [weak state] frame in state?.send(owner, "onNativeLayout", frameFields(frame)) }
|
|
141437
|
+
)
|
|
141438
|
+
item.configureStyle(normalizeStyle(page["swiftStyle"] as? Spec))
|
|
141439
|
+
item.emit = { [weak state] name, value in
|
|
141440
|
+
state?.send(owner, "onNativeSDKEvent", ["name": name, "value": value])
|
|
141441
|
+
}
|
|
141442
|
+
pages.append(item)
|
|
141443
|
+
}
|
|
141444
|
+
tabs.setPages(pages)
|
|
141445
|
+
let previousSequence = state.tabSelectionSequence
|
|
141446
|
+
for commit in spec["__peachTabSelections"] as? [Spec] ?? [] {
|
|
141447
|
+
guard let sequence = commit["sequence"] as? Int, sequence > state.tabSelectionSequence else { continue }
|
|
141448
|
+
state.tabSelectionSequence = sequence
|
|
141449
|
+
if let selection = commit["selection"] as? String, pages.contains(where: { $0.id == selection }) {
|
|
141450
|
+
tabs.setSelection(selection, acknowledgedEvent: commit["acknowledgedEvent"] as? Int ?? 0, revision: commit["revision"] as? Int ?? 0)
|
|
141451
|
+
}
|
|
141452
|
+
}
|
|
141453
|
+
tabs.setSelection(spec["selection"] as? String ?? "", acknowledgedEvent: spec["acknowledgedEvent"] as? Int ?? 0, revision: spec["revision"] as? Int ?? 0)
|
|
141454
|
+
if state.tabSelectionSequence > previousSequence {
|
|
141455
|
+
state.send(id, "onNativeTabSelectionsApplied", ["sequence": state.tabSelectionSequence])
|
|
141456
|
+
}
|
|
141457
|
+
let next = toolbars.map { state.render($0, visited: &visited) as! OneNativeToolbarView }
|
|
141458
|
+
state.reconcile(next, previous: state.toolbars,
|
|
141459
|
+
remove: { tabs.unmountToolbar($0 as! OneNativeToolbarView) },
|
|
141460
|
+
insert: { view, _ in tabs.mountToolbar(view as! OneNativeToolbarView) })
|
|
141461
|
+
state.toolbars = next
|
|
141462
|
+
state.prune(keeping: visited)
|
|
141463
|
+
state.pageHosts = state.pageHosts.filter { visited.contains($0.key) }
|
|
141464
|
+
}
|
|
141465
|
+
|
|
141466
|
+
static func dismantleUIView(_ view: OneNativeTabViewView, coordinator: Coordinator) {
|
|
141467
|
+
coordinator.emit = nil
|
|
141468
|
+
view.reset()
|
|
141469
|
+
coordinator.prune(keeping: [])
|
|
141470
|
+
coordinator.pageHosts.removeAll()
|
|
141471
|
+
coordinator.toolbars.removeAll()
|
|
141472
|
+
}
|
|
141473
|
+
}
|
|
141474
|
+
|
|
141475
|
+
private func frameFields(_ frame: CGRect) -> Spec {
|
|
141476
|
+
["x": frame.minX, "y": frame.minY, "width": frame.width, "height": frame.height]
|
|
141477
|
+
}
|
|
141478
|
+
|
|
141200
141479
|
@_expose(wasm, "peach_register_views")
|
|
141201
141480
|
@_cdecl("peach_register_views")
|
|
141202
141481
|
@MainActor public func peach_register_views() {
|
|
@@ -141214,6 +141493,10 @@ private struct NavigationSplitViewBridge: UIViewRepresentable {
|
|
|
141214
141493
|
return AnyView(NavigationSplitViewBridge(spec: spec, emit: emit)
|
|
141215
141494
|
.frame(maxWidth: .infinity, maxHeight: .infinity)
|
|
141216
141495
|
.ignoresSafeArea(.container))
|
|
141496
|
+
case "${ONE_NATIVE_CONTROLS_TAB_VIEW}":
|
|
141497
|
+
return AnyView(TabViewBridge(spec: spec, emit: emit)
|
|
141498
|
+
.frame(maxWidth: .infinity, maxHeight: .infinity)
|
|
141499
|
+
.ignoresSafeArea(.container, edges: .horizontal))
|
|
141217
141500
|
default:
|
|
141218
141501
|
let root = spec["root"] as! Spec
|
|
141219
141502
|
precondition((root["spec"] as? Spec)?["control"] as? String == view)
|
|
@@ -145761,7 +146044,7 @@ var init_nitro_superset = __esm({
|
|
|
145761
146044
|
init_nitroContract();
|
|
145762
146045
|
init_swift_standin_digest();
|
|
145763
146046
|
NITRO_SUPERSET_ENTRY_NAME = "superset";
|
|
145764
|
-
NITRO_COMPILER_DIGEST = true ? "
|
|
146047
|
+
NITRO_COMPILER_DIGEST = true ? "74b5613216c94c9a712253659e2803b31d4fe1a7f0ff32f2ad7d3fa7ef57f2ab" : nitroCompilerSourceDigest(__sootsim_import_meta_dirname, STANDIN_SOURCE_DIGEST2);
|
|
145765
146048
|
nitroSupersetLock = parseLock(nitro_superset_lock_default);
|
|
145766
146049
|
nitroSupersetKey = (inputs2) => nativeEntryKey({ ...inputs2, compiler: NITRO_COMPILER_DIGEST });
|
|
145767
146050
|
published3 = /* @__PURE__ */ new Map();
|