peachsim 0.1.1744 → 0.1.1801
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 +28 -28
- package/cli/account-gate.ts +97 -0
- package/cli/app-catalog.ts +24 -0
- package/cli/app-stubs.ts +7 -0
- package/cli/auth.ts +48 -18
- package/cli/bin.ts +35 -2
- package/cli/bridge-flow-runner.ts +174 -6
- package/cli/cloud-dispatch.ts +0 -3
- package/cli/command-registry.ts +2 -6
- package/cli/commands/auth.ts +68 -3
- package/cli/commands/compat.ts +1116 -0
- package/cli/commands/control.ts +90 -13
- package/cli/commands/coverage.ts +85 -116
- package/cli/commands/detox.ts +20 -20
- package/cli/commands/device.ts +31 -27
- package/cli/commands/doctor.ts +76 -1032
- package/cli/commands/flow.ts +80 -41
- package/cli/commands/guest-host.ts +2 -2
- package/cli/commands/inspect/core.ts +8 -7
- package/cli/commands/inspect/settling.ts +60 -25
- package/cli/commands/inspect/wait-ready.ts +6 -4
- package/cli/commands/inspect/wait-selector.ts +32 -18
- package/cli/commands/inspect.ts +8 -6
- package/cli/commands/kotlin.ts +15 -6
- package/cli/commands/logout.ts +4 -2
- package/cli/commands/maestro-compare.ts +19 -37
- package/cli/commands/maestro-generate.ts +4 -4
- package/cli/commands/maestro.ts +56 -37
- package/cli/commands/package.ts +136 -57
- package/cli/commands/preview.ts +10 -1
- package/cli/commands/{film.ts → record-three.ts} +33 -28
- package/cli/commands/record.ts +41 -39
- package/cli/commands/screenshots.ts +4 -0
- package/cli/commands/setup.ts +38 -1
- package/cli/commands/shell-url.ts +49 -24
- package/cli/commands/swift.ts +29 -11
- package/cli/commands/test.ts +43 -13
- package/cli/commands/upload.ts +12 -9
- package/cli/drivers/playwright-core-pin.ts +2 -2
- package/cli/flow-export.ts +1 -1
- package/cli/flow-file.ts +1 -1
- package/cli/internal-child.ts +3 -8
- package/cli/maestro-compare.ts +73 -7
- package/cli/maestro-js.ts +1 -1
- package/cli/maestro-report.ts +1 -1
- package/cli/maestro-workspace.ts +66 -4
- package/cli/main.ts +22 -55
- package/cli/native-input.ts +13 -20
- package/cli/outbound-endpoints.ts +40 -7
- package/cli/output-redaction.ts +8 -3
- package/cli/packaged-app-launcher.ts +40 -28
- package/cli/prompt.ts +20 -0
- package/cli/recording-access.ts +7 -7
- package/cli/run-registry.ts +1 -1
- package/cli/scene-video.ts +0 -4
- package/cli/ws-bridge.ts +7 -4
- package/detox/index.ts +293 -50
- package/detox/jest-preset.cjs +6 -0
- package/detox/launch-permissions.ts +1 -21
- package/dist-lib/agent-daemon-client.cjs +1 -1
- package/dist-lib/agent-events.cjs +1 -1
- package/dist-lib/attached-projects.cjs +1 -1
- package/dist-lib/auth/shared-session.cjs +1 -1
- package/dist-lib/backend-origin.cjs +1 -1
- package/dist-lib/beta.cjs +1 -1
- package/dist-lib/beta.mjs +1 -1
- package/dist-lib/bridge-constants.cjs +1 -1
- package/dist-lib/bridge-contract-input.cjs +1 -1
- package/dist-lib/bridge-contract-input.mjs +1 -1
- package/dist-lib/bridge-contract.cjs +2 -8
- package/dist-lib/bridge-contract.mjs +2 -7
- package/dist-lib/bundle-channel.cjs +45273 -38265
- package/dist-lib/capture-contract.cjs +37 -14
- package/dist-lib/capture-contract.mjs +36 -13
- 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 +2 -2
- package/dist-lib/cloud.mjs +2 -2
- package/dist-lib/config.cjs +1 -1
- package/dist-lib/config.mjs +1 -1
- package/dist-lib/detox/index.cjs +562 -126
- package/dist-lib/detox/jest-preset.cjs +6 -0
- package/dist-lib/dev-bundle-resolution.cjs +18 -13
- package/dist-lib/expo-swift-bundle.cjs +28566 -23874
- package/dist-lib/expo-swift-metadata.cjs +104 -2
- package/dist-lib/expo-swift-metadata.mjs +104 -2
- package/dist-lib/home-paths.cjs +8 -5
- package/dist-lib/host/bridge-host.cjs +36618 -29846
- package/dist-lib/host/fetch-proxy-handler.cjs +23 -20
- 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 +5 -2
- package/dist-lib/index.cjs +1921 -1549
- package/dist-lib/jump-to-source-babel.cjs +1 -1
- package/dist-lib/jump-to-source-native.cjs +1 -1
- package/dist-lib/kotlin-host.cjs +1 -1
- package/dist-lib/menu.cjs +21 -7
- package/dist-lib/menu.mjs +21 -7
- 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 +1877 -1584
- package/dist-lib/native-app-identity-project.cjs +1274 -951
- package/dist-lib/native-app-identity-project.mjs +1414 -963
- package/dist-lib/native-app-identity.cjs +64 -58
- package/dist-lib/native-app-identity.mjs +64 -58
- package/dist-lib/native-firebase-metadata.cjs +1 -1
- package/dist-lib/native-firebase-metadata.mjs +1 -1
- package/dist-lib/plist.cjs +1 -1
- package/dist-lib/plist.mjs +1 -1
- package/dist-lib/profiles.cjs +1 -1
- package/dist-lib/public-brand.cjs +1 -1
- package/dist-lib/public-origins-lib-esm.json +79 -33
- package/dist-lib/public-origins-lib-static.json +1 -1
- package/dist-lib/public-origins-lib.json +484 -280
- package/dist-lib/react-native-host-modules.cjs +3 -1
- package/dist-lib/react-native-host-modules.mjs +3 -1
- package/dist-lib/reap-browser.cjs +23 -26
- package/dist-lib/scripts/dev-server-scanner.cjs +13 -10
- package/dist-lib/sdk.cjs +69 -36
- package/dist-lib/sdk.mjs +69 -36
- package/dist-lib/skills.cjs +33781 -27141
- package/dist-lib/swift-compile.cjs +3759 -2520
- package/dist-lib/swift-compile.mjs +3680 -2441
- package/dist-lib/swift-package.cjs +33 -1
- package/dist-lib/swift-package.mjs +31 -1
- package/dist-lib/swift-submit.cjs +1 -1
- package/dist-lib/swift-submit.mjs +1 -1
- package/dist-lib/swift-toolchain.cjs +102 -5
- package/dist-lib/swift.cjs +1 -1
- package/dist-lib/vite-swift.cjs +16480 -14579
- package/dist-lib/vite.cjs +269 -295
- package/dist-lib/worklet-executable.cjs +1 -1
- package/dist-lib/worklet-executable.mjs +1 -1
- package/dist-types/packages/peach-compat/src/secure-item-store.d.ts +38 -0
- package/dist-types/packages/peach-compat/src/stubs/ring-mode-state.d.ts +4 -0
- package/dist-types/packages/peach-compat/src/stubs/screen-transition-math.d.ts +21 -12
- package/dist-types/packages/peach-engine/src/billing/plans.d.ts +1 -2
- package/dist-types/packages/peach-engine/src/capture/browser-composite-provider.d.ts +2 -0
- package/dist-types/packages/peach-engine/src/capture/browser-composite.d.ts +1 -1
- package/dist-types/packages/peach-engine/src/engine/animated-driven-style.d.ts +10 -10
- package/dist-types/packages/peach-engine/src/engine/animated.d.ts +1 -0
- package/dist-types/packages/peach-engine/src/engine/animation-graph.d.ts +6 -2
- package/dist-types/packages/peach-engine/src/engine/canvaskit-api.d.ts +1 -0
- package/dist-types/packages/peach-engine/src/engine/canvaskit-renderer.d.ts +3 -2
- package/dist-types/packages/peach-engine/src/engine/fiber-debug-metadata.d.ts +5 -0
- package/dist-types/packages/peach-engine/src/engine/image-loader.d.ts +3 -0
- package/dist-types/packages/peach-engine/src/engine/liquid-glass.d.ts +1 -0
- package/dist-types/packages/peach-engine/src/engine/lottie-runtime.d.ts +3 -0
- package/dist-types/packages/peach-engine/src/engine/native-animation-driver.d.ts +18 -1
- package/dist-types/packages/peach-engine/src/engine/native-layout.d.ts +1 -0
- package/dist-types/packages/peach-engine/src/engine/nativeReplayContract.d.ts +71 -0
- package/dist-types/packages/peach-engine/src/engine/node.d.ts +31 -3
- package/dist-types/packages/peach-engine/src/engine/paint-boundary-types.d.ts +0 -1
- package/dist-types/packages/peach-engine/src/engine/paint-boundary.d.ts +7 -2
- package/dist-types/packages/peach-engine/src/engine/portals.d.ts +2 -4
- package/dist-types/packages/peach-engine/src/engine/render-damage.d.ts +5 -0
- package/dist-types/packages/peach-engine/src/engine/scene-table.d.ts +7 -1
- package/dist-types/packages/peach-engine/src/engine/scroll-momentum-math.d.ts +3 -3
- package/dist-types/packages/peach-engine/src/engine/scroll-velocity.d.ts +1 -0
- package/dist-types/packages/peach-engine/src/engine/scroll.d.ts +10 -0
- package/dist-types/packages/peach-engine/src/engine/secureItemHostContract.d.ts +30 -0
- package/dist-types/packages/peach-engine/src/engine/shell-owned-values.d.ts +55 -0
- package/dist-types/packages/peach-engine/src/engine/text-first-baseline.d.ts +2 -1
- package/dist-types/packages/peach-engine/src/engine/types.d.ts +85 -26
- package/dist-types/packages/peach-engine/src/graphite-stats-fields.d.ts +28 -0
- package/dist-types/packages/peach-engine/src/ios/apps/canvas-map-data.d.ts +1 -0
- package/dist-types/packages/peach-engine/src/ios/aux-home-scene.d.ts +3 -4
- package/dist-types/packages/peach-engine/src/ios/aux-shell-animated-sources.d.ts +1 -1
- package/dist-types/packages/peach-engine/src/ios/home-app-catalog.d.ts +2 -0
- package/dist-types/packages/peach-engine/src/ios/photo-store.d.ts +2 -0
- package/dist-types/packages/peach-engine/src/ios/photoLibraryContract.d.ts +15 -0
- package/dist-types/packages/peach-engine/src/ios/shell-controller-types.d.ts +1 -0
- package/dist-types/packages/peach-engine/src/metro-asset-path.d.ts +2 -0
- package/dist-types/packages/peach-engine/src/react-native/platform-colors.d.ts +1 -0
- package/dist-types/packages/peach-engine/src/remote-stream/cloud-display.d.ts +2 -2
- package/dist-types/packages/peach-engine/src/render-worker/canvaskit-webgpu.d.ts +2 -0
- package/dist-types/packages/peach-engine/src/render-worker/canvaskit-worker-init.d.ts +1 -1
- package/dist-types/packages/peach-engine/src/render-worker/compositor-protocol.d.ts +31 -12
- package/dist-types/packages/peach-engine/src/render-worker/compositor-runtime/scroll-drag-presentation.d.ts +23 -0
- package/dist-types/packages/peach-engine/src/render-worker/expo-widgetContract.d.ts +6 -0
- package/dist-types/packages/peach-engine/src/render-worker/expo-widgets-activityContract.d.ts +15 -0
- package/dist-types/packages/peach-engine/src/render-worker/graph-linked-value.d.ts +3 -1
- package/dist-types/packages/peach-engine/src/render-worker/host-service-protocol.d.ts +12 -2
- package/dist-types/packages/peach-engine/src/render-worker/image-pixel-contract.d.ts +12 -0
- package/dist-types/packages/peach-engine/src/render-worker/native-ui-protocol.d.ts +30 -0
- package/dist-types/packages/peach-engine/src/render-worker/native-widgetContract.d.ts +4 -1
- package/dist-types/packages/peach-engine/src/render-worker/protocol.d.ts +15 -9
- package/dist-types/packages/peach-engine/src/render-worker/scroll-mirror-tenant.d.ts +3 -1
- package/dist-types/packages/peach-engine/src/render-worker/scroll-mirror.d.ts +24 -0
- package/dist-types/packages/peach-engine/src/render-worker/shell-protocol.d.ts +8 -4
- package/dist-types/packages/peach-engine/src/render-worker/shell-scene-schema.d.ts +4 -0
- package/dist-types/packages/peach-engine/src/render-worker/shell-tree-wire.d.ts +3 -2
- package/dist-types/packages/peach-engine/src/render-worker/text-inputContract.d.ts +1 -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/worker-input-runtime.d.ts +2 -0
- package/dist-types/packages/peach-engine/src/render-worker/worklet-runtime.d.ts +10 -1
- package/dist-types/packages/peach-engine/src/render-worker/worklet-sab.d.ts +5 -0
- package/dist-types/packages/peach-engine/src/rolldown-production-module.d.ts +2 -1
- package/dist-types/packages/peach-engine/src/settings/devices.d.ts +4 -0
- package/dist-types/packages/peach-globals/src/eventBridgeContract.d.ts +1 -1
- package/dist-types/packages/peach-globals/src/lockstepCaptureBridgeContract.d.ts +7 -0
- package/dist-types/packages/peach-globals/src/nodeContract.d.ts +3 -1
- package/dist-types/packages/peach-globals/src/recordingBridgeContract.d.ts +5 -1
- package/dist-types/packages/peach-globals/src/shellBridgeContract.d.ts +2 -0
- package/dist-types/packages/peach-globals/src/testBridgeContract.d.ts +3 -1
- package/dist-types/packages/peach-kit/src/capabilities.d.ts +23 -1
- package/dist-types/packages/peach-kit/src/internal.d.ts +2 -1
- package/dist-types/packages/peach-kit/src/ui/hosting-safe-area.d.ts +2 -0
- package/dist-types/packages/peach-kit/src/ui/keyboard-toolbar.d.ts +5 -0
- package/install.sh +20 -1
- package/package.json +6 -5
- package/runtime-companion.json +1 -1
- package/sdk/ios/System/Library/Frameworks/AVFAudio.framework/Headers/AVAudioSession.h +629 -0
- package/sdk/ios/System/Library/Frameworks/AVFAudio.framework/Headers/AVAudioSessionDeprecated.h +90 -0
- package/sdk/ios/System/Library/Frameworks/AVFAudio.framework/Headers/AVAudioSessionRoute.h +256 -0
- package/sdk/ios/System/Library/Frameworks/AVFAudio.framework/Headers/AVAudioSessionTypes.h +1006 -0
- package/sdk/ios/System/Library/Frameworks/AVFAudio.framework/Headers/AVFAudio.apinotes +246 -0
- package/sdk/ios/System/Library/Frameworks/AVFAudio.framework/Headers/AVFAudio.h +5 -0
- package/sdk/ios/System/Library/Frameworks/AVFAudio.framework/Modules/module.modulemap +5 -0
- package/sdk/ios/System/Library/Frameworks/AVFoundation.framework/Headers/AVAnimation.h +52 -0
- package/sdk/ios/System/Library/Frameworks/AVFoundation.framework/Headers/AVAudioSession.h +11 -0
- package/sdk/ios/System/Library/Frameworks/AVFoundation.framework/Headers/AVBase.h +264 -0
- package/sdk/ios/System/Library/Frameworks/AVFoundation.framework/Headers/AVCaptureDevice.h +88 -0
- package/sdk/ios/System/Library/Frameworks/AVFoundation.framework/Headers/AVCaptureSession.h +1360 -0
- package/sdk/ios/System/Library/Frameworks/AVFoundation.framework/Headers/AVCaptureSessionPreset.h +167 -0
- package/sdk/ios/System/Library/Frameworks/AVFoundation.framework/Headers/AVFoundation.h +13 -0
- package/sdk/ios/System/Library/Frameworks/AVFoundation.framework/Headers/AVMediaFormat.h +508 -0
- package/sdk/ios/System/Library/Frameworks/AVFoundation.framework/Headers/AVMetadataItem.h +1 -1
- package/sdk/ios/System/Library/Frameworks/AVFoundation.framework/Headers/AVPlayerItem.h +31 -0
- package/sdk/ios/System/Library/Frameworks/AVFoundation.framework/Headers/AVSampleBufferDisplayLayer.h +18 -0
- package/sdk/ios/System/Library/Frameworks/AVKit.framework/Headers/AVCaptureDeviceDirectionCoordinator.h +113 -0
- package/sdk/ios/System/Library/Frameworks/AVKit.framework/Headers/AVCaptureEvent.h +82 -0
- package/sdk/ios/System/Library/Frameworks/AVKit.framework/Headers/AVCaptureEventInteraction.h +114 -0
- package/sdk/ios/System/Library/Frameworks/AVKit.framework/Headers/AVCaptureEventSound.h +50 -0
- package/sdk/ios/System/Library/Frameworks/AVKit.framework/Headers/AVError.h +51 -0
- package/sdk/ios/System/Library/Frameworks/AVKit.framework/Headers/AVInputPickerInteraction.h +93 -0
- package/sdk/ios/System/Library/Frameworks/AVKit.framework/Headers/AVInterstitialTimeRange.h +39 -0
- package/sdk/ios/System/Library/Frameworks/AVKit.framework/Headers/AVKit.apinotes +112 -0
- package/sdk/ios/System/Library/Frameworks/AVKit.framework/Headers/AVKit.h +110 -0
- package/sdk/ios/System/Library/Frameworks/AVKit.framework/Headers/AVKitDefines.h +79 -0
- package/sdk/ios/System/Library/Frameworks/AVKit.framework/Headers/AVKitTypes.h +54 -0
- package/sdk/ios/System/Library/Frameworks/AVKit.framework/Headers/AVLegibleMediaOptionsMenuController.h +193 -0
- package/sdk/ios/System/Library/Frameworks/AVKit.framework/Headers/AVPictureInPictureController.h +271 -0
- package/sdk/ios/System/Library/Frameworks/AVKit.framework/Headers/AVPictureInPictureController_AVSampleBufferDisplayLayerSupport.h +135 -0
- package/sdk/ios/System/Library/Frameworks/AVKit.framework/Headers/AVPictureInPictureController_VideoCallSupport.h +66 -0
- package/sdk/ios/System/Library/Frameworks/AVKit.framework/Headers/AVPlaybackRouteSelecting.h +46 -0
- package/sdk/ios/System/Library/Frameworks/AVKit.framework/Headers/AVPlaybackSpeed.h +71 -0
- package/sdk/ios/System/Library/Frameworks/AVKit.framework/Headers/AVPlaybackUserInterfaceControllable.h +551 -0
- package/sdk/ios/System/Library/Frameworks/AVKit.framework/Headers/AVPlayerItem+AVKitAdditions.h +42 -0
- package/sdk/ios/System/Library/Frameworks/AVKit.framework/Headers/AVPlayerViewController.h +704 -0
- package/sdk/ios/System/Library/Frameworks/AVKit.framework/Headers/AVRoutePickerView.h +186 -0
- package/sdk/ios/System/Library/Frameworks/AVKit.framework/Modules/module.modulemap +5 -0
- package/sdk/ios/System/Library/Frameworks/Accounts.framework/Headers/ACAccount.h +1 -1
- package/sdk/ios/System/Library/Frameworks/Accounts.framework/Headers/ACAccountCredential.h +1 -1
- package/sdk/ios/System/Library/Frameworks/Accounts.framework/Headers/ACAccountStore.h +1 -1
- package/sdk/ios/System/Library/Frameworks/Accounts.framework/Headers/ACAccountType.h +1 -1
- package/sdk/ios/System/Library/Frameworks/CoreAudioTypes.framework/Headers/AudioSessionTypes.h +104 -0
- package/sdk/ios/System/Library/Frameworks/CoreAudioTypes.framework/Headers/CoreAudioBaseTypes.h +1621 -0
- package/sdk/ios/System/Library/Frameworks/CoreAudioTypes.framework/Headers/CoreAudioTypes.apinotes +42 -0
- package/sdk/ios/System/Library/Frameworks/CoreAudioTypes.framework/Headers/CoreAudioTypes.h +9 -0
- package/sdk/ios/System/Library/Frameworks/CoreAudioTypes.framework/Modules/module.modulemap +6 -0
- package/sdk/ios/System/Library/Frameworks/CoreBluetooth.framework/Headers/CBAttribute.h +1 -1
- package/sdk/ios/System/Library/Frameworks/CoreBluetooth.framework/Headers/CBCentralManager.h +1 -1
- package/sdk/ios/System/Library/Frameworks/CoreBluetooth.framework/Headers/CBCharacteristic.h +1 -1
- package/sdk/ios/System/Library/Frameworks/CoreBluetooth.framework/Headers/CBDescriptor.h +1 -1
- package/sdk/ios/System/Library/Frameworks/CoreBluetooth.framework/Headers/CBManager.h +1 -1
- package/sdk/ios/System/Library/Frameworks/CoreBluetooth.framework/Headers/CBPeer.h +1 -1
- package/sdk/ios/System/Library/Frameworks/CoreBluetooth.framework/Headers/CBPeripheral.h +1 -1
- package/sdk/ios/System/Library/Frameworks/CoreBluetooth.framework/Headers/CBService.h +1 -1
- package/sdk/ios/System/Library/Frameworks/CoreBluetooth.framework/Headers/CBUUID.h +1 -1
- package/sdk/ios/System/Library/Frameworks/CoreData.framework/Headers/NSFetchRequest.h +1 -1
- package/sdk/ios/System/Library/Frameworks/CoreData.framework/Headers/NSManagedObjectID.h +1 -1
- package/sdk/ios/System/Library/Frameworks/CoreData.framework/Headers/NSManagedObjectModel.h +1 -1
- package/sdk/ios/System/Library/Frameworks/CoreData.framework/Headers/NSPersistentStoreCoordinator.h +1 -1
- package/sdk/ios/System/Library/Frameworks/CoreData.framework/Headers/NSPersistentStoreRequest.h +1 -1
- package/sdk/ios/System/Library/Frameworks/CoreFoundation.framework/Headers/CFRunLoop.h +195 -0
- package/sdk/ios/System/Library/Frameworks/CoreFoundation.framework/Headers/CFSocket.h +220 -0
- package/sdk/ios/System/Library/Frameworks/CoreFoundation.framework/Headers/CFStream.h +501 -0
- package/sdk/ios/System/Library/Frameworks/CoreFoundation.framework/Headers/CoreFoundation.h +3 -18
- package/sdk/ios/System/Library/Frameworks/CoreLocation.framework/Headers/CLBeaconIdentityConstraint.h +1 -1
- package/sdk/ios/System/Library/Frameworks/CoreLocation.framework/Headers/CLBeaconRegion.h +2 -2
- package/sdk/ios/System/Library/Frameworks/CoreLocation.framework/Headers/CLCircularRegion.h +1 -1
- package/sdk/ios/System/Library/Frameworks/CoreLocation.framework/Headers/CLGeocoder.h +2 -2
- package/sdk/ios/System/Library/Frameworks/CoreLocation.framework/Headers/CLHeading.h +1 -1
- package/sdk/ios/System/Library/Frameworks/CoreLocation.framework/Headers/CLLocationManager+CLVisitExtensions.h +1 -1
- package/sdk/ios/System/Library/Frameworks/CoreLocation.framework/Headers/CLLocationManager.h +1 -1
- package/sdk/ios/System/Library/Frameworks/CoreLocation.framework/Headers/CLPlacemark.h +2 -2
- package/sdk/ios/System/Library/Frameworks/CoreLocation.framework/Headers/CLRegion.h +1 -1
- package/sdk/ios/System/Library/Frameworks/CoreLocation.framework/Headers/CLVisit.h +1 -1
- package/sdk/ios/System/Library/Frameworks/CoreMedia.framework/Headers/CMBase.h +443 -0
- package/sdk/ios/System/Library/Frameworks/CoreMedia.framework/Headers/CMFormatDescription.h +8 -0
- package/sdk/ios/System/Library/Frameworks/CoreMedia.framework/Headers/CMSync.h +996 -0
- package/sdk/ios/System/Library/Frameworks/CoreMedia.framework/Headers/CMTime.h +9 -0
- package/sdk/ios/System/Library/Frameworks/CoreMedia.framework/Headers/CoreMedia.h +3 -0
- package/sdk/ios/System/Library/Frameworks/CoreNFC.framework/Headers/NFCNDEFMessage.h +1 -1
- package/sdk/ios/System/Library/Frameworks/CoreNFC.framework/Headers/NFCNDEFPayload.h +2 -2
- package/sdk/ios/System/Library/Frameworks/CoreNFC.framework/Headers/NFCNDEFReaderSession.h +1 -1
- package/sdk/ios/System/Library/Frameworks/CoreNFC.framework/Headers/NFCReaderSession.h +1 -1
- package/sdk/ios/System/Library/Frameworks/CoreTelephony.framework/Headers/CTCellularData.h +1 -1
- package/sdk/ios/System/Library/Frameworks/CoreTelephony.framework/Headers/CTTelephonyNetworkInfo.h +1 -1
- package/sdk/ios/System/Library/Frameworks/CoreText.framework/Headers/CTFont.h +1811 -0
- package/sdk/ios/System/Library/Frameworks/CoreText.framework/Headers/CTFontCollection.h +360 -0
- package/sdk/ios/System/Library/Frameworks/CoreText.framework/Headers/CTFontManager.h +574 -17
- package/sdk/ios/System/Library/Frameworks/CoreText.framework/Headers/CTFontManagerErrors.h +109 -0
- package/sdk/ios/System/Library/Frameworks/CoreText.framework/Headers/CTFrame.h +336 -0
- package/sdk/ios/System/Library/Frameworks/CoreText.framework/Headers/CTFramesetter.h +203 -0
- package/sdk/ios/System/Library/Frameworks/CoreText.framework/Headers/CTGlyphInfo.h +264 -0
- package/sdk/ios/System/Library/Frameworks/CoreText.framework/Headers/CTLine.h +531 -0
- package/sdk/ios/System/Library/Frameworks/CoreText.framework/Headers/CTParagraphStyle.h +496 -0
- package/sdk/ios/System/Library/Frameworks/CoreText.framework/Headers/CTRubyAnnotation.h +326 -0
- package/sdk/ios/System/Library/Frameworks/CoreText.framework/Headers/CTRun.h +547 -0
- package/sdk/ios/System/Library/Frameworks/CoreText.framework/Headers/CTRunDelegate.h +213 -0
- package/sdk/ios/System/Library/Frameworks/CoreText.framework/Headers/CTStringAttributes.h +496 -0
- package/sdk/ios/System/Library/Frameworks/CoreText.framework/Headers/CTTextTab.h +158 -0
- package/sdk/ios/System/Library/Frameworks/CoreText.framework/Headers/CTTypesetter.h +286 -0
- package/sdk/ios/System/Library/Frameworks/CoreText.framework/Headers/CoreText.h +80 -1
- package/sdk/ios/System/Library/Frameworks/CoreText.framework/Headers/SFNTLayoutTypes.h +1833 -0
- package/sdk/ios/System/Library/Frameworks/CoreText.framework/Headers/SFNTTypes.h +482 -0
- package/sdk/ios/System/Library/Frameworks/DeviceDiscoveryUI.framework/Headers/DDDevicePickerViewController.h +41 -0
- package/sdk/ios/System/Library/Frameworks/DeviceDiscoveryUI.framework/Headers/DeviceDiscoveryUI.h +9 -0
- package/sdk/ios/System/Library/Frameworks/DeviceDiscoveryUI.framework/Headers/DeviceDiscoveryUIDefines.h +14 -0
- package/sdk/ios/System/Library/Frameworks/DeviceDiscoveryUI.framework/Modules/DeviceDiscoveryUI.swiftcrossimport/SwiftUI.swiftoverlay +4 -0
- package/sdk/ios/System/Library/Frameworks/DeviceDiscoveryUI.framework/Modules/module.modulemap +9 -0
- package/sdk/ios/System/Library/Frameworks/Foundation.framework/Headers/Foundation.apinotes +1 -1
- package/sdk/ios/System/Library/Frameworks/Foundation.framework/Headers/Foundation.h +49 -1
- package/sdk/ios/System/Library/Frameworks/Foundation.framework/Headers/NSObjCRuntime.h +2 -0
- package/sdk/ios/System/Library/Frameworks/Foundation.framework/Headers/NSRegularExpression.h +15 -0
- package/sdk/ios/System/Library/Frameworks/Foundation.framework/Headers/NSUbiquitousKeyValueStore.h +30 -0
- package/sdk/ios/System/Library/Frameworks/GameKit.framework/Headers/GKAchievement.h +3 -3
- package/sdk/ios/System/Library/Frameworks/GameKit.framework/Headers/GKBasePlayer.h +1 -1
- package/sdk/ios/System/Library/Frameworks/GameKit.framework/Headers/GKChallenge.h +6 -6
- package/sdk/ios/System/Library/Frameworks/GameKit.framework/Headers/GKGameCenterViewController.h +4 -4
- package/sdk/ios/System/Library/Frameworks/GameKit.framework/Headers/GKLocalPlayer.h +6 -6
- package/sdk/ios/System/Library/Frameworks/GameKit.framework/Headers/GKMatchmaker.h +2 -2
- package/sdk/ios/System/Library/Frameworks/GameKit.framework/Headers/GKNotificationBanner.h +1 -1
- package/sdk/ios/System/Library/Frameworks/GameKit.framework/Headers/GKPlayer.h +3 -3
- package/sdk/ios/System/Library/Frameworks/GameKit.framework/Headers/GKSavedGame.h +2 -2
- package/sdk/ios/System/Library/Frameworks/GameKit.framework/Headers/GKTurnBasedMatch.h +4 -4
- package/sdk/ios/System/Library/Frameworks/GameKit.framework/Headers/GKTurnBasedMatchmakerViewController.h +3 -3
- package/sdk/ios/System/Library/Frameworks/HealthKit.framework/Headers/HKActivitySummary.h +1 -1
- package/sdk/ios/System/Library/Frameworks/HealthKit.framework/Headers/HKActivitySummaryQuery.h +1 -1
- package/sdk/ios/System/Library/Frameworks/HealthKit.framework/Headers/HKCategorySample.h +1 -1
- package/sdk/ios/System/Library/Frameworks/HealthKit.framework/Headers/HKClinicalType.h +1 -1
- package/sdk/ios/System/Library/Frameworks/HealthKit.framework/Headers/HKHealthStore.h +6 -6
- package/sdk/ios/System/Library/Frameworks/HealthKit.framework/Headers/HKObject.h +1 -1
- package/sdk/ios/System/Library/Frameworks/HealthKit.framework/Headers/HKObjectType.h +5 -5
- package/sdk/ios/System/Library/Frameworks/HealthKit.framework/Headers/HKObserverQuery.h +1 -1
- package/sdk/ios/System/Library/Frameworks/HealthKit.framework/Headers/HKQuantity.h +1 -1
- package/sdk/ios/System/Library/Frameworks/HealthKit.framework/Headers/HKQuantitySample.h +1 -1
- package/sdk/ios/System/Library/Frameworks/HealthKit.framework/Headers/HKQuery.h +14 -14
- package/sdk/ios/System/Library/Frameworks/HealthKit.framework/Headers/HKSample.h +1 -1
- package/sdk/ios/System/Library/Frameworks/HealthKit.framework/Headers/HKSampleQuery.h +1 -1
- package/sdk/ios/System/Library/Frameworks/HealthKit.framework/Headers/HKStatistics.h +1 -1
- package/sdk/ios/System/Library/Frameworks/HealthKit.framework/Headers/HKStatisticsQuery.h +1 -1
- package/sdk/ios/System/Library/Frameworks/HealthKit.framework/Headers/HKUnit.h +20 -20
- package/sdk/ios/System/Library/Frameworks/IOSurface.framework/Headers/IOSurfaceObjC.h +1 -1
- package/sdk/ios/System/Library/Frameworks/ImageIO.framework/Headers/CGImageAnimation.h +2 -0
- package/sdk/ios/System/Library/Frameworks/ImageIO.framework/Headers/CGImageDestination.h +2 -0
- package/sdk/ios/System/Library/Frameworks/ImageIO.framework/Headers/CGImageMetadata.h +2 -0
- package/sdk/ios/System/Library/Frameworks/ImageIO.framework/Headers/CGImageProperties.h +2 -0
- package/sdk/ios/System/Library/Frameworks/ImageIO.framework/Headers/CGImageSource.h +2 -0
- package/sdk/ios/System/Library/Frameworks/ImageIO.framework/Headers/ImageIOBase.h +6 -0
- package/sdk/ios/System/Library/Frameworks/JavaScriptCore.framework/Headers/JSBase.h +195 -0
- package/sdk/ios/System/Library/Frameworks/JavaScriptCore.framework/Headers/JSContext.h +245 -0
- package/sdk/ios/System/Library/Frameworks/JavaScriptCore.framework/Headers/JSContextRef.h +178 -0
- package/sdk/ios/System/Library/Frameworks/JavaScriptCore.framework/Headers/JSExport.h +151 -0
- package/sdk/ios/System/Library/Frameworks/JavaScriptCore.framework/Headers/JSManagedValue.h +81 -0
- package/sdk/ios/System/Library/Frameworks/JavaScriptCore.framework/Headers/JSObjectRef.h +755 -0
- package/sdk/ios/System/Library/Frameworks/JavaScriptCore.framework/Headers/JSStringRef.h +148 -0
- package/sdk/ios/System/Library/Frameworks/JavaScriptCore.framework/Headers/JSStringRefCF.h +60 -0
- package/sdk/ios/System/Library/Frameworks/JavaScriptCore.framework/Headers/JSTypedArray.h +180 -0
- package/sdk/ios/System/Library/Frameworks/JavaScriptCore.framework/Headers/JSValue.h +824 -0
- package/sdk/ios/System/Library/Frameworks/JavaScriptCore.framework/Headers/JSValueRef.h +555 -0
- package/sdk/ios/System/Library/Frameworks/JavaScriptCore.framework/Headers/JSVirtualMachine.h +92 -0
- package/sdk/ios/System/Library/Frameworks/JavaScriptCore.framework/Headers/JavaScript.h +37 -0
- package/sdk/ios/System/Library/Frameworks/JavaScriptCore.framework/Headers/JavaScriptCore.h +38 -0
- package/sdk/ios/System/Library/Frameworks/JavaScriptCore.framework/Headers/WebKitAvailability.h +36 -0
- package/sdk/ios/System/Library/Frameworks/JavaScriptCore.framework/Modules/module.modulemap +8 -0
- package/sdk/ios/System/Library/Frameworks/MobileCoreServices.framework/Headers/UTType.h +19 -0
- package/sdk/ios/System/Library/Frameworks/MultipeerConnectivity.framework/Headers/MCAdvertiserAssistant.h +76 -0
- package/sdk/ios/System/Library/Frameworks/MultipeerConnectivity.framework/Headers/MCBrowserViewController.h +88 -0
- package/sdk/ios/System/Library/Frameworks/MultipeerConnectivity.framework/Headers/MCError.h +34 -0
- package/sdk/ios/System/Library/Frameworks/MultipeerConnectivity.framework/Headers/MCNearbyServiceAdvertiser.h +84 -0
- package/sdk/ios/System/Library/Frameworks/MultipeerConnectivity.framework/Headers/MCNearbyServiceBrowser.h +94 -0
- package/sdk/ios/System/Library/Frameworks/MultipeerConnectivity.framework/Headers/MCPeerID.h +37 -0
- package/sdk/ios/System/Library/Frameworks/MultipeerConnectivity.framework/Headers/MCSession.h +215 -0
- package/sdk/ios/System/Library/Frameworks/MultipeerConnectivity.framework/Headers/MultipeerConnectivity.apinotes +5 -0
- package/sdk/ios/System/Library/Frameworks/MultipeerConnectivity.framework/Headers/MultipeerConnectivity.h +15 -0
- package/sdk/ios/System/Library/Frameworks/MultipeerConnectivity.framework/Modules/module.modulemap +7 -0
- package/sdk/ios/System/Library/Frameworks/NetworkExtension.framework/Headers/NEHotspotHelper.h +1 -1
- package/sdk/ios/System/Library/Frameworks/NetworkExtension.framework/Headers/NEHotspotNetwork.h +1 -1
- package/sdk/ios/System/Library/Frameworks/QuartzCore.framework/Headers/CAEmitterCell.h +1 -1
- package/sdk/ios/System/Library/Frameworks/QuartzCore.framework/Headers/CAEmitterLayer.h +1 -1
- package/sdk/ios/System/Library/Frameworks/QuartzCore.framework/Headers/CAGradientLayer.h +1 -1
- package/sdk/ios/System/Library/Frameworks/QuartzCore.framework/Headers/CAReplicatorLayer.h +1 -1
- package/sdk/ios/System/Library/Frameworks/QuartzCore.framework/Headers/CAScrollLayer.h +1 -1
- package/sdk/ios/System/Library/Frameworks/QuartzCore.framework/Headers/CAShapeLayer.h +1 -1
- package/sdk/ios/System/Library/Frameworks/QuartzCore.framework/Headers/CATextLayer.h +1 -1
- package/sdk/ios/System/Library/Frameworks/QuartzCore.framework/Headers/CATiledLayer.h +1 -1
- package/sdk/ios/System/Library/Frameworks/QuartzCore.framework/Headers/CATransformLayer.h +1 -1
- package/sdk/ios/System/Library/Frameworks/QuartzCore.framework/Headers/CAValueFunction.h +1 -1
- package/sdk/ios/System/Library/Frameworks/SafariServices.framework/Headers/SFSafariViewController.h +1 -1
- package/sdk/ios/System/Library/Frameworks/SceneKit.framework/Headers/ModelIO.h +6 -6
- package/sdk/ios/System/Library/Frameworks/SceneKit.framework/Headers/SCNAction.h +1 -1
- package/sdk/ios/System/Library/Frameworks/SceneKit.framework/Headers/SCNAudioSource.h +1 -1
- package/sdk/ios/System/Library/Frameworks/SceneKit.framework/Headers/SCNCamera.h +1 -1
- package/sdk/ios/System/Library/Frameworks/SceneKit.framework/Headers/SCNConstraint.h +2 -2
- package/sdk/ios/System/Library/Frameworks/SceneKit.framework/Headers/SCNGeometry.h +1 -1
- package/sdk/ios/System/Library/Frameworks/SceneKit.framework/Headers/SCNHitTest.h +2 -2
- package/sdk/ios/System/Library/Frameworks/SceneKit.framework/Headers/SCNLight.h +1 -1
- package/sdk/ios/System/Library/Frameworks/SceneKit.framework/Headers/SCNMaterial.h +1 -1
- package/sdk/ios/System/Library/Frameworks/SceneKit.framework/Headers/SCNMaterialProperty.h +1 -1
- package/sdk/ios/System/Library/Frameworks/SceneKit.framework/Headers/SCNNode.h +4 -4
- package/sdk/ios/System/Library/Frameworks/SceneKit.framework/Headers/SCNParametricGeometry.h +1 -1
- package/sdk/ios/System/Library/Frameworks/SceneKit.framework/Headers/SCNParticleSystem.h +2 -2
- package/sdk/ios/System/Library/Frameworks/SceneKit.framework/Headers/SCNScene.h +1 -1
- package/sdk/ios/System/Library/Frameworks/SceneKit.framework/Headers/SCNTransaction.h +1 -1
- package/sdk/ios/System/Library/Frameworks/SceneKit.framework/Headers/SCNView.h +1 -1
- package/sdk/ios/System/Library/Frameworks/SceneKit.framework/Headers/SceneKitDeprecated.h +3 -3
- package/sdk/ios/System/Library/Frameworks/UIKit.framework/Headers/NSLayoutManager.h +14 -0
- package/sdk/ios/System/Library/Frameworks/UIKit.framework/Headers/NSParagraphStyle.h +172 -27
- package/sdk/ios/System/Library/Frameworks/UIKit.framework/Headers/NSText.h +59 -0
- package/sdk/ios/System/Library/Frameworks/UIKit.framework/Headers/NSTextContainer.h +13 -0
- package/sdk/ios/System/Library/Frameworks/UIKit.framework/Headers/NSTextList.h +63 -0
- package/sdk/ios/System/Library/Frameworks/UIKit.framework/Headers/NSTextStorage.h +10 -0
- package/sdk/ios/System/Library/Frameworks/UIKit.framework/Headers/NSToolbar+UIKitAdditions.h +142 -0
- package/sdk/ios/System/Library/Frameworks/UIKit.framework/Headers/UIAccessibilityConstants.h +20 -20
- package/sdk/ios/System/Library/Frameworks/UIKit.framework/Headers/UIAction.h +103 -0
- package/sdk/ios/System/Library/Frameworks/UIKit.framework/Headers/UIApplication.h +6 -0
- package/sdk/ios/System/Library/Frameworks/UIKit.framework/Headers/UICommand.h +131 -0
- package/sdk/ios/System/Library/Frameworks/UIKit.framework/Headers/UIEvent.h +8 -3
- package/sdk/ios/System/Library/Frameworks/UIKit.framework/Headers/UIFont.h +80 -0
- package/sdk/ios/System/Library/Frameworks/UIKit.framework/Headers/UIFontDescriptor.h +191 -0
- package/sdk/ios/System/Library/Frameworks/UIKit.framework/Headers/UIGeometry.h +259 -0
- package/sdk/ios/System/Library/Frameworks/UIKit.framework/Headers/UIGestureRecognizer.h +9 -3
- package/sdk/ios/System/Library/Frameworks/UIKit.framework/Headers/UIGestureRecognizerSubclass.h +5 -3
- package/sdk/ios/System/Library/Frameworks/UIKit.framework/Headers/UIHoverGestureRecognizer.h +6 -3
- package/sdk/ios/System/Library/Frameworks/UIKit.framework/Headers/UIInteraction.h +37 -0
- package/sdk/ios/System/Library/Frameworks/UIKit.framework/Headers/UIKit.apinotes +4248 -0
- package/sdk/ios/System/Library/Frameworks/UIKit.framework/Headers/UIKit.h +66 -102
- package/sdk/ios/System/Library/Frameworks/UIKit.framework/Headers/UIKitDefines.h +55 -0
- package/sdk/ios/System/Library/Frameworks/UIKit.framework/Headers/UILayoutGuide.h +62 -0
- package/sdk/ios/System/Library/Frameworks/UIKit.framework/Headers/UIMenu.h +283 -0
- package/sdk/ios/System/Library/Frameworks/UIKit.framework/Headers/UIMenuDisplayPreferences.h +27 -0
- package/sdk/ios/System/Library/Frameworks/UIKit.framework/Headers/UIMenuElement.h +86 -0
- package/sdk/ios/System/Library/Frameworks/UIKit.framework/Headers/UIMenuLeaf.h +68 -0
- package/sdk/ios/System/Library/Frameworks/UIKit.framework/Headers/UITouch.h +1 -0
- package/sdk/ios/System/Library/Frameworks/UIKit.framework/Headers/UITraitCollection.h +2 -2
- package/sdk/ios/System/Library/Frameworks/UIKit.framework/Headers/UIView.h +3 -0
- package/sdk/ios/System/Library/Frameworks/UIKit.framework/Modules/module.modulemap +2 -0
- package/sdk/ios/System/Library/Frameworks/UIKitText.framework/Headers/UIKitText.apinotes +135 -0
- package/sdk/ios/System/Library/Frameworks/UIKitText.framework/Modules/module.modulemap +8 -0
- package/sdk/ios/System/Library/Frameworks/UniformTypeIdentifiers.framework/Headers/UTAdditions.h +167 -0
- package/sdk/ios/System/Library/Frameworks/UniformTypeIdentifiers.framework/Headers/UTCoreTypes.h +1332 -0
- package/sdk/ios/System/Library/Frameworks/UniformTypeIdentifiers.framework/Headers/UniformTypeIdentifiers.apinotes +53 -0
- package/sdk/ios/System/Library/Frameworks/UniformTypeIdentifiers.framework/Headers/UniformTypeIdentifiers.h +18 -0
- package/sdk/ios/System/Library/Frameworks/UniformTypeIdentifiers.framework/Modules/module.modulemap +6 -0
- package/sdk/ios/System/Library/Frameworks/UserNotifications.framework/Headers/NSString+UserNotifications.h +19 -0
- package/sdk/ios/System/Library/Frameworks/UserNotifications.framework/Headers/UNError.h +29 -0
- package/sdk/ios/System/Library/Frameworks/UserNotifications.framework/Headers/UNNotification.h +27 -0
- package/sdk/ios/System/Library/Frameworks/UserNotifications.framework/Headers/UNNotificationAction.h +69 -0
- package/sdk/ios/System/Library/Frameworks/UserNotifications.framework/Headers/UNNotificationActionIcon.h +23 -0
- package/sdk/ios/System/Library/Frameworks/UserNotifications.framework/Headers/UNNotificationAttachment.h +44 -0
- package/sdk/ios/System/Library/Frameworks/UserNotifications.framework/Headers/UNNotificationAttributedMessageContext.h +24 -0
- package/sdk/ios/System/Library/Frameworks/UserNotifications.framework/Headers/UNNotificationCategory.h +82 -0
- package/sdk/ios/System/Library/Frameworks/UserNotifications.framework/Headers/UNNotificationContent.h +152 -0
- package/sdk/ios/System/Library/Frameworks/UserNotifications.framework/Headers/UNNotificationRequest.h +34 -0
- package/sdk/ios/System/Library/Frameworks/UserNotifications.framework/Headers/UNNotificationResponse.h +41 -0
- package/sdk/ios/System/Library/Frameworks/UserNotifications.framework/Headers/UNNotificationServiceExtension.h +27 -0
- package/sdk/ios/System/Library/Frameworks/UserNotifications.framework/Headers/UNNotificationSettings.h +90 -0
- package/sdk/ios/System/Library/Frameworks/UserNotifications.framework/Headers/UNNotificationSound.h +45 -0
- package/sdk/ios/System/Library/Frameworks/UserNotifications.framework/Headers/UNNotificationTrigger.h +64 -0
- package/sdk/ios/System/Library/Frameworks/UserNotifications.framework/Headers/UNUserNotificationCenter.h +107 -0
- package/sdk/ios/System/Library/Frameworks/UserNotifications.framework/Headers/UserNotifications.apinotes +17 -0
- package/sdk/ios/System/Library/Frameworks/UserNotifications.framework/Headers/UserNotifications.h +23 -0
- package/sdk/ios/System/Library/Frameworks/UserNotifications.framework/Modules/module.modulemap +6 -0
- package/sdk/ios/System/Library/Frameworks/WatchConnectivity.framework/Headers/WCDefines.h +14 -0
- package/sdk/ios/System/Library/Frameworks/WatchConnectivity.framework/Headers/WCError.h +38 -0
- package/sdk/ios/System/Library/Frameworks/WatchConnectivity.framework/Headers/WCSession.h +200 -0
- package/sdk/ios/System/Library/Frameworks/WatchConnectivity.framework/Headers/WCSessionFile.h +30 -0
- package/sdk/ios/System/Library/Frameworks/WatchConnectivity.framework/Headers/WCSessionUserInfoTransfer.h +22 -0
- package/sdk/ios/System/Library/Frameworks/WatchConnectivity.framework/Headers/WatchConnectivity.apinotes +19 -0
- package/sdk/ios/System/Library/Frameworks/WatchConnectivity.framework/Headers/WatchConnectivity.h +15 -0
- package/sdk/ios/System/Library/Frameworks/WatchConnectivity.framework/Modules/module.modulemap +5 -0
- package/sdk/ios/System/Library/Frameworks/WebKit.framework/Headers/NSAttributedString.h +120 -0
- package/sdk/ios/System/Library/Frameworks/WebKit.framework/Headers/WKBackForwardList.h +77 -0
- package/sdk/ios/System/Library/Frameworks/WebKit.framework/Headers/WKBackForwardListItem.h +54 -0
- package/sdk/ios/System/Library/Frameworks/WebKit.framework/Headers/WKContentRuleList.h +37 -0
- package/sdk/ios/System/Library/Frameworks/WebKit.framework/Headers/WKContentRuleListStore.h +47 -0
- package/sdk/ios/System/Library/Frameworks/WebKit.framework/Headers/WKContentWorld.h +87 -0
- package/sdk/ios/System/Library/Frameworks/WebKit.framework/Headers/WKContentWorldConfiguration.h +71 -0
- package/sdk/ios/System/Library/Frameworks/WebKit.framework/Headers/WKContextMenuElementInfo.h +47 -0
- package/sdk/ios/System/Library/Frameworks/WebKit.framework/Headers/WKDOMNodeSnapshot.h +57 -0
- package/sdk/ios/System/Library/Frameworks/WebKit.framework/Headers/WKDataDetectorTypes.h +60 -0
- package/sdk/ios/System/Library/Frameworks/WebKit.framework/Headers/WKDownload.h +67 -0
- package/sdk/ios/System/Library/Frameworks/WebKit.framework/Headers/WKDownloadDelegate.h +146 -0
- package/sdk/ios/System/Library/Frameworks/WebKit.framework/Headers/WKError.h +71 -0
- package/sdk/ios/System/Library/Frameworks/WebKit.framework/Headers/WKFindConfiguration.h +52 -0
- package/sdk/ios/System/Library/Frameworks/WebKit.framework/Headers/WKFindResult.h +41 -0
- package/sdk/ios/System/Library/Frameworks/WebKit.framework/Headers/WKFormInfo.h +63 -0
- package/sdk/ios/System/Library/Frameworks/WebKit.framework/Headers/WKFoundation.h +72 -0
- package/sdk/ios/System/Library/Frameworks/WebKit.framework/Headers/WKFrameInfo.h +62 -0
- package/sdk/ios/System/Library/Frameworks/WebKit.framework/Headers/WKHTTPCookieStore.h +108 -0
- package/sdk/ios/System/Library/Frameworks/WebKit.framework/Headers/WKImmersiveEnvironment.h +50 -0
- package/sdk/ios/System/Library/Frameworks/WebKit.framework/Headers/WKImmersiveEnvironmentDelegate.h +69 -0
- package/sdk/ios/System/Library/Frameworks/WebKit.framework/Headers/WKJSHandle.h +80 -0
- package/sdk/ios/System/Library/Frameworks/WebKit.framework/Headers/WKNavigation.h +45 -0
- package/sdk/ios/System/Library/Frameworks/WebKit.framework/Headers/WKNavigationAction.h +118 -0
- package/sdk/ios/System/Library/Frameworks/WebKit.framework/Headers/WKNavigationDelegate.h +219 -0
- package/sdk/ios/System/Library/Frameworks/WebKit.framework/Headers/WKNavigationResponse.h +60 -0
- package/sdk/ios/System/Library/Frameworks/WebKit.framework/Headers/WKOpenPanelParameters.h +47 -0
- package/sdk/ios/System/Library/Frameworks/WebKit.framework/Headers/WKPDFConfiguration.h +49 -0
- package/sdk/ios/System/Library/Frameworks/WebKit.framework/Headers/WKPreferences.h +117 -0
- package/sdk/ios/System/Library/Frameworks/WebKit.framework/Headers/WKPreviewActionItem.h +39 -0
- package/sdk/ios/System/Library/Frameworks/WebKit.framework/Headers/WKPreviewActionItemIdentifiers.h +38 -0
- package/sdk/ios/System/Library/Frameworks/WebKit.framework/Headers/WKPreviewElementInfo.h +43 -0
- package/sdk/ios/System/Library/Frameworks/WebKit.framework/Headers/WKProcessPool.h +39 -0
- package/sdk/ios/System/Library/Frameworks/WebKit.framework/Headers/WKScriptMessage.h +64 -0
- package/sdk/ios/System/Library/Frameworks/WebKit.framework/Headers/WKScriptMessageHandler.h +52 -0
- package/sdk/ios/System/Library/Frameworks/WebKit.framework/Headers/WKScriptMessageHandlerWithReply.h +95 -0
- package/sdk/ios/System/Library/Frameworks/WebKit.framework/Headers/WKSecurityOrigin.h +57 -0
- package/sdk/ios/System/Library/Frameworks/WebKit.framework/Headers/WKSnapshotConfiguration.h +59 -0
- package/sdk/ios/System/Library/Frameworks/WebKit.framework/Headers/WKUIDelegate.h +316 -0
- package/sdk/ios/System/Library/Frameworks/WebKit.framework/Headers/WKURLSchemeHandler.h +61 -0
- package/sdk/ios/System/Library/Frameworks/WebKit.framework/Headers/WKURLSchemeTask.h +75 -0
- package/sdk/ios/System/Library/Frameworks/WebKit.framework/Headers/WKUserContentController.h +162 -0
- package/sdk/ios/System/Library/Frameworks/WebKit.framework/Headers/WKUserScript.h +76 -0
- package/sdk/ios/System/Library/Frameworks/WebKit.framework/Headers/WKWebExtension.h +237 -0
- package/sdk/ios/System/Library/Frameworks/WebKit.framework/Headers/WKWebExtensionAction.h +164 -0
- package/sdk/ios/System/Library/Frameworks/WebKit.framework/Headers/WKWebExtensionCommand.h +106 -0
- package/sdk/ios/System/Library/Frameworks/WebKit.framework/Headers/WKWebExtensionContext.h +790 -0
- package/sdk/ios/System/Library/Frameworks/WebKit.framework/Headers/WKWebExtensionController.h +255 -0
- package/sdk/ios/System/Library/Frameworks/WebKit.framework/Headers/WKWebExtensionControllerConfiguration.h +89 -0
- package/sdk/ios/System/Library/Frameworks/WebKit.framework/Headers/WKWebExtensionControllerDelegate.h +207 -0
- package/sdk/ios/System/Library/Frameworks/WebKit.framework/Headers/WKWebExtensionDataRecord.h +90 -0
- package/sdk/ios/System/Library/Frameworks/WebKit.framework/Headers/WKWebExtensionDataType.h +43 -0
- package/sdk/ios/System/Library/Frameworks/WebKit.framework/Headers/WKWebExtensionMatchPattern.h +175 -0
- package/sdk/ios/System/Library/Frameworks/WebKit.framework/Headers/WKWebExtensionMessagePort.h +99 -0
- package/sdk/ios/System/Library/Frameworks/WebKit.framework/Headers/WKWebExtensionPermission.h +95 -0
- package/sdk/ios/System/Library/Frameworks/WebKit.framework/Headers/WKWebExtensionTab.h +396 -0
- package/sdk/ios/System/Library/Frameworks/WebKit.framework/Headers/WKWebExtensionTabConfiguration.h +94 -0
- package/sdk/ios/System/Library/Frameworks/WebKit.framework/Headers/WKWebExtensionWindow.h +170 -0
- package/sdk/ios/System/Library/Frameworks/WebKit.framework/Headers/WKWebExtensionWindowConfiguration.h +87 -0
- package/sdk/ios/System/Library/Frameworks/WebKit.framework/Headers/WKWebView.h +800 -0
- package/sdk/ios/System/Library/Frameworks/WebKit.framework/Headers/WKWebViewConfiguration.h +275 -0
- package/sdk/ios/System/Library/Frameworks/WebKit.framework/Headers/WKWebpagePreferences.h +150 -0
- package/sdk/ios/System/Library/Frameworks/WebKit.framework/Headers/WKWebsiteDataRecord.h +90 -0
- package/sdk/ios/System/Library/Frameworks/WebKit.framework/Headers/WKWebsiteDataStore.h +137 -0
- package/sdk/ios/System/Library/Frameworks/WebKit.framework/Headers/WKWindowFeatures.h +72 -0
- package/sdk/ios/System/Library/Frameworks/WebKit.framework/Headers/WebKit.apinotes +204 -0
- package/sdk/ios/System/Library/Frameworks/WebKit.framework/Headers/WebKit.h +93 -0
- package/sdk/ios/System/Library/Frameworks/WebKit.framework/Headers/WebKitLegacy.h +3 -0
- package/sdk/ios/System/Library/Frameworks/WebKit.framework/Modules/module.modulemap +5 -0
- package/sdk/ios/System/Library/Frameworks/WiFiAware.framework/Modules/WiFiAware.swiftmodule/arm64-apple-ios-simulator.swiftinterface +605 -0
- package/sdk/ios/System/Library/Frameworks/_DeviceDiscoveryUI_SwiftUI.framework/Modules/_DeviceDiscoveryUI_SwiftUI.swiftmodule/arm64-apple-ios-simulator.swiftinterface +79 -0
- package/sdk/ios/usr/include/MacTypes.h +8 -0
- package/sdk/ios/usr/include/objc/NSObjCRuntime.h +5 -0
- package/sdk/ios/wasm/include/fcntl.h +1 -0
- package/sdk/ios/wasm/include/pthread.h +2 -0
- package/sdk/ios/wasm/include/stdlib.h +1 -0
- package/sdk/native-hashes.json +11 -1
- package/skills/contrast/SKILL.md +4 -9
- package/skills/peach-perf/SKILL.md +3 -1
- package/skills/peach-perf/references/profiling.md +1 -1
- package/skills/peach-test/SKILL.md +20 -17
- package/skills/peach-test/references/detox.md +7 -7
- package/skills/peach-test/references/maestro.md +20 -18
- package/src/admitted-mac-build.ts +7 -0
- package/src/android-autolinking.ts +2 -2
- package/src/android-drawables.ts +5 -5
- package/src/android-string-value.ts +1 -1
- package/src/android-strings.ts +1 -1
- package/src/android-theme.ts +2 -2
- package/src/appPackageContract.ts +1 -1
- package/src/bridge-contract.ts +12 -16
- package/src/build-cache.ts +65 -0
- package/src/bundle-channel.mjs +69 -9
- package/src/capture-contract.ts +55 -17
- package/src/chromium-admission.ts +24 -21
- package/src/conformance-comparison-contract.ts +105 -40
- package/src/dev-bundle-resolution.ts +23 -10
- package/src/device-catalog.ts +35 -2
- package/src/disk-cleanup.ts +18 -8
- package/src/expo-autolinking.ts +24 -0
- package/src/expo-discovery-cache.ts +168 -23
- package/src/expo-native-workspace.ts +551 -191
- package/src/expo-swift-host.ts +711 -314
- package/src/expo-swift-ready.ts +39 -5
- package/src/expo-widget-assets.ts +2 -2
- package/src/expo-widgets-bundle.ts +56 -0
- package/src/expo-workspace-exclusion.ts +62 -0
- package/src/expoSwiftContract.ts +27 -4
- package/src/forked-script-contract.ts +3 -0
- package/src/home-paths.ts +10 -6
- package/src/host/bridge-host.ts +27 -0
- package/src/host/network-policy.ts +1 -1
- package/src/kotlin-app.ts +9 -11
- package/src/kotlin-host.ts +2 -2
- package/src/launchMetadataContract.ts +5 -0
- package/src/menu.ts +19 -5
- package/src/native-app-identity-project.ts +35 -49
- package/src/native-app-identity.ts +5 -6
- package/src/native-firebase-config.ts +10 -48
- package/src/native-prebuilt.ts +3 -2
- package/src/native-slices.ts +39 -0
- package/src/native-static-libraries.ts +73 -0
- package/src/nitro-adapter.lock.json +249 -249
- package/src/nitro-adapter.ts +16 -5
- package/src/nitro-bundle.ts +35 -16
- package/src/nitro-compile.ts +254 -16
- package/src/nitro-compiler-digest.ts +39 -0
- package/src/nitro-dependencies.ts +368 -28
- package/src/nitro-source.ts +432 -77
- package/src/nitro-superset.lock.json +27 -36
- package/src/nitro-superset.ts +6 -0
- package/src/nitroAdapterContract.ts +52 -0
- package/src/nitroContract.ts +40 -4
- package/src/numbered-lock.ts +2 -2
- package/src/one-native-app-accent.ts +32 -0
- package/src/one-widget-discovery.ts +6 -1
- package/src/one-widget-metadata.ts +2 -2
- package/src/portable-expo-contract.ts +103 -0
- package/src/portable-expo-workspace.ts +94 -0
- package/src/prepared-native-inventory.ts +93 -0
- package/src/prepared-xcode-phases.ts +194 -0
- package/src/process-group.ts +8 -15
- package/src/process-table.ts +117 -0
- package/src/react-native-bridge-modules.ts +240 -14
- package/src/react-native-coverage/native-typescript-parser.ts +11 -2
- package/src/react-native-coverage/verified-reach.ts +12 -6
- package/src/react-native-host-modules.ts +2 -0
- package/src/reap-browser.ts +13 -9
- package/src/retired-cache-directory.ts +34 -0
- package/src/runtime-assets.ts +1 -0
- package/src/screenshots/orchestrate.ts +4 -0
- package/src/screenshots/schema.ts +2 -2
- package/src/storageSnapshotContract.ts +9 -2
- package/src/stub-pattern-matcher.ts +53 -19
- package/src/swift-compile.ts +1011 -327
- package/src/swift-compiler-digest.ts +3 -0
- package/src/swift-coverage/indexing.ts +1 -1
- package/src/swift-coverage/xcode-asset-symbols.ts +72 -39
- package/src/swift-coverage/xcode-assets.ts +2 -1
- package/src/swift-cxx-declarations.ts +114 -130
- package/src/swift-cxx-standin.ts +3 -3
- package/src/swift-darwin-records.ts +88 -0
- package/src/swift-distribution.lock.json +15 -12
- package/src/swift-distribution.ts +25 -9
- package/src/swift-host.ts +443 -142
- package/src/swift-icu.ts +72 -4
- package/src/swift-link-roots.ts +2 -0
- package/src/swift-objc-compile.ts +312 -65
- package/src/swift-objc-import.ts +8 -1
- package/src/swift-objc-standin.ts +20 -2
- package/src/swift-package-manifest.ts +189 -57
- package/src/swift-package.ts +51 -0
- package/src/swift-packages.ts +117 -45
- package/src/swift-pdf-raster.ts +7 -4
- package/src/swift-project-user.ts +183 -0
- package/src/swift-reproducible.ts +26 -0
- package/src/swift-root-lock.ts +34 -62
- package/src/swift-shared-sdk.ts +232 -21
- package/src/swift-source-pods.ts +9 -2
- package/src/swift-standin-emit.ts +248 -7
- package/src/swift-standins.ts +130 -108
- package/src/swift-submit.ts +3 -0
- package/src/swift-toolchain.ts +109 -8
- package/src/swift-wasm-prune.ts +210 -55
- package/src/swiftContract.ts +14 -0
- package/src/swiftGuestImageContract.ts +113 -0
- package/src/turbo-bundle.ts +5 -8
- package/src/turbo-codegen-intake.ts +134 -0
- package/src/turbo-compile.ts +198 -21
- package/src/turbo-native-libraries.ts +98 -0
- package/src/turbo-runtime.lock.json +25 -18
- package/src/turbo-source.ts +1519 -147
- package/src/vite-plugin-one.ts +25 -3
- package/src/vite-plugin-swift.ts +5 -1
- package/src/vite-plugin.ts +40 -18
- package/src/worker-system-chunks.ts +103 -15
- package/src/worklets-babel.ts +50 -29
- package/src/xcode-header-search.ts +15 -5
- package/src/xcode-project.ts +444 -88
- package/src/xcode-target-members.ts +72 -63
- package/dist-types/packages/peach-engine/src/render-worker/compositor-runtime/scroll-drag-resample.d.ts +0 -44
package/src/swift-compile.ts
CHANGED
|
@@ -22,18 +22,34 @@ import {
|
|
|
22
22
|
} from 'node:fs'
|
|
23
23
|
import os from 'node:os'
|
|
24
24
|
import path from 'node:path'
|
|
25
|
-
import {
|
|
25
|
+
import { windowAdmission } from './admitted-mac-build'
|
|
26
26
|
import cPredefinesJson from './generated/swift-c-predefines.json' with { type: 'json' }
|
|
27
27
|
import { swiftCacheDir, swiftPackageCacheOptions } from './home-paths'
|
|
28
28
|
import { terminateProcessGroup } from './process-group'
|
|
29
|
+
import {
|
|
30
|
+
reapRetiredCacheDirectory,
|
|
31
|
+
removeRetiredDirectory,
|
|
32
|
+
} from './retired-cache-directory'
|
|
29
33
|
import { swiftCompilerSourceDigest } from './swift-compiler-digest'
|
|
34
|
+
import {
|
|
35
|
+
compileDarwinRecords,
|
|
36
|
+
DARWIN_RECORDS_PREFIX,
|
|
37
|
+
darwinRecordsMinimum,
|
|
38
|
+
} from './swift-darwin-records'
|
|
30
39
|
import { designTimeDiagnostic, designTimeSource } from './swift-design-time'
|
|
31
40
|
import {
|
|
32
41
|
parseSwiftDistributionManifest,
|
|
33
42
|
SWIFT_DISTRIBUTION_MANIFEST,
|
|
34
43
|
type SwiftDistributionManifest,
|
|
35
44
|
} from './swift-distribution-contract'
|
|
36
|
-
import {
|
|
45
|
+
import {
|
|
46
|
+
brotliCompressQ11,
|
|
47
|
+
brotliCompressQ4,
|
|
48
|
+
swiftIcuAsset,
|
|
49
|
+
swiftIcuBrotli,
|
|
50
|
+
swiftIcuBrotliQ4,
|
|
51
|
+
type SwiftIcuAsset,
|
|
52
|
+
} from './swift-icu'
|
|
37
53
|
import { swiftObjcRootObjects } from './swift-link-roots'
|
|
38
54
|
import {
|
|
39
55
|
SWIFT_OBJC_INTEROP_FLAGS,
|
|
@@ -44,9 +60,11 @@ import { swiftObjCRuntimeFlags } from './swift-objc-runtime'
|
|
|
44
60
|
import { iosDeploymentMinimum, objcSdkIntakeFlags } from './swift-objc-standin'
|
|
45
61
|
import {
|
|
46
62
|
isSwiftNativeTranslationUnit,
|
|
63
|
+
moduleMapName,
|
|
47
64
|
OBJC_RESOURCE_ACCESSOR_BODY,
|
|
48
65
|
OBJC_RESOURCE_ACCESSOR_HEADER,
|
|
49
66
|
swiftManifestCxxLanguageStandard,
|
|
67
|
+
swiftImplicitResourcePaths,
|
|
50
68
|
swiftManifestDeclarations,
|
|
51
69
|
swiftManifestTargets,
|
|
52
70
|
swiftManifestPackages,
|
|
@@ -61,6 +79,14 @@ import {
|
|
|
61
79
|
SWIFT_NATIVE_SOURCE_EXTENSIONS,
|
|
62
80
|
type SwiftPackageTarget,
|
|
63
81
|
} from './swift-package'
|
|
82
|
+
import {
|
|
83
|
+
endSwiftProjectProcesses,
|
|
84
|
+
prepareSwiftProjectProcess,
|
|
85
|
+
projectOutputFile,
|
|
86
|
+
removeProjectLinks,
|
|
87
|
+
type SwiftProjectUser,
|
|
88
|
+
} from './swift-project-user'
|
|
89
|
+
import { swiftReproducibleBuildFlags } from './swift-reproducible'
|
|
64
90
|
import { withSwiftRootLock, type SwiftRootLease } from './swift-root-lock'
|
|
65
91
|
import {
|
|
66
92
|
swiftSharedSdkInputFiles,
|
|
@@ -80,6 +106,7 @@ import {
|
|
|
80
106
|
import { pruneSwiftWasmLink } from './swift-wasm-prune'
|
|
81
107
|
import {
|
|
82
108
|
isSwiftNativeTargets,
|
|
109
|
+
isSwiftHeaderAliases,
|
|
83
110
|
isSwiftPackageFiles,
|
|
84
111
|
isSwiftProjectFiles,
|
|
85
112
|
isSwiftResourceBundles,
|
|
@@ -88,6 +115,7 @@ import {
|
|
|
88
115
|
SWIFT_NATIVE_SDK_INCLUDE,
|
|
89
116
|
type SwiftPackageFiles,
|
|
90
117
|
type SwiftNativeTarget,
|
|
118
|
+
type SwiftHeaderAliases,
|
|
91
119
|
type SwiftProjectPreparation,
|
|
92
120
|
} from './swiftContract'
|
|
93
121
|
import { optimizeWasm, WASM_OPTIMIZE_IDENTITY } from './wasm-optimize'
|
|
@@ -95,7 +123,14 @@ import { writeXcodeHeaderSearch } from './xcode-header-search'
|
|
|
95
123
|
import type { SwiftImageUpload } from './swift-submit'
|
|
96
124
|
import type { SwiftResourceBundle } from './swiftContract'
|
|
97
125
|
|
|
98
|
-
export {
|
|
126
|
+
export {
|
|
127
|
+
brotliCompressQ11,
|
|
128
|
+
brotliCompressQ4,
|
|
129
|
+
swiftIcuAsset,
|
|
130
|
+
swiftIcuBrotli,
|
|
131
|
+
swiftIcuBrotliQ4,
|
|
132
|
+
type SwiftIcuAsset,
|
|
133
|
+
}
|
|
99
134
|
|
|
100
135
|
// compiler drivers own descendants such as admission and swiftpm workers.
|
|
101
136
|
// cancellation waits for their pipes to close before releasing the build root.
|
|
@@ -107,7 +142,13 @@ export { swiftIcuAsset, type SwiftIcuAsset }
|
|
|
107
142
|
async function runCompiler(
|
|
108
143
|
command: string,
|
|
109
144
|
args: string[],
|
|
110
|
-
options: ExecFileOptions & {
|
|
145
|
+
options: ExecFileOptions & {
|
|
146
|
+
signal?: AbortSignal
|
|
147
|
+
lease?: SwiftRootLease
|
|
148
|
+
frameworkLease?: SwiftRootLease
|
|
149
|
+
/** applied over the confined scratch environment, for a child that cannot use the host's. */
|
|
150
|
+
confined?: Record<string, string>
|
|
151
|
+
},
|
|
111
152
|
stream: boolean | RegExp = false,
|
|
112
153
|
quiet?: RegExp,
|
|
113
154
|
): Promise<string> {
|
|
@@ -115,12 +156,14 @@ async function runCompiler(
|
|
|
115
156
|
signal?.throwIfAborted()
|
|
116
157
|
const launch = {
|
|
117
158
|
cwd: options.cwd,
|
|
118
|
-
env: swiftEnvironment(options.env),
|
|
159
|
+
env: { ...swiftEnvironment(options.env), ...options.confined },
|
|
160
|
+
uid: options.uid,
|
|
161
|
+
gid: options.gid,
|
|
119
162
|
detached: true,
|
|
120
163
|
stdio: ['ignore', 'pipe', 'pipe'] as ['ignore', 'pipe', 'pipe'],
|
|
121
164
|
} satisfies SpawnOptions
|
|
122
165
|
const child = options.lease
|
|
123
|
-
? options.lease.spawn(command, args, launch)
|
|
166
|
+
? options.lease.spawn(command, args, launch, options.frameworkLease)
|
|
124
167
|
: spawn(command, args, launch)
|
|
125
168
|
let stopping: Promise<void> | undefined
|
|
126
169
|
try {
|
|
@@ -227,6 +270,7 @@ export interface SwiftCompileInput {
|
|
|
227
270
|
projectFiles?: Record<string, string>
|
|
228
271
|
packageGuestImports?: string[]
|
|
229
272
|
nativeTargets?: SwiftNativeTarget[]
|
|
273
|
+
headerAliases?: SwiftHeaderAliases
|
|
230
274
|
/** the Xcode app project's development region, for the emitted manifest's default localization. */
|
|
231
275
|
defaultLocalization?: string
|
|
232
276
|
metalSources?: Record<string, string>
|
|
@@ -253,6 +297,8 @@ export interface SwiftCompileInput {
|
|
|
253
297
|
* references by symbol, plus those that register ObjC classes at load.
|
|
254
298
|
*/
|
|
255
299
|
lazyDistribution?: boolean
|
|
300
|
+
/** CocoaPods static targets whose C/C++ objects load only to resolve references. */
|
|
301
|
+
staticClangTargets?: string[]
|
|
256
302
|
}
|
|
257
303
|
|
|
258
304
|
// the builder hop wraps the compiler's own timeout with admission, transfer and
|
|
@@ -272,6 +318,12 @@ export interface SwiftCompileOptions {
|
|
|
272
318
|
moduleRoot: string
|
|
273
319
|
release: string
|
|
274
320
|
toolchainBin: string
|
|
321
|
+
/**
|
|
322
|
+
* run the compilers that read project sources (the app's swift build, which
|
|
323
|
+
* evaluates its manifests and macros) as this user, from this base
|
|
324
|
+
* environment. the host's own steps never see project files as that user.
|
|
325
|
+
*/
|
|
326
|
+
project?: SwiftProjectUser
|
|
275
327
|
timeoutMs?: number
|
|
276
328
|
signal?: AbortSignal
|
|
277
329
|
/** called as the compile reaches each stage, in addition to the stderr line. */
|
|
@@ -312,9 +364,13 @@ export function swiftDistributionAt(root: string): SwiftDistributionManifest | n
|
|
|
312
364
|
export function swiftModuleInterface(
|
|
313
365
|
moduleRoot: string,
|
|
314
366
|
name: string,
|
|
367
|
+
interfaceRoot?: string,
|
|
315
368
|
): { declared: ReadonlySet<string>; header: string } | null {
|
|
316
369
|
if (swiftDistributionAt(moduleRoot)) {
|
|
317
|
-
const file = path.join(
|
|
370
|
+
const file = path.join(
|
|
371
|
+
interfaceRoot ?? path.join(moduleRoot, 'modules'),
|
|
372
|
+
`${name}-Swift.h`,
|
|
373
|
+
)
|
|
318
374
|
if (!existsSync(file)) return null
|
|
319
375
|
const header = clangInterfaceHeader(readFileSync(file, 'utf8'))
|
|
320
376
|
return { declared: swiftInterfaceDeclarations(header), header }
|
|
@@ -339,9 +395,14 @@ export function swiftModuleInterface(
|
|
|
339
395
|
}
|
|
340
396
|
|
|
341
397
|
// the compiler imports the module that defines a type, and UIKit's declarations
|
|
342
|
-
// live in UIKitCore, which only the umbrella UIKit module represents
|
|
398
|
+
// live in UIKitCore/UIKitText, which only the umbrella UIKit module represents
|
|
399
|
+
// to clang. CoreFoundation's CGFloat lives in the Swift CoreFoundation overlay,
|
|
400
|
+
// while clang's Foundation umbrella provides CoreFoundation/CoreFoundation.h.
|
|
343
401
|
const clangInterfaceHeader = (header: string): string =>
|
|
344
|
-
header
|
|
402
|
+
header
|
|
403
|
+
.replace(/^@import (?:UIKitCore|UIKitText);$/gm, '@import UIKit;')
|
|
404
|
+
.replace(/^@import CoreFoundation;$/gm, '@import Foundation;')
|
|
405
|
+
.replace(/\b_TtC10Foundation\d+(NS\w+)\b/g, '$1')
|
|
345
406
|
|
|
346
407
|
/** the Objective-C protocols and classes a generated interface header defines. */
|
|
347
408
|
const swiftInterfaceDeclarations = (header: string): Set<string> =>
|
|
@@ -350,6 +411,38 @@ const swiftInterfaceDeclarations = (header: string): Set<string> =>
|
|
|
350
411
|
...[...header.matchAll(/^@interface\s+(\w+)\s*(?=[:<{]|$)/gm)].map((m) => m[1]!),
|
|
351
412
|
])
|
|
352
413
|
|
|
414
|
+
/** a header with the definitions Swift owns replaced by an import of its interface header. */
|
|
415
|
+
export function withoutSwiftDeclarations(
|
|
416
|
+
text: string,
|
|
417
|
+
declared: ReadonlySet<string>,
|
|
418
|
+
interfaceImport: string,
|
|
419
|
+
): string {
|
|
420
|
+
const out: string[] = []
|
|
421
|
+
let skipping = false
|
|
422
|
+
let imported = false
|
|
423
|
+
// clang refuses to enter a header inside an assume_nonnull region, so the
|
|
424
|
+
// import goes above the region's start when the declaration sits inside it.
|
|
425
|
+
let regionStart = -1
|
|
426
|
+
for (const line of text.split('\n')) {
|
|
427
|
+
if (skipping) {
|
|
428
|
+
if (/^@end\b/.test(line)) skipping = false
|
|
429
|
+
continue
|
|
430
|
+
}
|
|
431
|
+
if (regionStart < 0 && /^NS_ASSUME_NONNULL_BEGIN\b/.test(line))
|
|
432
|
+
regionStart = out.length
|
|
433
|
+
const name = /^@(?:protocol|interface)\s+(\w+)\s*(?=[:<{]|$)/.exec(line)?.[1]
|
|
434
|
+
if (name && declared.has(name)) {
|
|
435
|
+
skipping = true
|
|
436
|
+
if (!imported)
|
|
437
|
+
out.splice(regionStart < 0 ? out.length : regionStart, 0, interfaceImport)
|
|
438
|
+
imported = true
|
|
439
|
+
continue
|
|
440
|
+
}
|
|
441
|
+
out.push(line)
|
|
442
|
+
}
|
|
443
|
+
return out.join('\n')
|
|
444
|
+
}
|
|
445
|
+
|
|
353
446
|
/** the wasm SDK a module root compiles with: a distribution's manifest names
|
|
354
447
|
* it, a source checkout's toolchain.json pins it. */
|
|
355
448
|
export function swiftModuleSdk(root: string): SwiftWasmSdk {
|
|
@@ -384,6 +477,7 @@ export function swiftModuleInputFiles(root: string): string[] {
|
|
|
384
477
|
const files: string[] = [
|
|
385
478
|
...swiftSharedSdkInputFiles(root),
|
|
386
479
|
'../peachsim/src/swift-shared-sdk.ts',
|
|
480
|
+
'../peachsim/src/swift-darwin-records.ts',
|
|
387
481
|
'../../scripts/generate/swift-sdk-module/darwin-mach.json',
|
|
388
482
|
'../../scripts/generate/swift-sdk-module/darwin-socketvar.json',
|
|
389
483
|
'../../scripts/ops/swift-distribution-publish.ts',
|
|
@@ -406,7 +500,7 @@ export function swiftModuleInputFiles(root: string): string[] {
|
|
|
406
500
|
})) {
|
|
407
501
|
const relative = `${dir}/${entry.name}`
|
|
408
502
|
if (entry.isDirectory()) walk(relative)
|
|
409
|
-
else if (/\.(swift|swiftinterface|swiftoverlay|c|cpp|h)$/.test(entry.name))
|
|
503
|
+
else if (/\.(swift|swiftinterface|swiftoverlay|c|cpp|h|m)$/.test(entry.name))
|
|
410
504
|
files.push(relative)
|
|
411
505
|
}
|
|
412
506
|
}
|
|
@@ -487,6 +581,7 @@ export async function ensureMacroPlugins(
|
|
|
487
581
|
toolchainBin: string,
|
|
488
582
|
release: string,
|
|
489
583
|
signal?: AbortSignal,
|
|
584
|
+
lease?: SwiftRootLease,
|
|
490
585
|
): Promise<{ libraries: string[]; executables: string[] }> {
|
|
491
586
|
const { libraries, executables, stale } = swiftMacroPlugins(moduleRoot)
|
|
492
587
|
if (stale) {
|
|
@@ -497,7 +592,7 @@ export async function ensureMacroPlugins(
|
|
|
497
592
|
toolchainBin,
|
|
498
593
|
libraries[0],
|
|
499
594
|
],
|
|
500
|
-
{ signal },
|
|
595
|
+
{ signal, lease },
|
|
501
596
|
)
|
|
502
597
|
writeFileSync(
|
|
503
598
|
path.join(path.dirname(libraries[0]!), 'compiler-release'),
|
|
@@ -529,6 +624,26 @@ export function swiftModuleDigest(root: string): Buffer {
|
|
|
529
624
|
const stamp = stampHash.digest('hex')
|
|
530
625
|
const cached = linkedModuleDigests.get(root)
|
|
531
626
|
if (cached?.stamp === stamp) return cached.digest
|
|
627
|
+
// a source checkout holds thousands of inputs, so a fresh bridge reuses the
|
|
628
|
+
// digest an earlier process recorded under the same stamp.
|
|
629
|
+
const record = path.join(
|
|
630
|
+
swiftCacheDir(),
|
|
631
|
+
'swift-module-digests',
|
|
632
|
+
`${createHash('sha256').update(root).digest('hex')}.json`,
|
|
633
|
+
)
|
|
634
|
+
if (existsSync(record)) {
|
|
635
|
+
const saved: unknown = JSON.parse(readFileSync(record, 'utf8'))
|
|
636
|
+
if (
|
|
637
|
+
saved &&
|
|
638
|
+
typeof saved === 'object' &&
|
|
639
|
+
Reflect.get(saved, 'stamp') === stamp &&
|
|
640
|
+
typeof Reflect.get(saved, 'digest') === 'string'
|
|
641
|
+
) {
|
|
642
|
+
const digest = Buffer.from(String(Reflect.get(saved, 'digest')), 'hex')
|
|
643
|
+
linkedModuleDigests.set(root, { stamp, digest })
|
|
644
|
+
return digest
|
|
645
|
+
}
|
|
646
|
+
}
|
|
532
647
|
const hash = createHash('sha256')
|
|
533
648
|
for (const file of files) {
|
|
534
649
|
hash.update(createHash('sha256').update(file).digest())
|
|
@@ -540,6 +655,10 @@ export function swiftModuleDigest(root: string): Buffer {
|
|
|
540
655
|
}
|
|
541
656
|
const digest = hash.digest()
|
|
542
657
|
linkedModuleDigests.set(root, { stamp, digest })
|
|
658
|
+
mkdirSync(path.dirname(record), { recursive: true })
|
|
659
|
+
const partial = `${record}.${process.pid}.${randomUUID()}`
|
|
660
|
+
writeFileSync(partial, JSON.stringify({ stamp, digest: digest.toString('hex') }))
|
|
661
|
+
renameSync(partial, record)
|
|
543
662
|
return digest
|
|
544
663
|
}
|
|
545
664
|
|
|
@@ -553,11 +672,46 @@ export function swiftProjectBuildKey(moduleRoot: string, release: string): strin
|
|
|
553
672
|
.slice(0, 32)
|
|
554
673
|
}
|
|
555
674
|
|
|
675
|
+
// clang autolinks the library a system module map names when a unit imports
|
|
676
|
+
// one of its headers, so an ios target links it without declaring it. swiftpm
|
|
677
|
+
// on wasm reads no clang autolinks, so the target declares the library the ios
|
|
678
|
+
// module map names: SQLite3 links sqlite3, which the wasm sdk ships.
|
|
679
|
+
const SYSTEM_MODULE_LIBRARIES: Record<string, string> = {
|
|
680
|
+
'sqlite3.h': 'sqlite3',
|
|
681
|
+
'sqlite3ext.h': 'sqlite3',
|
|
682
|
+
SQLite3: 'sqlite3',
|
|
683
|
+
}
|
|
684
|
+
const SYSTEM_MODULE_IMPORT =
|
|
685
|
+
/^\s*(?:#\s*(?:import|include)\s*<(sqlite3(?:ext)?\.h)>|@import\s+(SQLite3)\b)/gm
|
|
686
|
+
|
|
556
687
|
export function compileTargets(input: SwiftCompileInput): SwiftPackageTarget[] {
|
|
557
688
|
const manifest = input.files['Package.swift']
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
689
|
+
if (manifest === undefined) return []
|
|
690
|
+
const targets = swiftPackagePartition(manifest, input.resourcePaths)
|
|
691
|
+
const owners = [...targets].sort((left, right) => right.path.length - left.path.length)
|
|
692
|
+
const autolinks = new Map<string, Set<string>>()
|
|
693
|
+
for (const [file, contents] of Object.entries(input.files)) {
|
|
694
|
+
if (!/\.(c|cc|cpp|cxx|h|hh|hpp|m|mm)$/.test(file)) continue
|
|
695
|
+
for (const match of contents.matchAll(SYSTEM_MODULE_IMPORT)) {
|
|
696
|
+
const owner = owners.find(
|
|
697
|
+
(target) => target.path === '.' || file.startsWith(`${target.path}/`),
|
|
698
|
+
)
|
|
699
|
+
const library = SYSTEM_MODULE_LIBRARIES[match[1] ?? match[2] ?? '']
|
|
700
|
+
if (!owner || !library) break
|
|
701
|
+
autolinks.set(owner.name, new Set([...(autolinks.get(owner.name) ?? []), library]))
|
|
702
|
+
}
|
|
703
|
+
}
|
|
704
|
+
return targets.map((target) => {
|
|
705
|
+
const libraries = autolinks.get(target.name)
|
|
706
|
+
return libraries
|
|
707
|
+
? {
|
|
708
|
+
...target,
|
|
709
|
+
linkedLibraries: [
|
|
710
|
+
...new Set([...(target.linkedLibraries ?? []), ...libraries]),
|
|
711
|
+
],
|
|
712
|
+
}
|
|
713
|
+
: target
|
|
714
|
+
})
|
|
561
715
|
}
|
|
562
716
|
|
|
563
717
|
/**
|
|
@@ -612,6 +766,8 @@ const OPTIONAL_FRAMEWORK_DEPENDENCIES: Record<string, string[]> = {
|
|
|
612
766
|
DatadogLogs: ['DatadogCore'],
|
|
613
767
|
DatadogRUM: ['DatadogCore'],
|
|
614
768
|
DatadogTrace: ['DatadogCore'],
|
|
769
|
+
DatadogCrashReporting: ['DatadogCore'],
|
|
770
|
+
Amplitude: [],
|
|
615
771
|
AppLovinSDK: [],
|
|
616
772
|
AppsFlyerLib: [],
|
|
617
773
|
FBSDKCoreKit: ['FBAEMKit', 'FBSDKCoreKit_Basics'],
|
|
@@ -925,7 +1081,7 @@ export function swiftAvailableModules(
|
|
|
925
1081
|
const cached = availableModules.get(key)
|
|
926
1082
|
if (cached) return cached
|
|
927
1083
|
const modules = new Set(swiftPeachModules(moduleRoot))
|
|
928
|
-
const { resources, frameworks } = swiftSdkPaths(moduleRoot, toolchainBin)
|
|
1084
|
+
const { darwin, resources, frameworks } = swiftSdkPaths(moduleRoot, toolchainBin)
|
|
929
1085
|
for (const entry of readdirSync(path.join(resources, 'wasi'))) {
|
|
930
1086
|
if (entry.endsWith('.swiftmodule'))
|
|
931
1087
|
modules.add(entry.slice(0, -'.swiftmodule'.length))
|
|
@@ -936,6 +1092,14 @@ export function swiftAvailableModules(
|
|
|
936
1092
|
for (const match of readFileSync(map, 'utf8').matchAll(/^module\s+([A-Za-z_]\w*)/gm))
|
|
937
1093
|
modules.add(match[1]!)
|
|
938
1094
|
}
|
|
1095
|
+
const libc = path.join(darwin, 'usr/include')
|
|
1096
|
+
for (const entry of readdirSync(libc)) {
|
|
1097
|
+
if (!entry.endsWith('.modulemap')) continue
|
|
1098
|
+
for (const match of readFileSync(path.join(libc, entry), 'utf8').matchAll(
|
|
1099
|
+
/^module\s+([A-Za-z_]\w*)/gm,
|
|
1100
|
+
))
|
|
1101
|
+
modules.add(match[1]!)
|
|
1102
|
+
}
|
|
939
1103
|
for (const directory of frameworks) {
|
|
940
1104
|
for (const entry of readdirSync(directory)) {
|
|
941
1105
|
const map = path.join(directory, entry, 'Modules/module.modulemap')
|
|
@@ -1139,10 +1303,15 @@ const executableLinkFlags = (root: string) => ` "-Xclang-linker", "-O0"
|
|
|
1139
1303
|
"-Xlinker", "--export-table",
|
|
1140
1304
|
"-Xlinker", "--growable-table",
|
|
1141
1305
|
`
|
|
1306
|
+
// the Darwin module's providers link as an archive does, ahead of the sdk's
|
|
1307
|
+
// libDarwinRecords.a, which supplies only what remains undefined
|
|
1308
|
+
// (specs/peach-swift/darwin-libc-providers.md).
|
|
1309
|
+
const darwinRecordsRegion = (quoted: readonly string[]): string[] =>
|
|
1310
|
+
quoted.length ? ['-Wl,--start-lib', ...quoted, '-Wl,--end-lib'] : []
|
|
1142
1311
|
const REACTOR_FLAG = '"-Xclang-linker", "-mexec-model=reactor",\n'
|
|
1143
1312
|
|
|
1144
1313
|
/** bump with any change to the emitted multi-target manifest text. */
|
|
1145
|
-
export const MULTI_MANIFEST_VERSION =
|
|
1314
|
+
export const MULTI_MANIFEST_VERSION = 55
|
|
1146
1315
|
|
|
1147
1316
|
// build-cli replaces this in every bundle; source runs read the files directly.
|
|
1148
1317
|
declare const __SWIFT_COMPILER_DIGEST__: string | undefined
|
|
@@ -1201,6 +1370,8 @@ export function swiftArtifactHash(
|
|
|
1201
1370
|
),
|
|
1202
1371
|
)
|
|
1203
1372
|
hash.update(JSON.stringify(input.nativeTargets ?? []))
|
|
1373
|
+
hash.update(JSON.stringify(input.staticClangTargets ?? []))
|
|
1374
|
+
hash.update(JSON.stringify(input.headerAliases ?? {}))
|
|
1204
1375
|
hash.update(JSON.stringify(input.packageGuestImports ?? []))
|
|
1205
1376
|
if (input.defaultLocalization)
|
|
1206
1377
|
hash.update(`default-localization\n${input.defaultLocalization}\n`)
|
|
@@ -1259,7 +1430,10 @@ interface SwiftNativeTargetPlan {
|
|
|
1259
1430
|
late?: { name: string; producers: string[] }
|
|
1260
1431
|
}
|
|
1261
1432
|
|
|
1262
|
-
function swiftCrossImportFlags(
|
|
1433
|
+
export function swiftCrossImportFlags(
|
|
1434
|
+
moduleRoot: string,
|
|
1435
|
+
distribution: boolean,
|
|
1436
|
+
): string[] {
|
|
1263
1437
|
const overlayRoot = path.join(
|
|
1264
1438
|
moduleRoot,
|
|
1265
1439
|
distribution ? 'modules' : 'cross-import-overlays',
|
|
@@ -1313,6 +1487,8 @@ export function emitSwiftPackageManifest(args: {
|
|
|
1313
1487
|
packages?: ReadonlyMap<string, string>
|
|
1314
1488
|
cxxLanguageStandard?: string
|
|
1315
1489
|
native?: Map<string, SwiftNativeTargetPlan>
|
|
1490
|
+
/** resource inputs must not be rediscovered by targets rooted at the build root. */
|
|
1491
|
+
nativeResourceExclusions?: string[]
|
|
1316
1492
|
headerDirectory?: string
|
|
1317
1493
|
/** the objective-c runtime and sdk flags every original native unit compiles with. */
|
|
1318
1494
|
nativeFlags?: Map<string, string[]>
|
|
@@ -1355,7 +1531,9 @@ export function emitSwiftPackageManifest(args: {
|
|
|
1355
1531
|
const linkedObjects = Boolean(distribution || prebuilt)
|
|
1356
1532
|
const cxxFlagsFor = (flags: readonly string[]): readonly string[] =>
|
|
1357
1533
|
args.deferDarwinOverlay ? withoutWasmOverlayIsystem(flags) : flags
|
|
1358
|
-
|
|
1534
|
+
// the base distribution links authenticationservices' prf key storage,
|
|
1535
|
+
// which requires cryptokit even when an app does not import it directly.
|
|
1536
|
+
const reachedFrameworks = new Set<string>(['CryptoKit'])
|
|
1359
1537
|
const reach = (name: string) => {
|
|
1360
1538
|
if (reachedFrameworks.has(name)) return
|
|
1361
1539
|
reachedFrameworks.add(name)
|
|
@@ -1375,32 +1553,40 @@ export function emitSwiftPackageManifest(args: {
|
|
|
1375
1553
|
let distributionLinkPath: string | undefined
|
|
1376
1554
|
const distributionLink = args.distributionLink
|
|
1377
1555
|
if (distribution && distributionLink) {
|
|
1378
|
-
const
|
|
1379
|
-
|
|
1380
|
-
|
|
1381
|
-
)
|
|
1556
|
+
const isProvider = (object: string) =>
|
|
1557
|
+
object.startsWith(`lib/${DARWIN_RECORDS_PREFIX}`)
|
|
1558
|
+
const objects = distribution.objects.filter(
|
|
1559
|
+
(object) =>
|
|
1560
|
+
!isProvider(object) &&
|
|
1561
|
+
[...OPTIONAL_FRAMEWORKS, 'SpriteKit', 'PeachBox2D'].every(
|
|
1562
|
+
(name) => !object.startsWith(`lib/${name}-`) || reachedFrameworks.has(name),
|
|
1563
|
+
),
|
|
1382
1564
|
)
|
|
1383
1565
|
const quoted = (object: string) =>
|
|
1384
1566
|
`"${path.join(moduleRoot, object).replaceAll('\\', '\\\\').replaceAll('"', '\\"')}"`
|
|
1567
|
+
// the category-only object has no symbol reference to pull it from the lazy
|
|
1568
|
+
// region, so it links directly like the framework package path does
|
|
1569
|
+
const formattingObject = 'lib/Foundation-NSStringFormatting.o'
|
|
1385
1570
|
const roots = args.lazyDistribution
|
|
1386
1571
|
? swiftObjcRootObjects(distribution.id, moduleRoot, distribution.objects)
|
|
1387
1572
|
: null
|
|
1388
1573
|
// an archive region loads an object only when a loaded one references it
|
|
1389
1574
|
const list =
|
|
1390
|
-
|
|
1391
|
-
|
|
1392
|
-
|
|
1393
|
-
|
|
1394
|
-
|
|
1395
|
-
|
|
1396
|
-
|
|
1397
|
-
|
|
1398
|
-
|
|
1399
|
-
|
|
1400
|
-
|
|
1401
|
-
|
|
1402
|
-
|
|
1403
|
-
|
|
1575
|
+
[
|
|
1576
|
+
...(roots
|
|
1577
|
+
? [
|
|
1578
|
+
...objects
|
|
1579
|
+
.filter((object) => roots.has(object) || object === formattingObject)
|
|
1580
|
+
.map(quoted),
|
|
1581
|
+
'-Wl,--start-lib',
|
|
1582
|
+
...objects
|
|
1583
|
+
.filter((object) => !roots.has(object) && object !== formattingObject)
|
|
1584
|
+
.map(quoted),
|
|
1585
|
+
'-Wl,--end-lib',
|
|
1586
|
+
]
|
|
1587
|
+
: objects.map(quoted)),
|
|
1588
|
+
...darwinRecordsRegion(distribution.objects.filter(isProvider).map(quoted)),
|
|
1589
|
+
].join('\n') + '\n'
|
|
1404
1590
|
distributionLinkPath = distributionLink.path.replace(
|
|
1405
1591
|
/\.rsp$/,
|
|
1406
1592
|
`-${createHash('sha256').update(list).digest('hex').slice(0, 12)}.rsp`,
|
|
@@ -1443,7 +1629,10 @@ export function emitSwiftPackageManifest(args: {
|
|
|
1443
1629
|
// the manifest's own raw flags last, where swiftpm puts a target's
|
|
1444
1630
|
// settings: after the build's defaults, so they win as they do in xcode.
|
|
1445
1631
|
const upstream = (target.swiftFlags ?? [])
|
|
1446
|
-
.map(
|
|
1632
|
+
.map(
|
|
1633
|
+
(flag) =>
|
|
1634
|
+
`, ${JSON.stringify(flag.replaceAll(SWIFT_NATIVE_INPUT_ROOT, args.root))}`,
|
|
1635
|
+
)
|
|
1447
1636
|
.join('')
|
|
1448
1637
|
// a distribution's modules import from its modules/ directory, and its
|
|
1449
1638
|
// objects link as inputs, exactly as a source build links every object it
|
|
@@ -1455,11 +1644,11 @@ export function emitSwiftPackageManifest(args: {
|
|
|
1455
1644
|
// the file opaquely so swift neither expands it nor scans every framework
|
|
1456
1645
|
// object for autolinks; distribution.link supplies those libraries.
|
|
1457
1646
|
const imports = distribution
|
|
1458
|
-
? `, "-
|
|
1647
|
+
? `, "-Isystem", ${JSON.stringify(
|
|
1459
1648
|
distributionModulesPath(args.root, moduleRoot, args.distributionExcludes),
|
|
1460
1649
|
)}`
|
|
1461
1650
|
: prebuilt
|
|
1462
|
-
? `, "-
|
|
1651
|
+
? `, "-Isystem", ${JSON.stringify(prebuilt.modules)}${prebuilt.moduleMaps
|
|
1463
1652
|
.map((map) => `, "-Xcc", ${JSON.stringify(`-fmodule-map-file=${map}`)}`)
|
|
1464
1653
|
.join('')}`
|
|
1465
1654
|
: ''
|
|
@@ -1489,12 +1678,23 @@ export function emitSwiftPackageManifest(args: {
|
|
|
1489
1678
|
const importedNativeFlags = [
|
|
1490
1679
|
...(args.nativeImportFlags?.get(target.name) ?? []),
|
|
1491
1680
|
...[...importContext].flatMap((name) => args.native?.get(name)?.importFlags ?? []),
|
|
1681
|
+
...[...importContext].flatMap((name) => {
|
|
1682
|
+
const flags = targets.find((target) => target.name === name)?.swiftFlags ?? []
|
|
1683
|
+
return flags.flatMap((flag, index) =>
|
|
1684
|
+
flags[index - 1] === '-Xcc'
|
|
1685
|
+
? [flag.replaceAll(SWIFT_NATIVE_INPUT_ROOT, args.root)]
|
|
1686
|
+
: [],
|
|
1687
|
+
)
|
|
1688
|
+
}),
|
|
1492
1689
|
]
|
|
1493
1690
|
const nativeImportFlags = (
|
|
1494
1691
|
args.deferDarwinOverlay
|
|
1495
1692
|
? withoutWasmOverlayIsystem(importedNativeFlags)
|
|
1496
1693
|
: importedNativeFlags
|
|
1497
1694
|
)
|
|
1695
|
+
// a dependency's C language standard applies to its own units, not to
|
|
1696
|
+
// a Swift target whose clang importer is compiling as Objective-C++.
|
|
1697
|
+
.filter((flag) => !target.cxxInterop || !flag.startsWith('-std='))
|
|
1498
1698
|
.map((flag) => `, "-Xcc", ${JSON.stringify(flag)}`)
|
|
1499
1699
|
.join('')
|
|
1500
1700
|
const objcFlags = [
|
|
@@ -1518,10 +1718,7 @@ export function emitSwiftPackageManifest(args: {
|
|
|
1518
1718
|
...new Set([
|
|
1519
1719
|
...(target.dependencies ?? []).flatMap((dependency) =>
|
|
1520
1720
|
dependency.kind === 'product' &&
|
|
1521
|
-
!(
|
|
1522
|
-
linkedObjects &&
|
|
1523
|
-
dependency.package === path.basename(moduleRoot).toLowerCase()
|
|
1524
|
-
)
|
|
1721
|
+
!(linkedObjects && dependency.package === 'sootsim-swift')
|
|
1525
1722
|
? [
|
|
1526
1723
|
`.product(name: ${JSON.stringify(dependency.name)}, package: ${JSON.stringify(dependency.package)})`,
|
|
1527
1724
|
]
|
|
@@ -1609,21 +1806,43 @@ export function emitSwiftPackageManifest(args: {
|
|
|
1609
1806
|
: ''
|
|
1610
1807
|
const cDefines = macroSettings(target.cDefines)
|
|
1611
1808
|
const cxxDefines = macroSettings(target.cxxDefines)
|
|
1809
|
+
const nativeCxx = native?.clang?.sources.some((source) =>
|
|
1810
|
+
/\.(?:cc|cpp|cxx|mm)$/.test(source),
|
|
1811
|
+
)
|
|
1612
1812
|
const declared = (tool: 'c' | 'cxx') =>
|
|
1613
|
-
clangSettingEntries(
|
|
1813
|
+
clangSettingEntries(
|
|
1814
|
+
target.clangSettings?.map((setting) =>
|
|
1815
|
+
'flags' in setting
|
|
1816
|
+
? {
|
|
1817
|
+
...setting,
|
|
1818
|
+
flags: setting.flags.map((flag) =>
|
|
1819
|
+
flag.replaceAll(SWIFT_NATIVE_INPUT_ROOT, args.root),
|
|
1820
|
+
),
|
|
1821
|
+
}
|
|
1822
|
+
: setting,
|
|
1823
|
+
),
|
|
1824
|
+
tool,
|
|
1825
|
+
)
|
|
1614
1826
|
.map((entry) => ` ${entry},`)
|
|
1615
1827
|
.join('')
|
|
1616
1828
|
const nativeSettings = native?.clang
|
|
1617
1829
|
? [
|
|
1618
1830
|
`cSettings: [${cDefines} .unsafeFlags(${JSON.stringify([...nativeFlags, ...native.clang.flags])})]`,
|
|
1619
|
-
|
|
1831
|
+
...(nativeCxx
|
|
1832
|
+
? [
|
|
1833
|
+
`cxxSettings: [${cxxDefines} .unsafeFlags(${JSON.stringify(['-fno-cxx-modules', ...cxxFlagsFor(nativeFlags), ...native.clang.cxxFlags])})]`,
|
|
1834
|
+
]
|
|
1835
|
+
: []),
|
|
1620
1836
|
].join(', ')
|
|
1621
1837
|
: [
|
|
1622
1838
|
`cSettings: [${cDefines}${declared('c')} .unsafeFlags(${JSON.stringify([...nativeFlags, ...(native?.flags ?? [])])})]`,
|
|
1623
1839
|
`cxxSettings: [${cxxDefines}${declared('cxx')} .unsafeFlags(${JSON.stringify(['-fno-cxx-modules', ...cxxFlagsFor(nativeFlags), ...(native?.cxxFlags ?? [])])})]`,
|
|
1624
1840
|
].join(', ')
|
|
1625
1841
|
const exclusions = native?.clang
|
|
1626
|
-
?
|
|
1842
|
+
? [
|
|
1843
|
+
...(native.exclude ?? native.lateSources),
|
|
1844
|
+
...(args.nativeResourceExclusions ?? []),
|
|
1845
|
+
]
|
|
1627
1846
|
: [
|
|
1628
1847
|
...(native ? (native.exclude ?? native.lateSources) : []),
|
|
1629
1848
|
...(target.exclude ?? []),
|
|
@@ -1686,18 +1905,25 @@ export function emitSwiftPackageManifest(args: {
|
|
|
1686
1905
|
{
|
|
1687
1906
|
name: late.name,
|
|
1688
1907
|
sources: native.lateSources,
|
|
1689
|
-
flags: [],
|
|
1690
|
-
cxxFlags: [],
|
|
1908
|
+
flags: ['-fmodules'],
|
|
1909
|
+
cxxFlags: ['-fmodules'],
|
|
1691
1910
|
},
|
|
1692
1911
|
]
|
|
1693
1912
|
).flatMap((group) => [
|
|
1694
1913
|
` .target(name: ${JSON.stringify(group.name)},`,
|
|
1695
1914
|
` dependencies: ${JSON.stringify(native.mixed ? [] : [name])},`,
|
|
1696
1915
|
` path: ${JSON.stringify(native.clang || native.mixed ? '.' : native.path)},`,
|
|
1916
|
+
...(native.clang || native.mixed
|
|
1917
|
+
? [` exclude: ${JSON.stringify(args.nativeResourceExclusions ?? [])},`]
|
|
1918
|
+
: []),
|
|
1697
1919
|
` sources: ${JSON.stringify(native.clang || native.mixed ? group.sources.map((source) => path.posix.join(native.path, source)) : group.sources)},`,
|
|
1698
1920
|
` publicHeadersPath: ${JSON.stringify(native.clang ? path.posix.dirname(native.clang.modulemap) : (native.implementationHeaders ?? 'include'))},`,
|
|
1699
|
-
` cSettings: [${macroSettings(owner?.cDefines)} .unsafeFlags(${JSON.stringify([...nativeFlags, ...group.flags])})],`,
|
|
1700
|
-
|
|
1921
|
+
` cSettings: [${macroSettings(owner?.cDefines)} .unsafeFlags(${JSON.stringify([...nativeFlags, '-I', native.includeDirectory, '-I', args.headerDirectory, ...group.flags])})],`,
|
|
1922
|
+
...(group.sources.some((source) => /\.(?:cc|cpp|cxx|mm)$/.test(source))
|
|
1923
|
+
? [
|
|
1924
|
+
` cxxSettings: [${macroSettings(owner?.cxxDefines)} .unsafeFlags(${JSON.stringify(['-fno-cxx-modules', ...cxxFlagsFor(nativeFlags), ...group.cxxFlags])})]),`,
|
|
1925
|
+
]
|
|
1926
|
+
: [' ),']),
|
|
1701
1927
|
])
|
|
1702
1928
|
: []
|
|
1703
1929
|
}),
|
|
@@ -1839,6 +2065,81 @@ export function lowerAVAssetURLCluster(source: string): string {
|
|
|
1839
2065
|
// the explicit .init(time:) spelling stays on the shim, and the sdk's own
|
|
1840
2066
|
// NSValue(bytes:objCType:) still traps on struct encodings (the probe's
|
|
1841
2067
|
// sdk-trap negative pins that wall as the one the box avoids).
|
|
2068
|
+
export function lowerNSDictionaryLiteralReturn(source: string): string {
|
|
2069
|
+
if (!source.includes('NSDictionary')) return source
|
|
2070
|
+
const masked = swiftCodeMask(source)
|
|
2071
|
+
const edits: [number, number, string][] = []
|
|
2072
|
+
const wrapDictAt = (bracketStart: number, limit: number) => {
|
|
2073
|
+
let bDepth = 1
|
|
2074
|
+
let j = bracketStart + 1
|
|
2075
|
+
let hasColon = false
|
|
2076
|
+
while (j < limit && bDepth > 0) {
|
|
2077
|
+
if (masked[j] === '[' || masked[j] === '(' || masked[j] === '{') bDepth++
|
|
2078
|
+
else if (masked[j] === ']' || masked[j] === ')' || masked[j] === '}') bDepth--
|
|
2079
|
+
else if (bDepth === 1 && masked[j] === ':') hasColon = true
|
|
2080
|
+
j++
|
|
2081
|
+
}
|
|
2082
|
+
if (bDepth === 0 && hasColon) {
|
|
2083
|
+
edits.push([
|
|
2084
|
+
bracketStart,
|
|
2085
|
+
j - bracketStart,
|
|
2086
|
+
`NSDictionary(dictionary: ${source.slice(bracketStart, j)})`,
|
|
2087
|
+
])
|
|
2088
|
+
}
|
|
2089
|
+
}
|
|
2090
|
+
const fnPattern = /\bfunc\b[^{]*->\s*NSDictionary\??\s*\{/g
|
|
2091
|
+
let fnMatch: RegExpExecArray | null
|
|
2092
|
+
while ((fnMatch = fnPattern.exec(masked)) !== null) {
|
|
2093
|
+
const openBrace = fnMatch.index + fnMatch[0].length - 1
|
|
2094
|
+
let depth = 1
|
|
2095
|
+
let i = openBrace + 1
|
|
2096
|
+
while (i < masked.length && depth > 0) {
|
|
2097
|
+
if (masked[i] === '{') depth++
|
|
2098
|
+
else if (masked[i] === '}') depth--
|
|
2099
|
+
i++
|
|
2100
|
+
}
|
|
2101
|
+
const bodyEnd = i - 1
|
|
2102
|
+
const bodyMasked = masked.slice(openBrace + 1, bodyEnd)
|
|
2103
|
+
const retPattern = /\breturn\s*\[/g
|
|
2104
|
+
let retMatch: RegExpExecArray | null
|
|
2105
|
+
while ((retMatch = retPattern.exec(bodyMasked)) !== null) {
|
|
2106
|
+
const bracketStart = openBrace + 1 + retMatch.index + retMatch[0].length - 1
|
|
2107
|
+
wrapDictAt(bracketStart, bodyEnd)
|
|
2108
|
+
}
|
|
2109
|
+
}
|
|
2110
|
+
const varPattern = /:\s*NSDictionary\??\s*=\s*\[/g
|
|
2111
|
+
let varMatch: RegExpExecArray | null
|
|
2112
|
+
while ((varMatch = varPattern.exec(masked)) !== null) {
|
|
2113
|
+
wrapDictAt(varMatch.index + varMatch[0].length - 1, masked.length)
|
|
2114
|
+
}
|
|
2115
|
+
const nsDictLabels = new Set<string>()
|
|
2116
|
+
for (const m of masked.matchAll(/\b(\w+)\s*:\s*NSDictionary\??\b/g)) {
|
|
2117
|
+
if (m[1]) nsDictLabels.add(m[1])
|
|
2118
|
+
}
|
|
2119
|
+
for (const label of nsDictLabels) {
|
|
2120
|
+
const argPattern = new RegExp(`\\b${label}\\s*:\\s*\\[`, 'g')
|
|
2121
|
+
let argMatch: RegExpExecArray | null
|
|
2122
|
+
while ((argMatch = argPattern.exec(masked)) !== null) {
|
|
2123
|
+
const before = masked.slice(0, argMatch.index).trimEnd()
|
|
2124
|
+
if (!before.endsWith('(') && !before.endsWith(',')) continue
|
|
2125
|
+
wrapDictAt(argMatch.index + argMatch[0].length - 1, masked.length)
|
|
2126
|
+
}
|
|
2127
|
+
}
|
|
2128
|
+
if (/\btypealias\s+\w+\s*=\s*\([^)]*,\s*NSDictionary\??\s*\)/.test(masked)) {
|
|
2129
|
+
const cbPattern = /\b\w+\s*\(\s*\.[A-Za-z_]\w*\s*,\s*\[/g
|
|
2130
|
+
let cbMatch: RegExpExecArray | null
|
|
2131
|
+
while ((cbMatch = cbPattern.exec(masked)) !== null) {
|
|
2132
|
+
wrapDictAt(cbMatch.index + cbMatch[0].length - 1, masked.length)
|
|
2133
|
+
}
|
|
2134
|
+
}
|
|
2135
|
+
const unique = new Map<number, [number, number, string]>()
|
|
2136
|
+
for (const edit of edits) unique.set(edit[0], edit)
|
|
2137
|
+
let out = source
|
|
2138
|
+
for (const [at, remove, insert] of [...unique.values()].sort((a, b) => b[0] - a[0]))
|
|
2139
|
+
out = out.slice(0, at) + insert + out.slice(at + remove)
|
|
2140
|
+
return out
|
|
2141
|
+
}
|
|
2142
|
+
|
|
1842
2143
|
export function lowerNSValueTimeBox(source: string): string {
|
|
1843
2144
|
const masked = swiftCodeMask(source)
|
|
1844
2145
|
const pattern = /\bNSValue\s*\(\s*time\s*:/g
|
|
@@ -2002,7 +2303,6 @@ const FOUNDATION_OVERLAY_TYPES = new Set([
|
|
|
2002
2303
|
'NSCollectionChangeType',
|
|
2003
2304
|
'NSConditionLock',
|
|
2004
2305
|
'NSDataDetector',
|
|
2005
|
-
'NSErrorPointer',
|
|
2006
2306
|
'NSException',
|
|
2007
2307
|
'NSExtensionContext',
|
|
2008
2308
|
'NSExtensionItem',
|
|
@@ -2643,6 +2943,7 @@ const CORE_FOUNDATION_HANDLE_IMPORTS = [
|
|
|
2643
2943
|
|
|
2644
2944
|
// the guest module that owns a name darwin's Foundation declares
|
|
2645
2945
|
export function foundationOwnerOf(name: string): string | undefined {
|
|
2946
|
+
if (name === 'NSErrorPointer') return 'Foundation'
|
|
2646
2947
|
if (
|
|
2647
2948
|
name === 'NSClassFromString' ||
|
|
2648
2949
|
name === 'NSKeyValueChange' ||
|
|
@@ -2714,7 +3015,10 @@ export function swiftSourceAsIOS(source: string): string {
|
|
|
2714
3015
|
// a Clang submodule import (`import UIKit.UIImage`) names its framework:
|
|
2715
3016
|
// peach's frameworks are Swift modules with no submodules, and on iOS the
|
|
2716
3017
|
// submodule brings in the framework's Swift overlay too.
|
|
2717
|
-
const imported =
|
|
3018
|
+
const imported =
|
|
3019
|
+
conditioned[at - 1] === '.'
|
|
3020
|
+
? null
|
|
3021
|
+
: /^import[ \t]+([A-Za-z_]\w*)(?:[ \t]*\.[ \t]*[A-Za-z_]\w*)+/.exec(rest)
|
|
2718
3022
|
if (imported) {
|
|
2719
3023
|
out +=
|
|
2720
3024
|
conditioned.slice(copied, at) + `import ${imported[1]}`.padEnd(imported[0].length)
|
|
@@ -2722,7 +3026,8 @@ export function swiftSourceAsIOS(source: string): string {
|
|
|
2722
3026
|
copied = at + imported[0].length
|
|
2723
3027
|
continue
|
|
2724
3028
|
}
|
|
2725
|
-
const coreFoundationImport =
|
|
3029
|
+
const coreFoundationImport =
|
|
3030
|
+
conditioned[at - 1] === '.' ? null : /^import[ \t]+CoreFoundation\b/.exec(rest)
|
|
2726
3031
|
if (coreFoundationImport) {
|
|
2727
3032
|
out +=
|
|
2728
3033
|
conditioned.slice(copied, at) +
|
|
@@ -2808,7 +3113,9 @@ export function swiftSourceAsIOS(source: string): string {
|
|
|
2808
3113
|
continue
|
|
2809
3114
|
}
|
|
2810
3115
|
}
|
|
2811
|
-
return
|
|
3116
|
+
return lowerNSDictionaryLiteralReturn(
|
|
3117
|
+
lowerNSValueTimeBox(lowerAVAssetURLCluster(out + conditioned.slice(copied))),
|
|
3118
|
+
)
|
|
2812
3119
|
}
|
|
2813
3120
|
|
|
2814
3121
|
// a native module's file closure includes referenced top-level declarations
|
|
@@ -2941,6 +3248,136 @@ export function wrapUIApplicationMainEntry(source: string): string | null {
|
|
|
2941
3248
|
)
|
|
2942
3249
|
}
|
|
2943
3250
|
|
|
3251
|
+
// an objective-c main calling UIApplicationMain: xcode runs it as the
|
|
3252
|
+
// application entry. the call must be the file's only one and its class
|
|
3253
|
+
// arguments must be recognizable.
|
|
3254
|
+
// comments, strings and character literals masked to spaces, positions kept
|
|
3255
|
+
// so a call parses in the masked text and transcribes from the original.
|
|
3256
|
+
function maskedCCode(source: string): string {
|
|
3257
|
+
let masked = ''
|
|
3258
|
+
let at = 0
|
|
3259
|
+
while (at < source.length) {
|
|
3260
|
+
if (source.startsWith('//', at)) {
|
|
3261
|
+
const end = source.indexOf('\n', at)
|
|
3262
|
+
const stop = end === -1 ? source.length : end
|
|
3263
|
+
masked += ' '.repeat(stop - at)
|
|
3264
|
+
at = stop
|
|
3265
|
+
} else if (source.startsWith('/*', at)) {
|
|
3266
|
+
const end = source.indexOf('*/', at + 2)
|
|
3267
|
+
const stop = end === -1 ? source.length : end + 2
|
|
3268
|
+
masked += source.slice(at, stop).replace(/[^\n]/g, ' ')
|
|
3269
|
+
at = stop
|
|
3270
|
+
} else if (source[at] === '@' && source[at + 1] === '"') {
|
|
3271
|
+
let stop = at + 2
|
|
3272
|
+
while (stop < source.length && source[stop] !== '"')
|
|
3273
|
+
stop += source[stop] === '\\' ? 2 : 1
|
|
3274
|
+
stop++
|
|
3275
|
+
masked += ' '.repeat(stop - at)
|
|
3276
|
+
at = stop
|
|
3277
|
+
} else if (source[at] === '"' || source[at] === "'") {
|
|
3278
|
+
const quote = source[at]!
|
|
3279
|
+
let stop = at + 1
|
|
3280
|
+
while (stop < source.length && source[stop] !== quote)
|
|
3281
|
+
stop += source[stop] === '\\' ? 2 : 1
|
|
3282
|
+
stop++
|
|
3283
|
+
masked += ' '.repeat(stop - at)
|
|
3284
|
+
at = stop
|
|
3285
|
+
} else {
|
|
3286
|
+
masked += source[at]
|
|
3287
|
+
at++
|
|
3288
|
+
}
|
|
3289
|
+
}
|
|
3290
|
+
return masked
|
|
3291
|
+
}
|
|
3292
|
+
|
|
3293
|
+
export function objcApplicationMainCall(
|
|
3294
|
+
source: string,
|
|
3295
|
+
): { principal: string; delegate: string } | null {
|
|
3296
|
+
const masked = maskedCCode(source)
|
|
3297
|
+
const calls: string[][] = []
|
|
3298
|
+
for (const match of masked.matchAll(/\bUIApplicationMain\s*\(/g)) {
|
|
3299
|
+
let depth = 1
|
|
3300
|
+
let index = match.index + match[0].length
|
|
3301
|
+
const args: string[] = []
|
|
3302
|
+
let start = index
|
|
3303
|
+
for (; index < masked.length && depth > 0; index++) {
|
|
3304
|
+
const char = masked[index]!
|
|
3305
|
+
if (char === '(') depth++
|
|
3306
|
+
else if (char === ')') {
|
|
3307
|
+
depth--
|
|
3308
|
+
if (depth === 0) args.push(source.slice(start, index))
|
|
3309
|
+
} else if (char === ',' && depth === 1) {
|
|
3310
|
+
args.push(source.slice(start, index))
|
|
3311
|
+
start = index + 1
|
|
3312
|
+
}
|
|
3313
|
+
}
|
|
3314
|
+
if (depth !== 0) return null
|
|
3315
|
+
calls.push(args)
|
|
3316
|
+
}
|
|
3317
|
+
if (calls.length !== 1) return null
|
|
3318
|
+
const args = calls[0]!
|
|
3319
|
+
if (args.length !== 4) return null
|
|
3320
|
+
const principal = objcMainCallArgument(args[2]!.trim())
|
|
3321
|
+
const delegate = objcMainCallArgument(args[3]!.trim())
|
|
3322
|
+
if (principal === null || delegate === null) return null
|
|
3323
|
+
return { principal, delegate }
|
|
3324
|
+
}
|
|
3325
|
+
|
|
3326
|
+
// recognize the original entry forms whose class arguments were supported.
|
|
3327
|
+
// the returned names are used only to identify a supported application entry.
|
|
3328
|
+
function objcMainCallArgument(argument: string): string | null {
|
|
3329
|
+
if (/^(?:nil|NULL|Nil)$/.test(argument)) return 'nil'
|
|
3330
|
+
const literal = /^@"((?:[^"\\]|\\.)*)"$/.exec(argument)
|
|
3331
|
+
if (literal) return `"${literal[1]}"`
|
|
3332
|
+
const name = /^NSStringFromClass\(\[([A-Za-z_]\w*) class\]\)$/.exec(argument)
|
|
3333
|
+
if (name) return `"${name[1]}"`
|
|
3334
|
+
return null
|
|
3335
|
+
}
|
|
3336
|
+
|
|
3337
|
+
// retain the original body under a different name and expose a C-linkage
|
|
3338
|
+
// entry even when the original unit is objective-c++.
|
|
3339
|
+
export function neutralizedNativeMain(source: string): string {
|
|
3340
|
+
const masked = maskedCCode(source)
|
|
3341
|
+
const starts: number[] = []
|
|
3342
|
+
let mainTakesNoArguments = false
|
|
3343
|
+
let depth = 0
|
|
3344
|
+
for (let index = 0; index < masked.length; index++) {
|
|
3345
|
+
const char = masked[index]!
|
|
3346
|
+
if (char === '{') depth++
|
|
3347
|
+
else if (char === '}') depth--
|
|
3348
|
+
else if (
|
|
3349
|
+
depth === 0 &&
|
|
3350
|
+
masked.startsWith('main', index) &&
|
|
3351
|
+
!/[\w$]/.test(masked[index - 1] ?? '') &&
|
|
3352
|
+
!/[\w$]/.test(masked[index + 4] ?? '') &&
|
|
3353
|
+
/^\s*\(/.test(masked.slice(index + 4))
|
|
3354
|
+
) {
|
|
3355
|
+
let parens = 0
|
|
3356
|
+
let cursor = index + 4
|
|
3357
|
+
for (; cursor < masked.length; cursor++) {
|
|
3358
|
+
if (masked[cursor] === '(') parens++
|
|
3359
|
+
else if (masked[cursor] === ')') {
|
|
3360
|
+
parens--
|
|
3361
|
+
if (parens === 0) break
|
|
3362
|
+
}
|
|
3363
|
+
}
|
|
3364
|
+
if (/^\s*[;{]/.test(masked.slice(cursor + 1))) {
|
|
3365
|
+
starts.push(index)
|
|
3366
|
+
if (/^\s*\{/.test(masked.slice(cursor + 1)))
|
|
3367
|
+
mainTakesNoArguments = /^\s*(?:void)?\s*$/.test(
|
|
3368
|
+
masked.slice(masked.indexOf('(', index) + 1, cursor),
|
|
3369
|
+
)
|
|
3370
|
+
}
|
|
3371
|
+
}
|
|
3372
|
+
}
|
|
3373
|
+
let out = source
|
|
3374
|
+
for (const start of starts.reverse())
|
|
3375
|
+
out = `${out.slice(0, start)}__peach_native_main${out.slice(start + 4)}`
|
|
3376
|
+
const args = mainTakesNoArguments ? '' : 'argc, argv'
|
|
3377
|
+
const unused = mainTakesNoArguments ? '(void)argc; (void)argv; ' : ''
|
|
3378
|
+
return `${out}\n#ifdef __cplusplus\nextern "C"\n#endif\nint __peach_call_native_main(int argc, char **argv) { ${unused}return __peach_native_main(${args}); }\n`
|
|
3379
|
+
}
|
|
3380
|
+
|
|
2944
3381
|
// a c-family entry: a main definition outside comments and strings. headers
|
|
2945
3382
|
// never compile, so only sources are scanned.
|
|
2946
3383
|
/** the macro environment a c-family entry guard evaluates against. */
|
|
@@ -3457,8 +3894,10 @@ export function writeSwiftProject(
|
|
|
3457
3894
|
layout: SwiftProjectLayout,
|
|
3458
3895
|
input: SwiftCompileInput,
|
|
3459
3896
|
moduleRoot: string,
|
|
3460
|
-
prebuilt?:
|
|
3897
|
+
prebuilt?: SwiftFrameworkProducts,
|
|
3461
3898
|
): SwiftProjectPreparation {
|
|
3899
|
+
if (input.headerAliases !== undefined && !isSwiftHeaderAliases(input.headerAliases))
|
|
3900
|
+
throw new Error('swift compile input has invalid original header aliases')
|
|
3462
3901
|
if (input.nativeTargets !== undefined && !isSwiftNativeTargets(input.nativeTargets))
|
|
3463
3902
|
throw new Error('swift compile input has invalid original clang target inputs')
|
|
3464
3903
|
if (input.packageFiles !== undefined && !isSwiftPackageFiles(input.packageFiles))
|
|
@@ -3549,6 +3988,13 @@ export function writeSwiftProject(
|
|
|
3549
3988
|
}
|
|
3550
3989
|
}
|
|
3551
3990
|
const headerDirectory = path.join(layout.root, '.build', 'peach-cxx-headers')
|
|
3991
|
+
const flattenedHeaders = new Set<string>()
|
|
3992
|
+
// product header aliases belong to this input. keep emitted Swift headers,
|
|
3993
|
+
// but retire module directories left by an earlier workspace snapshot.
|
|
3994
|
+
if (existsSync(headerDirectory))
|
|
3995
|
+
for (const entry of readdirSync(headerDirectory, { withFileTypes: true }))
|
|
3996
|
+
if (entry.isDirectory())
|
|
3997
|
+
rmSync(path.join(headerDirectory, entry.name), { recursive: true, force: true })
|
|
3552
3998
|
let checkedToolchain: string | undefined
|
|
3553
3999
|
const nativeToolchain = () => {
|
|
3554
4000
|
if (checkedToolchain) return checkedToolchain
|
|
@@ -3638,6 +4084,14 @@ export function writeSwiftProject(
|
|
|
3638
4084
|
})
|
|
3639
4085
|
}
|
|
3640
4086
|
}
|
|
4087
|
+
const moduleInterfaces = new Map<string, ReturnType<typeof swiftModuleInterface>>()
|
|
4088
|
+
const moduleInterface = (name: string) => {
|
|
4089
|
+
const cached = moduleInterfaces.get(name)
|
|
4090
|
+
if (cached !== undefined) return cached
|
|
4091
|
+
const value = swiftModuleInterface(moduleRoot, name)
|
|
4092
|
+
moduleInterfaces.set(name, value)
|
|
4093
|
+
return value
|
|
4094
|
+
}
|
|
3641
4095
|
// headers keep their original project paths. an xcode target's product
|
|
3642
4096
|
// headers additionally occupy the flat Module/Header.h namespace it
|
|
3643
4097
|
// publishes; a swiftpm target's stay under its public headers directory.
|
|
@@ -3645,29 +4099,40 @@ export function writeSwiftProject(
|
|
|
3645
4099
|
for (const file of settings.headers) {
|
|
3646
4100
|
// a source checkout's interface header exists once its module built,
|
|
3647
4101
|
// after the input was cut; the staged copy stands in until then
|
|
3648
|
-
const interfaceModule = /(?:^|\/)(\w+)
|
|
3649
|
-
|
|
3650
|
-
|
|
3651
|
-
|
|
3652
|
-
|
|
3653
|
-
|
|
3654
|
-
|
|
4102
|
+
const interfaceModule = /(?:^|\/)(\w+)-Swift\.h$/.exec(file)?.[1]
|
|
4103
|
+
const frameworkHeader =
|
|
4104
|
+
!interfaceModule &&
|
|
4105
|
+
/(?:^|\/)(\w+)\.framework\/Headers\/[\w+.-]+\.h$/.exec(file)?.[1]
|
|
4106
|
+
const frameworkInterface = frameworkHeader ? moduleInterface(frameworkHeader) : null
|
|
4107
|
+
const rawContents =
|
|
4108
|
+
(interfaceModule && moduleInterface(interfaceModule)?.header) || input.files[file]
|
|
4109
|
+
if (rawContents === undefined)
|
|
3655
4110
|
throw new Error(`missing original Objective-C header ${file}`)
|
|
4111
|
+
const contents =
|
|
4112
|
+
frameworkInterface && typeof rawContents === 'string'
|
|
4113
|
+
? withoutSwiftDeclarations(
|
|
4114
|
+
rawContents,
|
|
4115
|
+
frameworkInterface.declared,
|
|
4116
|
+
`#import <${frameworkHeader}/${frameworkHeader}-Swift.h>`,
|
|
4117
|
+
)
|
|
4118
|
+
: rawContents
|
|
3656
4119
|
const destination = path.join(layout.root, file)
|
|
3657
4120
|
mkdirSync(path.dirname(destination), { recursive: true })
|
|
3658
4121
|
writeFileSync(destination, contents)
|
|
3659
4122
|
files.set(destination, contents)
|
|
3660
4123
|
}
|
|
3661
|
-
|
|
3662
|
-
|
|
3663
|
-
const
|
|
3664
|
-
|
|
3665
|
-
|
|
3666
|
-
|
|
3667
|
-
|
|
3668
|
-
|
|
3669
|
-
|
|
3670
|
-
|
|
4124
|
+
// the product alias must retain the module map's original file identity.
|
|
4125
|
+
if (settings.flattensPublicHeaders)
|
|
4126
|
+
for (const header of settings.publicHeaders) {
|
|
4127
|
+
const destination = path.join(
|
|
4128
|
+
headerDirectory,
|
|
4129
|
+
settings.name,
|
|
4130
|
+
path.basename(header),
|
|
4131
|
+
)
|
|
4132
|
+
if (flattenedHeaders.has(destination))
|
|
4133
|
+
throw new Error(`duplicate product header ${destination}`)
|
|
4134
|
+
flattenedHeaders.add(destination)
|
|
4135
|
+
}
|
|
3671
4136
|
}
|
|
3672
4137
|
// xcode's header maps and product header overlay, naming the headers
|
|
3673
4138
|
// written above, bound into every clang command of their target.
|
|
@@ -3686,16 +4151,28 @@ export function writeSwiftProject(
|
|
|
3686
4151
|
fromInputRoot(file),
|
|
3687
4152
|
]),
|
|
3688
4153
|
})),
|
|
3689
|
-
productHeaders: Object.fromEntries(
|
|
3690
|
-
Object.entries(settings.productHeaders).map(([product, file]) => [
|
|
4154
|
+
productHeaders: Object.fromEntries([
|
|
4155
|
+
...Object.entries(settings.productHeaders).map(([product, file]) => [
|
|
3691
4156
|
path.join(layout.root, product),
|
|
3692
4157
|
path.join(layout.root, file),
|
|
3693
4158
|
]),
|
|
3694
|
-
|
|
4159
|
+
...(settings.flattensPublicHeaders
|
|
4160
|
+
? settings.publicHeaders.map((header) => [
|
|
4161
|
+
path.join(headerDirectory, settings.name, path.basename(header)),
|
|
4162
|
+
path.join(layout.root, header),
|
|
4163
|
+
])
|
|
4164
|
+
: []),
|
|
4165
|
+
]),
|
|
3695
4166
|
userHeaderSearchPaths: settings.userHeaderSearchPaths.map((directory) =>
|
|
3696
4167
|
path.join(layout.root, directory),
|
|
3697
4168
|
),
|
|
3698
4169
|
})),
|
|
4170
|
+
Object.fromEntries(
|
|
4171
|
+
Object.entries(input.headerAliases ?? {}).map(([alias, file]) => [
|
|
4172
|
+
path.join(layout.root, alias),
|
|
4173
|
+
path.join(layout.root, file),
|
|
4174
|
+
]),
|
|
4175
|
+
),
|
|
3699
4176
|
)
|
|
3700
4177
|
// declarations are imported before swift can emit the header that native
|
|
3701
4178
|
// implementations consume. give those implementations a downstream target.
|
|
@@ -3705,7 +4182,18 @@ export function writeSwiftProject(
|
|
|
3705
4182
|
const prefix = target.path === '.' ? '' : `${target.path}/`
|
|
3706
4183
|
const entries = targetEntries(target)
|
|
3707
4184
|
const units = entries.filter(([file]) => isSwiftNativeTranslationUnit(file))
|
|
3708
|
-
if (
|
|
4185
|
+
if (
|
|
4186
|
+
units.length === 0 &&
|
|
4187
|
+
!(
|
|
4188
|
+
entries.some(([file]) => file.endsWith('.swift')) &&
|
|
4189
|
+
input.nativeTargets?.some(
|
|
4190
|
+
(settings) =>
|
|
4191
|
+
settings.name === target.name &&
|
|
4192
|
+
(settings.publicHeaders.length > 0 || settings.bridgingHeader !== null),
|
|
4193
|
+
)
|
|
4194
|
+
)
|
|
4195
|
+
)
|
|
4196
|
+
continue
|
|
3709
4197
|
const includes = `${prefix}include/`
|
|
3710
4198
|
const consumers = new Map<string, Set<string>>()
|
|
3711
4199
|
const reverse = new Map<string, string[]>()
|
|
@@ -3766,7 +4254,7 @@ export function writeSwiftProject(
|
|
|
3766
4254
|
for (const file of headers) {
|
|
3767
4255
|
const destination = path.join(layout.root, file)
|
|
3768
4256
|
mkdirSync(path.dirname(destination), { recursive: true })
|
|
3769
|
-
writeFileSync(destination, input.files[file]!)
|
|
4257
|
+
writeFileSync(destination, files.get(destination) ?? input.files[file]!)
|
|
3770
4258
|
}
|
|
3771
4259
|
// xcode searches only the target's search paths and header maps; a
|
|
3772
4260
|
// -I per header directory would let an angle include land on a
|
|
@@ -3834,7 +4322,13 @@ export function writeSwiftProject(
|
|
|
3834
4322
|
swiftSdkPaths(moduleRoot, toolchainBin).sysroot,
|
|
3835
4323
|
'darwin/usr/include',
|
|
3836
4324
|
)
|
|
3837
|
-
const
|
|
4325
|
+
const dependencyModuleMaps = clangImportModuleMapFlags(
|
|
4326
|
+
settings,
|
|
4327
|
+
layout.root,
|
|
4328
|
+
importModuleMaps,
|
|
4329
|
+
generatedModuleMaps,
|
|
4330
|
+
)
|
|
4331
|
+
const flags = [...stageFlags(originalFlags, sdkInclude), ...dependencyModuleMaps]
|
|
3838
4332
|
const prefixHeader = settings?.prefixHeader
|
|
3839
4333
|
? ['-include', path.join(layout.root, settings.prefixHeader)]
|
|
3840
4334
|
: []
|
|
@@ -3885,7 +4379,11 @@ export function writeSwiftProject(
|
|
|
3885
4379
|
const accessorFlags = accessor ? ['-include', accessorHeader] : []
|
|
3886
4380
|
const nativeC = !entries.some(([file]) => file.endsWith('.swift'))
|
|
3887
4381
|
const originalModuleMap = Object.entries(settings.productHeaders).find(
|
|
3888
|
-
([product]) =>
|
|
4382
|
+
([product, file]) =>
|
|
4383
|
+
product.endsWith('/Modules/module.modulemap') ||
|
|
4384
|
+
(file.endsWith('.modulemap') &&
|
|
4385
|
+
moduleMapName(input.files[file] ?? '') ===
|
|
4386
|
+
swiftTargetModuleName(target.name)),
|
|
3889
4387
|
)
|
|
3890
4388
|
const packageModuleMap = entries.find(
|
|
3891
4389
|
([file]) => file === includes + 'module.modulemap',
|
|
@@ -3957,7 +4455,11 @@ export function writeSwiftProject(
|
|
|
3957
4455
|
}
|
|
3958
4456
|
}
|
|
3959
4457
|
const modulemap =
|
|
3960
|
-
originalModuleMap
|
|
4458
|
+
(originalModuleMap
|
|
4459
|
+
? originalModuleMap[0].endsWith('/Modules/module.modulemap')
|
|
4460
|
+
? originalModuleMap[0]
|
|
4461
|
+
: originalModuleMap[1]
|
|
4462
|
+
: undefined) ??
|
|
3961
4463
|
swiftpmModuleMap?.path ??
|
|
3962
4464
|
packageModuleMap?.[0] ??
|
|
3963
4465
|
path.posix.join(
|
|
@@ -3979,15 +4481,17 @@ export function writeSwiftProject(
|
|
|
3979
4481
|
stageTargetFile(target.name, path.join(layout.root, modulemap), moduleContents, {
|
|
3980
4482
|
allowExisting: true,
|
|
3981
4483
|
})
|
|
4484
|
+
if (nativeC && path.posix.basename(modulemap) !== 'module.modulemap') {
|
|
4485
|
+
stageTargetFile(
|
|
4486
|
+
target.name,
|
|
4487
|
+
path.join(layout.root, path.posix.dirname(modulemap), 'module.modulemap'),
|
|
4488
|
+
`extern module ${swiftTargetModuleName(target.name)} ${JSON.stringify(path.join(layout.root, modulemap))}\n`,
|
|
4489
|
+
)
|
|
4490
|
+
}
|
|
3982
4491
|
const importFlags = [
|
|
3983
4492
|
...swiftClangImporterFlags(stageFlags(importOriginalFlags, sdkInclude)),
|
|
3984
4493
|
'-fmodule-map-file=' + path.join(layout.root, modulemap),
|
|
3985
|
-
...
|
|
3986
|
-
settings,
|
|
3987
|
-
layout.root,
|
|
3988
|
-
importModuleMaps,
|
|
3989
|
-
generatedModuleMaps,
|
|
3990
|
-
),
|
|
4494
|
+
...dependencyModuleMaps,
|
|
3991
4495
|
]
|
|
3992
4496
|
const groups = new Map<
|
|
3993
4497
|
string,
|
|
@@ -4023,6 +4527,9 @@ export function writeSwiftProject(
|
|
|
4023
4527
|
),
|
|
4024
4528
|
]
|
|
4025
4529
|
const cxx = /\.(?:cc|cpp|cxx|mm)$/.test(file)
|
|
4530
|
+
const moduleFlag = perFile.some((flag) => flag.startsWith('-fmodule-name='))
|
|
4531
|
+
? []
|
|
4532
|
+
: [`-fmodule-name=${swiftTargetModuleName(target.name)}`]
|
|
4026
4533
|
const identity = createHash('sha256')
|
|
4027
4534
|
.update(JSON.stringify([cxx, perFile, (consumers.get(file)?.size ?? 0) > 0]))
|
|
4028
4535
|
.digest('hex')
|
|
@@ -4030,7 +4537,13 @@ export function writeSwiftProject(
|
|
|
4030
4537
|
const group = groups.get(identity) ?? {
|
|
4031
4538
|
name: `${target.name}${nativeC ? 'Native' : 'Swift'}Implementation_${identity}`,
|
|
4032
4539
|
sources: [],
|
|
4033
|
-
flags: [
|
|
4540
|
+
flags: [
|
|
4541
|
+
...flags,
|
|
4542
|
+
...prefixHeader,
|
|
4543
|
+
...accessorFlags,
|
|
4544
|
+
...perFile,
|
|
4545
|
+
...moduleFlag,
|
|
4546
|
+
],
|
|
4034
4547
|
cxxFlags: [
|
|
4035
4548
|
...flags,
|
|
4036
4549
|
...prefixHeader,
|
|
@@ -4043,6 +4556,7 @@ export function writeSwiftProject(
|
|
|
4043
4556
|
),
|
|
4044
4557
|
),
|
|
4045
4558
|
...perFile,
|
|
4559
|
+
...moduleFlag,
|
|
4046
4560
|
],
|
|
4047
4561
|
}
|
|
4048
4562
|
group.sources.push(source)
|
|
@@ -4203,7 +4717,27 @@ export function writeSwiftProject(
|
|
|
4203
4717
|
`extern module ${map.module} ${JSON.stringify(map.published)}\n`,
|
|
4204
4718
|
)
|
|
4205
4719
|
if (native.size > 0) mkdirSync(headerDirectory, { recursive: true })
|
|
4206
|
-
const
|
|
4720
|
+
const headerAliasFlags =
|
|
4721
|
+
Object.keys(input.headerAliases ?? {}).length > 0
|
|
4722
|
+
? ['-ivfsoverlay', headerSearch.files[0]!]
|
|
4723
|
+
: []
|
|
4724
|
+
const nativeHeaderFlags: string[] = [...headerAliasFlags]
|
|
4725
|
+
const originalMaps = new Map<string, string>()
|
|
4726
|
+
for (const target of input.nativeTargets ?? []) {
|
|
4727
|
+
for (const flag of [...target.flags, ...target.cxxFlags]) {
|
|
4728
|
+
if (!flag.startsWith('-fmodule-map-file=')) continue
|
|
4729
|
+
const file = flag
|
|
4730
|
+
.slice('-fmodule-map-file='.length)
|
|
4731
|
+
.replace(`${SWIFT_NATIVE_INPUT_ROOT}/`, '')
|
|
4732
|
+
const name = moduleMapName(input.files[file] ?? '')
|
|
4733
|
+
if (name && !originalMaps.has(name)) originalMaps.set(name, file)
|
|
4734
|
+
}
|
|
4735
|
+
}
|
|
4736
|
+
for (const [file, contents] of Object.entries(input.files)) {
|
|
4737
|
+
if (!file.endsWith('.modulemap')) continue
|
|
4738
|
+
const name = moduleMapName(contents)
|
|
4739
|
+
if (name && !originalMaps.has(name)) originalMaps.set(name, file)
|
|
4740
|
+
}
|
|
4207
4741
|
for (const name of new Set(
|
|
4208
4742
|
[...native.values()].flatMap((value) => value.late?.producers ?? []),
|
|
4209
4743
|
)) {
|
|
@@ -4218,14 +4752,19 @@ export function writeSwiftProject(
|
|
|
4218
4752
|
name,
|
|
4219
4753
|
'module.modulemap',
|
|
4220
4754
|
)
|
|
4755
|
+
const moduleName = swiftTargetModuleName(name)
|
|
4756
|
+
const originalMap = originalMaps.get(moduleName)
|
|
4221
4757
|
files.set(
|
|
4222
4758
|
modulemap,
|
|
4223
|
-
|
|
4224
|
-
|
|
4225
|
-
|
|
4226
|
-
|
|
4227
|
-
|
|
4228
|
-
|
|
4759
|
+
originalMap
|
|
4760
|
+
? `extern module ${moduleName} ${JSON.stringify(path.join(layout.root, originalMap))}\nmodule ${moduleName}.Swift {\n header ${JSON.stringify(path.join(headerDirectory, name + '-Swift.h'))}\n requires objc\n}\n`
|
|
4761
|
+
: swiftObjCModuleMap(moduleName, [
|
|
4762
|
+
...(
|
|
4763
|
+
input.nativeTargets?.find((target) => target.name === name)
|
|
4764
|
+
?.publicHeaders ?? []
|
|
4765
|
+
).map((header) => path.join(layout.root, header)),
|
|
4766
|
+
path.join(headerDirectory, name + '-Swift.h'),
|
|
4767
|
+
]),
|
|
4229
4768
|
)
|
|
4230
4769
|
nativeHeaderFlags.push('-fmodule-map-file=' + modulemap)
|
|
4231
4770
|
}
|
|
@@ -4289,8 +4828,9 @@ export function writeSwiftProject(
|
|
|
4289
4828
|
const entry = swiftTypedApplicationEntry(source)
|
|
4290
4829
|
return entry ? [{ file, source, ...entry }] : []
|
|
4291
4830
|
})
|
|
4292
|
-
let entryFile
|
|
4293
|
-
let entrySource
|
|
4831
|
+
let entryFile = ''
|
|
4832
|
+
let entrySource = ''
|
|
4833
|
+
let nativeEntry = false
|
|
4294
4834
|
if (mains.length === 1) {
|
|
4295
4835
|
const main = mains[0]!
|
|
4296
4836
|
entryFile = main.file
|
|
@@ -4306,18 +4846,46 @@ export function writeSwiftProject(
|
|
|
4306
4846
|
)
|
|
4307
4847
|
const wrapped =
|
|
4308
4848
|
procedural.length === 1 ? wrapUIApplicationMainEntry(procedural[0]![1]) : null
|
|
4309
|
-
if (
|
|
4310
|
-
|
|
4311
|
-
|
|
4849
|
+
if (wrapped) {
|
|
4850
|
+
entryFile = procedural[0]![0]
|
|
4851
|
+
entrySource = wrapped
|
|
4852
|
+
} else {
|
|
4853
|
+
// an objective-c main calling UIApplicationMain is the entry xcode
|
|
4854
|
+
// runs. the library retains its body under a different name and the
|
|
4855
|
+
// generated executable calls it after both phases link.
|
|
4856
|
+
const nativeMains = Object.entries(input.files).filter(
|
|
4857
|
+
([file, contents]) =>
|
|
4858
|
+
file.startsWith(prefix) &&
|
|
4859
|
+
!targets.some(
|
|
4860
|
+
(candidate) =>
|
|
4861
|
+
candidate.name !== target.name &&
|
|
4862
|
+
candidate.path !== '.' &&
|
|
4863
|
+
candidate.path.startsWith(prefix) &&
|
|
4864
|
+
file.startsWith(`${candidate.path}/`),
|
|
4865
|
+
) &&
|
|
4866
|
+
isSwiftNativeTranslationUnit(file) &&
|
|
4867
|
+
swiftCMainEntry(file, contents),
|
|
4868
|
+
)
|
|
4869
|
+
if (nativeMains.length !== 1)
|
|
4870
|
+
throw new Error(
|
|
4871
|
+
`mixed executable ${target.name} requires one typed Swift application entry`,
|
|
4872
|
+
)
|
|
4873
|
+
if (!objcApplicationMainCall(nativeMains[0]![1]))
|
|
4874
|
+
throw new Error(
|
|
4875
|
+
`mixed executable ${target.name} requires one typed Swift application entry`,
|
|
4876
|
+
)
|
|
4877
|
+
files.set(
|
|
4878
|
+
path.join(layout.root, nativeMains[0]![0]),
|
|
4879
|
+
neutralizedNativeMain(nativeMains[0]![1]),
|
|
4312
4880
|
)
|
|
4313
|
-
|
|
4314
|
-
|
|
4881
|
+
nativeEntry = true
|
|
4882
|
+
}
|
|
4315
4883
|
} else {
|
|
4316
4884
|
throw new Error(
|
|
4317
4885
|
`mixed executable ${target.name} requires one typed Swift application entry`,
|
|
4318
4886
|
)
|
|
4319
4887
|
}
|
|
4320
|
-
compiled.set(entryFile, entrySource)
|
|
4888
|
+
if (!nativeEntry) compiled.set(entryFile, entrySource)
|
|
4321
4889
|
const name = `${target.name}Executable`
|
|
4322
4890
|
if (targets.some((candidate) => candidate.name === name))
|
|
4323
4891
|
throw new Error(`mixed application executable target conflicts with ${name}`)
|
|
@@ -4333,17 +4901,31 @@ export function writeSwiftProject(
|
|
|
4333
4901
|
})
|
|
4334
4902
|
files.set(
|
|
4335
4903
|
path.join(layout.root, `PeachApplication/${name}/Entry.swift`),
|
|
4336
|
-
|
|
4904
|
+
!nativeEntry
|
|
4905
|
+
? `import ${swiftTargetModuleName(target.name)}\n@main struct __PeachApplicationEntry { @MainActor static func main() { __peachRunApplication() } }\n`
|
|
4906
|
+
: `import ${swiftTargetModuleName(target.name)}\n@_silgen_name("__peach_call_native_main") private func __peachCallNativeMain(_ argc: Int32, _ argv: UnsafeMutablePointer<UnsafeMutablePointer<CChar>?>) -> Int32\n@main struct __PeachApplicationEntry { @MainActor static func main() { _ = __peachCallNativeMain(CommandLine.argc, CommandLine.unsafeArgv) } }\n`,
|
|
4337
4907
|
)
|
|
4338
4908
|
}
|
|
4339
4909
|
// original units compile on the objective-c runtime whether or not swift
|
|
4340
4910
|
// exports anything to them.
|
|
4341
4911
|
const nativeImportFlags = new Map<string, string[]>()
|
|
4912
|
+
for (const target of targets)
|
|
4913
|
+
if (headerAliasFlags.length > 0) nativeImportFlags.set(target.name, headerAliasFlags)
|
|
4342
4914
|
const nativeFlags = native.size > 0 ? new Map<string, string[]>() : undefined
|
|
4343
4915
|
if (nativeFlags) {
|
|
4344
4916
|
const toolchainBin = nativeToolchain()
|
|
4345
4917
|
const headers = path.join(swiftSdkPaths(moduleRoot, toolchainBin).sysroot, 'darwin')
|
|
4918
|
+
const dependencies = swiftTargetDependencies(input.files, targets)
|
|
4919
|
+
const reachesNative = (name: string, seen = new Set<string>()): boolean => {
|
|
4920
|
+
if (native.has(name)) return true
|
|
4921
|
+
if (seen.has(name)) return false
|
|
4922
|
+
seen.add(name)
|
|
4923
|
+
return [...(dependencies.get(name) ?? [])].some((dependency) =>
|
|
4924
|
+
reachesNative(dependency, seen),
|
|
4925
|
+
)
|
|
4926
|
+
}
|
|
4346
4927
|
for (const target of targets) {
|
|
4928
|
+
if (!target.executable && !reachesNative(target.name)) continue
|
|
4347
4929
|
const version = deploymentTarget(target.name)
|
|
4348
4930
|
const minimum = iosDeploymentMinimum(version)
|
|
4349
4931
|
if (minimum === undefined)
|
|
@@ -4354,6 +4936,8 @@ export function writeSwiftProject(
|
|
|
4354
4936
|
)
|
|
4355
4937
|
const intake = [
|
|
4356
4938
|
...objcSdkIntakeFlags(headers, toolchainBin, minimum),
|
|
4939
|
+
'-ivfsoverlay',
|
|
4940
|
+
headerSearch.files[0]!,
|
|
4357
4941
|
'-I',
|
|
4358
4942
|
headerDirectory,
|
|
4359
4943
|
]
|
|
@@ -4438,7 +5022,15 @@ export function writeSwiftProject(
|
|
|
4438
5022
|
}
|
|
4439
5023
|
for (const [file, contents] of Object.entries(input.files)) {
|
|
4440
5024
|
if (file === 'Package.swift') continue
|
|
4441
|
-
|
|
5025
|
+
const destination = path.join(base, file)
|
|
5026
|
+
const interfaceModule = /(?:^|\/)(\w+)-Swift\.h$/.exec(file)?.[1]
|
|
5027
|
+
files.set(
|
|
5028
|
+
destination,
|
|
5029
|
+
compiled.get(file) ??
|
|
5030
|
+
files.get(destination) ??
|
|
5031
|
+
(interfaceModule && moduleInterface(interfaceModule)?.header) ??
|
|
5032
|
+
contents,
|
|
5033
|
+
)
|
|
4442
5034
|
}
|
|
4443
5035
|
// a source package with no manifest of its own is the one App target the
|
|
4444
5036
|
// template declares. its framework objects are already built elsewhere.
|
|
@@ -4486,11 +5078,14 @@ export function writeSwiftProject(
|
|
|
4486
5078
|
? path.join(layout.root, '.peach-framework-objects.rsp')
|
|
4487
5079
|
: undefined
|
|
4488
5080
|
if (prebuilt && frameworkLink) {
|
|
5081
|
+
const quote = (object: string) =>
|
|
5082
|
+
`"${object.replaceAll('\\', '\\\\').replaceAll('"', '\\"')}"`
|
|
4489
5083
|
files.set(
|
|
4490
5084
|
frameworkLink,
|
|
4491
|
-
|
|
4492
|
-
.map(
|
|
4493
|
-
.
|
|
5085
|
+
[
|
|
5086
|
+
...prebuilt.objects.map(quote),
|
|
5087
|
+
...darwinRecordsRegion(prebuilt.providers.map(quote)),
|
|
5088
|
+
].join('\n') + '\n',
|
|
4494
5089
|
)
|
|
4495
5090
|
}
|
|
4496
5091
|
files.set(
|
|
@@ -4500,6 +5095,20 @@ export function writeSwiftProject(
|
|
|
4500
5095
|
targets: manifestTargets,
|
|
4501
5096
|
packages,
|
|
4502
5097
|
native,
|
|
5098
|
+
nativeResourceExclusions: [
|
|
5099
|
+
...new Set(
|
|
5100
|
+
swiftImplicitResourcePaths([
|
|
5101
|
+
...Object.keys(input.files),
|
|
5102
|
+
...Object.keys(input.packageFiles ?? {}),
|
|
5103
|
+
...Object.keys(input.projectFiles ?? {}),
|
|
5104
|
+
]).map(
|
|
5105
|
+
(file) =>
|
|
5106
|
+
/^(.*?\.(?:lproj|xcassets|xcdatamodeld|xcdatamodel|xcmappingmodel))(?:\/|$)/.exec(
|
|
5107
|
+
file,
|
|
5108
|
+
)?.[1] ?? file,
|
|
5109
|
+
),
|
|
5110
|
+
),
|
|
5111
|
+
],
|
|
4503
5112
|
nativeFlags,
|
|
4504
5113
|
nativeImportFlags,
|
|
4505
5114
|
nativeHeaderFlags,
|
|
@@ -4572,9 +5181,16 @@ export function writeSwiftProject(
|
|
|
4572
5181
|
path.join(layout.root, '.peach-target-toolset.json'),
|
|
4573
5182
|
JSON.stringify({
|
|
4574
5183
|
schemaVersion: '1.0',
|
|
5184
|
+
...(headerAliasFlags.length > 0
|
|
5185
|
+
? {
|
|
5186
|
+
cCompiler: { extraCLIOptions: headerAliasFlags },
|
|
5187
|
+
cxxCompiler: { extraCLIOptions: headerAliasFlags },
|
|
5188
|
+
}
|
|
5189
|
+
: {}),
|
|
4575
5190
|
swiftCompiler: {
|
|
4576
5191
|
extraCLIOptions: [
|
|
4577
|
-
'-
|
|
5192
|
+
...headerAliasFlags.flatMap((flag) => ['-Xcc', flag]),
|
|
5193
|
+
distribution || prebuilt ? '-Isystem' : '-I',
|
|
4578
5194
|
distribution
|
|
4579
5195
|
? distributionModulesPath(layout.root, moduleRoot, distributionExcludes)
|
|
4580
5196
|
: prebuilt
|
|
@@ -4587,7 +5203,7 @@ export function writeSwiftProject(
|
|
|
4587
5203
|
'-Xfrontend',
|
|
4588
5204
|
'-enable-cross-import-overlays',
|
|
4589
5205
|
...swiftCrossImportFlags(moduleRoot, Boolean(distribution)),
|
|
4590
|
-
...(distribution
|
|
5206
|
+
...(distribution || prebuilt
|
|
4591
5207
|
? FOUNDATION_IMPLICIT_MODULES.flatMap((module) => [
|
|
4592
5208
|
'-Xfrontend',
|
|
4593
5209
|
'-import-module',
|
|
@@ -4663,6 +5279,8 @@ function outputOf(error: unknown): string {
|
|
|
4663
5279
|
streamText(Reflect.get(error, 'stdout')),
|
|
4664
5280
|
streamText(Reflect.get(error, 'stderr')),
|
|
4665
5281
|
].filter(Boolean)
|
|
5282
|
+
// a killed process leaves no error line, so the runner's own message names how it ended.
|
|
5283
|
+
if (error instanceof Error) streams.push(error.message)
|
|
4666
5284
|
if (streams.length > 0) return streams.join('\n')
|
|
4667
5285
|
}
|
|
4668
5286
|
return error instanceof Error ? error.message : String(error)
|
|
@@ -4831,7 +5449,7 @@ function pruneSharedArtifacts(parent: string, keep: string): void {
|
|
|
4831
5449
|
for (const name of readdirSync(parent)) {
|
|
4832
5450
|
const directory = path.join(parent, name)
|
|
4833
5451
|
if (name.startsWith(RETIRED_PREFIX)) {
|
|
4834
|
-
|
|
5452
|
+
reapRetiredCacheDirectory(parent, name)
|
|
4835
5453
|
continue
|
|
4836
5454
|
}
|
|
4837
5455
|
try {
|
|
@@ -4866,7 +5484,7 @@ function pruneSharedArtifacts(parent: string, keep: string): void {
|
|
|
4866
5484
|
if (vanished(error)) continue
|
|
4867
5485
|
throw error
|
|
4868
5486
|
}
|
|
4869
|
-
|
|
5487
|
+
removeRetiredDirectory(retired)
|
|
4870
5488
|
total -= entry.bytes
|
|
4871
5489
|
}
|
|
4872
5490
|
}
|
|
@@ -5107,6 +5725,16 @@ function removeCaseCollidingModuleArtifacts(
|
|
|
5107
5725
|
}
|
|
5108
5726
|
}
|
|
5109
5727
|
|
|
5728
|
+
/** a source checkout's framework build: what the app link reads from it. */
|
|
5729
|
+
interface SwiftFrameworkProducts {
|
|
5730
|
+
modules: string
|
|
5731
|
+
objects: string[]
|
|
5732
|
+
/** the Darwin module's providers, linked as an archive ahead of the sdk's */
|
|
5733
|
+
providers: string[]
|
|
5734
|
+
link: string[]
|
|
5735
|
+
moduleMaps: string[]
|
|
5736
|
+
}
|
|
5737
|
+
|
|
5110
5738
|
// xcode keeps each project's intermediates under that project's own directory
|
|
5111
5739
|
// (`PROJECT_NAME.build` / `TARGET_NAME.build`). swiftpm names object and module
|
|
5112
5740
|
// files by the target's c99 name inside one scratch, so two packages whose
|
|
@@ -5121,40 +5749,24 @@ async function compileFrameworkProducts(args: {
|
|
|
5121
5749
|
sdk: string
|
|
5122
5750
|
toolchainBin: string
|
|
5123
5751
|
plugins: { libraries: string[]; executables: string[] }
|
|
5124
|
-
buildOptions: ExecFileOptions & {
|
|
5125
|
-
|
|
5126
|
-
|
|
5127
|
-
|
|
5128
|
-
|
|
5129
|
-
|
|
5130
|
-
}> {
|
|
5752
|
+
buildOptions: ExecFileOptions & {
|
|
5753
|
+
signal?: AbortSignal
|
|
5754
|
+
lease?: SwiftRootLease
|
|
5755
|
+
frameworkLease?: SwiftRootLease
|
|
5756
|
+
}
|
|
5757
|
+
}): Promise<SwiftFrameworkProducts> {
|
|
5131
5758
|
const scratch = swiftFrameworkScratch(args.frameworkKey)
|
|
5132
5759
|
mkdirSync(scratch, { recursive: true })
|
|
5133
5760
|
// incremental builds leave the directory's own mtime alone, which the prune reads
|
|
5134
5761
|
const now = new Date()
|
|
5135
5762
|
utimesSync(scratch, now, now)
|
|
5136
|
-
|
|
5137
|
-
// uses it. a build that finds the products current only plans and returns.
|
|
5138
|
-
return withSwiftRootLock(
|
|
5139
|
-
scratch,
|
|
5140
|
-
(lease) =>
|
|
5141
|
-
buildFrameworkProducts(scratch, {
|
|
5142
|
-
...args,
|
|
5143
|
-
buildOptions: { ...args.buildOptions, lease },
|
|
5144
|
-
}),
|
|
5145
|
-
args.buildOptions.signal,
|
|
5146
|
-
)
|
|
5763
|
+
return buildFrameworkProducts(scratch, args)
|
|
5147
5764
|
}
|
|
5148
5765
|
|
|
5149
5766
|
async function buildFrameworkProducts(
|
|
5150
5767
|
scratch: string,
|
|
5151
5768
|
args: Parameters<typeof compileFrameworkProducts>[0],
|
|
5152
|
-
): Promise<{
|
|
5153
|
-
modules: string
|
|
5154
|
-
objects: string[]
|
|
5155
|
-
link: string[]
|
|
5156
|
-
moduleMaps: string[]
|
|
5157
|
-
}> {
|
|
5769
|
+
): Promise<SwiftFrameworkProducts> {
|
|
5158
5770
|
const linkedTargets = linkedFrameworkTargets(args.moduleRoot, args.input)
|
|
5159
5771
|
const linkRoot = path.join(scratch, 'link')
|
|
5160
5772
|
writeFrameworkLinkPackage(linkRoot, args.moduleRoot, linkedTargets.products)
|
|
@@ -5184,6 +5796,11 @@ async function buildFrameworkProducts(
|
|
|
5184
5796
|
'-num-threads',
|
|
5185
5797
|
'-Xswiftc',
|
|
5186
5798
|
BUILD_JOBS,
|
|
5799
|
+
...swiftReproducibleBuildFlags([
|
|
5800
|
+
[path.dirname(args.toolchainBin), 'toolchain'],
|
|
5801
|
+
[args.moduleRoot, 'framework'],
|
|
5802
|
+
[scratch, 'framework-scratch'],
|
|
5803
|
+
]),
|
|
5187
5804
|
...args.plugins.libraries.flatMap((plugin) => [
|
|
5188
5805
|
'-Xswiftc',
|
|
5189
5806
|
'-load-plugin-library',
|
|
@@ -5197,7 +5814,9 @@ async function buildFrameworkProducts(
|
|
|
5197
5814
|
`${plugin}#ExpoModulesMacros`,
|
|
5198
5815
|
]),
|
|
5199
5816
|
],
|
|
5200
|
-
|
|
5817
|
+
// the framework build's warnings alone pass the default 1 MiB cap, which kills
|
|
5818
|
+
// the build one step from the end.
|
|
5819
|
+
{ ...args.buildOptions, maxBuffer: 64 * 1024 * 1024 },
|
|
5201
5820
|
SWIFTPM_PROGRESS,
|
|
5202
5821
|
SWIFTPM_NOISE,
|
|
5203
5822
|
).catch((error: unknown) => {
|
|
@@ -5232,9 +5851,29 @@ async function buildFrameworkProducts(
|
|
|
5232
5851
|
'wasi/NSStringFormatting.objc.o',
|
|
5233
5852
|
),
|
|
5234
5853
|
)
|
|
5854
|
+
// the providers compile from this revision's source, once per scratch
|
|
5855
|
+
const providerDir = path.join(scratch, 'darwin-records')
|
|
5856
|
+
if (!existsSync(path.join(providerDir, '.complete'))) {
|
|
5857
|
+
rmSync(providerDir, { recursive: true, force: true })
|
|
5858
|
+
mkdirSync(providerDir)
|
|
5859
|
+
const sdkPaths = swiftSdkPaths(args.moduleRoot, args.toolchainBin)
|
|
5860
|
+
compileDarwinRecords({
|
|
5861
|
+
bin: args.toolchainBin,
|
|
5862
|
+
sysroot: sdkPaths.sysroot,
|
|
5863
|
+
darwin: sdkPaths.darwin,
|
|
5864
|
+
packageRoot: args.moduleRoot,
|
|
5865
|
+
minimum: darwinRecordsMinimum(),
|
|
5866
|
+
out: providerDir,
|
|
5867
|
+
})
|
|
5868
|
+
writeFileSync(path.join(providerDir, '.complete'), '')
|
|
5869
|
+
}
|
|
5235
5870
|
return {
|
|
5236
5871
|
modules: path.join(release, 'Modules'),
|
|
5237
5872
|
objects,
|
|
5873
|
+
providers: readdirSync(providerDir)
|
|
5874
|
+
.filter((file) => file.endsWith('.o'))
|
|
5875
|
+
.sort()
|
|
5876
|
+
.map((file) => path.join(providerDir, file)),
|
|
5238
5877
|
link,
|
|
5239
5878
|
moduleMaps: linked.moduleMaps,
|
|
5240
5879
|
}
|
|
@@ -5296,7 +5935,7 @@ function stageFrameworkSource(moduleRoot: string, frameworkKey: string): string
|
|
|
5296
5935
|
|
|
5297
5936
|
function swiftLinkStamp(args: {
|
|
5298
5937
|
frameworkKey: string
|
|
5299
|
-
prebuilt?:
|
|
5938
|
+
prebuilt?: SwiftFrameworkProducts
|
|
5300
5939
|
}): string {
|
|
5301
5940
|
const hash = createHash('sha256')
|
|
5302
5941
|
hash.update(`swift-link/v1\n${args.frameworkKey}\n`)
|
|
@@ -5307,6 +5946,8 @@ function swiftLinkStamp(args: {
|
|
|
5307
5946
|
}
|
|
5308
5947
|
for (const object of args.prebuilt.objects)
|
|
5309
5948
|
hash.update(`object\n${object}\n${statOf(object)}`)
|
|
5949
|
+
for (const object of args.prebuilt.providers)
|
|
5950
|
+
hash.update(`provider\n${object}\n${statOf(object)}`)
|
|
5310
5951
|
for (const map of args.prebuilt.moduleMaps)
|
|
5311
5952
|
hash.update(`module-map\n${map}\n${statOf(map)}`)
|
|
5312
5953
|
hash.update(`link\n${args.prebuilt.link.join('\n')}\n`)
|
|
@@ -5384,19 +6025,21 @@ export function compileSwiftProjectUnit(
|
|
|
5384
6025
|
return retain(root, retained)
|
|
5385
6026
|
}
|
|
5386
6027
|
const cached = readCompiledArtifact(path.join(sharedRoot, 'artifact'), hash)
|
|
5387
|
-
|
|
6028
|
+
// a build root the project user writes in cannot vouch for an artifact
|
|
6029
|
+
const previous =
|
|
6030
|
+
cached ??
|
|
6031
|
+
(options.project ? null : readCompiledArtifact(path.join(root, 'artifact'), hash))
|
|
5388
6032
|
if (previous) {
|
|
5389
6033
|
if (cached) renewSharedArtifact(sharedRoot)
|
|
5390
6034
|
else saveSharedArtifact(sharedRoot, previous)
|
|
5391
6035
|
report('reusing verified disk artifact')
|
|
5392
6036
|
return retain(root, previous)
|
|
5393
6037
|
}
|
|
5394
|
-
// a
|
|
5395
|
-
// transport markers alone still dispatch through admission.
|
|
6038
|
+
// a live local or destination grant authorizes compilation here.
|
|
5396
6039
|
if (
|
|
5397
6040
|
process.platform === 'darwin' &&
|
|
5398
6041
|
process.env.TM_SESSION &&
|
|
5399
|
-
!
|
|
6042
|
+
!windowAdmission() &&
|
|
5400
6043
|
process.env.CI !== 'true' &&
|
|
5401
6044
|
moduleRoot === sourceSwiftCheckout() &&
|
|
5402
6045
|
!swiftDistributionAt(moduleRoot)
|
|
@@ -5477,210 +6120,251 @@ export function compileSwiftProjectUnit(
|
|
|
5477
6120
|
`swift-compile: no swift.org toolchain at ${options.toolchainBin}; install ${options.release} and its matching wasm sdk`,
|
|
5478
6121
|
)
|
|
5479
6122
|
}
|
|
5480
|
-
|
|
6123
|
+
return withSwiftRootLock(
|
|
5481
6124
|
swiftFrameworkScratch(frameworkKey),
|
|
5482
|
-
async () =>
|
|
5483
|
-
|
|
5484
|
-
|
|
5485
|
-
|
|
5486
|
-
const macroPlugins = await withSwiftRootLock(
|
|
5487
|
-
swiftFrameworkScratch(frameworkKey),
|
|
5488
|
-
async () =>
|
|
5489
|
-
ensureMacroPlugins(
|
|
6125
|
+
async (frameworkLease) => {
|
|
6126
|
+
const frameworkRoot = stageFrameworkSource(moduleRoot, frameworkKey)
|
|
6127
|
+
report('preparing compiler plugins')
|
|
6128
|
+
const macroPlugins = await ensureMacroPlugins(
|
|
5490
6129
|
frameworkRoot,
|
|
5491
6130
|
options.toolchainBin,
|
|
5492
6131
|
options.release,
|
|
5493
6132
|
options.signal,
|
|
5494
|
-
|
|
5495
|
-
|
|
5496
|
-
|
|
5497
|
-
|
|
5498
|
-
|
|
5499
|
-
|
|
5500
|
-
|
|
5501
|
-
|
|
5502
|
-
|
|
5503
|
-
|
|
5504
|
-
|
|
5505
|
-
|
|
6133
|
+
frameworkLease,
|
|
6134
|
+
)
|
|
6135
|
+
// memoized per toolchain, so only a process's first build waits on it,
|
|
6136
|
+
// and that one reads and gzips it while swift builds
|
|
6137
|
+
const sdk = swiftModuleSdk(frameworkRoot).wasmSdkId
|
|
6138
|
+
const icu = swiftIcuAsset(options.toolchainBin, sdk)
|
|
6139
|
+
const buildOptions = {
|
|
6140
|
+
env: {
|
|
6141
|
+
...(options.project?.env ?? process.env),
|
|
6142
|
+
// shipped host plugins resolve against the selected compiler's runtime.
|
|
6143
|
+
...(process.platform === 'linux'
|
|
6144
|
+
? {
|
|
6145
|
+
LD_LIBRARY_PATH: [
|
|
6146
|
+
path.resolve(options.toolchainBin, '../lib/swift/linux'),
|
|
6147
|
+
path.resolve(options.toolchainBin, '../lib/swift/host'),
|
|
6148
|
+
process.env.LD_LIBRARY_PATH,
|
|
6149
|
+
]
|
|
6150
|
+
.filter(Boolean)
|
|
6151
|
+
.join(':'),
|
|
6152
|
+
}
|
|
6153
|
+
: {}),
|
|
6154
|
+
...(input.lazyDistribution ? { PEACH_DEFER_WASM_LINK: '1' } : {}),
|
|
6155
|
+
},
|
|
6156
|
+
maxBuffer: 64 * 1024 * 1024,
|
|
6157
|
+
timeout: options.timeoutMs,
|
|
6158
|
+
signal: options.signal,
|
|
6159
|
+
lease,
|
|
6160
|
+
frameworkLease,
|
|
6161
|
+
}
|
|
6162
|
+
let prebuilt: SwiftFrameworkProducts | undefined
|
|
6163
|
+
if (!swiftDistributionAt(moduleRoot)) {
|
|
6164
|
+
report('compiling framework products')
|
|
6165
|
+
prebuilt = await compileFrameworkProducts({
|
|
6166
|
+
moduleRoot: frameworkRoot,
|
|
6167
|
+
frameworkKey,
|
|
6168
|
+
input,
|
|
6169
|
+
swift,
|
|
6170
|
+
sdk,
|
|
6171
|
+
toolchainBin: options.toolchainBin,
|
|
6172
|
+
plugins: macroPlugins,
|
|
6173
|
+
buildOptions,
|
|
6174
|
+
})
|
|
6175
|
+
await pruneFrameworkScratches(frameworkKey)
|
|
6176
|
+
}
|
|
6177
|
+
if (options.project) removeProjectLinks(root)
|
|
6178
|
+
if (
|
|
6179
|
+
retireStaleSwiftLink(
|
|
6180
|
+
root,
|
|
6181
|
+
swiftLinkStamp({
|
|
6182
|
+
frameworkKey,
|
|
6183
|
+
prebuilt,
|
|
6184
|
+
}),
|
|
6185
|
+
)
|
|
6186
|
+
)
|
|
6187
|
+
report('framework revision changed; rebuilding the app link')
|
|
6188
|
+
const preparation = writeSwiftProject(
|
|
6189
|
+
layout,
|
|
6190
|
+
input,
|
|
6191
|
+
frameworkRoot,
|
|
6192
|
+
prebuilt,
|
|
6193
|
+
)
|
|
6194
|
+
writeSwiftAutolinkLinker(root, options.toolchainBin)
|
|
6195
|
+
const projectProcess = options.project
|
|
6196
|
+
? prepareSwiftProjectProcess(root, options.project)
|
|
6197
|
+
: undefined
|
|
6198
|
+
const appOptions = projectProcess
|
|
5506
6199
|
? {
|
|
5507
|
-
|
|
5508
|
-
|
|
5509
|
-
|
|
5510
|
-
|
|
5511
|
-
]
|
|
5512
|
-
.filter(Boolean)
|
|
5513
|
-
.join(':'),
|
|
6200
|
+
...buildOptions,
|
|
6201
|
+
uid: projectProcess.uid,
|
|
6202
|
+
gid: projectProcess.gid,
|
|
6203
|
+
confined: projectProcess.env,
|
|
5514
6204
|
}
|
|
5515
|
-
:
|
|
5516
|
-
|
|
5517
|
-
|
|
5518
|
-
maxBuffer: 64 * 1024 * 1024,
|
|
5519
|
-
timeout: options.timeoutMs,
|
|
5520
|
-
signal: options.signal,
|
|
5521
|
-
lease,
|
|
5522
|
-
}
|
|
5523
|
-
let prebuilt:
|
|
5524
|
-
| { modules: string; objects: string[]; link: string[]; moduleMaps: string[] }
|
|
5525
|
-
| undefined
|
|
5526
|
-
if (!swiftDistributionAt(moduleRoot)) {
|
|
5527
|
-
report('compiling framework products')
|
|
5528
|
-
prebuilt = await compileFrameworkProducts({
|
|
5529
|
-
moduleRoot: frameworkRoot,
|
|
5530
|
-
frameworkKey,
|
|
5531
|
-
input,
|
|
5532
|
-
swift,
|
|
5533
|
-
sdk,
|
|
5534
|
-
toolchainBin: options.toolchainBin,
|
|
5535
|
-
plugins: macroPlugins,
|
|
5536
|
-
buildOptions,
|
|
5537
|
-
})
|
|
5538
|
-
await pruneFrameworkScratches(frameworkKey)
|
|
5539
|
-
}
|
|
5540
|
-
if (
|
|
5541
|
-
retireStaleSwiftLink(
|
|
5542
|
-
root,
|
|
5543
|
-
swiftLinkStamp({
|
|
5544
|
-
frameworkKey,
|
|
5545
|
-
prebuilt,
|
|
5546
|
-
}),
|
|
5547
|
-
)
|
|
5548
|
-
)
|
|
5549
|
-
report('framework revision changed; rebuilding the app link')
|
|
5550
|
-
const preparation = writeSwiftProject(layout, input, frameworkRoot, prebuilt)
|
|
5551
|
-
writeSwiftAutolinkLinker(root, options.toolchainBin)
|
|
5552
|
-
const unprepared = preparation.targetFailures.map(
|
|
5553
|
-
(failure) => `error: target ${failure}`,
|
|
5554
|
-
)
|
|
5555
|
-
const buildArgs = [
|
|
5556
|
-
'build',
|
|
5557
|
-
...swiftPackageCacheOptions(),
|
|
5558
|
-
'--build-system',
|
|
5559
|
-
'native',
|
|
5560
|
-
'-j',
|
|
5561
|
-
BUILD_JOBS,
|
|
5562
|
-
'--package-path',
|
|
5563
|
-
root,
|
|
5564
|
-
...swiftCompileSdkOptions(frameworkRoot, options.toolchainBin),
|
|
5565
|
-
'--swift-sdk',
|
|
5566
|
-
sdk,
|
|
5567
|
-
...(input.packageFiles || prebuilt
|
|
5568
|
-
? ['--toolset', path.join(root, '.peach-target-toolset.json')]
|
|
5569
|
-
: []),
|
|
5570
|
-
'-c',
|
|
5571
|
-
'release',
|
|
5572
|
-
'-Xswiftc',
|
|
5573
|
-
'-Osize',
|
|
5574
|
-
'-Xswiftc',
|
|
5575
|
-
'-num-threads',
|
|
5576
|
-
'-Xswiftc',
|
|
5577
|
-
BUILD_JOBS,
|
|
5578
|
-
...macroPlugins.libraries.flatMap((plugin) => [
|
|
5579
|
-
'-Xswiftc',
|
|
5580
|
-
'-load-plugin-library',
|
|
5581
|
-
'-Xswiftc',
|
|
5582
|
-
plugin,
|
|
5583
|
-
]),
|
|
5584
|
-
...macroPlugins.executables.flatMap((plugin) => [
|
|
5585
|
-
'-Xswiftc',
|
|
5586
|
-
'-load-plugin-executable',
|
|
5587
|
-
'-Xswiftc',
|
|
5588
|
-
`${plugin}#ExpoModulesMacros`,
|
|
5589
|
-
]),
|
|
5590
|
-
]
|
|
5591
|
-
const linked = builtArtifact(layout)
|
|
5592
|
-
if (input.lazyDistribution) {
|
|
5593
|
-
rmSync(path.join(root, '.peach-link.rsp'), { force: true })
|
|
5594
|
-
if (existsSync(linked) && statSync(linked).size <= 8)
|
|
5595
|
-
rmSync(linked, { force: true })
|
|
5596
|
-
}
|
|
5597
|
-
report('compiling and linking Swift modules')
|
|
5598
|
-
try {
|
|
5599
|
-
// clang consumes the real emitted headers after swift finishes.
|
|
5600
|
-
// swiftpm's transitive swift module maps are not C declarations:
|
|
5601
|
-
// importing them would shadow SDK modules such as ObjectiveC.
|
|
5602
|
-
for (const producer of preparation.headerProducers) {
|
|
5603
|
-
await runCompiler(
|
|
5604
|
-
swift,
|
|
5605
|
-
[...buildArgs, '--target', producer],
|
|
5606
|
-
buildOptions,
|
|
5607
|
-
SWIFTPM_PROGRESS,
|
|
5608
|
-
SWIFTPM_NOISE,
|
|
6205
|
+
: buildOptions
|
|
6206
|
+
const unprepared = preparation.targetFailures.map(
|
|
6207
|
+
(failure) => `error: target ${failure}`,
|
|
5609
6208
|
)
|
|
5610
|
-
|
|
5611
|
-
|
|
5612
|
-
|
|
5613
|
-
|
|
5614
|
-
|
|
5615
|
-
|
|
5616
|
-
|
|
5617
|
-
|
|
5618
|
-
|
|
5619
|
-
|
|
5620
|
-
|
|
5621
|
-
|
|
5622
|
-
|
|
5623
|
-
|
|
5624
|
-
|
|
5625
|
-
|
|
5626
|
-
|
|
5627
|
-
|
|
5628
|
-
|
|
5629
|
-
|
|
5630
|
-
|
|
5631
|
-
|
|
6209
|
+
const buildArgs = [
|
|
6210
|
+
'build',
|
|
6211
|
+
...(projectProcess?.cacheOptions ?? swiftPackageCacheOptions()),
|
|
6212
|
+
'--build-system',
|
|
6213
|
+
'native',
|
|
6214
|
+
'-j',
|
|
6215
|
+
BUILD_JOBS,
|
|
6216
|
+
'--package-path',
|
|
6217
|
+
root,
|
|
6218
|
+
...swiftCompileSdkOptions(frameworkRoot, options.toolchainBin),
|
|
6219
|
+
'--swift-sdk',
|
|
6220
|
+
sdk,
|
|
6221
|
+
...(input.packageFiles || prebuilt
|
|
6222
|
+
? ['--toolset', path.join(root, '.peach-target-toolset.json')]
|
|
6223
|
+
: []),
|
|
6224
|
+
'-c',
|
|
6225
|
+
'release',
|
|
6226
|
+
'-Xswiftc',
|
|
6227
|
+
'-num-threads',
|
|
6228
|
+
'-Xswiftc',
|
|
6229
|
+
BUILD_JOBS,
|
|
6230
|
+
...swiftReproducibleBuildFlags([
|
|
6231
|
+
[path.dirname(options.toolchainBin), 'toolchain'],
|
|
6232
|
+
[frameworkRoot, 'framework'],
|
|
6233
|
+
[root, 'build'],
|
|
6234
|
+
]),
|
|
6235
|
+
...macroPlugins.libraries.flatMap((plugin) => [
|
|
6236
|
+
'-Xswiftc',
|
|
6237
|
+
'-load-plugin-library',
|
|
6238
|
+
'-Xswiftc',
|
|
6239
|
+
plugin,
|
|
6240
|
+
]),
|
|
6241
|
+
...macroPlugins.executables.flatMap((plugin) => [
|
|
6242
|
+
'-Xswiftc',
|
|
6243
|
+
'-load-plugin-executable',
|
|
6244
|
+
'-Xswiftc',
|
|
6245
|
+
`${plugin}#ExpoModulesMacros`,
|
|
6246
|
+
]),
|
|
6247
|
+
]
|
|
6248
|
+
const linked = builtArtifact(layout)
|
|
6249
|
+
if (input.lazyDistribution) {
|
|
6250
|
+
rmSync(path.join(root, '.peach-link.rsp'), { force: true })
|
|
6251
|
+
if (existsSync(linked) && statSync(linked).size <= 8)
|
|
6252
|
+
rmSync(linked, { force: true })
|
|
6253
|
+
}
|
|
6254
|
+
report('compiling and linking Swift modules')
|
|
5632
6255
|
try {
|
|
6256
|
+
// clang consumes the real emitted headers after swift finishes.
|
|
6257
|
+
// swiftpm's transitive swift module maps are not C declarations:
|
|
6258
|
+
// importing them would shadow SDK modules such as ObjectiveC.
|
|
6259
|
+
for (const producer of preparation.headerProducers) {
|
|
6260
|
+
await runCompiler(
|
|
6261
|
+
swift,
|
|
6262
|
+
[...buildArgs, '--target', producer],
|
|
6263
|
+
appOptions,
|
|
6264
|
+
SWIFTPM_PROGRESS,
|
|
6265
|
+
SWIFTPM_NOISE,
|
|
6266
|
+
)
|
|
6267
|
+
const emitted = path.join(
|
|
6268
|
+
root,
|
|
6269
|
+
'.build',
|
|
6270
|
+
'peach-cxx-headers',
|
|
6271
|
+
`${producer}-Swift.h`,
|
|
6272
|
+
)
|
|
6273
|
+
if (existsSync(emitted))
|
|
6274
|
+
writeFileSync(
|
|
6275
|
+
emitted,
|
|
6276
|
+
clangInterfaceHeader(readFileSync(emitted, 'utf8')),
|
|
6277
|
+
)
|
|
6278
|
+
}
|
|
5633
6279
|
await runCompiler(
|
|
5634
6280
|
swift,
|
|
5635
6281
|
buildArgs,
|
|
5636
|
-
|
|
6282
|
+
appOptions,
|
|
5637
6283
|
SWIFTPM_PROGRESS,
|
|
5638
6284
|
SWIFTPM_NOISE,
|
|
5639
6285
|
)
|
|
5640
|
-
} catch (
|
|
6286
|
+
} catch (error) {
|
|
6287
|
+
const output = outputOf(error)
|
|
6288
|
+
const moduleCache = path.join(
|
|
6289
|
+
root,
|
|
6290
|
+
'.build',
|
|
6291
|
+
WASM_TRIPLE,
|
|
6292
|
+
'release',
|
|
6293
|
+
'ModuleCache',
|
|
6294
|
+
)
|
|
6295
|
+
if (
|
|
6296
|
+
output.includes('was compiled with module cache path') &&
|
|
6297
|
+
existsSync(moduleCache)
|
|
6298
|
+
) {
|
|
6299
|
+
rmSync(moduleCache, { recursive: true, force: true })
|
|
6300
|
+
try {
|
|
6301
|
+
await runCompiler(
|
|
6302
|
+
swift,
|
|
6303
|
+
buildArgs,
|
|
6304
|
+
appOptions,
|
|
6305
|
+
SWIFTPM_PROGRESS,
|
|
6306
|
+
SWIFTPM_NOISE,
|
|
6307
|
+
)
|
|
6308
|
+
} catch (retryError) {
|
|
6309
|
+
throw new Error(
|
|
6310
|
+
[
|
|
6311
|
+
...unprepared,
|
|
6312
|
+
projectDiagnostic(outputOf(retryError), layout, input.files),
|
|
6313
|
+
].join('\n'),
|
|
6314
|
+
{ cause: retryError },
|
|
6315
|
+
)
|
|
6316
|
+
}
|
|
6317
|
+
} else {
|
|
6318
|
+
throw new Error(
|
|
6319
|
+
[...unprepared, projectDiagnostic(output, layout, input.files)].join(
|
|
6320
|
+
'\n',
|
|
6321
|
+
),
|
|
6322
|
+
{ cause: error },
|
|
6323
|
+
)
|
|
6324
|
+
}
|
|
6325
|
+
} finally {
|
|
6326
|
+
// a manifest, macro or build tool can leave processes behind that
|
|
6327
|
+
// outlive the compiler's own group; none runs once the host reads.
|
|
6328
|
+
if (options.project) endSwiftProjectProcesses(options.project)
|
|
6329
|
+
}
|
|
6330
|
+
if (unprepared.length) throw new Error(unprepared.join('\n'))
|
|
6331
|
+
if (!existsSync(linked)) {
|
|
6332
|
+
const binDir = path.dirname(linked)
|
|
6333
|
+
const found = existsSync(binDir)
|
|
6334
|
+
? readdirSync(binDir)
|
|
6335
|
+
.filter((name) => name.endsWith('.wasm'))
|
|
6336
|
+
.sort()
|
|
6337
|
+
: []
|
|
5641
6338
|
throw new Error(
|
|
5642
|
-
|
|
5643
|
-
...unprepared,
|
|
5644
|
-
projectDiagnostic(outputOf(retryError), layout, input.files),
|
|
5645
|
-
].join('\n'),
|
|
5646
|
-
{ cause: retryError },
|
|
6339
|
+
`swift-compile: the build produced no ${path.basename(linked)} (found: ${found.join(', ') || 'none'})`,
|
|
5647
6340
|
)
|
|
5648
6341
|
}
|
|
5649
|
-
|
|
5650
|
-
|
|
5651
|
-
|
|
5652
|
-
|
|
5653
|
-
|
|
5654
|
-
|
|
5655
|
-
|
|
5656
|
-
|
|
5657
|
-
|
|
5658
|
-
|
|
5659
|
-
|
|
5660
|
-
|
|
5661
|
-
|
|
5662
|
-
|
|
5663
|
-
|
|
5664
|
-
|
|
5665
|
-
|
|
5666
|
-
|
|
5667
|
-
|
|
5668
|
-
|
|
5669
|
-
|
|
5670
|
-
|
|
5671
|
-
|
|
5672
|
-
|
|
5673
|
-
|
|
5674
|
-
|
|
5675
|
-
const artifact = {
|
|
5676
|
-
hash,
|
|
5677
|
-
bytes: readFileSync(input.lazyDistribution ? optimized : linked),
|
|
5678
|
-
icu: await icu,
|
|
5679
|
-
}
|
|
5680
|
-
saveCompiledArtifact(root, artifact)
|
|
5681
|
-
saveSharedArtifact(sharedRoot, artifact)
|
|
5682
|
-
report('compiled artifact verified')
|
|
5683
|
-
return retain(root, artifact)
|
|
6342
|
+
if (options.project) removeProjectLinks(root)
|
|
6343
|
+
const output = options.project
|
|
6344
|
+
? projectOutputFile(root, linked, options.project)
|
|
6345
|
+
: linked
|
|
6346
|
+
const optimized = `${output}.optimized`
|
|
6347
|
+
if (input.lazyDistribution) {
|
|
6348
|
+
pruneSwiftWasmLink(
|
|
6349
|
+
root,
|
|
6350
|
+
options.toolchainBin,
|
|
6351
|
+
frameworkRoot,
|
|
6352
|
+
input.staticClangTargets,
|
|
6353
|
+
)
|
|
6354
|
+
await optimizeWasm(output, optimized)
|
|
6355
|
+
}
|
|
6356
|
+
const artifact = {
|
|
6357
|
+
hash,
|
|
6358
|
+
bytes: readFileSync(input.lazyDistribution ? optimized : output),
|
|
6359
|
+
icu: await icu,
|
|
6360
|
+
}
|
|
6361
|
+
if (!options.project) saveCompiledArtifact(root, artifact)
|
|
6362
|
+
saveSharedArtifact(sharedRoot, artifact)
|
|
6363
|
+
report('compiled artifact verified')
|
|
6364
|
+
return retain(root, artifact)
|
|
6365
|
+
},
|
|
6366
|
+
options.signal,
|
|
6367
|
+
)
|
|
5684
6368
|
},
|
|
5685
6369
|
options.signal,
|
|
5686
6370
|
)
|