peachsim 0.1.2935 → 0.1.2937
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/LICENSE +6 -8
- package/cli/account-gate.ts +20 -3
- package/cli/app-bundle-resources.ts +66 -19
- package/cli/catalog/meta.ts +2 -106
- package/cli/command-agent.ts +7 -0
- package/cli/command-registry.ts +0 -1
- package/cli/commands/control.ts +13 -5
- package/cli/commands/daemon.ts +4 -2
- package/cli/commands/device.ts +78 -8
- package/cli/commands/do-chain.ts +11 -8
- package/cli/commands/inspect/core.ts +4 -9
- package/cli/commands/inspect/settling.ts +1 -0
- package/cli/commands/logout.ts +6 -1
- package/cli/commands/map.ts +2 -6
- package/cli/commands/package.ts +112 -57
- package/cli/commands/shell-url.ts +0 -1
- package/cli/download-auth.ts +2 -0
- package/cli/drivers/playwright-provisioning.ts +10 -38
- package/cli/github-workflow-identity.ts +8 -0
- package/cli/internal-child-contract.ts +1 -0
- package/cli/internal-child.ts +5 -0
- package/cli/main.ts +2 -10
- package/cli/outbound-endpoints.ts +26 -0
- package/detox/index.ts +227 -131
- package/dist-lib/agent-daemon-client.cjs +1 -1
- package/dist-lib/agent-events.cjs +1 -1
- package/dist-lib/attached-projects.cjs +1 -1
- package/dist-lib/auth/shared-session.cjs +1 -1
- package/dist-lib/backend-origin.cjs +1 -1
- package/dist-lib/beta.cjs +1 -1
- package/dist-lib/beta.mjs +2 -2
- package/dist-lib/bridge-constants.cjs +1 -1
- package/dist-lib/bridge-contract-input.cjs +47 -3
- package/dist-lib/bridge-contract-input.mjs +6 -6
- package/dist-lib/bridge-contract.cjs +10 -1
- package/dist-lib/bridge-contract.mjs +3 -3
- package/dist-lib/bundle-channel.cjs +12779 -9515
- package/dist-lib/capture-contract.cjs +39 -17
- package/dist-lib/capture-contract.mjs +3 -3
- package/dist-lib/cloud-contract.cjs +1 -1
- package/dist-lib/cloud-contract.mjs +3 -3
- package/dist-lib/cloud-test-args.cjs +1 -1
- package/dist-lib/cloud-test-args.mjs +2 -2
- package/dist-lib/cloud.cjs +1 -1
- package/dist-lib/cloud.mjs +8 -8
- package/dist-lib/config.cjs +1 -1
- package/dist-lib/config.mjs +6 -6
- package/dist-lib/detox/index.cjs +200 -132
- package/dist-lib/dev-bundle-resolution.cjs +1 -1
- package/dist-lib/esm-chunks/{acorn-Q5TRRYSO.mjs → acorn-IIBLEO25.mjs} +3 -3
- package/dist-lib/esm-chunks/{chunk-UDWBTBVG.mjs → chunk-4FTPQKPT.mjs} +10 -1
- package/dist-lib/esm-chunks/chunk-4WIDTRBB.mjs +10232 -0
- package/dist-lib/esm-chunks/{chunk-LCMFYMT7.mjs → chunk-5QZOQ3NZ.mjs} +1 -1
- package/dist-lib/esm-chunks/{chunk-BJ2OGUX7.mjs → chunk-CIY67HNL.mjs} +39 -17
- package/dist-lib/esm-chunks/{chunk-SKQTNQYE.mjs → chunk-CQFEMJ64.mjs} +1 -1
- package/dist-lib/esm-chunks/{chunk-AXWVXRHX.mjs → chunk-CWVMCW23.mjs} +1 -1
- package/dist-lib/esm-chunks/{chunk-MTALOHQR.mjs → chunk-F6DZ4DS2.mjs} +1 -1
- package/dist-lib/esm-chunks/{chunk-I4R7IZRD.mjs → chunk-HJMF6O7L.mjs} +74 -46
- package/dist-lib/esm-chunks/chunk-I6T4PXJF.mjs +154 -0
- package/dist-lib/esm-chunks/{chunk-XWAUZKIA.mjs → chunk-IJU3JMWM.mjs} +1 -1
- package/dist-lib/esm-chunks/{chunk-CXWUIOCH.mjs → chunk-KODEPXQC.mjs} +4 -4
- package/dist-lib/esm-chunks/{chunk-WJE5QHSD.mjs → chunk-LD4K2VBL.mjs} +155 -36
- package/dist-lib/esm-chunks/{chunk-2TSM64HI.mjs → chunk-LTE7YMEG.mjs} +1 -1
- package/dist-lib/esm-chunks/{chunk-3GGOXUJA.mjs → chunk-M3CSKAJE.mjs} +1 -1
- package/dist-lib/esm-chunks/{chunk-7G5UETIG.mjs → chunk-NA6DJPB6.mjs} +43 -1
- package/dist-lib/esm-chunks/{chunk-MSUHMNAI.mjs → chunk-NNAX24FS.mjs} +1 -1
- package/dist-lib/esm-chunks/{chunk-VDJA4LP4.mjs → chunk-PZPJJBAS.mjs} +1 -1
- package/dist-lib/esm-chunks/{chunk-UEEEJVQA.mjs → chunk-QXSTHMWN.mjs} +1 -1
- package/dist-lib/esm-chunks/{chunk-S2RJB5I7.mjs → chunk-RBPVK5YI.mjs} +1 -1
- package/dist-lib/esm-chunks/{chunk-VRAXNGYT.mjs → chunk-SCT5OFDV.mjs} +1 -1
- package/dist-lib/esm-chunks/{chunk-T3M73LGP.mjs → chunk-U3CJGYSP.mjs} +50 -6
- package/dist-lib/esm-chunks/{chunk-SLUGTGQQ.mjs → chunk-VXTOQ522.mjs} +12 -6
- package/dist-lib/esm-chunks/{chunk-EL44SZMV.mjs → chunk-WMSVGYTH.mjs} +1 -1
- package/dist-lib/esm-chunks/{chunk-FEDEPSEV.mjs → chunk-WRWINRWK.mjs} +1 -1
- package/dist-lib/esm-chunks/{chunk-BNO52N2S.mjs → chunk-YZF2USRD.mjs} +1905 -8760
- package/dist-lib/esm-chunks/{chunk-TQLKYMVP.mjs → chunk-ZNHR6C3L.mjs} +1 -1
- package/dist-lib/esm-chunks/{download-auth-registry-G75MIT55.mjs → download-auth-registry-AHS5MSIB.mjs} +4 -4
- package/dist-lib/esm-chunks/{metro-layout-parser-FXLUDTYT.mjs → metro-layout-parser-24ZYK5UP.mjs} +3 -3
- package/dist-lib/esm-chunks/{swift-package-prebuilt-524D4MA2.mjs → swift-package-prebuilt-L4YNXQRD.mjs} +15 -15
- package/dist-lib/esm-chunks/{swift-sdk-app-module-EX544YJY.mjs → swift-sdk-app-module-RM652JSW.mjs} +87 -71
- package/dist-lib/esm-chunks/{swift-sdk-image-LOTMWVM7.mjs → swift-sdk-image-5PQ44UJT.mjs} +15 -15
- package/dist-lib/esm-chunks/{swift-sdk-image-producer-UO6B3M4U.mjs → swift-sdk-image-producer-GD3SM6YI.mjs} +5 -5
- package/dist-lib/esm-chunks/swift-sdk-later-data-62QYJ2KH.mjs +590 -0
- package/dist-lib/expo-swift-bundle.cjs +21037 -17896
- package/dist-lib/expo-swift-metadata.cjs +8 -2
- package/dist-lib/expo-swift-metadata.mjs +9 -8
- package/dist-lib/home-paths.cjs +1 -1
- package/dist-lib/host/bridge-host.cjs +22481 -18741
- package/dist-lib/host/fetch-proxy-handler.cjs +21079 -17980
- package/dist-lib/host/fetch-proxy-overrides.cjs +1 -1
- package/dist-lib/host/fetch-proxy-overrides.mjs +2 -2
- package/dist-lib/host/replacement-module-handler.cjs +1 -1
- package/dist-lib/host/websocket-proxy.cjs +1 -1
- package/dist-lib/index.cjs +68 -38
- package/dist-lib/kotlin-host.cjs +97 -21
- package/dist-lib/menu.cjs +1 -1
- package/dist-lib/menu.mjs +3 -3
- package/dist-lib/metro-fingerprint-registry.cjs +1 -1
- package/dist-lib/metro-fingerprint-registry.mjs +3 -3
- package/dist-lib/metro-production-bundle.cjs +23 -1
- package/dist-lib/metro-production-bundle.mjs +24 -4
- package/dist-lib/native-app-identity-project.cjs +3582 -571
- package/dist-lib/native-app-identity-project.mjs +1024 -398
- package/dist-lib/native-app-identity.cjs +1 -1
- package/dist-lib/native-app-identity.mjs +6 -6
- package/dist-lib/native-firebase-metadata.cjs +1 -1
- package/dist-lib/native-firebase-metadata.mjs +3 -3
- package/dist-lib/pdfium-raster.cjs +1 -1
- package/dist-lib/pdfium-raster.mjs +2 -2
- package/dist-lib/plist.cjs +1 -1
- package/dist-lib/plist.mjs +3 -3
- package/dist-lib/profiles.cjs +1 -1
- package/dist-lib/public-brand.cjs +1 -1
- package/dist-lib/public-origins-lib-esm.json +132 -116
- package/dist-lib/public-origins-lib.json +215 -173
- package/dist-lib/react-native-host-modules.cjs +1 -1
- package/dist-lib/react-native-host-modules.mjs +2 -2
- package/dist-lib/reap-browser.cjs +17 -1
- package/dist-lib/scripts/dev-server-scanner.cjs +1 -1
- package/dist-lib/sdk.cjs +6 -7
- package/dist-lib/sdk.mjs +13 -14
- package/dist-lib/skills.cjs +23216 -19650
- package/dist-lib/swift-compile.cjs +4337 -2905
- package/dist-lib/swift-compile.mjs +15 -13
- package/dist-lib/swift-package.cjs +1 -1
- package/dist-lib/swift-package.mjs +3 -3
- package/dist-lib/swift-submit.cjs +1 -1
- package/dist-lib/swift-submit.mjs +6 -6
- package/dist-lib/swift-svg-raster.cjs +1 -1
- package/dist-lib/swift-svg-raster.mjs +2 -2
- package/dist-lib/swift-toolchain.cjs +19 -1
- package/dist-lib/swift.cjs +1 -1
- package/dist-lib/vendor/@peculiar/x509.cjs +1 -1
- package/dist-lib/vendor/@ruby/prism/src/nodes.js.cjs +1 -1
- package/dist-lib/vendor/@ruby/prism/src/parsePrism.js.cjs +1 -1
- package/dist-lib/vendor/acorn.cjs +1 -1
- package/dist-lib/vendor/stream-json.cjs +1 -1
- package/dist-lib/vendor/sucrase/dist/index.js.cjs +1 -1
- package/dist-lib/vendor/sucrase/dist/parser/index.js.cjs +1 -1
- package/dist-lib/vendor/sucrase/dist/parser/tokenizer/index.js.cjs +1 -1
- package/dist-lib/vendor/sucrase/dist/parser/tokenizer/types.js.cjs +1 -1
- package/dist-lib/vendor/sucrase.cjs +1 -1
- package/dist-lib/vendor/terser.cjs +1 -1
- package/dist-lib/vendor/valibot.cjs +1 -1
- package/dist-lib/vendor/ws.cjs +94 -32
- package/dist-lib/vendor/zod.cjs +1 -1
- package/dist-lib/worklet-executable.cjs +8 -5
- package/dist-lib/worklet-executable.mjs +9 -6
- package/dist-types/packages/peach-engine/src/canvaskit-artifact-urls.d.ts +2 -1
- package/dist-types/packages/peach-engine/src/capture/compositor-presentation-recording.d.ts +1 -0
- package/dist-types/packages/peach-engine/src/engine/generated/canvaskit-artifact-hashes.d.ts +26 -0
- package/dist-types/packages/peach-engine/src/engine/guest-scene-inspect.d.ts +1 -1
- package/dist-types/packages/peach-engine/src/engine/inspect-info.d.ts +1 -0
- package/dist-types/packages/peach-engine/src/engine/metalTypes.d.ts +32 -2
- package/dist-types/packages/peach-engine/src/engine/portalContract.d.ts +24 -0
- package/dist-types/packages/peach-engine/src/engine/remote-display-protocol.d.ts +12 -2
- package/dist-types/packages/peach-engine/src/guest/http-cookie-storage.d.ts +73 -0
- package/dist-types/packages/peach-engine/src/guest/native-evaluation-lease.d.ts +5 -0
- package/dist-types/packages/peach-engine/src/guest/nitro-jsi-host.d.ts +3 -1
- package/dist-types/packages/peach-engine/src/ios/apps/canvas-map-data.d.ts +225 -9
- package/dist-types/packages/peach-engine/src/ios/chrome-metrics.d.ts +4 -1
- package/dist-types/packages/peach-engine/src/ios/duo-vertical-bar-geometry.d.ts +0 -1
- package/dist-types/packages/peach-engine/src/native-preview-bundle.d.ts +1 -0
- package/dist-types/packages/peach-engine/src/remote-stream/canvas-display-compositor.d.ts +1 -0
- package/dist-types/packages/peach-engine/src/remote-stream/canvas-display-contract.d.ts +44 -10
- package/dist-types/packages/peach-engine/src/remote-stream/cloud-display.d.ts +4 -3
- package/dist-types/packages/peach-engine/src/render-worker/compositor-protocol.d.ts +2 -4
- package/dist-types/packages/peach-engine/src/render-worker/metro-bundle-metadata.d.ts +2 -0
- package/dist-types/packages/peach-engine/src/render-worker/native-widgetContract.d.ts +1 -1
- package/dist-types/packages/peach-engine/src/render-worker/protocol.d.ts +15 -27
- package/dist-types/packages/peach-engine/src/render-worker/reanimated-readiness.d.ts +2 -6
- package/dist-types/packages/peach-engine/src/render-worker/shell-protocol.d.ts +11 -3
- package/dist-types/packages/peach-engine/src/settings/devices.d.ts +3 -1
- package/dist-types/packages/peach-engine/src/settings/duo-fold.d.ts +1 -1
- package/dist-types/packages/peach-engine/src/webview-automation-host.d.ts +1 -1
- package/dist-types/packages/peach-globals/src/app-bundle-resources.d.ts +10 -0
- package/dist-types/packages/peach-globals/src/compositorBridgeContract.d.ts +1 -1
- package/dist-types/packages/peach-globals/src/hostStorageBridgeContract.d.ts +1 -0
- package/dist-types/packages/peach-globals/src/index.d.ts +2 -2
- package/dist-types/packages/peach-globals/src/lockstepCaptureBridgeContract.d.ts +9 -6
- package/dist-types/packages/peach-globals/src/nodeContract.d.ts +11 -0
- package/dist-types/packages/peach-globals/src/oneWidgetContract.d.ts +28 -0
- package/package.json +2 -2
- package/runtime-companion.json +1 -1
- package/sdk/ios/System/Library/Frameworks/CoreHaptics.framework/Headers/CoreHaptics.h +251 -0
- package/sdk/ios/System/Library/Frameworks/Intents.framework/Headers/INImage.h +14 -0
- package/sdk/ios/System/Library/Frameworks/Intents.framework/Headers/INIntent.h +18 -0
- package/sdk/ios/System/Library/Frameworks/Intents.framework/Headers/INIntentIdentifiers.h +30 -0
- package/sdk/ios/System/Library/Frameworks/Intents.framework/Headers/INIntentResponse.h +12 -0
- package/sdk/ios/System/Library/Frameworks/Intents.framework/Headers/INInteraction.h +35 -0
- package/sdk/ios/System/Library/Frameworks/Intents.framework/Headers/INObjectCollection.h +0 -7
- package/sdk/ios/System/Library/Frameworks/Intents.framework/Headers/INObjectSection.h +0 -7
- package/sdk/ios/System/Library/Frameworks/Intents.framework/Headers/INOutgoingMessageType.h +7 -0
- package/sdk/ios/System/Library/Frameworks/Intents.framework/Headers/INPerson.h +36 -0
- package/sdk/ios/System/Library/Frameworks/Intents.framework/Headers/INPersonHandle.h +22 -0
- package/sdk/ios/System/Library/Frameworks/Intents.framework/Headers/INSendMessageIntent+UserNotifications.h +6 -0
- package/sdk/ios/System/Library/Frameworks/Intents.framework/Headers/INSendMessageIntent.h +33 -0
- package/sdk/ios/System/Library/Frameworks/Intents.framework/Headers/INSpeakableString.h +24 -0
- package/sdk/ios/System/Library/Frameworks/Intents.framework/Headers/Intents.h +11 -7
- package/sdk/ios/System/Library/Frameworks/MessageUI.framework/Headers/MFMailComposeViewController.h +1 -1
- package/sdk/ios/System/Library/Frameworks/MessageUI.framework/Headers/MFMessageComposeViewController.h +1 -1
- package/sdk/ios/System/Library/Frameworks/Metal.framework/Headers/MTLRenderCommandEncoder.h +0 -8
- package/sdk/ios/System/Library/Frameworks/MetalTypes.framework/Headers/MetalTypes.h +8 -0
- package/sdk/ios/System/Library/Frameworks/Social.framework/Headers/SLServiceTypes.h +9 -0
- package/sdk/ios/System/Library/Frameworks/Social.framework/Headers/Social.h +1 -0
- package/sdk/ios/System/Library/Frameworks/UserNotifications.framework/Headers/UNNotification.h +1 -1
- package/sdk/ios/System/Library/Frameworks/UserNotifications.framework/Headers/UNNotificationAction.h +2 -2
- package/sdk/ios/System/Library/Frameworks/UserNotifications.framework/Headers/UNNotificationAttachment.h +1 -1
- package/sdk/ios/System/Library/Frameworks/UserNotifications.framework/Headers/UNNotificationCategory.h +1 -1
- package/sdk/ios/System/Library/Frameworks/UserNotifications.framework/Headers/UNNotificationContent.h +2 -2
- package/sdk/ios/System/Library/Frameworks/UserNotifications.framework/Headers/UNNotificationRequest.h +1 -1
- package/sdk/ios/System/Library/Frameworks/UserNotifications.framework/Headers/UNNotificationResponse.h +2 -2
- package/sdk/ios/System/Library/Frameworks/UserNotifications.framework/Headers/UNNotificationSound.h +1 -1
- package/sdk/ios/System/Library/Frameworks/UserNotifications.framework/Headers/UNNotificationTrigger.h +5 -5
- package/sdk/ios/usr/lib/swift/UIKit.swiftmodule/arm64-apple-ios-simulator.swiftinterface +4 -0
- package/sdk/ios/wasm/include/unistd.h +1 -0
- package/src/acorn-program.ts +3 -0
- package/src/audio-codec-archives.ts +141 -0
- package/src/bridge-contract-input.ts +61 -1
- package/src/bridge-contract.ts +45 -4
- package/src/bundle-channel.mjs +44 -30
- package/src/capture-contract.ts +57 -39
- package/src/conformance-comparison-contract.ts +2 -0
- package/src/expo-discovery-cache.ts +0 -2
- package/src/expo-macro-host.ts +8 -3
- package/src/expo-native-compiler-digest.ts +0 -1
- package/src/expo-native-prebuilt.ts +1 -1
- package/src/expo-native-workspace.ts +83 -45
- package/src/expo-pod-prebuilt.ts +1 -0
- package/src/expo-swift-host.ts +158 -77
- package/src/expo-swift-legacy-runtime-source.ts +12 -1
- package/src/expo-swift-view-source.ts +51 -20
- package/src/expo-workspace-exclusion.ts +7 -1
- package/src/expoSwiftContract.ts +10 -1
- package/src/ffmpeg-source-build.ts +123 -59
- package/src/genrule-archives.ts +7 -2
- package/src/genrule-library-builds.ts +101 -18
- package/src/host/bridge-host.ts +10 -1
- package/src/installed-native-libraries.ts +147 -23
- package/src/installed-package-versions.ts +30 -0
- package/src/ios-rn-bundle-request.ts +3 -1
- package/src/ios-rn-bundle.ts +38 -27
- package/src/ios-rn-compile.ts +23 -6
- package/src/ios-rn-startup.ts +2 -1
- package/src/java-module-abi.ts +4 -3
- package/src/kotlin-host.ts +4 -4
- package/src/kotlin-library-sources.ts +8 -5
- package/src/metro-production-bundle.ts +24 -0
- package/src/native-firebase-config.ts +2 -0
- package/src/native-framework-compiler.ts +5 -0
- package/src/native-package-slice-build.ts +3 -0
- package/src/native-package-slice.ts +15 -10
- package/src/native-preparation.ts +4 -1
- package/src/native-static-libraries.ts +107 -33
- package/src/nativeRuntimePackageIndex.ts +1 -4
- package/src/nitro-adapter.lock.json +286 -286
- package/src/nitro-app-providers.ts +20 -8
- package/src/nitro-compile.ts +131 -37
- package/src/nitro-dependencies.ts +42 -8
- package/src/nitro-source.ts +40 -36
- package/src/nitro-superset.lock.json +4 -4
- package/src/nitroAdapterContract.ts +32 -7
- package/src/nitroContract.ts +21 -37
- package/src/one-direct-host-source.ts +247 -140
- package/src/one-fabric.ts +129 -0
- package/src/one-native-controls-package.ts +95 -21
- package/src/one-native-controls-release.ts +147 -14
- package/src/one-native-source.ts +4 -1
- package/src/one-nitro-inputs.ts +1 -1
- package/src/one-nitro-source.ts +45 -1
- package/src/one-sdk/source.ts +10 -41
- package/src/one-widget-metadata.ts +2 -2
- package/src/one-widget-package.ts +1 -1
- package/src/oneSdkContract.ts +3 -0
- package/src/playwright-browser-paths.ts +30 -0
- package/src/pods-install.ts +6 -2
- package/src/pods-post-install.ts +2 -2
- package/src/pods-project.ts +10 -0
- package/src/podspec-ruby-stdlib.ts +73 -0
- package/src/podspec-ruby.ts +1 -1
- package/src/podspec-sources.ts +31 -13
- package/src/process-group.ts +135 -5
- package/src/published-swift-sdk.ts +25 -1
- package/src/react-native-bridge-modules.ts +35 -3
- package/src/react-native-core-build.ts +14 -2
- package/src/react-native-core.ts +12 -2
- package/src/rive-runtime-dependencies.ts +178 -40
- package/src/serverDiscoveryContract.ts +1 -1
- package/src/storageSnapshotContract.ts +1 -1
- package/src/swift-app-data-store.ts +35 -0
- package/src/swift-compile.ts +403 -121
- package/src/swift-compiler-digest.ts +4 -0
- package/src/swift-darwin-records.ts +6 -0
- package/src/swift-distribution-mirror.ts +10 -1
- package/src/swift-distribution.lock.json +19 -18
- package/src/swift-distribution.ts +17 -1
- package/src/swift-entry-module.ts +1 -0
- package/src/swift-guest-compile.ts +8 -1
- package/src/swift-host.ts +79 -23
- package/src/swift-installed-targets.ts +51 -20
- package/src/swift-objc-standin.ts +60 -8
- package/src/swift-packages.ts +104 -24
- package/src/swift-project-user.ts +2 -1
- package/src/swift-reproducible.ts +99 -1
- package/src/swift-root-lock.ts +52 -46
- package/src/swift-sdk-app-module.ts +65 -13
- package/src/swift-sdk-image-producer.ts +2 -1
- package/src/swift-sdk-image.ts +23 -8
- package/src/swift-sdk-later-data.ts +294 -44
- package/src/swift-sdk-surface.ts +233 -55
- package/src/swift-shared-sdk.ts +7 -0
- package/src/swift-standin-builtin-behavior.ts +18 -0
- package/src/swift-standin-emit.ts +242 -54
- package/src/swift-standins.ts +184 -38
- package/src/swift-startup-split.ts +19 -9
- package/src/swift-toolchain.ts +18 -0
- package/src/swift-wasm-prune.ts +179 -9
- package/src/swift-xcframework.ts +16 -0
- package/src/swiftContract.ts +4 -1
- package/src/swiftSdkLinkContract.ts +2 -0
- package/src/swiftTargetContract.ts +1 -0
- package/src/turbo-bundle.ts +6 -3
- package/src/turbo-codegen-intake.ts +106 -16
- package/src/turbo-compile.ts +89 -68
- package/src/turbo-fabric-app.ts +287 -23
- package/src/turbo-provider-host.ts +122 -31
- package/src/turbo-runtime.lock.json +26 -26
- package/src/turbo-source.ts +374 -157
- package/src/vite-plugin.ts +48 -112
- package/src/wasm-binary-sections.ts +40 -0
- package/src/wasm-code-immediates.ts +35 -5
- package/src/widget-extension-bundle.ts +15 -1
- package/src/worklet-executable.ts +2 -1
- package/src/worklet-kernel.ts +5 -3
- package/src/worklets-babel.ts +2 -1
- package/src/xcode-project.ts +151 -53
- package/src/xcode-scheme-actions.ts +104 -0
- package/cli/commands/canvas.ts +0 -1204
- package/dist-lib/esm-chunks/chunk-B5QD2KEV.mjs +0 -2787
- package/dist-lib/vendor/magic-string.cjs +0 -1693
- package/dist-types/packages/peach-compat/src/stubs/native-seams/react-native-cookies.d.ts +0 -127
- package/src/appBundleResourcesContract.ts +0 -51
- package/src/canvas-groups.ts +0 -28
- package/src/canvas-map-layout.ts +0 -161
- package/src/oneWidgetContract.ts +0 -134
package/src/swift-compile.ts
CHANGED
|
@@ -1,10 +1,5 @@
|
|
|
1
1
|
import { AsyncLocalStorage } from 'node:async_hooks'
|
|
2
|
-
import {
|
|
3
|
-
spawn,
|
|
4
|
-
spawnSync,
|
|
5
|
-
type ExecFileOptions,
|
|
6
|
-
type SpawnOptions,
|
|
7
|
-
} from 'node:child_process'
|
|
2
|
+
import { spawnSync, type ExecFileOptions } from 'node:child_process'
|
|
8
3
|
import { createHash, randomUUID } from 'node:crypto'
|
|
9
4
|
import {
|
|
10
5
|
chmodSync,
|
|
@@ -29,14 +24,20 @@ import os from 'node:os'
|
|
|
29
24
|
import path from 'node:path'
|
|
30
25
|
import { setTimeout as delay } from 'node:timers/promises'
|
|
31
26
|
import * as v from 'valibot'
|
|
27
|
+
import {
|
|
28
|
+
RNX_INTERNAL_CHILDREN,
|
|
29
|
+
RNX_INTERNAL_COMMAND,
|
|
30
|
+
} from '../cli/internal-child-contract'
|
|
31
|
+
import { rnxSelfInvocation } from '../cli/self-invocation'
|
|
32
32
|
import { windowAdmission } from './admitted-mac-build'
|
|
33
33
|
import cPredefinesJson from './generated/swift-c-predefines.json' with { type: 'json' }
|
|
34
34
|
import { isRecord } from './is-record'
|
|
35
|
-
import { terminateProcessGroup } from './process-group'
|
|
35
|
+
import { spawnOwnedProcessGroup, terminateProcessGroup } from './process-group'
|
|
36
36
|
import {
|
|
37
37
|
reapRetiredCacheDirectory,
|
|
38
38
|
removeRetiredDirectory,
|
|
39
39
|
} from './retired-cache-directory'
|
|
40
|
+
import { writeSwiftAppData } from './swift-app-data-store'
|
|
40
41
|
import { withSwiftCompileBudget } from './swift-compile-budget'
|
|
41
42
|
import { swiftCompilerSourceDigest } from './swift-compiler-digest'
|
|
42
43
|
import {
|
|
@@ -163,12 +164,14 @@ import {
|
|
|
163
164
|
swiftCTakesReturnAddress,
|
|
164
165
|
swiftDistributionAt,
|
|
165
166
|
swiftDistributionCompileView,
|
|
167
|
+
swiftFrameworkHeaderDigest,
|
|
166
168
|
swiftHeaderWithSuperclassImports,
|
|
167
169
|
swiftImportNames,
|
|
168
170
|
swiftInterfaceDeclarations,
|
|
169
171
|
swiftMacroPlugins,
|
|
170
172
|
swiftModuleDigest,
|
|
171
173
|
swiftModuleInputFiles,
|
|
174
|
+
providedObjCFrameworkHeaders,
|
|
172
175
|
swiftModuleInterface,
|
|
173
176
|
swiftModuleSdk,
|
|
174
177
|
swiftPeachModules,
|
|
@@ -190,6 +193,7 @@ import {
|
|
|
190
193
|
SWIFT_CACHE_HOLD_MARKER,
|
|
191
194
|
swiftCacheDir,
|
|
192
195
|
swiftEnvironment,
|
|
196
|
+
swiftFileChecksum,
|
|
193
197
|
swiftPackageCacheOptions,
|
|
194
198
|
swiftSdkOptions,
|
|
195
199
|
swiftToolchain,
|
|
@@ -225,6 +229,7 @@ import {
|
|
|
225
229
|
SWIFT_JAVASCRIPTCORE_RUNTIME,
|
|
226
230
|
SWIFT_PEACH_ENGINE_ARCHIVE,
|
|
227
231
|
SWIFT_PEACH_ENGINE_LIBRARIES,
|
|
232
|
+
SWIFT_PROVIDED_MODULES_PREFIX,
|
|
228
233
|
SWIFT_WASM_TRIPLE,
|
|
229
234
|
wasmThreadLinkFlags,
|
|
230
235
|
} from './swiftTargetContract.ts'
|
|
@@ -305,12 +310,16 @@ async function runCompiler(
|
|
|
305
310
|
},
|
|
306
311
|
uid: options.uid,
|
|
307
312
|
gid: options.gid,
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
313
|
+
}
|
|
314
|
+
const lease = options.lease ?? options.frameworkLease
|
|
315
|
+
const child = lease
|
|
316
|
+
? lease.spawn(
|
|
317
|
+
command,
|
|
318
|
+
args,
|
|
319
|
+
launch,
|
|
320
|
+
options.lease ? options.frameworkLease : undefined,
|
|
321
|
+
)
|
|
322
|
+
: spawnOwnedProcessGroup(command, args, launch)
|
|
314
323
|
// cross-request-promise: one child process owns this stop, inside the call that spawned it
|
|
315
324
|
let stopping: Promise<void> | undefined
|
|
316
325
|
try {
|
|
@@ -423,7 +432,7 @@ function pushMapList<K, V>(map: Map<K, V[]>, key: K, value: V): void {
|
|
|
423
432
|
const quoteRspPath = (file: string) =>
|
|
424
433
|
`"${file.replaceAll('\\', '\\\\').replaceAll('"', '\\"')}"`
|
|
425
434
|
|
|
426
|
-
const linuxSwiftLdLibraryPath = (toolchainBin: string, current?: string) =>
|
|
435
|
+
export const linuxSwiftLdLibraryPath = (toolchainBin: string, current?: string) =>
|
|
427
436
|
[
|
|
428
437
|
path.resolve(toolchainBin, '../lib/swift/linux'),
|
|
429
438
|
path.resolve(toolchainBin, '../lib/swift/host'),
|
|
@@ -661,8 +670,8 @@ export async function ensureMacroPlugins(
|
|
|
661
670
|
return { libraries, executables }
|
|
662
671
|
}
|
|
663
672
|
|
|
664
|
-
//
|
|
665
|
-
//
|
|
673
|
+
// the link plan names the exact framework objects independently of the app's
|
|
674
|
+
// compiler inputs, which can stay stable across implementation edits.
|
|
666
675
|
export function swiftProjectBuildKey(
|
|
667
676
|
moduleRoot: string,
|
|
668
677
|
release: string,
|
|
@@ -1206,7 +1215,7 @@ function providedModulesPath(
|
|
|
1206
1215
|
.update([...excluded].sort().join('\0'))
|
|
1207
1216
|
.digest('hex')
|
|
1208
1217
|
.slice(0, 16)
|
|
1209
|
-
const directory = path.join(root,
|
|
1218
|
+
const directory = path.join(root, `${SWIFT_PROVIDED_MODULES_PREFIX}${key}`)
|
|
1210
1219
|
const complete = path.join(directory, '.complete')
|
|
1211
1220
|
if (!existsSync(complete)) {
|
|
1212
1221
|
mkdirSync(directory, { recursive: true })
|
|
@@ -1617,7 +1626,7 @@ export function emitSwiftPackageManifest(args: {
|
|
|
1617
1626
|
nativeImportFlags?: Map<string, string[]>
|
|
1618
1627
|
coalescibleOverlays?: ReadonlySet<string>
|
|
1619
1628
|
nativeHeaderFlags?: string[]
|
|
1620
|
-
|
|
1629
|
+
nativeSwiftHeaderFlags?: ReadonlyMap<string, readonly string[]>
|
|
1621
1630
|
nativeHeaderDeclarations?: Readonly<Record<string, readonly string[]>>
|
|
1622
1631
|
objcImplementationModules?: Set<string>
|
|
1623
1632
|
siblings: Map<string, string[]>
|
|
@@ -2033,11 +2042,9 @@ export function emitSwiftPackageManifest(args: {
|
|
|
2033
2042
|
const interoperability = cxxInterop ? ' .interoperabilityMode(.Cxx),' : ''
|
|
2034
2043
|
const importedNativeFlags = [
|
|
2035
2044
|
...(args.nativeImportFlags?.get(target.name) ?? []),
|
|
2036
|
-
...[...importContext].flatMap((name) =>
|
|
2037
|
-
|
|
2038
|
-
|
|
2039
|
-
return map ? ['-fmodule-map-file=' + map] : []
|
|
2040
|
-
}),
|
|
2045
|
+
...[...importContext].flatMap((name) =>
|
|
2046
|
+
name === target.name ? [] : (args.nativeSwiftHeaderFlags?.get(name) ?? []),
|
|
2047
|
+
),
|
|
2041
2048
|
...[...importContext].flatMap((name) => args.native?.get(name)?.importFlags ?? []),
|
|
2042
2049
|
...[...importContext].flatMap((name) => targetSwiftXccFlags.get(name) ?? []),
|
|
2043
2050
|
]
|
|
@@ -2057,8 +2064,17 @@ export function emitSwiftPackageManifest(args: {
|
|
|
2057
2064
|
.filter((flag) => !cxxInterop || !flag.startsWith('-std='))
|
|
2058
2065
|
.map((flag) => `, "-Xcc", ${JSON.stringify(flag)}`)
|
|
2059
2066
|
.join('')
|
|
2067
|
+
const standinMap = path.join(args.root, target.path, 'include/module.modulemap')
|
|
2068
|
+
const underlying =
|
|
2069
|
+
args.sourceSwiftTargets?.has(target.name) &&
|
|
2070
|
+
target.path.startsWith(`${SWIFT_STANDINS_DIR}/`) &&
|
|
2071
|
+
args.files.has(standinMap) &&
|
|
2072
|
+
!native?.swiftFlags?.includes('-import-underlying-module')
|
|
2073
|
+
? ['-import-underlying-module', '-Xcc', '-fmodule-map-file=' + standinMap]
|
|
2074
|
+
: []
|
|
2060
2075
|
const objcFlags = [
|
|
2061
2076
|
...SWIFT_OBJC_INTEROP_FLAGS,
|
|
2077
|
+
...underlying,
|
|
2062
2078
|
...(native?.swiftFlags ?? []),
|
|
2063
2079
|
...(args.objcImplementationModules?.has(target.name)
|
|
2064
2080
|
? ['-enable-experimental-feature', 'ObjCImplementation']
|
|
@@ -2270,8 +2286,14 @@ export function emitSwiftPackageManifest(args: {
|
|
|
2270
2286
|
}
|
|
2271
2287
|
if (native.mixed)
|
|
2272
2288
|
for (const dependency of siblings.get(name) ?? []) visit(dependency)
|
|
2273
|
-
const
|
|
2274
|
-
|
|
2289
|
+
const mixedContext = new Set(context)
|
|
2290
|
+
// an emitted Swift header can import Clang modules from its producer.
|
|
2291
|
+
for (const producer of late?.producers ?? [])
|
|
2292
|
+
for (const dependency of siblings.get(producer) ?? []) visit(dependency)
|
|
2293
|
+
const contextFlags = [...context].flatMap((dependency) =>
|
|
2294
|
+
(args.native?.get(dependency)?.importFlags ?? []).filter(
|
|
2295
|
+
(flag) => mixedContext.has(dependency) || flag.startsWith('-fmodule-map-file='),
|
|
2296
|
+
),
|
|
2275
2297
|
)
|
|
2276
2298
|
return late
|
|
2277
2299
|
? (
|
|
@@ -2383,7 +2405,7 @@ export function syncSwiftTree(
|
|
|
2383
2405
|
dir === base &&
|
|
2384
2406
|
(entry.name === '.build' ||
|
|
2385
2407
|
entry.name === SWIFT_CACHE_HOLD_MARKER ||
|
|
2386
|
-
entry.name.startsWith(
|
|
2408
|
+
entry.name.startsWith(SWIFT_PROVIDED_MODULES_PREFIX) ||
|
|
2387
2409
|
// distribution clang maps are written beside the project, so a sync
|
|
2388
2410
|
// must not remove them.
|
|
2389
2411
|
entry.name === CLANG_DISTRIBUTION_MODULES ||
|
|
@@ -3541,6 +3563,8 @@ export function writeSwiftProject(
|
|
|
3541
3563
|
compileSdk?: Pick<SwiftMirrorSdk, 'id' | 'options'>,
|
|
3542
3564
|
): SwiftProjectPreparation & {
|
|
3543
3565
|
generatedOwners: Map<string, string>
|
|
3566
|
+
nativeProvidedUmbrellas: ReadonlyMap<string, string>
|
|
3567
|
+
projectFrameworkUmbrellas: ReadonlyMap<string, string>
|
|
3544
3568
|
targetToolset: boolean
|
|
3545
3569
|
headerCompiler: boolean
|
|
3546
3570
|
usesObjcPrebuilt: boolean
|
|
@@ -3675,6 +3699,7 @@ export function writeSwiftProject(
|
|
|
3675
3699
|
const importedModules = new Set<string>()
|
|
3676
3700
|
const swiftImportedModules = new Set<string>()
|
|
3677
3701
|
const clangImportedModules = new Set<string>()
|
|
3702
|
+
const clangImportedSwiftHeaders = new Set<string>()
|
|
3678
3703
|
for (const [file, contents] of Object.entries(input.files)) {
|
|
3679
3704
|
if (file.endsWith('.swift'))
|
|
3680
3705
|
for (const name of swiftImportNames(contents)) {
|
|
@@ -3685,11 +3710,16 @@ export function writeSwiftProject(
|
|
|
3685
3710
|
SWIFT_NATIVE_SOURCE_EXTENSIONS.some(
|
|
3686
3711
|
(extension) => extension !== '.modulemap' && file.endsWith(extension),
|
|
3687
3712
|
)
|
|
3688
|
-
)
|
|
3713
|
+
) {
|
|
3689
3714
|
for (const name of clangImportNames(contents)) {
|
|
3690
3715
|
importedModules.add(name)
|
|
3691
3716
|
clangImportedModules.add(name)
|
|
3692
3717
|
}
|
|
3718
|
+
for (const include of nativeHeaderIncludes(contents)) {
|
|
3719
|
+
const module = /^(\w+)\/\1-Swift\.h$/.exec(include)?.[1]
|
|
3720
|
+
if (module) clangImportedSwiftHeaders.add(module)
|
|
3721
|
+
}
|
|
3722
|
+
}
|
|
3693
3723
|
}
|
|
3694
3724
|
const submoduleImports = sourceSubmoduleImports(
|
|
3695
3725
|
Object.entries(input.files).flatMap(([file, contents]) =>
|
|
@@ -3915,6 +3945,7 @@ export function writeSwiftProject(
|
|
|
3915
3945
|
// a warm root also holds what earlier builds emitted into it; admit only this
|
|
3916
3946
|
// input's files under the root so stale binary trees never churn the overlay.
|
|
3917
3947
|
const inRoot = `${layout.root}${path.sep}`
|
|
3948
|
+
const projectFrameworkUmbrellas = new Map<string, string>()
|
|
3918
3949
|
const headerSearch = writeXcodeHeaderSearch(
|
|
3919
3950
|
path.join(layout.root, '.build', 'peach-xcode-headers'),
|
|
3920
3951
|
nativeTargets.map((settings) => {
|
|
@@ -3924,6 +3955,15 @@ export function writeSwiftProject(
|
|
|
3924
3955
|
for (const [product, file] of Object.entries(settings.productHeaders)) {
|
|
3925
3956
|
const header = path.join(layout.root, file)
|
|
3926
3957
|
productHeaders[path.join(layout.root, product)] = header
|
|
3958
|
+
const frameworkMap =
|
|
3959
|
+
/(?:^|\/)([^/]+)\.framework\/Modules\/module\.modulemap$/.exec(product)
|
|
3960
|
+
if (frameworkMap) {
|
|
3961
|
+
const map = input.files[file] ?? ''
|
|
3962
|
+
const module = moduleMapName(map)
|
|
3963
|
+
const umbrella = /\bumbrella\s+header\s+"([^"]+)"/.exec(map)?.[1]
|
|
3964
|
+
if (module && umbrella)
|
|
3965
|
+
projectFrameworkUmbrellas.set(module, `${frameworkMap[1]}/${umbrella}`)
|
|
3966
|
+
}
|
|
3927
3967
|
const framework = /^(.+\.framework)\/((?:Private)?Headers\/.+)$/.exec(product)
|
|
3928
3968
|
if (
|
|
3929
3969
|
framework &&
|
|
@@ -3981,7 +4021,15 @@ export function writeSwiftProject(
|
|
|
3981
4021
|
// declarations are imported before swift can emit the header that native
|
|
3982
4022
|
// implementations consume. give those implementations a downstream target.
|
|
3983
4023
|
const importModuleMaps = new Map<string, string>()
|
|
3984
|
-
const sourceModuleMaps = new Map<
|
|
4024
|
+
const sourceModuleMaps = new Map<
|
|
4025
|
+
string,
|
|
4026
|
+
{
|
|
4027
|
+
path: string
|
|
4028
|
+
contents: string
|
|
4029
|
+
publicHeaders?: string
|
|
4030
|
+
frameworkDirectory?: string
|
|
4031
|
+
}
|
|
4032
|
+
>()
|
|
3985
4033
|
const nativeModuleImports = new Map<string, Set<string>>()
|
|
3986
4034
|
const originalMaps = new Map<string, string>()
|
|
3987
4035
|
for (const target of input.nativeTargets ?? []) {
|
|
@@ -4230,7 +4278,9 @@ export function writeSwiftProject(
|
|
|
4230
4278
|
([file, contents]) =>
|
|
4231
4279
|
(isSwiftNativeTranslationUnit(file) ||
|
|
4232
4280
|
/\.(?:h|hpp|hh|hxx)$/.test(file)) &&
|
|
4233
|
-
/\bSWIFTPM_MODULE_BUNDLE\b/.test(
|
|
4281
|
+
/\bSWIFTPM_MODULE_BUNDLE\b/.test(
|
|
4282
|
+
contents.replace(/\/\*[\s\S]*?\*\/|\/\/[^\n]*/g, ''),
|
|
4283
|
+
),
|
|
4234
4284
|
),
|
|
4235
4285
|
bundles: input.resourceBundles,
|
|
4236
4286
|
})
|
|
@@ -4430,15 +4480,18 @@ export function writeSwiftProject(
|
|
|
4430
4480
|
sourceModuleMaps.set(swiftTargetModuleName(target.name), {
|
|
4431
4481
|
path: path.join(layout.root, modulemap),
|
|
4432
4482
|
contents: moduleContents.toString(),
|
|
4483
|
+
publicHeaders: swiftpmModuleMap
|
|
4484
|
+
? path.dirname(path.join(layout.root, swiftpmModuleMap.path))
|
|
4485
|
+
: undefined,
|
|
4486
|
+
frameworkDirectory,
|
|
4433
4487
|
})
|
|
4434
4488
|
// glog 0.3.5 includes glog/log_severity.h inside namespace google; placing a
|
|
4435
4489
|
// module.modulemap beside its public headers lets -fmodules Objective-C++
|
|
4436
4490
|
// units auto-import it via -I and fail. keep the SwiftPM systemLibrary
|
|
4437
4491
|
// shim outside the header search path instead.
|
|
4492
|
+
const glog = swiftTargetModuleName(target.name) === 'glog'
|
|
4438
4493
|
const systemModuleMap =
|
|
4439
|
-
nativeC &&
|
|
4440
|
-
swiftTargetModuleName(target.name) === 'glog' &&
|
|
4441
|
-
path.posix.basename(modulemap) !== 'module.modulemap'
|
|
4494
|
+
nativeC && glog && path.posix.basename(modulemap) !== 'module.modulemap'
|
|
4442
4495
|
? path.posix.join(
|
|
4443
4496
|
'.build',
|
|
4444
4497
|
'peach-objc-originals',
|
|
@@ -4626,9 +4679,8 @@ export function writeSwiftProject(
|
|
|
4626
4679
|
}
|
|
4627
4680
|
: {}),
|
|
4628
4681
|
})
|
|
4629
|
-
//
|
|
4630
|
-
|
|
4631
|
-
if (owner && !frameworkDirectory) {
|
|
4682
|
+
// glog's implementation map would expose the modular headers to C++.
|
|
4683
|
+
if (owner && !frameworkDirectory && !glog) {
|
|
4632
4684
|
const exportedModule = moduleMapName(moduleContents.toString())
|
|
4633
4685
|
if (!exportedModule)
|
|
4634
4686
|
throw new Error(`original module map declares no module: ${modulemap}`)
|
|
@@ -4808,11 +4860,74 @@ export function writeSwiftProject(
|
|
|
4808
4860
|
Object.keys(input.headerAliases ?? {}).length > 0
|
|
4809
4861
|
? ['-ivfsoverlay', headerSearch.files[0]!]
|
|
4810
4862
|
: []
|
|
4863
|
+
const binaryHeaders = new Map<string, Map<string, string>>()
|
|
4864
|
+
for (const [file, source] of Object.entries(input.files)) {
|
|
4865
|
+
const match =
|
|
4866
|
+
/(?:^|\/)peach-binary-trees\/.+\/(\w+)\.framework\/Headers\/([^/]+\.h)$/.exec(file)
|
|
4867
|
+
if (!match) continue
|
|
4868
|
+
const headers = binaryHeaders.get(match[1]!) ?? new Map<string, string>()
|
|
4869
|
+
headers.set(match[2]!, source)
|
|
4870
|
+
binaryHeaders.set(match[1]!, headers)
|
|
4871
|
+
}
|
|
4872
|
+
const nativeProvidedUmbrellas = new Map<string, string>()
|
|
4873
|
+
if (distribution) {
|
|
4874
|
+
const sdkFrameworks = path.join(
|
|
4875
|
+
swiftSharedSdkRoot(moduleRoot, true),
|
|
4876
|
+
'System/Library/Frameworks',
|
|
4877
|
+
)
|
|
4878
|
+
const interfaces = new Map<string, string>()
|
|
4879
|
+
for (const name of clangImportedModules) {
|
|
4880
|
+
if (
|
|
4881
|
+
swiftTargets.has(name) ||
|
|
4882
|
+
native.has(name) ||
|
|
4883
|
+
(!binaryHeaders.has(name) && !clangImportedSwiftHeaders.has(name))
|
|
4884
|
+
)
|
|
4885
|
+
continue
|
|
4886
|
+
const header = moduleInterface(name)?.header
|
|
4887
|
+
if (header !== undefined) interfaces.set(name, header)
|
|
4888
|
+
}
|
|
4889
|
+
for (const [name, header] of interfaces) {
|
|
4890
|
+
const projected = providedObjCFrameworkHeaders(
|
|
4891
|
+
name,
|
|
4892
|
+
binaryHeaders.get(name) ?? new Map(),
|
|
4893
|
+
header,
|
|
4894
|
+
(framework, file) =>
|
|
4895
|
+
binaryHeaders.get(framework)?.has(file) === true ||
|
|
4896
|
+
(file === framework + '-Swift.h' && interfaces.has(framework)) ||
|
|
4897
|
+
existsSync(path.join(sdkFrameworks, framework + '.framework', 'Headers', file)),
|
|
4898
|
+
)
|
|
4899
|
+
const directory = path.join(headerDirectory, name)
|
|
4900
|
+
for (const [file, source] of projected)
|
|
4901
|
+
files.set(path.join(directory, file), source)
|
|
4902
|
+
if (projected.has(name + '.h'))
|
|
4903
|
+
nativeProvidedUmbrellas.set(name, path.join(directory, name + '.h'))
|
|
4904
|
+
}
|
|
4905
|
+
}
|
|
4811
4906
|
const nativeHeaderFlags: string[] = [...headerAliasFlags]
|
|
4812
|
-
const
|
|
4813
|
-
|
|
4814
|
-
|
|
4815
|
-
|
|
4907
|
+
const nativeSwiftHeaderFlags = new Map<string, string[]>()
|
|
4908
|
+
const nativeHeaderDeclarations: Record<string, string[]> = {}
|
|
4909
|
+
for (const [file, source] of Object.entries(input.files)) {
|
|
4910
|
+
const header =
|
|
4911
|
+
/(?:^|\/)(\w+)\.framework\/Headers\/(.*\.h)$/.exec(file) ??
|
|
4912
|
+
/^__standins__\/(\w+)\/include\/\1\/(.*\.h)$/.exec(file)
|
|
4913
|
+
const module = header?.[1]
|
|
4914
|
+
if (!module || !swiftTargets.has(module) || native.has(module)) continue
|
|
4915
|
+
const declared = new Set(nativeHeaderDeclarations[module])
|
|
4916
|
+
// a swift-only framework's consumers import just its generated header,
|
|
4917
|
+
// which the local producer emits in its place
|
|
4918
|
+
if (header[2] !== `${module}-Swift.h`) {
|
|
4919
|
+
for (const name of swiftInterfaceDeclarations(source)) declared.add(name)
|
|
4920
|
+
for (const match of source.matchAll(
|
|
4921
|
+
/\btypedef\s+(?:NS_ENUM|NS_OPTIONS)\s*\(\s*\w+\s*,\s*(\w+)\b/g,
|
|
4922
|
+
))
|
|
4923
|
+
declared.add(match[1]!)
|
|
4924
|
+
}
|
|
4925
|
+
nativeHeaderDeclarations[module] = [...declared]
|
|
4926
|
+
}
|
|
4927
|
+
for (const name of new Set([
|
|
4928
|
+
...Object.keys(nativeHeaderDeclarations),
|
|
4929
|
+
...[...native.values()].flatMap((value) => value.late?.producers ?? []),
|
|
4930
|
+
])) {
|
|
4816
4931
|
files.set(
|
|
4817
4932
|
path.join(headerDirectory, name, name + '-Swift.h'),
|
|
4818
4933
|
'#include "../' + name + '-Swift.h"\n',
|
|
@@ -4829,6 +4944,9 @@ export function writeSwiftProject(
|
|
|
4829
4944
|
const stagedMap = sourceModuleMaps.get(moduleName)
|
|
4830
4945
|
const originalPath =
|
|
4831
4946
|
stagedMap?.path ?? (originalMap ? path.join(layout.root, originalMap) : undefined)
|
|
4947
|
+
const flags = originalMap?.startsWith(`${SWIFT_STANDINS_DIR}/`)
|
|
4948
|
+
? ['-I' + path.dirname(path.join(layout.root, originalMap))]
|
|
4949
|
+
: []
|
|
4832
4950
|
const originalContents =
|
|
4833
4951
|
stagedMap?.contents ?? (originalMap && input.files[originalMap])
|
|
4834
4952
|
const originalTokens = originalContents ? moduleMapTokens(originalContents) : []
|
|
@@ -4841,25 +4959,25 @@ export function writeSwiftProject(
|
|
|
4841
4959
|
originalTokens[index + 1] === `${moduleName}.Swift`),
|
|
4842
4960
|
)
|
|
4843
4961
|
) {
|
|
4844
|
-
|
|
4845
|
-
|
|
4846
|
-
|
|
4847
|
-
|
|
4848
|
-
|
|
4849
|
-
|
|
4850
|
-
|
|
4851
|
-
|
|
4852
|
-
|
|
4853
|
-
|
|
4854
|
-
|
|
4855
|
-
|
|
4962
|
+
flags.push('-fmodule-map-file=' + originalPath)
|
|
4963
|
+
} else {
|
|
4964
|
+
files.set(
|
|
4965
|
+
modulemap,
|
|
4966
|
+
originalPath
|
|
4967
|
+
? `extern module ${moduleName} ${JSON.stringify(originalPath)}\nmodule ${moduleName}.Swift {\n header ${JSON.stringify(path.join(headerDirectory, name + '-Swift.h'))}\n requires objc\n}\n`
|
|
4968
|
+
: swiftObjCModuleMap(
|
|
4969
|
+
moduleName,
|
|
4970
|
+
(nativeTargetByName.get(name)?.publicHeaders ?? []).map((header) =>
|
|
4971
|
+
path.join(layout.root, header),
|
|
4972
|
+
),
|
|
4973
|
+
submoduleImports.get(moduleName),
|
|
4974
|
+
path.join(headerDirectory, name + '-Swift.h'),
|
|
4856
4975
|
),
|
|
4857
|
-
|
|
4858
|
-
|
|
4859
|
-
|
|
4860
|
-
)
|
|
4861
|
-
|
|
4862
|
-
nativeSwiftHeaderMaps.set(name, modulemap)
|
|
4976
|
+
)
|
|
4977
|
+
flags.push('-fmodule-map-file=' + modulemap)
|
|
4978
|
+
}
|
|
4979
|
+
nativeHeaderFlags.push(...flags)
|
|
4980
|
+
nativeSwiftHeaderFlags.set(name, flags)
|
|
4863
4981
|
}
|
|
4864
4982
|
// an umbrella header re-exports each optional product it finds through
|
|
4865
4983
|
// __has_include(<M/M.h>). a third-party product the distribution provides as
|
|
@@ -4893,6 +5011,7 @@ export function writeSwiftProject(
|
|
|
4893
5011
|
for (const name of probedProducts) {
|
|
4894
5012
|
if (
|
|
4895
5013
|
!OPTIONAL_FRAMEWORKS.has(name) ||
|
|
5014
|
+
nativeProvidedUmbrellas.has(name) ||
|
|
4896
5015
|
!importedProducts.has(name) ||
|
|
4897
5016
|
swiftTargets.has(name) ||
|
|
4898
5017
|
native.has(name)
|
|
@@ -5185,21 +5304,6 @@ export function writeSwiftProject(
|
|
|
5185
5304
|
const nativeImportFlags = new Map<string, string[]>()
|
|
5186
5305
|
for (const target of targets)
|
|
5187
5306
|
if (headerAliasFlags.length > 0) nativeImportFlags.set(target.name, headerAliasFlags)
|
|
5188
|
-
const nativeHeaderDeclarations: Record<string, string[]> = {}
|
|
5189
|
-
for (const [file, source] of Object.entries(input.files)) {
|
|
5190
|
-
const module = /(?:^|\/)(\w+)\.framework\/Headers\/(?!.*-Swift\.h$).*\.h$/.exec(
|
|
5191
|
-
file,
|
|
5192
|
-
)?.[1]
|
|
5193
|
-
if (!module || !swiftTargets.has(module) || native.has(module)) continue
|
|
5194
|
-
const declared = new Set(nativeHeaderDeclarations[module])
|
|
5195
|
-
for (const name of swiftInterfaceDeclarations(source)) declared.add(name)
|
|
5196
|
-
for (const match of source.matchAll(
|
|
5197
|
-
/\btypedef\s+(?:NS_ENUM|NS_OPTIONS)\s*\(\s*\w+\s*,\s*(\w+)\b/g,
|
|
5198
|
-
))
|
|
5199
|
-
declared.add(match[1]!)
|
|
5200
|
-
nativeHeaderDeclarations[module] = [...declared]
|
|
5201
|
-
}
|
|
5202
|
-
|
|
5203
5307
|
const nativeFlags = native.size > 0 ? new Map<string, string[]>() : undefined
|
|
5204
5308
|
const generatedOverlays = new Set(
|
|
5205
5309
|
headerSearch.files.filter((file) => file.endsWith('.yaml')),
|
|
@@ -5255,7 +5359,13 @@ export function writeSwiftProject(
|
|
|
5255
5359
|
const moduleFlags = [...(nativeModuleImports.get(target.name) ?? [])].flatMap(
|
|
5256
5360
|
(name) => {
|
|
5257
5361
|
const map = sourceModuleMaps.get(name)
|
|
5258
|
-
return map
|
|
5362
|
+
return map
|
|
5363
|
+
? [
|
|
5364
|
+
`-fmodule-map-file=${map.path}`,
|
|
5365
|
+
...(map.publicHeaders ? ['-I', map.publicHeaders] : []),
|
|
5366
|
+
...(map.frameworkDirectory ? ['-F', map.frameworkDirectory] : []),
|
|
5367
|
+
]
|
|
5368
|
+
: []
|
|
5259
5369
|
},
|
|
5260
5370
|
)
|
|
5261
5371
|
nativeFlags.set(target.name, [
|
|
@@ -5353,8 +5463,12 @@ export function writeSwiftProject(
|
|
|
5353
5463
|
for (const [target, data] of Object.entries(input.libraries ?? {})) {
|
|
5354
5464
|
const bytes = Buffer.from(data, 'base64')
|
|
5355
5465
|
const digest = sha256Hex(bytes)
|
|
5356
|
-
if (
|
|
5357
|
-
|
|
5466
|
+
if (
|
|
5467
|
+
input.binaryModules?.[target] &&
|
|
5468
|
+
(!input.sourceLinkGraph || packageTargets.has(target))
|
|
5469
|
+
) {
|
|
5470
|
+
// swiftpm passes every Swift object to the linker, which discovers its SDK
|
|
5471
|
+
// dependencies, and an app links its pods with -ObjC, loading their classes.
|
|
5358
5472
|
const objects = path.join(
|
|
5359
5473
|
layout.root,
|
|
5360
5474
|
NATIVE_ARCHIVE_OBJECTS_DIR,
|
|
@@ -5515,7 +5629,7 @@ export function writeSwiftProject(
|
|
|
5515
5629
|
? coalescibleHeaderOverlays(generatedOverlays)
|
|
5516
5630
|
: undefined,
|
|
5517
5631
|
nativeHeaderFlags,
|
|
5518
|
-
|
|
5632
|
+
nativeSwiftHeaderFlags,
|
|
5519
5633
|
nativeHeaderDeclarations,
|
|
5520
5634
|
objcImplementationModules: new Set(
|
|
5521
5635
|
targets
|
|
@@ -5944,6 +6058,8 @@ export function writeSwiftProject(
|
|
|
5944
6058
|
headerProducers: orderedProducers,
|
|
5945
6059
|
headerBuilds,
|
|
5946
6060
|
nativeHeaderDeclarations,
|
|
6061
|
+
nativeProvidedUmbrellas,
|
|
6062
|
+
projectFrameworkUmbrellas,
|
|
5947
6063
|
targetFailures,
|
|
5948
6064
|
generatedOwners,
|
|
5949
6065
|
targetToolset,
|
|
@@ -6123,6 +6239,8 @@ function saveCompiledArtifact(root: string, artifact: SwiftCompileArtifact): voi
|
|
|
6123
6239
|
try {
|
|
6124
6240
|
const appLink = artifact.sdk?.binding.appLink
|
|
6125
6241
|
if (appLink) writeFileSync(path.join(pending, 'app-link.json.gz'), appLink)
|
|
6242
|
+
const appData = artifact.sdk?.binding.appData
|
|
6243
|
+
if (appData) writeSwiftAppData(artifact.bytes, appData)
|
|
6126
6244
|
writeFileSync(path.join(pending, 'app.wasm'), artifact.bytes)
|
|
6127
6245
|
writeFileSync(path.join(pending, 'icu.gz'), artifact.icu.gzip)
|
|
6128
6246
|
if (artifact.sdk) {
|
|
@@ -6780,11 +6898,14 @@ function shellQuote(value: string): string {
|
|
|
6780
6898
|
return `'${value.replaceAll("'", "'\\''")}'`
|
|
6781
6899
|
}
|
|
6782
6900
|
|
|
6783
|
-
|
|
6901
|
+
const SWIFT_FRAMEWORK_CODEGEN_PENDING = 'wasm-codegen-pending'
|
|
6902
|
+
|
|
6903
|
+
function prepareSwiftCompileCache(
|
|
6784
6904
|
scratch: string,
|
|
6785
6905
|
moduleRoot: string,
|
|
6786
6906
|
toolchainBin: string,
|
|
6787
6907
|
sdkOptions: string[],
|
|
6908
|
+
bindingsContext?: string,
|
|
6788
6909
|
): { wrapper: string; statsFile: string } | null {
|
|
6789
6910
|
const launcher = path.join(moduleRoot, 'scripts/build-cache-launcher.ts')
|
|
6790
6911
|
if (!existsSync(launcher)) return null
|
|
@@ -6805,15 +6926,29 @@ function prepareFrameworkCompileCache(
|
|
|
6805
6926
|
const pathMapEntries: [string, string][] = [['$SLOT_ROOT', scratch]]
|
|
6806
6927
|
if (sdkViewDir) pathMapEntries.push(['$SDK_VIEW', sdkViewDir])
|
|
6807
6928
|
const pathMap = JSON.stringify(pathMapEntries)
|
|
6808
|
-
const
|
|
6929
|
+
const frontend = shellQuote(path.join(toolchainBin, 'swift-frontend'))
|
|
6930
|
+
const context = bindingsContext ?? frameworkHeaderContext(moduleRoot)
|
|
6809
6931
|
const script = [
|
|
6810
6932
|
'#!/bin/sh',
|
|
6933
|
+
...(bindingsContext
|
|
6934
|
+
? [
|
|
6935
|
+
'module=; previous=',
|
|
6936
|
+
'for flag in "$@"; do',
|
|
6937
|
+
' if [ "$previous" = -module-name ]; then module=$flag; break; fi',
|
|
6938
|
+
' previous=$flag',
|
|
6939
|
+
'done',
|
|
6940
|
+
`case "$module" in OneSDKBindings|'') ;; *) exec ${frontend} "$@" ;; esac`,
|
|
6941
|
+
'export SWIFT_SDK_COMPILE_CACHE_DIAGNOSTICS=1',
|
|
6942
|
+
]
|
|
6943
|
+
: [
|
|
6944
|
+
`export SWIFT_SDK_COMPILE_CACHE_WASM_PENDING=${shellQuote(path.join(scratch, SWIFT_FRAMEWORK_CODEGEN_PENDING))}`,
|
|
6945
|
+
]),
|
|
6811
6946
|
`export SWIFT_SDK_COMPILE_CACHE=${shellQuote(cacheRoot)}`,
|
|
6812
6947
|
'export SWIFT_SDK_COMPILE_CACHE_REUSE=1',
|
|
6813
6948
|
`export SWIFT_SDK_COMPILE_CACHE_PATH_MAP=${shellQuote(pathMap)}`,
|
|
6814
6949
|
`export SWIFT_SDK_COMPILE_CACHE_CONTEXT=${shellQuote(context)}`,
|
|
6815
6950
|
`export SWIFT_SDK_COMPILE_CACHE_STATS=${shellQuote(statsFile)}`,
|
|
6816
|
-
`exec ${shellQuote(bunBin)} ${shellQuote(launcher)} ${
|
|
6951
|
+
`exec ${shellQuote(bunBin)} ${shellQuote(launcher)} ${frontend} "$@"`,
|
|
6817
6952
|
'',
|
|
6818
6953
|
].join('\n')
|
|
6819
6954
|
const partial = `${wrapper}.${process.pid}.${randomUUID()}.partial`
|
|
@@ -6823,17 +6958,32 @@ function prepareFrameworkCompileCache(
|
|
|
6823
6958
|
return { wrapper, statsFile }
|
|
6824
6959
|
}
|
|
6825
6960
|
|
|
6826
|
-
function
|
|
6961
|
+
function reportSwiftCompileCacheStats(
|
|
6962
|
+
kind: 'framework' | 'bindings',
|
|
6963
|
+
scratch: string,
|
|
6964
|
+
statsFile: string,
|
|
6965
|
+
): void {
|
|
6827
6966
|
if (!existsSync(statsFile)) return
|
|
6828
6967
|
let hits = 0
|
|
6829
6968
|
let misses = 0
|
|
6830
6969
|
let savedMs = 0
|
|
6970
|
+
let reusedObjects = 0
|
|
6971
|
+
const missedModules = new Map<string, number>()
|
|
6831
6972
|
try {
|
|
6832
6973
|
for (const line of readFileSync(statsFile, 'utf8').split('\n').filter(Boolean)) {
|
|
6833
|
-
const entry: {
|
|
6974
|
+
const entry: {
|
|
6975
|
+
hits?: number
|
|
6976
|
+
misses?: number
|
|
6977
|
+
savedMs?: number
|
|
6978
|
+
reusedObjects?: number
|
|
6979
|
+
missedModules?: Record<string, number>
|
|
6980
|
+
} = JSON.parse(line)
|
|
6834
6981
|
hits += entry.hits ?? 0
|
|
6835
6982
|
misses += entry.misses ?? 0
|
|
6836
6983
|
savedMs += entry.savedMs ?? 0
|
|
6984
|
+
reusedObjects += entry.reusedObjects ?? 0
|
|
6985
|
+
for (const [name, count] of Object.entries(entry.missedModules ?? {}))
|
|
6986
|
+
missedModules.set(name, (missedModules.get(name) ?? 0) + count)
|
|
6837
6987
|
}
|
|
6838
6988
|
} catch (error) {
|
|
6839
6989
|
if (error instanceof SyntaxError) return
|
|
@@ -6842,8 +6992,13 @@ function reportFrameworkCompileCacheStats(scratch: string, statsFile: string): v
|
|
|
6842
6992
|
rmSync(statsFile, { force: true })
|
|
6843
6993
|
}
|
|
6844
6994
|
if (hits > 0 || misses > 0) {
|
|
6995
|
+
const missed = [...missedModules]
|
|
6996
|
+
.sort((left, right) => right[1] - left[1])
|
|
6997
|
+
.slice(0, 8)
|
|
6998
|
+
.map(([name, count]) => `${name}:${count}`)
|
|
6999
|
+
.join(',')
|
|
6845
7000
|
console.error(
|
|
6846
|
-
`[swift-
|
|
7001
|
+
`[swift-${kind}-compile-cache] ${path.basename(scratch)} hits=${hits} misses=${misses} reusedObjects=${reusedObjects} saved=${(savedMs / 1000).toFixed(1)}s${missed ? ` missed=${missed}` : ''}`,
|
|
6847
7002
|
)
|
|
6848
7003
|
}
|
|
6849
7004
|
}
|
|
@@ -6949,12 +7104,7 @@ async function buildFrameworkProducts(
|
|
|
6949
7104
|
jobs >= 16 ? Math.min(jobs, 24) : Math.max(1, Math.floor(jobs / targetJobs))
|
|
6950
7105
|
const cache = unoptimized
|
|
6951
7106
|
? null
|
|
6952
|
-
:
|
|
6953
|
-
scratch,
|
|
6954
|
-
args.moduleRoot,
|
|
6955
|
-
args.toolchainBin,
|
|
6956
|
-
sdkOptions,
|
|
6957
|
-
)
|
|
7107
|
+
: prepareSwiftCompileCache(scratch, args.moduleRoot, args.toolchainBin, sdkOptions)
|
|
6958
7108
|
await runCompiler(
|
|
6959
7109
|
args.swift,
|
|
6960
7110
|
[
|
|
@@ -7027,7 +7177,7 @@ async function buildFrameworkProducts(
|
|
|
7027
7177
|
throw new Error(outputOf(error), { cause: error })
|
|
7028
7178
|
})
|
|
7029
7179
|
.finally(() => {
|
|
7030
|
-
if (cache)
|
|
7180
|
+
if (cache) reportSwiftCompileCacheStats('framework', scratch, cache.statsFile)
|
|
7031
7181
|
})
|
|
7032
7182
|
}
|
|
7033
7183
|
const release = path.join(scratch, WASM_TRIPLE, 'release')
|
|
@@ -7317,6 +7467,26 @@ async function withSwiftFrameworkSlot<T>(
|
|
|
7317
7467
|
hasPendingForeignHandoff(slot, Date.now())
|
|
7318
7468
|
)
|
|
7319
7469
|
return
|
|
7470
|
+
const pending = path.join(slot, SWIFT_FRAMEWORK_CODEGEN_PENDING)
|
|
7471
|
+
const interrupted = existsSync(pending)
|
|
7472
|
+
? readdirSync(pending).filter((file) => file.endsWith('.json'))
|
|
7473
|
+
: []
|
|
7474
|
+
if (interrupted.length) {
|
|
7475
|
+
if (!allowWrite) return
|
|
7476
|
+
const releaseDir = path.join(slot, WASM_TRIPLE, 'release') + path.sep
|
|
7477
|
+
for (const file of interrupted) {
|
|
7478
|
+
const objects = v.parse(
|
|
7479
|
+
v.array(v.string()),
|
|
7480
|
+
JSON.parse(readFileSync(path.join(pending, file), 'utf8')),
|
|
7481
|
+
)
|
|
7482
|
+
for (const object of objects) {
|
|
7483
|
+
if (!path.resolve(object).startsWith(releaseDir) || !object.endsWith('.o'))
|
|
7484
|
+
throw new Error(`invalid retained framework object ${object}`)
|
|
7485
|
+
rmSync(object, { force: true })
|
|
7486
|
+
}
|
|
7487
|
+
}
|
|
7488
|
+
rmSync(pending, { recursive: true, force: true })
|
|
7489
|
+
}
|
|
7320
7490
|
if (!matches) logSelection?.()
|
|
7321
7491
|
if (mode === 'extend')
|
|
7322
7492
|
console.error(
|
|
@@ -7628,6 +7798,7 @@ function stageFrameworkSource(
|
|
|
7628
7798
|
const stagedModule = path.join(staged, 'packages', path.basename(moduleRoot))
|
|
7629
7799
|
const hadKey = swiftFrameworkSlotKey(slot)
|
|
7630
7800
|
if (hadKey !== frameworkKey) {
|
|
7801
|
+
const sameRelease = swiftFrameworkSlotRelease(slot) === release
|
|
7631
7802
|
const stagedManifest = path.join(stagedModule, 'Package.swift')
|
|
7632
7803
|
const manifestChanged =
|
|
7633
7804
|
existsSync(stagedManifest) &&
|
|
@@ -7666,7 +7837,12 @@ function stageFrameworkSource(
|
|
|
7666
7837
|
for (const file of staleInputs)
|
|
7667
7838
|
rmSync(path.resolve(stagedModule, file), { force: true })
|
|
7668
7839
|
// the cached description belongs to the previous package graph and source paths.
|
|
7840
|
+
// llvm's object hash uses the compiler version string, so keep old objects
|
|
7841
|
+
// only within the same pinned compiler release.
|
|
7842
|
+
if (!sameRelease)
|
|
7843
|
+
rmSync(path.join(slot, WASM_TRIPLE), { recursive: true, force: true })
|
|
7669
7844
|
if (
|
|
7845
|
+
!sameRelease ||
|
|
7670
7846
|
manifestChanged ||
|
|
7671
7847
|
moduleRestructured ||
|
|
7672
7848
|
sdkRestructured ||
|
|
@@ -7756,6 +7932,36 @@ function swiftLinkStamp(args: {
|
|
|
7756
7932
|
return hash.digest('hex')
|
|
7757
7933
|
}
|
|
7758
7934
|
|
|
7935
|
+
function sourceFrameworkCompileStamp(
|
|
7936
|
+
moduleRoot: string,
|
|
7937
|
+
prebuilt: SwiftFrameworkProducts,
|
|
7938
|
+
toolchainBin: string,
|
|
7939
|
+
plugins: { libraries: string[]; executables: string[] },
|
|
7940
|
+
): string {
|
|
7941
|
+
const hash = createHash('sha256')
|
|
7942
|
+
.update('swift-app-objects/v1\n')
|
|
7943
|
+
.update(compilerSourceDigest)
|
|
7944
|
+
.update(JSON.stringify([moduleRoot, prebuilt.modules, toolchainBin]))
|
|
7945
|
+
.update(swiftFrameworkHeaderDigest(moduleRoot))
|
|
7946
|
+
// serialized modules include inlinable Swift bodies and private declarations
|
|
7947
|
+
// used by optimized clients. source info and documentation affect diagnostics.
|
|
7948
|
+
const files = [
|
|
7949
|
+
...readdirSync(prebuilt.modules, { recursive: true, encoding: 'utf8' })
|
|
7950
|
+
.filter((file) => !/\.(?:swiftdoc|swiftsourceinfo)$/.test(file))
|
|
7951
|
+
.map((file) => path.join(prebuilt.modules, file)),
|
|
7952
|
+
...prebuilt.moduleMaps,
|
|
7953
|
+
...prebuilt.objcHeaders.values(),
|
|
7954
|
+
...plugins.libraries,
|
|
7955
|
+
...plugins.executables,
|
|
7956
|
+
].sort()
|
|
7957
|
+
for (const file of files) {
|
|
7958
|
+
hash.update(`${file}\0`)
|
|
7959
|
+
if (statSync(file, { throwIfNoEntry: false })?.isFile())
|
|
7960
|
+
hash.update(swiftFileChecksum(file))
|
|
7961
|
+
}
|
|
7962
|
+
return hash.digest('hex')
|
|
7963
|
+
}
|
|
7964
|
+
|
|
7759
7965
|
function retireSwiftBuildPlan(scratch: string): void {
|
|
7760
7966
|
rmSync(path.join(scratch, 'release.yaml'), { force: true })
|
|
7761
7967
|
rmSync(path.join(scratch, WASM_TRIPLE, 'release', 'description.json'), { force: true })
|
|
@@ -7802,7 +8008,7 @@ function retireStaleSwiftLink(
|
|
|
7802
8008
|
root: string,
|
|
7803
8009
|
baseStamp: string,
|
|
7804
8010
|
stamp: string,
|
|
7805
|
-
|
|
8011
|
+
preserve?: 'clang' | 'app',
|
|
7806
8012
|
): boolean {
|
|
7807
8013
|
const receipt = path.join(root, SWIFT_LINK_STAMP)
|
|
7808
8014
|
let previous: string | null = null
|
|
@@ -7811,16 +8017,14 @@ function retireStaleSwiftLink(
|
|
|
7811
8017
|
} catch (error) {
|
|
7812
8018
|
if (!vanished(error)) throw error
|
|
7813
8019
|
}
|
|
7814
|
-
const combined = `${baseStamp}\n${
|
|
8020
|
+
const combined = `${baseStamp}\n${preserve === 'clang' ? 'swift-targets-v2\n' : ''}${stamp}`
|
|
7815
8021
|
if (previous === combined) return false
|
|
7816
8022
|
const retired = path.join(root, '.build')
|
|
7817
8023
|
const hadBuild = existsSync(retired)
|
|
7818
8024
|
const [previousBase] = previous?.split('\n') ?? []
|
|
7819
|
-
|
|
7820
|
-
|
|
7821
|
-
|
|
7822
|
-
else rmSync(retired, { recursive: true, force: true })
|
|
7823
|
-
}
|
|
8025
|
+
const preserved = previousBase === baseStamp ? preserve : undefined
|
|
8026
|
+
if (hadBuild && preserved === 'clang') retireSwiftLinkTargets(retired)
|
|
8027
|
+
if (hadBuild && !preserved) rmSync(retired, { recursive: true, force: true })
|
|
7824
8028
|
// record the retirement before compiling so a failed build can reuse its outputs.
|
|
7825
8029
|
mkdirSync(root, { recursive: true })
|
|
7826
8030
|
writeFileSync(receipt, `${combined}\n`)
|
|
@@ -8302,9 +8506,10 @@ async function compileSwiftProjectOnce(
|
|
|
8302
8506
|
!options.project &&
|
|
8303
8507
|
!options.linkOnly &&
|
|
8304
8508
|
path.basename(path.dirname(baseRoot)) === 'swift-builds'
|
|
8509
|
+
const reuseSourceObjects = canPoolBuildRoot && !distribution && !!batchSdk
|
|
8305
8510
|
const compatShapeParts = canPoolBuildRoot
|
|
8306
8511
|
? [
|
|
8307
|
-
distribution ? options.release : frameworkKey,
|
|
8512
|
+
distribution || reuseSourceObjects ? options.release : frameworkKey,
|
|
8308
8513
|
compileTargets(input)
|
|
8309
8514
|
.map((target) => target.name)
|
|
8310
8515
|
.sort(),
|
|
@@ -8557,6 +8762,7 @@ async function compileSwiftProjectOnce(
|
|
|
8557
8762
|
let readHold = frameworks.readHold
|
|
8558
8763
|
const buildOptions = {
|
|
8559
8764
|
env: baseBuildEnv,
|
|
8765
|
+
cwd: root,
|
|
8560
8766
|
maxBuffer: 64 * 1024 * 1024,
|
|
8561
8767
|
signal: budget.signal,
|
|
8562
8768
|
onOutput: budget.progress,
|
|
@@ -8566,15 +8772,25 @@ async function compileSwiftProjectOnce(
|
|
|
8566
8772
|
if (options.project) removeProjectLinks(root)
|
|
8567
8773
|
const packageHostMacros =
|
|
8568
8774
|
process.platform === 'linux' ? input.packageHostMacros : undefined
|
|
8775
|
+
const sourceCompileStamp =
|
|
8776
|
+
reuseSourceObjects && prebuilt
|
|
8777
|
+
? sourceFrameworkCompileStamp(
|
|
8778
|
+
frameworkRoot,
|
|
8779
|
+
prebuilt,
|
|
8780
|
+
toolchainBin,
|
|
8781
|
+
macroPlugins,
|
|
8782
|
+
)
|
|
8783
|
+
: undefined
|
|
8569
8784
|
if (
|
|
8570
8785
|
retireStaleSwiftLink(
|
|
8571
8786
|
root,
|
|
8572
|
-
|
|
8573
|
-
|
|
8574
|
-
|
|
8575
|
-
|
|
8576
|
-
|
|
8577
|
-
|
|
8787
|
+
sourceCompileStamp ??
|
|
8788
|
+
swiftLinkStamp({
|
|
8789
|
+
frameworkKey: mirrorDistribution
|
|
8790
|
+
? `${options.release}\0mirror`
|
|
8791
|
+
: `${options.release}\0${Boolean(distribution)}\0${swiftModuleSdk(frameworkRoot).wasmSdkId}`,
|
|
8792
|
+
packageHostMacros,
|
|
8793
|
+
}),
|
|
8578
8794
|
swiftLinkStamp({
|
|
8579
8795
|
// mirrored distributions and their WASI SDK mirror invalidate
|
|
8580
8796
|
// dependents per changed file instead of wiping every Clang object.
|
|
@@ -8586,10 +8802,25 @@ async function compileSwiftProjectOnce(
|
|
|
8586
8802
|
prebuilt,
|
|
8587
8803
|
packageHostMacros,
|
|
8588
8804
|
}),
|
|
8589
|
-
|
|
8805
|
+
sourceCompileStamp
|
|
8806
|
+
? 'app'
|
|
8807
|
+
: mirrorDistribution || options.linkOnly
|
|
8808
|
+
? 'clang'
|
|
8809
|
+
: undefined,
|
|
8590
8810
|
)
|
|
8591
8811
|
)
|
|
8592
8812
|
stage('framework revision changed; rebuilding the app link')
|
|
8813
|
+
const bindingCache =
|
|
8814
|
+
sourceCompileStamp &&
|
|
8815
|
+
targets.some(({ name }) => name === 'OneSDKBindings')
|
|
8816
|
+
? prepareSwiftCompileCache(
|
|
8817
|
+
path.join(root, '.build'),
|
|
8818
|
+
frameworkRoot,
|
|
8819
|
+
toolchainBin,
|
|
8820
|
+
compileSdk.options,
|
|
8821
|
+
inputHash.copy().update(sourceCompileStamp).digest('hex'),
|
|
8822
|
+
)
|
|
8823
|
+
: null
|
|
8593
8824
|
const nativeToolset = needsNativeToolset(input, prebuilt)
|
|
8594
8825
|
const projectStart = performance.now()
|
|
8595
8826
|
const preparation = writeSwiftProject(
|
|
@@ -8628,9 +8859,8 @@ async function compileSwiftProjectOnce(
|
|
|
8628
8859
|
const compiler: Record<string, string> = preparation.targetToolset
|
|
8629
8860
|
? { CC: path.join(root, CLANG_TARGET_MODULE_WRAPPER) }
|
|
8630
8861
|
: {}
|
|
8631
|
-
|
|
8632
|
-
|
|
8633
|
-
// when swiftpm compiles a declared macro for the linux host.
|
|
8862
|
+
// swiftpm applies the guest resource flag to host macros too.
|
|
8863
|
+
{
|
|
8634
8864
|
const swiftc = path.join(root, SWIFT_HOST_COMPILER_WRAPPER)
|
|
8635
8865
|
writeBuildFile(
|
|
8636
8866
|
swiftc,
|
|
@@ -8645,6 +8875,9 @@ async function compileSwiftProjectOnce(
|
|
|
8645
8875
|
' case "$argument" in -c|-emit-module|-scan-dependencies|-typecheck) compile=1 ;; esac',
|
|
8646
8876
|
' previous=$argument',
|
|
8647
8877
|
'done',
|
|
8878
|
+
'case "$target" in',
|
|
8879
|
+
' *-apple-*|*-linux*) set -- "$@" -resource-dir "$PEACH_SWIFT_HOST_RESOURCES" ;;',
|
|
8880
|
+
'esac',
|
|
8648
8881
|
'case "$target/$compile" in',
|
|
8649
8882
|
' *-*-linux*/1)',
|
|
8650
8883
|
' case ",$PEACH_SWIFT_HOST_MACROS," in',
|
|
@@ -8657,8 +8890,12 @@ async function compileSwiftProjectOnce(
|
|
|
8657
8890
|
)
|
|
8658
8891
|
chmodSync(swiftc, 0o755)
|
|
8659
8892
|
compiler.SWIFT_EXEC = swiftc
|
|
8660
|
-
compiler.PEACH_SWIFT_HOST_MACROS = packageHostMacros
|
|
8893
|
+
compiler.PEACH_SWIFT_HOST_MACROS = packageHostMacros?.join(',') ?? ''
|
|
8661
8894
|
compiler.PEACH_SWIFTC = path.join(toolchainBin, 'swiftc')
|
|
8895
|
+
compiler.PEACH_SWIFT_HOST_RESOURCES = path.resolve(
|
|
8896
|
+
toolchainBin,
|
|
8897
|
+
'../lib/swift',
|
|
8898
|
+
)
|
|
8662
8899
|
}
|
|
8663
8900
|
const projectProcess = options.project
|
|
8664
8901
|
? prepareSwiftProjectProcess(root, options.project)
|
|
@@ -8686,6 +8923,18 @@ async function compileSwiftProjectOnce(
|
|
|
8686
8923
|
...compiler,
|
|
8687
8924
|
},
|
|
8688
8925
|
}
|
|
8926
|
+
const { executable, prefixArgs } = rnxSelfInvocation()
|
|
8927
|
+
const frontendWrapper = path.join(root, '.build', 'peach-source-frontend')
|
|
8928
|
+
mkdirSync(path.dirname(frontendWrapper), { recursive: true })
|
|
8929
|
+
writeBuildFile(
|
|
8930
|
+
frontendWrapper,
|
|
8931
|
+
[
|
|
8932
|
+
'#!/bin/sh',
|
|
8933
|
+
`exec ${[executable, ...prefixArgs, RNX_INTERNAL_COMMAND, RNX_INTERNAL_CHILDREN.swiftSourceFrontend, root, bindingCache?.wrapper ?? path.join(toolchainBin, 'swift-frontend')].map(shellQuote).join(' ')} "$@"`,
|
|
8934
|
+
'',
|
|
8935
|
+
].join('\n'),
|
|
8936
|
+
)
|
|
8937
|
+
chmodSync(frontendWrapper, 0o755)
|
|
8689
8938
|
const unprepared = preparation.targetFailures.map(
|
|
8690
8939
|
(failure) => `error: target ${failure}`,
|
|
8691
8940
|
)
|
|
@@ -8719,6 +8968,12 @@ async function compileSwiftProjectOnce(
|
|
|
8719
8968
|
const reproducibleFrameworkRoot = mirrorDistribution
|
|
8720
8969
|
? frameworkRoot
|
|
8721
8970
|
: compileFrameworkRoot
|
|
8971
|
+
const compileSdkPaths = swiftSdkPaths(
|
|
8972
|
+
frameworkRoot,
|
|
8973
|
+
toolchainBin,
|
|
8974
|
+
compileSdk.options,
|
|
8975
|
+
compileSdk.id,
|
|
8976
|
+
)
|
|
8722
8977
|
const buildArgs = [
|
|
8723
8978
|
'build',
|
|
8724
8979
|
...(projectProcess?.cacheOptions ?? swiftPackageCacheOptions()),
|
|
@@ -8737,6 +8992,14 @@ async function compileSwiftProjectOnce(
|
|
|
8737
8992
|
: []),
|
|
8738
8993
|
'-c',
|
|
8739
8994
|
'release',
|
|
8995
|
+
'-Xswiftc',
|
|
8996
|
+
'-driver-use-frontend-path',
|
|
8997
|
+
'-Xswiftc',
|
|
8998
|
+
frontendWrapper,
|
|
8999
|
+
'-Xswiftc',
|
|
9000
|
+
'-resource-dir',
|
|
9001
|
+
'-Xswiftc',
|
|
9002
|
+
compileSdkPaths.resources,
|
|
8740
9003
|
...(input.unoptimized ? ['-Xswiftc', '-Onone'] : []),
|
|
8741
9004
|
...(perFile
|
|
8742
9005
|
? [
|
|
@@ -8821,19 +9084,17 @@ async function compileSwiftProjectOnce(
|
|
|
8821
9084
|
string,
|
|
8822
9085
|
{ file: string; header: string; module: boolean } | null
|
|
8823
9086
|
>()
|
|
8824
|
-
const compileSdkPaths = swiftSdkPaths(
|
|
8825
|
-
frameworkRoot,
|
|
8826
|
-
toolchainBin,
|
|
8827
|
-
compileSdk.options,
|
|
8828
|
-
compileSdk.id,
|
|
8829
|
-
)
|
|
8830
9087
|
const sdkFrameworks = path.join(
|
|
8831
9088
|
compileSdkPaths.darwin,
|
|
8832
9089
|
'System/Library/Frameworks',
|
|
8833
9090
|
)
|
|
8834
9091
|
const generatedInterface = (source: string) =>
|
|
8835
9092
|
withoutImportedSdkEnumForwards(
|
|
8836
|
-
clangInterfaceHeader(
|
|
9093
|
+
clangInterfaceHeader(
|
|
9094
|
+
readFileSync(source, 'utf8'),
|
|
9095
|
+
frameworkRoot,
|
|
9096
|
+
preparation.projectFrameworkUmbrellas,
|
|
9097
|
+
),
|
|
8837
9098
|
sdkObjCDeclarationOwners(sdkFrameworks),
|
|
8838
9099
|
)
|
|
8839
9100
|
const nativeDeclarations = new Map<string, Set<string>>()
|
|
@@ -8962,12 +9223,16 @@ async function compileSwiftProjectOnce(
|
|
|
8962
9223
|
module: existsSync(headers),
|
|
8963
9224
|
}
|
|
8964
9225
|
frameworkInterfaces.set(name, value)
|
|
8965
|
-
|
|
8966
|
-
value.file,
|
|
9226
|
+
const compatibility =
|
|
8967
9227
|
(existsSync(path.join(headers, `${name}.h`))
|
|
8968
9228
|
? `#import <${name}/${name}.h>\n`
|
|
8969
|
-
: '') +
|
|
8970
|
-
|
|
9229
|
+
: '') + swiftHeaderWithSuperclassImports(header, frameworkInterface)
|
|
9230
|
+
const nativeUmbrella = preparation.nativeProvidedUmbrellas.get(name)
|
|
9231
|
+
writeBuildFile(
|
|
9232
|
+
value.file,
|
|
9233
|
+
nativeUmbrella
|
|
9234
|
+
? `#if defined(__swift__)\n${compatibility}\n#else\n#import ${JSON.stringify(nativeUmbrella)}\n#endif\n`
|
|
9235
|
+
: compatibility,
|
|
8971
9236
|
)
|
|
8972
9237
|
return value
|
|
8973
9238
|
}
|
|
@@ -8989,7 +9254,22 @@ async function compileSwiftProjectOnce(
|
|
|
8989
9254
|
original,
|
|
8990
9255
|
emitted,
|
|
8991
9256
|
}: ReturnType<typeof headerPaths>) => {
|
|
8992
|
-
|
|
9257
|
+
let generated = generatedInterface(original)
|
|
9258
|
+
const vendor =
|
|
9259
|
+
input.files[`${SWIFT_STANDINS_DIR}/${producer}/${producer}-Swift.inc`]
|
|
9260
|
+
if (vendor) {
|
|
9261
|
+
// the clang header printer skips classes nested in a swift-only namespace.
|
|
9262
|
+
const existing = swiftInterfaceDeclarations(generated)
|
|
9263
|
+
const supplement = vendor.replace(
|
|
9264
|
+
/^((?:SWIFT_(?:RESILIENT_)?CLASS_NAMED\([^\n]*\)\n)?@interface (\w+)\b[^\n]*\n[\s\S]*?^@end\b)/gm,
|
|
9265
|
+
(declaration, _body: string, name: string) =>
|
|
9266
|
+
existing.has(name) ? '' : declaration,
|
|
9267
|
+
)
|
|
9268
|
+
generated = generated.replace(
|
|
9269
|
+
/#endif\s*$/,
|
|
9270
|
+
`#if defined(__OBJC__)\n${supplement}\n#endif\n#endif\n`,
|
|
9271
|
+
)
|
|
9272
|
+
}
|
|
8993
9273
|
writeBuildFile(
|
|
8994
9274
|
emitted,
|
|
8995
9275
|
withoutSwiftDeclarations(
|
|
@@ -9004,7 +9284,7 @@ async function compileSwiftProjectOnce(
|
|
|
9004
9284
|
}
|
|
9005
9285
|
const recipe = inputHash
|
|
9006
9286
|
.copy()
|
|
9007
|
-
.update(compileDigest)
|
|
9287
|
+
.update(sourceCompileStamp ?? compileDigest)
|
|
9008
9288
|
.update(readFileSync(path.join(root, 'Package.swift')))
|
|
9009
9289
|
.update(JSON.stringify(buildArgs))
|
|
9010
9290
|
.digest('hex')
|
|
@@ -9139,6 +9419,8 @@ async function compileSwiftProjectOnce(
|
|
|
9139
9419
|
)
|
|
9140
9420
|
}
|
|
9141
9421
|
} finally {
|
|
9422
|
+
if (bindingCache)
|
|
9423
|
+
reportSwiftCompileCacheStats('bindings', root, bindingCache.statsFile)
|
|
9142
9424
|
if (temporaryDirectory)
|
|
9143
9425
|
rmSync(temporaryDirectory, { recursive: true, force: true })
|
|
9144
9426
|
// a manifest, macro or build tool can leave processes behind that
|