peachsim 0.1.1674 → 0.1.1684
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/control.ts +13 -1
- package/cli/commands/coverage-swift.ts +83 -27
- package/cli/commands/coverage.ts +219 -20
- package/cli/commands/detect.ts +10 -6
- package/cli/commands/inspect/core.ts +2 -0
- package/cli/commands/inspect/wait-ready.ts +7 -0
- package/cli/outbound-endpoints.ts +12 -0
- package/detox/index.ts +11 -1
- package/detox/jest-environment.cjs +14 -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 +1 -1
- package/dist-lib/bridge-constants.cjs +1 -1
- package/dist-lib/bridge-contract-input.cjs +1 -1
- package/dist-lib/bridge-contract-input.mjs +1 -1
- package/dist-lib/bridge-contract.cjs +1 -1
- package/dist-lib/bridge-contract.mjs +1 -1
- package/dist-lib/bundle-channel.cjs +3274 -1663
- package/dist-lib/capture-contract.cjs +1 -1
- package/dist-lib/capture-contract.mjs +1 -1
- package/dist-lib/cloud-contract.cjs +1 -1
- package/dist-lib/cloud-contract.mjs +1 -1
- package/dist-lib/cloud-test-args.cjs +1 -1
- package/dist-lib/cloud-test-args.mjs +1 -1
- package/dist-lib/cloud.cjs +1 -1
- package/dist-lib/cloud.mjs +1 -1
- package/dist-lib/config.cjs +1 -1
- package/dist-lib/config.mjs +1 -1
- package/dist-lib/detox/index.cjs +6 -4
- package/dist-lib/detox/jest-environment.cjs +14 -0
- package/dist-lib/dev-bundle-resolution.cjs +1 -1
- package/dist-lib/expo-swift-bundle.cjs +2407 -1126
- package/dist-lib/expo-swift-metadata.cjs +1 -1
- package/dist-lib/expo-swift-metadata.mjs +1 -1
- package/dist-lib/home-paths.cjs +1 -1
- package/dist-lib/host/bridge-host.cjs +2879 -1598
- package/dist-lib/host/fetch-proxy-handler.cjs +18 -5
- package/dist-lib/host/fetch-proxy-overrides.cjs +1 -1
- package/dist-lib/host/fetch-proxy-overrides.mjs +1 -1
- package/dist-lib/host/replacement-module-handler.cjs +1 -1
- package/dist-lib/host/websocket-proxy.cjs +1 -1
- package/dist-lib/index.cjs +1904 -741
- package/dist-lib/jump-to-source-babel.cjs +1 -1
- package/dist-lib/jump-to-source-native.cjs +1 -1
- package/dist-lib/kotlin-host.cjs +1 -1
- package/dist-lib/menu.cjs +1 -1
- package/dist-lib/menu.mjs +1 -1
- package/dist-lib/metro-fingerprint-registry.cjs +1 -1
- package/dist-lib/metro-fingerprint-registry.mjs +1 -1
- package/dist-lib/metro-production-bundle.cjs +1 -1
- package/dist-lib/metro-production-bundle.mjs +1 -1
- package/dist-lib/metro.cjs +6215 -4283
- package/dist-lib/native-app-identity-project.cjs +31 -6
- package/dist-lib/native-app-identity-project.mjs +31 -6
- package/dist-lib/native-app-identity.cjs +1 -1
- package/dist-lib/native-app-identity.mjs +1 -1
- package/dist-lib/native-firebase-metadata.cjs +1 -1
- package/dist-lib/native-firebase-metadata.mjs +1 -1
- package/dist-lib/plist.cjs +1 -1
- package/dist-lib/plist.mjs +1 -1
- package/dist-lib/profiles.cjs +1 -1
- package/dist-lib/public-brand.cjs +1 -1
- package/dist-lib/public-origins-lib-esm.json +24 -23
- package/dist-lib/public-origins-lib-static.json +1 -1
- package/dist-lib/public-origins-lib.json +134 -78
- package/dist-lib/react-native-host-modules.cjs +1 -1
- package/dist-lib/react-native-host-modules.mjs +1 -1
- package/dist-lib/reap-browser.cjs +2 -2
- package/dist-lib/scripts/dev-server-scanner.cjs +1 -1
- package/dist-lib/sdk.cjs +2 -1
- package/dist-lib/sdk.mjs +2 -1
- package/dist-lib/skills.cjs +3570 -2160
- package/dist-lib/swift-compile.cjs +473 -351
- package/dist-lib/swift-compile.mjs +471 -349
- package/dist-lib/swift-package.cjs +36 -6
- package/dist-lib/swift-package.mjs +35 -6
- package/dist-lib/swift-submit.cjs +1 -1
- package/dist-lib/swift-submit.mjs +1 -1
- package/dist-lib/swift-toolchain.cjs +26 -11
- package/dist-lib/swift.cjs +1 -1
- package/dist-lib/vite-swift.cjs +2418 -1132
- package/dist-lib/vite.cjs +1907 -766
- package/dist-lib/worklet-executable.cjs +1 -1
- package/dist-lib/worklet-executable.mjs +1 -1
- package/dist-types/packages/peach-engine/src/engine/canvaskit-api.d.ts +1 -1
- package/dist-types/packages/peach-engine/src/engine/clipboardContract.d.ts +9 -1
- package/dist-types/packages/peach-engine/src/preview/upload-protocol.d.ts +11 -3
- package/dist-types/packages/peach-engine/src/webview-automation-host.d.ts +6 -0
- package/dist-types/packages/peach-globals/src/clipboardBridgeContract.d.ts +2 -0
- package/package.json +1 -1
- package/runtime-companion.json +1 -1
- package/sdk/ios/System/Library/Frameworks/CoreFoundation.framework/Headers/CoreFoundation.h +51 -2
- package/sdk/ios/System/Library/Frameworks/Foundation.framework/Headers/Foundation.h +21 -0
- package/sdk/ios/System/Library/Frameworks/MessageUI.framework/Headers/MFComposeAssistantViewController.h +29 -0
- package/sdk/ios/System/Library/Frameworks/MessageUI.framework/Headers/MFMailComposeControllerDeferredAction.h +14 -0
- package/sdk/ios/System/Library/Frameworks/MessageUI.framework/Headers/MFMailComposeViewController.h +162 -0
- package/sdk/ios/System/Library/Frameworks/MessageUI.framework/Headers/MFMailDraft.h +24 -0
- package/sdk/ios/System/Library/Frameworks/MessageUI.framework/Headers/MFMessageComposeViewController+UPI.h +31 -0
- package/sdk/ios/System/Library/Frameworks/MessageUI.framework/Headers/MFMessageComposeViewController.h +169 -0
- package/sdk/ios/System/Library/Frameworks/MessageUI.framework/Headers/MessageUI.h +13 -0
- package/sdk/ios/System/Library/Frameworks/MessageUI.framework/Modules/module.modulemap +11 -0
- package/sdk/ios/System/Library/Frameworks/UIKit.framework/Headers/UIKit.h +10 -0
- package/sdk/ios/usr/include/arm/param.h +151 -0
- package/sdk/ios/usr/include/dispatch/dispatch.h +3 -0
- package/sdk/ios/usr/include/dlfcn.h +1 -2
- package/sdk/ios/usr/include/machine/param.h +42 -0
- package/sdk/ios/usr/include/net/if.h +1 -2
- package/sdk/ios/usr/include/peach/pthread.h +4 -4
- package/sdk/ios/usr/include/pthread/qos.h +304 -0
- package/sdk/ios/usr/include/sys/_types/_fd_clr.h +31 -0
- package/sdk/ios/usr/include/sys/_types/_fd_copy.h +31 -0
- package/sdk/ios/usr/include/sys/_types/_fd_def.h +121 -0
- package/sdk/ios/usr/include/sys/_types/_fd_isset.h +31 -0
- package/sdk/ios/usr/include/sys/_types/_fd_set.h +31 -0
- package/sdk/ios/usr/include/sys/_types/_fd_setsize.h +31 -0
- package/sdk/ios/usr/include/sys/_types/_fd_zero.h +31 -0
- package/sdk/ios/usr/include/sys/cdefs.h +3 -0
- package/sdk/ios/usr/include/sys/param.h +235 -0
- package/sdk/ios/usr/include/sys/proc.h +1 -0
- package/sdk/ios/usr/include/sys/qos.h +151 -12
- package/sdk/ios/wasm/include/__typedef_sigset_t.h +7 -0
- package/sdk/ios/wasm/include/fcntl.h +11 -0
- package/sdk/ios/wasm/include/mach/machine/boolean.h +2 -0
- package/sdk/ios/wasm/include/mach/machine/exception.h +5 -0
- package/sdk/ios/wasm/include/mach/machine/kern_return.h +2 -0
- package/sdk/ios/wasm/include/mach/machine/processor_info.h +2 -0
- package/sdk/ios/wasm/include/mach/machine/rpc.h +2 -0
- package/sdk/ios/wasm/include/mach/machine/thread_state.h +3 -0
- package/sdk/ios/wasm/include/mach/machine/thread_status.h +3 -0
- package/sdk/ios/wasm/include/mach/machine/vm_param.h +3 -0
- package/sdk/ios/wasm/include/mach/machine/vm_types.h +18 -0
- package/sdk/ios/wasm/include/machine/_types.h +153 -0
- package/sdk/ios/wasm/include/machine/endian.h +2 -0
- package/sdk/ios/wasm/include/machine/limits.h +2 -0
- package/sdk/ios/wasm/include/machine/types.h +30 -0
- package/sdk/ios/wasm/include/poll.h +8 -0
- package/sdk/ios/wasm/include/pthread.h +50 -0
- package/sdk/ios/wasm/include/signal.h +72 -0
- package/sdk/ios/wasm/include/stdlib.h +3 -0
- package/sdk/ios/wasm/include/string.h +10 -0
- package/sdk/ios/wasm/include/sys/_pthread/_pthread_attr_t.h +7 -0
- package/sdk/ios/wasm/include/sys/_pthread/_pthread_t.h +7 -0
- package/sdk/ios/wasm/include/sys/mman.h +122 -0
- package/sdk/ios/wasm/include/sys/select.h +37 -0
- package/sdk/ios/wasm/include/sys/signal.h +259 -0
- package/sdk/ios/wasm/include/sys/socket.h +8 -0
- package/sdk/ios/wasm/include/sys/types.h +14 -0
- package/sdk/ios/wasm/include/sys/ucontext.h +1 -0
- package/sdk/ios/wasm/include/sys/uio.h +11 -0
- package/sdk/ios/wasm/include/sys/wait.h +89 -0
- package/sdk/ios/wasm/include/time.h +8 -0
- package/sdk/ios/wasm/include/unistd.h +17 -0
- package/src/bridge-contract.ts +2 -0
- package/src/chromium-admission.ts +10 -5
- package/src/device-catalog.ts +4 -4
- package/src/host/fetch-proxy-handler.ts +20 -0
- package/src/metro-plugin.ts +5 -2
- package/src/nitro-adapter.lock.json +6 -6
- package/src/nitro-compile.ts +63 -2
- package/src/numbered-lock.ts +72 -0
- package/src/react-native-coverage/capability-reference-resolution.ts +62 -5
- package/src/react-native-coverage/capability-source-references.ts +50 -13
- package/src/react-native-coverage/native-source-credit.ts +126 -0
- package/src/react-native-coverage/native-source-ranges-file.ts +38 -0
- package/src/react-native-coverage/native-surface.ts +49 -0
- package/src/react-native-coverage/verified-reach.ts +22 -2
- package/src/runtime-assets.ts +17 -0
- package/src/swift-compile.ts +84 -48
- package/src/swift-coverage/indexing.ts +17 -1
- package/src/swift-coverage/sdk.ts +71 -0
- package/src/swift-coverage/source.ts +74 -2
- package/src/swift-coverage/types.ts +6 -0
- package/src/swift-distribution.lock.json +12 -12
- package/src/swift-host.ts +133 -14
- package/src/swift-objc-compile.ts +6 -21
- package/src/swift-objc-metadata.ts +2 -8
- package/src/swift-objc-platform.ts +53 -0
- package/src/swift-objc-standin.ts +45 -1
- package/src/swift-package-manifest.ts +48 -3
- package/src/swift-package.ts +59 -9
- package/src/swift-packages.ts +157 -44
- package/src/swift-source-pods.ts +288 -0
- package/src/swift-toolchain.ts +32 -10
- package/src/vite-plugin-one.ts +5 -4
- package/src/worker-system-chunks.ts +7 -1
- package/src/xcode-project.ts +40 -11
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! peach v0.1.
|
|
1
|
+
/*! peach v0.1.1684 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
|
|
2
2
|
var __defProp = Object.defineProperty;
|
|
3
3
|
var __export = (target, all) => {
|
|
4
4
|
for (var name2 in all)
|
|
@@ -26,7 +26,7 @@ import {
|
|
|
26
26
|
writeFileSync as writeFileSync3
|
|
27
27
|
} from "node:fs";
|
|
28
28
|
import os2 from "node:os";
|
|
29
|
-
import
|
|
29
|
+
import path12 from "node:path";
|
|
30
30
|
|
|
31
31
|
// ../../node_modules/yaml/browser/dist/index.js
|
|
32
32
|
var dist_exports = {};
|
|
@@ -114,17 +114,17 @@ function visit(node, visitor) {
|
|
|
114
114
|
visit.BREAK = BREAK;
|
|
115
115
|
visit.SKIP = SKIP;
|
|
116
116
|
visit.REMOVE = REMOVE;
|
|
117
|
-
function visit_(key, node, visitor,
|
|
118
|
-
const ctrl = callVisitor(key, node, visitor,
|
|
117
|
+
function visit_(key, node, visitor, path13) {
|
|
118
|
+
const ctrl = callVisitor(key, node, visitor, path13);
|
|
119
119
|
if (isNode(ctrl) || isPair(ctrl)) {
|
|
120
|
-
replaceNode(key,
|
|
121
|
-
return visit_(key, ctrl, visitor,
|
|
120
|
+
replaceNode(key, path13, ctrl);
|
|
121
|
+
return visit_(key, ctrl, visitor, path13);
|
|
122
122
|
}
|
|
123
123
|
if (typeof ctrl !== "symbol") {
|
|
124
124
|
if (isCollection(node)) {
|
|
125
|
-
|
|
125
|
+
path13 = Object.freeze(path13.concat(node));
|
|
126
126
|
for (let i = 0; i < node.items.length; ++i) {
|
|
127
|
-
const ci = visit_(i, node.items[i], visitor,
|
|
127
|
+
const ci = visit_(i, node.items[i], visitor, path13);
|
|
128
128
|
if (typeof ci === "number")
|
|
129
129
|
i = ci - 1;
|
|
130
130
|
else if (ci === BREAK)
|
|
@@ -135,13 +135,13 @@ function visit_(key, node, visitor, path12) {
|
|
|
135
135
|
}
|
|
136
136
|
}
|
|
137
137
|
} else if (isPair(node)) {
|
|
138
|
-
|
|
139
|
-
const ck = visit_("key", node.key, visitor,
|
|
138
|
+
path13 = Object.freeze(path13.concat(node));
|
|
139
|
+
const ck = visit_("key", node.key, visitor, path13);
|
|
140
140
|
if (ck === BREAK)
|
|
141
141
|
return BREAK;
|
|
142
142
|
else if (ck === REMOVE)
|
|
143
143
|
node.key = null;
|
|
144
|
-
const cv = visit_("value", node.value, visitor,
|
|
144
|
+
const cv = visit_("value", node.value, visitor, path13);
|
|
145
145
|
if (cv === BREAK)
|
|
146
146
|
return BREAK;
|
|
147
147
|
else if (cv === REMOVE)
|
|
@@ -162,17 +162,17 @@ async function visitAsync(node, visitor) {
|
|
|
162
162
|
visitAsync.BREAK = BREAK;
|
|
163
163
|
visitAsync.SKIP = SKIP;
|
|
164
164
|
visitAsync.REMOVE = REMOVE;
|
|
165
|
-
async function visitAsync_(key, node, visitor,
|
|
166
|
-
const ctrl = await callVisitor(key, node, visitor,
|
|
165
|
+
async function visitAsync_(key, node, visitor, path13) {
|
|
166
|
+
const ctrl = await callVisitor(key, node, visitor, path13);
|
|
167
167
|
if (isNode(ctrl) || isPair(ctrl)) {
|
|
168
|
-
replaceNode(key,
|
|
169
|
-
return visitAsync_(key, ctrl, visitor,
|
|
168
|
+
replaceNode(key, path13, ctrl);
|
|
169
|
+
return visitAsync_(key, ctrl, visitor, path13);
|
|
170
170
|
}
|
|
171
171
|
if (typeof ctrl !== "symbol") {
|
|
172
172
|
if (isCollection(node)) {
|
|
173
|
-
|
|
173
|
+
path13 = Object.freeze(path13.concat(node));
|
|
174
174
|
for (let i = 0; i < node.items.length; ++i) {
|
|
175
|
-
const ci = await visitAsync_(i, node.items[i], visitor,
|
|
175
|
+
const ci = await visitAsync_(i, node.items[i], visitor, path13);
|
|
176
176
|
if (typeof ci === "number")
|
|
177
177
|
i = ci - 1;
|
|
178
178
|
else if (ci === BREAK)
|
|
@@ -183,13 +183,13 @@ async function visitAsync_(key, node, visitor, path12) {
|
|
|
183
183
|
}
|
|
184
184
|
}
|
|
185
185
|
} else if (isPair(node)) {
|
|
186
|
-
|
|
187
|
-
const ck = await visitAsync_("key", node.key, visitor,
|
|
186
|
+
path13 = Object.freeze(path13.concat(node));
|
|
187
|
+
const ck = await visitAsync_("key", node.key, visitor, path13);
|
|
188
188
|
if (ck === BREAK)
|
|
189
189
|
return BREAK;
|
|
190
190
|
else if (ck === REMOVE)
|
|
191
191
|
node.key = null;
|
|
192
|
-
const cv = await visitAsync_("value", node.value, visitor,
|
|
192
|
+
const cv = await visitAsync_("value", node.value, visitor, path13);
|
|
193
193
|
if (cv === BREAK)
|
|
194
194
|
return BREAK;
|
|
195
195
|
else if (cv === REMOVE)
|
|
@@ -216,23 +216,23 @@ function initVisitor(visitor) {
|
|
|
216
216
|
}
|
|
217
217
|
return visitor;
|
|
218
218
|
}
|
|
219
|
-
function callVisitor(key, node, visitor,
|
|
219
|
+
function callVisitor(key, node, visitor, path13) {
|
|
220
220
|
if (typeof visitor === "function")
|
|
221
|
-
return visitor(key, node,
|
|
221
|
+
return visitor(key, node, path13);
|
|
222
222
|
if (isMap(node))
|
|
223
|
-
return visitor.Map?.(key, node,
|
|
223
|
+
return visitor.Map?.(key, node, path13);
|
|
224
224
|
if (isSeq(node))
|
|
225
|
-
return visitor.Seq?.(key, node,
|
|
225
|
+
return visitor.Seq?.(key, node, path13);
|
|
226
226
|
if (isPair(node))
|
|
227
|
-
return visitor.Pair?.(key, node,
|
|
227
|
+
return visitor.Pair?.(key, node, path13);
|
|
228
228
|
if (isScalar(node))
|
|
229
|
-
return visitor.Scalar?.(key, node,
|
|
229
|
+
return visitor.Scalar?.(key, node, path13);
|
|
230
230
|
if (isAlias(node))
|
|
231
|
-
return visitor.Alias?.(key, node,
|
|
231
|
+
return visitor.Alias?.(key, node, path13);
|
|
232
232
|
return void 0;
|
|
233
233
|
}
|
|
234
|
-
function replaceNode(key,
|
|
235
|
-
const parent =
|
|
234
|
+
function replaceNode(key, path13, node) {
|
|
235
|
+
const parent = path13[path13.length - 1];
|
|
236
236
|
if (isCollection(parent)) {
|
|
237
237
|
parent.items[key] = node;
|
|
238
238
|
} else if (isPair(parent)) {
|
|
@@ -761,10 +761,10 @@ function createNode(value, tagName, ctx) {
|
|
|
761
761
|
}
|
|
762
762
|
|
|
763
763
|
// ../../node_modules/yaml/browser/dist/nodes/Collection.js
|
|
764
|
-
function collectionFromPath(schema4,
|
|
764
|
+
function collectionFromPath(schema4, path13, value) {
|
|
765
765
|
let v = value;
|
|
766
|
-
for (let i =
|
|
767
|
-
const k =
|
|
766
|
+
for (let i = path13.length - 1; i >= 0; --i) {
|
|
767
|
+
const k = path13[i];
|
|
768
768
|
if (typeof k === "number" && Number.isInteger(k) && k >= 0) {
|
|
769
769
|
const a = [];
|
|
770
770
|
a[k] = v;
|
|
@@ -783,7 +783,7 @@ function collectionFromPath(schema4, path12, value) {
|
|
|
783
783
|
sourceObjects: /* @__PURE__ */ new Map()
|
|
784
784
|
});
|
|
785
785
|
}
|
|
786
|
-
var isEmptyPath = (
|
|
786
|
+
var isEmptyPath = (path13) => path13 == null || typeof path13 === "object" && !!path13[Symbol.iterator]().next().done;
|
|
787
787
|
var Collection = class extends NodeBase {
|
|
788
788
|
constructor(type, schema4) {
|
|
789
789
|
super(type);
|
|
@@ -813,11 +813,11 @@ var Collection = class extends NodeBase {
|
|
|
813
813
|
* be a Pair instance or a `{ key, value }` object, which may not have a key
|
|
814
814
|
* that already exists in the map.
|
|
815
815
|
*/
|
|
816
|
-
addIn(
|
|
817
|
-
if (isEmptyPath(
|
|
816
|
+
addIn(path13, value) {
|
|
817
|
+
if (isEmptyPath(path13))
|
|
818
818
|
this.add(value);
|
|
819
819
|
else {
|
|
820
|
-
const [key, ...rest] =
|
|
820
|
+
const [key, ...rest] = path13;
|
|
821
821
|
const node = this.get(key, true);
|
|
822
822
|
if (isCollection(node))
|
|
823
823
|
node.addIn(rest, value);
|
|
@@ -831,8 +831,8 @@ var Collection = class extends NodeBase {
|
|
|
831
831
|
* Removes a value from the collection.
|
|
832
832
|
* @returns `true` if the item was found and removed.
|
|
833
833
|
*/
|
|
834
|
-
deleteIn(
|
|
835
|
-
const [key, ...rest] =
|
|
834
|
+
deleteIn(path13) {
|
|
835
|
+
const [key, ...rest] = path13;
|
|
836
836
|
if (rest.length === 0)
|
|
837
837
|
return this.delete(key);
|
|
838
838
|
const node = this.get(key, true);
|
|
@@ -846,8 +846,8 @@ var Collection = class extends NodeBase {
|
|
|
846
846
|
* scalar values from their surrounding node; to disable set `keepScalar` to
|
|
847
847
|
* `true` (collections are always returned intact).
|
|
848
848
|
*/
|
|
849
|
-
getIn(
|
|
850
|
-
const [key, ...rest] =
|
|
849
|
+
getIn(path13, keepScalar) {
|
|
850
|
+
const [key, ...rest] = path13;
|
|
851
851
|
const node = this.get(key, true);
|
|
852
852
|
if (rest.length === 0)
|
|
853
853
|
return !keepScalar && isScalar(node) ? node.value : node;
|
|
@@ -865,8 +865,8 @@ var Collection = class extends NodeBase {
|
|
|
865
865
|
/**
|
|
866
866
|
* Checks if the collection includes a value with the key `key`.
|
|
867
867
|
*/
|
|
868
|
-
hasIn(
|
|
869
|
-
const [key, ...rest] =
|
|
868
|
+
hasIn(path13) {
|
|
869
|
+
const [key, ...rest] = path13;
|
|
870
870
|
if (rest.length === 0)
|
|
871
871
|
return this.has(key);
|
|
872
872
|
const node = this.get(key, true);
|
|
@@ -876,8 +876,8 @@ var Collection = class extends NodeBase {
|
|
|
876
876
|
* Sets a value in this collection. For `!!set`, `value` needs to be a
|
|
877
877
|
* boolean to add/remove the item from the set.
|
|
878
878
|
*/
|
|
879
|
-
setIn(
|
|
880
|
-
const [key, ...rest] =
|
|
879
|
+
setIn(path13, value) {
|
|
880
|
+
const [key, ...rest] = path13;
|
|
881
881
|
if (rest.length === 0) {
|
|
882
882
|
this.set(key, value);
|
|
883
883
|
} else {
|
|
@@ -3016,9 +3016,9 @@ var Document = class _Document {
|
|
|
3016
3016
|
this.contents.add(value);
|
|
3017
3017
|
}
|
|
3018
3018
|
/** Adds a value to the document. */
|
|
3019
|
-
addIn(
|
|
3019
|
+
addIn(path13, value) {
|
|
3020
3020
|
if (assertCollection(this.contents))
|
|
3021
|
-
this.contents.addIn(
|
|
3021
|
+
this.contents.addIn(path13, value);
|
|
3022
3022
|
}
|
|
3023
3023
|
/**
|
|
3024
3024
|
* Create a new `Alias` node, ensuring that the target `node` has the required anchor.
|
|
@@ -3093,14 +3093,14 @@ var Document = class _Document {
|
|
|
3093
3093
|
* Removes a value from the document.
|
|
3094
3094
|
* @returns `true` if the item was found and removed.
|
|
3095
3095
|
*/
|
|
3096
|
-
deleteIn(
|
|
3097
|
-
if (isEmptyPath(
|
|
3096
|
+
deleteIn(path13) {
|
|
3097
|
+
if (isEmptyPath(path13)) {
|
|
3098
3098
|
if (this.contents == null)
|
|
3099
3099
|
return false;
|
|
3100
3100
|
this.contents = null;
|
|
3101
3101
|
return true;
|
|
3102
3102
|
}
|
|
3103
|
-
return assertCollection(this.contents) ? this.contents.deleteIn(
|
|
3103
|
+
return assertCollection(this.contents) ? this.contents.deleteIn(path13) : false;
|
|
3104
3104
|
}
|
|
3105
3105
|
/**
|
|
3106
3106
|
* Returns item at `key`, or `undefined` if not found. By default unwraps
|
|
@@ -3115,10 +3115,10 @@ var Document = class _Document {
|
|
|
3115
3115
|
* scalar values from their surrounding node; to disable set `keepScalar` to
|
|
3116
3116
|
* `true` (collections are always returned intact).
|
|
3117
3117
|
*/
|
|
3118
|
-
getIn(
|
|
3119
|
-
if (isEmptyPath(
|
|
3118
|
+
getIn(path13, keepScalar) {
|
|
3119
|
+
if (isEmptyPath(path13))
|
|
3120
3120
|
return !keepScalar && isScalar(this.contents) ? this.contents.value : this.contents;
|
|
3121
|
-
return isCollection(this.contents) ? this.contents.getIn(
|
|
3121
|
+
return isCollection(this.contents) ? this.contents.getIn(path13, keepScalar) : void 0;
|
|
3122
3122
|
}
|
|
3123
3123
|
/**
|
|
3124
3124
|
* Checks if the document includes a value with the key `key`.
|
|
@@ -3129,10 +3129,10 @@ var Document = class _Document {
|
|
|
3129
3129
|
/**
|
|
3130
3130
|
* Checks if the document includes a value at `path`.
|
|
3131
3131
|
*/
|
|
3132
|
-
hasIn(
|
|
3133
|
-
if (isEmptyPath(
|
|
3132
|
+
hasIn(path13) {
|
|
3133
|
+
if (isEmptyPath(path13))
|
|
3134
3134
|
return this.contents !== void 0;
|
|
3135
|
-
return isCollection(this.contents) ? this.contents.hasIn(
|
|
3135
|
+
return isCollection(this.contents) ? this.contents.hasIn(path13) : false;
|
|
3136
3136
|
}
|
|
3137
3137
|
/**
|
|
3138
3138
|
* Sets a value in this document. For `!!set`, `value` needs to be a
|
|
@@ -3149,13 +3149,13 @@ var Document = class _Document {
|
|
|
3149
3149
|
* Sets a value in this document. For `!!set`, `value` needs to be a
|
|
3150
3150
|
* boolean to add/remove the item from the set.
|
|
3151
3151
|
*/
|
|
3152
|
-
setIn(
|
|
3153
|
-
if (isEmptyPath(
|
|
3152
|
+
setIn(path13, value) {
|
|
3153
|
+
if (isEmptyPath(path13)) {
|
|
3154
3154
|
this.contents = value;
|
|
3155
3155
|
} else if (this.contents == null) {
|
|
3156
|
-
this.contents = collectionFromPath(this.schema, Array.from(
|
|
3156
|
+
this.contents = collectionFromPath(this.schema, Array.from(path13), value);
|
|
3157
3157
|
} else if (assertCollection(this.contents)) {
|
|
3158
|
-
this.contents.setIn(
|
|
3158
|
+
this.contents.setIn(path13, value);
|
|
3159
3159
|
}
|
|
3160
3160
|
}
|
|
3161
3161
|
/**
|
|
@@ -4951,9 +4951,9 @@ function visit2(cst, visitor) {
|
|
|
4951
4951
|
visit2.BREAK = BREAK2;
|
|
4952
4952
|
visit2.SKIP = SKIP2;
|
|
4953
4953
|
visit2.REMOVE = REMOVE2;
|
|
4954
|
-
visit2.itemAtPath = (cst,
|
|
4954
|
+
visit2.itemAtPath = (cst, path13) => {
|
|
4955
4955
|
let item = cst;
|
|
4956
|
-
for (const [field, index] of
|
|
4956
|
+
for (const [field, index] of path13) {
|
|
4957
4957
|
const tok = item?.[field];
|
|
4958
4958
|
if (tok && "items" in tok) {
|
|
4959
4959
|
item = tok.items[index];
|
|
@@ -4962,23 +4962,23 @@ visit2.itemAtPath = (cst, path12) => {
|
|
|
4962
4962
|
}
|
|
4963
4963
|
return item;
|
|
4964
4964
|
};
|
|
4965
|
-
visit2.parentCollection = (cst,
|
|
4966
|
-
const parent = visit2.itemAtPath(cst,
|
|
4967
|
-
const field =
|
|
4965
|
+
visit2.parentCollection = (cst, path13) => {
|
|
4966
|
+
const parent = visit2.itemAtPath(cst, path13.slice(0, -1));
|
|
4967
|
+
const field = path13[path13.length - 1][0];
|
|
4968
4968
|
const coll = parent?.[field];
|
|
4969
4969
|
if (coll && "items" in coll)
|
|
4970
4970
|
return coll;
|
|
4971
4971
|
throw new Error("Parent collection not found");
|
|
4972
4972
|
};
|
|
4973
|
-
function _visit(
|
|
4974
|
-
let ctrl = visitor(item,
|
|
4973
|
+
function _visit(path13, item, visitor) {
|
|
4974
|
+
let ctrl = visitor(item, path13);
|
|
4975
4975
|
if (typeof ctrl === "symbol")
|
|
4976
4976
|
return ctrl;
|
|
4977
4977
|
for (const field of ["key", "value"]) {
|
|
4978
4978
|
const token = item[field];
|
|
4979
4979
|
if (token && "items" in token) {
|
|
4980
4980
|
for (let i = 0; i < token.items.length; ++i) {
|
|
4981
|
-
const ci = _visit(Object.freeze(
|
|
4981
|
+
const ci = _visit(Object.freeze(path13.concat([[field, i]])), token.items[i], visitor);
|
|
4982
4982
|
if (typeof ci === "number")
|
|
4983
4983
|
i = ci - 1;
|
|
4984
4984
|
else if (ci === BREAK2)
|
|
@@ -4989,10 +4989,10 @@ function _visit(path12, item, visitor) {
|
|
|
4989
4989
|
}
|
|
4990
4990
|
}
|
|
4991
4991
|
if (typeof ctrl === "function" && field === "key")
|
|
4992
|
-
ctrl = ctrl(item,
|
|
4992
|
+
ctrl = ctrl(item, path13);
|
|
4993
4993
|
}
|
|
4994
4994
|
}
|
|
4995
|
-
return typeof ctrl === "function" ? ctrl(item,
|
|
4995
|
+
return typeof ctrl === "function" ? ctrl(item, path13) : ctrl;
|
|
4996
4996
|
}
|
|
4997
4997
|
|
|
4998
4998
|
// ../../node_modules/yaml/browser/dist/parse/cst.js
|
|
@@ -7376,9 +7376,9 @@ var EXCERPT = /^(\s*)(\d+)( \| )(.*)$/;
|
|
|
7376
7376
|
var MARKER = /^(\s*)( \| )(.*)$/;
|
|
7377
7377
|
function designTimeDiagnostic(output, files) {
|
|
7378
7378
|
const rewritten = /* @__PURE__ */ new Map();
|
|
7379
|
-
const linesOf = (
|
|
7379
|
+
const linesOf = (path13) => {
|
|
7380
7380
|
const file = Object.keys(files).find(
|
|
7381
|
-
(name2) => name2.endsWith(".swift") && (
|
|
7381
|
+
(name2) => name2.endsWith(".swift") && (path13 === name2 || path13.endsWith(`/${name2}`))
|
|
7382
7382
|
);
|
|
7383
7383
|
if (file === void 0) return null;
|
|
7384
7384
|
let lines = rewritten.get(file);
|
|
@@ -7490,20 +7490,20 @@ function swiftSdkOptions() {
|
|
|
7490
7490
|
}
|
|
7491
7491
|
return [];
|
|
7492
7492
|
}
|
|
7493
|
-
var SWIFT_HOST_COMPILER_RELEASE = "swift-6.4.0-RELEASE-custom-
|
|
7494
|
-
var SWIFT_HOST_COMPILER_ID = "
|
|
7493
|
+
var SWIFT_HOST_COMPILER_RELEASE = "swift-6.4.0-RELEASE-custom-8be2e4a7a393b003";
|
|
7494
|
+
var SWIFT_HOST_COMPILER_ID = "8be2e4a7a393b003";
|
|
7495
7495
|
var compilerArchives = {
|
|
7496
7496
|
"darwin-arm64": {
|
|
7497
|
-
checksum: "
|
|
7498
|
-
manifest: "
|
|
7497
|
+
checksum: "88d69b7ac912962adaadce9fdb2c57fe07cd19e4d8158088e0acbd247496ca6d",
|
|
7498
|
+
manifest: "70d5e2be8c959eb5dd1d9b576e6c209e1f58bfb9089f90c38c2d7e087759f0b3"
|
|
7499
7499
|
},
|
|
7500
7500
|
"linux-x64": {
|
|
7501
|
-
checksum: "
|
|
7502
|
-
manifest: "
|
|
7501
|
+
checksum: "7c42ded03742d16816e64f8ae8fca478aaaff450d22ab3d698daf78c010854b2",
|
|
7502
|
+
manifest: "90cfb09c5a0ba8c119066787cf47244a45bf3cda68dce94c6b1a16337b9b91bd"
|
|
7503
7503
|
},
|
|
7504
7504
|
"linux-arm64": {
|
|
7505
|
-
checksum: "
|
|
7506
|
-
manifest: "
|
|
7505
|
+
checksum: "f9f1d96fb1a6325d3bb30ab12a75fc06e4e8535aab58a91581e03f3d91f68fa6",
|
|
7506
|
+
manifest: "f988181dce795f6c8a6d4a8d86f7b61768f23a743b4e7bea76e64862ef328ad6"
|
|
7507
7507
|
}
|
|
7508
7508
|
};
|
|
7509
7509
|
function swiftHostCompilerArchive(release, host2 = `${process.platform}-${process.arch}`) {
|
|
@@ -9062,10 +9062,10 @@ function swiftObjCImports(graphs, options) {
|
|
|
9062
9062
|
}
|
|
9063
9063
|
|
|
9064
9064
|
// src/swift-objc-metadata.ts
|
|
9065
|
-
import { spawnSync as
|
|
9065
|
+
import { spawnSync as spawnSync5 } from "node:child_process";
|
|
9066
9066
|
import { createHash as createHash7 } from "node:crypto";
|
|
9067
9067
|
import fs4 from "node:fs";
|
|
9068
|
-
import
|
|
9068
|
+
import path9 from "node:path";
|
|
9069
9069
|
|
|
9070
9070
|
// src/swift-objc-sdk.ts
|
|
9071
9071
|
import path6 from "node:path";
|
|
@@ -9089,12 +9089,65 @@ for (const [file, text3] of tree) {
|
|
|
9089
9089
|
}
|
|
9090
9090
|
|
|
9091
9091
|
// src/swift-objc-standin.ts
|
|
9092
|
-
import { execFileSync as execFileSync2, spawnSync as
|
|
9092
|
+
import { execFileSync as execFileSync2, spawnSync as spawnSync4 } from "node:child_process";
|
|
9093
9093
|
import { createHash as createHash6 } from "node:crypto";
|
|
9094
9094
|
import fs3 from "node:fs";
|
|
9095
|
+
import path8 from "node:path";
|
|
9096
|
+
|
|
9097
|
+
// src/swift-objc-platform.ts
|
|
9098
|
+
import { spawnSync as spawnSync3 } from "node:child_process";
|
|
9095
9099
|
import path7 from "node:path";
|
|
9100
|
+
var platforms = /* @__PURE__ */ new Map();
|
|
9101
|
+
function swiftObjCPlatformFlags(toolchainBin, minimum) {
|
|
9102
|
+
const key = `${toolchainBin}:${minimum}`;
|
|
9103
|
+
const cached = platforms.get(key);
|
|
9104
|
+
if (cached) return cached;
|
|
9105
|
+
const version = [
|
|
9106
|
+
Math.floor(minimum / 1e4),
|
|
9107
|
+
Math.floor(minimum % 1e4 / 100),
|
|
9108
|
+
minimum % 100
|
|
9109
|
+
].join(".");
|
|
9110
|
+
const result = spawnSync3(
|
|
9111
|
+
path7.join(toolchainBin, "clang"),
|
|
9112
|
+
[
|
|
9113
|
+
"-target",
|
|
9114
|
+
`arm64-apple-ios${version}-simulator`,
|
|
9115
|
+
"-dM",
|
|
9116
|
+
"-E",
|
|
9117
|
+
"-x",
|
|
9118
|
+
"objective-c",
|
|
9119
|
+
"-"
|
|
9120
|
+
],
|
|
9121
|
+
{
|
|
9122
|
+
input: "",
|
|
9123
|
+
encoding: "utf8",
|
|
9124
|
+
env: swiftEnvironment(),
|
|
9125
|
+
timeout: 3e4,
|
|
9126
|
+
maxBuffer: 1024 * 1024
|
|
9127
|
+
}
|
|
9128
|
+
);
|
|
9129
|
+
if (result.error || result.status !== 0)
|
|
9130
|
+
throw new Error(
|
|
9131
|
+
`could not read iOS compiler platform predefines: ${result.error?.message ?? result.stderr}`
|
|
9132
|
+
);
|
|
9133
|
+
const flags = [
|
|
9134
|
+
...result.stdout.matchAll(
|
|
9135
|
+
/^#define (TARGET_OS_\w+|TARGET_IPHONE_SIMULATOR|__APPLE\w*__|__MACH__|__ENVIRONMENT_\w+) (.*)$/gm
|
|
9136
|
+
)
|
|
9137
|
+
].map(([, name2, value]) => `-D${name2}=${value}`);
|
|
9138
|
+
if (!flags.includes("-D__APPLE__=1") || !flags.includes("-D__MACH__=1"))
|
|
9139
|
+
throw new Error("iOS compiler platform predefines lack Apple and Mach identity");
|
|
9140
|
+
platforms.set(key, flags);
|
|
9141
|
+
return flags;
|
|
9142
|
+
}
|
|
9143
|
+
|
|
9144
|
+
// src/swift-objc-standin.ts
|
|
9096
9145
|
var NATIVE_GRAPH_SDK_VERSION = "27.1";
|
|
9097
|
-
var WASI_EMULATION = [
|
|
9146
|
+
var WASI_EMULATION = [
|
|
9147
|
+
"_WASI_EMULATED_SIGNAL",
|
|
9148
|
+
"_WASI_EMULATED_MMAN",
|
|
9149
|
+
"_WASI_EMULATED_PROCESS_CLOCKS"
|
|
9150
|
+
];
|
|
9098
9151
|
var WASI_EMULATION_FLAGS = WASI_EMULATION.map((name2) => `-D${name2}`);
|
|
9099
9152
|
var NATIVE_GRAPH_INPUTS = {
|
|
9100
9153
|
sdk: NATIVE_GRAPH_SDK_VERSION,
|
|
@@ -9120,13 +9173,13 @@ ${text3}`
|
|
|
9120
9173
|
}
|
|
9121
9174
|
var IOS_SDK_ID = createHash6("sha256").update(JSON.stringify(iosSdkEntries())).digest("hex").slice(0, 16);
|
|
9122
9175
|
function materializeObjcSdk(cacheDir2) {
|
|
9123
|
-
const sdk =
|
|
9176
|
+
const sdk = path8.join(cacheDir2, "ios-sdk", IOS_SDK_ID);
|
|
9124
9177
|
if (fs3.existsSync(sdk)) return sdk;
|
|
9125
|
-
fs3.mkdirSync(
|
|
9178
|
+
fs3.mkdirSync(path8.dirname(sdk), { recursive: true });
|
|
9126
9179
|
const staging = fs3.mkdtempSync(`${sdk}-`);
|
|
9127
9180
|
for (const [file, text3] of iosSdkEntries()) {
|
|
9128
|
-
fs3.mkdirSync(
|
|
9129
|
-
fs3.writeFileSync(
|
|
9181
|
+
fs3.mkdirSync(path8.dirname(path8.join(staging, file)), { recursive: true });
|
|
9182
|
+
fs3.writeFileSync(path8.join(staging, file), text3);
|
|
9130
9183
|
}
|
|
9131
9184
|
try {
|
|
9132
9185
|
fs3.renameSync(staging, sdk);
|
|
@@ -9136,6 +9189,33 @@ function materializeObjcSdk(cacheDir2) {
|
|
|
9136
9189
|
}
|
|
9137
9190
|
return sdk;
|
|
9138
9191
|
}
|
|
9192
|
+
function objcSdkIntakeFlags(headers, toolchainBin, minimum) {
|
|
9193
|
+
return [
|
|
9194
|
+
...swiftObjCPlatformFlags(toolchainBin, minimum),
|
|
9195
|
+
// AvailabilityInternal.h derives this through __is_target_os(ios), which
|
|
9196
|
+
// is false for wasm32.
|
|
9197
|
+
`-D__IPHONE_OS_VERSION_MIN_REQUIRED=${minimum}`,
|
|
9198
|
+
// apple's build setting for a 32-bit target to keep NSInteger and
|
|
9199
|
+
// NSUInteger long, the nominal types they have on arm64.
|
|
9200
|
+
"-DNS_BUILD_32_LIKE_64=1",
|
|
9201
|
+
// the installed libc's default feature set otherwise defines
|
|
9202
|
+
// _XOPEN_SOURCE, which darwin's sys/cdefs.h turns into a strict posix
|
|
9203
|
+
// level; iOS compiles at darwin's full level with neither defined.
|
|
9204
|
+
"-D_BSD_SOURCE",
|
|
9205
|
+
...WASI_EMULATION_FLAGS,
|
|
9206
|
+
"-iframework",
|
|
9207
|
+
path8.join(headers, "System/Library/Frameworks"),
|
|
9208
|
+
"-isystem",
|
|
9209
|
+
path8.join(headers, "wasm/include"),
|
|
9210
|
+
"-idirafter",
|
|
9211
|
+
path8.join(headers, "usr/include")
|
|
9212
|
+
];
|
|
9213
|
+
}
|
|
9214
|
+
function iosDeploymentMinimum(version) {
|
|
9215
|
+
const parts = /^(\d{1,2})(?:\.(\d{1,2}))?(?:\.(\d{1,2}))?$/.exec(version ?? "");
|
|
9216
|
+
if (!parts) return void 0;
|
|
9217
|
+
return Number(parts[1]) * 1e4 + Number(parts[2] ?? 0) * 100 + Number(parts[3] ?? 0);
|
|
9218
|
+
}
|
|
9139
9219
|
var headerFiles = (dir) => fs3.readdirSync(dir, { recursive: true, encoding: "utf8" }).filter((file) => file.endsWith(".h")).sort();
|
|
9140
9220
|
function missingHeader(missing) {
|
|
9141
9221
|
const lines = ["#import <Foundation/Foundation.h>", "#import <UIKit/UIKit.h>"];
|
|
@@ -9158,52 +9238,52 @@ function objcView(surface, toolchainBin, stdlib, cacheDir2, work, original) {
|
|
|
9158
9238
|
`this peach's Swift has no iOS simulator standard library at ${stdlib}`
|
|
9159
9239
|
);
|
|
9160
9240
|
const sdk = materializeObjcSdk(cacheDir2);
|
|
9161
|
-
const framework =
|
|
9162
|
-
const frameworks =
|
|
9163
|
-
const include =
|
|
9164
|
-
const headersDir = framework ?
|
|
9241
|
+
const framework = path8.basename(path8.dirname(surface.modulemap)) === "Modules";
|
|
9242
|
+
const frameworks = path8.join(work, "frameworks");
|
|
9243
|
+
const include = path8.join(work, "include");
|
|
9244
|
+
const headersDir = framework ? path8.join(frameworks, `${surface.module}.framework`, "Headers") : path8.join(include, surface.module);
|
|
9165
9245
|
fs3.mkdirSync(headersDir, { recursive: true });
|
|
9166
9246
|
const originals = new Map(
|
|
9167
9247
|
headerFiles(surface.headers).map((file) => [
|
|
9168
|
-
|
|
9169
|
-
fs3.readFileSync(
|
|
9248
|
+
path8.join(headersDir, file),
|
|
9249
|
+
fs3.readFileSync(path8.join(surface.headers, file), "utf8")
|
|
9170
9250
|
])
|
|
9171
9251
|
);
|
|
9172
9252
|
for (const [file, text3] of originals) {
|
|
9173
|
-
fs3.mkdirSync(
|
|
9253
|
+
fs3.mkdirSync(path8.dirname(file), { recursive: true });
|
|
9174
9254
|
fs3.writeFileSync(file, text3);
|
|
9175
9255
|
}
|
|
9176
9256
|
if (framework) {
|
|
9177
|
-
fs3.mkdirSync(
|
|
9257
|
+
fs3.mkdirSync(path8.join(frameworks, `${surface.module}.framework`, "Modules"), {
|
|
9178
9258
|
recursive: true
|
|
9179
9259
|
});
|
|
9180
9260
|
fs3.copyFileSync(
|
|
9181
9261
|
surface.modulemap,
|
|
9182
|
-
|
|
9262
|
+
path8.join(frameworks, `${surface.module}.framework`, "Modules", "module.modulemap")
|
|
9183
9263
|
);
|
|
9184
9264
|
} else {
|
|
9185
|
-
fs3.copyFileSync(surface.modulemap,
|
|
9265
|
+
fs3.copyFileSync(surface.modulemap, path8.join(headersDir, "module.modulemap"));
|
|
9186
9266
|
}
|
|
9187
9267
|
const dependencyOriginals = /* @__PURE__ */ new Map();
|
|
9188
9268
|
for (const dependency of surface.dependencies ?? []) {
|
|
9189
|
-
const dir =
|
|
9269
|
+
const dir = path8.join(include, dependency.module);
|
|
9190
9270
|
fs3.mkdirSync(dir, { recursive: true });
|
|
9191
9271
|
for (const file of headerFiles(dependency.headers)) {
|
|
9192
|
-
const destination =
|
|
9193
|
-
const text3 = fs3.readFileSync(
|
|
9272
|
+
const destination = path8.join(dir, file);
|
|
9273
|
+
const text3 = fs3.readFileSync(path8.join(dependency.headers, file), "utf8");
|
|
9194
9274
|
dependencyOriginals.set(destination, text3);
|
|
9195
|
-
fs3.mkdirSync(
|
|
9275
|
+
fs3.mkdirSync(path8.dirname(destination), { recursive: true });
|
|
9196
9276
|
fs3.writeFileSync(destination, text3);
|
|
9197
9277
|
}
|
|
9198
|
-
const supplied =
|
|
9278
|
+
const supplied = path8.join(dependency.headers, "module.modulemap");
|
|
9199
9279
|
fs3.writeFileSync(
|
|
9200
|
-
|
|
9280
|
+
path8.join(dir, "module.modulemap"),
|
|
9201
9281
|
fs3.existsSync(supplied) ? fs3.readFileSync(supplied, "utf8") : `module ${dependency.module} { umbrella "." export * }
|
|
9202
9282
|
`
|
|
9203
9283
|
);
|
|
9204
9284
|
}
|
|
9205
|
-
const stubs =
|
|
9206
|
-
const stubIncludes =
|
|
9285
|
+
const stubs = path8.join(work, "stubs");
|
|
9286
|
+
const stubIncludes = path8.join(work, "stub-include");
|
|
9207
9287
|
fs3.mkdirSync(stubs, { recursive: true });
|
|
9208
9288
|
fs3.mkdirSync(stubIncludes, { recursive: true });
|
|
9209
9289
|
const search = [
|
|
@@ -9211,11 +9291,11 @@ function objcView(surface, toolchainBin, stdlib, cacheDir2, work, original) {
|
|
|
9211
9291
|
sdk,
|
|
9212
9292
|
// keep compiler support headers without importing host platform modules.
|
|
9213
9293
|
"-resource-dir",
|
|
9214
|
-
|
|
9294
|
+
path8.join(sdk, "usr/lib/swift"),
|
|
9215
9295
|
"-I",
|
|
9216
|
-
|
|
9296
|
+
path8.resolve(toolchainBin, "../lib/swift/clang/include"),
|
|
9217
9297
|
"-I",
|
|
9218
|
-
|
|
9298
|
+
path8.resolve(toolchainBin, "../lib/swift/shims"),
|
|
9219
9299
|
"-I",
|
|
9220
9300
|
stdlib,
|
|
9221
9301
|
"-F",
|
|
@@ -9226,7 +9306,7 @@ function objcView(surface, toolchainBin, stdlib, cacheDir2, work, original) {
|
|
|
9226
9306
|
headersDir,
|
|
9227
9307
|
...(surface.dependencies ?? []).flatMap((dependency) => [
|
|
9228
9308
|
"-I",
|
|
9229
|
-
|
|
9309
|
+
path8.join(include, dependency.module)
|
|
9230
9310
|
]),
|
|
9231
9311
|
"-F",
|
|
9232
9312
|
stubs,
|
|
@@ -9235,7 +9315,7 @@ function objcView(surface, toolchainBin, stdlib, cacheDir2, work, original) {
|
|
|
9235
9315
|
];
|
|
9236
9316
|
const missing = /* @__PURE__ */ new Map();
|
|
9237
9317
|
const stubbed = /* @__PURE__ */ new Set();
|
|
9238
|
-
const out =
|
|
9318
|
+
const out = path8.join(work, "graphs");
|
|
9239
9319
|
const stub = (include2) => {
|
|
9240
9320
|
if (stubbed.has(include2)) return false;
|
|
9241
9321
|
stubbed.add(include2);
|
|
@@ -9247,22 +9327,22 @@ function objcView(surface, toolchainBin, stdlib, cacheDir2, work, original) {
|
|
|
9247
9327
|
IOS_SDK_HEADERS,
|
|
9248
9328
|
`System/Library/Frameworks/${name2}.framework/Headers/${name2}.h`
|
|
9249
9329
|
)) {
|
|
9250
|
-
const header2 =
|
|
9251
|
-
fs3.mkdirSync(
|
|
9330
|
+
const header2 = path8.join(stubIncludes, include2);
|
|
9331
|
+
fs3.mkdirSync(path8.dirname(header2), { recursive: true });
|
|
9252
9332
|
fs3.writeFileSync(header2, `#import <${umbrella}>
|
|
9253
9333
|
`);
|
|
9254
9334
|
return true;
|
|
9255
9335
|
}
|
|
9256
|
-
const root =
|
|
9257
|
-
const header =
|
|
9258
|
-
fs3.mkdirSync(
|
|
9336
|
+
const root = path8.join(stubs, `${name2}.framework`);
|
|
9337
|
+
const header = path8.join(root, "Headers", include2.slice(slash + 1));
|
|
9338
|
+
fs3.mkdirSync(path8.dirname(header), { recursive: true });
|
|
9259
9339
|
fs3.writeFileSync(
|
|
9260
9340
|
header,
|
|
9261
9341
|
"#import <Foundation/Foundation.h>\n#import <UIKit/UIKit.h>\n"
|
|
9262
9342
|
);
|
|
9263
|
-
fs3.mkdirSync(
|
|
9343
|
+
fs3.mkdirSync(path8.join(root, "Modules"), { recursive: true });
|
|
9264
9344
|
fs3.writeFileSync(
|
|
9265
|
-
|
|
9345
|
+
path8.join(root, "Modules", "module.modulemap"),
|
|
9266
9346
|
`framework module ${name2} {
|
|
9267
9347
|
umbrella "Headers"
|
|
9268
9348
|
export *
|
|
@@ -9271,19 +9351,19 @@ function objcView(surface, toolchainBin, stdlib, cacheDir2, work, original) {
|
|
|
9271
9351
|
`
|
|
9272
9352
|
);
|
|
9273
9353
|
} else {
|
|
9274
|
-
const header =
|
|
9275
|
-
fs3.mkdirSync(
|
|
9354
|
+
const header = path8.join(stubIncludes, include2);
|
|
9355
|
+
fs3.mkdirSync(path8.dirname(header), { recursive: true });
|
|
9276
9356
|
fs3.writeFileSync(header, "");
|
|
9277
9357
|
}
|
|
9278
9358
|
return true;
|
|
9279
9359
|
};
|
|
9280
9360
|
const declareMissing = () => {
|
|
9281
|
-
const root =
|
|
9282
|
-
fs3.mkdirSync(
|
|
9283
|
-
fs3.mkdirSync(
|
|
9284
|
-
fs3.writeFileSync(
|
|
9361
|
+
const root = path8.join(stubs, "PeachMissing.framework");
|
|
9362
|
+
fs3.mkdirSync(path8.join(root, "Headers"), { recursive: true });
|
|
9363
|
+
fs3.mkdirSync(path8.join(root, "Modules"), { recursive: true });
|
|
9364
|
+
fs3.writeFileSync(path8.join(root, "Headers", "PeachMissing.h"), missingHeader(missing));
|
|
9285
9365
|
fs3.writeFileSync(
|
|
9286
|
-
|
|
9366
|
+
path8.join(root, "Modules", "module.modulemap"),
|
|
9287
9367
|
'framework module PeachMissing {\n umbrella header "PeachMissing.h"\n export *\n}\n'
|
|
9288
9368
|
);
|
|
9289
9369
|
for (const [file, text3] of [...originals, ...dependencyOriginals])
|
|
@@ -9300,8 +9380,8 @@ function objcView(surface, toolchainBin, stdlib, cacheDir2, work, original) {
|
|
|
9300
9380
|
for (let round = 0; ; round++) {
|
|
9301
9381
|
fs3.rmSync(out, { recursive: true, force: true });
|
|
9302
9382
|
fs3.mkdirSync(out, { recursive: true });
|
|
9303
|
-
const run2 =
|
|
9304
|
-
|
|
9383
|
+
const run2 = spawnSync4(
|
|
9384
|
+
path8.join(toolchainBin, "swift-symbolgraph-extract"),
|
|
9305
9385
|
[
|
|
9306
9386
|
"-module-name",
|
|
9307
9387
|
surface.module,
|
|
@@ -9310,7 +9390,7 @@ function objcView(surface, toolchainBin, stdlib, cacheDir2, work, original) {
|
|
|
9310
9390
|
...search,
|
|
9311
9391
|
...original?.flags.flatMap((flag) => ["-Xcc", flag]) ?? [],
|
|
9312
9392
|
"-module-cache-path",
|
|
9313
|
-
|
|
9393
|
+
path8.join(cacheDir2, "ios-module-cache"),
|
|
9314
9394
|
"-minimum-access-level",
|
|
9315
9395
|
// symbol graphs hide public underscored names at the public threshold.
|
|
9316
9396
|
// original clang headers remain the declaration boundary.
|
|
@@ -9373,7 +9453,7 @@ function objcView(surface, toolchainBin, stdlib, cacheDir2, work, original) {
|
|
|
9373
9453
|
);
|
|
9374
9454
|
if (missing.size > 0) declareMissing();
|
|
9375
9455
|
}
|
|
9376
|
-
const graphs = fs3.readdirSync(out).filter((name2) => name2.endsWith(".symbols.json")).sort().map((name2) => JSON.parse(fs3.readFileSync(
|
|
9456
|
+
const graphs = fs3.readdirSync(out).filter((name2) => name2.endsWith(".symbols.json")).sort().map((name2) => JSON.parse(fs3.readFileSync(path8.join(out, name2), "utf8")));
|
|
9377
9457
|
const imports = /* @__PURE__ */ new Set(["Foundation", "UIKit"]);
|
|
9378
9458
|
for (const text3 of originals.values())
|
|
9379
9459
|
for (const match of text3.matchAll(
|
|
@@ -9402,7 +9482,7 @@ function objcDeclarationAST(surface, framework, toolchainBin, search, work, orig
|
|
|
9402
9482
|
const roots = [
|
|
9403
9483
|
...fs3.readFileSync(surface.modulemap, "utf8").matchAll(/(?:umbrella\s+)?header\s+"([^"]+)"/g)
|
|
9404
9484
|
].map((match) => match[1]);
|
|
9405
|
-
const probe =
|
|
9485
|
+
const probe = path8.join(work, "declarations.m");
|
|
9406
9486
|
fs3.writeFileSync(
|
|
9407
9487
|
probe,
|
|
9408
9488
|
roots.map(
|
|
@@ -9432,8 +9512,8 @@ function objcDeclarationAST(surface, framework, toolchainBin, search, work, orig
|
|
|
9432
9512
|
"-ast-dump-all=json"
|
|
9433
9513
|
];
|
|
9434
9514
|
const dump = (filter) => {
|
|
9435
|
-
const run2 =
|
|
9436
|
-
|
|
9515
|
+
const run2 = spawnSync4(
|
|
9516
|
+
path8.join(toolchainBin, "clang"),
|
|
9437
9517
|
[
|
|
9438
9518
|
...args,
|
|
9439
9519
|
...filter ? ["-Xclang", "-ast-dump-filter", "-Xclang", filter] : [],
|
|
@@ -9497,7 +9577,7 @@ function enumValues(graphs, surface, framework, toolchainBin, search, work, orig
|
|
|
9497
9577
|
const roots = [
|
|
9498
9578
|
...fs3.readFileSync(surface.modulemap, "utf8").matchAll(/(?:umbrella\s+)?header\s+"([^"]+)"/g)
|
|
9499
9579
|
].map((match) => match[1]);
|
|
9500
|
-
const probe =
|
|
9580
|
+
const probe = path8.join(work, "values.m");
|
|
9501
9581
|
fs3.writeFileSync(
|
|
9502
9582
|
probe,
|
|
9503
9583
|
roots.map(
|
|
@@ -9512,8 +9592,8 @@ function enumValues(graphs, surface, framework, toolchainBin, search, work, orig
|
|
|
9512
9592
|
if (flag === "-sdk") flags.push("-isysroot", dir);
|
|
9513
9593
|
else flags.push(flag, dir);
|
|
9514
9594
|
}
|
|
9515
|
-
const run2 =
|
|
9516
|
-
|
|
9595
|
+
const run2 = spawnSync4(
|
|
9596
|
+
path8.join(toolchainBin, "clang"),
|
|
9517
9597
|
[
|
|
9518
9598
|
"-x",
|
|
9519
9599
|
"objective-c",
|
|
@@ -9526,7 +9606,7 @@ function enumValues(graphs, surface, framework, toolchainBin, search, work, orig
|
|
|
9526
9606
|
original?.target ?? IOS_SDK_TARGET,
|
|
9527
9607
|
...flags,
|
|
9528
9608
|
...original?.flags ?? [],
|
|
9529
|
-
`-fmodules-cache-path=${
|
|
9609
|
+
`-fmodules-cache-path=${path8.join(work, "clang-modules")}`,
|
|
9530
9610
|
"-Xclang",
|
|
9531
9611
|
"-ast-dump=json",
|
|
9532
9612
|
probe
|
|
@@ -9812,8 +9892,8 @@ var swiftEscapes = {
|
|
|
9812
9892
|
r: "\r",
|
|
9813
9893
|
t: " "
|
|
9814
9894
|
};
|
|
9815
|
-
function
|
|
9816
|
-
const
|
|
9895
|
+
function settingsBlocks(call, tool) {
|
|
9896
|
+
const bodies = [];
|
|
9817
9897
|
for (const open of call.matchAll(new RegExp(`\\b${tool}Settings\\s*:\\s*\\[`, "g"))) {
|
|
9818
9898
|
let depth = 1;
|
|
9819
9899
|
let index = open.index + open[0].length;
|
|
@@ -9826,7 +9906,28 @@ function settingDefines(call, tool) {
|
|
|
9826
9906
|
} else if (char === "[") depth++;
|
|
9827
9907
|
else if (char === "]") depth--;
|
|
9828
9908
|
}
|
|
9829
|
-
|
|
9909
|
+
bodies.push(call.slice(start, index - 1));
|
|
9910
|
+
}
|
|
9911
|
+
return bodies;
|
|
9912
|
+
}
|
|
9913
|
+
function settingFeatures(call, setting) {
|
|
9914
|
+
const found = [];
|
|
9915
|
+
for (const body of settingsBlocks(call, "swift")) {
|
|
9916
|
+
if (setting === ".unsafeFlags") {
|
|
9917
|
+
for (const list of body.matchAll(/\.unsafeFlags\(\s*\[([^\]]*)\]/g))
|
|
9918
|
+
for (const match of list[1].matchAll(/"((?:[^"\\]|\\.)*)"/g))
|
|
9919
|
+
found.push(JSON.parse(`"${match[1]}"`));
|
|
9920
|
+
} else {
|
|
9921
|
+
const name2 = "([A-Za-z_][A-Za-z0-9_]*(?:=[A-Za-z_][A-Za-z0-9_.-]*)?)";
|
|
9922
|
+
const pattern = setting === ".enableExperimentalFeature" ? new RegExp(`\\.enableExperimentalFeature\\(\\s*"${name2}"\\s*\\)`, "g") : new RegExp(`\\.enableUpcomingFeature\\(\\s*"${name2}"\\s*\\)`, "g");
|
|
9923
|
+
for (const match of body.matchAll(pattern)) found.push(match[1]);
|
|
9924
|
+
}
|
|
9925
|
+
}
|
|
9926
|
+
return found;
|
|
9927
|
+
}
|
|
9928
|
+
function settingDefines(call, tool) {
|
|
9929
|
+
const defines = [];
|
|
9930
|
+
for (const body of settingsBlocks(call, tool)) {
|
|
9830
9931
|
for (const match of body.matchAll(
|
|
9831
9932
|
/\.define\(\s*"([A-Za-z_][A-Za-z0-9_]*)"\s*(?:,\s*to:\s*"((?:[^"\\]|\\.)*)"\s*)?\)/g
|
|
9832
9933
|
)) {
|
|
@@ -9873,6 +9974,9 @@ function swiftManifestTargets(manifest, resourcePaths = []) {
|
|
|
9873
9974
|
call.replace(/"(?:\\.|[^"\\])*"/g, "")
|
|
9874
9975
|
);
|
|
9875
9976
|
const defines = settingDefines(call, "swift").map((define) => define.split("=")[0]);
|
|
9977
|
+
const experimentalFeatures = settingFeatures(call, ".enableExperimentalFeature");
|
|
9978
|
+
const upcomingFeatures = settingFeatures(call, ".enableUpcomingFeature");
|
|
9979
|
+
const swiftFlags = settingFeatures(call, ".unsafeFlags");
|
|
9876
9980
|
const cDefines = settingDefines(call, "c");
|
|
9877
9981
|
const cxxDefines = settingDefines(call, "cxx");
|
|
9878
9982
|
const linkedLibraries = [...call.matchAll(/\.linkedLibrary\(\s*"([^"]+)"\s*\)/g)].map(
|
|
@@ -9917,6 +10021,9 @@ function swiftManifestTargets(manifest, resourcePaths = []) {
|
|
|
9917
10021
|
mainActorIsolation,
|
|
9918
10022
|
...cxxInterop ? { cxxInterop: true } : {},
|
|
9919
10023
|
...defines.length === 0 ? {} : { defines },
|
|
10024
|
+
...experimentalFeatures.length === 0 ? {} : { experimentalFeatures },
|
|
10025
|
+
...upcomingFeatures.length === 0 ? {} : { upcomingFeatures },
|
|
10026
|
+
...swiftFlags.length === 0 ? {} : { swiftFlags },
|
|
9920
10027
|
...cDefines.length === 0 ? {} : { cDefines },
|
|
9921
10028
|
...cxxDefines.length === 0 ? {} : { cxxDefines },
|
|
9922
10029
|
...linkedLibraries.length === 0 ? {} : { linkedLibraries },
|
|
@@ -10004,13 +10111,13 @@ function swiftObjCResourceAccessor(bundleName) {
|
|
|
10004
10111
|
}
|
|
10005
10112
|
function swiftPackagePartition(manifest, resourcePaths = []) {
|
|
10006
10113
|
const targets = swiftManifestTargets(manifest, resourcePaths);
|
|
10007
|
-
return targets.length === 1 && targets[0].executable && targets[0].path === "." && targets[0].languageMode === 5 && !targets[0].mainActorIsolation && !targets[0].defines?.length && !targets[0].linkedLibraries?.length && !targets[0].cxxInterop && !swiftManifestCxxLanguageStandard(manifest) ? [] : targets;
|
|
10114
|
+
return targets.length === 1 && targets[0].executable && targets[0].path === "." && targets[0].languageMode === 5 && !targets[0].mainActorIsolation && !targets[0].defines?.length && !targets[0].experimentalFeatures?.length && !targets[0].upcomingFeatures?.length && !targets[0].swiftFlags?.length && !targets[0].linkedLibraries?.length && !targets[0].cxxInterop && !swiftManifestCxxLanguageStandard(manifest) ? [] : targets;
|
|
10008
10115
|
}
|
|
10009
10116
|
|
|
10010
10117
|
// src/swift-root-lock.ts
|
|
10011
10118
|
import {
|
|
10012
10119
|
spawn as spawn2,
|
|
10013
|
-
spawnSync as
|
|
10120
|
+
spawnSync as spawnSync6
|
|
10014
10121
|
} from "node:child_process";
|
|
10015
10122
|
import { createHash as createHash8, randomUUID as randomUUID2 } from "node:crypto";
|
|
10016
10123
|
import {
|
|
@@ -10021,7 +10128,7 @@ import {
|
|
|
10021
10128
|
rmSync as rmSync2,
|
|
10022
10129
|
writeFileSync as writeFileSync2
|
|
10023
10130
|
} from "node:fs";
|
|
10024
|
-
import
|
|
10131
|
+
import path10 from "node:path";
|
|
10025
10132
|
var POLL_MS = 250;
|
|
10026
10133
|
var START_TOLERANCE_MS = 2e3;
|
|
10027
10134
|
function errorCode(error) {
|
|
@@ -10033,7 +10140,7 @@ function parseStart(text3) {
|
|
|
10033
10140
|
return start;
|
|
10034
10141
|
}
|
|
10035
10142
|
function processTable() {
|
|
10036
|
-
const result =
|
|
10143
|
+
const result = spawnSync6("ps", ["-A", "-o", "pid=,pgid=,stat=,lstart="], {
|
|
10037
10144
|
encoding: "utf8",
|
|
10038
10145
|
env: { ...process.env, LC_ALL: "C", TZ: "UTC" },
|
|
10039
10146
|
stdio: ["ignore", "pipe", "pipe"],
|
|
@@ -10096,7 +10203,7 @@ function generationNumbers(directory) {
|
|
|
10096
10203
|
function readGeneration(directory, number) {
|
|
10097
10204
|
let owner;
|
|
10098
10205
|
try {
|
|
10099
|
-
owner = readFileSync5(
|
|
10206
|
+
owner = readFileSync5(path10.join(directory, name(number, "owner")), "utf8");
|
|
10100
10207
|
} catch (error) {
|
|
10101
10208
|
if (errorCode(error) === "ENOENT") return null;
|
|
10102
10209
|
throw error;
|
|
@@ -10109,7 +10216,7 @@ function readGeneration(directory, number) {
|
|
|
10109
10216
|
}
|
|
10110
10217
|
function readChildren(directory, number) {
|
|
10111
10218
|
const prefix = name(number, "child.");
|
|
10112
|
-
return readdirSync3(directory).filter((entry) => entry.startsWith(prefix)).map((entry) => parseIdentity(readFileSync5(
|
|
10219
|
+
return readdirSync3(directory).filter((entry) => entry.startsWith(prefix)).map((entry) => parseIdentity(readFileSync5(path10.join(directory, entry), "utf8")));
|
|
10113
10220
|
}
|
|
10114
10221
|
function groupAlive(table, leader) {
|
|
10115
10222
|
const row = table.find((candidate) => candidate.pid === leader.pid);
|
|
@@ -10117,7 +10224,7 @@ function groupAlive(table, leader) {
|
|
|
10117
10224
|
return table.some((candidate) => candidate.pgid === leader.pid && !candidate.zombie);
|
|
10118
10225
|
}
|
|
10119
10226
|
async function withSwiftRootLock(root, work, signal) {
|
|
10120
|
-
const directory =
|
|
10227
|
+
const directory = path10.join(
|
|
10121
10228
|
rnxHomeDir(),
|
|
10122
10229
|
"cache",
|
|
10123
10230
|
"swift-root-locks",
|
|
@@ -10126,7 +10233,7 @@ async function withSwiftRootLock(root, work, signal) {
|
|
|
10126
10233
|
mkdirSync(directory, { recursive: true });
|
|
10127
10234
|
const token = randomUUID2();
|
|
10128
10235
|
const owner = JSON.stringify(ownIdentity(process.pid));
|
|
10129
|
-
const pending =
|
|
10236
|
+
const pending = path10.join(directory, `pending.${token}`);
|
|
10130
10237
|
let held = 0;
|
|
10131
10238
|
for (; ; ) {
|
|
10132
10239
|
signal?.throwIfAborted();
|
|
@@ -10147,7 +10254,7 @@ async function withSwiftRootLock(root, work, signal) {
|
|
|
10147
10254
|
}
|
|
10148
10255
|
writeFileSync2(pending, owner);
|
|
10149
10256
|
try {
|
|
10150
|
-
linkSync(pending,
|
|
10257
|
+
linkSync(pending, path10.join(directory, name(newest + 1, "owner")));
|
|
10151
10258
|
} catch (error) {
|
|
10152
10259
|
if (errorCode(error) === "EEXIST") continue;
|
|
10153
10260
|
throw error;
|
|
@@ -10156,7 +10263,7 @@ async function withSwiftRootLock(root, work, signal) {
|
|
|
10156
10263
|
}
|
|
10157
10264
|
const numbers = generationNumbers(directory);
|
|
10158
10265
|
if (numbers.at(-1) !== newest + 1) {
|
|
10159
|
-
rmSync2(
|
|
10266
|
+
rmSync2(path10.join(directory, name(newest + 1, "owner")), { force: true });
|
|
10160
10267
|
continue;
|
|
10161
10268
|
}
|
|
10162
10269
|
held = newest + 1;
|
|
@@ -10164,7 +10271,7 @@ async function withSwiftRootLock(root, work, signal) {
|
|
|
10164
10271
|
if (number < held) {
|
|
10165
10272
|
for (const entry of readdirSync3(directory))
|
|
10166
10273
|
if (entry.startsWith(name(number, "")))
|
|
10167
|
-
rmSync2(
|
|
10274
|
+
rmSync2(path10.join(directory, entry), { force: true });
|
|
10168
10275
|
}
|
|
10169
10276
|
break;
|
|
10170
10277
|
}
|
|
@@ -10188,7 +10295,7 @@ async function withSwiftRootLock(root, work, signal) {
|
|
|
10188
10295
|
const childPending = `${pending}.child.${child.pid}`;
|
|
10189
10296
|
try {
|
|
10190
10297
|
writeFileSync2(childPending, JSON.stringify(ownIdentity(child.pid)));
|
|
10191
|
-
linkSync(childPending,
|
|
10298
|
+
linkSync(childPending, path10.join(directory, name(held, `child.${child.pid}`)));
|
|
10192
10299
|
} finally {
|
|
10193
10300
|
rmSync2(childPending, { force: true });
|
|
10194
10301
|
}
|
|
@@ -10204,7 +10311,7 @@ async function withSwiftRootLock(root, work, signal) {
|
|
|
10204
10311
|
return await work(lease);
|
|
10205
10312
|
} finally {
|
|
10206
10313
|
await Promise.all(children.map((child) => terminateProcessGroup(child, "SIGKILL", 0)));
|
|
10207
|
-
writeFileSync2(
|
|
10314
|
+
writeFileSync2(path10.join(directory, name(held, "released")), "");
|
|
10208
10315
|
}
|
|
10209
10316
|
}
|
|
10210
10317
|
|
|
@@ -10260,7 +10367,7 @@ function isSwiftResourceBundles(value) {
|
|
|
10260
10367
|
|
|
10261
10368
|
// src/xcode-header-search.ts
|
|
10262
10369
|
import fs5 from "node:fs";
|
|
10263
|
-
import
|
|
10370
|
+
import path11 from "node:path";
|
|
10264
10371
|
function headerMap(entries) {
|
|
10265
10372
|
const unique = /* @__PURE__ */ new Map();
|
|
10266
10373
|
for (const entry of entries)
|
|
@@ -10307,11 +10414,11 @@ function writeXcodeHeaderSearch(directory, targets) {
|
|
|
10307
10414
|
const productDirectories = /* @__PURE__ */ new Map();
|
|
10308
10415
|
for (const target of targets)
|
|
10309
10416
|
for (const [product, file] of Object.entries(target.productHeaders)) {
|
|
10310
|
-
const listed = productDirectories.get(
|
|
10311
|
-
productDirectories.set(
|
|
10312
|
-
listed.push({ name:
|
|
10417
|
+
const listed = productDirectories.get(path11.dirname(product)) ?? [];
|
|
10418
|
+
productDirectories.set(path11.dirname(product), listed);
|
|
10419
|
+
listed.push({ name: path11.basename(product), file });
|
|
10313
10420
|
}
|
|
10314
|
-
const overlay =
|
|
10421
|
+
const overlay = path11.join(directory, "all-product-headers.yaml");
|
|
10315
10422
|
fs5.writeFileSync(
|
|
10316
10423
|
overlay,
|
|
10317
10424
|
JSON.stringify({
|
|
@@ -10331,7 +10438,7 @@ function writeXcodeHeaderSearch(directory, targets) {
|
|
|
10331
10438
|
const files = [overlay];
|
|
10332
10439
|
const flags = targets.map((target, index) => {
|
|
10333
10440
|
const maps = target.headerMaps.map((map2, order) => {
|
|
10334
|
-
const file =
|
|
10441
|
+
const file = path11.join(directory, `${index}-${order}.hmap`);
|
|
10335
10442
|
fs5.writeFileSync(file, headerMap(map2.entries));
|
|
10336
10443
|
files.push(file);
|
|
10337
10444
|
return { flag: map2.flag, file };
|
|
@@ -10448,7 +10555,7 @@ function swiftBuilderHopTimeoutMs(compileTimeoutMs) {
|
|
|
10448
10555
|
return (compileTimeoutMs ?? SWIFT_BUILDER_DEFAULT_COMPILE_MS) + SWIFT_BUILDER_TRANSPORT_MARGIN_MS;
|
|
10449
10556
|
}
|
|
10450
10557
|
function swiftDistributionAt(root) {
|
|
10451
|
-
const file =
|
|
10558
|
+
const file = path12.join(root, SWIFT_DISTRIBUTION_MANIFEST);
|
|
10452
10559
|
if (!existsSync2(file)) return null;
|
|
10453
10560
|
return parseSwiftDistributionManifest(JSON.parse(readFileSync6(file, "utf8")));
|
|
10454
10561
|
}
|
|
@@ -10477,7 +10584,7 @@ function swiftModuleInputFiles(root) {
|
|
|
10477
10584
|
"toolchain.json"
|
|
10478
10585
|
];
|
|
10479
10586
|
const walk = (dir) => {
|
|
10480
|
-
for (const entry of readdirSync4(
|
|
10587
|
+
for (const entry of readdirSync4(path12.join(root, dir), {
|
|
10481
10588
|
withFileTypes: true
|
|
10482
10589
|
})) {
|
|
10483
10590
|
const relative = `${dir}/${entry.name}`;
|
|
@@ -10495,32 +10602,32 @@ function swiftMacroPlugins(moduleRoot) {
|
|
|
10495
10602
|
const distribution = swiftDistributionAt(moduleRoot);
|
|
10496
10603
|
if (distribution)
|
|
10497
10604
|
return {
|
|
10498
|
-
libraries: distribution.plugins.map((plugin) =>
|
|
10605
|
+
libraries: distribution.plugins.map((plugin) => path12.join(moduleRoot, plugin)),
|
|
10499
10606
|
stale: false
|
|
10500
10607
|
};
|
|
10501
|
-
const dir =
|
|
10608
|
+
const dir = path12.join(moduleRoot, ".build/host/RnxPreviewMacros");
|
|
10502
10609
|
const release = JSON.parse(
|
|
10503
|
-
readFileSync6(
|
|
10610
|
+
readFileSync6(path12.join(moduleRoot, "toolchain.json"), "utf8")
|
|
10504
10611
|
).release;
|
|
10505
|
-
const compilerStamp =
|
|
10612
|
+
const compilerStamp = path12.join(dir, "compiler-release");
|
|
10506
10613
|
const ext = process.platform === "darwin" ? "dylib" : "so";
|
|
10507
10614
|
const plugins = [
|
|
10508
10615
|
{
|
|
10509
|
-
library:
|
|
10510
|
-
sources: [
|
|
10616
|
+
library: path12.join(dir, `libRnxPreviewMacros.${ext}`),
|
|
10617
|
+
sources: [path12.join(moduleRoot, "Sources/RnxPreviewMacros/PreviewMacro.swift")]
|
|
10511
10618
|
},
|
|
10512
10619
|
{
|
|
10513
|
-
library:
|
|
10620
|
+
library: path12.join(dir, `libFoundationMacros.${ext}`),
|
|
10514
10621
|
sources: [
|
|
10515
|
-
|
|
10516
|
-
|
|
10622
|
+
path12.join(moduleRoot, "Sources/FoundationMacros/PredicateMacro.swift"),
|
|
10623
|
+
path12.join(moduleRoot, "Sources/SwiftMacroSupport/PredicateExpression.swift")
|
|
10517
10624
|
]
|
|
10518
10625
|
},
|
|
10519
10626
|
{
|
|
10520
|
-
library:
|
|
10627
|
+
library: path12.join(dir, `libTipKitMacros.${ext}`),
|
|
10521
10628
|
sources: [
|
|
10522
|
-
|
|
10523
|
-
|
|
10629
|
+
path12.join(moduleRoot, "Sources/TipKitMacros/TipKitMacros.swift"),
|
|
10630
|
+
path12.join(moduleRoot, "Sources/SwiftMacroSupport/PredicateExpression.swift")
|
|
10524
10631
|
]
|
|
10525
10632
|
}
|
|
10526
10633
|
];
|
|
@@ -10537,14 +10644,14 @@ async function ensureMacroPlugins(moduleRoot, toolchainBin, release, signal) {
|
|
|
10537
10644
|
await runCompiler(
|
|
10538
10645
|
"sh",
|
|
10539
10646
|
[
|
|
10540
|
-
|
|
10647
|
+
path12.join(moduleRoot, "scripts/build-preview-plugin.sh"),
|
|
10541
10648
|
toolchainBin,
|
|
10542
10649
|
libraries[0]
|
|
10543
10650
|
],
|
|
10544
10651
|
{ signal }
|
|
10545
10652
|
);
|
|
10546
10653
|
writeFileSync3(
|
|
10547
|
-
|
|
10654
|
+
path12.join(path12.dirname(libraries[0]), "compiler-release"),
|
|
10548
10655
|
`${release}
|
|
10549
10656
|
`
|
|
10550
10657
|
);
|
|
@@ -10560,7 +10667,7 @@ function swiftModuleDigest(root) {
|
|
|
10560
10667
|
const files = swiftModuleInputFiles(root);
|
|
10561
10668
|
const stampHash = createHash9("sha256");
|
|
10562
10669
|
for (const file of files) {
|
|
10563
|
-
const stat = statSync(
|
|
10670
|
+
const stat = statSync(path12.join(root, file), { bigint: true });
|
|
10564
10671
|
stampHash.update(file);
|
|
10565
10672
|
stampHash.update(
|
|
10566
10673
|
`${stat.dev}:${stat.ino}:${stat.size}:${stat.mtimeNs}:${stat.ctimeNs}
|
|
@@ -10574,7 +10681,7 @@ function swiftModuleDigest(root) {
|
|
|
10574
10681
|
for (const file of files) {
|
|
10575
10682
|
hash2.update(createHash9("sha256").update(file).digest());
|
|
10576
10683
|
hash2.update(
|
|
10577
|
-
createHash9("sha256").update(readFileSync6(
|
|
10684
|
+
createHash9("sha256").update(readFileSync6(path12.join(root, file))).digest()
|
|
10578
10685
|
);
|
|
10579
10686
|
}
|
|
10580
10687
|
const digest = hash2.digest();
|
|
@@ -10598,7 +10705,7 @@ function withNativeSourceGlue(input, glue) {
|
|
|
10598
10705
|
...input,
|
|
10599
10706
|
files: {
|
|
10600
10707
|
...input.files,
|
|
10601
|
-
[
|
|
10708
|
+
[path12.posix.join(targetPath, "OneNativeSource.generated.swift")]: glue
|
|
10602
10709
|
},
|
|
10603
10710
|
oneModule: true
|
|
10604
10711
|
};
|
|
@@ -10723,7 +10830,7 @@ function swiftImportNames(contents, available) {
|
|
|
10723
10830
|
function swiftPeachModules(moduleRoot) {
|
|
10724
10831
|
const distribution = swiftDistributionAt(moduleRoot);
|
|
10725
10832
|
return distribution ? distribution.modules : [
|
|
10726
|
-
...readFileSync6(
|
|
10833
|
+
...readFileSync6(path12.join(moduleRoot, "Package.swift"), "utf8").matchAll(
|
|
10727
10834
|
/\.(?:target|systemLibrary)\(\s*name:\s*"([^"]+)"/g
|
|
10728
10835
|
)
|
|
10729
10836
|
].map((match) => match[1]);
|
|
@@ -10735,7 +10842,7 @@ function swiftSdkPaths(moduleRoot, toolchainBin) {
|
|
|
10735
10842
|
const cached = sdkPaths.get(key);
|
|
10736
10843
|
if (cached) return cached;
|
|
10737
10844
|
const configuration = execFileSync3(
|
|
10738
|
-
|
|
10845
|
+
path12.join(toolchainBin, "swift"),
|
|
10739
10846
|
[
|
|
10740
10847
|
"sdk",
|
|
10741
10848
|
"configure",
|
|
@@ -10766,12 +10873,12 @@ function swiftAvailableModules(moduleRoot, toolchainBin) {
|
|
|
10766
10873
|
if (cached) return cached;
|
|
10767
10874
|
const modules = new Set(swiftPeachModules(moduleRoot));
|
|
10768
10875
|
const { resources } = swiftSdkPaths(moduleRoot, toolchainBin);
|
|
10769
|
-
for (const entry of readdirSync4(
|
|
10876
|
+
for (const entry of readdirSync4(path12.join(resources, "wasi"))) {
|
|
10770
10877
|
if (entry.endsWith(".swiftmodule"))
|
|
10771
10878
|
modules.add(entry.slice(0, -".swiftmodule".length));
|
|
10772
10879
|
}
|
|
10773
10880
|
for (const entry of readdirSync4(resources)) {
|
|
10774
|
-
const map2 =
|
|
10881
|
+
const map2 = path12.join(resources, entry, "module.modulemap");
|
|
10775
10882
|
if (!existsSync2(map2)) continue;
|
|
10776
10883
|
for (const match of readFileSync6(map2, "utf8").matchAll(/^module\s+([A-Za-z_]\w*)/gm))
|
|
10777
10884
|
modules.add(match[1]);
|
|
@@ -10779,12 +10886,14 @@ function swiftAvailableModules(moduleRoot, toolchainBin) {
|
|
|
10779
10886
|
availableModules.set(key, modules);
|
|
10780
10887
|
return modules;
|
|
10781
10888
|
}
|
|
10782
|
-
function missingSwiftModules(files, available) {
|
|
10889
|
+
function missingSwiftModules(files, available, providedByFile = () => []) {
|
|
10783
10890
|
const missing = /* @__PURE__ */ new Map();
|
|
10784
10891
|
for (const [file, contents] of Object.entries(files)) {
|
|
10785
10892
|
if (!file.endsWith(".swift") || file === "Package.swift") continue;
|
|
10786
|
-
|
|
10787
|
-
|
|
10893
|
+
const extra = providedByFile(file);
|
|
10894
|
+
const scoped = extra.length === 0 ? available : /* @__PURE__ */ new Set([...available, ...extra]);
|
|
10895
|
+
for (const name2 of new Set(swiftImportNames(contents, scoped))) {
|
|
10896
|
+
if (scoped.has(name2)) continue;
|
|
10788
10897
|
missing.set(name2, [...missing.get(name2) ?? [], file]);
|
|
10789
10898
|
}
|
|
10790
10899
|
}
|
|
@@ -10837,7 +10946,7 @@ var EXECUTABLE_LINK_FLAGS = ` "-Xclang-linker", "-O0",
|
|
|
10837
10946
|
`;
|
|
10838
10947
|
var REACTOR_FLAG = '"-Xclang-linker", "-mexec-model=reactor",\n';
|
|
10839
10948
|
var MULTI_MANIFEST_VERSION = 40;
|
|
10840
|
-
var compilerSourceDigest = true ? "
|
|
10949
|
+
var compilerSourceDigest = true ? "25e399c85c279ad057ea8e9dac685fe538c7bda43eb7708cf1a32edcb229391d" : swiftCompilerSourceDigest(import.meta.dirname);
|
|
10841
10950
|
function swiftArtifactHash(input, release, moduleRoot) {
|
|
10842
10951
|
const hash2 = createHash9("sha256");
|
|
10843
10952
|
hash2.update(`swift-compile
|
|
@@ -10933,11 +11042,11 @@ function emitSwiftPackageManifest(args) {
|
|
|
10933
11042
|
distributionLink.files.set(
|
|
10934
11043
|
distributionLink.path,
|
|
10935
11044
|
objects.map(
|
|
10936
|
-
(object) => `"${
|
|
11045
|
+
(object) => `"${path12.join(moduleRoot, object).replaceAll("\\", "\\\\").replaceAll('"', '\\"')}"`
|
|
10937
11046
|
).join("\n") + "\n"
|
|
10938
11047
|
);
|
|
10939
11048
|
}
|
|
10940
|
-
const overlayRoot =
|
|
11049
|
+
const overlayRoot = path12.join(
|
|
10941
11050
|
moduleRoot,
|
|
10942
11051
|
distribution ? "modules" : "cross-import-overlays"
|
|
10943
11052
|
);
|
|
@@ -10945,9 +11054,9 @@ function emitSwiftPackageManifest(args) {
|
|
|
10945
11054
|
"-Xfrontend",
|
|
10946
11055
|
"-swift-module-cross-import",
|
|
10947
11056
|
"-Xfrontend",
|
|
10948
|
-
|
|
11057
|
+
path12.basename(path12.dirname(file), ".swiftcrossimport"),
|
|
10949
11058
|
"-Xfrontend",
|
|
10950
|
-
|
|
11059
|
+
path12.join(overlayRoot, file)
|
|
10951
11060
|
]).map((flag) => `, ${JSON.stringify(flag)}`).join("");
|
|
10952
11061
|
const executable = targets.find((target) => target.executable);
|
|
10953
11062
|
if (!executable) throw new Error("swift-compile: no executable target to emit");
|
|
@@ -10962,7 +11071,10 @@ function emitSwiftPackageManifest(args) {
|
|
|
10962
11071
|
const interoperability = target.cxxInterop ? " .interoperabilityMode(.Cxx)," : "";
|
|
10963
11072
|
const exports = args.objcExports?.modules.has(target.name) || args.objcExports?.rootModule === target.name ? ' .enableExperimentalFeature("Extern"),' : "";
|
|
10964
11073
|
const defines = (target.defines ?? []).map((name2) => ` .define(${JSON.stringify(name2)}),`).join("");
|
|
10965
|
-
const
|
|
11074
|
+
const features = (target.experimentalFeatures ?? []).map((name2) => ` .enableExperimentalFeature(${JSON.stringify(name2)}),`).join("");
|
|
11075
|
+
const upcoming = (target.upcomingFeatures ?? []).map((name2) => ` .enableUpcomingFeature(${JSON.stringify(name2)}),`).join("");
|
|
11076
|
+
const upstream = (target.swiftFlags ?? []).map((flag) => `, ${JSON.stringify(flag)}`).join("");
|
|
11077
|
+
const imports = distribution ? `, "-I", ${JSON.stringify(path12.join(moduleRoot, "modules"))}` : "";
|
|
10966
11078
|
const native = args.native?.get(target.name);
|
|
10967
11079
|
const clang = native && !native.mixed;
|
|
10968
11080
|
const nativeImports = (siblings.get(target.name) ?? []).filter((name2) => args.native?.has(name2) && !args.native.get(name2)?.mixed).map(
|
|
@@ -10982,8 +11094,8 @@ function emitSwiftPackageManifest(args) {
|
|
|
10982
11094
|
const nativeImportFlags = [...importContext].flatMap((name2) => args.native?.get(name2)?.clang?.importFlags ?? []).map((flag) => `, "-Xcc", ${JSON.stringify(flag)}`).join("");
|
|
10983
11095
|
const header = args.headerDirectory && [...args.native?.values() ?? []].some(
|
|
10984
11096
|
(value) => value.late?.producers.includes(target.name)
|
|
10985
|
-
) ? `, "-emit-objc-header-path", ${JSON.stringify(
|
|
10986
|
-
const swiftSettings = `swiftSettings: [.swiftLanguageMode(.v${target.languageMode}),${isolation}${interoperability}${defines}${exports} .unsafeFlags(["-Osize", "-Xfrontend", "-enable-cross-import-overlays"${overlayFlags}${FOUNDATION_IMPLICIT_FLAGS}${oneModule ? ONE_IMPLICIT_FLAGS : ""}${imports}${nativeImports}${nativeImportFlags}${header}])]`;
|
|
11097
|
+
) ? `, "-emit-objc-header-path", ${JSON.stringify(path12.join(args.headerDirectory, `${target.name}-${args.objcExports?.modules.has(target.name) ? "Cxx" : "Swift"}.h`))}` : "";
|
|
11098
|
+
const swiftSettings = `swiftSettings: [.swiftLanguageMode(.v${target.languageMode}),${isolation}${interoperability}${defines}${features}${upcoming}${exports} .unsafeFlags(["-Osize", "-Xfrontend", "-enable-cross-import-overlays"${overlayFlags}${FOUNDATION_IMPLICIT_FLAGS}${oneModule ? ONE_IMPLICIT_FLAGS : ""}${imports}${nativeImports}${nativeImportFlags}${header}${upstream}])]`;
|
|
10987
11099
|
const deps = [
|
|
10988
11100
|
.../* @__PURE__ */ new Set([
|
|
10989
11101
|
...target.executable ? [
|
|
@@ -11034,11 +11146,11 @@ function emitSwiftPackageManifest(args) {
|
|
|
11034
11146
|
const cDefines = macroSettings(target.cDefines);
|
|
11035
11147
|
const cxxDefines = macroSettings(target.cxxDefines);
|
|
11036
11148
|
const nativeSettings = native?.clang ? [
|
|
11037
|
-
`cSettings: [${cDefines} .unsafeFlags(${JSON.stringify([...args.
|
|
11038
|
-
`cxxSettings: [${cxxDefines} .unsafeFlags(${JSON.stringify(["-fno-cxx-modules", ...args.
|
|
11149
|
+
`cSettings: [${cDefines} .unsafeFlags(${JSON.stringify([...args.nativeFlags?.get(target.name) ?? [], ...native.clang.flags])})]`,
|
|
11150
|
+
`cxxSettings: [${cxxDefines} .unsafeFlags(${JSON.stringify(["-fno-cxx-modules", ...args.nativeFlags?.get(target.name) ?? [], ...native.clang.cxxFlags])})]`
|
|
11039
11151
|
].join(", ") : [
|
|
11040
|
-
`cSettings: [${cDefines} .unsafeFlags(${JSON.stringify([...args.
|
|
11041
|
-
`cxxSettings: [${cxxDefines} .unsafeFlags(${JSON.stringify(["-fno-cxx-modules", ...args.
|
|
11152
|
+
`cSettings: [${cDefines} .unsafeFlags(${JSON.stringify([...args.nativeFlags?.get(target.name) ?? [], ...native?.flags ?? []])})]`,
|
|
11153
|
+
`cxxSettings: [${cxxDefines} .unsafeFlags(${JSON.stringify(["-fno-cxx-modules", ...args.nativeFlags?.get(target.name) ?? [], ...native?.cxxFlags ?? []])})]`
|
|
11042
11154
|
].join(", ");
|
|
11043
11155
|
return [
|
|
11044
11156
|
` ${kind}(`,
|
|
@@ -11047,8 +11159,8 @@ function emitSwiftPackageManifest(args) {
|
|
|
11047
11159
|
` path: ${JSON.stringify(native?.clang ? "." : target.path)},`,
|
|
11048
11160
|
...native ? [` exclude: ${JSON.stringify(native.exclude ?? native.lateSources)},`] : [],
|
|
11049
11161
|
...native?.clang ? [
|
|
11050
|
-
` sources: ${JSON.stringify(native.clang.sources.map((source) =>
|
|
11051
|
-
` publicHeadersPath: ${JSON.stringify(
|
|
11162
|
+
` sources: ${JSON.stringify(native.clang.sources.map((source) => path12.posix.join(native.path, source)))},`,
|
|
11163
|
+
` publicHeadersPath: ${JSON.stringify(path12.posix.dirname(native.clang.modulemap))},`
|
|
11052
11164
|
] : native?.flags ? [` sources: ${JSON.stringify(native.sources)},`] : [],
|
|
11053
11165
|
// the native backend supplies dependency module maps without their
|
|
11054
11166
|
// compiled modules. textual c++ includes keep those dependencies usable.
|
|
@@ -11073,7 +11185,7 @@ function emitSwiftPackageManifest(args) {
|
|
|
11073
11185
|
' path: "PeachObjCExports",',
|
|
11074
11186
|
` sources: ${JSON.stringify(["root.m", ...[...args.objcExports.modules].map((name2) => `${name2}.m`)])},`,
|
|
11075
11187
|
' publicHeadersPath: "include",',
|
|
11076
|
-
` cSettings: [.unsafeFlags(${JSON.stringify([...args.objcExports.
|
|
11188
|
+
` cSettings: [.unsafeFlags(${JSON.stringify([...args.nativeFlags.get(args.objcExports.rootModule).filter((flag) => flag !== "-fobjc-arc"), "-fno-objc-arc", "-Xclang", "-disable-objc-default-synthesize-properties"])})]),`
|
|
11077
11189
|
] : [],
|
|
11078
11190
|
...[...args.native?.entries() ?? []].flatMap(([name2, native]) => {
|
|
11079
11191
|
const late = native.late;
|
|
@@ -11089,10 +11201,10 @@ function emitSwiftPackageManifest(args) {
|
|
|
11089
11201
|
` .target(name: ${JSON.stringify(group.name)},`,
|
|
11090
11202
|
` dependencies: ${JSON.stringify(native.mixed ? [] : [name2, ...late.producers])},`,
|
|
11091
11203
|
` path: ${JSON.stringify(native.clang ? "." : native.path)},`,
|
|
11092
|
-
` sources: ${JSON.stringify(native.clang ? group.sources.map((source) =>
|
|
11093
|
-
` publicHeadersPath: ${JSON.stringify(native.clang ?
|
|
11094
|
-
` cSettings: [${macroSettings(owner?.cDefines)} .unsafeFlags(${JSON.stringify([...args.
|
|
11095
|
-
` cxxSettings: [${macroSettings(owner?.cxxDefines)} .unsafeFlags(${JSON.stringify(["-fno-cxx-modules", ...args.
|
|
11204
|
+
` sources: ${JSON.stringify(native.clang ? group.sources.map((source) => path12.posix.join(native.path, source)) : group.sources)},`,
|
|
11205
|
+
` publicHeadersPath: ${JSON.stringify(native.clang ? path12.posix.dirname(native.clang.modulemap) : "include")},`,
|
|
11206
|
+
` cSettings: [${macroSettings(owner?.cDefines)} .unsafeFlags(${JSON.stringify([...args.nativeFlags?.get(name2) ?? [], ...group.flags])})],`,
|
|
11207
|
+
` cxxSettings: [${macroSettings(owner?.cxxDefines)} .unsafeFlags(${JSON.stringify(["-fno-cxx-modules", ...args.nativeFlags?.get(name2) ?? [], "-I", native.includeDirectory, "-I", args.headerDirectory, ...group.cxxFlags])})]),`
|
|
11096
11208
|
]) : [];
|
|
11097
11209
|
}),
|
|
11098
11210
|
args.cxxLanguageStandard ? ` ],
|
|
@@ -11105,7 +11217,7 @@ function syncSwiftTree(base, files) {
|
|
|
11105
11217
|
mkdirSync2(base, { recursive: true });
|
|
11106
11218
|
const walk = (dir) => {
|
|
11107
11219
|
for (const entry of readdirSync4(dir, { withFileTypes: true })) {
|
|
11108
|
-
const full =
|
|
11220
|
+
const full = path12.join(dir, entry.name);
|
|
11109
11221
|
if (dir === base && entry.name === ".build") continue;
|
|
11110
11222
|
if (entry.isDirectory()) walk(full);
|
|
11111
11223
|
else if (!files.has(full)) rmSync3(full, { force: true });
|
|
@@ -11115,7 +11227,7 @@ function syncSwiftTree(base, files) {
|
|
|
11115
11227
|
for (const [full, contents] of files) {
|
|
11116
11228
|
if (existsSync2(full) && (typeof contents === "string" ? readFileSync6(full, "utf8") === contents : readFileSync6(full).equals(contents)))
|
|
11117
11229
|
continue;
|
|
11118
|
-
mkdirSync2(
|
|
11230
|
+
mkdirSync2(path12.dirname(full), { recursive: true });
|
|
11119
11231
|
writeFileSync3(full, contents);
|
|
11120
11232
|
}
|
|
11121
11233
|
}
|
|
@@ -14891,7 +15003,7 @@ function swiftApplicationEntry(file, source) {
|
|
|
14891
15003
|
else if (source[at] === "}") depth--;
|
|
14892
15004
|
else if (depth === 0 && /^@(?:main|UIApplicationMain)\b/.test(source.slice(at)))
|
|
14893
15005
|
return true;
|
|
14894
|
-
else if (depth === 0 &&
|
|
15006
|
+
else if (depth === 0 && path12.basename(file) === "main.swift" && /^UIApplicationMain\s*\(/.test(source.slice(at)))
|
|
14895
15007
|
return true;
|
|
14896
15008
|
}
|
|
14897
15009
|
return false;
|
|
@@ -14924,7 +15036,7 @@ function installObjcPeerStartup(input, targets, compiled) {
|
|
|
14924
15036
|
);
|
|
14925
15037
|
if (entries.length === 0) {
|
|
14926
15038
|
const source2 = compiled.get(input.entry);
|
|
14927
|
-
if (
|
|
15039
|
+
if (path12.basename(input.entry) !== "main.swift" || source2 === void 0)
|
|
14928
15040
|
fail("requires main.swift or a supported @main App/UIApplicationDelegate entry");
|
|
14929
15041
|
compiled.set(input.entry, `_peachRegisterObjcPeers()
|
|
14930
15042
|
${source2}`);
|
|
@@ -15060,14 +15172,14 @@ function prepareSwiftDependency(source, destination) {
|
|
|
15060
15172
|
for (const entry of readdirSync4(from, { withFileTypes: true })) {
|
|
15061
15173
|
if (entry.name === ".git" || entry.name === ".build" || entry.name === ".swiftpm")
|
|
15062
15174
|
continue;
|
|
15063
|
-
const file =
|
|
15175
|
+
const file = path12.join(from, entry.name);
|
|
15064
15176
|
if (entry.isDirectory()) gather(file);
|
|
15065
15177
|
else if (entry.isFile() && entry.name.endsWith(".swift"))
|
|
15066
|
-
origins[
|
|
15178
|
+
origins[path12.relative(source, file)] = readFileSync6(file, "utf8");
|
|
15067
15179
|
}
|
|
15068
15180
|
};
|
|
15069
15181
|
gather(source);
|
|
15070
|
-
const manifest =
|
|
15182
|
+
const manifest = path12.join(source, "Package.swift");
|
|
15071
15183
|
const targets = existsSync2(manifest) ? swiftManifestTargets(readFileSync6(manifest, "utf8")) : [];
|
|
15072
15184
|
const compiled = compiledSwiftSources(origins, targets);
|
|
15073
15185
|
const copy = (from, to) => {
|
|
@@ -15075,11 +15187,11 @@ function prepareSwiftDependency(source, destination) {
|
|
|
15075
15187
|
for (const entry of readdirSync4(from, { withFileTypes: true })) {
|
|
15076
15188
|
if (entry.name === ".git" || entry.name === ".build" || entry.name === ".swiftpm")
|
|
15077
15189
|
continue;
|
|
15078
|
-
const file =
|
|
15079
|
-
const target =
|
|
15190
|
+
const file = path12.join(from, entry.name);
|
|
15191
|
+
const target = path12.join(to, entry.name);
|
|
15080
15192
|
if (entry.isDirectory()) copy(file, target);
|
|
15081
15193
|
else if (entry.isFile() && entry.name.endsWith(".swift"))
|
|
15082
|
-
writeFileSync3(target, compiled.get(
|
|
15194
|
+
writeFileSync3(target, compiled.get(path12.relative(source, file)));
|
|
15083
15195
|
else cpSync(file, target, { verbatimSymlinks: true });
|
|
15084
15196
|
}
|
|
15085
15197
|
};
|
|
@@ -15101,7 +15213,7 @@ function writeSwiftProject(layout, input, moduleRoot) {
|
|
|
15101
15213
|
const targets = distribution && compileTargets(input).length === 0 ? [
|
|
15102
15214
|
{
|
|
15103
15215
|
name: "App",
|
|
15104
|
-
path:
|
|
15216
|
+
path: path12.relative(layout.root, layout.sources),
|
|
15105
15217
|
executable: true,
|
|
15106
15218
|
languageMode: 5,
|
|
15107
15219
|
mainActorIsolation: false,
|
|
@@ -15122,17 +15234,25 @@ function writeSwiftProject(layout, input, moduleRoot) {
|
|
|
15122
15234
|
);
|
|
15123
15235
|
if (target) swiftTargets.add(target.name);
|
|
15124
15236
|
}
|
|
15125
|
-
const headerDirectory =
|
|
15126
|
-
const headerModuleDirectory =
|
|
15237
|
+
const headerDirectory = path12.join(layout.root, ".build", "peach-cxx-headers");
|
|
15238
|
+
const headerModuleDirectory = path12.join(
|
|
15127
15239
|
layout.root,
|
|
15128
15240
|
".build",
|
|
15129
15241
|
"peach-objc-export-modules"
|
|
15130
15242
|
);
|
|
15131
15243
|
const imports = /* @__PURE__ */ new Map();
|
|
15132
15244
|
const objcProducers = /* @__PURE__ */ new Set();
|
|
15245
|
+
let checkedToolchain;
|
|
15246
|
+
const nativeToolchain = () => {
|
|
15247
|
+
if (checkedToolchain) return checkedToolchain;
|
|
15248
|
+
const pin = distribution ?? JSON.parse(readFileSync6(path12.join(moduleRoot, "toolchain.json"), "utf8"));
|
|
15249
|
+
checkedToolchain = swiftToolchain(pin.release, swiftModuleSdk(moduleRoot));
|
|
15250
|
+
return checkedToolchain;
|
|
15251
|
+
};
|
|
15252
|
+
const deploymentTarget = (name2) => input.nativeTargets?.find((value) => value.name === name2)?.deploymentTarget ?? "16.0";
|
|
15133
15253
|
const targetStagedFiles = /* @__PURE__ */ new Map();
|
|
15134
15254
|
const stageTargetFile = (target, file, contents, options) => {
|
|
15135
|
-
const relative =
|
|
15255
|
+
const relative = path12.relative(layout.root, file).split(path12.sep).join(path12.posix.sep);
|
|
15136
15256
|
const prior = files.has(file) ? files.get(file) : Object.hasOwn(input.files, relative) ? input.files[relative] : void 0;
|
|
15137
15257
|
if (!options?.allowExisting && prior !== void 0)
|
|
15138
15258
|
throw new Error(`target ${target} already contains generated output ${relative}`);
|
|
@@ -15163,7 +15283,7 @@ function writeSwiftProject(layout, input, moduleRoot) {
|
|
|
15163
15283
|
targetStagedFiles.delete(target.name);
|
|
15164
15284
|
if (entries.some(([file]) => /\.(?:c|cc|cpp|cxx|m|mm)$/.test(file)) && (swift || input.nativeTargets?.some((value) => value.name === target.name))) {
|
|
15165
15285
|
if (!swift) {
|
|
15166
|
-
const unprepared =
|
|
15286
|
+
const unprepared = path12.join(
|
|
15167
15287
|
layout.root,
|
|
15168
15288
|
target.path,
|
|
15169
15289
|
"PeachUnprepared.generated.swift"
|
|
@@ -15178,7 +15298,7 @@ function writeSwiftProject(layout, input, moduleRoot) {
|
|
|
15178
15298
|
native.set(target.name, {
|
|
15179
15299
|
mixed: true,
|
|
15180
15300
|
path: target.path,
|
|
15181
|
-
includeDirectory:
|
|
15301
|
+
includeDirectory: path12.join(layout.root, target.path, "include"),
|
|
15182
15302
|
sources: [],
|
|
15183
15303
|
lateSources: [],
|
|
15184
15304
|
exclude: entries.filter(([file]) => !file.endsWith(".swift") && !file.endsWith(".metal")).map(([file]) => file.slice(prefix.length))
|
|
@@ -15190,26 +15310,26 @@ function writeSwiftProject(layout, input, moduleRoot) {
|
|
|
15190
15310
|
const contents = input.files[file];
|
|
15191
15311
|
if (contents === void 0)
|
|
15192
15312
|
throw new Error(`missing original Objective-C header ${file}`);
|
|
15193
|
-
const destination =
|
|
15194
|
-
mkdirSync2(
|
|
15313
|
+
const destination = path12.join(layout.root, file);
|
|
15314
|
+
mkdirSync2(path12.dirname(destination), { recursive: true });
|
|
15195
15315
|
writeFileSync3(destination, contents);
|
|
15196
15316
|
files.set(destination, contents);
|
|
15197
15317
|
}
|
|
15198
15318
|
for (const header of settings.publicHeaders) {
|
|
15199
|
-
const destination =
|
|
15319
|
+
const destination = path12.join(headerDirectory, settings.name, path12.basename(header));
|
|
15200
15320
|
if (files.has(destination))
|
|
15201
15321
|
throw new Error(`duplicate product header ${destination}`);
|
|
15202
|
-
const contents = `#import ${JSON.stringify(
|
|
15322
|
+
const contents = `#import ${JSON.stringify(path12.join(layout.root, header))}
|
|
15203
15323
|
`;
|
|
15204
15324
|
files.set(destination, contents);
|
|
15205
|
-
mkdirSync2(
|
|
15325
|
+
mkdirSync2(path12.dirname(destination), { recursive: true });
|
|
15206
15326
|
writeFileSync3(destination, contents);
|
|
15207
15327
|
}
|
|
15208
15328
|
}
|
|
15209
15329
|
const nativeTargets = input.nativeTargets ?? [];
|
|
15210
|
-
const fromInputRoot = (file) => file.startsWith(`${SWIFT_NATIVE_INPUT_ROOT}/`) ?
|
|
15330
|
+
const fromInputRoot = (file) => file.startsWith(`${SWIFT_NATIVE_INPUT_ROOT}/`) ? path12.join(layout.root, file.slice(SWIFT_NATIVE_INPUT_ROOT.length + 1)) : file;
|
|
15211
15331
|
const headerSearch = writeXcodeHeaderSearch(
|
|
15212
|
-
|
|
15332
|
+
path12.join(layout.root, ".build", "peach-xcode-headers"),
|
|
15213
15333
|
nativeTargets.map((settings) => ({
|
|
15214
15334
|
headerMaps: settings.headerMaps.map((map2) => ({
|
|
15215
15335
|
flag: map2.flag,
|
|
@@ -15220,12 +15340,12 @@ function writeSwiftProject(layout, input, moduleRoot) {
|
|
|
15220
15340
|
})),
|
|
15221
15341
|
productHeaders: Object.fromEntries(
|
|
15222
15342
|
Object.entries(settings.productHeaders).map(([product, file]) => [
|
|
15223
|
-
|
|
15224
|
-
|
|
15343
|
+
path12.join(layout.root, product),
|
|
15344
|
+
path12.join(layout.root, file)
|
|
15225
15345
|
])
|
|
15226
15346
|
),
|
|
15227
15347
|
userHeaderSearchPaths: settings.userHeaderSearchPaths.map(
|
|
15228
|
-
(directory) =>
|
|
15348
|
+
(directory) => path12.join(layout.root, directory)
|
|
15229
15349
|
)
|
|
15230
15350
|
}))
|
|
15231
15351
|
);
|
|
@@ -15248,7 +15368,7 @@ function writeSwiftProject(layout, input, moduleRoot) {
|
|
|
15248
15368
|
if (producer && targets.some((value) => value.name === producer))
|
|
15249
15369
|
producers2.add(producer);
|
|
15250
15370
|
const local = [
|
|
15251
|
-
|
|
15371
|
+
path12.posix.join(path12.posix.dirname(file), include2),
|
|
15252
15372
|
`${includes}${include2}`
|
|
15253
15373
|
].find((candidate) => input.files[candidate] !== void 0);
|
|
15254
15374
|
if (local) {
|
|
@@ -15278,21 +15398,19 @@ function writeSwiftProject(layout, input, moduleRoot) {
|
|
|
15278
15398
|
const headers = settings.headers;
|
|
15279
15399
|
const roots2 = settings.bridgingHeader ? [settings.bridgingHeader] : settings.publicHeaders;
|
|
15280
15400
|
for (const file of headers) {
|
|
15281
|
-
const destination =
|
|
15282
|
-
mkdirSync2(
|
|
15401
|
+
const destination = path12.join(layout.root, file);
|
|
15402
|
+
mkdirSync2(path12.dirname(destination), { recursive: true });
|
|
15283
15403
|
writeFileSync3(destination, input.files[file]);
|
|
15284
15404
|
}
|
|
15285
15405
|
const search = [
|
|
15286
15406
|
.../* @__PURE__ */ new Set([
|
|
15287
15407
|
...settings?.headerSearchPaths ?? [],
|
|
15288
|
-
...headers.map((file) =>
|
|
15408
|
+
...headers.map((file) => path12.posix.dirname(file))
|
|
15289
15409
|
])
|
|
15290
|
-
].flatMap((dir) => ["-I",
|
|
15291
|
-
const
|
|
15292
|
-
const release = pin.release;
|
|
15293
|
-
const toolchainBin = swiftToolchain(release, swiftModuleSdk(moduleRoot));
|
|
15410
|
+
].flatMap((dir) => ["-I", path12.join(layout.root, dir)]);
|
|
15411
|
+
const toolchainBin = nativeToolchain();
|
|
15294
15412
|
const sdkHeaders = materializeObjcSdk(
|
|
15295
|
-
|
|
15413
|
+
path12.join(layout.root, ".build", "peach-objc-sdk")
|
|
15296
15414
|
);
|
|
15297
15415
|
const stageFlags = (flags2, sdkInclude) => flags2.map(
|
|
15298
15416
|
(flag) => flag.replaceAll(SWIFT_NATIVE_INPUT_ROOT, layout.root).replaceAll(SWIFT_NATIVE_SDK_INCLUDE, sdkInclude)
|
|
@@ -15303,16 +15421,16 @@ function writeSwiftProject(layout, input, moduleRoot) {
|
|
|
15303
15421
|
...search,
|
|
15304
15422
|
...(settings?.frameworkSearchPaths ?? []).flatMap((dir) => [
|
|
15305
15423
|
"-F",
|
|
15306
|
-
|
|
15424
|
+
path12.join(layout.root, dir)
|
|
15307
15425
|
]),
|
|
15308
15426
|
"-I",
|
|
15309
15427
|
headerDirectory
|
|
15310
15428
|
];
|
|
15311
15429
|
const flags = stageFlags(
|
|
15312
15430
|
originalFlags,
|
|
15313
|
-
|
|
15431
|
+
path12.join(swiftSdkPaths(moduleRoot, toolchainBin).sysroot, "include")
|
|
15314
15432
|
);
|
|
15315
|
-
const prefixHeader = settings?.prefixHeader ? ["-include",
|
|
15433
|
+
const prefixHeader = settings?.prefixHeader ? ["-include", path12.join(layout.root, settings.prefixHeader)] : [];
|
|
15316
15434
|
const bundleName = entries.some(([file]) => file.endsWith(".swift")) ? void 0 : swiftObjCResourceBundleName({
|
|
15317
15435
|
target: target.name,
|
|
15318
15436
|
path: target.path,
|
|
@@ -15323,7 +15441,7 @@ function writeSwiftProject(layout, input, moduleRoot) {
|
|
|
15323
15441
|
bundles: input.resourceBundles
|
|
15324
15442
|
});
|
|
15325
15443
|
const accessor = bundleName === void 0 ? void 0 : swiftObjCResourceAccessor(bundleName);
|
|
15326
|
-
const accessorHeader =
|
|
15444
|
+
const accessorHeader = path12.join(
|
|
15327
15445
|
layout.root,
|
|
15328
15446
|
target.path,
|
|
15329
15447
|
OBJC_RESOURCE_ACCESSOR_HEADER
|
|
@@ -15334,23 +15452,23 @@ function writeSwiftProject(layout, input, moduleRoot) {
|
|
|
15334
15452
|
const nativeUnits = accessor ? [...units, [accessorUnit, accessor.body]] : units;
|
|
15335
15453
|
const unitSource = (file) => {
|
|
15336
15454
|
const relative = file.slice(prefix.length);
|
|
15337
|
-
return relative.split("/").some((part) => part.startsWith(".")) ?
|
|
15455
|
+
return relative.split("/").some((part) => part.startsWith(".")) ? path12.posix.join(HIDDEN_UNITS, relative.replaceAll(/(^|\/)\./g, "$1%2E")) : relative;
|
|
15338
15456
|
};
|
|
15339
15457
|
const accessorFlags = accessor ? ["-include", accessorHeader] : [];
|
|
15340
15458
|
let nativeC = !roots2.length && !entries.some(([file]) => file.endsWith(".swift")) && !units.some(([file]) => /\.mm?$/.test(file));
|
|
15341
15459
|
if (roots2.length) {
|
|
15342
|
-
const sourceHeaders =
|
|
15460
|
+
const sourceHeaders = path12.join(
|
|
15343
15461
|
layout.root,
|
|
15344
15462
|
".build",
|
|
15345
15463
|
"peach-objc-originals",
|
|
15346
15464
|
target.name
|
|
15347
15465
|
);
|
|
15348
15466
|
mkdirSync2(sourceHeaders, { recursive: true });
|
|
15349
|
-
const modulemap =
|
|
15467
|
+
const modulemap = path12.join(sourceHeaders, "module.modulemap");
|
|
15350
15468
|
writeFileSync3(
|
|
15351
15469
|
modulemap,
|
|
15352
15470
|
`module ${swiftTargetModuleName(target.name)} {
|
|
15353
|
-
${roots2.map((file) => `header ${JSON.stringify(
|
|
15471
|
+
${roots2.map((file) => `header ${JSON.stringify(path12.join(layout.root, file))}`).join("\n")}
|
|
15354
15472
|
export *
|
|
15355
15473
|
}
|
|
15356
15474
|
`
|
|
@@ -15362,12 +15480,12 @@ export *
|
|
|
15362
15480
|
modulemap
|
|
15363
15481
|
},
|
|
15364
15482
|
toolchainBin,
|
|
15365
|
-
|
|
15366
|
-
|
|
15367
|
-
|
|
15483
|
+
path12.join(moduleRoot, "ios-simulator-stdlib"),
|
|
15484
|
+
path12.join(layout.root, ".build", "peach-objc-sdk"),
|
|
15485
|
+
path12.join(layout.root, ".build", "peach-objc-imports", target.name),
|
|
15368
15486
|
{
|
|
15369
|
-
flags: stageFlags(originalFlags,
|
|
15370
|
-
target: `arm64-apple-ios${
|
|
15487
|
+
flags: stageFlags(originalFlags, path12.join(sdkHeaders, "usr/include")),
|
|
15488
|
+
target: `arm64-apple-ios${deploymentTarget(target.name)}-simulator`
|
|
15371
15489
|
}
|
|
15372
15490
|
);
|
|
15373
15491
|
const defined = /* @__PURE__ */ new Set();
|
|
@@ -15405,7 +15523,7 @@ export *
|
|
|
15405
15523
|
imports.set(target.name, {
|
|
15406
15524
|
view,
|
|
15407
15525
|
classes: [...foreignTypes.values()],
|
|
15408
|
-
headers: roots2.map((file) =>
|
|
15526
|
+
headers: roots2.map((file) => path12.join(layout.root, file)),
|
|
15409
15527
|
foreignTypes
|
|
15410
15528
|
});
|
|
15411
15529
|
}
|
|
@@ -15414,25 +15532,25 @@ export *
|
|
|
15414
15532
|
for (const [file, contents] of nativeUnits) {
|
|
15415
15533
|
const origin = settings?.sourceDirectories[file];
|
|
15416
15534
|
if (origin) {
|
|
15417
|
-
const original =
|
|
15418
|
-
mkdirSync2(
|
|
15535
|
+
const original = path12.join(layout.root, origin, path12.posix.basename(file));
|
|
15536
|
+
mkdirSync2(path12.dirname(original), { recursive: true });
|
|
15419
15537
|
stageTargetFile(target.name, original, contents, { allowExisting: true });
|
|
15420
15538
|
}
|
|
15421
15539
|
const source = unitSource(file);
|
|
15422
15540
|
if (source !== file.slice(prefix.length))
|
|
15423
15541
|
stageTargetFile(
|
|
15424
15542
|
target.name,
|
|
15425
|
-
|
|
15543
|
+
path12.join(layout.root, target.path, source),
|
|
15426
15544
|
contents,
|
|
15427
15545
|
{
|
|
15428
15546
|
allowExisting: true
|
|
15429
15547
|
}
|
|
15430
15548
|
);
|
|
15431
15549
|
const perFile = [
|
|
15432
|
-
...origin ? ["-iquote",
|
|
15550
|
+
...origin ? ["-iquote", path12.join(layout.root, origin)] : [],
|
|
15433
15551
|
...stageFlags(
|
|
15434
15552
|
settings?.fileFlags[file] ?? [],
|
|
15435
|
-
|
|
15553
|
+
path12.join(swiftSdkPaths(moduleRoot, toolchainBin).sysroot, "include")
|
|
15436
15554
|
)
|
|
15437
15555
|
];
|
|
15438
15556
|
const cxx = /\.(?:cc|cpp|cxx|mm)$/.test(file);
|
|
@@ -15453,7 +15571,7 @@ export *
|
|
|
15453
15571
|
...accessorFlags,
|
|
15454
15572
|
...stageFlags(
|
|
15455
15573
|
cxx ? settings.cxxFlags : [],
|
|
15456
|
-
|
|
15574
|
+
path12.join(swiftSdkPaths(moduleRoot, toolchainBin).sysroot, "include")
|
|
15457
15575
|
),
|
|
15458
15576
|
...perFile
|
|
15459
15577
|
]
|
|
@@ -15468,12 +15586,12 @@ export *
|
|
|
15468
15586
|
flags: [...flags, "-fobjc-arc"],
|
|
15469
15587
|
cxxFlags: [...flags, "-fobjc-arc"]
|
|
15470
15588
|
});
|
|
15471
|
-
const include2 =
|
|
15589
|
+
const include2 = path12.join(layout.root, target.path, "include");
|
|
15472
15590
|
if (accessor) {
|
|
15473
15591
|
stageTargetFile(target.name, accessorHeader, accessor.header);
|
|
15474
15592
|
stageTargetFile(
|
|
15475
15593
|
target.name,
|
|
15476
|
-
|
|
15594
|
+
path12.join(layout.root, accessorUnit),
|
|
15477
15595
|
accessor.body
|
|
15478
15596
|
);
|
|
15479
15597
|
}
|
|
@@ -15512,12 +15630,12 @@ export *
|
|
|
15512
15630
|
const contents = input.files[original];
|
|
15513
15631
|
if (contents === void 0)
|
|
15514
15632
|
throw new Error(`missing original module map ${original}`);
|
|
15515
|
-
stageTargetFile(target.name,
|
|
15633
|
+
stageTargetFile(target.name, path12.join(layout.root, product), contents);
|
|
15516
15634
|
const [owner, ...implementations] = groups.values();
|
|
15517
15635
|
if (!owner) throw new Error(`target ${target.name} has no original units`);
|
|
15518
15636
|
native.set(target.name, {
|
|
15519
15637
|
path: target.path,
|
|
15520
|
-
includeDirectory:
|
|
15638
|
+
includeDirectory: path12.join(layout.root, path12.dirname(product)),
|
|
15521
15639
|
sources: nativeUnits.map(([file]) => unitSource(file)),
|
|
15522
15640
|
lateSources: implementations.flatMap((group) => group.sources),
|
|
15523
15641
|
exclude: [],
|
|
@@ -15538,7 +15656,7 @@ export *
|
|
|
15538
15656
|
}
|
|
15539
15657
|
stageTargetFile(
|
|
15540
15658
|
target.name,
|
|
15541
|
-
|
|
15659
|
+
path12.join(include2, "module.modulemap"),
|
|
15542
15660
|
`module ${target.name}ImplementationDeclarations { export * }
|
|
15543
15661
|
`
|
|
15544
15662
|
);
|
|
@@ -15574,7 +15692,7 @@ export *
|
|
|
15574
15692
|
}
|
|
15575
15693
|
native.set(target.name, {
|
|
15576
15694
|
path: target.path,
|
|
15577
|
-
includeDirectory:
|
|
15695
|
+
includeDirectory: path12.join(layout.root, includes),
|
|
15578
15696
|
sources: units.map(([file]) => file.slice(prefix.length)),
|
|
15579
15697
|
lateSources: late.map(([file]) => file.slice(prefix.length)),
|
|
15580
15698
|
...late.length > 0 ? {
|
|
@@ -15592,7 +15710,7 @@ export *
|
|
|
15592
15710
|
([file]) => file.startsWith(includes) && /\.(?:h|hpp|hh|hxx)$/.test(file) && consumers.get(file).size === 0
|
|
15593
15711
|
);
|
|
15594
15712
|
files.set(
|
|
15595
|
-
|
|
15713
|
+
path12.join(layout.root, includes, "module.modulemap"),
|
|
15596
15714
|
[
|
|
15597
15715
|
`module ${target.name} {`,
|
|
15598
15716
|
...roots.map(
|
|
@@ -15609,7 +15727,7 @@ export *
|
|
|
15609
15727
|
swiftModuleInputFiles(moduleRoot).join("\n")
|
|
15610
15728
|
);
|
|
15611
15729
|
if (!distribution) {
|
|
15612
|
-
modulePlan.update(readFileSync6(
|
|
15730
|
+
modulePlan.update(readFileSync6(path12.join(moduleRoot, "Package.swift")));
|
|
15613
15731
|
}
|
|
15614
15732
|
const resourcePlan = createHash9("sha256").update(
|
|
15615
15733
|
JSON.stringify(
|
|
@@ -15690,27 +15808,27 @@ export *
|
|
|
15690
15808
|
objcModules.add(name2);
|
|
15691
15809
|
rootOwner ?? (rootOwner = exported ? [...exported.swift.keys()][0] : `${prefix}PeachObjCImports.generated.swift`);
|
|
15692
15810
|
files.set(
|
|
15693
|
-
|
|
15811
|
+
path12.join(headerDirectory, `${name2}-Swift.h`),
|
|
15694
15812
|
exported?.header ?? "#pragma once\n"
|
|
15695
15813
|
);
|
|
15696
15814
|
files.set(
|
|
15697
|
-
|
|
15815
|
+
path12.join(headerDirectory, name2, `${name2}-Swift.h`),
|
|
15698
15816
|
`#include "../${name2}-Swift.h"
|
|
15699
15817
|
`
|
|
15700
15818
|
);
|
|
15701
15819
|
files.set(
|
|
15702
|
-
|
|
15820
|
+
path12.join(headerModuleDirectory, name2, "module.modulemap"),
|
|
15703
15821
|
`module ${swiftTargetModuleName(name2)} {
|
|
15704
15822
|
${[
|
|
15705
|
-
|
|
15706
|
-
...(input.nativeTargets?.find((target2) => target2.name === name2)?.publicHeaders ?? []).map((header) =>
|
|
15823
|
+
path12.join(headerDirectory, `${name2}-Swift.h`),
|
|
15824
|
+
...(input.nativeTargets?.find((target2) => target2.name === name2)?.publicHeaders ?? []).map((header) => path12.join(layout.root, header))
|
|
15707
15825
|
].map((header) => ` header ${JSON.stringify(header)}`).join("\n")}
|
|
15708
15826
|
export *
|
|
15709
15827
|
}
|
|
15710
15828
|
`
|
|
15711
15829
|
);
|
|
15712
15830
|
files.set(
|
|
15713
|
-
|
|
15831
|
+
path12.join(layout.root, "PeachObjCExports", `${name2}.m`),
|
|
15714
15832
|
exported?.implementation ?? `#include "${name2}-Cxx.h"
|
|
15715
15833
|
`
|
|
15716
15834
|
);
|
|
@@ -15722,13 +15840,13 @@ ${[
|
|
|
15722
15840
|
if (generated) {
|
|
15723
15841
|
const register = `_peach_objc_imports_${swiftTargetModuleName(name2)}`;
|
|
15724
15842
|
files.set(
|
|
15725
|
-
|
|
15843
|
+
path12.join(layout.root, target.path, "PeachObjCImports.generated.swift"),
|
|
15726
15844
|
generated.swift + generated.registration + `
|
|
15727
15845
|
@_cdecl("${register}") public func __peachRegisterOriginalObjC() { ${generated.registerFunction}() }
|
|
15728
15846
|
`
|
|
15729
15847
|
);
|
|
15730
15848
|
files.set(
|
|
15731
|
-
|
|
15849
|
+
path12.join(layout.root, target.path, "PeachObjCImports.generated.m"),
|
|
15732
15850
|
generated.objc
|
|
15733
15851
|
);
|
|
15734
15852
|
registrations.push(`${register}();`);
|
|
@@ -15786,7 +15904,7 @@ ${[
|
|
|
15786
15904
|
exclude: []
|
|
15787
15905
|
});
|
|
15788
15906
|
files.set(
|
|
15789
|
-
|
|
15907
|
+
path12.join(layout.root, `PeachApplication/${name2}/Entry.swift`),
|
|
15790
15908
|
`import ${swiftTargetModuleName(target.name)}
|
|
15791
15909
|
@main struct __PeachApplicationEntry { @MainActor static func main() { __peachRunApplication() } }
|
|
15792
15910
|
`
|
|
@@ -15794,22 +15912,35 @@ ${[
|
|
|
15794
15912
|
}
|
|
15795
15913
|
const nativeFlags = (() => {
|
|
15796
15914
|
if (native.size === 0) return void 0;
|
|
15797
|
-
const headers = materializeObjcSdk(
|
|
15798
|
-
|
|
15799
|
-
|
|
15800
|
-
|
|
15801
|
-
|
|
15802
|
-
|
|
15803
|
-
|
|
15804
|
-
|
|
15805
|
-
|
|
15806
|
-
|
|
15807
|
-
|
|
15808
|
-
|
|
15809
|
-
|
|
15810
|
-
|
|
15811
|
-
|
|
15812
|
-
|
|
15915
|
+
const headers = materializeObjcSdk(path12.join(layout.root, ".build", "peach-objc-sdk"));
|
|
15916
|
+
const moduleMaps = rootOwner ? [...objcModules].map(
|
|
15917
|
+
(name2) => `-fmodule-map-file=${path12.join(headerModuleDirectory, name2, "module.modulemap")}`
|
|
15918
|
+
) : [];
|
|
15919
|
+
return new Map(
|
|
15920
|
+
targets.map((target) => {
|
|
15921
|
+
const version = deploymentTarget(target.name);
|
|
15922
|
+
const minimum = iosDeploymentMinimum(version);
|
|
15923
|
+
if (minimum === void 0)
|
|
15924
|
+
throw new Error(
|
|
15925
|
+
`${target.name}: unsupported IPHONEOS_DEPLOYMENT_TARGET ${JSON.stringify(version)}`
|
|
15926
|
+
);
|
|
15927
|
+
return [
|
|
15928
|
+
target.name,
|
|
15929
|
+
[
|
|
15930
|
+
"-fobjc-runtime=gnustep-2.2",
|
|
15931
|
+
"-fobjc-exceptions",
|
|
15932
|
+
"-fexceptions",
|
|
15933
|
+
"-fwasm-exceptions",
|
|
15934
|
+
"-fobjc-arc",
|
|
15935
|
+
"-fblocks",
|
|
15936
|
+
...objcSdkIntakeFlags(headers, nativeToolchain(), minimum),
|
|
15937
|
+
"-I",
|
|
15938
|
+
headerDirectory,
|
|
15939
|
+
...moduleMaps
|
|
15940
|
+
]
|
|
15941
|
+
];
|
|
15942
|
+
})
|
|
15943
|
+
);
|
|
15813
15944
|
})();
|
|
15814
15945
|
let objcExports;
|
|
15815
15946
|
if (rootOwner && input.objcPeerStartup)
|
|
@@ -15826,7 +15957,7 @@ ${[
|
|
|
15826
15957
|
throw new Error(
|
|
15827
15958
|
"Swift Objective-C export target conflicts with application sources"
|
|
15828
15959
|
);
|
|
15829
|
-
const ownerFile =
|
|
15960
|
+
const ownerFile = path12.join(layout.root, rootOwner);
|
|
15830
15961
|
const ownerSource = compiled.get(rootOwner) ?? files.get(ownerFile);
|
|
15831
15962
|
if (typeof ownerSource !== "string")
|
|
15832
15963
|
throw new Error("Objective-C root registration has no owning Swift source");
|
|
@@ -15843,11 +15974,11 @@ public func __peachObjcExportRoot() { _objcRegisterPeerClass(NSObject.self, nati
|
|
|
15843
15974
|
);
|
|
15844
15975
|
if (compiled.has(rootOwner)) compiled.set(rootOwner, files.get(ownerFile).toString());
|
|
15845
15976
|
files.set(
|
|
15846
|
-
|
|
15977
|
+
path12.join(layout.root, "PeachObjCExports", "include", "module.modulemap"),
|
|
15847
15978
|
"module PeachSwiftObjCExports { export * }\n"
|
|
15848
15979
|
);
|
|
15849
15980
|
files.set(
|
|
15850
|
-
|
|
15981
|
+
path12.join(layout.root, "PeachObjCExports", "root.m"),
|
|
15851
15982
|
[
|
|
15852
15983
|
"#import <Foundation/Foundation.h>",
|
|
15853
15984
|
"extern void _peach_objc_ensure_exports(void);",
|
|
@@ -15869,24 +16000,15 @@ public func __peachObjcExportRoot() { _objcRegisterPeerClass(NSObject.self, nati
|
|
|
15869
16000
|
""
|
|
15870
16001
|
].join("\n")
|
|
15871
16002
|
);
|
|
15872
|
-
objcExports = {
|
|
15873
|
-
modules: objcModules,
|
|
15874
|
-
rootModule,
|
|
15875
|
-
flags: [
|
|
15876
|
-
...nativeFlags,
|
|
15877
|
-
...[...objcModules].map(
|
|
15878
|
-
(name2) => `-fmodule-map-file=${path11.join(headerModuleDirectory, name2, "module.modulemap")}`
|
|
15879
|
-
)
|
|
15880
|
-
]
|
|
15881
|
-
};
|
|
16003
|
+
objcExports = { modules: objcModules, rootModule };
|
|
15882
16004
|
}
|
|
15883
16005
|
if (targets.length === 0) {
|
|
15884
16006
|
for (const [file, contents] of Object.entries(input.files)) {
|
|
15885
16007
|
if (file === "Package.swift") continue;
|
|
15886
|
-
files.set(
|
|
16008
|
+
files.set(path12.join(layout.sources, file), compiled.get(file) ?? contents);
|
|
15887
16009
|
}
|
|
15888
16010
|
let manifest = readFileSync6(
|
|
15889
|
-
|
|
16011
|
+
path12.join(moduleRoot, "scripts/contrast-app-Package.swift"),
|
|
15890
16012
|
"utf8"
|
|
15891
16013
|
).replaceAll("__SOOTSIM_SWIFT_PACKAGE__", moduleRoot);
|
|
15892
16014
|
const reactor = ` ${REACTOR_FLAG}`;
|
|
@@ -15930,21 +16052,21 @@ public func __peachObjcExportRoot() { _objcRegisterPeerClass(NSObject.self, nati
|
|
|
15930
16052
|
manifest = manifest.replace(anchor, `${anchor}
|
|
15931
16053
|
${SPRITEKIT_PRODUCT},`);
|
|
15932
16054
|
}
|
|
15933
|
-
files.set(
|
|
16055
|
+
files.set(path12.join(layout.root, "Package.swift"), manifest + moduleFiles);
|
|
15934
16056
|
} else {
|
|
15935
16057
|
const base = layout.multi ? layout.root : layout.sources;
|
|
15936
16058
|
const libraries = /* @__PURE__ */ new Map();
|
|
15937
16059
|
for (const [target, data] of Object.entries(input.libraries ?? {})) {
|
|
15938
|
-
const file =
|
|
16060
|
+
const file = path12.join(layout.root, ".peach-libraries", `lib${target}.a`);
|
|
15939
16061
|
files.set(file, Buffer.from(data, "base64"));
|
|
15940
16062
|
libraries.set(target, file);
|
|
15941
16063
|
}
|
|
15942
16064
|
for (const [file, contents] of Object.entries(input.files)) {
|
|
15943
16065
|
if (file === "Package.swift") continue;
|
|
15944
|
-
files.set(
|
|
16066
|
+
files.set(path12.join(base, file), compiled.get(file) ?? contents);
|
|
15945
16067
|
}
|
|
15946
16068
|
files.set(
|
|
15947
|
-
|
|
16069
|
+
path12.join(layout.root, "Package.swift"),
|
|
15948
16070
|
emitSwiftPackageManifest({
|
|
15949
16071
|
targets,
|
|
15950
16072
|
native,
|
|
@@ -15963,7 +16085,7 @@ public func __peachObjcExportRoot() { _objcRegisterPeerClass(NSObject.self, nati
|
|
|
15963
16085
|
spriteKit: importsSpriteKit(input.files),
|
|
15964
16086
|
distribution: distribution ?? void 0,
|
|
15965
16087
|
distributionLink: {
|
|
15966
|
-
path:
|
|
16088
|
+
path: path12.join(layout.root, ".peach-distribution-objects.rsp"),
|
|
15967
16089
|
files
|
|
15968
16090
|
},
|
|
15969
16091
|
libraries
|
|
@@ -15979,9 +16101,9 @@ public func __peachObjcExportRoot() { _objcRegisterPeerClass(NSObject.self, nati
|
|
|
15979
16101
|
throw new Error(
|
|
15980
16102
|
`swift resource target ${target.name} has no matching bundle assignment`
|
|
15981
16103
|
);
|
|
15982
|
-
const directory = layout.multi ?
|
|
16104
|
+
const directory = layout.multi ? path12.join(layout.root, target.path) : layout.sources;
|
|
15983
16105
|
files.set(
|
|
15984
|
-
|
|
16106
|
+
path12.join(directory, "ResourceBundleAccessor.generated.swift"),
|
|
15985
16107
|
[
|
|
15986
16108
|
"import Foundation",
|
|
15987
16109
|
"",
|
|
@@ -15998,7 +16120,7 @@ public func __peachObjcExportRoot() { _objcRegisterPeerClass(NSObject.self, nati
|
|
|
15998
16120
|
}
|
|
15999
16121
|
for (const [file, source] of compiled)
|
|
16000
16122
|
if (!Object.hasOwn(input.files, file))
|
|
16001
|
-
files.set(
|
|
16123
|
+
files.set(path12.join(layout.multi ? layout.root : layout.sources, file), source);
|
|
16002
16124
|
syncSwiftTree(layout.root, files);
|
|
16003
16125
|
const producers = [
|
|
16004
16126
|
.../* @__PURE__ */ new Set([
|
|
@@ -16020,10 +16142,10 @@ public func __peachObjcExportRoot() { _objcRegisterPeerClass(NSObject.self, nati
|
|
|
16020
16142
|
targetFailures,
|
|
16021
16143
|
...rootOwner && objcExports ? {
|
|
16022
16144
|
objcImplementations: {
|
|
16023
|
-
owner:
|
|
16145
|
+
owner: path12.join(layout.root, rootOwner),
|
|
16024
16146
|
registeredClasses: [...registeredClasses],
|
|
16025
16147
|
units: [...native.values()].flatMap(
|
|
16026
|
-
(value) => value.sources.filter((file) => /\.mm?$/.test(file)).map((file) =>
|
|
16148
|
+
(value) => value.sources.filter((file) => /\.mm?$/.test(file)).map((file) => path12.join(layout.root, value.path, file))
|
|
16027
16149
|
)
|
|
16028
16150
|
}
|
|
16029
16151
|
} : {}
|
|
@@ -16045,13 +16167,13 @@ function outputOf(error) {
|
|
|
16045
16167
|
return error instanceof Error ? error.message : String(error);
|
|
16046
16168
|
}
|
|
16047
16169
|
function builtArtifact(layout) {
|
|
16048
|
-
const binDir =
|
|
16049
|
-
const manifest = readFileSync6(
|
|
16170
|
+
const binDir = path12.join(layout.root, ".build", WASM_TRIPLE, "release");
|
|
16171
|
+
const manifest = readFileSync6(path12.join(layout.root, "Package.swift"), "utf8");
|
|
16050
16172
|
const executable = swiftManifestTargets(manifest).find((target) => target.executable);
|
|
16051
16173
|
if (executable === void 0) {
|
|
16052
16174
|
throw new Error("swift-compile: the written manifest names no executable target");
|
|
16053
16175
|
}
|
|
16054
|
-
const file =
|
|
16176
|
+
const file = path12.join(binDir, `${executable.name}.wasm`);
|
|
16055
16177
|
if (!existsSync2(file)) {
|
|
16056
16178
|
const found = existsSync2(binDir) ? readdirSync4(binDir).filter((name2) => name2.endsWith(".wasm")).sort() : [];
|
|
16057
16179
|
throw new Error(
|
|
@@ -16062,7 +16184,7 @@ function builtArtifact(layout) {
|
|
|
16062
16184
|
}
|
|
16063
16185
|
function projectDiagnostic(output, layout, files) {
|
|
16064
16186
|
const base = layout.multi ? layout.root : layout.sources;
|
|
16065
|
-
const prefix = `${base}${
|
|
16187
|
+
const prefix = `${base}${path12.sep}`;
|
|
16066
16188
|
return designTimeDiagnostic(output, files).split("\n").filter((line) => !SWIFTPM_NOISE.test(line)).map((line) => line.startsWith(prefix) ? line.slice(prefix.length) : line).join("\n").trim();
|
|
16067
16189
|
}
|
|
16068
16190
|
var ROOT_LOCKS = Symbol.for("peachsim.swiftCompile.rootLocks");
|
|
@@ -16098,12 +16220,12 @@ function serialize(root, work, signal) {
|
|
|
16098
16220
|
function readCompiledArtifact(directory, hash2) {
|
|
16099
16221
|
try {
|
|
16100
16222
|
const receipt = JSON.parse(
|
|
16101
|
-
readFileSync6(
|
|
16223
|
+
readFileSync6(path12.join(directory, "artifact.json"), "utf8")
|
|
16102
16224
|
);
|
|
16103
16225
|
if (!receipt || typeof receipt !== "object" || !("hash" in receipt) || receipt.hash !== hash2 || !("icu" in receipt) || typeof receipt.icu !== "string" || !("wasm" in receipt) || typeof receipt.wasm !== "string")
|
|
16104
16226
|
return null;
|
|
16105
|
-
const bytes = readFileSync6(
|
|
16106
|
-
const gzip2 = readFileSync6(
|
|
16227
|
+
const bytes = readFileSync6(path12.join(directory, "app.wasm"));
|
|
16228
|
+
const gzip2 = readFileSync6(path12.join(directory, "icu.gz"));
|
|
16107
16229
|
if (createHash9("sha256").update(bytes).digest("hex") !== receipt.wasm || createHash9("sha256").update(gzip2).digest("hex") !== receipt.icu || bytes.length < 8 || bytes.readUInt32LE(0) !== 1836278016 || bytes.readUInt32LE(4) !== 1)
|
|
16108
16230
|
return null;
|
|
16109
16231
|
return { hash: hash2, bytes, icu: { sha256: receipt.icu, gzip: gzip2 } };
|
|
@@ -16114,14 +16236,14 @@ function readCompiledArtifact(directory, hash2) {
|
|
|
16114
16236
|
}
|
|
16115
16237
|
}
|
|
16116
16238
|
function saveCompiledArtifact(root, artifact) {
|
|
16117
|
-
const directory =
|
|
16239
|
+
const directory = path12.join(root, "artifact");
|
|
16118
16240
|
mkdirSync2(directory, { recursive: true });
|
|
16119
|
-
const pending = mkdtempSync2(
|
|
16241
|
+
const pending = mkdtempSync2(path12.join(root, ".artifact-"));
|
|
16120
16242
|
try {
|
|
16121
|
-
writeFileSync3(
|
|
16122
|
-
writeFileSync3(
|
|
16243
|
+
writeFileSync3(path12.join(pending, "app.wasm"), artifact.bytes);
|
|
16244
|
+
writeFileSync3(path12.join(pending, "icu.gz"), artifact.icu.gzip);
|
|
16123
16245
|
writeFileSync3(
|
|
16124
|
-
|
|
16246
|
+
path12.join(pending, "artifact.json"),
|
|
16125
16247
|
JSON.stringify({
|
|
16126
16248
|
hash: artifact.hash,
|
|
16127
16249
|
wasm: createHash9("sha256").update(artifact.bytes).digest("hex"),
|
|
@@ -16129,7 +16251,7 @@ function saveCompiledArtifact(root, artifact) {
|
|
|
16129
16251
|
})
|
|
16130
16252
|
);
|
|
16131
16253
|
for (const file of ["app.wasm", "icu.gz", "artifact.json"]) {
|
|
16132
|
-
renameSync(
|
|
16254
|
+
renameSync(path12.join(pending, file), path12.join(directory, file));
|
|
16133
16255
|
}
|
|
16134
16256
|
} finally {
|
|
16135
16257
|
rmSync3(pending, { recursive: true, force: true });
|
|
@@ -16151,16 +16273,16 @@ function renewSharedArtifact(sharedRoot) {
|
|
|
16151
16273
|
function pruneSharedArtifacts(parent, keep) {
|
|
16152
16274
|
const entries = [];
|
|
16153
16275
|
for (const name2 of readdirSync4(parent)) {
|
|
16154
|
-
const directory =
|
|
16276
|
+
const directory = path12.join(parent, name2);
|
|
16155
16277
|
if (name2.startsWith(RETIRED_PREFIX)) {
|
|
16156
16278
|
rmSync3(directory, { recursive: true, force: true });
|
|
16157
16279
|
continue;
|
|
16158
16280
|
}
|
|
16159
16281
|
try {
|
|
16160
16282
|
let bytes = 0;
|
|
16161
|
-
for (const file of readdirSync4(
|
|
16283
|
+
for (const file of readdirSync4(path12.join(directory, "artifact"))) {
|
|
16162
16284
|
try {
|
|
16163
|
-
bytes += statSync(
|
|
16285
|
+
bytes += statSync(path12.join(directory, "artifact", file)).size;
|
|
16164
16286
|
} catch (error) {
|
|
16165
16287
|
if (!vanished(error)) throw error;
|
|
16166
16288
|
}
|
|
@@ -16175,9 +16297,9 @@ function pruneSharedArtifacts(parent, keep) {
|
|
|
16175
16297
|
if (total <= SHARED_ARTIFACT_BUDGET_BYTES) break;
|
|
16176
16298
|
if (entry.directory === keep || Date.now() - entry.used < SHARED_ARTIFACT_GRACE_MS)
|
|
16177
16299
|
continue;
|
|
16178
|
-
const retired =
|
|
16300
|
+
const retired = path12.join(
|
|
16179
16301
|
parent,
|
|
16180
|
-
`${RETIRED_PREFIX}${process.pid}-${
|
|
16302
|
+
`${RETIRED_PREFIX}${process.pid}-${path12.basename(entry.directory)}`
|
|
16181
16303
|
);
|
|
16182
16304
|
try {
|
|
16183
16305
|
if (statSync(entry.directory).mtimeMs !== entry.used) continue;
|
|
@@ -16193,7 +16315,7 @@ function pruneSharedArtifacts(parent, keep) {
|
|
|
16193
16315
|
function saveSharedArtifact(sharedRoot, artifact) {
|
|
16194
16316
|
saveCompiledArtifact(sharedRoot, artifact);
|
|
16195
16317
|
renewSharedArtifact(sharedRoot);
|
|
16196
|
-
pruneSharedArtifacts(
|
|
16318
|
+
pruneSharedArtifacts(path12.dirname(sharedRoot), sharedRoot);
|
|
16197
16319
|
}
|
|
16198
16320
|
var retainedArtifacts = /* @__PURE__ */ new Map();
|
|
16199
16321
|
function retain(root, artifact) {
|
|
@@ -16210,14 +16332,14 @@ function compileSwiftProjectUnit(input, options) {
|
|
|
16210
16332
|
options.signal?.throwIfAborted();
|
|
16211
16333
|
mkdirSync2(options.buildRoot, { recursive: true });
|
|
16212
16334
|
const root = realpathSync(options.buildRoot);
|
|
16213
|
-
const moduleRoot =
|
|
16335
|
+
const moduleRoot = path12.resolve(options.moduleRoot);
|
|
16214
16336
|
const layout = {
|
|
16215
16337
|
root,
|
|
16216
|
-
sources:
|
|
16338
|
+
sources: path12.join(root, "Sources", "App"),
|
|
16217
16339
|
multi: compileTargets(input).length > 0
|
|
16218
16340
|
};
|
|
16219
16341
|
const hash2 = swiftArtifactHash(input, options.release, moduleRoot);
|
|
16220
|
-
const sharedRoot =
|
|
16342
|
+
const sharedRoot = path12.join(rnxHomeDir(), "cache", "swift-projects", hash2);
|
|
16221
16343
|
const report = (message) => {
|
|
16222
16344
|
console.error(`[swift-project ${hash2.slice(0, 16)}] ${message}`);
|
|
16223
16345
|
options.onStage?.(message);
|
|
@@ -16231,8 +16353,8 @@ function compileSwiftProjectUnit(input, options) {
|
|
|
16231
16353
|
report("reusing memory artifact");
|
|
16232
16354
|
return retain(root, retained);
|
|
16233
16355
|
}
|
|
16234
|
-
const cached = readCompiledArtifact(
|
|
16235
|
-
const previous = cached ?? readCompiledArtifact(
|
|
16356
|
+
const cached = readCompiledArtifact(path12.join(sharedRoot, "artifact"), hash2);
|
|
16357
|
+
const previous = cached ?? readCompiledArtifact(path12.join(root, "artifact"), hash2);
|
|
16236
16358
|
if (previous) {
|
|
16237
16359
|
if (cached) renewSharedArtifact(sharedRoot);
|
|
16238
16360
|
else saveSharedArtifact(sharedRoot, previous);
|
|
@@ -16241,8 +16363,8 @@ function compileSwiftProjectUnit(input, options) {
|
|
|
16241
16363
|
}
|
|
16242
16364
|
if (process.platform === "darwin" && process.env.TM_SESSION && !admittedMacBuilderSlot() && process.env.CI !== "true" && moduleRoot === sourceSwiftCheckout() && !swiftDistributionAt(moduleRoot)) {
|
|
16243
16365
|
const requestRoot = mkdtempSync2(`${root}.builder-request-`);
|
|
16244
|
-
const output =
|
|
16245
|
-
const request =
|
|
16366
|
+
const output = path12.join(requestRoot, "output");
|
|
16367
|
+
const request = path12.join(requestRoot, "request.json");
|
|
16246
16368
|
writeFileSync3(
|
|
16247
16369
|
request,
|
|
16248
16370
|
JSON.stringify({
|
|
@@ -16256,12 +16378,12 @@ function compileSwiftProjectUnit(input, options) {
|
|
|
16256
16378
|
})
|
|
16257
16379
|
);
|
|
16258
16380
|
try {
|
|
16259
|
-
const repo =
|
|
16381
|
+
const repo = path12.resolve(moduleRoot, "../..");
|
|
16260
16382
|
report("requesting builder admission or cached result");
|
|
16261
16383
|
await runCompiler(
|
|
16262
16384
|
"bun",
|
|
16263
16385
|
[
|
|
16264
|
-
|
|
16386
|
+
path12.join(repo, "scripts/build/swift-project.ts"),
|
|
16265
16387
|
"--request",
|
|
16266
16388
|
request,
|
|
16267
16389
|
"--output",
|
|
@@ -16295,7 +16417,7 @@ function compileSwiftProjectUnit(input, options) {
|
|
|
16295
16417
|
return withSwiftRootLock(
|
|
16296
16418
|
root,
|
|
16297
16419
|
async (lease) => {
|
|
16298
|
-
const built = readCompiledArtifact(
|
|
16420
|
+
const built = readCompiledArtifact(path12.join(sharedRoot, "artifact"), hash2);
|
|
16299
16421
|
if (built) {
|
|
16300
16422
|
report("reusing verified disk artifact");
|
|
16301
16423
|
return retain(root, built);
|
|
@@ -16304,7 +16426,7 @@ function compileSwiftProjectUnit(input, options) {
|
|
|
16304
16426
|
const unprepared = preparation.targetFailures.map(
|
|
16305
16427
|
(failure) => `error: target ${failure}`
|
|
16306
16428
|
);
|
|
16307
|
-
const swift =
|
|
16429
|
+
const swift = path12.join(options.toolchainBin, "swift");
|
|
16308
16430
|
if (!existsSync2(swift)) {
|
|
16309
16431
|
throw new Error(
|
|
16310
16432
|
`swift-compile: no swift.org toolchain at ${options.toolchainBin}; install ${options.release} and its matching wasm sdk`
|
|
@@ -16352,8 +16474,8 @@ function compileSwiftProjectUnit(input, options) {
|
|
|
16352
16474
|
// shipped host plugins resolve against the selected compiler's runtime.
|
|
16353
16475
|
...process.platform === "linux" ? {
|
|
16354
16476
|
LD_LIBRARY_PATH: [
|
|
16355
|
-
|
|
16356
|
-
|
|
16477
|
+
path12.resolve(options.toolchainBin, "../lib/swift/linux"),
|
|
16478
|
+
path12.resolve(options.toolchainBin, "../lib/swift/host"),
|
|
16357
16479
|
process.env.LD_LIBRARY_PATH
|
|
16358
16480
|
].filter(Boolean).join(":")
|
|
16359
16481
|
} : {}
|
|
@@ -16377,7 +16499,7 @@ function compileSwiftProjectUnit(input, options) {
|
|
|
16377
16499
|
if (preparation.objcImplementations) {
|
|
16378
16500
|
const plan = preparation.objcImplementations;
|
|
16379
16501
|
const manifest = browser_default.parse(
|
|
16380
|
-
readFileSync6(
|
|
16502
|
+
readFileSync6(path12.join(root, ".build", "release.yaml"), "utf8")
|
|
16381
16503
|
);
|
|
16382
16504
|
if (!isRecord(manifest) || !isRecord(manifest.commands))
|
|
16383
16505
|
throw new Error("missing SwiftPM native compiler commands");
|
|
@@ -16434,7 +16556,7 @@ function compileSwiftProjectUnit(input, options) {
|
|
|
16434
16556
|
);
|
|
16435
16557
|
} catch (error) {
|
|
16436
16558
|
const output = outputOf(error);
|
|
16437
|
-
const moduleCache =
|
|
16559
|
+
const moduleCache = path12.join(
|
|
16438
16560
|
root,
|
|
16439
16561
|
".build",
|
|
16440
16562
|
WASM_TRIPLE,
|