peachsim 0.1.1674 → 0.1.1692
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cli/commands/control.ts +13 -1
- package/cli/commands/coverage-swift.ts +150 -27
- package/cli/commands/coverage.ts +219 -20
- package/cli/commands/detect.ts +10 -6
- package/cli/commands/inspect/actions.ts +1 -0
- package/cli/commands/inspect/core.ts +2 -0
- package/cli/commands/inspect/wait-ready.ts +7 -0
- package/cli/commands/screenshot.ts +12 -0
- package/cli/outbound-endpoints.ts +12 -0
- package/detox/index.ts +11 -1
- package/detox/jest-environment.cjs +14 -0
- package/dist-lib/agent-daemon-client.cjs +1 -1
- package/dist-lib/agent-events.cjs +1 -1
- package/dist-lib/attached-projects.cjs +1 -1
- package/dist-lib/auth/shared-session.cjs +1 -1
- package/dist-lib/backend-origin.cjs +1 -1
- package/dist-lib/beta.cjs +1 -1
- package/dist-lib/beta.mjs +1 -1
- package/dist-lib/bridge-constants.cjs +1 -1
- package/dist-lib/bridge-contract-input.cjs +1 -1
- package/dist-lib/bridge-contract-input.mjs +1 -1
- package/dist-lib/bridge-contract.cjs +1 -1
- package/dist-lib/bridge-contract.mjs +1 -1
- package/dist-lib/bundle-channel.cjs +4833 -2432
- package/dist-lib/capture-contract.cjs +1 -1
- package/dist-lib/capture-contract.mjs +1 -1
- package/dist-lib/cloud-contract.cjs +1 -1
- package/dist-lib/cloud-contract.mjs +1 -1
- package/dist-lib/cloud-test-args.cjs +1 -1
- package/dist-lib/cloud-test-args.mjs +1 -1
- package/dist-lib/cloud.cjs +1 -1
- package/dist-lib/cloud.mjs +1 -1
- package/dist-lib/config.cjs +1 -1
- package/dist-lib/config.mjs +1 -1
- package/dist-lib/detox/index.cjs +6 -4
- package/dist-lib/detox/jest-environment.cjs +14 -0
- package/dist-lib/dev-bundle-resolution.cjs +1 -1
- package/dist-lib/expo-swift-bundle.cjs +3785 -1737
- package/dist-lib/expo-swift-metadata.cjs +1 -1
- package/dist-lib/expo-swift-metadata.mjs +1 -1
- package/dist-lib/home-paths.cjs +1 -1
- package/dist-lib/host/bridge-host.cjs +4253 -2205
- package/dist-lib/host/fetch-proxy-handler.cjs +20 -7
- package/dist-lib/host/fetch-proxy-overrides.cjs +1 -1
- package/dist-lib/host/fetch-proxy-overrides.mjs +1 -1
- package/dist-lib/host/replacement-module-handler.cjs +1 -1
- package/dist-lib/host/websocket-proxy.cjs +1 -1
- package/dist-lib/index.cjs +2065 -796
- package/dist-lib/jump-to-source-babel.cjs +1 -1
- package/dist-lib/jump-to-source-native.cjs +1 -1
- package/dist-lib/kotlin-host.cjs +1 -1
- package/dist-lib/menu.cjs +1 -1
- package/dist-lib/menu.mjs +1 -1
- package/dist-lib/metro-fingerprint-registry.cjs +1 -1
- package/dist-lib/metro-fingerprint-registry.mjs +1 -1
- package/dist-lib/metro-production-bundle.cjs +1 -1
- package/dist-lib/metro-production-bundle.mjs +1 -1
- package/dist-lib/metro.cjs +6325 -4287
- package/dist-lib/native-app-identity-project.cjs +192 -55
- package/dist-lib/native-app-identity-project.mjs +235 -86
- package/dist-lib/native-app-identity.cjs +1 -1
- package/dist-lib/native-app-identity.mjs +1 -1
- package/dist-lib/native-firebase-metadata.cjs +1 -1
- package/dist-lib/native-firebase-metadata.mjs +1 -1
- package/dist-lib/plist.cjs +1 -1
- package/dist-lib/plist.mjs +1 -1
- package/dist-lib/profiles.cjs +1 -1
- package/dist-lib/public-brand.cjs +1 -1
- package/dist-lib/public-origins-lib-esm.json +27 -23
- package/dist-lib/public-origins-lib-static.json +1 -1
- package/dist-lib/public-origins-lib.json +156 -87
- package/dist-lib/react-native-host-modules.cjs +1 -1
- package/dist-lib/react-native-host-modules.mjs +1 -1
- package/dist-lib/reap-browser.cjs +2 -2
- package/dist-lib/scripts/dev-server-scanner.cjs +1 -1
- package/dist-lib/sdk.cjs +3 -2
- package/dist-lib/sdk.mjs +3 -2
- package/dist-lib/skills.cjs +5036 -2833
- package/dist-lib/swift-compile.cjs +2937 -437
- package/dist-lib/swift-compile.mjs +2932 -435
- package/dist-lib/swift-package.cjs +137 -49
- package/dist-lib/swift-package.mjs +132 -49
- package/dist-lib/swift-submit.cjs +1 -1
- package/dist-lib/swift-submit.mjs +1 -1
- package/dist-lib/swift-toolchain.cjs +26 -11
- package/dist-lib/swift.cjs +1 -1
- package/dist-lib/vite-swift.cjs +6005 -1725
- package/dist-lib/vite.cjs +1911 -776
- package/dist-lib/worklet-executable.cjs +7 -4
- package/dist-lib/worklet-executable.mjs +7 -4
- package/dist-types/packages/peach-engine/src/engine/canvaskit-api.d.ts +1 -1
- package/dist-types/packages/peach-engine/src/engine/clipboardContract.d.ts +24 -2
- package/dist-types/packages/peach-engine/src/preview/upload-protocol.d.ts +11 -3
- package/dist-types/packages/peach-engine/src/webview-automation-host.d.ts +6 -0
- package/dist-types/packages/peach-globals/src/clipboardBridgeContract.d.ts +8 -0
- package/dist-types/packages/peach-globals/src/index.d.ts +1 -1
- package/dist-types/packages/peach-globals/src/nodeContract.d.ts +3 -2
- package/dist-types/packages/peach-kit/src/capabilities.d.ts +1 -0
- package/package.json +1 -1
- package/runtime-companion.json +1 -1
- package/sdk/ios/System/Library/Frameworks/CoreFoundation.framework/Headers/CoreFoundation.h +60 -2
- package/sdk/ios/System/Library/Frameworks/CoreLocation.framework/Headers/CLAvailability.h +22 -0
- package/sdk/ios/System/Library/Frameworks/CoreLocation.framework/Headers/CLBackgroundActivitySession.h +145 -0
- package/sdk/ios/System/Library/Frameworks/CoreLocation.framework/Headers/CLBeaconIdentityCondition.h +113 -0
- package/sdk/ios/System/Library/Frameworks/CoreLocation.framework/Headers/CLBeaconIdentityConstraint.h +34 -0
- package/sdk/ios/System/Library/Frameworks/CoreLocation.framework/Headers/CLBeaconRegion.h +225 -0
- package/sdk/ios/System/Library/Frameworks/CoreLocation.framework/Headers/CLBody.h +26 -0
- package/sdk/ios/System/Library/Frameworks/CoreLocation.framework/Headers/CLCircularGeographicCondition.h +59 -0
- package/sdk/ios/System/Library/Frameworks/CoreLocation.framework/Headers/CLCircularRegion.h +64 -0
- package/sdk/ios/System/Library/Frameworks/CoreLocation.framework/Headers/CLCondition.h +48 -0
- package/sdk/ios/System/Library/Frameworks/CoreLocation.framework/Headers/CLError.h +52 -0
- package/sdk/ios/System/Library/Frameworks/CoreLocation.framework/Headers/CLErrorDomain.h +24 -0
- package/sdk/ios/System/Library/Frameworks/CoreLocation.framework/Headers/CLGeocoder.h +55 -0
- package/sdk/ios/System/Library/Frameworks/CoreLocation.framework/Headers/CLHeading.h +117 -0
- package/sdk/ios/System/Library/Frameworks/CoreLocation.framework/Headers/CLLocation.h +9 -0
- package/sdk/ios/System/Library/Frameworks/CoreLocation.framework/Headers/CLLocationManager+CLVisitExtensions.h +45 -0
- package/sdk/ios/System/Library/Frameworks/CoreLocation.framework/Headers/CLLocationManager.h +877 -0
- package/sdk/ios/System/Library/Frameworks/CoreLocation.framework/Headers/CLLocationManagerDelegate.h +225 -0
- package/sdk/ios/System/Library/Frameworks/CoreLocation.framework/Headers/CLLocationPushServiceError.h +33 -0
- package/sdk/ios/System/Library/Frameworks/CoreLocation.framework/Headers/CLLocationPushServiceExtension.h +28 -0
- package/sdk/ios/System/Library/Frameworks/CoreLocation.framework/Headers/CLLocationUpdater.h +250 -0
- package/sdk/ios/System/Library/Frameworks/CoreLocation.framework/Headers/CLMonitor.h +140 -0
- package/sdk/ios/System/Library/Frameworks/CoreLocation.framework/Headers/CLMonitorConfiguration.h +77 -0
- package/sdk/ios/System/Library/Frameworks/CoreLocation.framework/Headers/CLMonitoringEvent.h +184 -0
- package/sdk/ios/System/Library/Frameworks/CoreLocation.framework/Headers/CLMonitoringRecord.h +57 -0
- package/sdk/ios/System/Library/Frameworks/CoreLocation.framework/Headers/CLPlacemark.h +98 -0
- package/sdk/ios/System/Library/Frameworks/CoreLocation.framework/Headers/CLRegion.h +123 -0
- package/sdk/ios/System/Library/Frameworks/CoreLocation.framework/Headers/CLServiceSession.h +211 -0
- package/sdk/ios/System/Library/Frameworks/CoreLocation.framework/Headers/CLVisit.h +66 -0
- package/sdk/ios/System/Library/Frameworks/CoreLocation.framework/Headers/CoreLocation.h +46 -0
- package/sdk/ios/System/Library/Frameworks/CoreLocation.framework/Modules/module.modulemap +7 -0
- package/sdk/ios/System/Library/Frameworks/Foundation.framework/Headers/Foundation.h +117 -2
- package/sdk/ios/System/Library/Frameworks/IOSurface.framework/Headers/IOSurfaceBase.h +52 -0
- package/sdk/ios/System/Library/Frameworks/IOSurface.framework/Headers/IOSurfaceObjC.h +240 -0
- package/sdk/ios/System/Library/Frameworks/IOSurface.framework/Headers/IOSurfaceRef.h +474 -0
- package/sdk/ios/System/Library/Frameworks/IOSurface.framework/Headers/IOSurfaceTypes.h +66 -0
- package/sdk/ios/System/Library/Frameworks/IOSurface.framework/Modules/module.modulemap +10 -0
- package/sdk/ios/System/Library/Frameworks/MessageUI.framework/Headers/MFComposeAssistantViewController.h +29 -0
- package/sdk/ios/System/Library/Frameworks/MessageUI.framework/Headers/MFMailComposeControllerDeferredAction.h +14 -0
- package/sdk/ios/System/Library/Frameworks/MessageUI.framework/Headers/MFMailComposeViewController.h +162 -0
- package/sdk/ios/System/Library/Frameworks/MessageUI.framework/Headers/MFMailDraft.h +24 -0
- package/sdk/ios/System/Library/Frameworks/MessageUI.framework/Headers/MFMessageComposeViewController+UPI.h +31 -0
- package/sdk/ios/System/Library/Frameworks/MessageUI.framework/Headers/MFMessageComposeViewController.h +169 -0
- package/sdk/ios/System/Library/Frameworks/MessageUI.framework/Headers/MessageUI.h +13 -0
- package/sdk/ios/System/Library/Frameworks/MessageUI.framework/Modules/module.modulemap +11 -0
- package/sdk/ios/System/Library/Frameworks/Metal.framework/Headers/MTL4AccelerationStructure.h +9 -0
- package/sdk/ios/System/Library/Frameworks/Metal.framework/Headers/MTL4Archive.h +16 -0
- package/sdk/ios/System/Library/Frameworks/Metal.framework/Headers/MTL4ArgumentTable.h +17 -0
- package/sdk/ios/System/Library/Frameworks/Metal.framework/Headers/MTL4BinaryFunction.h +13 -0
- package/sdk/ios/System/Library/Frameworks/Metal.framework/Headers/MTL4BinaryFunctionDescriptor.h +14 -0
- package/sdk/ios/System/Library/Frameworks/Metal.framework/Headers/MTL4BufferRange.h +79 -0
- package/sdk/ios/System/Library/Frameworks/Metal.framework/Headers/MTL4CommandAllocator.h +15 -0
- package/sdk/ios/System/Library/Frameworks/Metal.framework/Headers/MTL4CommandBuffer.h +17 -0
- package/sdk/ios/System/Library/Frameworks/Metal.framework/Headers/MTL4CommandEncoder.h +16 -0
- package/sdk/ios/System/Library/Frameworks/Metal.framework/Headers/MTL4CommandQueue.h +19 -0
- package/sdk/ios/System/Library/Frameworks/Metal.framework/Headers/MTL4CommitFeedback.h +15 -0
- package/sdk/ios/System/Library/Frameworks/Metal.framework/Headers/MTL4Compiler.h +13 -0
- package/sdk/ios/System/Library/Frameworks/Metal.framework/Headers/MTL4CompilerTask.h +13 -0
- package/sdk/ios/System/Library/Frameworks/Metal.framework/Headers/MTL4ComputeCommandEncoder.h +19 -0
- package/sdk/ios/System/Library/Frameworks/Metal.framework/Headers/MTL4ComputePipeline.h +13 -0
- package/sdk/ios/System/Library/Frameworks/Metal.framework/Headers/MTL4Counters.h +19 -0
- package/sdk/ios/System/Library/Frameworks/Metal.framework/Headers/MTL4FunctionDescriptor.h +13 -0
- package/sdk/ios/System/Library/Frameworks/Metal.framework/Headers/MTL4LibraryDescriptor.h +13 -0
- package/sdk/ios/System/Library/Frameworks/Metal.framework/Headers/MTL4LibraryFunctionDescriptor.h +13 -0
- package/sdk/ios/System/Library/Frameworks/Metal.framework/Headers/MTL4LinkingDescriptor.h +13 -0
- package/sdk/ios/System/Library/Frameworks/Metal.framework/Headers/MTL4MachineLearningCommandEncoder.h +17 -0
- package/sdk/ios/System/Library/Frameworks/Metal.framework/Headers/MTL4MachineLearningPipeline.h +13 -0
- package/sdk/ios/System/Library/Frameworks/Metal.framework/Headers/MTL4MeshRenderPipeline.h +13 -0
- package/sdk/ios/System/Library/Frameworks/Metal.framework/Headers/MTL4PipelineDataSetSerializer.h +13 -0
- package/sdk/ios/System/Library/Frameworks/Metal.framework/Headers/MTL4PipelineState.h +13 -0
- package/sdk/ios/System/Library/Frameworks/Metal.framework/Headers/MTL4RenderCommandEncoder.h +17 -0
- package/sdk/ios/System/Library/Frameworks/Metal.framework/Headers/MTL4RenderPass.h +17 -0
- package/sdk/ios/System/Library/Frameworks/Metal.framework/Headers/MTL4RenderPipeline.h +13 -0
- package/sdk/ios/System/Library/Frameworks/Metal.framework/Headers/MTL4SpecializedFunctionDescriptor.h +13 -0
- package/sdk/ios/System/Library/Frameworks/Metal.framework/Headers/MTL4StitchedFunctionDescriptor.h +13 -0
- package/sdk/ios/System/Library/Frameworks/Metal.framework/Headers/MTL4TileRenderPipeline.h +13 -0
- package/sdk/ios/System/Library/Frameworks/Metal.framework/Headers/MTLAccelerationStructure.h +1212 -0
- package/sdk/ios/System/Library/Frameworks/Metal.framework/Headers/MTLAccelerationStructureCommandEncoder.h +322 -0
- package/sdk/ios/System/Library/Frameworks/Metal.framework/Headers/MTLAccelerationStructureTypes.h +224 -0
- package/sdk/ios/System/Library/Frameworks/Metal.framework/Headers/MTLAllocation.h +22 -0
- package/sdk/ios/System/Library/Frameworks/Metal.framework/Headers/MTLArgument.h +279 -0
- package/sdk/ios/System/Library/Frameworks/Metal.framework/Headers/MTLArgumentEncoder.h +199 -0
- package/sdk/ios/System/Library/Frameworks/Metal.framework/Headers/MTLBinaryArchive.h +142 -0
- package/sdk/ios/System/Library/Frameworks/Metal.framework/Headers/MTLBlitCommandEncoder.h +266 -0
- package/sdk/ios/System/Library/Frameworks/Metal.framework/Headers/MTLBlitPass.h +82 -0
- package/sdk/ios/System/Library/Frameworks/Metal.framework/Headers/MTLBuffer.h +94 -0
- package/sdk/ios/System/Library/Frameworks/Metal.framework/Headers/MTLCaptureManager.h +113 -0
- package/sdk/ios/System/Library/Frameworks/Metal.framework/Headers/MTLCaptureScope.h +43 -0
- package/sdk/ios/System/Library/Frameworks/Metal.framework/Headers/MTLCommandBuffer.h +449 -0
- package/sdk/ios/System/Library/Frameworks/Metal.framework/Headers/MTLCommandEncoder.h +148 -0
- package/sdk/ios/System/Library/Frameworks/Metal.framework/Headers/MTLCommandQueue.h +102 -0
- package/sdk/ios/System/Library/Frameworks/Metal.framework/Headers/MTLComputeCommandEncoder.h +350 -0
- package/sdk/ios/System/Library/Frameworks/Metal.framework/Headers/MTLComputePass.h +90 -0
- package/sdk/ios/System/Library/Frameworks/Metal.framework/Headers/MTLComputePipeline.h +274 -0
- package/sdk/ios/System/Library/Frameworks/Metal.framework/Headers/MTLCounters.h +225 -0
- package/sdk/ios/System/Library/Frameworks/Metal.framework/Headers/MTLDataType.h +232 -0
- package/sdk/ios/System/Library/Frameworks/Metal.framework/Headers/MTLDefines.h +39 -0
- package/sdk/ios/System/Library/Frameworks/Metal.framework/Headers/MTLDepthStencil.h +93 -0
- package/sdk/ios/System/Library/Frameworks/Metal.framework/Headers/MTLDevice.h +1122 -0
- package/sdk/ios/System/Library/Frameworks/Metal.framework/Headers/MTLDeviceCertification.h +29 -0
- package/sdk/ios/System/Library/Frameworks/Metal.framework/Headers/MTLDrawable.h +36 -0
- package/sdk/ios/System/Library/Frameworks/Metal.framework/Headers/MTLDynamicLibrary.h +81 -0
- package/sdk/ios/System/Library/Frameworks/Metal.framework/Headers/MTLEvent.h +79 -0
- package/sdk/ios/System/Library/Frameworks/Metal.framework/Headers/MTLFence.h +22 -0
- package/sdk/ios/System/Library/Frameworks/Metal.framework/Headers/MTLFunctionConstantValues.h +30 -0
- package/sdk/ios/System/Library/Frameworks/Metal.framework/Headers/MTLFunctionDescriptor.h +95 -0
- package/sdk/ios/System/Library/Frameworks/Metal.framework/Headers/MTLFunctionHandle.h +29 -0
- package/sdk/ios/System/Library/Frameworks/Metal.framework/Headers/MTLFunctionLog.h +37 -0
- package/sdk/ios/System/Library/Frameworks/Metal.framework/Headers/MTLFunctionStitching.h +131 -0
- package/sdk/ios/System/Library/Frameworks/Metal.framework/Headers/MTLGPUAddress.h +19 -0
- package/sdk/ios/System/Library/Frameworks/Metal.framework/Headers/MTLHeap.h +284 -0
- package/sdk/ios/System/Library/Frameworks/Metal.framework/Headers/MTLIOCommandBuffer.h +10 -0
- package/sdk/ios/System/Library/Frameworks/Metal.framework/Headers/MTLIOCommandQueue.h +11 -0
- package/sdk/ios/System/Library/Frameworks/Metal.framework/Headers/MTLIOCompressor.h +10 -0
- package/sdk/ios/System/Library/Frameworks/Metal.framework/Headers/MTLIndirectCommandBuffer.h +157 -0
- package/sdk/ios/System/Library/Frameworks/Metal.framework/Headers/MTLIndirectCommandEncoder.h +110 -0
- package/sdk/ios/System/Library/Frameworks/Metal.framework/Headers/MTLIntersectionFunctionTable.h +186 -0
- package/sdk/ios/System/Library/Frameworks/Metal.framework/Headers/MTLLibrary.h +549 -0
- package/sdk/ios/System/Library/Frameworks/Metal.framework/Headers/MTLLinkedFunctions.h +57 -0
- package/sdk/ios/System/Library/Frameworks/Metal.framework/Headers/MTLLogState.h +65 -0
- package/sdk/ios/System/Library/Frameworks/Metal.framework/Headers/MTLParallelRenderCommandEncoder.h +77 -0
- package/sdk/ios/System/Library/Frameworks/Metal.framework/Headers/MTLPipeline.h +57 -0
- package/sdk/ios/System/Library/Frameworks/Metal.framework/Headers/MTLPixelFormat.h +342 -0
- package/sdk/ios/System/Library/Frameworks/Metal.framework/Headers/MTLRasterizationRate.h +323 -0
- package/sdk/ios/System/Library/Frameworks/Metal.framework/Headers/MTLRenderCommandEncoder.h +1068 -0
- package/sdk/ios/System/Library/Frameworks/Metal.framework/Headers/MTLRenderPass.h +411 -0
- package/sdk/ios/System/Library/Frameworks/Metal.framework/Headers/MTLRenderPipeline.h +788 -0
- package/sdk/ios/System/Library/Frameworks/Metal.framework/Headers/MTLResidencySet.h +141 -0
- package/sdk/ios/System/Library/Frameworks/Metal.framework/Headers/MTLResource.h +307 -0
- package/sdk/ios/System/Library/Frameworks/Metal.framework/Headers/MTLResourceStateCommandEncoder.h +125 -0
- package/sdk/ios/System/Library/Frameworks/Metal.framework/Headers/MTLResourceStatePass.h +85 -0
- package/sdk/ios/System/Library/Frameworks/Metal.framework/Headers/MTLResourceViewPool.h +22 -0
- package/sdk/ios/System/Library/Frameworks/Metal.framework/Headers/MTLSampler.h +252 -0
- package/sdk/ios/System/Library/Frameworks/Metal.framework/Headers/MTLStageInputOutputDescriptor.h +158 -0
- package/sdk/ios/System/Library/Frameworks/Metal.framework/Headers/MTLTensor.h +17 -0
- package/sdk/ios/System/Library/Frameworks/Metal.framework/Headers/MTLTexture.h +460 -0
- package/sdk/ios/System/Library/Frameworks/Metal.framework/Headers/MTLTextureViewPool.h +18 -0
- package/sdk/ios/System/Library/Frameworks/Metal.framework/Headers/MTLTypes.h +125 -0
- package/sdk/ios/System/Library/Frameworks/Metal.framework/Headers/MTLVertexDescriptor.h +153 -0
- package/sdk/ios/System/Library/Frameworks/Metal.framework/Headers/MTLVisibleFunctionTable.h +45 -0
- package/sdk/ios/System/Library/Frameworks/Metal.framework/Headers/Metal.h +94 -0
- package/sdk/ios/System/Library/Frameworks/Metal.framework/Modules/module.modulemap +6 -0
- package/sdk/ios/System/Library/Frameworks/UIKit.framework/Headers/UIKit.h +10 -0
- package/sdk/ios/System/Library/Frameworks/UniformTypeIdentifiers.framework/Headers/UTDefines.h +35 -0
- package/sdk/ios/System/Library/Frameworks/UniformTypeIdentifiers.framework/Headers/UTTagClass.h +33 -0
- package/sdk/ios/System/Library/Frameworks/UniformTypeIdentifiers.framework/Headers/UTType.h +504 -0
- package/sdk/ios/System/Library/Frameworks/_LocationEssentials.framework/Headers/CLEssentialsAvailability.h +14 -0
- package/sdk/ios/System/Library/Frameworks/_LocationEssentials.framework/Headers/CLLocationEssentials.h +444 -0
- package/sdk/ios/System/Library/Frameworks/_LocationEssentials.framework/Headers/LocationEssentials.h +14 -0
- package/sdk/ios/System/Library/Frameworks/_LocationEssentials.framework/Modules/module.modulemap +14 -0
- package/sdk/ios/usr/include/arm/param.h +151 -0
- package/sdk/ios/usr/include/complex.h +167 -0
- package/sdk/ios/usr/include/dispatch/dispatch.h +8 -0
- package/sdk/ios/usr/include/dlfcn.h +1 -2
- package/sdk/ios/usr/include/mach/mach_types.h +1 -0
- package/sdk/ios/usr/include/machine/param.h +42 -0
- package/sdk/ios/usr/include/math.h +835 -2
- package/sdk/ios/usr/include/net/if.h +1 -2
- package/sdk/ios/usr/include/peach/pthread.h +4 -4
- package/sdk/ios/usr/include/pthread/qos.h +304 -0
- package/sdk/ios/usr/include/sys/_types/_fd_clr.h +31 -0
- package/sdk/ios/usr/include/sys/_types/_fd_copy.h +31 -0
- package/sdk/ios/usr/include/sys/_types/_fd_def.h +121 -0
- package/sdk/ios/usr/include/sys/_types/_fd_isset.h +31 -0
- package/sdk/ios/usr/include/sys/_types/_fd_set.h +31 -0
- package/sdk/ios/usr/include/sys/_types/_fd_setsize.h +31 -0
- package/sdk/ios/usr/include/sys/_types/_fd_zero.h +31 -0
- package/sdk/ios/usr/include/sys/cdefs.h +3 -1
- package/sdk/ios/usr/include/sys/param.h +235 -0
- package/sdk/ios/usr/include/sys/proc.h +1 -0
- package/sdk/ios/usr/include/sys/qos.h +151 -12
- package/sdk/ios/wasm/include/__typedef_sigset_t.h +7 -0
- package/sdk/ios/wasm/include/fcntl.h +11 -0
- package/sdk/ios/wasm/include/mach/machine/boolean.h +2 -0
- package/sdk/ios/wasm/include/mach/machine/exception.h +5 -0
- package/sdk/ios/wasm/include/mach/machine/kern_return.h +2 -0
- package/sdk/ios/wasm/include/mach/machine/processor_info.h +2 -0
- package/sdk/ios/wasm/include/mach/machine/rpc.h +2 -0
- package/sdk/ios/wasm/include/mach/machine/thread_state.h +3 -0
- package/sdk/ios/wasm/include/mach/machine/thread_status.h +3 -0
- package/sdk/ios/wasm/include/mach/machine/vm_param.h +3 -0
- package/sdk/ios/wasm/include/mach/machine/vm_types.h +18 -0
- package/sdk/ios/wasm/include/machine/_types.h +153 -0
- package/sdk/ios/wasm/include/machine/endian.h +2 -0
- package/sdk/ios/wasm/include/machine/limits.h +2 -0
- package/sdk/ios/wasm/include/machine/types.h +30 -0
- package/sdk/ios/wasm/include/poll.h +8 -0
- package/sdk/ios/wasm/include/pthread.h +50 -0
- package/sdk/ios/wasm/include/signal.h +72 -0
- package/sdk/ios/wasm/include/stdlib.h +3 -0
- package/sdk/ios/wasm/include/string.h +10 -0
- package/sdk/ios/wasm/include/sys/_pthread/_pthread_attr_t.h +7 -0
- package/sdk/ios/wasm/include/sys/_pthread/_pthread_t.h +7 -0
- package/sdk/ios/wasm/include/sys/mman.h +122 -0
- package/sdk/ios/wasm/include/sys/select.h +37 -0
- package/sdk/ios/wasm/include/sys/signal.h +259 -0
- package/sdk/ios/wasm/include/sys/socket.h +8 -0
- package/sdk/ios/wasm/include/sys/types.h +14 -0
- package/sdk/ios/wasm/include/sys/ucontext.h +1 -0
- package/sdk/ios/wasm/include/sys/uio.h +11 -0
- package/sdk/ios/wasm/include/sys/wait.h +89 -0
- package/sdk/ios/wasm/include/time.h +8 -0
- package/sdk/ios/wasm/include/unistd.h +17 -0
- package/src/bridge-contract.ts +2 -0
- package/src/chromium-admission.ts +10 -5
- package/src/device-catalog.ts +4 -4
- package/src/generated/swift-c-predefines.json +1988 -0
- package/src/host/fetch-proxy-handler.ts +20 -0
- package/src/metro-plugin.ts +5 -2
- package/src/nitro-adapter.lock.json +6 -6
- package/src/nitro-bundle.ts +1 -0
- package/src/nitro-compile.ts +67 -2
- package/src/nitroContract.ts +18 -2
- package/src/numbered-lock.ts +72 -0
- package/src/react-native-coverage/capability-reference-resolution.ts +62 -5
- package/src/react-native-coverage/capability-source-references.ts +50 -13
- package/src/react-native-coverage/native-source-credit.ts +126 -0
- package/src/react-native-coverage/native-source-ranges-file.ts +38 -0
- package/src/react-native-coverage/native-surface.ts +49 -0
- package/src/react-native-coverage/verified-reach.ts +22 -2
- package/src/runtime-assets.ts +17 -0
- package/src/swift-compile.ts +530 -97
- package/src/swift-coverage/indexing.ts +17 -1
- package/src/swift-coverage/package.ts +3 -1
- package/src/swift-coverage/sdk.ts +71 -0
- package/src/swift-coverage/source.ts +74 -2
- package/src/swift-coverage/types.ts +6 -0
- package/src/swift-coverage/xcode-assets.ts +62 -2
- package/src/swift-coverage/xcode-packages.ts +11 -6
- package/src/swift-distribution.lock.json +12 -12
- package/src/swift-host.ts +457 -62
- package/src/swift-objc-compile.ts +26 -26
- package/src/swift-objc-metadata.ts +2 -8
- package/src/swift-objc-platform.ts +53 -0
- package/src/swift-objc-standin.ts +66 -12
- package/src/swift-package-manifest.ts +196 -28
- package/src/swift-package.ts +186 -60
- package/src/swift-packages.ts +298 -88
- package/src/swift-source-file.ts +10 -15
- package/src/swift-source-pods.ts +288 -0
- package/src/swift-standins.ts +87 -13
- package/src/swift-submit.ts +5 -0
- package/src/swift-toolchain.ts +32 -10
- package/src/swiftContract.ts +160 -75
- package/src/target-matcher.ts +15 -2
- package/src/vite-plugin-one.ts +5 -4
- package/src/worker-system-chunks.ts +7 -1
- package/src/worklet-executable.ts +7 -3
- package/src/xcode-json-project.ts +14 -2
- package/src/xcode-project.ts +193 -69
package/src/swift-host.ts
CHANGED
|
@@ -23,15 +23,25 @@ import {
|
|
|
23
23
|
compileTargets,
|
|
24
24
|
missingSwiftModules,
|
|
25
25
|
swiftAvailableModules,
|
|
26
|
+
swiftImportNames,
|
|
26
27
|
swiftPeachModules,
|
|
27
28
|
withNativeSourceGlue,
|
|
28
29
|
swiftModuleInputFiles,
|
|
29
30
|
swiftApplicationEntry,
|
|
31
|
+
swiftCDefinedNames,
|
|
32
|
+
swiftCMainEntry,
|
|
33
|
+
swiftCPredefines,
|
|
30
34
|
} from './swift-compile'
|
|
35
|
+
import {
|
|
36
|
+
assetSymbolText,
|
|
37
|
+
generatePackageAssetSymbols,
|
|
38
|
+
planAssetSymbols,
|
|
39
|
+
} from './swift-coverage/xcode-assets'
|
|
31
40
|
import { designTimeValues } from './swift-design-time'
|
|
32
41
|
import { swiftDistributionRoot, swiftModuleToolchain } from './swift-distribution'
|
|
33
42
|
import { xcodeObjCInputs } from './swift-objc-compile'
|
|
34
43
|
import {
|
|
44
|
+
isSwiftNativeTranslationUnit,
|
|
35
45
|
swiftImplicitResourcePaths,
|
|
36
46
|
swiftMetalSourceFiles,
|
|
37
47
|
swiftResourceBundles,
|
|
@@ -39,18 +49,27 @@ import {
|
|
|
39
49
|
swiftResourceBundleInfoPlist,
|
|
40
50
|
SWIFT_NATIVE_SOURCE_EXTENSIONS,
|
|
41
51
|
swiftTargetModuleName,
|
|
52
|
+
swiftPackageIdentity,
|
|
42
53
|
clangMacroSetting,
|
|
43
54
|
type SwiftPackageTarget,
|
|
44
55
|
} from './swift-package'
|
|
45
|
-
import { swiftPackageManifest } from './swift-package-manifest'
|
|
46
56
|
import {
|
|
57
|
+
swiftPackageManifest,
|
|
58
|
+
swiftTargetFiles,
|
|
59
|
+
swiftTargetResourceFiles,
|
|
60
|
+
} from './swift-package-manifest'
|
|
61
|
+
import {
|
|
62
|
+
prefetchSwiftCheckouts,
|
|
47
63
|
remoteSwiftCheckouts,
|
|
48
64
|
resolveSwiftPackages,
|
|
49
65
|
type SwiftPackageBinary,
|
|
50
66
|
type SwiftPackageGap,
|
|
51
67
|
type SwiftPackages,
|
|
52
68
|
} from './swift-packages'
|
|
53
|
-
import {
|
|
69
|
+
import {
|
|
70
|
+
packageInputPath,
|
|
71
|
+
readPackageFile as readSwiftSourceFile,
|
|
72
|
+
} from './swift-source-file'
|
|
54
73
|
import { readSwiftStandinBehavior } from './swift-standin-config'
|
|
55
74
|
import {
|
|
56
75
|
standinGenerationInputs,
|
|
@@ -79,11 +98,19 @@ import {
|
|
|
79
98
|
type SwiftImageUpload,
|
|
80
99
|
type SwiftNativeModules,
|
|
81
100
|
} from './swift-submit'
|
|
82
|
-
import {
|
|
101
|
+
import {
|
|
102
|
+
SWIFT_NATIVE_INPUT_ROOT,
|
|
103
|
+
SWIFT_NATIVE_SDK_INCLUDE,
|
|
104
|
+
swiftPackageInputNames,
|
|
105
|
+
swiftPackageInputBytes,
|
|
106
|
+
SWIFT_REMOTE_PACKAGES_DIR,
|
|
107
|
+
SWIFT_LOCAL_PACKAGES_DIR,
|
|
108
|
+
} from './swiftContract'
|
|
83
109
|
import {
|
|
84
110
|
enclosingXcodeWorkspace,
|
|
85
111
|
readXcodeAppTarget,
|
|
86
112
|
type XcodeAppTarget,
|
|
113
|
+
type XcodeModuleTarget,
|
|
87
114
|
} from './xcode-project'
|
|
88
115
|
import type { SwiftEntryModuleArgs } from '../../sootsim-swift/src/entryModule'
|
|
89
116
|
import type {
|
|
@@ -96,6 +123,7 @@ import type { SwiftCompileInput, SwiftIcuAsset } from './swift-compile'
|
|
|
96
123
|
import type { SwiftStandinBehaviors } from './swift-standin-emit'
|
|
97
124
|
import type {
|
|
98
125
|
SwiftMetalLibrarySource,
|
|
126
|
+
SwiftPackageFiles,
|
|
99
127
|
SwiftNativeTarget,
|
|
100
128
|
SwiftResourceBundle,
|
|
101
129
|
} from './swiftContract'
|
|
@@ -189,6 +217,9 @@ export interface SwiftProject {
|
|
|
189
217
|
hosted?: SwiftHostedCompileOptions
|
|
190
218
|
signal?: AbortSignal
|
|
191
219
|
libraries?: Record<string, string>
|
|
220
|
+
nativeTargets?: SwiftNativeTarget[]
|
|
221
|
+
resourceBundles?: SwiftResourceBundle[]
|
|
222
|
+
bundleFiles?: SwiftBundlePack
|
|
192
223
|
}
|
|
193
224
|
|
|
194
225
|
// a project is its swiftpm package: the build, the artifact, and the dev
|
|
@@ -257,6 +288,55 @@ interface XcodeProjectEntry {
|
|
|
257
288
|
|
|
258
289
|
const xcodeProjects = new Map<string, XcodeProjectEntry>()
|
|
259
290
|
|
|
291
|
+
// run script phases read SourcePackages/checkouts from disk, but the pins
|
|
292
|
+
// and the checkout root only exist after a first read. read once without
|
|
293
|
+
// running scripts, fetch the pins the way xcode's resolution does, link
|
|
294
|
+
// each used project's derived-data sibling at them, then read for real.
|
|
295
|
+
// once per project per process: the checkouts persist and the link is
|
|
296
|
+
// idempotent, and a later re-resolve refetches through the same writer.
|
|
297
|
+
const preparedScriptInputs = new Set<string>()
|
|
298
|
+
function readXcodeAppTargetPrepared(
|
|
299
|
+
input: string,
|
|
300
|
+
target: string | undefined,
|
|
301
|
+
configuration: string | undefined,
|
|
302
|
+
options: {
|
|
303
|
+
requireSources?: boolean
|
|
304
|
+
prepareGeneratedSources?: boolean
|
|
305
|
+
installedPods?: boolean
|
|
306
|
+
},
|
|
307
|
+
): XcodeAppTarget {
|
|
308
|
+
if (options.prepareGeneratedSources !== true)
|
|
309
|
+
return readXcodeAppTarget(input, target, configuration, options)
|
|
310
|
+
const key = JSON.stringify([input, target, configuration])
|
|
311
|
+
if (!preparedScriptInputs.has(key)) {
|
|
312
|
+
const probe = readXcodeAppTarget(input, target, configuration, {
|
|
313
|
+
...options,
|
|
314
|
+
prepareGeneratedSources: false,
|
|
315
|
+
requireSources: false,
|
|
316
|
+
})
|
|
317
|
+
prefetchSwiftCheckouts(probe.rootDir, probe.packageResolved)
|
|
318
|
+
const checkouts = remoteSwiftCheckouts(probe.rootDir)
|
|
319
|
+
for (const projectDir of probe.projectDirs) {
|
|
320
|
+
const packages = path.join(projectDir, '.build', 'peach-xcode', 'SourcePackages')
|
|
321
|
+
fs.mkdirSync(packages, { recursive: true })
|
|
322
|
+
const link = path.join(packages, 'checkouts')
|
|
323
|
+
let linked: string | null = null
|
|
324
|
+
try {
|
|
325
|
+
linked = fs.lstatSync(link).isSymbolicLink() ? fs.readlinkSync(link) : null
|
|
326
|
+
} catch {
|
|
327
|
+
linked = null
|
|
328
|
+
}
|
|
329
|
+
if (linked !== null) {
|
|
330
|
+
if (path.resolve(packages, linked) === checkouts) continue
|
|
331
|
+
fs.unlinkSync(link)
|
|
332
|
+
} else if (fs.existsSync(link)) continue
|
|
333
|
+
fs.symlinkSync(checkouts, link)
|
|
334
|
+
}
|
|
335
|
+
preparedScriptInputs.add(key)
|
|
336
|
+
}
|
|
337
|
+
return readXcodeAppTarget(input, target, configuration, options)
|
|
338
|
+
}
|
|
339
|
+
|
|
260
340
|
/**
|
|
261
341
|
* registers an xcode project's application target as a compile unit and
|
|
262
342
|
* returns the package path that names it. compiling locally against
|
|
@@ -269,7 +349,7 @@ export function openXcodeProject(
|
|
|
269
349
|
moduleRoot: string | undefined,
|
|
270
350
|
configuration?: string,
|
|
271
351
|
): string {
|
|
272
|
-
const app =
|
|
352
|
+
const app = readXcodeAppTargetPrepared(xcodeproj, target, configuration, {
|
|
273
353
|
prepareGeneratedSources: true,
|
|
274
354
|
installedPods: true,
|
|
275
355
|
})
|
|
@@ -419,7 +499,7 @@ export const XCODE_APP_DIR = '__app__'
|
|
|
419
499
|
const XCODE_FRAMEWORKS_DIR = '__frameworks__'
|
|
420
500
|
// remote package checkouts compile here: swiftpm owns `.build` in the
|
|
421
501
|
// compile's package root as its scratch directory.
|
|
422
|
-
const XCODE_PACKAGES_DIR =
|
|
502
|
+
const XCODE_PACKAGES_DIR = SWIFT_REMOTE_PACKAGES_DIR
|
|
423
503
|
|
|
424
504
|
// the compile input key of a root-relative path in an xcode layout.
|
|
425
505
|
function xcodeInputKey(
|
|
@@ -443,6 +523,8 @@ interface XcodeLayout {
|
|
|
443
523
|
/** framework and package targets, with root-relative paths and the nested target directories they exclude. */
|
|
444
524
|
targets: (SwiftPackageTarget & { exclude: string[] })[]
|
|
445
525
|
packages: SwiftPackages
|
|
526
|
+
packagePaths: Map<string, string>
|
|
527
|
+
packageFiles: Map<string, string>
|
|
446
528
|
standins: SwiftStandin[]
|
|
447
529
|
/** the binary targets the stand-ins come from. */
|
|
448
530
|
binaries: SwiftPackageBinary[]
|
|
@@ -451,6 +533,8 @@ interface XcodeLayout {
|
|
|
451
533
|
/** the input directory each app and framework source compiles under. */
|
|
452
534
|
targetDirs: Map<string, string>
|
|
453
535
|
resourceBundles: SwiftResourceBundle[]
|
|
536
|
+
/** the symbol sources xcode generates from package target catalogs, by input key. */
|
|
537
|
+
generatedSources: Record<string, string>
|
|
454
538
|
nativeTargets: SwiftNativeTarget[]
|
|
455
539
|
nativeFiles: Map<string, Buffer>
|
|
456
540
|
files: string[]
|
|
@@ -459,7 +543,7 @@ interface XcodeLayout {
|
|
|
459
543
|
function xcodeLayout(root: string): XcodeLayout | null {
|
|
460
544
|
const registered = xcodeProjects.get(root)
|
|
461
545
|
if (!registered) return null
|
|
462
|
-
const app =
|
|
546
|
+
const app = readXcodeAppTargetPrepared(
|
|
463
547
|
registered.xcodeproj,
|
|
464
548
|
registered.target,
|
|
465
549
|
registered.configuration,
|
|
@@ -480,6 +564,20 @@ function xcodeLayout(root: string): XcodeLayout | null {
|
|
|
480
564
|
{ target: app.moduleName, sourcePath: XCODE_APP_DIR, path: '.' },
|
|
481
565
|
]
|
|
482
566
|
const targets: XcodeLayout['targets'] = []
|
|
567
|
+
const generatedSources: Record<string, string> = {}
|
|
568
|
+
// xcode generates symbols for each target's own catalogs from its own settings
|
|
569
|
+
const targetAssetSymbols = (module: XcodeModuleTarget, dir: string) => {
|
|
570
|
+
const plan = planAssetSymbols(
|
|
571
|
+
module.resources.map((file) => path.relative(root, file)),
|
|
572
|
+
root,
|
|
573
|
+
module.assetSettings,
|
|
574
|
+
)
|
|
575
|
+
if (plan.status === 'unknown') throw new Error(`${module.name}: ${plan.reason}`)
|
|
576
|
+
if (plan.status === 'plan')
|
|
577
|
+
generatedSources[path.posix.join(dir, 'GeneratedAssetSymbols.swift')] =
|
|
578
|
+
assetSymbolText(plan.plan, root)
|
|
579
|
+
}
|
|
580
|
+
targetAssetSymbols(app, XCODE_APP_DIR)
|
|
483
581
|
for (const framework of app.frameworks) {
|
|
484
582
|
const dir = path.posix.join(XCODE_FRAMEWORKS_DIR, framework.moduleName)
|
|
485
583
|
resourceBundles.push({
|
|
@@ -497,6 +595,7 @@ function xcodeLayout(root: string): XcodeLayout | null {
|
|
|
497
595
|
targetDirs.set(file, dir)
|
|
498
596
|
files.add(file)
|
|
499
597
|
}
|
|
598
|
+
targetAssetSymbols(framework, dir)
|
|
500
599
|
targets.push({
|
|
501
600
|
name: framework.moduleName,
|
|
502
601
|
path: dir,
|
|
@@ -509,10 +608,58 @@ function xcodeLayout(root: string): XcodeLayout | null {
|
|
|
509
608
|
})
|
|
510
609
|
}
|
|
511
610
|
const { packages, standins, projectGaps, binaries } = swiftPackages(registered, app)
|
|
611
|
+
const packagePaths = new Map<string, string>()
|
|
612
|
+
const packageFiles = new Map<string, string>()
|
|
613
|
+
let localPackageRoot = root
|
|
614
|
+
for (const { manifest, remote } of packages.nativePackages) {
|
|
615
|
+
if (remote) continue
|
|
616
|
+
let relative = path.relative(localPackageRoot, manifest.dir)
|
|
617
|
+
while (relative === '..' || relative.startsWith(`..${path.sep}`)) {
|
|
618
|
+
localPackageRoot = path.dirname(localPackageRoot)
|
|
619
|
+
relative = path.relative(localPackageRoot, manifest.dir)
|
|
620
|
+
}
|
|
621
|
+
}
|
|
622
|
+
for (const { manifest, remote } of packages.nativePackages) {
|
|
623
|
+
const directory = remote
|
|
624
|
+
? path.posix.join(
|
|
625
|
+
XCODE_PACKAGES_DIR,
|
|
626
|
+
path
|
|
627
|
+
.relative(remoteSwiftCheckouts(root), manifest.dir)
|
|
628
|
+
.split(path.sep)
|
|
629
|
+
.join('/'),
|
|
630
|
+
)
|
|
631
|
+
: path.posix.join(
|
|
632
|
+
SWIFT_LOCAL_PACKAGES_DIR,
|
|
633
|
+
path.basename(localPackageRoot),
|
|
634
|
+
path.relative(localPackageRoot, manifest.dir).split(path.sep).join('/'),
|
|
635
|
+
)
|
|
636
|
+
packagePaths.set(manifest.dir, directory)
|
|
637
|
+
const manifests = fs
|
|
638
|
+
.readdirSync(manifest.dir)
|
|
639
|
+
.filter((name) => /^Package(@swift-[\d.]+)?\.swift$/.test(name))
|
|
640
|
+
.map((name) => path.join(manifest.dir, name))
|
|
641
|
+
for (const file of new Set([
|
|
642
|
+
...manifests,
|
|
643
|
+
...[...manifest.targets.values()].flatMap((target) => [
|
|
644
|
+
...swiftTargetFiles(manifest, target),
|
|
645
|
+
...swiftTargetResourceFiles(manifest, target),
|
|
646
|
+
]),
|
|
647
|
+
])) {
|
|
648
|
+
packageFiles.set(
|
|
649
|
+
file,
|
|
650
|
+
path.posix.join(
|
|
651
|
+
directory,
|
|
652
|
+
path.relative(manifest.dir, file).split(path.sep).join('/'),
|
|
653
|
+
),
|
|
654
|
+
)
|
|
655
|
+
files.add(file)
|
|
656
|
+
}
|
|
657
|
+
}
|
|
512
658
|
for (const standin of standins)
|
|
513
659
|
targets.push({
|
|
514
660
|
name: standin.module,
|
|
515
661
|
path: path.posix.join(SWIFT_STANDINS_DIR, standin.module),
|
|
662
|
+
publicHeadersPath: standin.publicHeadersPath,
|
|
516
663
|
dependencies: standin.dependencies?.map((name) => ({ kind: 'target', name })),
|
|
517
664
|
executable: false,
|
|
518
665
|
resources: false,
|
|
@@ -557,6 +704,27 @@ function xcodeLayout(root: string): XcodeLayout | null {
|
|
|
557
704
|
)
|
|
558
705
|
.map((define) => define.name),
|
|
559
706
|
],
|
|
707
|
+
experimentalFeatures: target.packageExperimentalFeatures
|
|
708
|
+
.filter(
|
|
709
|
+
(feature) =>
|
|
710
|
+
feature.configuration === null ||
|
|
711
|
+
feature.configuration === packageConfiguration,
|
|
712
|
+
)
|
|
713
|
+
.map((feature) => feature.name),
|
|
714
|
+
upcomingFeatures: target.packageUpcomingFeatures
|
|
715
|
+
.filter(
|
|
716
|
+
(feature) =>
|
|
717
|
+
feature.configuration === null ||
|
|
718
|
+
feature.configuration === packageConfiguration,
|
|
719
|
+
)
|
|
720
|
+
.map((feature) => feature.name),
|
|
721
|
+
swiftFlags: target.packageSwiftFlags
|
|
722
|
+
.filter(
|
|
723
|
+
(setting) =>
|
|
724
|
+
setting.configuration === null ||
|
|
725
|
+
setting.configuration === packageConfiguration,
|
|
726
|
+
)
|
|
727
|
+
.flatMap((setting) => setting.flags),
|
|
560
728
|
linkedLibraries: target.packageLibraries
|
|
561
729
|
.filter(
|
|
562
730
|
(library) =>
|
|
@@ -574,6 +742,31 @@ function xcodeLayout(root: string): XcodeLayout | null {
|
|
|
574
742
|
}
|
|
575
743
|
if (!target.remote) files.add(path.join(target.packageDir, 'Package.swift'))
|
|
576
744
|
for (const file of target.files) files.add(file)
|
|
745
|
+
const catalogs = [
|
|
746
|
+
...new Set(
|
|
747
|
+
target.files.flatMap((file) => {
|
|
748
|
+
const at = file.indexOf(`.xcassets${path.sep}`)
|
|
749
|
+
return at >= 0 ? [file.slice(0, at + '.xcassets'.length)] : []
|
|
750
|
+
}),
|
|
751
|
+
),
|
|
752
|
+
].sort()
|
|
753
|
+
if (catalogs.length > 0) {
|
|
754
|
+
if (!target.iosDeployment)
|
|
755
|
+
throw new Error(
|
|
756
|
+
`${target.name}: asset symbols for a package that declares no iOS platform are unproven`,
|
|
757
|
+
)
|
|
758
|
+
generatedSources[
|
|
759
|
+
path.posix.join(
|
|
760
|
+
target.remote ? path.posix.join(XCODE_PACKAGES_DIR, posix) : posix,
|
|
761
|
+
'GeneratedAssetSymbols.swift',
|
|
762
|
+
)
|
|
763
|
+
] = generatePackageAssetSymbols(
|
|
764
|
+
catalogs,
|
|
765
|
+
target.packageDir,
|
|
766
|
+
target.iosDeployment,
|
|
767
|
+
`${path.basename(target.packageDir).toLowerCase()}.${target.name}`,
|
|
768
|
+
)
|
|
769
|
+
}
|
|
577
770
|
}
|
|
578
771
|
// swiftpm assigns a file to one target: a target directory nested in
|
|
579
772
|
// another's is that one's exclusion
|
|
@@ -643,7 +836,9 @@ function xcodeLayout(root: string): XcodeLayout | null {
|
|
|
643
836
|
)
|
|
644
837
|
.map(relative),
|
|
645
838
|
userHeaderSearchPaths: settings.userHeaderSearchPaths.map(relative),
|
|
646
|
-
frameworkSearchPaths:
|
|
839
|
+
frameworkSearchPaths: nativeInputs.targets
|
|
840
|
+
.find((value) => value.name === target.moduleName)!
|
|
841
|
+
.frameworks.map(relative),
|
|
647
842
|
// the same prepared maps and overlay the implementation compile stages
|
|
648
843
|
headerMaps: settings.headerMaps.map((map) => ({
|
|
649
844
|
flag: map.flag,
|
|
@@ -678,7 +873,7 @@ function xcodeLayout(root: string): XcodeLayout | null {
|
|
|
678
873
|
),
|
|
679
874
|
sourceDirectories: Object.fromEntries(
|
|
680
875
|
target.allSources
|
|
681
|
-
.filter(
|
|
876
|
+
.filter(isSwiftNativeTranslationUnit)
|
|
682
877
|
.map((file) => [relative(file), relative(path.dirname(file))]),
|
|
683
878
|
),
|
|
684
879
|
},
|
|
@@ -719,11 +914,14 @@ function xcodeLayout(root: string): XcodeLayout | null {
|
|
|
719
914
|
app,
|
|
720
915
|
targets,
|
|
721
916
|
packages,
|
|
917
|
+
packagePaths,
|
|
918
|
+
packageFiles,
|
|
722
919
|
standins,
|
|
723
920
|
binaries,
|
|
724
921
|
projectGaps,
|
|
725
922
|
targetDirs,
|
|
726
923
|
resourceBundles,
|
|
924
|
+
generatedSources,
|
|
727
925
|
nativeTargets,
|
|
728
926
|
nativeFiles,
|
|
729
927
|
files: [...files].sort(),
|
|
@@ -733,15 +931,57 @@ function xcodeLayout(root: string): XcodeLayout | null {
|
|
|
733
931
|
// the manifest the compile reads for an xcode app: the app target and each
|
|
734
932
|
// framework and package target, in the forms swiftManifestTargets scans.
|
|
735
933
|
function xcodeManifest(layout: XcodeLayout): string {
|
|
934
|
+
const nativePaths = new Map(
|
|
935
|
+
[...layout.packagePaths].map(([directory, relative]) => [
|
|
936
|
+
swiftPackageIdentity(directory),
|
|
937
|
+
relative,
|
|
938
|
+
]),
|
|
939
|
+
)
|
|
940
|
+
const nativeProducts = layout.packages.nativeProducts
|
|
941
|
+
const productDependency = (name: string, packageDir: string | null) => {
|
|
942
|
+
if (packageDir === null) throw new Error(`unresolved package for product ${name}`)
|
|
943
|
+
return `.product(name: ${JSON.stringify(name)}, package: ${JSON.stringify(swiftPackageIdentity(packageDir))})`
|
|
944
|
+
}
|
|
945
|
+
const dependencies = (target: SwiftPackageTarget) =>
|
|
946
|
+
(target.dependencies ?? [])
|
|
947
|
+
.map((dependency) =>
|
|
948
|
+
dependency.kind === 'product'
|
|
949
|
+
? productDependency(dependency.name, dependency.package)
|
|
950
|
+
: JSON.stringify(dependency.name),
|
|
951
|
+
)
|
|
952
|
+
.join(', ')
|
|
953
|
+
const appProducts = layout.app.linkedProducts.flatMap(({ product, source }) => {
|
|
954
|
+
const native = nativeProducts.find(
|
|
955
|
+
({ name, source: origin }) =>
|
|
956
|
+
name === product &&
|
|
957
|
+
(source.kind === 'unnamed' ||
|
|
958
|
+
origin === (source.kind === 'remote' ? source.url : path.resolve(source.dir))),
|
|
959
|
+
)
|
|
960
|
+
return native ? [productDependency(native.name, native.packageDir)] : []
|
|
961
|
+
})
|
|
736
962
|
const settings = (target: {
|
|
737
963
|
languageMode: number
|
|
738
964
|
mainActorIsolation: boolean
|
|
739
965
|
defines?: string[]
|
|
966
|
+
experimentalFeatures?: string[]
|
|
967
|
+
upcomingFeatures?: string[]
|
|
968
|
+
swiftFlags?: string[]
|
|
740
969
|
}) =>
|
|
741
970
|
`swiftSettings: [${[
|
|
742
971
|
`.swiftLanguageMode(.v${target.languageMode})`,
|
|
743
972
|
...(target.mainActorIsolation ? ['.defaultIsolation(MainActor.self)'] : []),
|
|
744
973
|
...(target.defines ?? []).map((name) => `.define(${JSON.stringify(name)})`),
|
|
974
|
+
...(target.experimentalFeatures ?? []).map(
|
|
975
|
+
(name) => `.enableExperimentalFeature(${JSON.stringify(name)})`,
|
|
976
|
+
),
|
|
977
|
+
...(target.upcomingFeatures ?? []).map(
|
|
978
|
+
(name) => `.enableUpcomingFeature(${JSON.stringify(name)})`,
|
|
979
|
+
),
|
|
980
|
+
...(target.swiftFlags?.length
|
|
981
|
+
? [
|
|
982
|
+
`.unsafeFlags([${target.swiftFlags.map((flag) => JSON.stringify(flag)).join(', ')}])`,
|
|
983
|
+
]
|
|
984
|
+
: []),
|
|
745
985
|
].join(', ')}]`
|
|
746
986
|
const clangSettings = (target: SwiftPackageTarget) =>
|
|
747
987
|
(
|
|
@@ -761,12 +1001,12 @@ function xcodeManifest(layout: XcodeLayout): string {
|
|
|
761
1001
|
return [
|
|
762
1002
|
'// swift-tools-version: 6.2',
|
|
763
1003
|
'import PackageDescription',
|
|
764
|
-
|
|
765
|
-
` .executableTarget(name: "${layout.app.moduleName}", path: "${XCODE_APP_DIR}", ${settings(layout.app)}),`,
|
|
1004
|
+
`let package = Package(name: "app", dependencies: [${[...nativePaths].map(([name, directory]) => `.package(name: ${JSON.stringify(name)}, path: ${JSON.stringify(directory)})`).join(', ')}], targets: [`,
|
|
1005
|
+
` .executableTarget(name: "${layout.app.moduleName}", dependencies: [${appProducts.join(', ')}], path: "${XCODE_APP_DIR}", ${settings(layout.app)}),`,
|
|
766
1006
|
...layout.targets.map((target) =>
|
|
767
1007
|
target.systemLibrary
|
|
768
1008
|
? ` .systemLibrary(name: "${target.name}", path: "${target.path}"),`
|
|
769
|
-
: ` .target(name: "${target.name}", dependencies: ${
|
|
1009
|
+
: ` .target(name: "${target.name}", dependencies: [${dependencies(target)}], path: "${target.path}", ${target.exclude.length > 0 ? `exclude: ${JSON.stringify(target.exclude)}, ` : ''}${target.resources ? 'resources: [], ' : ''}${target.publicHeadersPath === undefined ? '' : `publicHeadersPath: ${JSON.stringify(target.publicHeadersPath)}, `}${clangSettings(target)}${settings(target)}${libraries(target)}),`,
|
|
770
1010
|
),
|
|
771
1011
|
'])',
|
|
772
1012
|
'',
|
|
@@ -794,8 +1034,12 @@ function packageFiles(root: string, includeBuildInputs = true): string[] {
|
|
|
794
1034
|
function readPackageFile(root: string, file: string, maxBytes: number): Buffer {
|
|
795
1035
|
if (xcodeProjects.has(root)) {
|
|
796
1036
|
const checkouts = remoteSwiftCheckouts(root)
|
|
797
|
-
if (file.startsWith(`${checkouts}${path.sep}`))
|
|
798
|
-
|
|
1037
|
+
if (file.startsWith(`${checkouts}${path.sep}`)) {
|
|
1038
|
+
const checkout = path.relative(checkouts, file).split(path.sep)[0]
|
|
1039
|
+
if (!checkout || checkout === '..')
|
|
1040
|
+
throw new Error(`swift input escapes the selected package: ${file}`)
|
|
1041
|
+
return readSwiftSourceFile(path.join(checkouts, checkout), file, maxBytes)
|
|
1042
|
+
}
|
|
799
1043
|
}
|
|
800
1044
|
return readSwiftSourceFile(root, file, maxBytes)
|
|
801
1045
|
}
|
|
@@ -803,7 +1047,12 @@ function readPackageFile(root: string, file: string, maxBytes: number): Buffer {
|
|
|
803
1047
|
// every input file under `dir`, which must stay inside `canonicalRoot`.
|
|
804
1048
|
function sourceTreeFiles(dir: string, canonicalRoot: string): string[] {
|
|
805
1049
|
const found: string[] = []
|
|
1050
|
+
const ancestors = new Set<string>()
|
|
806
1051
|
const walk = (dir: string): void => {
|
|
1052
|
+
const realDirectory = packageInputPath(canonicalRoot, dir)
|
|
1053
|
+
if (ancestors.has(realDirectory))
|
|
1054
|
+
throw new Error(`swift input directory cycle: ${dir}`)
|
|
1055
|
+
ancestors.add(realDirectory)
|
|
807
1056
|
for (const entry of fs
|
|
808
1057
|
.readdirSync(dir, { withFileTypes: true })
|
|
809
1058
|
.sort((left, right) => left.name.localeCompare(right.name))) {
|
|
@@ -818,26 +1067,31 @@ function sourceTreeFiles(dir: string, canonicalRoot: string): string[] {
|
|
|
818
1067
|
)
|
|
819
1068
|
continue
|
|
820
1069
|
const full = path.join(dir, entry.name)
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
1070
|
+
let real: string
|
|
1071
|
+
try {
|
|
1072
|
+
real = packageInputPath(canonicalRoot, full)
|
|
1073
|
+
} catch (error) {
|
|
1074
|
+
if (
|
|
1075
|
+
entry.isSymbolicLink() &&
|
|
1076
|
+
error instanceof Error &&
|
|
1077
|
+
'code' in error &&
|
|
1078
|
+
error.code === 'ENOENT'
|
|
1079
|
+
)
|
|
1080
|
+
continue
|
|
1081
|
+
throw error
|
|
830
1082
|
}
|
|
831
|
-
|
|
1083
|
+
const stat = fs.statSync(real)
|
|
1084
|
+
if (stat.isDirectory()) {
|
|
832
1085
|
if (fs.existsSync(path.join(full, 'Package.swift'))) continue
|
|
833
1086
|
walk(full)
|
|
834
|
-
} else if (
|
|
1087
|
+
} else if (stat.isFile()) {
|
|
835
1088
|
found.push(full)
|
|
836
1089
|
if (found.length > 4096) throw new Error('swift package exceeds 4096 input files')
|
|
837
1090
|
}
|
|
838
1091
|
}
|
|
1092
|
+
ancestors.delete(realDirectory)
|
|
839
1093
|
}
|
|
840
|
-
if (fs.existsSync(dir)) walk(
|
|
1094
|
+
if (fs.existsSync(dir)) walk(packageInputPath(canonicalRoot, dir))
|
|
841
1095
|
return found
|
|
842
1096
|
}
|
|
843
1097
|
|
|
@@ -1010,7 +1264,10 @@ export function buildSwiftResourceTable(
|
|
|
1010
1264
|
)
|
|
1011
1265
|
}
|
|
1012
1266
|
const layout = xcodeLayout(project.packagePath)
|
|
1013
|
-
const bundles =
|
|
1267
|
+
const bundles =
|
|
1268
|
+
project.resourceBundles ??
|
|
1269
|
+
layout?.resourceBundles ??
|
|
1270
|
+
swiftResourceBundles(inputs, relative)
|
|
1014
1271
|
const catalogFiles = relative.filter((file) => {
|
|
1015
1272
|
const disk = byRelative.get(file)
|
|
1016
1273
|
return !disk || !layout?.targetDirs.get(disk)?.startsWith(`${XCODE_FRAMEWORKS_DIR}/`)
|
|
@@ -1144,6 +1401,7 @@ export function buildSwiftBundleFiles(
|
|
|
1144
1401
|
packagePath: string,
|
|
1145
1402
|
hosted: boolean,
|
|
1146
1403
|
inputs?: Record<string, string>,
|
|
1404
|
+
resourceBundles?: SwiftResourceBundle[],
|
|
1147
1405
|
): SwiftBundlePack {
|
|
1148
1406
|
packagePath = fs.realpathSync(packagePath)
|
|
1149
1407
|
const limits = inputLimits(hosted)
|
|
@@ -1158,6 +1416,7 @@ export function buildSwiftBundleFiles(
|
|
|
1158
1416
|
let total = 0
|
|
1159
1417
|
const xcode = xcodeLayout(packagePath)
|
|
1160
1418
|
const bundles =
|
|
1419
|
+
resourceBundles ??
|
|
1161
1420
|
xcode?.resourceBundles ??
|
|
1162
1421
|
swiftResourceBundles(inputs ?? packageSources(packagePath, hosted), relative)
|
|
1163
1422
|
const addFile = (key: string, bytes: Buffer) => {
|
|
@@ -1267,6 +1526,9 @@ export function sourceStamp(
|
|
|
1267
1526
|
hash.update(JSON.stringify(xcodeProjects.get(packagePath)?.behavior ?? {}))
|
|
1268
1527
|
const libraries = projects.get(packagePath)?.libraries
|
|
1269
1528
|
if (libraries) hash.update(JSON.stringify(libraries))
|
|
1529
|
+
hash.update(JSON.stringify(projects.get(packagePath)?.nativeTargets ?? []))
|
|
1530
|
+
hash.update(JSON.stringify(projects.get(packagePath)?.resourceBundles ?? []))
|
|
1531
|
+
hash.update(JSON.stringify(projects.get(packagePath)?.bundleFiles ?? null))
|
|
1270
1532
|
const projectInputs = new Set(packageFiles(packagePath))
|
|
1271
1533
|
for (const file of [...projectInputs].sort()) {
|
|
1272
1534
|
hash.update(path.relative(packagePath, file))
|
|
@@ -1287,6 +1549,9 @@ export function sourceContentStamp(
|
|
|
1287
1549
|
hash.update(JSON.stringify(xcodeProjects.get(packagePath)?.behavior ?? {}))
|
|
1288
1550
|
const libraries = projects.get(packagePath)?.libraries
|
|
1289
1551
|
if (libraries) hash.update(JSON.stringify(libraries))
|
|
1552
|
+
hash.update(JSON.stringify(projects.get(packagePath)?.nativeTargets ?? []))
|
|
1553
|
+
hash.update(JSON.stringify(projects.get(packagePath)?.resourceBundles ?? []))
|
|
1554
|
+
hash.update(JSON.stringify(projects.get(packagePath)?.bundleFiles ?? null))
|
|
1290
1555
|
for (const file of [...new Set(packageFiles(packagePath))].sort()) {
|
|
1291
1556
|
hash.update(path.relative(packagePath, file))
|
|
1292
1557
|
hash.update(fs.readFileSync(file))
|
|
@@ -1378,7 +1643,7 @@ function packageSources(
|
|
|
1378
1643
|
const limits = inputLimits(hosted)
|
|
1379
1644
|
for (const file of sourceFiles(packagePath)) {
|
|
1380
1645
|
const relative = path.relative(packagePath, file).split(path.sep).join(path.posix.sep)
|
|
1381
|
-
if (manifests.has(file)) continue
|
|
1646
|
+
if (manifests.has(file) || xcode?.packageFiles.has(file)) continue
|
|
1382
1647
|
files[xcode ? xcodeInputKey(xcode, file, relative) : relative] = (
|
|
1383
1648
|
xcode?.nativeFiles.get(file) ??
|
|
1384
1649
|
readPackageFile(packagePath, file, limits.sourceBytes)
|
|
@@ -1394,6 +1659,7 @@ function packageSources(
|
|
|
1394
1659
|
)
|
|
1395
1660
|
] = contents.toString('utf8')
|
|
1396
1661
|
files['Package.swift'] = xcodeManifest(xcode)
|
|
1662
|
+
Object.assign(files, xcode.generatedSources)
|
|
1397
1663
|
for (const standin of xcode.standins)
|
|
1398
1664
|
for (const [file, text] of Object.entries(standin.files))
|
|
1399
1665
|
files[path.posix.join(SWIFT_STANDINS_DIR, standin.module, file)] =
|
|
@@ -1405,6 +1671,9 @@ function packageSources(
|
|
|
1405
1671
|
}
|
|
1406
1672
|
|
|
1407
1673
|
interface SwiftPackageSnapshot {
|
|
1674
|
+
nativeModules: string[]
|
|
1675
|
+
packageFiles?: SwiftPackageFiles
|
|
1676
|
+
packageGuestImports?: string[]
|
|
1408
1677
|
files: Record<string, string>
|
|
1409
1678
|
nativeTargets?: SwiftNativeTarget[]
|
|
1410
1679
|
entry: string
|
|
@@ -1427,9 +1696,45 @@ function packageSnapshot(project: SwiftProject, entry: string): SwiftPackageSnap
|
|
|
1427
1696
|
new Set([...linked.values()].flat()),
|
|
1428
1697
|
)
|
|
1429
1698
|
const native = nativeSourceDescriptor(project.packagePath)
|
|
1699
|
+
const packageFiles: SwiftPackageFiles = {}
|
|
1700
|
+
for (const [file, relative] of layout?.packageFiles ?? [])
|
|
1701
|
+
packageFiles[relative] = readPackageFile(
|
|
1702
|
+
project.packagePath,
|
|
1703
|
+
fs.realpathSync(file),
|
|
1704
|
+
inputLimits(Boolean(project.hosted)).sourceBytes,
|
|
1705
|
+
).toString('base64')
|
|
1430
1706
|
return {
|
|
1431
1707
|
files,
|
|
1432
|
-
|
|
1708
|
+
nativeModules: (layout?.packages.nativePackages ?? []).flatMap(
|
|
1709
|
+
({ guestTargets: targets }) =>
|
|
1710
|
+
targets
|
|
1711
|
+
.filter((target) => target.type === 'regular' || target.type === 'system')
|
|
1712
|
+
.map((target) => swiftTargetModuleName(target.name)),
|
|
1713
|
+
),
|
|
1714
|
+
...(Object.keys(packageFiles).length > 0
|
|
1715
|
+
? {
|
|
1716
|
+
packageFiles,
|
|
1717
|
+
packageGuestImports: [
|
|
1718
|
+
...new Set(
|
|
1719
|
+
(layout?.packages.nativePackages ?? []).flatMap(
|
|
1720
|
+
({ manifest, guestTargets: targets }) =>
|
|
1721
|
+
targets
|
|
1722
|
+
.filter((target) => target.type === 'regular')
|
|
1723
|
+
.flatMap((target) =>
|
|
1724
|
+
swiftTargetFiles(manifest, target)
|
|
1725
|
+
.filter((file) => file.endsWith('.swift'))
|
|
1726
|
+
.flatMap((file) =>
|
|
1727
|
+
swiftImportNames(fs.readFileSync(file, 'utf8')),
|
|
1728
|
+
),
|
|
1729
|
+
),
|
|
1730
|
+
),
|
|
1731
|
+
),
|
|
1732
|
+
].sort(),
|
|
1733
|
+
}
|
|
1734
|
+
: {}),
|
|
1735
|
+
...((project.nativeTargets ?? layout?.nativeTargets)?.length
|
|
1736
|
+
? { nativeTargets: project.nativeTargets ?? layout?.nativeTargets }
|
|
1737
|
+
: {}),
|
|
1433
1738
|
entry: layout
|
|
1434
1739
|
? xcodeInputKey(layout, path.resolve(project.packagePath, entry), entry)
|
|
1435
1740
|
: entry,
|
|
@@ -1443,11 +1748,14 @@ function packageSnapshot(project: SwiftProject, entry: string): SwiftPackageSnap
|
|
|
1443
1748
|
}),
|
|
1444
1749
|
),
|
|
1445
1750
|
resources: buildSwiftResourceTable(project, '', files),
|
|
1446
|
-
bundleFiles:
|
|
1447
|
-
project.
|
|
1448
|
-
|
|
1449
|
-
|
|
1450
|
-
|
|
1751
|
+
bundleFiles:
|
|
1752
|
+
project.bundleFiles ??
|
|
1753
|
+
buildSwiftBundleFiles(
|
|
1754
|
+
project.packagePath,
|
|
1755
|
+
Boolean(project.hosted),
|
|
1756
|
+
files,
|
|
1757
|
+
project.resourceBundles,
|
|
1758
|
+
),
|
|
1451
1759
|
native,
|
|
1452
1760
|
...(linked.size > 0 || project.libraries
|
|
1453
1761
|
? {
|
|
@@ -1477,6 +1785,12 @@ function packageSnapshot(project: SwiftProject, entry: string): SwiftPackageSnap
|
|
|
1477
1785
|
function snapshotCompileInput(snapshot: SwiftPackageSnapshot): SwiftCompileInput {
|
|
1478
1786
|
const input: SwiftCompileInput = {
|
|
1479
1787
|
files: snapshot.files,
|
|
1788
|
+
...(snapshot.packageFiles
|
|
1789
|
+
? {
|
|
1790
|
+
packageFiles: snapshot.packageFiles,
|
|
1791
|
+
packageGuestImports: snapshot.packageGuestImports,
|
|
1792
|
+
}
|
|
1793
|
+
: {}),
|
|
1480
1794
|
...(snapshot.nativeTargets ? { nativeTargets: snapshot.nativeTargets } : {}),
|
|
1481
1795
|
metalSources: snapshot.resources.metalUploads,
|
|
1482
1796
|
resourcePaths: snapshot.resourcePaths,
|
|
@@ -1542,16 +1856,27 @@ async function compile(
|
|
|
1542
1856
|
module: moduleStamp(packagePath, moduleRootOverride, false),
|
|
1543
1857
|
}
|
|
1544
1858
|
// targets are imported by their module names
|
|
1545
|
-
const
|
|
1546
|
-
|
|
1547
|
-
|
|
1859
|
+
const parsed = compileTargets(input)
|
|
1860
|
+
const targets = parsed.map((target) => swiftTargetModuleName(target.name))
|
|
1861
|
+
// the compiler synthesizes Builtin for a file whose own target enables the
|
|
1862
|
+
// feature, exactly when its import compiles. longest path first, so a
|
|
1863
|
+
// nested target's files read its own settings.
|
|
1864
|
+
const byPath = [...parsed].sort((left, right) => right.path.length - left.path.length)
|
|
1865
|
+
const providedByFile = (file: string): readonly string[] => {
|
|
1866
|
+
const owner = byPath.find((target) =>
|
|
1867
|
+
target.path === '.' ? true : file.startsWith(`${target.path}/`),
|
|
1868
|
+
)
|
|
1869
|
+
return owner?.experimentalFeatures?.includes('BuiltinModule') ? ['Builtin'] : []
|
|
1870
|
+
}
|
|
1548
1871
|
const missing = missingSwiftModules(
|
|
1549
1872
|
input.files,
|
|
1550
1873
|
new Set([
|
|
1551
1874
|
...swiftAvailableModules(moduleRoot, toolchain.toolchainBin),
|
|
1552
1875
|
// a project without a manifest compiles as the template's one App target
|
|
1553
1876
|
...(targets.length > 0 ? targets : ['App']),
|
|
1877
|
+
...snapshot.nativeModules,
|
|
1554
1878
|
]),
|
|
1879
|
+
providedByFile,
|
|
1555
1880
|
)
|
|
1556
1881
|
if (missing.size > 0)
|
|
1557
1882
|
throw new SwiftMissingModulesError(await missingModulesMessage(packagePath, missing))
|
|
@@ -1722,18 +2047,20 @@ async function missingModulesMessage(
|
|
|
1722
2047
|
)
|
|
1723
2048
|
if (packaged.size > 0)
|
|
1724
2049
|
await Promise.all(
|
|
1725
|
-
(layout?.packages.binaries ?? [])
|
|
1726
|
-
|
|
1727
|
-
|
|
1728
|
-
|
|
1729
|
-
|
|
1730
|
-
|
|
1731
|
-
|
|
1732
|
-
|
|
1733
|
-
|
|
1734
|
-
|
|
1735
|
-
|
|
1736
|
-
|
|
2050
|
+
(layout?.packages.binaries ?? [])
|
|
2051
|
+
.filter((binary) => binary.reached)
|
|
2052
|
+
.map(async (binary) => {
|
|
2053
|
+
// archive inspection may fail without hiding the selected target's reason.
|
|
2054
|
+
const modules = await swiftBinaryModules(binary).catch(() => [])
|
|
2055
|
+
for (const name of modules)
|
|
2056
|
+
if (packaged.has(name))
|
|
2057
|
+
gaps.set(name, {
|
|
2058
|
+
source: binary.source,
|
|
2059
|
+
reason:
|
|
2060
|
+
layout?.packages.modules.get(binary.target)?.reason ??
|
|
2061
|
+
`${binary.target} is a binary framework`,
|
|
2062
|
+
})
|
|
2063
|
+
}),
|
|
1737
2064
|
)
|
|
1738
2065
|
const width = Math.max(...[...missing.keys()].map((name) => name.length))
|
|
1739
2066
|
const opened = xcodeProjects.get(packagePath)?.xcodeproj
|
|
@@ -1789,13 +2116,14 @@ async function compileRemote(
|
|
|
1789
2116
|
})
|
|
1790
2117
|
if (!submit) throw new Error('swift compile: no credential to submit with')
|
|
1791
2118
|
const sources = Object.values(snapshot.files)
|
|
1792
|
-
const
|
|
1793
|
-
|
|
1794
|
-
|
|
1795
|
-
|
|
1796
|
-
|
|
2119
|
+
const packageSources = Object.values(snapshot.packageFiles ?? {})
|
|
2120
|
+
const count = sources.length + packageSources.length
|
|
2121
|
+
const bytes =
|
|
2122
|
+
sources.reduce((total, text) => total + Buffer.byteLength(text), 0) +
|
|
2123
|
+
packageSources.reduce((total, encoded) => total + swiftPackageInputBytes(encoded), 0)
|
|
2124
|
+
if (count > MAX_SWIFT_COMPILE_FILES || bytes > MAX_SWIFT_COMPILE_SOURCE_BYTES) {
|
|
1797
2125
|
throw new Error(
|
|
1798
|
-
`${path.basename(packagePath)} has ${
|
|
2126
|
+
`${path.basename(packagePath)} has ${count} input files (${bytes} bytes; packages: ${swiftPackageInputNames(snapshot.packageFiles).join(', ') || 'none'}), over Contrast's compile limits of ${MAX_SWIFT_COMPILE_FILES} files and ${MAX_SWIFT_COMPILE_SOURCE_BYTES} bytes; compile it on this machine with the Swift distribution instead`,
|
|
1799
2127
|
)
|
|
1800
2128
|
}
|
|
1801
2129
|
const descriptor = snapshot.native
|
|
@@ -1803,6 +2131,12 @@ async function compileRemote(
|
|
|
1803
2131
|
submit,
|
|
1804
2132
|
{
|
|
1805
2133
|
files: snapshot.files,
|
|
2134
|
+
...(snapshot.packageFiles
|
|
2135
|
+
? {
|
|
2136
|
+
packageFiles: snapshot.packageFiles,
|
|
2137
|
+
packageGuestImports: snapshot.packageGuestImports,
|
|
2138
|
+
}
|
|
2139
|
+
: {}),
|
|
1806
2140
|
...(snapshot.nativeTargets ? { nativeTargets: snapshot.nativeTargets } : {}),
|
|
1807
2141
|
metalSources: snapshot.resources.metalUploads,
|
|
1808
2142
|
resourcePaths: snapshot.resourcePaths,
|
|
@@ -1969,14 +2303,75 @@ export async function swiftPackageMetadata(
|
|
|
1969
2303
|
packagePath = fs.realpathSync(packagePath)
|
|
1970
2304
|
const project = projectFor(packagePath, hosted, signal)
|
|
1971
2305
|
const limits = inputLimits(Boolean(project.hosted))
|
|
1972
|
-
|
|
1973
|
-
|
|
1974
|
-
|
|
1975
|
-
|
|
1976
|
-
|
|
1977
|
-
|
|
1978
|
-
|
|
1979
|
-
|
|
2306
|
+
// an xcode project runs its selected application target: the entry is one
|
|
2307
|
+
// of the target's own sources, swift or c-family, never a framework,
|
|
2308
|
+
// package or sibling target's @main elsewhere in the inputs. a plain
|
|
2309
|
+
// package scans its tree.
|
|
2310
|
+
const registered = xcodeProjects.get(packagePath)
|
|
2311
|
+
const app = registered
|
|
2312
|
+
? readXcodeAppTargetPrepared(
|
|
2313
|
+
registered.xcodeproj,
|
|
2314
|
+
registered.target,
|
|
2315
|
+
registered.configuration,
|
|
2316
|
+
{ prepareGeneratedSources: true, installedPods: true },
|
|
2317
|
+
)
|
|
2318
|
+
: null
|
|
2319
|
+
const candidates = app
|
|
2320
|
+
? [...app.sources, ...app.allSources.filter(isSwiftNativeTranslationUnit)]
|
|
2321
|
+
: sourceFiles(packagePath).filter((file) => file.endsWith('.swift'))
|
|
2322
|
+
// the preprocessor names xcode compiles each c-family unit with: the
|
|
2323
|
+
// target's -D flags, the c++ ones for c++ units, and the file's own.
|
|
2324
|
+
const cDefines = (file: string): Map<string, string | undefined> => {
|
|
2325
|
+
const defines = new Map<string, string | undefined>()
|
|
2326
|
+
const cxx = /\.(?:cc|cpp|cxx)$/.test(file)
|
|
2327
|
+
for (const flag of [
|
|
2328
|
+
...(app?.objc?.flags ?? []),
|
|
2329
|
+
...(cxx ? (app?.objc?.cxxFlags ?? []) : []),
|
|
2330
|
+
...(app?.objc?.fileFlags[file] ?? []),
|
|
2331
|
+
]) {
|
|
2332
|
+
const define = /^-D([^=]+)(?:=(.*))?$/.exec(flag)
|
|
2333
|
+
if (define) defines.set(define[1]!, define[2])
|
|
2334
|
+
const undef = /^-U(.+)$/.exec(flag)
|
|
2335
|
+
if (undef) defines.delete(undef[1]!)
|
|
2336
|
+
}
|
|
2337
|
+
return defines
|
|
2338
|
+
}
|
|
2339
|
+
// names any of the target's own c-family sources, headers or prefix
|
|
2340
|
+
// header defines, read once. like the candidate reads below, a member
|
|
2341
|
+
// that cannot be read fails the scan instead of silently deciding false.
|
|
2342
|
+
let targetDefined: Set<string> | null = null
|
|
2343
|
+
const definedNames = (): Set<string> => {
|
|
2344
|
+
if (targetDefined) return targetDefined
|
|
2345
|
+
const texts = [
|
|
2346
|
+
...candidates.filter((file) => !file.endsWith('.swift')),
|
|
2347
|
+
...(app?.objc?.headers ?? []),
|
|
2348
|
+
...(app?.objc?.prefixHeader ? [app.objc.prefixHeader] : []),
|
|
2349
|
+
].map((file) =>
|
|
2350
|
+
readPackageFile(packagePath, file, limits.sourceBytes).toString('utf8'),
|
|
2351
|
+
)
|
|
2352
|
+
targetDefined = swiftCDefinedNames(texts)
|
|
2353
|
+
return targetDefined
|
|
2354
|
+
}
|
|
2355
|
+
const cLanguage = (file: string): 'c' | 'c++' | 'objective-c' | 'objective-c++' =>
|
|
2356
|
+
file.endsWith('.mm')
|
|
2357
|
+
? 'objective-c++'
|
|
2358
|
+
: file.endsWith('.m')
|
|
2359
|
+
? 'objective-c'
|
|
2360
|
+
: /\.(?:cc|cpp|cxx)$/.test(file)
|
|
2361
|
+
? 'c++'
|
|
2362
|
+
: 'c'
|
|
2363
|
+
const mains = candidates.filter((file) => {
|
|
2364
|
+
const contents = readPackageFile(packagePath, file, limits.sourceBytes).toString(
|
|
2365
|
+
'utf8',
|
|
2366
|
+
)
|
|
2367
|
+
return file.endsWith('.swift')
|
|
2368
|
+
? swiftApplicationEntry(file, contents)
|
|
2369
|
+
: swiftCMainEntry(file, contents, {
|
|
2370
|
+
defines: cDefines(file),
|
|
2371
|
+
predefines: swiftCPredefines(cLanguage(file)),
|
|
2372
|
+
targetDefined: definedNames(),
|
|
2373
|
+
})
|
|
2374
|
+
})
|
|
1980
2375
|
const native = nativeSourceDescriptor(packagePath)
|
|
1981
2376
|
if (mains.length > 1 || (mains.length === 0 && !native)) {
|
|
1982
2377
|
throw new Error(
|