peachsim 0.1.1716 → 0.1.1738
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +21 -3
- package/cli/app-bundle-resources.ts +2 -1
- package/cli/app-fonts.ts +4 -4
- package/cli/app-splash.ts +4 -4
- package/cli/app-stubs.ts +17 -0
- package/cli/command-registry.ts +1 -0
- package/cli/commands/control.ts +83 -822
- package/cli/commands/coverage-swift.ts +112 -4
- package/cli/commands/daemon.ts +8 -0
- package/cli/commands/detox.ts +3 -0
- package/cli/commands/doctor.ts +19 -2
- package/cli/commands/inspect/actions.ts +74 -14
- package/cli/commands/inspect/core.ts +5 -1
- package/cli/commands/inspect/settling.ts +5 -2
- package/cli/commands/inspect/wait-ready.ts +6 -0
- package/cli/commands/inspect.ts +48 -45
- package/cli/commands/kotlin.ts +12 -2
- package/cli/commands/package.ts +760 -0
- package/cli/commands/serve.ts +6 -0
- package/cli/commands/shell-url.ts +838 -0
- package/cli/commands/swift.ts +42 -102
- package/cli/commands/test.ts +20 -0
- package/cli/commands/upload.ts +1 -1
- package/cli/device-option.ts +1 -1
- package/cli/main.ts +13 -1
- package/cli/native-input.ts +199 -0
- package/cli/outbound-endpoints.ts +26 -1
- package/cli/packaged-app-launcher.ts +95 -0
- package/cli/scene-video.ts +36 -12
- package/detox/index.ts +196 -24
- package/dist-lib/agent-daemon-client.cjs +1 -1
- package/dist-lib/agent-events.cjs +1 -1
- package/dist-lib/attached-projects.cjs +5 -2
- package/dist-lib/auth/shared-session.cjs +5 -2
- 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 +39889 -31873
- 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 +195 -63
- package/dist-lib/dev-bundle-resolution.cjs +14 -13
- package/dist-lib/expo-swift-bundle.cjs +18507 -11835
- package/dist-lib/expo-swift-metadata.cjs +4 -1
- package/dist-lib/expo-swift-metadata.mjs +3 -1
- package/dist-lib/home-paths.cjs +27 -3
- package/dist-lib/host/bridge-host.cjs +28373 -24090
- package/dist-lib/host/fetch-proxy-handler.cjs +235 -225
- 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 +915 -399
- 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 +335 -47
- package/dist-lib/menu.cjs +13 -1
- package/dist-lib/menu.mjs +13 -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 +918 -411
- package/dist-lib/native-app-identity-project.cjs +703 -283
- package/dist-lib/native-app-identity-project.mjs +500 -87
- package/dist-lib/native-app-identity.cjs +13 -2
- package/dist-lib/native-app-identity.mjs +13 -2
- 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 +5 -2
- package/dist-lib/public-brand.cjs +1 -1
- package/dist-lib/public-origins-lib-esm.json +28 -23
- package/dist-lib/public-origins-lib.json +418 -224
- package/dist-lib/react-native-host-modules.cjs +35 -2
- package/dist-lib/react-native-host-modules.mjs +35 -2
- package/dist-lib/reap-browser.cjs +12 -4
- package/dist-lib/scripts/dev-server-scanner.cjs +15 -8
- package/dist-lib/sdk.cjs +17 -7
- package/dist-lib/sdk.mjs +16 -7
- package/dist-lib/skills.cjs +44825 -29141
- package/dist-lib/swift-compile.cjs +616 -400
- package/dist-lib/swift-compile.mjs +528 -315
- package/dist-lib/swift-package.cjs +1 -1
- package/dist-lib/swift-package.mjs +1 -1
- package/dist-lib/swift-submit.cjs +2 -2
- package/dist-lib/swift-submit.mjs +2 -2
- package/dist-lib/swift-toolchain.cjs +105 -17
- package/dist-lib/swift.cjs +1 -1
- package/dist-lib/vite-swift.cjs +4660 -2252
- package/dist-lib/vite.cjs +248 -234
- package/dist-lib/worklet-executable.cjs +1 -1
- package/dist-lib/worklet-executable.mjs +1 -1
- package/dist-types/packages/peach-compat/src/stubs/native-seams/react-native-cookies.d.ts +17 -8
- package/dist-types/packages/peach-engine/src/engine/canvaskit-renderer.d.ts +1 -0
- package/dist-types/packages/peach-engine/src/engine/font-config.d.ts +7 -4
- package/dist-types/packages/peach-engine/src/engine/image-loader.d.ts +9 -6
- package/dist-types/packages/peach-engine/src/engine/liquid-glass.d.ts +0 -5
- package/dist-types/packages/peach-engine/src/engine/memory-counts.d.ts +11 -1
- package/dist-types/packages/peach-engine/src/engine/node.d.ts +5 -12
- package/dist-types/packages/peach-engine/src/engine/render-damage.d.ts +2 -2
- package/dist-types/packages/peach-engine/src/engine/text-first-baseline.d.ts +5 -0
- package/dist-types/packages/peach-engine/src/engine/text-paragraph.d.ts +1 -0
- package/dist-types/packages/peach-engine/src/engine/types.d.ts +3 -0
- package/dist-types/packages/peach-engine/src/native-preview-bundle.d.ts +2 -0
- package/dist-types/packages/peach-engine/src/render-worker/compositor-protocol.d.ts +9 -0
- package/dist-types/packages/peach-engine/src/render-worker/host-service-protocol.d.ts +3 -0
- package/dist-types/packages/peach-engine/src/render-worker/native-ui-commandContract.d.ts +1 -1
- package/dist-types/packages/peach-engine/src/render-worker/protocol.d.ts +7 -2
- package/dist-types/packages/peach-engine/src/render-worker/shell-protocol.d.ts +5 -0
- package/dist-types/packages/peach-engine/src/render-worker/tree-sync-port.d.ts +1 -1
- package/dist-types/packages/peach-engine/src/render-worker/worklet-runtime.d.ts +36 -2
- package/dist-types/packages/peach-engine/src/shell-events.d.ts +1 -0
- package/dist-types/packages/peach-globals/src/audioBridgeContract.d.ts +5 -0
- package/dist-types/packages/peach-globals/src/index.d.ts +1 -1
- package/dist-types/packages/peach-globals/src/keyboardBridgeContract.d.ts +11 -0
- package/dist-types/packages/peach-globals/src/shellBridgeContract.d.ts +1 -0
- package/dist-types/packages/peach-globals/src/testBridgeContract.d.ts +9 -2
- package/dist-types/packages/peach-kit/src/capabilities.d.ts +1 -0
- package/kotlin/README.md +3 -0
- package/kotlin/sdk.tar.gz +0 -0
- package/package.json +1 -1
- package/runtime-companion.json +1 -1
- package/scripts/dev-server-scanner.ts +12 -25
- package/sdk/ios/System/Library/Frameworks/Accounts.framework/Headers/ACAccount.h +55 -0
- package/sdk/ios/System/Library/Frameworks/Accounts.framework/Headers/ACAccountCredential.h +35 -0
- package/sdk/ios/System/Library/Frameworks/Accounts.framework/Headers/ACAccountStore.h +94 -0
- package/sdk/ios/System/Library/Frameworks/Accounts.framework/Headers/ACAccountType.h +53 -0
- package/sdk/ios/System/Library/Frameworks/Accounts.framework/Headers/ACError.h +37 -0
- package/sdk/ios/System/Library/Frameworks/Accounts.framework/Headers/Accounts.h +13 -0
- package/sdk/ios/System/Library/Frameworks/Accounts.framework/Headers/AccountsDefines.h +13 -0
- package/sdk/ios/System/Library/Frameworks/Accounts.framework/Modules/module.modulemap +5 -0
- package/sdk/ios/System/Library/Frameworks/AuthenticationServices.framework/Headers/ASFoundation.h +52 -0
- package/sdk/ios/System/Library/Frameworks/AuthenticationServices.framework/Headers/ASWebAuthenticationSession.h +128 -0
- package/sdk/ios/System/Library/Frameworks/AuthenticationServices.framework/Headers/ASWebAuthenticationSessionCallback.h +35 -0
- package/sdk/ios/System/Library/Frameworks/AuthenticationServices.framework/Headers/AuthenticationServices.h +3 -0
- package/sdk/ios/System/Library/Frameworks/AuthenticationServices.framework/Modules/module.modulemap +5 -0
- package/sdk/ios/System/Library/Frameworks/CFNetwork.framework/Headers/CFHTTPMessage.h +724 -0
- package/sdk/ios/System/Library/Frameworks/CFNetwork.framework/Headers/CFNetwork.h +4 -0
- package/sdk/ios/System/Library/Frameworks/CFNetwork.framework/Headers/CFNetworkDefs.h +27 -0
- package/sdk/ios/System/Library/Frameworks/CFNetwork.framework/Modules/module.modulemap +5 -0
- package/sdk/ios/System/Library/Frameworks/CoreFoundation.framework/Headers/CFURL.h +1301 -0
- package/sdk/ios/System/Library/Frameworks/CoreGraphics.framework/Headers/CoreGraphics.h +3 -1
- package/sdk/ios/System/Library/Frameworks/CoreLocation.framework/Headers/CLLocationManager.h +21 -50
- package/sdk/ios/System/Library/Frameworks/CoreLocation.framework/Headers/CLRegion.h +6 -6
- package/sdk/ios/System/Library/Frameworks/Foundation.framework/Headers/Foundation.apinotes +58 -3
- package/sdk/ios/System/Library/Frameworks/Foundation.framework/Headers/Foundation.h +711 -46
- package/sdk/ios/System/Library/Frameworks/UIKit.framework/Headers/UIApplication.h +12 -0
- package/sdk/ios/System/Library/Frameworks/UIKit.framework/Headers/UIInterface.h +23 -0
- package/sdk/ios/System/Library/Frameworks/UIKit.framework/Headers/UIKit.h +7 -9
- package/sdk/ios/System/Library/Frameworks/UIKit.framework/Headers/UIOrientation.h +14 -0
- package/sdk/ios/System/Library/Frameworks/UIKit.framework/Headers/UIStringDrawing.h +12 -0
- package/sdk/ios/System/Library/Frameworks/UIKit.framework/Headers/UIView.h +14 -0
- package/sdk/ios/System/Library/Frameworks/UIKit.framework/Headers/UIViewAnimating.h +12 -0
- package/sdk/ios/System/Library/Frameworks/UIKit.framework/Headers/UIViewController.h +16 -0
- package/sdk/ios/System/Library/Frameworks/UIKit.framework/Headers/UIWindow.h +2 -0
- package/sdk/ios/usr/include/ConditionalMacros.h +619 -0
- package/sdk/ios/usr/include/module.modulemap +1 -0
- package/sdk/ios/usr/include/objc/objc-sync.h +59 -0
- package/sdk/ios/usr/include/os/signpost.h +414 -0
- package/sdk/ios/usr/include/os.modulemap +10 -0
- package/sdk/ios/usr/include/sys/cdefs.h +5 -0
- package/sdk/ios/usr/include/sys/ioccom.h +99 -0
- package/sdk/ios/usr/include/sys/syslog.h +236 -0
- package/sdk/ios/usr/include/syslog.h +24 -0
- package/sdk/ios/wasm/include/errno.h +4 -20
- package/sdk/ios/wasm/include/fcntl.h +4 -2
- package/sdk/ios/wasm/include/pthread.h +3 -0
- package/sdk/ios/wasm/include/setjmp.h +57 -0
- package/sdk/ios/wasm/include/stdio.h +24 -0
- package/sdk/ios/wasm/include/stdlib.h +32 -7
- package/sdk/ios/wasm/include/sys/file.h +7 -0
- package/sdk/ios/wasm/include/sys/ioctl.h +6 -0
- package/sdk/ios/wasm/include/sys/resource.h +2 -2
- package/sdk/ios/wasm/include/sys/syscall.h +9 -0
- package/sdk/ios/wasm/include/sys/time.h +10 -0
- package/sdk/ios/wasm/include/unistd.h +12 -3
- package/sdk/native-hashes.json +4 -3
- package/skills/contrast/SKILL.md +2 -1
- package/skills/peach-debug/SKILL.md +0 -1
- package/skills/peach-perf/SKILL.md +0 -1
- package/skills/peach-setup/SKILL.md +0 -1
- package/skills/peach-test/SKILL.md +7 -4
- package/skills/peach-visual/SKILL.md +0 -1
- package/src/admitted-mac-build.ts +3 -0
- package/src/android-app-identity.ts +18 -0
- package/src/android-autolinking.ts +1 -0
- package/src/android-bridge-packages.ts +279 -0
- package/src/android-root-module.ts +9 -9
- package/src/appPackageContract.ts +83 -0
- package/src/bridge-contract.ts +50 -0
- package/src/bundle-channel.mjs +41 -6
- package/src/cli-runtime.ts +9 -5
- package/src/dev-bundle-resolution.ts +7 -27
- package/src/dom-source-reference.ts +15 -0
- package/src/expo-discovery-cache.ts +134 -26
- package/src/expo-kotlin-host.ts +97 -26
- package/src/expo-manifest-body.ts +33 -0
- package/src/expo-native-workspace.ts +158 -38
- package/src/expo-swift-host.ts +350 -75
- package/src/expo-swift-ready.ts +5 -1
- package/src/expoKotlinContract.ts +12 -2
- package/src/expoSwiftContract.ts +10 -0
- package/src/generated/swift-c-predefines.json +1 -1
- package/src/home-paths.ts +41 -2
- package/src/host/app-package-handler.ts +47 -0
- package/src/host/bridge-host.ts +8 -0
- package/src/host/fetch-proxy-handler.ts +10 -0
- package/src/host/staged-host-files.ts +18 -0
- package/src/index.ts +3 -0
- package/src/kotlin-host.ts +225 -48
- package/src/kotlin-instance-source.ts +126 -0
- package/src/kotlinSdkContract.ts +2 -1
- package/src/menu.ts +14 -0
- package/src/native-app-identity-project.ts +7 -2
- package/src/native-app-identity.ts +11 -0
- package/src/native-firebase-config.ts +24 -1
- package/src/native-prebuilt.ts +154 -0
- package/src/nitro-adapter.lock.json +270 -270
- package/src/nitro-adapter.ts +56 -50
- package/src/nitro-bundle.ts +92 -74
- package/src/nitro-compile.ts +45 -14
- package/src/nitro-dependencies.ts +63 -46
- package/src/nitro-source.ts +64 -26
- package/src/nitroAdapterContract.ts +146 -98
- package/src/nitroContract.ts +71 -21
- package/src/react-native-bridge-modules.ts +70 -42
- package/src/react-native-host-modules.ts +34 -1
- package/src/reactNativeConfigurationContract.ts +14 -0
- package/src/reap-browser.ts +15 -3
- package/src/sdk.ts +5 -0
- package/src/settingsContract.ts +38 -1
- package/src/sim-client.ts +4 -1
- package/src/storageSnapshotContract.ts +32 -81
- package/src/swift-compile.ts +268 -89
- package/src/swift-coverage/indexdump.ts +22 -6
- package/src/swift-coverage/indexing.ts +4 -4
- package/src/swift-coverage/provenance.ts +1 -0
- package/src/swift-coverage/sdk.ts +104 -20
- package/src/swift-coverage/types.ts +34 -0
- package/src/swift-coverage/xcode-asset-symbols.ts +922 -0
- package/src/swift-coverage/xcode-assets.ts +89 -131
- package/src/swift-coverage/xcode.ts +10 -2
- package/src/swift-cxx-reachable.ts +2 -1
- package/src/swift-distribution.lock.json +20 -16
- package/src/swift-host.ts +98 -22
- package/src/swift-icu.ts +1 -1
- package/src/swift-link-roots.ts +118 -0
- package/src/swift-objc-compile.ts +144 -22
- package/src/swift-objc-import.ts +6 -0
- package/src/swift-objc-standin.ts +2 -14
- package/src/swift-package-manifest.ts +14 -6
- package/src/swift-packages.ts +75 -11
- package/src/swift-pdf-raster.ts +1 -0
- package/src/swift-root-lock.ts +17 -1
- package/src/swift-source-pods.ts +2 -10
- package/src/swift-standin-emit.ts +597 -57
- package/src/swift-standins.ts +599 -56
- package/src/swift-submit.ts +7 -1
- package/src/swift-toolchain.ts +140 -17
- package/src/turbo-bundle.ts +81 -0
- package/src/turbo-codegen-intake.ts +91 -0
- package/src/turbo-compile.ts +120 -0
- package/src/turbo-runtime.lock.json +69 -0
- package/src/turbo-source.ts +754 -0
- package/src/vite-plugin-one.ts +17 -12
- package/src/vite-plugin.ts +28 -15
- package/src/xcode-project.ts +223 -22
|
@@ -4,6 +4,7 @@ import fs from 'node:fs'
|
|
|
4
4
|
import path from 'node:path'
|
|
5
5
|
import { cacheDir } from './home-paths'
|
|
6
6
|
import { isRecord } from './is-record'
|
|
7
|
+
import { DOUBLE_CONVERSION_WASM32_BACKPORT } from './nitro-dependencies'
|
|
7
8
|
import {
|
|
8
9
|
swiftSdkPaths,
|
|
9
10
|
swiftModuleSdk,
|
|
@@ -11,6 +12,7 @@ import {
|
|
|
11
12
|
swiftPeachModules,
|
|
12
13
|
} from './swift-compile'
|
|
13
14
|
import { swiftModuleToolchain } from './swift-distribution'
|
|
15
|
+
import { swiftClangImporterFlags } from './swift-objc-import'
|
|
14
16
|
import { swiftObjCRuntimeFlags } from './swift-objc-runtime'
|
|
15
17
|
import { iosDeploymentMinimum, objcSdkIntakeFlags } from './swift-objc-standin'
|
|
16
18
|
import {
|
|
@@ -109,6 +111,8 @@ export function xcodeObjCInputs(
|
|
|
109
111
|
) {
|
|
110
112
|
const sources = new Map<string, Buffer>()
|
|
111
113
|
const links: Record<string, string> = {}
|
|
114
|
+
const derivations: Record<string, { upstreamCommit: string; originalSha256: string }> =
|
|
115
|
+
{}
|
|
112
116
|
const checkouts = remoteSwiftCheckouts(app.rootDir)
|
|
113
117
|
const generated = new Map(
|
|
114
118
|
products?.files.map(({ path: declared, file }) => [declared, file]),
|
|
@@ -135,14 +139,31 @@ export function xcodeObjCInputs(
|
|
|
135
139
|
if (sources.has(file)) return
|
|
136
140
|
const resolved = header ? fs.realpathSync.native(file) : file
|
|
137
141
|
if (resolved !== file) links[file] = resolved
|
|
138
|
-
|
|
139
|
-
file,
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
142
|
+
const bytes = readPackageFile(
|
|
143
|
+
file.startsWith(`${checkouts}${path.sep}`) ? checkouts : app.rootDir,
|
|
144
|
+
resolved,
|
|
145
|
+
Infinity,
|
|
146
|
+
)
|
|
147
|
+
// the pod's own double-conversion utils.h takes the approved backport by
|
|
148
|
+
// its exact original bytes; the file on disk stays unchanged.
|
|
149
|
+
const backport = DOUBLE_CONVERSION_WASM32_BACKPORT
|
|
150
|
+
if (
|
|
151
|
+
path.basename(file) !== 'utils.h' ||
|
|
152
|
+
createHash('sha256').update(bytes).digest('hex') !== backport.originalSha256
|
|
153
|
+
) {
|
|
154
|
+
sources.set(file, bytes)
|
|
155
|
+
return
|
|
156
|
+
}
|
|
157
|
+
const derived = Buffer.from(
|
|
158
|
+
bytes.toString('utf8').replace(backport.before, backport.after),
|
|
145
159
|
)
|
|
160
|
+
if (createHash('sha256').update(derived).digest('hex') !== backport.derivedSha256)
|
|
161
|
+
throw new Error(`DoubleConversion backport derived source differs: ${file}`)
|
|
162
|
+
sources.set(file, derived)
|
|
163
|
+
derivations[file] = {
|
|
164
|
+
upstreamCommit: backport.upstreamCommit,
|
|
165
|
+
originalSha256: backport.originalSha256,
|
|
166
|
+
}
|
|
146
167
|
}
|
|
147
168
|
const walked = new Map<string, boolean>()
|
|
148
169
|
const ancestors = new Set<string>()
|
|
@@ -271,7 +292,12 @@ export function xcodeObjCInputs(
|
|
|
271
292
|
}
|
|
272
293
|
// xcode searches the frameworks of the package binary targets the app links
|
|
273
294
|
const binarySearch = binaries
|
|
274
|
-
.filter(
|
|
295
|
+
.filter(
|
|
296
|
+
(binary) =>
|
|
297
|
+
binary.reached &&
|
|
298
|
+
binary.publicHeaders === undefined &&
|
|
299
|
+
binary.placeholder === undefined,
|
|
300
|
+
)
|
|
275
301
|
.map((binary) => binaryHeaderSearchPaths(binary, checkouts))
|
|
276
302
|
const binaryFrameworks = binarySearch.flatMap((search) => search.frameworks)
|
|
277
303
|
const binaryHeaders = binarySearch.flatMap((search) => search.headers)
|
|
@@ -287,6 +313,40 @@ export function xcodeObjCInputs(
|
|
|
287
313
|
add(file, !file.endsWith('.swift'))
|
|
288
314
|
}
|
|
289
315
|
if (!target.objc) continue
|
|
316
|
+
// a framework consumer resolves its dependency's module through the
|
|
317
|
+
// published framework layout, so the overlay publishes the extended
|
|
318
|
+
// compatibility map and the generated interface header instead of the
|
|
319
|
+
// unextended originals: with the originals the Swift submodule never
|
|
320
|
+
// attaches and the consumer fails on undeclared identifiers.
|
|
321
|
+
const compatibility = target.swift?.compatibility
|
|
322
|
+
let productHeaders = target.objc.productHeaders
|
|
323
|
+
if (
|
|
324
|
+
compatibility?.framework &&
|
|
325
|
+
generated.has(compatibility.outputModuleMap) &&
|
|
326
|
+
generated.has(compatibility.outputHeader)
|
|
327
|
+
) {
|
|
328
|
+
let umbrellaDir: string | undefined
|
|
329
|
+
let frameworkDir: string | undefined
|
|
330
|
+
const rewritten: Record<string, string> = {}
|
|
331
|
+
for (const [product, file] of Object.entries(productHeaders)) {
|
|
332
|
+
if (
|
|
333
|
+
file === compatibility.moduleMap &&
|
|
334
|
+
product.endsWith(`${path.sep}Modules${path.sep}module.modulemap`)
|
|
335
|
+
) {
|
|
336
|
+
rewritten[product] = compatibility.outputModuleMap
|
|
337
|
+
frameworkDir ??= path.dirname(path.dirname(product))
|
|
338
|
+
} else {
|
|
339
|
+
rewritten[product] = file
|
|
340
|
+
if (file === compatibility.umbrella) umbrellaDir ??= path.dirname(product)
|
|
341
|
+
}
|
|
342
|
+
}
|
|
343
|
+
const headersDir =
|
|
344
|
+
umbrellaDir ?? (frameworkDir ? path.join(frameworkDir, 'Headers') : undefined)
|
|
345
|
+
if (headersDir)
|
|
346
|
+
rewritten[path.join(headersDir, path.basename(compatibility.outputHeader))] =
|
|
347
|
+
compatibility.outputHeader
|
|
348
|
+
productHeaders = rewritten
|
|
349
|
+
}
|
|
290
350
|
const frameworkSearchPaths = [
|
|
291
351
|
...target.objc.frameworkSearchPaths,
|
|
292
352
|
...binaryFrameworks,
|
|
@@ -300,7 +360,7 @@ export function xcodeObjCInputs(
|
|
|
300
360
|
...[target.objc.prefixHeader, target.objc.bridgingHeader].filter(
|
|
301
361
|
(file): file is string => file !== null,
|
|
302
362
|
),
|
|
303
|
-
...Object.values(
|
|
363
|
+
...Object.values(productHeaders),
|
|
304
364
|
...target.objc.headerMaps.flatMap((map) =>
|
|
305
365
|
map.entries.flatMap(([, file]) =>
|
|
306
366
|
path.isAbsolute(file) && fs.existsSync(file) ? [file] : [],
|
|
@@ -381,12 +441,12 @@ export function xcodeObjCInputs(
|
|
|
381
441
|
prefix: target.objc.prefixHeader,
|
|
382
442
|
fileFlags: target.objc.fileFlags,
|
|
383
443
|
headerMaps: target.objc.headerMaps,
|
|
384
|
-
productHeaders
|
|
444
|
+
productHeaders,
|
|
385
445
|
moduleMaps: linkedMaps,
|
|
386
446
|
})
|
|
387
447
|
}
|
|
388
448
|
for (const file of generated.keys()) add(file)
|
|
389
|
-
return { sources, links, targets }
|
|
449
|
+
return { sources, links, derivations, targets }
|
|
390
450
|
}
|
|
391
451
|
|
|
392
452
|
/** builds dependency Swift before its generated compatibility headers are consumed. */
|
|
@@ -442,7 +502,7 @@ export function prepareXcodeSwiftProducts(
|
|
|
442
502
|
frontendFlags.push(flag === '-Xfrontend' ? options[++index]! : flag)
|
|
443
503
|
}
|
|
444
504
|
const identity = {
|
|
445
|
-
version:
|
|
505
|
+
version: 3,
|
|
446
506
|
sdk: swiftModuleSdk(moduleRoot),
|
|
447
507
|
distribution: swiftModuleDigest(moduleRoot).toString('hex'),
|
|
448
508
|
compiler: digest(fs.readFileSync(frontend)),
|
|
@@ -578,6 +638,7 @@ export function prepareXcodeSwiftProducts(
|
|
|
578
638
|
const compatibility = target.swift!.compatibility!
|
|
579
639
|
const outputMap = local(compatibility.outputModuleMap)
|
|
580
640
|
const outputHeader = local(compatibility.outputHeader)
|
|
641
|
+
let ownMap = local(compatibility.moduleMap)
|
|
581
642
|
const outputModule = path.join(
|
|
582
643
|
preparation.modules,
|
|
583
644
|
`${target.moduleName}.swiftmodule`,
|
|
@@ -586,6 +647,33 @@ export function prepareXcodeSwiftProducts(
|
|
|
586
647
|
fs.mkdirSync(path.dirname(outputHeader), { recursive: true })
|
|
587
648
|
fs.copyFileSync(local(compatibility.moduleMap), outputMap)
|
|
588
649
|
fs.copyFileSync(local(compatibility.umbrella), local(compatibility.outputUmbrella))
|
|
650
|
+
// a framework module resolves its umbrella against the framework's
|
|
651
|
+
// Headers/, as xcode's product layout provides; the staged original
|
|
652
|
+
// sits in source layout, so the own compile reads a framework-layout
|
|
653
|
+
// view of the same unextended bytes.
|
|
654
|
+
const provider = providers.get(target.moduleName)
|
|
655
|
+
if (compatibility.framework && !provider) {
|
|
656
|
+
const viewModules = path.join(
|
|
657
|
+
work,
|
|
658
|
+
'frameworks',
|
|
659
|
+
`${target.moduleName}.framework`,
|
|
660
|
+
'Modules',
|
|
661
|
+
'module.modulemap',
|
|
662
|
+
)
|
|
663
|
+
const viewHeaders = path.join(
|
|
664
|
+
work,
|
|
665
|
+
'frameworks',
|
|
666
|
+
`${target.moduleName}.framework`,
|
|
667
|
+
'Headers',
|
|
668
|
+
path.basename(compatibility.umbrella),
|
|
669
|
+
)
|
|
670
|
+
fs.mkdirSync(path.dirname(viewModules), { recursive: true })
|
|
671
|
+
fs.mkdirSync(path.dirname(viewHeaders), { recursive: true })
|
|
672
|
+
fs.copyFileSync(ownMap, viewModules)
|
|
673
|
+
fs.copyFileSync(local(compatibility.umbrella), viewHeaders)
|
|
674
|
+
generated.push(viewModules, viewHeaders)
|
|
675
|
+
ownMap = viewModules
|
|
676
|
+
}
|
|
589
677
|
const minimum = iosDeploymentMinimum(target.iosDeploymentTarget)
|
|
590
678
|
if (minimum === undefined)
|
|
591
679
|
throw new Error(
|
|
@@ -605,9 +693,8 @@ export function prepareXcodeSwiftProducts(
|
|
|
605
693
|
'-F',
|
|
606
694
|
remap(file),
|
|
607
695
|
]),
|
|
608
|
-
...(target.objc?.flags ?? []).map(remap),
|
|
696
|
+
...swiftClangImporterFlags(target.objc?.flags ?? []).map(remap),
|
|
609
697
|
]
|
|
610
|
-
const provider = providers.get(target.moduleName)
|
|
611
698
|
const swiftFlags: string[] = []
|
|
612
699
|
for (let index = 0; index < target.swift!.flags.length; index++) {
|
|
613
700
|
const flag = target.swift!.flags[index]!
|
|
@@ -615,6 +702,18 @@ export function prepareXcodeSwiftProducts(
|
|
|
615
702
|
remap(flag === '-Xfrontend' ? target.swift!.flags[++index]! : flag),
|
|
616
703
|
)
|
|
617
704
|
}
|
|
705
|
+
// a framework target carries no own-map flag; xcode resolves its
|
|
706
|
+
// underlying module through the unextended overlay instead. the staged
|
|
707
|
+
// original is that same unextended view, added exactly once.
|
|
708
|
+
const carriesOwnMap =
|
|
709
|
+
provider !== undefined ||
|
|
710
|
+
target.swift!.flags.some(
|
|
711
|
+
(flag) =>
|
|
712
|
+
flag.startsWith('-fmodule-map-file=') &&
|
|
713
|
+
fs.existsSync(flag.slice('-fmodule-map-file='.length)) &&
|
|
714
|
+
fs.realpathSync.native(flag.slice('-fmodule-map-file='.length)) ===
|
|
715
|
+
fs.realpathSync.native(compatibility.moduleMap),
|
|
716
|
+
)
|
|
618
717
|
const args = [
|
|
619
718
|
...(provider
|
|
620
719
|
? ['-merge-modules', '-emit-module']
|
|
@@ -647,9 +746,12 @@ export function prepareXcodeSwiftProducts(
|
|
|
647
746
|
...(target.objc?.bridgingHeader
|
|
648
747
|
? ['-import-objc-header', local(target.objc.bridgingHeader)]
|
|
649
748
|
: ['-import-underlying-module']),
|
|
650
|
-
// the pod's own compile reads its genuine original map
|
|
651
|
-
//
|
|
652
|
-
//
|
|
749
|
+
// the pod's own compile reads its genuine original map: static
|
|
750
|
+
// targets through their remapped flags, framework targets
|
|
751
|
+
// through the staged original, which is xcode's unextended view
|
|
752
|
+
// without the overlay. the output copy below serves consumers
|
|
753
|
+
// only, since two maps defining the module fail.
|
|
754
|
+
...(carriesOwnMap ? [] : ['-Xcc', `-fmodule-map-file=${ownMap}`]),
|
|
653
755
|
'-emit-module-path',
|
|
654
756
|
outputModule,
|
|
655
757
|
...target.sources.map(local),
|
|
@@ -684,11 +786,15 @@ export function prepareXcodeSwiftProducts(
|
|
|
684
786
|
throw new Error(
|
|
685
787
|
`${target.moduleName}: Swift compatibility product compilation failed. ${fs.readFileSync(log, 'utf8')}\nInputs: ${preparation.receipt}`,
|
|
686
788
|
)
|
|
687
|
-
// preserve
|
|
789
|
+
// preserve the public map and expose only the compiler's
|
|
790
|
+
// declarations: CocoaPods' script shape for libraries, xcode's appended
|
|
791
|
+
// stanza shape for frameworks.
|
|
688
792
|
const relativeHeader = path.relative(path.dirname(outputMap), outputHeader)
|
|
689
793
|
fs.appendFileSync(
|
|
690
794
|
outputMap,
|
|
691
|
-
|
|
795
|
+
compatibility.framework
|
|
796
|
+
? `\n\nmodule ${target.moduleName}.Swift {\n header ${JSON.stringify(path.basename(outputHeader))}\n}\n`
|
|
797
|
+
: `\n\nmodule ${target.moduleName}.Swift {\n header ${JSON.stringify(relativeHeader)}\n requires objc\n}\n`,
|
|
692
798
|
)
|
|
693
799
|
generated.push(
|
|
694
800
|
outputModule,
|
|
@@ -736,7 +842,11 @@ export function prepareXcodeObjCImplementations(
|
|
|
736
842
|
const toolchain = swiftModuleToolchain(moduleRoot)
|
|
737
843
|
const sdk = swiftSdkPaths(moduleRoot, toolchain.toolchainBin)
|
|
738
844
|
const products = prepareXcodeSwiftProducts(app, binaries, moduleRoot)
|
|
739
|
-
const { sources, links, targets } = xcodeObjCInputs(
|
|
845
|
+
const { sources, links, derivations, targets } = xcodeObjCInputs(
|
|
846
|
+
app,
|
|
847
|
+
binaries,
|
|
848
|
+
products,
|
|
849
|
+
)
|
|
740
850
|
const checkouts = remoteSwiftCheckouts(app.rootDir)
|
|
741
851
|
const digest = (bytes: Buffer | string) =>
|
|
742
852
|
createHash('sha256').update(bytes).digest('hex')
|
|
@@ -748,7 +858,7 @@ export function prepareXcodeObjCImplementations(
|
|
|
748
858
|
// records as a marker here; minimumFor still owns the failure below.
|
|
749
859
|
const headers = path.join(sdk.sysroot, 'darwin')
|
|
750
860
|
const identity = {
|
|
751
|
-
version:
|
|
861
|
+
version: 23,
|
|
752
862
|
importer: STANDIN_SOURCE_DIGEST,
|
|
753
863
|
intake: targets.map((target) => {
|
|
754
864
|
const minimum = iosDeploymentMinimum(target.deploymentTarget)
|
|
@@ -762,6 +872,7 @@ export function prepareXcodeObjCImplementations(
|
|
|
762
872
|
targets,
|
|
763
873
|
inputs,
|
|
764
874
|
links,
|
|
875
|
+
derivations,
|
|
765
876
|
swiftProducts: products?.receipt,
|
|
766
877
|
}
|
|
767
878
|
const parent = path.join(cacheDir(), 'swift-objc-implementations')
|
|
@@ -1013,11 +1124,22 @@ export function prepareXcodeObjCImplementations(
|
|
|
1013
1124
|
return `-fmodule-map-file=${staged(flag.slice('-fmodule-map-file='.length))}`
|
|
1014
1125
|
return include ? `${include[1]}${staged(include[2]!)}` : flag
|
|
1015
1126
|
})
|
|
1127
|
+
// xcode passes the cache path with -fmodules, and apple clang claims it
|
|
1128
|
+
// in a c++ unit whose modules are off; this clang reports it unused,
|
|
1129
|
+
// which -Werror turns into a failure.
|
|
1130
|
+
const modules =
|
|
1131
|
+
flags.includes('-fmodules') &&
|
|
1132
|
+
(!cxx ||
|
|
1133
|
+
flags.lastIndexOf('-fno-cxx-modules') <= flags.lastIndexOf('-fcxx-modules'))
|
|
1016
1134
|
const args = [
|
|
1017
1135
|
'--target=wasm32-unknown-wasip1',
|
|
1018
1136
|
`--sysroot=${sdk.sysroot}`,
|
|
1019
1137
|
'-fwasm-exceptions',
|
|
1020
1138
|
'-fexceptions',
|
|
1139
|
+
// the backend lowers direct setjmp-family calls; -lsetjmp is already
|
|
1140
|
+
// linked. no-op for units without setjmp calls (byte-identical).
|
|
1141
|
+
'-mllvm',
|
|
1142
|
+
'-wasm-enable-sjlj',
|
|
1021
1143
|
...(objc ? [...swiftObjCRuntimeFlags, '-fobjc-exceptions'] : []),
|
|
1022
1144
|
...objcSdkIntakeFlags(headers, toolchain.toolchainBin, minimum),
|
|
1023
1145
|
...headerSearch.flags[index]!,
|
|
@@ -1025,7 +1147,7 @@ export function prepareXcodeObjCImplementations(
|
|
|
1025
1147
|
...target.frameworks.flatMap((framework) => ['-F', staged(framework)]),
|
|
1026
1148
|
...moduleMaps[index]!,
|
|
1027
1149
|
`-fmodule-name=${swiftTargetModuleName(target.name)}`,
|
|
1028
|
-
`-fmodules-cache-path=${path.join(work, 'module-cache')}
|
|
1150
|
+
...(modules ? [`-fmodules-cache-path=${path.join(work, 'module-cache')}`] : []),
|
|
1029
1151
|
...flags,
|
|
1030
1152
|
...(target.prefix ? ['-include', staged(target.prefix)] : []),
|
|
1031
1153
|
'-Os',
|
package/src/swift-objc-import.ts
CHANGED
|
@@ -11,6 +11,12 @@ export const SWIFT_OBJC_INTEROP_FLAGS = [
|
|
|
11
11
|
'-fblocks',
|
|
12
12
|
]
|
|
13
13
|
|
|
14
|
+
// swift's clang importer reads objective-c only under arc, as xcode's swift
|
|
15
|
+
// compile does; a target's CLANG_ENABLE_OBJC_ARC governs its own units only.
|
|
16
|
+
export function swiftClangImporterFlags(flags: readonly string[]): string[] {
|
|
17
|
+
return flags.filter((flag) => flag !== '-fobjc-arc' && flag !== '-fno-objc-arc')
|
|
18
|
+
}
|
|
19
|
+
|
|
14
20
|
// swiftpm synthesizes a module map for public headers when the package provides
|
|
15
21
|
// none. original xcode and package module maps retain their own contents.
|
|
16
22
|
export function swiftObjCModuleMap(module: string, headers: readonly string[]): string {
|
|
@@ -273,20 +273,8 @@ function iosSdkEntries(): (readonly [string, string])[] {
|
|
|
273
273
|
`// swift-interface-format-version: 1.0\n// swift-module-flags: -target ${IOS_SDK_TARGET} -enable-objc-interop -enable-library-evolution -module-name ${module}\n${text}`,
|
|
274
274
|
] as const,
|
|
275
275
|
)
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
// resolves the way the ios sdk resolves it. it holds no headers, so no
|
|
279
|
-
// sdk header can shadow the sysroot, and a swift module of the same name
|
|
280
|
-
// still answers a plain import. emitted here so the one atomic rename
|
|
281
|
-
// owns everything under the sdk id.
|
|
282
|
-
const osMap = IOS_SDK_HEADERS['usr/include/os.modulemap']
|
|
283
|
-
if (osMap === undefined)
|
|
284
|
-
throw new Error('sdk intake has no usr/include/os.modulemap for clang-import')
|
|
285
|
-
const clangImport: (readonly [string, string])[] = [
|
|
286
|
-
['clang-import/module.modulemap', osMap],
|
|
287
|
-
]
|
|
288
|
-
return [...Object.entries(IOS_SDK_HEADERS), ...overlays, ...clangImport].sort(
|
|
289
|
-
([a], [b]) => (a < b ? -1 : 1),
|
|
276
|
+
return [...Object.entries(IOS_SDK_HEADERS), ...overlays].sort(([a], [b]) =>
|
|
277
|
+
a < b ? -1 : 1,
|
|
290
278
|
)
|
|
291
279
|
}
|
|
292
280
|
|
|
@@ -158,6 +158,16 @@ function swiftCommand(): string {
|
|
|
158
158
|
return path.join(swiftToolchainBin(lock.release), 'swift')
|
|
159
159
|
}
|
|
160
160
|
|
|
161
|
+
function swiftPackageFailure(error: unknown): string {
|
|
162
|
+
if (!(error instanceof Error)) return String(error)
|
|
163
|
+
const stderr =
|
|
164
|
+
'stderr' in error &&
|
|
165
|
+
(typeof error.stderr === 'string' || Buffer.isBuffer(error.stderr))
|
|
166
|
+
? error.stderr.toString().trim()
|
|
167
|
+
: ''
|
|
168
|
+
return stderr || error.message
|
|
169
|
+
}
|
|
170
|
+
|
|
161
171
|
const cacheDir = path.join(peachCacheDir(), 'swift-manifests')
|
|
162
172
|
const evaluated = new Map<string, SwiftPackageManifest>()
|
|
163
173
|
|
|
@@ -215,10 +225,9 @@ function dump(dir: string): {
|
|
|
215
225
|
},
|
|
216
226
|
)
|
|
217
227
|
} catch (error) {
|
|
218
|
-
const stderr =
|
|
219
|
-
error instanceof Error && 'stderr' in error ? String(error.stderr).trim() : ''
|
|
220
228
|
throw new Error(
|
|
221
|
-
`swiftpm could not evaluate ${path.join(dir, 'Package.swift')}
|
|
229
|
+
`swiftpm could not evaluate ${path.join(dir, 'Package.swift')}: ${swiftPackageFailure(error)}`,
|
|
230
|
+
{ cause: error },
|
|
222
231
|
)
|
|
223
232
|
}
|
|
224
233
|
fs.mkdirSync(cacheDir, { recursive: true })
|
|
@@ -693,10 +702,9 @@ let package = Package(
|
|
|
693
702
|
},
|
|
694
703
|
)
|
|
695
704
|
} catch (error) {
|
|
696
|
-
const stderr =
|
|
697
|
-
error instanceof Error && 'stderr' in error ? String(error.stderr).trim() : ''
|
|
698
705
|
throw new Error(
|
|
699
|
-
`swiftpm could not resolve ${clauses.length} package requirements${
|
|
706
|
+
`swiftpm could not resolve ${clauses.length} package requirements (${clauses.join(', ')}): ${swiftPackageFailure(error)}`,
|
|
707
|
+
{ cause: error },
|
|
700
708
|
)
|
|
701
709
|
}
|
|
702
710
|
const resolved = path.join(dir, 'Package.resolved')
|
package/src/swift-packages.ts
CHANGED
|
@@ -110,8 +110,26 @@ export interface SwiftPackageBinary {
|
|
|
110
110
|
clients?: string[]
|
|
111
111
|
/** simulator library headers actually included by original C++ units. */
|
|
112
112
|
cxxHeaders?: { roots: string[]; reached: string[]; flags: string[]; error?: string }
|
|
113
|
+
/** a swift target of a placeholder package: the compiler gap that forces
|
|
114
|
+
* it, its sources relative to dir, and the swiftc flags its settings give
|
|
115
|
+
* them. it stands in from its own sources' public interface. */
|
|
116
|
+
placeholder?: { gap: string; sources: string[]; flags: string[] }
|
|
113
117
|
}
|
|
114
118
|
|
|
119
|
+
// sdks that send telemetry, by package identity, that peach's swift cannot
|
|
120
|
+
// compile yet, each with the compiler gap that forces it. their swift targets
|
|
121
|
+
// stand in from their own public interface with inert bodies, so an app's
|
|
122
|
+
// calls compile and run and nothing is sent. an entry goes once the real sdk
|
|
123
|
+
// compiles.
|
|
124
|
+
export const SWIFT_PLACEHOLDER_PACKAGES: ReadonlyMap<string, string> = new Map([
|
|
125
|
+
[
|
|
126
|
+
'dd-sdk-ios',
|
|
127
|
+
"DatadogInternal's NetworkInstrumentation names URLSessionDataDelegate, URLSessionTaskDelegate and URLSessionTaskMetrics, which FoundationNetworking and the SDK's Objective-C Foundation headers both declare",
|
|
128
|
+
],
|
|
129
|
+
])
|
|
130
|
+
const placeholderPackage = (pkg: LoadedPackage) =>
|
|
131
|
+
SWIFT_PLACEHOLDER_PACKAGES.get(swiftPackageIdentity(pkg.manifest.dir))
|
|
132
|
+
|
|
115
133
|
/** dependency checkouts belong to peach, isolated by the canonical app root. */
|
|
116
134
|
export function remoteSwiftCheckouts(root: string): string {
|
|
117
135
|
const key = createHash('sha256')
|
|
@@ -254,9 +272,17 @@ function resolvableSubmodulePaths(
|
|
|
254
272
|
else entry.url = match[3]
|
|
255
273
|
entries.set(match[1]!, entry)
|
|
256
274
|
}
|
|
257
|
-
|
|
275
|
+
const named = [...entries.values()]
|
|
258
276
|
.filter((entry) => entry.path !== undefined && entry.url !== undefined)
|
|
259
277
|
.map((entry) => entry.path!)
|
|
278
|
+
if (named.length === 0) return []
|
|
279
|
+
const gitlinks = new Set(
|
|
280
|
+
git(dir, 'ls-files', '--stage', '--', ...named)
|
|
281
|
+
.split('\n')
|
|
282
|
+
.filter((line) => line.startsWith('160000 '))
|
|
283
|
+
.map((line) => line.slice(line.indexOf('\t') + 1)),
|
|
284
|
+
)
|
|
285
|
+
return named.filter((submodule) => gitlinks.has(submodule))
|
|
260
286
|
}
|
|
261
287
|
|
|
262
288
|
// a shallow checkout of exactly the pinned revision, reused while HEAD is it.
|
|
@@ -334,10 +360,11 @@ function checkout(checkouts: string, identity: string, pin: Pin): string {
|
|
|
334
360
|
// relative submodule urls resolve against origin, which a fetch-by-url
|
|
335
361
|
// never configures, so the pinned location is named as origin and sync
|
|
336
362
|
// repairs urls recorded against a missing origin before update checks out
|
|
337
|
-
// the gitlink pins. only
|
|
338
|
-
// a
|
|
339
|
-
//
|
|
340
|
-
// the
|
|
363
|
+
// the gitlink pins. only gitlinks the tree records whose .gitmodules entry
|
|
364
|
+
// names a url resolve, as swiftpm's bare `submodule update` selects them: a
|
|
365
|
+
// stale gitlink without a .gitmodules entry (gifu's GifuDocs) stays an empty
|
|
366
|
+
// dir, and a .gitmodules entry whose path the tree has no gitlink for
|
|
367
|
+
// (apollo-ios's docs/renderer) is skipped, instead of failing the fetch.
|
|
341
368
|
let submoduleRelease = tryAcquireNumberedLock(`${dir}.lock`)
|
|
342
369
|
while (!submoduleRelease) {
|
|
343
370
|
Atomics.wait(new Int32Array(new SharedArrayBuffer(4)), 0, 0, 25)
|
|
@@ -548,14 +575,17 @@ export function resolveSwiftPackages(options: {
|
|
|
548
575
|
const assembly = target.declaresWasiNativeSettings
|
|
549
576
|
? []
|
|
550
577
|
: files.filter((file) => UNSUPPORTED_NATIVE.test(file))
|
|
578
|
+
const placeholder = placeholderPackage(pkg)
|
|
551
579
|
const ownReason =
|
|
552
580
|
target.type === 'binary'
|
|
553
581
|
? `${name} ${BINARY}${gap ? `; ${gap}` : ''}`
|
|
554
|
-
:
|
|
555
|
-
? `${name}
|
|
556
|
-
:
|
|
557
|
-
? `${name} is
|
|
558
|
-
:
|
|
582
|
+
: placeholder && gap
|
|
583
|
+
? `${name} stands in as a placeholder (${placeholder}), and ${gap}`
|
|
584
|
+
: target.type !== 'regular' && target.type !== 'system'
|
|
585
|
+
? `${name} is a ${target.type} target`
|
|
586
|
+
: assembly.length > 0
|
|
587
|
+
? `${name} is an assembly target with no wasm32 lowering: ${assembly.map((file) => path.relative(pkg.manifest.dir, file)).join(', ')}${gap ? `; ${gap}` : ''}`
|
|
588
|
+
: null
|
|
559
589
|
// every dependency resolves, so a failing one never hides the rest
|
|
560
590
|
// of the closure from the compile or from the report
|
|
561
591
|
const reasons = target.dependencies.map((dependency) => {
|
|
@@ -683,7 +713,39 @@ export function resolveSwiftPackages(options: {
|
|
|
683
713
|
const objc =
|
|
684
714
|
target.type === 'regular' && files.some((file) => /\.(m|mm)$/.test(file))
|
|
685
715
|
const assembly = assemblySources(files, target)
|
|
686
|
-
|
|
716
|
+
const gap = placeholderPackage(pkg)
|
|
717
|
+
const sources = files.filter((file) => file.endsWith('.swift'))
|
|
718
|
+
// swiftpm's release settings, as xcode builds a package for any
|
|
719
|
+
// configuration other than Debug
|
|
720
|
+
const release = (setting: SwiftManifestSetting) => setting.configuration !== 'debug'
|
|
721
|
+
if (gap && target.type === 'regular' && !objc && sources.length > 0)
|
|
722
|
+
result.binaries.push({
|
|
723
|
+
target: name,
|
|
724
|
+
source: pkg.source,
|
|
725
|
+
url: null,
|
|
726
|
+
checksum: null,
|
|
727
|
+
dir: pkg.manifest.dir,
|
|
728
|
+
reached: false,
|
|
729
|
+
placeholder: {
|
|
730
|
+
gap,
|
|
731
|
+
sources: sources.map((file) => path.relative(pkg.manifest.dir, file)),
|
|
732
|
+
flags: [
|
|
733
|
+
'-swift-version',
|
|
734
|
+
String(target.languageMode),
|
|
735
|
+
'-package-name',
|
|
736
|
+
swiftPackageIdentity(pkg.manifest.dir),
|
|
737
|
+
'-DSWIFT_PACKAGE',
|
|
738
|
+
...target.defines.filter(release).flatMap(({ name }) => ['-D', name]),
|
|
739
|
+
...target.experimentalFeatures
|
|
740
|
+
.filter(release)
|
|
741
|
+
.flatMap(({ name }) => ['-enable-experimental-feature', name]),
|
|
742
|
+
...target.upcomingFeatures
|
|
743
|
+
.filter(release)
|
|
744
|
+
.flatMap(({ name }) => ['-enable-upcoming-feature', name]),
|
|
745
|
+
],
|
|
746
|
+
},
|
|
747
|
+
})
|
|
748
|
+
else if (target.type === 'binary' || objc || assembly)
|
|
687
749
|
result.binaries.push({
|
|
688
750
|
target: name,
|
|
689
751
|
source: pkg.source,
|
|
@@ -729,6 +791,8 @@ export function resolveSwiftPackages(options: {
|
|
|
729
791
|
if (found.has(key)) return
|
|
730
792
|
found.add(key)
|
|
731
793
|
if (pkg.manifest.targets.get(name)?.type === 'macro') return
|
|
794
|
+
// a placeholder standing in needs none of what its sources import
|
|
795
|
+
if (provided.has(name) && placeholderPackage(pkg)) return
|
|
732
796
|
for (const dependency of pkg.manifest.targets.get(name)?.dependencies ?? []) {
|
|
733
797
|
if (dependency.kind === 'target') visit(pkg, dependency.name)
|
|
734
798
|
else {
|
package/src/swift-pdf-raster.ts
CHANGED
|
@@ -61,6 +61,7 @@ function rasterBinary(): string {
|
|
|
61
61
|
)
|
|
62
62
|
fs.writeFileSync(source, RASTER_SWIFT)
|
|
63
63
|
try {
|
|
64
|
+
// runner-toolchain-platform: darwin
|
|
64
65
|
execFileSync('xcrun', ['swiftc', '-o', binary, source], { stdio: 'pipe' })
|
|
65
66
|
} finally {
|
|
66
67
|
fs.rmSync(path.dirname(source), { recursive: true, force: true })
|
package/src/swift-root-lock.ts
CHANGED
|
@@ -203,7 +203,21 @@ export async function withSwiftRootLock<T>(
|
|
|
203
203
|
root: string,
|
|
204
204
|
work: (lease: SwiftRootLease) => Promise<T>,
|
|
205
205
|
signal?: AbortSignal,
|
|
206
|
-
): Promise<T>
|
|
206
|
+
): Promise<T>
|
|
207
|
+
/** with `wait: false` a root another process holds is skipped: `work` does not
|
|
208
|
+
* run and the result is undefined. */
|
|
209
|
+
export async function withSwiftRootLock<T>(
|
|
210
|
+
root: string,
|
|
211
|
+
work: (lease: SwiftRootLease) => Promise<T>,
|
|
212
|
+
signal: AbortSignal | undefined,
|
|
213
|
+
wait: false,
|
|
214
|
+
): Promise<T | undefined>
|
|
215
|
+
export async function withSwiftRootLock<T>(
|
|
216
|
+
root: string,
|
|
217
|
+
work: (lease: SwiftRootLease) => Promise<T>,
|
|
218
|
+
signal?: AbortSignal,
|
|
219
|
+
wait = true,
|
|
220
|
+
): Promise<T | undefined> {
|
|
207
221
|
const directory = path.join(
|
|
208
222
|
rnxHomeDir(),
|
|
209
223
|
'cache',
|
|
@@ -223,11 +237,13 @@ export async function withSwiftRootLock<T>(
|
|
|
223
237
|
if (current && !current.released) {
|
|
224
238
|
const table = processTable()
|
|
225
239
|
if (table.some((row) => !row.zombie && sameProcess(row, current.holder))) {
|
|
240
|
+
if (!wait) return undefined
|
|
226
241
|
await pause(POLL_MS, signal)
|
|
227
242
|
continue
|
|
228
243
|
}
|
|
229
244
|
const children = readChildren(directory, newest)
|
|
230
245
|
if (children.some((child) => groupAlive(table, child))) {
|
|
246
|
+
if (!wait) return undefined
|
|
231
247
|
await pause(POLL_MS, signal)
|
|
232
248
|
continue
|
|
233
249
|
}
|
package/src/swift-source-pods.ts
CHANGED
|
@@ -341,16 +341,8 @@ export async function collectSwiftSourcePods(
|
|
|
341
341
|
const root = openXcodeProject(workspace, APP, moduleRoot, 'Release')
|
|
342
342
|
try {
|
|
343
343
|
const input = compileInput(root, 'main.swift')
|
|
344
|
-
if (
|
|
345
|
-
|
|
346
|
-
Object.values(input.resources ?? {}).some((encoded) => {
|
|
347
|
-
const bytes = Buffer.from(encoded, 'base64')
|
|
348
|
-
return !Buffer.from(bytes.toString('utf8')).equals(bytes)
|
|
349
|
-
})
|
|
350
|
-
)
|
|
351
|
-
throw new Error(
|
|
352
|
-
`${work}: binary pod resources require original binary file transport`,
|
|
353
|
-
)
|
|
344
|
+
if (Object.keys(input.images ?? {}).length > 0)
|
|
345
|
+
throw new Error(`${work}: pod image resources require original image transport`)
|
|
354
346
|
const targets = swiftManifestTargets(input.files['Package.swift']!).filter(
|
|
355
347
|
(target) => !target.executable,
|
|
356
348
|
)
|