peachsim 0.1.2606 → 0.1.2607
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-KFWXYMX5.mjs} +3 -3
- package/dist-lib/esm-chunks/{chunk-EXB4QSQI.mjs → chunk-6JPUMAC2.mjs} +1 -1
- package/dist-lib/esm-chunks/{chunk-CPMK3DA6.mjs → chunk-6NDABMDX.mjs} +3 -3
- package/dist-lib/esm-chunks/{chunk-5JMW5G3U.mjs → chunk-7SKDPTZN.mjs} +1 -1
- package/dist-lib/esm-chunks/{chunk-MBCSJQRY.mjs → chunk-ACAXWH62.mjs} +1 -1
- package/dist-lib/esm-chunks/{chunk-25LYRBSX.mjs → chunk-ARYRQJUB.mjs} +1 -1
- package/dist-lib/esm-chunks/{chunk-KWLQDES2.mjs → chunk-BNAXRY5Q.mjs} +1 -1
- package/dist-lib/esm-chunks/{chunk-VTZJPPTE.mjs → chunk-CA64UUHF.mjs} +1 -1
- package/dist-lib/esm-chunks/{chunk-OB5XSLW6.mjs → chunk-DBW62F4N.mjs} +3 -2
- package/dist-lib/esm-chunks/{chunk-RTPUFY2K.mjs → chunk-ESS2CG5G.mjs} +5 -5
- package/dist-lib/esm-chunks/{chunk-O6NRI4T2.mjs → chunk-IGSLOAPL.mjs} +1 -1
- package/dist-lib/esm-chunks/{chunk-5ANQR24T.mjs → chunk-KIIALACX.mjs} +1 -1
- package/dist-lib/esm-chunks/{chunk-66ESCMV3.mjs → chunk-LJZ373SO.mjs} +818 -678
- package/dist-lib/esm-chunks/{chunk-TVICD24H.mjs → chunk-M4ORY3NH.mjs} +1 -1
- package/dist-lib/esm-chunks/{chunk-34CIYRB7.mjs → chunk-MBWWOGI5.mjs} +4 -4
- package/dist-lib/esm-chunks/{chunk-QFASF6EH.mjs → chunk-O5BPZVLB.mjs} +5 -5
- package/dist-lib/esm-chunks/{chunk-L7FPUZZO.mjs → chunk-P5Q5QCTP.mjs} +1 -1
- package/dist-lib/esm-chunks/{chunk-B7AXR7WA.mjs → chunk-QJUAWJDB.mjs} +1 -1
- package/dist-lib/esm-chunks/{chunk-O6ZNRBLB.mjs → chunk-RIDXKGBZ.mjs} +1 -1
- package/dist-lib/esm-chunks/{chunk-WJKACRMG.mjs → chunk-TD2DBEKQ.mjs} +1 -1
- package/dist-lib/esm-chunks/{chunk-E2TASYAA.mjs → chunk-UTSB5CDG.mjs} +1 -1
- package/dist-lib/esm-chunks/{chunk-PLOV7VQQ.mjs → chunk-WMWOBH7E.mjs} +1 -1
- package/dist-lib/esm-chunks/{chunk-XUWYWP35.mjs → chunk-ZNGLVJYL.mjs} +1 -1
- package/dist-lib/esm-chunks/{metro-layout-parser-OMUFYOJI.mjs → metro-layout-parser-UY3B6VGU.mjs} +3 -3
- package/dist-lib/esm-chunks/{swift-package-prebuilt-X7EZCX34.mjs → swift-package-prebuilt-HDHPWS44.mjs} +10 -10
- package/dist-lib/esm-chunks/{swift-sdk-app-module-E3IF2XPD.mjs → swift-sdk-app-module-U6G5RZV2.mjs} +14 -14
- package/dist-lib/esm-chunks/{swift-sdk-image-57YYLNU6.mjs → swift-sdk-image-PVDA2MVM.mjs} +14 -14
- package/dist-lib/esm-chunks/{swift-sdk-image-producer-DZOZTTDZ.mjs → swift-sdk-image-producer-YHPS3KNR.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/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
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! peach v0.1.
|
|
1
|
+
/*! peach v0.1.2607 | (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;
|
|
@@ -6024,13 +6024,13 @@ var init_swift_standin_digest = __esm({
|
|
|
6024
6024
|
STANDIN_DIGEST_ENTRYPOINTS = ["swift-standins.ts", "swift-objc-compile.ts"];
|
|
6025
6025
|
SPECIFIER = /from\s*['"]([^'"]+)['"]|import\s*\(\s*['"]([^'"]+)['"]\s*\)/g;
|
|
6026
6026
|
standinSourceDigest = (srcDir = __sootsim_import_meta_dirname) => sourceClosureDigest(srcDir, STANDIN_DIGEST_ENTRYPOINTS);
|
|
6027
|
-
STANDIN_SOURCE_DIGEST = true ? "
|
|
6027
|
+
STANDIN_SOURCE_DIGEST = true ? "fde0b0b7ddf441a32e71680bc17ba12f69f2cbaed1a0a024505e7f4a5394772d" : standinSourceDigest();
|
|
6028
6028
|
}
|
|
6029
6029
|
});
|
|
6030
6030
|
|
|
6031
6031
|
// src/expo-native-compiler-digest.ts
|
|
6032
6032
|
function expoNativeCompilerDigestValue() {
|
|
6033
|
-
return true ? "
|
|
6033
|
+
return true ? "0eb8b57c26c74de660f5dc029f1ae0ffa0af503b67afa64e2c93b02b517a2e68" : expoNativeCompilerDigest(__sootsim_import_meta_dirname);
|
|
6034
6034
|
}
|
|
6035
6035
|
var import_node_crypto11;
|
|
6036
6036
|
var init_expo_native_compiler_digest = __esm({
|
|
@@ -13601,7 +13601,8 @@ function swiftCompilerRelease(release) {
|
|
|
13601
13601
|
}
|
|
13602
13602
|
function swiftToolchainBin(release) {
|
|
13603
13603
|
if (process.platform === "darwin") {
|
|
13604
|
-
const
|
|
13604
|
+
const bases = [.../* @__PURE__ */ new Set([import_node_os8.default.homedir(), import_node_path33.default.dirname(peachHome()), "/"])];
|
|
13605
|
+
const dirs = bases.map(
|
|
13605
13606
|
(base2) => import_node_path33.default.join(base2, `Library/Developer/Toolchains/${release}.xctoolchain/usr/bin`)
|
|
13606
13607
|
);
|
|
13607
13608
|
const found2 = dirs.find((dir) => import_node_fs35.default.existsSync(import_node_path33.default.join(dir, "swift")));
|
|
@@ -26652,24 +26653,37 @@ function swiftBuilderHopTimeoutMs(compileTimeoutMs) {
|
|
|
26652
26653
|
async function withSwiftCompileBudget(compileTimeoutMs, signal, work) {
|
|
26653
26654
|
const deadline = new AbortController();
|
|
26654
26655
|
const combined = signal ? AbortSignal.any([signal, deadline.signal]) : deadline.signal;
|
|
26656
|
+
const stallMs = compileTimeoutMs ?? SWIFT_COMPILE_TIMEOUT_MS;
|
|
26657
|
+
let compiling2 = false;
|
|
26655
26658
|
let timer = setTimeout(
|
|
26656
26659
|
() => deadline.abort(new Error("Swift build lock wait timed out")),
|
|
26657
26660
|
SWIFT_LOCK_WAIT_TIMEOUT_MS
|
|
26658
26661
|
);
|
|
26662
|
+
const restart = () => {
|
|
26663
|
+
clearTimeout(timer);
|
|
26664
|
+
timer = setTimeout(
|
|
26665
|
+
() => deadline.abort(
|
|
26666
|
+
new Error(
|
|
26667
|
+
`Swift compilation made no progress for ${Math.round(stallMs / 1e3)}s`
|
|
26668
|
+
)
|
|
26669
|
+
),
|
|
26670
|
+
stallMs
|
|
26671
|
+
);
|
|
26672
|
+
};
|
|
26659
26673
|
try {
|
|
26660
26674
|
combined.throwIfAborted();
|
|
26661
26675
|
const result = await work({
|
|
26662
26676
|
signal: combined,
|
|
26663
26677
|
startCompile() {
|
|
26664
26678
|
combined.throwIfAborted();
|
|
26665
|
-
|
|
26666
|
-
|
|
26667
|
-
|
|
26668
|
-
|
|
26669
|
-
);
|
|
26679
|
+
compiling2 = true;
|
|
26680
|
+
restart();
|
|
26681
|
+
},
|
|
26682
|
+
progress() {
|
|
26683
|
+
if (compiling2 && !deadline.signal.aborted) restart();
|
|
26670
26684
|
}
|
|
26671
26685
|
});
|
|
26672
|
-
|
|
26686
|
+
signal?.throwIfAborted();
|
|
26673
26687
|
return result;
|
|
26674
26688
|
} finally {
|
|
26675
26689
|
clearTimeout(timer);
|
|
@@ -44675,6 +44689,7 @@ async function compileGuestLink(options2) {
|
|
|
44675
44689
|
);
|
|
44676
44690
|
continue;
|
|
44677
44691
|
}
|
|
44692
|
+
options2.onStage("lowering the app image");
|
|
44678
44693
|
const lowerPromise = link.lower();
|
|
44679
44694
|
await new Promise((resolve11) => setImmediate(resolve11));
|
|
44680
44695
|
let binding;
|
|
@@ -44705,6 +44720,7 @@ async function compileGuestLink(options2) {
|
|
|
44705
44720
|
return binding;
|
|
44706
44721
|
}
|
|
44707
44722
|
}
|
|
44723
|
+
options2.onStage("lowering the app image");
|
|
44708
44724
|
await lowerWasm(options2.output, options2.optimized, {
|
|
44709
44725
|
optimize: options2.optimize,
|
|
44710
44726
|
skipPasses: ["duplicate-function-elimination"],
|
|
@@ -46128,8 +46144,18 @@ async function runCompiler(command, args, options2, stream = false, quiet) {
|
|
|
46128
46144
|
void stopping.catch(() => {
|
|
46129
46145
|
});
|
|
46130
46146
|
};
|
|
46147
|
+
const restartTimeout = () => {
|
|
46148
|
+
if (!options2.timeout) return;
|
|
46149
|
+
clearTimeout(timeout);
|
|
46150
|
+
timeout = setTimeout(() => {
|
|
46151
|
+
failure2 = new Error(`Swift compiler was silent for ${options2.timeout}ms`);
|
|
46152
|
+
stop();
|
|
46153
|
+
}, options2.timeout);
|
|
46154
|
+
};
|
|
46131
46155
|
for (const name3 of ["stdout", "stderr"]) {
|
|
46132
46156
|
child[name3].on("data", (bytes) => {
|
|
46157
|
+
restartTimeout();
|
|
46158
|
+
options2.onOutput?.();
|
|
46133
46159
|
if (stream === true) process[name3].write(bytes);
|
|
46134
46160
|
else if (stream) {
|
|
46135
46161
|
const lines = (partial[name3] + bytes.toString()).split("\n");
|
|
@@ -46178,11 +46204,7 @@ async function runCompiler(command, args, options2, stream = false, quiet) {
|
|
|
46178
46204
|
resolve11(Buffer.concat(chunks.stdout).toString());
|
|
46179
46205
|
}
|
|
46180
46206
|
});
|
|
46181
|
-
|
|
46182
|
-
timeout = setTimeout(() => {
|
|
46183
|
-
failure2 = new Error("Swift compiler timed out");
|
|
46184
|
-
stop();
|
|
46185
|
-
}, options2.timeout);
|
|
46207
|
+
restartTimeout();
|
|
46186
46208
|
if (signal?.aborted) stop();
|
|
46187
46209
|
});
|
|
46188
46210
|
} finally {
|
|
@@ -51069,24 +51091,18 @@ function readFrameworkProductsReceipt(scratch2, receiptKey) {
|
|
|
51069
51091
|
} catch {
|
|
51070
51092
|
return null;
|
|
51071
51093
|
}
|
|
51072
|
-
const
|
|
51073
|
-
|
|
51074
|
-
const archiveMatches = (0, import_node_fs79.existsSync)(archiveStamp) && (0, import_node_fs79.readFileSync)(archiveStamp, "utf8") === receiptKey;
|
|
51094
|
+
const archiveRoot = import_node_path81.default.join(scratch2, "products-lib", receiptKey);
|
|
51095
|
+
if (parsed2.root !== archiveRoot) return null;
|
|
51075
51096
|
if (!(0, import_node_fs79.existsSync)(parsed2.modules)) return null;
|
|
51076
|
-
for (const [object9] of parsed2.archived)
|
|
51097
|
+
for (const [object9, rel] of parsed2.archived) {
|
|
51098
|
+
if (!(0, import_node_fs79.existsSync)(object9) || !(0, import_node_fs79.existsSync)(import_node_path81.default.join(archiveRoot, rel))) return null;
|
|
51099
|
+
}
|
|
51077
51100
|
for (const file of parsed2.providers) if (!(0, import_node_fs79.existsSync)(file)) return null;
|
|
51078
51101
|
for (const file of parsed2.moduleMaps) if (!(0, import_node_fs79.existsSync)(file)) return null;
|
|
51079
|
-
if (!archiveMatches) {
|
|
51080
|
-
(0, import_node_fs79.rmSync)(archive, { recursive: true, force: true });
|
|
51081
|
-
(0, import_node_fs79.mkdirSync)(archive, { recursive: true });
|
|
51082
|
-
for (const [object9, rel] of parsed2.archived)
|
|
51083
|
-
(0, import_node_fs79.symlinkSync)(object9, import_node_path81.default.join(scratch2, rel));
|
|
51084
|
-
(0, import_node_fs79.writeFileSync)(archiveStamp, receiptKey);
|
|
51085
|
-
}
|
|
51086
51102
|
for (const file of parsed2.objects) if (!(0, import_node_fs79.existsSync)(file)) return null;
|
|
51087
51103
|
for (const file of parsed2.lazyObjects) if (!(0, import_node_fs79.existsSync)(file)) return null;
|
|
51088
51104
|
return {
|
|
51089
|
-
root:
|
|
51105
|
+
root: parsed2.root,
|
|
51090
51106
|
modules: parsed2.modules,
|
|
51091
51107
|
objects: parsed2.objects,
|
|
51092
51108
|
lazyObjects: parsed2.lazyObjects,
|
|
@@ -51104,7 +51120,7 @@ async function buildFrameworkProducts(scratch2, args) {
|
|
|
51104
51120
|
const selectorOptions = swiftObjCSelectorOptions(args.moduleRoot);
|
|
51105
51121
|
const receiptKey = (0, import_node_crypto47.createHash)("sha256").update(
|
|
51106
51122
|
JSON.stringify([
|
|
51107
|
-
"framework-products/
|
|
51123
|
+
"framework-products/v2",
|
|
51108
51124
|
args.frameworkKey,
|
|
51109
51125
|
unoptimized,
|
|
51110
51126
|
args.sdk,
|
|
@@ -51262,28 +51278,40 @@ async function buildFrameworkProducts(scratch2, args) {
|
|
|
51262
51278
|
}
|
|
51263
51279
|
const providers = (0, import_node_fs79.readdirSync)(providerDir).filter((file) => file.endsWith(".o")).sort().map((file) => import_node_path81.default.join(providerDir, file));
|
|
51264
51280
|
for (const provider of providers) linked.owners.set(provider, "DarwinRecords");
|
|
51265
|
-
const
|
|
51266
|
-
(0, import_node_fs79.
|
|
51267
|
-
(
|
|
51281
|
+
const archiveBase = import_node_path81.default.join(scratch2, "products-lib");
|
|
51282
|
+
(0, import_node_fs79.mkdirSync)(archiveBase, { recursive: true });
|
|
51283
|
+
const archiveRoot = import_node_path81.default.join(archiveBase, receiptKey);
|
|
51284
|
+
const stagedArchiveRoot = `${archiveRoot}.tmp-${process.pid}-${(0, import_node_crypto47.randomUUID)()}`;
|
|
51285
|
+
const stagedArchive = import_node_path81.default.join(stagedArchiveRoot, "lib");
|
|
51286
|
+
(0, import_node_fs79.mkdirSync)(stagedArchive, { recursive: true });
|
|
51268
51287
|
const archived = /* @__PURE__ */ new Map();
|
|
51269
|
-
|
|
51270
|
-
const
|
|
51271
|
-
|
|
51272
|
-
|
|
51273
|
-
|
|
51274
|
-
|
|
51275
|
-
|
|
51276
|
-
|
|
51277
|
-
|
|
51278
|
-
|
|
51279
|
-
|
|
51280
|
-
|
|
51288
|
+
try {
|
|
51289
|
+
for (const object9 of objects) {
|
|
51290
|
+
const target = linked.owners.get(object9);
|
|
51291
|
+
const dir = import_node_path81.default.join(release, `${target}.build`);
|
|
51292
|
+
if (!target || target === "Darwin" || !object9.startsWith(dir + import_node_path81.default.sep)) continue;
|
|
51293
|
+
const name3 = `${target}-${import_node_path81.default.relative(dir, object9).replaceAll(import_node_path81.default.sep, "-").replace(/\.swift\.o$/, ".o")}`;
|
|
51294
|
+
(0, import_node_fs79.symlinkSync)(object9, import_node_path81.default.join(stagedArchive, name3));
|
|
51295
|
+
archived.set(object9, `lib/${name3}`);
|
|
51296
|
+
}
|
|
51297
|
+
(0, import_node_fs79.rmSync)(archiveRoot, { recursive: true, force: true });
|
|
51298
|
+
(0, import_node_fs79.renameSync)(stagedArchiveRoot, archiveRoot);
|
|
51299
|
+
} catch (error) {
|
|
51300
|
+
(0, import_node_fs79.rmSync)(stagedArchiveRoot, { recursive: true, force: true });
|
|
51301
|
+
throw error;
|
|
51302
|
+
}
|
|
51303
|
+
const roots = swiftObjcRootObjects(
|
|
51304
|
+
`${archiveRoot}
|
|
51305
|
+
${args.frameworkKey}`,
|
|
51306
|
+
archiveRoot,
|
|
51307
|
+
[...archived.values()]
|
|
51308
|
+
);
|
|
51281
51309
|
const linkedObjects = objects.map((object9) => {
|
|
51282
51310
|
const name3 = archived.get(object9);
|
|
51283
|
-
return name3 ? { path: import_node_path81.default.join(
|
|
51311
|
+
return name3 ? { path: import_node_path81.default.join(archiveRoot, name3), lazy: !roots.has(name3) } : { path: object9, lazy: false };
|
|
51284
51312
|
});
|
|
51285
51313
|
const result = {
|
|
51286
|
-
root:
|
|
51314
|
+
root: archiveRoot,
|
|
51287
51315
|
modules: import_node_path81.default.join(release, "Modules"),
|
|
51288
51316
|
objects: linkedObjects.filter((object9) => !object9.lazy).map((object9) => object9.path),
|
|
51289
51317
|
lazyObjects: linkedObjects.filter((object9) => object9.lazy).map((object9) => object9.path),
|
|
@@ -51293,7 +51321,6 @@ ${args.frameworkKey}`, scratch2, [
|
|
|
51293
51321
|
moduleMaps: linked.moduleMaps,
|
|
51294
51322
|
objcHeaders: linked.objcHeaders
|
|
51295
51323
|
};
|
|
51296
|
-
(0, import_node_fs79.writeFileSync)(import_node_path81.default.join(archive, ".receipt"), receiptKey);
|
|
51297
51324
|
const receiptsDir = import_node_path81.default.join(scratch2, "products-ready");
|
|
51298
51325
|
(0, import_node_fs79.mkdirSync)(receiptsDir, { recursive: true });
|
|
51299
51326
|
const receiptFile2 = import_node_path81.default.join(receiptsDir, `${receiptKey}.json`);
|
|
@@ -51301,6 +51328,7 @@ ${args.frameworkKey}`, scratch2, [
|
|
|
51301
51328
|
(0, import_node_fs79.writeFileSync)(
|
|
51302
51329
|
partialReceipt,
|
|
51303
51330
|
JSON.stringify({
|
|
51331
|
+
root: result.root,
|
|
51304
51332
|
modules: result.modules,
|
|
51305
51333
|
objects: result.objects,
|
|
51306
51334
|
lazyObjects: result.lazyObjects,
|
|
@@ -51332,7 +51360,10 @@ function swiftFrameworkSlotRecord(slot, record6) {
|
|
|
51332
51360
|
function swiftFrameworkSlotKey(slot) {
|
|
51333
51361
|
return swiftFrameworkSlotRecord(slot, SWIFT_FRAMEWORK_SLOT_KEY);
|
|
51334
51362
|
}
|
|
51335
|
-
|
|
51363
|
+
function swiftFrameworkSlotRelease(slot) {
|
|
51364
|
+
return swiftFrameworkSlotRecord(slot, SWIFT_FRAMEWORK_SLOT_RELEASE);
|
|
51365
|
+
}
|
|
51366
|
+
async function withSwiftFrameworkSlot(frameworkKey, release, moduleRoot, signal, work, unoptimized = false) {
|
|
51336
51367
|
const slotCount = unoptimized ? SWIFT_FRAMEWORK_UNOPTIMIZED_SLOTS : SWIFT_FRAMEWORK_SLOTS;
|
|
51337
51368
|
const slotsDir = swiftFrameworksDir(unoptimized);
|
|
51338
51369
|
const slots = Array.from({ length: slotCount }, (_, index) => {
|
|
@@ -51355,9 +51386,12 @@ async function withSwiftFrameworkSlot(frameworkKey, moduleRoot, signal, work, un
|
|
|
51355
51386
|
(0, import_node_fs79.readFileSync)(import_node_path81.default.join(moduleRoot, file))
|
|
51356
51387
|
])
|
|
51357
51388
|
);
|
|
51358
|
-
const ranked = slots.map((slot) => {
|
|
51389
|
+
const ranked = slots.map((slot, index) => {
|
|
51390
|
+
const slotKey = swiftFrameworkSlotKey(slot);
|
|
51391
|
+
if (slotKey === null) return { slot, index, tier: 1, changes: Infinity };
|
|
51392
|
+
if (swiftFrameworkSlotRelease(slot) !== release)
|
|
51393
|
+
return { slot, index, tier: 2, changes: Infinity };
|
|
51359
51394
|
let changes = 0;
|
|
51360
|
-
if (swiftFrameworkSlotKey(slot) === null) return { slot, changes: Infinity };
|
|
51361
51395
|
const source = import_node_path81.default.join(slot, "source", "packages", import_node_path81.default.basename(moduleRoot));
|
|
51362
51396
|
for (const [file, contents2] of inputs2) {
|
|
51363
51397
|
try {
|
|
@@ -51369,18 +51403,22 @@ async function withSwiftFrameworkSlot(frameworkKey, moduleRoot, signal, work, un
|
|
|
51369
51403
|
changes++;
|
|
51370
51404
|
}
|
|
51371
51405
|
}
|
|
51372
|
-
return { slot, changes };
|
|
51373
|
-
}).sort(
|
|
51374
|
-
(left
|
|
51375
|
-
|
|
51376
|
-
|
|
51406
|
+
return { slot, index, tier: 0, changes };
|
|
51407
|
+
}).sort((left, right) => {
|
|
51408
|
+
if (left.tier !== right.tier) return left.tier - right.tier;
|
|
51409
|
+
if (left.tier === 0)
|
|
51410
|
+
return left.changes - right.changes || Number(own2(right.slot)) - Number(own2(left.slot)) || (built2.get(right.slot) ?? 0) - (built2.get(left.slot) ?? 0);
|
|
51411
|
+
if (left.tier === 1) return left.index - right.index;
|
|
51412
|
+
return (built2.get(left.slot) ?? 0) - (built2.get(right.slot) ?? 0);
|
|
51413
|
+
});
|
|
51414
|
+
for (const { slot, tier, changes } of ranked) {
|
|
51377
51415
|
if (await hasLiveSwiftRootReaders(slot, signal)) continue;
|
|
51378
51416
|
const result = await withSwiftRootLock(
|
|
51379
51417
|
slot,
|
|
51380
51418
|
async (lease) => {
|
|
51381
51419
|
if (await hasLiveSwiftRootReaders(slot, signal)) return void 0;
|
|
51382
51420
|
console.error(
|
|
51383
|
-
`[swift-framework-cache] ${import_node_path81.default.basename(slot)} changedInputs=${changes} totalInputs=${inputs2.size}`
|
|
51421
|
+
`[swift-framework-cache] ${import_node_path81.default.basename(slot)} release=${release} tier=${tier} changedInputs=${changes} totalInputs=${inputs2.size}`
|
|
51384
51422
|
);
|
|
51385
51423
|
return { value: await run17(slot)(lease) };
|
|
51386
51424
|
},
|
|
@@ -51392,6 +51430,43 @@ async function withSwiftFrameworkSlot(frameworkKey, moduleRoot, signal, work, un
|
|
|
51392
51430
|
const nearest = ranked[0].slot;
|
|
51393
51431
|
return withSwiftRootLock(nearest, run17(nearest), signal);
|
|
51394
51432
|
}
|
|
51433
|
+
async function withSwiftBuildRootSlot(baseRoot, buildShape, signal, work) {
|
|
51434
|
+
const slots = Array.from({ length: SWIFT_BUILD_ROOT_SLOTS }, (_, index) => {
|
|
51435
|
+
const slot = index === 0 ? baseRoot : `${baseRoot}-s${index}`;
|
|
51436
|
+
(0, import_node_fs79.mkdirSync)(slot, { recursive: true });
|
|
51437
|
+
return slot;
|
|
51438
|
+
});
|
|
51439
|
+
const runInSlot = (slot, waitStart2) => (lease) => {
|
|
51440
|
+
const waitedMs = Date.now() - waitStart2;
|
|
51441
|
+
const now = /* @__PURE__ */ new Date();
|
|
51442
|
+
(0, import_node_fs79.utimesSync)(slot, now, now);
|
|
51443
|
+
return work(slot, lease, waitedMs);
|
|
51444
|
+
};
|
|
51445
|
+
const built2 = new Map(slots.map((slot) => [slot, (0, import_node_fs79.statSync)(slot).mtimeMs]));
|
|
51446
|
+
const ranked = slots.map((slot, index) => {
|
|
51447
|
+
const shape = swiftFrameworkSlotRecord(slot, SWIFT_BUILD_ROOT_SHAPE);
|
|
51448
|
+
const tier = shape === buildShape ? 0 : shape === null ? 1 : 2;
|
|
51449
|
+
return { slot, index, tier };
|
|
51450
|
+
}).sort((left, right) => {
|
|
51451
|
+
if (left.tier !== right.tier) return left.tier - right.tier;
|
|
51452
|
+
if (left.tier === 0)
|
|
51453
|
+
return (built2.get(right.slot) ?? 0) - (built2.get(left.slot) ?? 0);
|
|
51454
|
+
if (left.tier === 1) return left.index - right.index;
|
|
51455
|
+
return (built2.get(left.slot) ?? 0) - (built2.get(right.slot) ?? 0);
|
|
51456
|
+
});
|
|
51457
|
+
for (const { slot } of ranked) {
|
|
51458
|
+
const result = await withSwiftRootLock(
|
|
51459
|
+
slot,
|
|
51460
|
+
async (lease) => ({ value: await runInSlot(slot, Date.now())(lease) }),
|
|
51461
|
+
signal,
|
|
51462
|
+
false
|
|
51463
|
+
);
|
|
51464
|
+
if (result) return result.value;
|
|
51465
|
+
}
|
|
51466
|
+
const nearest = ranked[0].slot;
|
|
51467
|
+
const waitStart = Date.now();
|
|
51468
|
+
return withSwiftRootLock(nearest, runInSlot(nearest, waitStart), signal);
|
|
51469
|
+
}
|
|
51395
51470
|
function mirrorTree2(source, target, skip) {
|
|
51396
51471
|
(0, import_node_fs79.mkdirSync)(target, { recursive: true });
|
|
51397
51472
|
const wanted = /* @__PURE__ */ new Set();
|
|
@@ -51441,8 +51516,10 @@ function stageFrameworkSource(moduleRoot, slot, frameworkKey, release) {
|
|
|
51441
51516
|
const hadKey = swiftFrameworkSlotKey(slot);
|
|
51442
51517
|
if (hadKey !== frameworkKey) {
|
|
51443
51518
|
(0, import_node_fs79.rmSync)(import_node_path81.default.join(slot, SWIFT_FRAMEWORK_SLOT_KEY), { force: true });
|
|
51519
|
+
(0, import_node_fs79.rmSync)(import_node_path81.default.join(slot, SWIFT_FRAMEWORK_SLOT_RELEASE), { force: true });
|
|
51444
51520
|
(0, import_node_fs79.rmSync)(import_node_path81.default.join(slot, "products-ready"), { recursive: true, force: true });
|
|
51445
|
-
(0, import_node_fs79.rmSync)(import_node_path81.default.join(slot, "lib"
|
|
51521
|
+
(0, import_node_fs79.rmSync)(import_node_path81.default.join(slot, "products-lib"), { recursive: true, force: true });
|
|
51522
|
+
(0, import_node_fs79.rmSync)(import_node_path81.default.join(slot, "lib"), { recursive: true, force: true });
|
|
51446
51523
|
const moduleRestructured = mirrorTree2(moduleRoot, stagedModule, ".build");
|
|
51447
51524
|
const sdkRestructured = mirrorTree2(
|
|
51448
51525
|
swiftSharedSdkRoot(moduleRoot, false),
|
|
@@ -51470,8 +51547,11 @@ function stageFrameworkSource(moduleRoot, slot, frameworkKey, release) {
|
|
|
51470
51547
|
(0, import_node_fs79.rmSync)(modules, { recursive: true, force: true });
|
|
51471
51548
|
(0, import_node_fs79.symlinkSync)(target, modules);
|
|
51472
51549
|
}
|
|
51550
|
+
(0, import_node_fs79.writeFileSync)(import_node_path81.default.join(slot, SWIFT_FRAMEWORK_SLOT_RELEASE), release);
|
|
51473
51551
|
(0, import_node_fs79.writeFileSync)(import_node_path81.default.join(slot, SWIFT_FRAMEWORK_SLOT_KEY), frameworkKey);
|
|
51474
51552
|
(0, import_node_fs79.writeFileSync)(import_node_path81.default.join(slot, SWIFT_FRAMEWORK_SLOT_ORIGIN), moduleRoot);
|
|
51553
|
+
} else if (swiftFrameworkSlotRelease(slot) !== release) {
|
|
51554
|
+
(0, import_node_fs79.writeFileSync)(import_node_path81.default.join(slot, SWIFT_FRAMEWORK_SLOT_RELEASE), release);
|
|
51475
51555
|
}
|
|
51476
51556
|
return stagedModule;
|
|
51477
51557
|
}
|
|
@@ -51699,660 +51779,717 @@ ${cap}` : "";
|
|
|
51699
51779
|
(0, import_node_fs79.rmSync)(requestRoot, { recursive: true, force: true });
|
|
51700
51780
|
}
|
|
51701
51781
|
}
|
|
51782
|
+
const baseRoot = root;
|
|
51783
|
+
const canPoolBuildRoot = !options2.intermediates && !options2.project && !options2.linkOnly && import_node_path81.default.basename(import_node_path81.default.dirname(baseRoot)) === "swift-builds";
|
|
51784
|
+
const buildShape = canPoolBuildRoot ? (0, import_node_crypto47.createHash)("sha256").update(
|
|
51785
|
+
JSON.stringify([
|
|
51786
|
+
frameworkKey,
|
|
51787
|
+
Boolean(sdkImage),
|
|
51788
|
+
compileTargets(input).map((target) => target.name).sort(),
|
|
51789
|
+
input.oneModule === true,
|
|
51790
|
+
input.optimize === true,
|
|
51791
|
+
input.unoptimized === true,
|
|
51792
|
+
Object.keys(input.files).sort()
|
|
51793
|
+
])
|
|
51794
|
+
).digest("hex").slice(0, 16) : "";
|
|
51702
51795
|
return withSwiftCompileBudget(options2.timeoutMs, options2.signal, async (budget) => {
|
|
51703
|
-
|
|
51704
|
-
|
|
51705
|
-
|
|
51706
|
-
|
|
51707
|
-
|
|
51708
|
-
|
|
51709
|
-
|
|
51710
|
-
|
|
51711
|
-
|
|
51712
|
-
|
|
51713
|
-
|
|
51714
|
-
|
|
51715
|
-
|
|
51716
|
-
|
|
51717
|
-
|
|
51796
|
+
const stage = (message) => {
|
|
51797
|
+
budget.progress();
|
|
51798
|
+
report(message);
|
|
51799
|
+
};
|
|
51800
|
+
const runLocked = (work) => {
|
|
51801
|
+
if (canPoolBuildRoot) {
|
|
51802
|
+
(0, import_node_fs79.mkdirSync)(sharedRoot, { recursive: true });
|
|
51803
|
+
return withSwiftRootLock(
|
|
51804
|
+
sharedRoot,
|
|
51805
|
+
async () => {
|
|
51806
|
+
const built2 = readCompiledArtifact(
|
|
51807
|
+
import_node_path81.default.join(sharedRoot, "artifact"),
|
|
51808
|
+
hash
|
|
51809
|
+
);
|
|
51810
|
+
if (built2) {
|
|
51811
|
+
stage("reusing verified disk artifact");
|
|
51812
|
+
return retain(baseRoot, built2);
|
|
51813
|
+
}
|
|
51814
|
+
return withSwiftBuildRootSlot(baseRoot, buildShape, budget.signal, work);
|
|
51815
|
+
},
|
|
51816
|
+
budget.signal
|
|
51817
|
+
);
|
|
51818
|
+
}
|
|
51819
|
+
const waitStart = Date.now();
|
|
51820
|
+
return withSwiftRootLock(
|
|
51821
|
+
baseRoot,
|
|
51822
|
+
(lease) => work(baseRoot, lease, Date.now() - waitStart),
|
|
51823
|
+
budget.signal
|
|
51824
|
+
);
|
|
51825
|
+
};
|
|
51826
|
+
return runLocked(async (slotRoot, lease, waitedMs) => {
|
|
51827
|
+
const root2 = slotRoot;
|
|
51828
|
+
const layout3 = {
|
|
51829
|
+
root: root2,
|
|
51830
|
+
sources: import_node_path81.default.join(root2, "Sources", "App"),
|
|
51831
|
+
multi: compileTargets(input).length > 0
|
|
51832
|
+
};
|
|
51833
|
+
if (!options2.intermediates) {
|
|
51834
|
+
const built2 = readCompiledArtifact(import_node_path81.default.join(sharedRoot, "artifact"), hash);
|
|
51835
|
+
if (built2) {
|
|
51836
|
+
stage("reusing verified disk artifact");
|
|
51837
|
+
return retain(baseRoot, built2);
|
|
51718
51838
|
}
|
|
51719
|
-
|
|
51720
|
-
|
|
51721
|
-
|
|
51722
|
-
|
|
51839
|
+
}
|
|
51840
|
+
if (waitedMs >= 1e3)
|
|
51841
|
+
report(`acquired build root ${import_node_path81.default.basename(root2)} after ${waitedMs}ms`);
|
|
51842
|
+
if (canPoolBuildRoot) {
|
|
51843
|
+
refreshSwiftCacheHold(root2);
|
|
51844
|
+
(0, import_node_fs79.writeFileSync)(import_node_path81.default.join(root2, SWIFT_BUILD_ROOT_SHAPE), buildShape);
|
|
51845
|
+
}
|
|
51846
|
+
const swift = import_node_path81.default.join(options2.toolchainBin, "swift");
|
|
51847
|
+
if (!(0, import_node_fs79.existsSync)(swift)) {
|
|
51848
|
+
throw new Error(
|
|
51849
|
+
`swift-compile: no swift.org toolchain at ${options2.toolchainBin}; install ${options2.release} and its matching wasm sdk`
|
|
51850
|
+
);
|
|
51851
|
+
}
|
|
51852
|
+
const unoptimized = input.unoptimized === true;
|
|
51853
|
+
const withFrameworkLock = (work) => distribution ? work(null) : withSwiftFrameworkSlot(
|
|
51854
|
+
frameworkKey,
|
|
51855
|
+
options2.release,
|
|
51856
|
+
moduleRoot,
|
|
51857
|
+
budget.signal,
|
|
51858
|
+
work,
|
|
51859
|
+
unoptimized
|
|
51860
|
+
);
|
|
51861
|
+
const baseBuildEnv = options2.project?.env ? {
|
|
51862
|
+
...options2.project.env,
|
|
51863
|
+
// shipped host plugins resolve against the selected compiler's runtime.
|
|
51864
|
+
...process.platform === "linux" ? {
|
|
51865
|
+
LD_LIBRARY_PATH: [
|
|
51866
|
+
import_node_path81.default.resolve(options2.toolchainBin, "../lib/swift/linux"),
|
|
51867
|
+
import_node_path81.default.resolve(options2.toolchainBin, "../lib/swift/host"),
|
|
51868
|
+
process.env.LD_LIBRARY_PATH
|
|
51869
|
+
].filter(Boolean).join(":")
|
|
51870
|
+
} : {},
|
|
51871
|
+
PEACH_DEFER_WASM_LINK: "1"
|
|
51872
|
+
} : swiftCompilerBaseEnv(options2.toolchainBin, process.env);
|
|
51873
|
+
const {
|
|
51874
|
+
frameworkRoot,
|
|
51875
|
+
compileFrameworkRoot,
|
|
51876
|
+
macroPlugins,
|
|
51877
|
+
sdk: sdk2,
|
|
51878
|
+
icu,
|
|
51879
|
+
prebuilt,
|
|
51880
|
+
readHold
|
|
51881
|
+
} = await withFrameworkLock(async (slot, frameworkLease) => {
|
|
51882
|
+
budget.startCompile();
|
|
51883
|
+
if (slot && swiftFrameworkSlotKey(slot) !== frameworkKey)
|
|
51884
|
+
await waitForNoSwiftRootReaders(slot, budget.signal);
|
|
51885
|
+
const frameworkRoot2 = mirrorDistribution ? syncSwiftDistributionMirror(root2, moduleRoot, mirrorDistribution) : distribution ? moduleRoot : stageFrameworkSource(moduleRoot, slot, frameworkKey, options2.release);
|
|
51886
|
+
if (!swiftModuleDigest(frameworkRoot2).equals(moduleDigest))
|
|
51887
|
+
throw new Error("Swift staged project source differs from the caller");
|
|
51888
|
+
stage("preparing compiler plugins");
|
|
51889
|
+
const macroPlugins2 = await ensureMacroPlugins(
|
|
51890
|
+
frameworkRoot2,
|
|
51891
|
+
options2.toolchainBin,
|
|
51892
|
+
options2.release,
|
|
51723
51893
|
budget.signal,
|
|
51724
|
-
|
|
51725
|
-
unoptimized
|
|
51894
|
+
frameworkLease
|
|
51726
51895
|
);
|
|
51727
|
-
const
|
|
51728
|
-
|
|
51729
|
-
|
|
51730
|
-
|
|
51731
|
-
|
|
51732
|
-
|
|
51733
|
-
|
|
51734
|
-
|
|
51735
|
-
|
|
51736
|
-
|
|
51737
|
-
|
|
51738
|
-
|
|
51739
|
-
|
|
51896
|
+
const compileFrameworkRoot2 = distribution ? swiftDistributionCompileView(frameworkRoot2, distribution) : frameworkRoot2;
|
|
51897
|
+
const sdk3 = swiftModuleSdk(frameworkRoot2).wasmSdkId;
|
|
51898
|
+
const icu2 = options2.linkOnly ? null : swiftIcuAsset(options2.toolchainBin, sdk3);
|
|
51899
|
+
let prebuilt2;
|
|
51900
|
+
if (!distribution) {
|
|
51901
|
+
stage("compiling framework products");
|
|
51902
|
+
prebuilt2 = await buildFrameworkProducts(slot, {
|
|
51903
|
+
moduleRoot: frameworkRoot2,
|
|
51904
|
+
frameworkKey,
|
|
51905
|
+
input,
|
|
51906
|
+
swift,
|
|
51907
|
+
sdk: sdk3,
|
|
51908
|
+
toolchainBin: options2.toolchainBin,
|
|
51909
|
+
plugins: macroPlugins2,
|
|
51910
|
+
buildOptions: {
|
|
51911
|
+
env: baseBuildEnv,
|
|
51912
|
+
maxBuffer: 64 * 1024 * 1024,
|
|
51913
|
+
signal: budget.signal,
|
|
51914
|
+
onOutput: budget.progress,
|
|
51915
|
+
lease,
|
|
51916
|
+
frameworkLease
|
|
51917
|
+
}
|
|
51918
|
+
});
|
|
51919
|
+
}
|
|
51920
|
+
const readHold2 = slot ? acquireSwiftRootReadHold(slot) : void 0;
|
|
51921
|
+
return {
|
|
51922
|
+
frameworkRoot: frameworkRoot2,
|
|
51923
|
+
compileFrameworkRoot: compileFrameworkRoot2,
|
|
51924
|
+
macroPlugins: macroPlugins2,
|
|
51925
|
+
sdk: sdk3,
|
|
51926
|
+
icu: icu2,
|
|
51927
|
+
prebuilt: prebuilt2,
|
|
51928
|
+
readHold: readHold2
|
|
51929
|
+
};
|
|
51930
|
+
});
|
|
51931
|
+
const buildOptions = {
|
|
51932
|
+
env: baseBuildEnv,
|
|
51933
|
+
maxBuffer: 64 * 1024 * 1024,
|
|
51934
|
+
signal: budget.signal,
|
|
51935
|
+
onOutput: budget.progress,
|
|
51936
|
+
lease
|
|
51937
|
+
};
|
|
51938
|
+
try {
|
|
51939
|
+
if (options2.project) removeProjectLinks(root2);
|
|
51940
|
+
const packageHostMacros = process.platform === "linux" ? input.packageHostMacros : void 0;
|
|
51941
|
+
if (retireStaleSwiftLink(
|
|
51942
|
+
root2,
|
|
51943
|
+
swiftLinkStamp({
|
|
51944
|
+
frameworkKey: `${options2.release}\0${Boolean(distribution)}\0${swiftModuleSdk(frameworkRoot).wasmSdkId}`,
|
|
51945
|
+
packageHostMacros
|
|
51946
|
+
}),
|
|
51947
|
+
swiftLinkStamp({
|
|
51948
|
+
// a distribution's objects reach only the deferred link, and
|
|
51949
|
+
// the root's mirror keeps its compile inputs at fixed paths
|
|
51950
|
+
frameworkKey: distribution ? `${options2.release}\0${distribution.wasmSdkChecksum}` : frameworkKey,
|
|
51951
|
+
prebuilt,
|
|
51952
|
+
packageHostMacros
|
|
51953
|
+
}),
|
|
51954
|
+
Boolean(options2.linkOnly)
|
|
51955
|
+
))
|
|
51956
|
+
stage("framework revision changed; rebuilding the app link");
|
|
51957
|
+
const nativeToolset = needsNativeToolset(input, prebuilt);
|
|
51958
|
+
const preparation = writeSwiftProject(
|
|
51959
|
+
layout3,
|
|
51960
|
+
input,
|
|
51740
51961
|
frameworkRoot,
|
|
51741
|
-
compileFrameworkRoot,
|
|
51742
|
-
macroPlugins,
|
|
51743
|
-
sdk: sdk2,
|
|
51744
|
-
icu,
|
|
51745
51962
|
prebuilt,
|
|
51746
|
-
|
|
51747
|
-
|
|
51748
|
-
|
|
51749
|
-
|
|
51750
|
-
|
|
51751
|
-
|
|
51752
|
-
|
|
51753
|
-
|
|
51754
|
-
|
|
51755
|
-
|
|
51756
|
-
|
|
51757
|
-
|
|
51758
|
-
|
|
51759
|
-
|
|
51760
|
-
|
|
51963
|
+
!options2.project,
|
|
51964
|
+
options2.project ? false : options2.objcPrebuiltStage ?? (options2.intermediates ? false : void 0)
|
|
51965
|
+
);
|
|
51966
|
+
const productFile = import_node_path81.default.join(frameworkRoot, SWIFT_FRAMEWORK_PRODUCT_FILE);
|
|
51967
|
+
writeSwiftAutolinkLinker(
|
|
51968
|
+
root2,
|
|
51969
|
+
options2.toolchainBin,
|
|
51970
|
+
(0, import_node_fs79.existsSync)(productFile) ? [
|
|
51971
|
+
v6.parse(
|
|
51972
|
+
swiftFrameworkProductSchema,
|
|
51973
|
+
JSON.parse((0, import_node_fs79.readFileSync)(productFile, "utf8"))
|
|
51974
|
+
).product.name
|
|
51975
|
+
] : []
|
|
51976
|
+
);
|
|
51977
|
+
const compiler = preparation.targetToolset ? { CC: import_node_path81.default.join(root2, CLANG_TARGET_MODULE_WRAPPER) } : {};
|
|
51978
|
+
if (packageHostMacros?.length) {
|
|
51979
|
+
const swiftc = import_node_path81.default.join(root2, SWIFT_HOST_COMPILER_WRAPPER);
|
|
51980
|
+
writeBuildFile(
|
|
51981
|
+
swiftc,
|
|
51982
|
+
[
|
|
51983
|
+
"#!/bin/sh",
|
|
51984
|
+
"target=",
|
|
51985
|
+
"module=",
|
|
51986
|
+
"compile=",
|
|
51987
|
+
"previous=",
|
|
51988
|
+
"for argument do",
|
|
51989
|
+
' case "$previous" in -target) target=$argument ;; -module-name) module=$argument ;; esac',
|
|
51990
|
+
' case "$argument" in -c|-emit-module|-scan-dependencies|-typecheck) compile=1 ;; esac',
|
|
51991
|
+
" previous=$argument",
|
|
51992
|
+
"done",
|
|
51993
|
+
'case "$target/$compile" in',
|
|
51994
|
+
" *-*-linux*/1)",
|
|
51995
|
+
' case ",$PEACH_SWIFT_HOST_MACROS," in',
|
|
51996
|
+
' *",$module,"*) set -- "$@" -Xfrontend -import-module -Xfrontend Foundation ;;',
|
|
51997
|
+
" esac ;;",
|
|
51998
|
+
"esac",
|
|
51999
|
+
'exec "$PEACH_SWIFTC" "$@"',
|
|
52000
|
+
""
|
|
52001
|
+
].join("\n")
|
|
51761
52002
|
);
|
|
51762
|
-
|
|
51763
|
-
|
|
51764
|
-
|
|
51765
|
-
|
|
51766
|
-
|
|
51767
|
-
|
|
51768
|
-
|
|
51769
|
-
|
|
51770
|
-
|
|
51771
|
-
|
|
51772
|
-
|
|
51773
|
-
|
|
51774
|
-
|
|
51775
|
-
|
|
51776
|
-
|
|
51777
|
-
|
|
51778
|
-
|
|
51779
|
-
|
|
51780
|
-
|
|
51781
|
-
frameworkLease
|
|
51782
|
-
}
|
|
51783
|
-
});
|
|
52003
|
+
(0, import_node_fs79.chmodSync)(swiftc, 493);
|
|
52004
|
+
compiler.SWIFT_EXEC = swiftc;
|
|
52005
|
+
compiler.PEACH_SWIFT_HOST_MACROS = packageHostMacros.join(",");
|
|
52006
|
+
compiler.PEACH_SWIFTC = import_node_path81.default.join(options2.toolchainBin, "swiftc");
|
|
52007
|
+
}
|
|
52008
|
+
const projectProcess = options2.project ? prepareSwiftProjectProcess(root2, options2.project) : void 0;
|
|
52009
|
+
const temporaryDirectory = projectProcess ? void 0 : import_node_path81.default.join(root2, ".build", "peach-compiler-tmp");
|
|
52010
|
+
const appOptions = projectProcess ? {
|
|
52011
|
+
...buildOptions,
|
|
52012
|
+
uid: projectProcess.uid,
|
|
52013
|
+
gid: projectProcess.gid,
|
|
52014
|
+
confined: { ...projectProcess.env, ...compiler }
|
|
52015
|
+
} : {
|
|
52016
|
+
...buildOptions,
|
|
52017
|
+
temporaryDirectory,
|
|
52018
|
+
env: {
|
|
52019
|
+
...buildOptions.env,
|
|
52020
|
+
...preparation.usesObjcPrebuilt && process.env.PEACH_HOME !== void 0 ? { PEACH_HOME: process.env.PEACH_HOME } : {},
|
|
52021
|
+
...compiler
|
|
51784
52022
|
}
|
|
51785
|
-
const readHold2 = slot ? acquireSwiftRootReadHold(slot) : void 0;
|
|
51786
|
-
return {
|
|
51787
|
-
frameworkRoot: frameworkRoot2,
|
|
51788
|
-
compileFrameworkRoot: compileFrameworkRoot2,
|
|
51789
|
-
macroPlugins: macroPlugins2,
|
|
51790
|
-
sdk: sdk3,
|
|
51791
|
-
icu: icu2,
|
|
51792
|
-
prebuilt: prebuilt2,
|
|
51793
|
-
readHold: readHold2
|
|
51794
|
-
};
|
|
51795
|
-
});
|
|
51796
|
-
const buildOptions = {
|
|
51797
|
-
env: baseBuildEnv,
|
|
51798
|
-
maxBuffer: 64 * 1024 * 1024,
|
|
51799
|
-
signal: budget.signal,
|
|
51800
|
-
lease
|
|
51801
52023
|
};
|
|
51802
|
-
|
|
51803
|
-
|
|
51804
|
-
|
|
51805
|
-
|
|
51806
|
-
|
|
51807
|
-
|
|
51808
|
-
|
|
51809
|
-
|
|
51810
|
-
|
|
51811
|
-
|
|
51812
|
-
|
|
51813
|
-
// the root's mirror keeps its compile inputs at fixed paths
|
|
51814
|
-
frameworkKey: distribution ? `${options2.release}\0${distribution.wasmSdkChecksum}` : frameworkKey,
|
|
51815
|
-
prebuilt,
|
|
51816
|
-
packageHostMacros
|
|
51817
|
-
}),
|
|
51818
|
-
Boolean(options2.linkOnly)
|
|
51819
|
-
))
|
|
51820
|
-
report("framework revision changed; rebuilding the app link");
|
|
51821
|
-
const nativeToolset = needsNativeToolset(input, prebuilt);
|
|
51822
|
-
const preparation = writeSwiftProject(
|
|
51823
|
-
layout2,
|
|
51824
|
-
input,
|
|
51825
|
-
frameworkRoot,
|
|
51826
|
-
prebuilt,
|
|
51827
|
-
!options2.project,
|
|
51828
|
-
options2.project ? false : options2.objcPrebuiltStage ?? (options2.intermediates ? false : void 0)
|
|
52024
|
+
const unprepared = preparation.targetFailures.map(
|
|
52025
|
+
(failure2) => `error: target ${failure2}`
|
|
52026
|
+
);
|
|
52027
|
+
const forwarders = /* @__PURE__ */ new Map();
|
|
52028
|
+
for (const [file, text7] of Object.entries(input.files)) {
|
|
52029
|
+
const parents = /^#include "((?:\.\.\/)+)[^"\n]+"\n$/.exec(text7)?.[1];
|
|
52030
|
+
if (!parents) continue;
|
|
52031
|
+
const directory2 = import_node_path81.default.posix.dirname(file);
|
|
52032
|
+
forwarders.set(
|
|
52033
|
+
`${import_node_path81.default.join(root2, directory2)}/${parents.slice(0, -1)}`,
|
|
52034
|
+
import_node_path81.default.posix.join("build", directory2, parents).replace(/\/$/, "")
|
|
51829
52035
|
);
|
|
51830
|
-
|
|
51831
|
-
|
|
51832
|
-
|
|
51833
|
-
|
|
51834
|
-
|
|
51835
|
-
|
|
51836
|
-
|
|
51837
|
-
|
|
51838
|
-
|
|
51839
|
-
|
|
52036
|
+
}
|
|
52037
|
+
const jobs = swiftCompilerJobs();
|
|
52038
|
+
const incrementalPreview = sdkImage !== void 0 && !guestGraph && !options2.project && !input.optimize && !input.unoptimized;
|
|
52039
|
+
const perFile = input.unoptimized || incrementalPreview;
|
|
52040
|
+
const buildArgs = [
|
|
52041
|
+
"build",
|
|
52042
|
+
...projectProcess?.cacheOptions ?? swiftPackageCacheOptions(),
|
|
52043
|
+
"--build-system",
|
|
52044
|
+
"native",
|
|
52045
|
+
"-j",
|
|
52046
|
+
String(jobs),
|
|
52047
|
+
"--package-path",
|
|
52048
|
+
root2,
|
|
52049
|
+
...swiftCompileSdkOptions(frameworkRoot, options2.toolchainBin),
|
|
52050
|
+
...swiftObjCSelectorOptions(frameworkRoot),
|
|
52051
|
+
"--swift-sdk",
|
|
52052
|
+
sdk2,
|
|
52053
|
+
...preparation.targetToolset ? ["--toolset", import_node_path81.default.join(root2, ".peach-target-toolset.json")] : [],
|
|
52054
|
+
"-c",
|
|
52055
|
+
"release",
|
|
52056
|
+
...input.unoptimized ? ["-Xswiftc", "-Onone"] : [],
|
|
52057
|
+
...perFile ? [
|
|
52058
|
+
"-Xswiftc",
|
|
52059
|
+
"-no-whole-module-optimization",
|
|
52060
|
+
"-Xswiftc",
|
|
52061
|
+
"-j",
|
|
52062
|
+
"-Xswiftc",
|
|
52063
|
+
String(jobs)
|
|
52064
|
+
] : [],
|
|
52065
|
+
...incrementalPreview ? ["-Xswiftc", "-incremental", "-Xswiftc", "-enable-batch-mode"] : [],
|
|
52066
|
+
// the mirror finds a changed sdk header's readers in their
|
|
52067
|
+
// dependency files, which omit system headers by default
|
|
52068
|
+
...mirrorDistribution ? ["-Xswiftc", "-track-system-dependencies"] : [],
|
|
52069
|
+
// the link strips debug info, so none is generated (as for the framework).
|
|
52070
|
+
// keep -num-threads fixed across caller core caps so llbuild does not
|
|
52071
|
+
// rebuild every target when callers alternate --cores, and bound backend
|
|
52072
|
+
// fan-out under high -j.
|
|
52073
|
+
"-Xswiftc",
|
|
52074
|
+
"-gnone",
|
|
52075
|
+
...incrementalPreview ? [] : [
|
|
52076
|
+
"-Xswiftc",
|
|
52077
|
+
"-num-threads",
|
|
52078
|
+
"-Xswiftc",
|
|
52079
|
+
String(perFile ? 1 : Math.min(8, import_node_os16.default.availableParallelism()))
|
|
52080
|
+
],
|
|
52081
|
+
...swiftReproducibleBuildFlags([
|
|
52082
|
+
[import_node_path81.default.dirname(options2.toolchainBin), "toolchain"],
|
|
52083
|
+
[compileFrameworkRoot, "framework"],
|
|
52084
|
+
[root2, "build"],
|
|
52085
|
+
...forwarders
|
|
52086
|
+
]).flatMap((flag, index, flags) => {
|
|
52087
|
+
if (!nativeToolset || !flag.startsWith("-ffile-prefix-map="))
|
|
52088
|
+
return [flag];
|
|
52089
|
+
const toolchainDir = import_node_path81.default.dirname(options2.toolchainBin);
|
|
52090
|
+
let mapped = flag;
|
|
52091
|
+
for (const [dir, target] of [
|
|
52092
|
+
[root2, "/peach/build"],
|
|
52093
|
+
[compileFrameworkRoot, "/peach/framework"],
|
|
52094
|
+
[(0, import_node_fs79.realpathSync)(compileFrameworkRoot), "/peach/framework"],
|
|
52095
|
+
[toolchainDir, "/peach/toolchain"],
|
|
52096
|
+
[(0, import_node_fs79.realpathSync)(toolchainDir), "/peach/toolchain"]
|
|
52097
|
+
]) {
|
|
52098
|
+
mapped = mapped.replaceAll(dir, target);
|
|
52099
|
+
}
|
|
52100
|
+
const [, from, to] = /^-ffile-prefix-map=([^=]+)=(.+)$/.exec(mapped) ?? [];
|
|
52101
|
+
const tool = flags[index - 1];
|
|
52102
|
+
return mapped !== flag && from !== to ? [flag, tool, mapped] : [flag];
|
|
52103
|
+
}),
|
|
52104
|
+
...macroPlugins.libraries.flatMap((plugin) => [
|
|
52105
|
+
"-Xswiftc",
|
|
52106
|
+
"-load-plugin-library",
|
|
52107
|
+
"-Xswiftc",
|
|
52108
|
+
plugin
|
|
52109
|
+
]),
|
|
52110
|
+
...macroPlugins.executables.flatMap((plugin) => [
|
|
52111
|
+
"-Xswiftc",
|
|
52112
|
+
"-load-plugin-executable",
|
|
52113
|
+
"-Xswiftc",
|
|
52114
|
+
`${plugin}#ExpoModulesMacros`
|
|
52115
|
+
])
|
|
52116
|
+
];
|
|
52117
|
+
const linked = builtArtifact(layout3);
|
|
52118
|
+
(0, import_node_fs79.rmSync)(import_node_path81.default.join(root2, ".peach-link.rsp"), { force: true });
|
|
52119
|
+
if (options2.linkOnly || (0, import_node_fs79.existsSync)(linked) && (0, import_node_fs79.statSync)(linked).size <= 8)
|
|
52120
|
+
(0, import_node_fs79.rmSync)(linked, { force: true });
|
|
52121
|
+
stage("compiling and linking Swift modules");
|
|
52122
|
+
const frameworkInterfaces = /* @__PURE__ */ new Map();
|
|
52123
|
+
const sdkFrameworks = import_node_path81.default.join(
|
|
52124
|
+
swiftSdkPaths(frameworkRoot, options2.toolchainBin).darwin,
|
|
52125
|
+
"System/Library/Frameworks"
|
|
52126
|
+
);
|
|
52127
|
+
const generatedInterface = (source) => withoutImportedSdkEnumForwards(
|
|
52128
|
+
clangInterfaceHeader((0, import_node_fs79.readFileSync)(source, "utf8"), frameworkRoot),
|
|
52129
|
+
sdkObjCDeclarationOwners(sdkFrameworks)
|
|
52130
|
+
);
|
|
52131
|
+
const nativeDeclarations = /* @__PURE__ */ new Map();
|
|
52132
|
+
const nativeHeaders = Object.entries(input.files).filter(([name3]) => name3.endsWith(".h") && !name3.endsWith("-Swift.h")).map(([, source]) => source);
|
|
52133
|
+
for (const [file, contents2] of Object.entries(input.files)) {
|
|
52134
|
+
if (!file.endsWith(".modulemap")) continue;
|
|
52135
|
+
const name3 = moduleMapName(contents2);
|
|
52136
|
+
const umbrella = /\bumbrella\s+header\s+"([^"]+)"/.exec(contents2)?.[1];
|
|
52137
|
+
if (!name3 || !umbrella) continue;
|
|
52138
|
+
const header = input.files[import_node_path81.default.posix.join(import_node_path81.default.posix.dirname(file), umbrella)];
|
|
52139
|
+
if (header === void 0) continue;
|
|
52140
|
+
const included = new Set(
|
|
52141
|
+
[
|
|
52142
|
+
...header.matchAll(/^\s*#\s*(?:import|include)\s*[<"]([^">]+)[">]/gm)
|
|
52143
|
+
].map((match) => import_node_path81.default.posix.basename(match[1]))
|
|
51840
52144
|
);
|
|
51841
|
-
const
|
|
51842
|
-
|
|
51843
|
-
|
|
51844
|
-
|
|
51845
|
-
|
|
51846
|
-
|
|
51847
|
-
|
|
51848
|
-
|
|
51849
|
-
|
|
51850
|
-
|
|
51851
|
-
|
|
51852
|
-
|
|
51853
|
-
|
|
51854
|
-
|
|
51855
|
-
|
|
51856
|
-
"done",
|
|
51857
|
-
'case "$target/$compile" in',
|
|
51858
|
-
" *-*-linux*/1)",
|
|
51859
|
-
' case ",$PEACH_SWIFT_HOST_MACROS," in',
|
|
51860
|
-
' *",$module,"*) set -- "$@" -Xfrontend -import-module -Xfrontend Foundation ;;',
|
|
51861
|
-
" esac ;;",
|
|
51862
|
-
"esac",
|
|
51863
|
-
'exec "$PEACH_SWIFTC" "$@"',
|
|
51864
|
-
""
|
|
51865
|
-
].join("\n")
|
|
51866
|
-
);
|
|
51867
|
-
(0, import_node_fs79.chmodSync)(swiftc, 493);
|
|
51868
|
-
compiler.SWIFT_EXEC = swiftc;
|
|
51869
|
-
compiler.PEACH_SWIFT_HOST_MACROS = packageHostMacros.join(",");
|
|
51870
|
-
compiler.PEACH_SWIFTC = import_node_path81.default.join(options2.toolchainBin, "swiftc");
|
|
52145
|
+
const declarations = nativeDeclarations.get(name3) ?? /* @__PURE__ */ new Set();
|
|
52146
|
+
for (const declaration of swiftInterfaceDeclarations(header))
|
|
52147
|
+
declarations.add(declaration);
|
|
52148
|
+
for (const [candidate, source] of Object.entries(input.files))
|
|
52149
|
+
if (included.has(import_node_path81.default.posix.basename(candidate)))
|
|
52150
|
+
for (const declaration of swiftInterfaceDeclarations(source))
|
|
52151
|
+
declarations.add(declaration);
|
|
52152
|
+
nativeDeclarations.set(name3, declarations);
|
|
52153
|
+
}
|
|
52154
|
+
const frameworkInterface = (name3) => {
|
|
52155
|
+
if (frameworkInterfaces.has(name3)) return frameworkInterfaces.get(name3);
|
|
52156
|
+
const source = distribution ? import_node_path81.default.join(frameworkRoot, "modules", `${name3}-Swift.h`) : prebuilt.objcHeaders.get(name3);
|
|
52157
|
+
if (!source || !(0, import_node_fs79.existsSync)(source)) {
|
|
52158
|
+
frameworkInterfaces.set(name3, null);
|
|
52159
|
+
return null;
|
|
51871
52160
|
}
|
|
51872
|
-
const
|
|
51873
|
-
const
|
|
51874
|
-
|
|
51875
|
-
|
|
51876
|
-
|
|
51877
|
-
|
|
51878
|
-
|
|
51879
|
-
|
|
51880
|
-
|
|
51881
|
-
|
|
51882
|
-
|
|
51883
|
-
|
|
51884
|
-
|
|
51885
|
-
|
|
51886
|
-
|
|
51887
|
-
|
|
51888
|
-
|
|
51889
|
-
|
|
52161
|
+
const headers = import_node_path81.default.join(sdkFrameworks, `${name3}.framework/Headers`);
|
|
52162
|
+
const declared = /* @__PURE__ */ new Set();
|
|
52163
|
+
if ((0, import_node_fs79.existsSync)(headers)) {
|
|
52164
|
+
for (const file of (0, import_node_fs79.readdirSync)(headers, {
|
|
52165
|
+
recursive: true,
|
|
52166
|
+
encoding: "utf8"
|
|
52167
|
+
}))
|
|
52168
|
+
if (file.endsWith(".h"))
|
|
52169
|
+
for (const name4 of swiftInterfaceDeclarations(
|
|
52170
|
+
(0, import_node_fs79.readFileSync)(import_node_path81.default.join(headers, file), "utf8")
|
|
52171
|
+
))
|
|
52172
|
+
declared.add(name4);
|
|
52173
|
+
}
|
|
52174
|
+
for (const declaration of nativeDeclarations.get(name3) ?? [])
|
|
52175
|
+
declared.add(declaration);
|
|
52176
|
+
const own2 = withoutSwiftDeclarations(
|
|
52177
|
+
generatedInterface(source),
|
|
52178
|
+
declared,
|
|
52179
|
+
nativeDeclarations.has(name3) ? `@import ${name3};` : `#import <${name3}/${name3}.h>`
|
|
51890
52180
|
);
|
|
51891
|
-
const
|
|
51892
|
-
|
|
51893
|
-
|
|
51894
|
-
|
|
51895
|
-
|
|
51896
|
-
|
|
51897
|
-
|
|
51898
|
-
|
|
51899
|
-
|
|
52181
|
+
const owners = sdkObjCDeclarationOwners(sdkFrameworks);
|
|
52182
|
+
const foreign = /* @__PURE__ */ new Map();
|
|
52183
|
+
for (const declaration of [
|
|
52184
|
+
...swiftInterfaceDeclarations(own2),
|
|
52185
|
+
...objcEnumerations(own2),
|
|
52186
|
+
...[...own2.matchAll(/^\s*SWIFT_EXTERN\b[^(\n]*?\b(\w+)\s*\(/gm)].map(
|
|
52187
|
+
(match) => match[1]
|
|
52188
|
+
)
|
|
52189
|
+
]) {
|
|
52190
|
+
const owner = owners.get(declaration);
|
|
52191
|
+
if (owner && owner !== name3) foreign.set(declaration, owner);
|
|
51900
52192
|
}
|
|
51901
|
-
const
|
|
51902
|
-
|
|
51903
|
-
|
|
51904
|
-
|
|
51905
|
-
|
|
51906
|
-
|
|
51907
|
-
"
|
|
51908
|
-
|
|
51909
|
-
|
|
51910
|
-
|
|
51911
|
-
|
|
51912
|
-
|
|
51913
|
-
|
|
51914
|
-
|
|
51915
|
-
|
|
51916
|
-
sdk2,
|
|
51917
|
-
...preparation.targetToolset ? ["--toolset", import_node_path81.default.join(root, ".peach-target-toolset.json")] : [],
|
|
51918
|
-
"-c",
|
|
51919
|
-
"release",
|
|
51920
|
-
...input.unoptimized ? ["-Xswiftc", "-Onone"] : [],
|
|
51921
|
-
...perFile ? [
|
|
51922
|
-
"-Xswiftc",
|
|
51923
|
-
"-no-whole-module-optimization",
|
|
51924
|
-
"-Xswiftc",
|
|
51925
|
-
"-j",
|
|
51926
|
-
"-Xswiftc",
|
|
51927
|
-
String(jobs)
|
|
51928
|
-
] : [],
|
|
51929
|
-
...incrementalPreview ? ["-Xswiftc", "-incremental", "-Xswiftc", "-enable-batch-mode"] : [],
|
|
51930
|
-
// the mirror finds a changed sdk header's readers in their
|
|
51931
|
-
// dependency files, which omit system headers by default
|
|
51932
|
-
...mirrorDistribution ? ["-Xswiftc", "-track-system-dependencies"] : [],
|
|
51933
|
-
// the link strips debug info, so none is generated (as for the framework).
|
|
51934
|
-
// keep -num-threads fixed across caller core caps so llbuild does not
|
|
51935
|
-
// rebuild every target when callers alternate --cores, and bound backend
|
|
51936
|
-
// fan-out under high -j.
|
|
51937
|
-
"-Xswiftc",
|
|
51938
|
-
"-gnone",
|
|
51939
|
-
...incrementalPreview ? [] : [
|
|
51940
|
-
"-Xswiftc",
|
|
51941
|
-
"-num-threads",
|
|
51942
|
-
"-Xswiftc",
|
|
51943
|
-
String(perFile ? 1 : Math.min(8, import_node_os16.default.availableParallelism()))
|
|
51944
|
-
],
|
|
51945
|
-
...swiftReproducibleBuildFlags([
|
|
51946
|
-
[import_node_path81.default.dirname(options2.toolchainBin), "toolchain"],
|
|
51947
|
-
[compileFrameworkRoot, "framework"],
|
|
51948
|
-
[root, "build"],
|
|
51949
|
-
...forwarders
|
|
51950
|
-
]).flatMap((flag, index, flags) => {
|
|
51951
|
-
if (!nativeToolset || !flag.startsWith("-ffile-prefix-map="))
|
|
51952
|
-
return [flag];
|
|
51953
|
-
const toolchainDir = import_node_path81.default.dirname(options2.toolchainBin);
|
|
51954
|
-
let mapped = flag;
|
|
51955
|
-
for (const [dir, target] of [
|
|
51956
|
-
[root, "/peach/build"],
|
|
51957
|
-
[compileFrameworkRoot, "/peach/framework"],
|
|
51958
|
-
[(0, import_node_fs79.realpathSync)(compileFrameworkRoot), "/peach/framework"],
|
|
51959
|
-
[toolchainDir, "/peach/toolchain"],
|
|
51960
|
-
[(0, import_node_fs79.realpathSync)(toolchainDir), "/peach/toolchain"]
|
|
51961
|
-
]) {
|
|
51962
|
-
mapped = mapped.replaceAll(dir, target);
|
|
51963
|
-
}
|
|
51964
|
-
const [, from, to] = /^-ffile-prefix-map=([^=]+)=(.+)$/.exec(mapped) ?? [];
|
|
51965
|
-
const tool = flags[index - 1];
|
|
51966
|
-
return mapped !== flag && from !== to ? [flag, tool, mapped] : [flag];
|
|
51967
|
-
}),
|
|
51968
|
-
...macroPlugins.libraries.flatMap((plugin) => [
|
|
51969
|
-
"-Xswiftc",
|
|
51970
|
-
"-load-plugin-library",
|
|
51971
|
-
"-Xswiftc",
|
|
51972
|
-
plugin
|
|
51973
|
-
]),
|
|
51974
|
-
...macroPlugins.executables.flatMap((plugin) => [
|
|
51975
|
-
"-Xswiftc",
|
|
51976
|
-
"-load-plugin-executable",
|
|
51977
|
-
"-Xswiftc",
|
|
51978
|
-
`${plugin}#ExpoModulesMacros`
|
|
51979
|
-
])
|
|
51980
|
-
];
|
|
51981
|
-
const linked = builtArtifact(layout2);
|
|
51982
|
-
(0, import_node_fs79.rmSync)(import_node_path81.default.join(root, ".peach-link.rsp"), { force: true });
|
|
51983
|
-
if (options2.linkOnly || (0, import_node_fs79.existsSync)(linked) && (0, import_node_fs79.statSync)(linked).size <= 8)
|
|
51984
|
-
(0, import_node_fs79.rmSync)(linked, { force: true });
|
|
51985
|
-
report("compiling and linking Swift modules");
|
|
51986
|
-
const frameworkInterfaces = /* @__PURE__ */ new Map();
|
|
51987
|
-
const sdkFrameworks = import_node_path81.default.join(
|
|
51988
|
-
swiftSdkPaths(frameworkRoot, options2.toolchainBin).darwin,
|
|
51989
|
-
"System/Library/Frameworks"
|
|
52193
|
+
const header = foreign.size ? withoutSwiftDeclarations(
|
|
52194
|
+
own2,
|
|
52195
|
+
new Set(foreign.keys()),
|
|
52196
|
+
[...new Set(foreign.values())].map((owner) => `#import <${owner}/${owner}.h>`).join("\n")
|
|
52197
|
+
) : own2;
|
|
52198
|
+
const value = {
|
|
52199
|
+
file: import_node_path81.default.join(root2, ".build/peach-framework-objc", `${name3}-Swift.h`),
|
|
52200
|
+
header,
|
|
52201
|
+
module: (0, import_node_fs79.existsSync)(headers)
|
|
52202
|
+
};
|
|
52203
|
+
frameworkInterfaces.set(name3, value);
|
|
52204
|
+
writeBuildFile(
|
|
52205
|
+
value.file,
|
|
52206
|
+
((0, import_node_fs79.existsSync)(import_node_path81.default.join(headers, `${name3}.h`)) ? `#import <${name3}/${name3}.h>
|
|
52207
|
+
` : "") + swiftHeaderWithSuperclassImports(header, frameworkInterface)
|
|
51990
52208
|
);
|
|
51991
|
-
|
|
51992
|
-
|
|
51993
|
-
|
|
52209
|
+
return value;
|
|
52210
|
+
};
|
|
52211
|
+
const headerPaths = (producer) => {
|
|
52212
|
+
const stem2 = import_node_path81.default.join(
|
|
52213
|
+
root2,
|
|
52214
|
+
".build",
|
|
52215
|
+
"peach-cxx-headers",
|
|
52216
|
+
`${producer}-Swift`
|
|
51994
52217
|
);
|
|
51995
|
-
|
|
51996
|
-
|
|
51997
|
-
|
|
51998
|
-
|
|
51999
|
-
|
|
52000
|
-
|
|
52001
|
-
|
|
52002
|
-
|
|
52003
|
-
|
|
52004
|
-
|
|
52005
|
-
|
|
52006
|
-
|
|
52007
|
-
|
|
52008
|
-
|
|
52009
|
-
|
|
52010
|
-
|
|
52011
|
-
|
|
52012
|
-
|
|
52013
|
-
|
|
52014
|
-
|
|
52015
|
-
|
|
52016
|
-
|
|
52017
|
-
|
|
52018
|
-
|
|
52019
|
-
|
|
52020
|
-
|
|
52021
|
-
|
|
52022
|
-
|
|
52023
|
-
|
|
52024
|
-
}
|
|
52025
|
-
|
|
52026
|
-
|
|
52027
|
-
|
|
52028
|
-
|
|
52029
|
-
|
|
52030
|
-
|
|
52031
|
-
|
|
52032
|
-
|
|
52033
|
-
|
|
52034
|
-
|
|
52035
|
-
|
|
52036
|
-
|
|
52037
|
-
|
|
52038
|
-
|
|
52039
|
-
|
|
52040
|
-
|
|
52041
|
-
|
|
52042
|
-
|
|
52043
|
-
nativeDeclarations.has(name3) ? `@import ${name3};` : `#import <${name3}/${name3}.h>`
|
|
52044
|
-
);
|
|
52045
|
-
const owners = sdkObjCDeclarationOwners(sdkFrameworks);
|
|
52046
|
-
const foreign = /* @__PURE__ */ new Map();
|
|
52047
|
-
for (const declaration of [
|
|
52048
|
-
...swiftInterfaceDeclarations(own2),
|
|
52049
|
-
...objcEnumerations(own2),
|
|
52050
|
-
...[...own2.matchAll(/^\s*SWIFT_EXTERN\b[^(\n]*?\b(\w+)\s*\(/gm)].map(
|
|
52051
|
-
(match) => match[1]
|
|
52052
|
-
)
|
|
52053
|
-
]) {
|
|
52054
|
-
const owner = owners.get(declaration);
|
|
52055
|
-
if (owner && owner !== name3) foreign.set(declaration, owner);
|
|
52218
|
+
return { producer, original: `${stem2}.original.h`, emitted: `${stem2}.h` };
|
|
52219
|
+
};
|
|
52220
|
+
const publishHeader = ({
|
|
52221
|
+
producer,
|
|
52222
|
+
original,
|
|
52223
|
+
emitted
|
|
52224
|
+
}) => {
|
|
52225
|
+
const generated = generatedInterface(original);
|
|
52226
|
+
writeBuildFile(
|
|
52227
|
+
emitted,
|
|
52228
|
+
withoutSwiftDeclarations(
|
|
52229
|
+
swiftHeaderWithSuperclassImports(generated, frameworkInterface),
|
|
52230
|
+
/* @__PURE__ */ new Set([
|
|
52231
|
+
...preparation.nativeHeaderDeclarations[producer] ?? [],
|
|
52232
|
+
...nativelyDeclaredFunctions(generated, nativeHeaders)
|
|
52233
|
+
]),
|
|
52234
|
+
`#import <${producer}/${producer}.h>`
|
|
52235
|
+
)
|
|
52236
|
+
);
|
|
52237
|
+
};
|
|
52238
|
+
const recipe2 = inputHash.copy().update(
|
|
52239
|
+
distribution ? swiftCompileSurfaceDigest(frameworkRoot) : moduleDigest
|
|
52240
|
+
).update((0, import_node_fs79.readFileSync)(import_node_path81.default.join(root2, "Package.swift"))).update(JSON.stringify(buildArgs)).digest("hex");
|
|
52241
|
+
const runApp = async (compiler2) => {
|
|
52242
|
+
const optionsWithCompiler = compiler2 ? { ...appOptions, env: { ...appOptions.env, ...compiler2 } } : appOptions;
|
|
52243
|
+
const stages = [
|
|
52244
|
+
...(preparation.nativePrerequisiteTargets ?? []).map((target) => ({
|
|
52245
|
+
target,
|
|
52246
|
+
producers: []
|
|
52247
|
+
})),
|
|
52248
|
+
...preparation.headerBuilds,
|
|
52249
|
+
...(preparation.nativeProductTargets ?? []).map((target) => ({
|
|
52250
|
+
target,
|
|
52251
|
+
producers: []
|
|
52252
|
+
}))
|
|
52253
|
+
];
|
|
52254
|
+
const checkpoints = import_node_path81.default.join(root2, ".build", "peach-product-checkpoints");
|
|
52255
|
+
const buildDbExists = (0, import_node_fs79.existsSync)(import_node_path81.default.join(root2, ".build", "build.db"));
|
|
52256
|
+
const releaseDir = import_node_path81.default.dirname(linked);
|
|
52257
|
+
for (const { target, producers } of stages) {
|
|
52258
|
+
if (!options2.project && producers.length === 0 && buildDbExists) {
|
|
52259
|
+
const expectedObjects = preparation.nativeStageObjects.get(target);
|
|
52260
|
+
if (expectedObjects && expectedObjects.length > 0 && expectedObjects.every(
|
|
52261
|
+
(relative6) => (0, import_node_fs79.statSync)(import_node_path81.default.join(releaseDir, relative6), {
|
|
52262
|
+
throwIfNoEntry: false
|
|
52263
|
+
})?.isFile()
|
|
52264
|
+
))
|
|
52265
|
+
continue;
|
|
52056
52266
|
}
|
|
52057
|
-
const
|
|
52058
|
-
|
|
52059
|
-
|
|
52060
|
-
[...new Set(foreign.values())].map((owner) => `#import <${owner}/${owner}.h>`).join("\n")
|
|
52061
|
-
) : own2;
|
|
52062
|
-
const value = {
|
|
52063
|
-
file: import_node_path81.default.join(root, ".build/peach-framework-objc", `${name3}-Swift.h`),
|
|
52064
|
-
header,
|
|
52065
|
-
module: (0, import_node_fs79.existsSync)(headers)
|
|
52066
|
-
};
|
|
52067
|
-
frameworkInterfaces.set(name3, value);
|
|
52068
|
-
writeBuildFile(
|
|
52069
|
-
value.file,
|
|
52070
|
-
((0, import_node_fs79.existsSync)(import_node_path81.default.join(headers, `${name3}.h`)) ? `#import <${name3}/${name3}.h>
|
|
52071
|
-
` : "") + swiftHeaderWithSuperclassImports(header, frameworkInterface)
|
|
52267
|
+
const receipt = import_node_path81.default.join(
|
|
52268
|
+
checkpoints,
|
|
52269
|
+
(0, import_node_crypto47.createHash)("sha256").update(target).digest("hex")
|
|
52072
52270
|
);
|
|
52073
|
-
|
|
52074
|
-
|
|
52075
|
-
|
|
52076
|
-
const
|
|
52077
|
-
|
|
52078
|
-
|
|
52079
|
-
|
|
52080
|
-
|
|
52081
|
-
|
|
52082
|
-
|
|
52083
|
-
};
|
|
52084
|
-
const publishHeader = ({
|
|
52085
|
-
producer,
|
|
52086
|
-
original,
|
|
52087
|
-
emitted
|
|
52088
|
-
}) => {
|
|
52089
|
-
const generated = generatedInterface(original);
|
|
52090
|
-
writeBuildFile(
|
|
52091
|
-
emitted,
|
|
52092
|
-
withoutSwiftDeclarations(
|
|
52093
|
-
swiftHeaderWithSuperclassImports(generated, frameworkInterface),
|
|
52094
|
-
/* @__PURE__ */ new Set([
|
|
52095
|
-
...preparation.nativeHeaderDeclarations[producer] ?? [],
|
|
52096
|
-
...nativelyDeclaredFunctions(generated, nativeHeaders)
|
|
52097
|
-
]),
|
|
52098
|
-
`#import <${producer}/${producer}.h>`
|
|
52099
|
-
)
|
|
52100
|
-
);
|
|
52101
|
-
};
|
|
52102
|
-
const recipe2 = inputHash.copy().update(
|
|
52103
|
-
distribution ? swiftCompileSurfaceDigest(frameworkRoot) : moduleDigest
|
|
52104
|
-
).update((0, import_node_fs79.readFileSync)(import_node_path81.default.join(root, "Package.swift"))).update(JSON.stringify(buildArgs)).digest("hex");
|
|
52105
|
-
const runApp = async (compiler2) => {
|
|
52106
|
-
const optionsWithCompiler = compiler2 ? { ...appOptions, env: { ...appOptions.env, ...compiler2 } } : appOptions;
|
|
52107
|
-
const stages = [
|
|
52108
|
-
...(preparation.nativePrerequisiteTargets ?? []).map((target) => ({
|
|
52109
|
-
target,
|
|
52110
|
-
producers: []
|
|
52111
|
-
})),
|
|
52112
|
-
...preparation.headerBuilds,
|
|
52113
|
-
...(preparation.nativeProductTargets ?? []).map((target) => ({
|
|
52114
|
-
target,
|
|
52115
|
-
producers: []
|
|
52116
|
-
}))
|
|
52117
|
-
];
|
|
52118
|
-
const checkpoints = import_node_path81.default.join(root, ".build", "peach-product-checkpoints");
|
|
52119
|
-
const buildDbExists = (0, import_node_fs79.existsSync)(import_node_path81.default.join(root, ".build", "build.db"));
|
|
52120
|
-
const releaseDir = import_node_path81.default.dirname(linked);
|
|
52121
|
-
for (const { target, producers } of stages) {
|
|
52122
|
-
if (!options2.project && producers.length === 0 && buildDbExists) {
|
|
52123
|
-
const expectedObjects = preparation.nativeStageObjects.get(target);
|
|
52124
|
-
if (expectedObjects && expectedObjects.length > 0 && expectedObjects.every(
|
|
52125
|
-
(relative6) => (0, import_node_fs79.statSync)(import_node_path81.default.join(releaseDir, relative6), {
|
|
52126
|
-
throwIfNoEntry: false
|
|
52127
|
-
})?.isFile()
|
|
52128
|
-
))
|
|
52129
|
-
continue;
|
|
52130
|
-
}
|
|
52131
|
-
const receipt = import_node_path81.default.join(
|
|
52132
|
-
checkpoints,
|
|
52133
|
-
(0, import_node_crypto47.createHash)("sha256").update(target).digest("hex")
|
|
52134
|
-
);
|
|
52135
|
-
const headers = producers.map(headerPaths);
|
|
52136
|
-
for (const header of headers)
|
|
52137
|
-
if ((0, import_node_fs79.existsSync)(header.original)) publishHeader(header);
|
|
52138
|
-
const fingerprint = () => {
|
|
52139
|
-
const digest3 = (0, import_node_crypto47.createHash)("sha256").update(recipe2);
|
|
52140
|
-
for (const { original, emitted } of headers) {
|
|
52141
|
-
if (!(0, import_node_fs79.existsSync)(original) || !(0, import_node_fs79.existsSync)(emitted)) return;
|
|
52142
|
-
digest3.update(
|
|
52143
|
-
(0, import_node_crypto47.createHash)("sha256").update((0, import_node_fs79.readFileSync)(emitted)).digest()
|
|
52144
|
-
);
|
|
52145
|
-
}
|
|
52146
|
-
return digest3.digest("hex");
|
|
52147
|
-
};
|
|
52148
|
-
if (!options2.project && (0, import_node_fs79.existsSync)(receipt) && (0, import_node_fs79.readFileSync)(receipt, "utf8") === fingerprint())
|
|
52149
|
-
continue;
|
|
52150
|
-
if (!options2.project) (0, import_node_fs79.rmSync)(receipt, { force: true });
|
|
52151
|
-
for (const header of headers) {
|
|
52152
|
-
if (!(0, import_node_fs79.existsSync)(header.original))
|
|
52153
|
-
(0, import_node_fs79.rmSync)(
|
|
52154
|
-
import_node_path81.default.join(
|
|
52155
|
-
import_node_path81.default.dirname(linked),
|
|
52156
|
-
"Modules",
|
|
52157
|
-
`${swiftTargetModuleName(header.producer)}.swiftmodule`
|
|
52158
|
-
),
|
|
52159
|
-
{ force: true }
|
|
52160
|
-
);
|
|
52161
|
-
}
|
|
52162
|
-
await runCompiler(
|
|
52163
|
-
swift,
|
|
52164
|
-
[...buildArgs, "--target", target],
|
|
52165
|
-
optionsWithCompiler,
|
|
52166
|
-
/^(?:\[swift-prebuilt\]|\[\d+\/\d+\] )/,
|
|
52167
|
-
SWIFTPM_NOISE
|
|
52168
|
-
);
|
|
52169
|
-
if (!compiler2) for (const header of headers) publishHeader(header);
|
|
52170
|
-
if (!options2.project) {
|
|
52171
|
-
const checkpoint = fingerprint();
|
|
52172
|
-
if (checkpoint === void 0)
|
|
52173
|
-
throw new Error(`missing Swift headers after building ${target}`);
|
|
52174
|
-
(0, import_node_fs79.mkdirSync)(checkpoints, { recursive: true });
|
|
52175
|
-
(0, import_node_fs79.writeFileSync)(`${receipt}.partial`, checkpoint);
|
|
52176
|
-
(0, import_node_fs79.renameSync)(`${receipt}.partial`, receipt);
|
|
52271
|
+
const headers = producers.map(headerPaths);
|
|
52272
|
+
for (const header of headers)
|
|
52273
|
+
if ((0, import_node_fs79.existsSync)(header.original)) publishHeader(header);
|
|
52274
|
+
const fingerprint = () => {
|
|
52275
|
+
const digest3 = (0, import_node_crypto47.createHash)("sha256").update(recipe2);
|
|
52276
|
+
for (const { original, emitted } of headers) {
|
|
52277
|
+
if (!(0, import_node_fs79.existsSync)(original) || !(0, import_node_fs79.existsSync)(emitted)) return;
|
|
52278
|
+
digest3.update(
|
|
52279
|
+
(0, import_node_crypto47.createHash)("sha256").update((0, import_node_fs79.readFileSync)(emitted)).digest()
|
|
52280
|
+
);
|
|
52177
52281
|
}
|
|
52282
|
+
return digest3.digest("hex");
|
|
52283
|
+
};
|
|
52284
|
+
if (!options2.project && (0, import_node_fs79.existsSync)(receipt) && (0, import_node_fs79.readFileSync)(receipt, "utf8") === fingerprint())
|
|
52285
|
+
continue;
|
|
52286
|
+
if (!options2.project) (0, import_node_fs79.rmSync)(receipt, { force: true });
|
|
52287
|
+
for (const header of headers) {
|
|
52288
|
+
if (!(0, import_node_fs79.existsSync)(header.original))
|
|
52289
|
+
(0, import_node_fs79.rmSync)(
|
|
52290
|
+
import_node_path81.default.join(
|
|
52291
|
+
import_node_path81.default.dirname(linked),
|
|
52292
|
+
"Modules",
|
|
52293
|
+
`${swiftTargetModuleName(header.producer)}.swiftmodule`
|
|
52294
|
+
),
|
|
52295
|
+
{ force: true }
|
|
52296
|
+
);
|
|
52178
52297
|
}
|
|
52179
52298
|
await runCompiler(
|
|
52180
52299
|
swift,
|
|
52181
|
-
buildArgs,
|
|
52300
|
+
[...buildArgs, "--target", target],
|
|
52182
52301
|
optionsWithCompiler,
|
|
52183
|
-
|
|
52302
|
+
/^(?:\[swift-prebuilt\]|\[\d+\/\d+\] )/,
|
|
52184
52303
|
SWIFTPM_NOISE
|
|
52185
52304
|
);
|
|
52186
|
-
|
|
52187
|
-
|
|
52188
|
-
|
|
52189
|
-
|
|
52190
|
-
|
|
52191
|
-
|
|
52192
|
-
|
|
52193
|
-
|
|
52194
|
-
|
|
52195
|
-
|
|
52196
|
-
|
|
52197
|
-
|
|
52198
|
-
|
|
52199
|
-
|
|
52200
|
-
|
|
52201
|
-
|
|
52202
|
-
|
|
52203
|
-
|
|
52204
|
-
|
|
52205
|
-
|
|
52206
|
-
|
|
52207
|
-
|
|
52208
|
-
|
|
52209
|
-
|
|
52210
|
-
|
|
52211
|
-
|
|
52212
|
-
|
|
52213
|
-
|
|
52214
|
-
|
|
52215
|
-
|
|
52216
|
-
|
|
52217
|
-
|
|
52218
|
-
|
|
52219
|
-
|
|
52220
|
-
|
|
52221
|
-
|
|
52222
|
-
|
|
52223
|
-
|
|
52224
|
-
|
|
52225
|
-
|
|
52226
|
-
|
|
52227
|
-
|
|
52228
|
-
|
|
52229
|
-
|
|
52230
|
-
|
|
52305
|
+
if (!compiler2) for (const header of headers) publishHeader(header);
|
|
52306
|
+
if (!options2.project) {
|
|
52307
|
+
const checkpoint = fingerprint();
|
|
52308
|
+
if (checkpoint === void 0)
|
|
52309
|
+
throw new Error(`missing Swift headers after building ${target}`);
|
|
52310
|
+
(0, import_node_fs79.mkdirSync)(checkpoints, { recursive: true });
|
|
52311
|
+
(0, import_node_fs79.writeFileSync)(`${receipt}.partial`, checkpoint);
|
|
52312
|
+
(0, import_node_fs79.renameSync)(`${receipt}.partial`, receipt);
|
|
52313
|
+
}
|
|
52314
|
+
}
|
|
52315
|
+
await runCompiler(
|
|
52316
|
+
swift,
|
|
52317
|
+
buildArgs,
|
|
52318
|
+
optionsWithCompiler,
|
|
52319
|
+
SWIFTPM_PROGRESS,
|
|
52320
|
+
SWIFTPM_NOISE
|
|
52321
|
+
);
|
|
52322
|
+
};
|
|
52323
|
+
const compileApp = () => preparation.headerCompiler ? withSwiftHeaderCompiler(
|
|
52324
|
+
root2,
|
|
52325
|
+
options2.toolchainBin,
|
|
52326
|
+
recipe2,
|
|
52327
|
+
new Map(
|
|
52328
|
+
preparation.headerBuilds[0].producers.map((producer) => {
|
|
52329
|
+
const paths = headerPaths(producer);
|
|
52330
|
+
return [
|
|
52331
|
+
swiftTargetModuleName(producer),
|
|
52332
|
+
{
|
|
52333
|
+
header: paths.original,
|
|
52334
|
+
publish: () => publishHeader(paths)
|
|
52335
|
+
}
|
|
52336
|
+
];
|
|
52337
|
+
})
|
|
52338
|
+
),
|
|
52339
|
+
runApp
|
|
52340
|
+
) : runApp();
|
|
52341
|
+
try {
|
|
52342
|
+
if (temporaryDirectory) (0, import_node_fs79.mkdirSync)(temporaryDirectory, { recursive: true });
|
|
52343
|
+
await compileApp();
|
|
52344
|
+
} catch (error) {
|
|
52345
|
+
const output2 = outputOf(error);
|
|
52346
|
+
const moduleCache = import_node_path81.default.join(
|
|
52347
|
+
root2,
|
|
52348
|
+
".build",
|
|
52349
|
+
WASM_TRIPLE,
|
|
52350
|
+
"release",
|
|
52351
|
+
"ModuleCache"
|
|
52352
|
+
);
|
|
52353
|
+
if (output2.includes("was compiled with module cache path") && (0, import_node_fs79.existsSync)(moduleCache)) {
|
|
52354
|
+
(0, import_node_fs79.rmSync)(moduleCache, { recursive: true, force: true });
|
|
52355
|
+
try {
|
|
52356
|
+
await compileApp();
|
|
52357
|
+
} catch (retryError) {
|
|
52231
52358
|
throw new Error(
|
|
52232
|
-
[
|
|
52233
|
-
|
|
52234
|
-
|
|
52235
|
-
|
|
52359
|
+
[
|
|
52360
|
+
...unprepared,
|
|
52361
|
+
projectDiagnostic(outputOf(retryError), layout3, input.files)
|
|
52362
|
+
].join("\n"),
|
|
52363
|
+
{ cause: retryError }
|
|
52236
52364
|
);
|
|
52237
52365
|
}
|
|
52238
|
-
}
|
|
52239
|
-
if (temporaryDirectory)
|
|
52240
|
-
(0, import_node_fs79.rmSync)(temporaryDirectory, { recursive: true, force: true });
|
|
52241
|
-
if (options2.project) endSwiftProjectProcesses(options2.project);
|
|
52242
|
-
}
|
|
52243
|
-
if (unprepared.length) throw new Error(unprepared.join("\n"));
|
|
52244
|
-
if (!(0, import_node_fs79.existsSync)(linked)) {
|
|
52245
|
-
const binDir = import_node_path81.default.dirname(linked);
|
|
52246
|
-
const found2 = (0, import_node_fs79.existsSync)(binDir) ? (0, import_node_fs79.readdirSync)(binDir).filter((name3) => name3.endsWith(".wasm")).sort() : [];
|
|
52366
|
+
} else {
|
|
52247
52367
|
throw new Error(
|
|
52248
|
-
|
|
52368
|
+
[...unprepared, projectDiagnostic(output2, layout3, input.files)].join(
|
|
52369
|
+
"\n"
|
|
52370
|
+
),
|
|
52371
|
+
{ cause: error }
|
|
52249
52372
|
);
|
|
52250
52373
|
}
|
|
52251
|
-
|
|
52252
|
-
|
|
52253
|
-
(
|
|
52374
|
+
} finally {
|
|
52375
|
+
if (temporaryDirectory)
|
|
52376
|
+
(0, import_node_fs79.rmSync)(temporaryDirectory, { recursive: true, force: true });
|
|
52377
|
+
if (options2.project) endSwiftProjectProcesses(options2.project);
|
|
52378
|
+
}
|
|
52379
|
+
if (unprepared.length) throw new Error(unprepared.join("\n"));
|
|
52380
|
+
if (!(0, import_node_fs79.existsSync)(linked)) {
|
|
52381
|
+
const binDir = import_node_path81.default.dirname(linked);
|
|
52382
|
+
const found2 = (0, import_node_fs79.existsSync)(binDir) ? (0, import_node_fs79.readdirSync)(binDir).filter((name3) => name3.endsWith(".wasm")).sort() : [];
|
|
52383
|
+
throw new Error(
|
|
52384
|
+
`swift-compile: the build produced no ${import_node_path81.default.basename(linked)} (found: ${found2.join(", ") || "none"})`
|
|
52254
52385
|
);
|
|
52255
|
-
|
|
52256
|
-
|
|
52257
|
-
|
|
52258
|
-
|
|
52259
|
-
|
|
52260
|
-
|
|
52261
|
-
|
|
52262
|
-
|
|
52263
|
-
|
|
52264
|
-
|
|
52265
|
-
|
|
52266
|
-
|
|
52267
|
-
|
|
52268
|
-
|
|
52269
|
-
|
|
52270
|
-
|
|
52271
|
-
|
|
52272
|
-
const optimized = `${output}.optimized`;
|
|
52273
|
-
if (sdkImage && options2.project) (0, import_node_fs79.rmSync)(optimized, { force: true });
|
|
52274
|
-
let sdkAsset;
|
|
52275
|
-
if (guestGraph) {
|
|
52276
|
-
const binding = await compileGuestLink({
|
|
52277
|
-
graph: guestGraph,
|
|
52278
|
-
buildDirectory: root,
|
|
52279
|
-
releaseDirectory: import_node_path81.default.dirname(linked),
|
|
52280
|
-
moduleRoot: frameworkRoot,
|
|
52281
|
-
toolchainBin: options2.toolchainBin,
|
|
52282
|
-
swiftCompiler: preparation.headerCompiler ? import_node_path81.default.join(root, SWIFT_HEADER_COMPILER_WRAPPER) : compiler.SWIFT_EXEC ?? import_node_path81.default.join(options2.toolchainBin, "swiftc"),
|
|
52283
|
-
sysroot: swiftSdkPaths(frameworkRoot, options2.toolchainBin).sysroot,
|
|
52284
|
-
sdk: swiftModuleSdk(frameworkRoot),
|
|
52285
|
-
sdkImage,
|
|
52286
|
-
compilerDigest: compilerSourceDigest,
|
|
52287
|
-
project: options2.project && {
|
|
52288
|
-
...options2.project,
|
|
52289
|
-
env: { ...options2.project.env, ...projectProcess?.env }
|
|
52290
|
-
},
|
|
52291
|
-
staticClangTargets: input.staticClangTargets ?? [],
|
|
52292
|
-
resourceReferences,
|
|
52293
|
-
resourceBundles: input.resourceBundles ?? [],
|
|
52294
|
-
generatedOwners: preparation.generatedOwners,
|
|
52295
|
-
output,
|
|
52296
|
-
optimized,
|
|
52297
|
-
optimize: input.optimize === true,
|
|
52298
|
-
jobs: swiftBuildJobs()
|
|
52299
|
-
});
|
|
52300
|
-
if (sdkImage && binding)
|
|
52301
|
-
sdkAsset = { key: sdkImage.key, sha256: sdkImage.sha256, binding };
|
|
52302
|
-
} else if (sdkImage) {
|
|
52303
|
-
const { buildSwiftAppModule: buildSwiftAppModule2 } = await Promise.resolve().then(() => (init_swift_sdk_app_module(), swift_sdk_app_module_exports));
|
|
52304
|
-
const binding = await buildSwiftAppModule2({
|
|
52305
|
-
buildRoot: root,
|
|
52306
|
-
toolchainBin: options2.toolchainBin,
|
|
52307
|
-
sdk: sdkImage,
|
|
52308
|
-
output: optimized,
|
|
52309
|
-
optimize: input.optimize === true,
|
|
52310
|
-
project: options2.project && {
|
|
52311
|
-
...options2.project,
|
|
52312
|
-
env: { ...options2.project.env, ...projectProcess?.env },
|
|
52313
|
-
sdkRoot: import_node_path81.default.dirname(
|
|
52314
|
-
swiftSdkPaths(frameworkRoot, options2.toolchainBin).sysroot
|
|
52315
|
-
),
|
|
52316
|
-
linked: output
|
|
52317
|
-
}
|
|
52318
|
-
});
|
|
52319
|
-
sdkAsset = { key: sdkImage.key, sha256: sdkImage.sha256, binding };
|
|
52320
|
-
} else {
|
|
52321
|
-
const bytes = (0, import_node_fs79.readFileSync)(output);
|
|
52322
|
-
const ordered = orderObjCConstructors(bytes);
|
|
52323
|
-
if (ordered !== bytes) (0, import_node_fs79.writeFileSync)(output, ordered);
|
|
52324
|
-
await lowerWasm(output, optimized, { optimize: input.optimize === true });
|
|
52325
|
-
}
|
|
52326
|
-
if (!sdkImage)
|
|
52327
|
-
await runCompiler(
|
|
52328
|
-
import_node_path81.default.join(options2.toolchainBin, "llvm-objcopy"),
|
|
52329
|
-
["--remove-section=.swift1_autolink_entries", optimized],
|
|
52330
|
-
buildOptions
|
|
52331
|
-
);
|
|
52332
|
-
const artifact = {
|
|
52333
|
-
hash,
|
|
52334
|
-
bytes: (0, import_node_fs79.readFileSync)(optimized),
|
|
52335
|
-
icu: await icu,
|
|
52336
|
-
sdk: sdkAsset
|
|
52337
|
-
};
|
|
52338
|
-
if (artifact.bytes.length <= 8)
|
|
52386
|
+
}
|
|
52387
|
+
if (options2.project) removeProjectLinks(root2);
|
|
52388
|
+
const resourceReferences = Object.values(input.resources ?? {}).map(
|
|
52389
|
+
(value) => Buffer.from(value, "base64")
|
|
52390
|
+
);
|
|
52391
|
+
if (!guestGraph)
|
|
52392
|
+
pruneSwiftWasmLink(
|
|
52393
|
+
root2,
|
|
52394
|
+
options2.toolchainBin,
|
|
52395
|
+
prebuilt?.root ?? frameworkRoot,
|
|
52396
|
+
input.staticClangTargets,
|
|
52397
|
+
options2.project,
|
|
52398
|
+
void 0,
|
|
52399
|
+
resourceReferences
|
|
52400
|
+
);
|
|
52401
|
+
if (options2.linkOnly) {
|
|
52402
|
+
if ((0, import_node_fs79.statSync)(linked).size <= 8)
|
|
52339
52403
|
throw new Error("swift-compile: deferred linker produced no executable");
|
|
52340
|
-
|
|
52341
|
-
|
|
52342
|
-
report("compiled artifact verified");
|
|
52343
|
-
return retain(root, artifact);
|
|
52344
|
-
} finally {
|
|
52345
|
-
readHold?.release();
|
|
52404
|
+
stage("project link verified");
|
|
52405
|
+
return;
|
|
52346
52406
|
}
|
|
52347
|
-
|
|
52348
|
-
|
|
52349
|
-
|
|
52407
|
+
const output = options2.project ? projectOutputFile(root2, linked, options2.project) : linked;
|
|
52408
|
+
const optimized = `${output}.optimized`;
|
|
52409
|
+
if (sdkImage && options2.project) (0, import_node_fs79.rmSync)(optimized, { force: true });
|
|
52410
|
+
let sdkAsset;
|
|
52411
|
+
stage("linking the app image");
|
|
52412
|
+
if (guestGraph) {
|
|
52413
|
+
const binding = await compileGuestLink({
|
|
52414
|
+
graph: guestGraph,
|
|
52415
|
+
buildDirectory: root2,
|
|
52416
|
+
releaseDirectory: import_node_path81.default.dirname(linked),
|
|
52417
|
+
moduleRoot: frameworkRoot,
|
|
52418
|
+
toolchainBin: options2.toolchainBin,
|
|
52419
|
+
swiftCompiler: preparation.headerCompiler ? import_node_path81.default.join(root2, SWIFT_HEADER_COMPILER_WRAPPER) : compiler.SWIFT_EXEC ?? import_node_path81.default.join(options2.toolchainBin, "swiftc"),
|
|
52420
|
+
sysroot: swiftSdkPaths(frameworkRoot, options2.toolchainBin).sysroot,
|
|
52421
|
+
sdk: swiftModuleSdk(frameworkRoot),
|
|
52422
|
+
sdkImage,
|
|
52423
|
+
compilerDigest: compilerSourceDigest,
|
|
52424
|
+
project: options2.project && {
|
|
52425
|
+
...options2.project,
|
|
52426
|
+
env: { ...options2.project.env, ...projectProcess?.env }
|
|
52427
|
+
},
|
|
52428
|
+
staticClangTargets: input.staticClangTargets ?? [],
|
|
52429
|
+
resourceReferences,
|
|
52430
|
+
resourceBundles: input.resourceBundles ?? [],
|
|
52431
|
+
generatedOwners: preparation.generatedOwners,
|
|
52432
|
+
output,
|
|
52433
|
+
optimized,
|
|
52434
|
+
optimize: input.optimize === true,
|
|
52435
|
+
jobs: swiftBuildJobs(),
|
|
52436
|
+
onStage: stage
|
|
52437
|
+
});
|
|
52438
|
+
if (sdkImage && binding)
|
|
52439
|
+
sdkAsset = { key: sdkImage.key, sha256: sdkImage.sha256, binding };
|
|
52440
|
+
} else if (sdkImage) {
|
|
52441
|
+
const { buildSwiftAppModule: buildSwiftAppModule2 } = await Promise.resolve().then(() => (init_swift_sdk_app_module(), swift_sdk_app_module_exports));
|
|
52442
|
+
const binding = await buildSwiftAppModule2({
|
|
52443
|
+
buildRoot: root2,
|
|
52444
|
+
toolchainBin: options2.toolchainBin,
|
|
52445
|
+
sdk: sdkImage,
|
|
52446
|
+
output: optimized,
|
|
52447
|
+
optimize: input.optimize === true,
|
|
52448
|
+
project: options2.project && {
|
|
52449
|
+
...options2.project,
|
|
52450
|
+
env: { ...options2.project.env, ...projectProcess?.env },
|
|
52451
|
+
sdkRoot: import_node_path81.default.dirname(
|
|
52452
|
+
swiftSdkPaths(frameworkRoot, options2.toolchainBin).sysroot
|
|
52453
|
+
),
|
|
52454
|
+
linked: output
|
|
52455
|
+
}
|
|
52456
|
+
});
|
|
52457
|
+
sdkAsset = { key: sdkImage.key, sha256: sdkImage.sha256, binding };
|
|
52458
|
+
} else {
|
|
52459
|
+
const bytes = (0, import_node_fs79.readFileSync)(output);
|
|
52460
|
+
const ordered = orderObjCConstructors(bytes);
|
|
52461
|
+
if (ordered !== bytes) (0, import_node_fs79.writeFileSync)(output, ordered);
|
|
52462
|
+
stage("lowering the app image");
|
|
52463
|
+
await lowerWasm(output, optimized, { optimize: input.optimize === true });
|
|
52464
|
+
}
|
|
52465
|
+
if (!sdkImage)
|
|
52466
|
+
await runCompiler(
|
|
52467
|
+
import_node_path81.default.join(options2.toolchainBin, "llvm-objcopy"),
|
|
52468
|
+
["--remove-section=.swift1_autolink_entries", optimized],
|
|
52469
|
+
buildOptions
|
|
52470
|
+
);
|
|
52471
|
+
const artifact = {
|
|
52472
|
+
hash,
|
|
52473
|
+
bytes: (0, import_node_fs79.readFileSync)(optimized),
|
|
52474
|
+
icu: await icu,
|
|
52475
|
+
sdk: sdkAsset
|
|
52476
|
+
};
|
|
52477
|
+
if (artifact.bytes.length <= 8)
|
|
52478
|
+
throw new Error("swift-compile: deferred linker produced no executable");
|
|
52479
|
+
if (!options2.project) saveCompiledArtifact(root2, artifact);
|
|
52480
|
+
saveSharedArtifact(sharedRoot, artifact);
|
|
52481
|
+
stage("compiled artifact verified");
|
|
52482
|
+
return retain(baseRoot, artifact);
|
|
52483
|
+
} finally {
|
|
52484
|
+
readHold?.release();
|
|
52485
|
+
}
|
|
52486
|
+
});
|
|
52350
52487
|
});
|
|
52351
52488
|
},
|
|
52352
52489
|
options2.signal
|
|
52353
52490
|
);
|
|
52354
52491
|
}
|
|
52355
|
-
var import_node_child_process40, import_node_crypto47, import_node_fs79, 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;
|
|
52492
|
+
var import_node_child_process40, import_node_crypto47, import_node_fs79, 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;
|
|
52356
52493
|
var init_swift_compile = __esm({
|
|
52357
52494
|
"src/swift-compile.ts"() {
|
|
52358
52495
|
"use strict";
|
|
@@ -52623,7 +52760,7 @@ ${wasmThreadLinkFlags.map((flag) => ` "-Xlinker", ${JSON.stringify(flag
|
|
|
52623
52760
|
REACTOR_FLAG = '"-Xclang-linker", "-mexec-model=reactor",\n';
|
|
52624
52761
|
MULTI_MANIFEST_VERSION = 76;
|
|
52625
52762
|
SWIFT_HEADER_PRODUCTS_TARGET = "PeachHeaderProducts";
|
|
52626
|
-
compilerSourceDigest = true ? "
|
|
52763
|
+
compilerSourceDigest = true ? "203439fc20df8d328b0c245496fc6db90092265409adb61b593725e82ce837de" : swiftCompilerSourceDigest2(__sootsim_import_meta_dirname);
|
|
52627
52764
|
nativeCxxCompilerFlags = ["-fno-cxx-modules"];
|
|
52628
52765
|
MODULE_MAP_RESPONSE_FILE_RUN = 16;
|
|
52629
52766
|
cFlagArray = (flags) => JSON.stringify(withoutGlogModuleMap(flags));
|
|
@@ -53047,6 +53184,7 @@ ${wasmThreadLinkFlags.map((flag) => ` "-Xlinker", ${JSON.stringify(flag
|
|
|
53047
53184
|
retainedArtifacts = /* @__PURE__ */ new Map();
|
|
53048
53185
|
FRAMEWORK_LINK_TARGET = "PeachFrameworkLink";
|
|
53049
53186
|
frameworkProductsReceiptSchema = v6.object({
|
|
53187
|
+
root: v6.string(),
|
|
53050
53188
|
modules: v6.string(),
|
|
53051
53189
|
objects: v6.array(v6.string()),
|
|
53052
53190
|
lazyObjects: v6.array(v6.string()),
|
|
@@ -53063,6 +53201,9 @@ ${wasmThreadLinkFlags.map((flag) => ` "-Xlinker", ${JSON.stringify(flag
|
|
|
53063
53201
|
SWIFT_FRAMEWORK_UNOPTIMIZED_SLOTS = 4;
|
|
53064
53202
|
SWIFT_FRAMEWORK_SLOT_KEY = ".peach-framework-key";
|
|
53065
53203
|
SWIFT_FRAMEWORK_SLOT_ORIGIN = ".peach-framework-origin";
|
|
53204
|
+
SWIFT_FRAMEWORK_SLOT_RELEASE = ".peach-framework-release";
|
|
53205
|
+
SWIFT_BUILD_ROOT_SLOTS = 4;
|
|
53206
|
+
SWIFT_BUILD_ROOT_SHAPE = ".peach-build-shape";
|
|
53066
53207
|
}
|
|
53067
53208
|
});
|
|
53068
53209
|
|
|
@@ -72557,7 +72698,7 @@ var init_provenance = __esm({
|
|
|
72557
72698
|
import_node_crypto53 = require("node:crypto");
|
|
72558
72699
|
import_node_fs93 = require("node:fs");
|
|
72559
72700
|
import_node_path96 = require("node:path");
|
|
72560
|
-
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":"
|
|
72701
|
+
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, ".."));
|
|
72561
72702
|
}
|
|
72562
72703
|
});
|
|
72563
72704
|
|
|
@@ -116143,7 +116284,7 @@ public func peachOneSDK(_ pointer: UnsafePointer<UInt8>, _ length: Int32) -> Uns
|
|
|
116143
116284
|
});
|
|
116144
116285
|
|
|
116145
116286
|
// ../peach-globals/src/oneNativeControlsContract.ts
|
|
116146
|
-
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;
|
|
116287
|
+
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;
|
|
116147
116288
|
var init_oneNativeControlsContract = __esm({
|
|
116148
116289
|
"../peach-globals/src/oneNativeControlsContract.ts"() {
|
|
116149
116290
|
"use strict";
|
|
@@ -116156,6 +116297,7 @@ var init_oneNativeControlsContract = __esm({
|
|
|
116156
116297
|
"OneNativeLinearGradient",
|
|
116157
116298
|
"OneNativeGlass"
|
|
116158
116299
|
];
|
|
116300
|
+
ONE_NATIVE_CONTROLS_TAB_VIEW = "OneNativeTabView";
|
|
116159
116301
|
}
|
|
116160
116302
|
});
|
|
116161
116303
|
|
|
@@ -116356,12 +116498,33 @@ var init_one_native_controls_package = __esm({
|
|
|
116356
116498
|
init_swift_submit();
|
|
116357
116499
|
init_swift_toolchain();
|
|
116358
116500
|
ONE_SDK_DEFINES = ["ONE_IOS_26_SDK", "ONE_IOS_27_SDK", "ONE_IOS_27_1_SDK"];
|
|
116359
|
-
BRIDGE_SWIFT =
|
|
116501
|
+
BRIDGE_SWIFT = `@_spi(Peach) import SwiftUI
|
|
116360
116502
|
@_spi(Peach) import UIKit
|
|
116361
116503
|
import PeachJSON
|
|
116362
116504
|
|
|
116363
116505
|
typealias Spec = [String: Any]
|
|
116364
116506
|
|
|
116507
|
+
private final class OneContentHost: UIView, _PeachToolbarTitleMenuProvider {
|
|
116508
|
+
var titleMenu: [Spec] = []
|
|
116509
|
+
var onTitleMenuAction: ((Int) -> Void)?
|
|
116510
|
+
|
|
116511
|
+
var _peachToolbarTitleMenuContent: AnyView? {
|
|
116512
|
+
guard !titleMenu.isEmpty else { return nil }
|
|
116513
|
+
return AnyView(ForEach(Array(titleMenu.enumerated()), id: \\.offset) { index, item in
|
|
116514
|
+
let label = item["label"] as! String
|
|
116515
|
+
Button(role: item["role"] as? String == "destructive" ? .destructive : nil) { [weak self] in
|
|
116516
|
+
self?.onTitleMenuAction?(index)
|
|
116517
|
+
} label: {
|
|
116518
|
+
if let symbol = item["systemImage"] as? String {
|
|
116519
|
+
Label(label, systemImage: symbol)
|
|
116520
|
+
} else {
|
|
116521
|
+
Text(label)
|
|
116522
|
+
}
|
|
116523
|
+
}
|
|
116524
|
+
})
|
|
116525
|
+
}
|
|
116526
|
+
}
|
|
116527
|
+
|
|
116365
116528
|
private func platformColor(named name: String) -> UIColor? {
|
|
116366
116529
|
switch name {
|
|
116367
116530
|
case "label", "-apple-system-label": return UIColor.label
|
|
@@ -116978,6 +117141,122 @@ private struct NavigationSplitViewBridge: UIViewRepresentable {
|
|
|
116978
117141
|
}
|
|
116979
117142
|
}
|
|
116980
117143
|
|
|
117144
|
+
private struct TabViewBridge: UIViewRepresentable {
|
|
117145
|
+
let spec: Spec
|
|
117146
|
+
let emit: (String, String) -> Void
|
|
117147
|
+
|
|
117148
|
+
final class Coordinator: ControlComposition {
|
|
117149
|
+
var pageHosts: [String: OneContentHost] = [:]
|
|
117150
|
+
var toolbars: [OneNativeToolbarView] = []
|
|
117151
|
+
var tabSelectionSequence = 0
|
|
117152
|
+
|
|
117153
|
+
func host(_ id: String, name: String?, titleMenu: [Spec]) -> UIView {
|
|
117154
|
+
let host = pageHosts[id] ?? OneContentHost(frame: .zero)
|
|
117155
|
+
pageHosts[id] = host
|
|
117156
|
+
host._peachReactContentHost = name
|
|
117157
|
+
host.titleMenu = titleMenu
|
|
117158
|
+
host.onTitleMenuAction = { [weak self] index in
|
|
117159
|
+
self?.send(id, "onNativeTitleMenuAction", ["index": index])
|
|
117160
|
+
}
|
|
117161
|
+
return host
|
|
117162
|
+
}
|
|
117163
|
+
}
|
|
117164
|
+
|
|
117165
|
+
func makeCoordinator() -> Coordinator { Coordinator() }
|
|
117166
|
+
func makeUIView(context: Context) -> OneNativeTabViewView { OneNativeTabViewView(frame: .zero) }
|
|
117167
|
+
|
|
117168
|
+
func updateUIView(_ tabs: OneNativeTabViewView, context: Context) {
|
|
117169
|
+
let state = context.coordinator
|
|
117170
|
+
state.emit = emit
|
|
117171
|
+
let root = self.spec["root"] as! Spec
|
|
117172
|
+
let id = root["id"] as! String
|
|
117173
|
+
let spec = root["spec"] as! Spec
|
|
117174
|
+
let nodes = root["children"] as? [Spec] ?? []
|
|
117175
|
+
var visited = Set<String>()
|
|
117176
|
+
tabs.onSelection = { [weak state] selection, count, revision in
|
|
117177
|
+
state?.send(id, "onNativeTabViewSelectionChange", ["selection": selection, "eventCount": count, "revision": revision])
|
|
117178
|
+
}
|
|
117179
|
+
tabs.onAction = { [weak state] tabId in
|
|
117180
|
+
state?.send(id, "onNativeTabViewAction", ["tabId": tabId])
|
|
117181
|
+
}
|
|
117182
|
+
tabs.onCustomization = { [weak state] customization in
|
|
117183
|
+
state?.send(id, "onNativeTabViewCustomizationChange", ["customization": customization])
|
|
117184
|
+
}
|
|
117185
|
+
tabs.onSDKEvent = { [weak state] name, value in
|
|
117186
|
+
state?.send(id, "onNativeSDKEvent", ["name": name, "value": value])
|
|
117187
|
+
}
|
|
117188
|
+
tabs.configureStyle(normalizeStyle(spec["swiftStyle"] as? Spec))
|
|
117189
|
+
tabs.configure(
|
|
117190
|
+
tabViewStyle: spec["tabViewStyle"] as? String ?? "automatic",
|
|
117191
|
+
tabBarVisibility: spec["tabBarVisibility"] as? String ?? "automatic",
|
|
117192
|
+
customization: spec["customization"] as? String ?? "",
|
|
117193
|
+
customizable: spec["customizable"] as? Bool ?? false,
|
|
117194
|
+
bottomAccessoryEnabled: spec["bottomAccessoryEnabled"] as? Bool ?? true
|
|
117195
|
+
)
|
|
117196
|
+
var pages: [OneNativeTabItem] = []
|
|
117197
|
+
var toolbars: [Spec] = []
|
|
117198
|
+
for node in nodes {
|
|
117199
|
+
let page = node["spec"] as! Spec
|
|
117200
|
+
if page["control"] as? String == "OneNativeToolbar" {
|
|
117201
|
+
toolbars.append(node)
|
|
117202
|
+
continue
|
|
117203
|
+
}
|
|
117204
|
+
precondition(page["control"] as? String == "OneNativeTab", "Swift.TabView requires Swift.Tab or Swift.Toolbar children")
|
|
117205
|
+
let owner = node["id"] as! String
|
|
117206
|
+
visited.insert(owner)
|
|
117207
|
+
let item = OneNativeTabItem(
|
|
117208
|
+
id: page["tabId"] as! String,
|
|
117209
|
+
kind: page["kind"] as? String ?? "page",
|
|
117210
|
+
title: page["title"] as? String ?? "",
|
|
117211
|
+
systemImage: page["systemImage"] as? String ?? "",
|
|
117212
|
+
badge: page["badge"] as? String ?? "",
|
|
117213
|
+
role: page["tabRole"] as? String ?? "",
|
|
117214
|
+
slotHeight: page["slotHeight"] as? Double ?? 0,
|
|
117215
|
+
tabModifiers: page["tabModifiers"] as? String ?? "{}",
|
|
117216
|
+
view: state.host(owner, name: node["contentHost"] as? String, titleMenu: page["titleMenu"] as? [Spec] ?? []),
|
|
117217
|
+
onLayout: { [weak state] frame in state?.send(owner, "onNativeLayout", frameFields(frame)) }
|
|
117218
|
+
)
|
|
117219
|
+
item.configureStyle(normalizeStyle(page["swiftStyle"] as? Spec))
|
|
117220
|
+
item.emit = { [weak state] name, value in
|
|
117221
|
+
state?.send(owner, "onNativeSDKEvent", ["name": name, "value": value])
|
|
117222
|
+
}
|
|
117223
|
+
pages.append(item)
|
|
117224
|
+
}
|
|
117225
|
+
tabs.setPages(pages)
|
|
117226
|
+
let previousSequence = state.tabSelectionSequence
|
|
117227
|
+
for commit in spec["__peachTabSelections"] as? [Spec] ?? [] {
|
|
117228
|
+
guard let sequence = commit["sequence"] as? Int, sequence > state.tabSelectionSequence else { continue }
|
|
117229
|
+
state.tabSelectionSequence = sequence
|
|
117230
|
+
if let selection = commit["selection"] as? String, pages.contains(where: { $0.id == selection }) {
|
|
117231
|
+
tabs.setSelection(selection, acknowledgedEvent: commit["acknowledgedEvent"] as? Int ?? 0, revision: commit["revision"] as? Int ?? 0)
|
|
117232
|
+
}
|
|
117233
|
+
}
|
|
117234
|
+
tabs.setSelection(spec["selection"] as? String ?? "", acknowledgedEvent: spec["acknowledgedEvent"] as? Int ?? 0, revision: spec["revision"] as? Int ?? 0)
|
|
117235
|
+
if state.tabSelectionSequence > previousSequence {
|
|
117236
|
+
state.send(id, "onNativeTabSelectionsApplied", ["sequence": state.tabSelectionSequence])
|
|
117237
|
+
}
|
|
117238
|
+
let next = toolbars.map { state.render($0, visited: &visited) as! OneNativeToolbarView }
|
|
117239
|
+
state.reconcile(next, previous: state.toolbars,
|
|
117240
|
+
remove: { tabs.unmountToolbar($0 as! OneNativeToolbarView) },
|
|
117241
|
+
insert: { view, _ in tabs.mountToolbar(view as! OneNativeToolbarView) })
|
|
117242
|
+
state.toolbars = next
|
|
117243
|
+
state.prune(keeping: visited)
|
|
117244
|
+
state.pageHosts = state.pageHosts.filter { visited.contains($0.key) }
|
|
117245
|
+
}
|
|
117246
|
+
|
|
117247
|
+
static func dismantleUIView(_ view: OneNativeTabViewView, coordinator: Coordinator) {
|
|
117248
|
+
coordinator.emit = nil
|
|
117249
|
+
view.reset()
|
|
117250
|
+
coordinator.prune(keeping: [])
|
|
117251
|
+
coordinator.pageHosts.removeAll()
|
|
117252
|
+
coordinator.toolbars.removeAll()
|
|
117253
|
+
}
|
|
117254
|
+
}
|
|
117255
|
+
|
|
117256
|
+
private func frameFields(_ frame: CGRect) -> Spec {
|
|
117257
|
+
["x": frame.minX, "y": frame.minY, "width": frame.width, "height": frame.height]
|
|
117258
|
+
}
|
|
117259
|
+
|
|
116981
117260
|
@_expose(wasm, "peach_register_views")
|
|
116982
117261
|
@_cdecl("peach_register_views")
|
|
116983
117262
|
@MainActor public func peach_register_views() {
|
|
@@ -116995,6 +117274,10 @@ private struct NavigationSplitViewBridge: UIViewRepresentable {
|
|
|
116995
117274
|
return AnyView(NavigationSplitViewBridge(spec: spec, emit: emit)
|
|
116996
117275
|
.frame(maxWidth: .infinity, maxHeight: .infinity)
|
|
116997
117276
|
.ignoresSafeArea(.container))
|
|
117277
|
+
case "${ONE_NATIVE_CONTROLS_TAB_VIEW}":
|
|
117278
|
+
return AnyView(TabViewBridge(spec: spec, emit: emit)
|
|
117279
|
+
.frame(maxWidth: .infinity, maxHeight: .infinity)
|
|
117280
|
+
.ignoresSafeArea(.container, edges: .horizontal))
|
|
116998
117281
|
default:
|
|
116999
117282
|
let root = spec["root"] as! Spec
|
|
117000
117283
|
precondition((root["spec"] as? Spec)?["control"] as? String == view)
|
|
@@ -121437,7 +121720,7 @@ var init_nitro_superset = __esm({
|
|
|
121437
121720
|
init_nitroContract();
|
|
121438
121721
|
init_swift_standin_digest();
|
|
121439
121722
|
NITRO_SUPERSET_ENTRY_NAME = "superset";
|
|
121440
|
-
NITRO_COMPILER_DIGEST = true ? "
|
|
121723
|
+
NITRO_COMPILER_DIGEST = true ? "74b5613216c94c9a712253659e2803b31d4fe1a7f0ff32f2ad7d3fa7ef57f2ab" : nitroCompilerSourceDigest(__sootsim_import_meta_dirname, STANDIN_SOURCE_DIGEST2);
|
|
121441
121724
|
nitroSupersetLock = parseLock(nitro_superset_lock_default);
|
|
121442
121725
|
nitroSupersetKey = (inputs2) => nativeEntryKey({ ...inputs2, compiler: NITRO_COMPILER_DIGEST });
|
|
121443
121726
|
published3 = /* @__PURE__ */ new Map();
|