peachsim 0.1.1684 → 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/coverage-swift.ts +72 -5
- package/cli/commands/inspect/actions.ts +1 -0
- package/cli/commands/screenshot.ts +12 -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 +2252 -1462
- 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 +1 -1
- package/dist-lib/dev-bundle-resolution.cjs +1 -1
- package/dist-lib/expo-swift-bundle.cjs +1762 -995
- 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 +2184 -1417
- package/dist-lib/host/fetch-proxy-handler.cjs +3 -3
- 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 +175 -69
- 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 +174 -68
- package/dist-lib/native-app-identity-project.cjs +163 -51
- package/dist-lib/native-app-identity-project.mjs +206 -82
- 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 +26 -23
- package/dist-lib/public-origins-lib.json +74 -61
- 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 +1 -1
- package/dist-lib/scripts/dev-server-scanner.cjs +1 -1
- package/dist-lib/sdk.cjs +2 -2
- package/dist-lib/sdk.mjs +2 -2
- package/dist-lib/skills.cjs +2633 -1840
- package/dist-lib/swift-compile.cjs +2478 -100
- package/dist-lib/swift-compile.mjs +2475 -100
- package/dist-lib/swift-package.cjs +108 -50
- package/dist-lib/swift-package.mjs +104 -50
- package/dist-lib/swift-submit.cjs +1 -1
- package/dist-lib/swift-submit.mjs +1 -1
- package/dist-lib/swift-toolchain.cjs +1 -1
- package/dist-lib/swift.cjs +1 -1
- package/dist-lib/vite-swift.cjs +3979 -985
- package/dist-lib/vite.cjs +12 -18
- package/dist-lib/worklet-executable.cjs +7 -4
- package/dist-lib/worklet-executable.mjs +7 -4
- package/dist-types/packages/peach-engine/src/engine/clipboardContract.d.ts +15 -1
- package/dist-types/packages/peach-globals/src/clipboardBridgeContract.d.ts +6 -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/sdk/ios/System/Library/Frameworks/CoreFoundation.framework/Headers/CoreFoundation.h +9 -0
- 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 +96 -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/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/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/complex.h +167 -0
- package/sdk/ios/usr/include/dispatch/dispatch.h +5 -0
- package/sdk/ios/usr/include/mach/mach_types.h +1 -0
- package/sdk/ios/usr/include/math.h +835 -2
- package/sdk/ios/usr/include/sys/cdefs.h +0 -1
- package/src/generated/swift-c-predefines.json +1988 -0
- package/src/nitro-bundle.ts +1 -0
- package/src/nitro-compile.ts +4 -0
- package/src/nitroContract.ts +18 -2
- package/src/swift-compile.ts +446 -49
- package/src/swift-coverage/package.ts +3 -1
- package/src/swift-coverage/xcode-assets.ts +62 -2
- package/src/swift-coverage/xcode-packages.ts +11 -6
- package/src/swift-host.ts +333 -57
- package/src/swift-objc-compile.ts +20 -5
- package/src/swift-objc-standin.ts +21 -11
- package/src/swift-package-manifest.ts +151 -28
- package/src/swift-package.ts +134 -58
- package/src/swift-packages.ts +141 -44
- package/src/swift-source-file.ts +10 -15
- package/src/swift-standins.ts +87 -13
- package/src/swift-submit.ts +5 -0
- package/src/swiftContract.ts +160 -75
- package/src/target-matcher.ts +15 -2
- package/src/worklet-executable.ts +7 -3
- package/src/xcode-json-project.ts +14 -2
- package/src/xcode-project.ts +154 -59
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,10 +49,15 @@ 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 {
|
|
56
|
+
import {
|
|
57
|
+
swiftPackageManifest,
|
|
58
|
+
swiftTargetFiles,
|
|
59
|
+
swiftTargetResourceFiles,
|
|
60
|
+
} from './swift-package-manifest'
|
|
46
61
|
import {
|
|
47
62
|
prefetchSwiftCheckouts,
|
|
48
63
|
remoteSwiftCheckouts,
|
|
@@ -51,7 +66,10 @@ import {
|
|
|
51
66
|
type SwiftPackageGap,
|
|
52
67
|
type SwiftPackages,
|
|
53
68
|
} from './swift-packages'
|
|
54
|
-
import {
|
|
69
|
+
import {
|
|
70
|
+
packageInputPath,
|
|
71
|
+
readPackageFile as readSwiftSourceFile,
|
|
72
|
+
} from './swift-source-file'
|
|
55
73
|
import { readSwiftStandinBehavior } from './swift-standin-config'
|
|
56
74
|
import {
|
|
57
75
|
standinGenerationInputs,
|
|
@@ -80,11 +98,19 @@ import {
|
|
|
80
98
|
type SwiftImageUpload,
|
|
81
99
|
type SwiftNativeModules,
|
|
82
100
|
} from './swift-submit'
|
|
83
|
-
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'
|
|
84
109
|
import {
|
|
85
110
|
enclosingXcodeWorkspace,
|
|
86
111
|
readXcodeAppTarget,
|
|
87
112
|
type XcodeAppTarget,
|
|
113
|
+
type XcodeModuleTarget,
|
|
88
114
|
} from './xcode-project'
|
|
89
115
|
import type { SwiftEntryModuleArgs } from '../../sootsim-swift/src/entryModule'
|
|
90
116
|
import type {
|
|
@@ -97,6 +123,7 @@ import type { SwiftCompileInput, SwiftIcuAsset } from './swift-compile'
|
|
|
97
123
|
import type { SwiftStandinBehaviors } from './swift-standin-emit'
|
|
98
124
|
import type {
|
|
99
125
|
SwiftMetalLibrarySource,
|
|
126
|
+
SwiftPackageFiles,
|
|
100
127
|
SwiftNativeTarget,
|
|
101
128
|
SwiftResourceBundle,
|
|
102
129
|
} from './swiftContract'
|
|
@@ -192,6 +219,7 @@ export interface SwiftProject {
|
|
|
192
219
|
libraries?: Record<string, string>
|
|
193
220
|
nativeTargets?: SwiftNativeTarget[]
|
|
194
221
|
resourceBundles?: SwiftResourceBundle[]
|
|
222
|
+
bundleFiles?: SwiftBundlePack
|
|
195
223
|
}
|
|
196
224
|
|
|
197
225
|
// a project is its swiftpm package: the build, the artifact, and the dev
|
|
@@ -471,7 +499,7 @@ export const XCODE_APP_DIR = '__app__'
|
|
|
471
499
|
const XCODE_FRAMEWORKS_DIR = '__frameworks__'
|
|
472
500
|
// remote package checkouts compile here: swiftpm owns `.build` in the
|
|
473
501
|
// compile's package root as its scratch directory.
|
|
474
|
-
const XCODE_PACKAGES_DIR =
|
|
502
|
+
const XCODE_PACKAGES_DIR = SWIFT_REMOTE_PACKAGES_DIR
|
|
475
503
|
|
|
476
504
|
// the compile input key of a root-relative path in an xcode layout.
|
|
477
505
|
function xcodeInputKey(
|
|
@@ -495,6 +523,8 @@ interface XcodeLayout {
|
|
|
495
523
|
/** framework and package targets, with root-relative paths and the nested target directories they exclude. */
|
|
496
524
|
targets: (SwiftPackageTarget & { exclude: string[] })[]
|
|
497
525
|
packages: SwiftPackages
|
|
526
|
+
packagePaths: Map<string, string>
|
|
527
|
+
packageFiles: Map<string, string>
|
|
498
528
|
standins: SwiftStandin[]
|
|
499
529
|
/** the binary targets the stand-ins come from. */
|
|
500
530
|
binaries: SwiftPackageBinary[]
|
|
@@ -503,6 +533,8 @@ interface XcodeLayout {
|
|
|
503
533
|
/** the input directory each app and framework source compiles under. */
|
|
504
534
|
targetDirs: Map<string, string>
|
|
505
535
|
resourceBundles: SwiftResourceBundle[]
|
|
536
|
+
/** the symbol sources xcode generates from package target catalogs, by input key. */
|
|
537
|
+
generatedSources: Record<string, string>
|
|
506
538
|
nativeTargets: SwiftNativeTarget[]
|
|
507
539
|
nativeFiles: Map<string, Buffer>
|
|
508
540
|
files: string[]
|
|
@@ -532,6 +564,20 @@ function xcodeLayout(root: string): XcodeLayout | null {
|
|
|
532
564
|
{ target: app.moduleName, sourcePath: XCODE_APP_DIR, path: '.' },
|
|
533
565
|
]
|
|
534
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)
|
|
535
581
|
for (const framework of app.frameworks) {
|
|
536
582
|
const dir = path.posix.join(XCODE_FRAMEWORKS_DIR, framework.moduleName)
|
|
537
583
|
resourceBundles.push({
|
|
@@ -549,6 +595,7 @@ function xcodeLayout(root: string): XcodeLayout | null {
|
|
|
549
595
|
targetDirs.set(file, dir)
|
|
550
596
|
files.add(file)
|
|
551
597
|
}
|
|
598
|
+
targetAssetSymbols(framework, dir)
|
|
552
599
|
targets.push({
|
|
553
600
|
name: framework.moduleName,
|
|
554
601
|
path: dir,
|
|
@@ -561,10 +608,58 @@ function xcodeLayout(root: string): XcodeLayout | null {
|
|
|
561
608
|
})
|
|
562
609
|
}
|
|
563
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
|
+
}
|
|
564
658
|
for (const standin of standins)
|
|
565
659
|
targets.push({
|
|
566
660
|
name: standin.module,
|
|
567
661
|
path: path.posix.join(SWIFT_STANDINS_DIR, standin.module),
|
|
662
|
+
publicHeadersPath: standin.publicHeadersPath,
|
|
568
663
|
dependencies: standin.dependencies?.map((name) => ({ kind: 'target', name })),
|
|
569
664
|
executable: false,
|
|
570
665
|
resources: false,
|
|
@@ -647,6 +742,31 @@ function xcodeLayout(root: string): XcodeLayout | null {
|
|
|
647
742
|
}
|
|
648
743
|
if (!target.remote) files.add(path.join(target.packageDir, 'Package.swift'))
|
|
649
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
|
+
}
|
|
650
770
|
}
|
|
651
771
|
// swiftpm assigns a file to one target: a target directory nested in
|
|
652
772
|
// another's is that one's exclusion
|
|
@@ -716,7 +836,9 @@ function xcodeLayout(root: string): XcodeLayout | null {
|
|
|
716
836
|
)
|
|
717
837
|
.map(relative),
|
|
718
838
|
userHeaderSearchPaths: settings.userHeaderSearchPaths.map(relative),
|
|
719
|
-
frameworkSearchPaths:
|
|
839
|
+
frameworkSearchPaths: nativeInputs.targets
|
|
840
|
+
.find((value) => value.name === target.moduleName)!
|
|
841
|
+
.frameworks.map(relative),
|
|
720
842
|
// the same prepared maps and overlay the implementation compile stages
|
|
721
843
|
headerMaps: settings.headerMaps.map((map) => ({
|
|
722
844
|
flag: map.flag,
|
|
@@ -751,7 +873,7 @@ function xcodeLayout(root: string): XcodeLayout | null {
|
|
|
751
873
|
),
|
|
752
874
|
sourceDirectories: Object.fromEntries(
|
|
753
875
|
target.allSources
|
|
754
|
-
.filter(
|
|
876
|
+
.filter(isSwiftNativeTranslationUnit)
|
|
755
877
|
.map((file) => [relative(file), relative(path.dirname(file))]),
|
|
756
878
|
),
|
|
757
879
|
},
|
|
@@ -792,11 +914,14 @@ function xcodeLayout(root: string): XcodeLayout | null {
|
|
|
792
914
|
app,
|
|
793
915
|
targets,
|
|
794
916
|
packages,
|
|
917
|
+
packagePaths,
|
|
918
|
+
packageFiles,
|
|
795
919
|
standins,
|
|
796
920
|
binaries,
|
|
797
921
|
projectGaps,
|
|
798
922
|
targetDirs,
|
|
799
923
|
resourceBundles,
|
|
924
|
+
generatedSources,
|
|
800
925
|
nativeTargets,
|
|
801
926
|
nativeFiles,
|
|
802
927
|
files: [...files].sort(),
|
|
@@ -806,6 +931,34 @@ function xcodeLayout(root: string): XcodeLayout | null {
|
|
|
806
931
|
// the manifest the compile reads for an xcode app: the app target and each
|
|
807
932
|
// framework and package target, in the forms swiftManifestTargets scans.
|
|
808
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
|
+
})
|
|
809
962
|
const settings = (target: {
|
|
810
963
|
languageMode: number
|
|
811
964
|
mainActorIsolation: boolean
|
|
@@ -848,12 +1001,12 @@ function xcodeManifest(layout: XcodeLayout): string {
|
|
|
848
1001
|
return [
|
|
849
1002
|
'// swift-tools-version: 6.2',
|
|
850
1003
|
'import PackageDescription',
|
|
851
|
-
|
|
852
|
-
` .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)}),`,
|
|
853
1006
|
...layout.targets.map((target) =>
|
|
854
1007
|
target.systemLibrary
|
|
855
1008
|
? ` .systemLibrary(name: "${target.name}", path: "${target.path}"),`
|
|
856
|
-
: ` .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)}),`,
|
|
857
1010
|
),
|
|
858
1011
|
'])',
|
|
859
1012
|
'',
|
|
@@ -881,8 +1034,12 @@ function packageFiles(root: string, includeBuildInputs = true): string[] {
|
|
|
881
1034
|
function readPackageFile(root: string, file: string, maxBytes: number): Buffer {
|
|
882
1035
|
if (xcodeProjects.has(root)) {
|
|
883
1036
|
const checkouts = remoteSwiftCheckouts(root)
|
|
884
|
-
if (file.startsWith(`${checkouts}${path.sep}`))
|
|
885
|
-
|
|
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
|
+
}
|
|
886
1043
|
}
|
|
887
1044
|
return readSwiftSourceFile(root, file, maxBytes)
|
|
888
1045
|
}
|
|
@@ -890,7 +1047,12 @@ function readPackageFile(root: string, file: string, maxBytes: number): Buffer {
|
|
|
890
1047
|
// every input file under `dir`, which must stay inside `canonicalRoot`.
|
|
891
1048
|
function sourceTreeFiles(dir: string, canonicalRoot: string): string[] {
|
|
892
1049
|
const found: string[] = []
|
|
1050
|
+
const ancestors = new Set<string>()
|
|
893
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)
|
|
894
1056
|
for (const entry of fs
|
|
895
1057
|
.readdirSync(dir, { withFileTypes: true })
|
|
896
1058
|
.sort((left, right) => left.name.localeCompare(right.name))) {
|
|
@@ -905,26 +1067,31 @@ function sourceTreeFiles(dir: string, canonicalRoot: string): string[] {
|
|
|
905
1067
|
)
|
|
906
1068
|
continue
|
|
907
1069
|
const full = path.join(dir, entry.name)
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
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
|
|
917
1082
|
}
|
|
918
|
-
|
|
1083
|
+
const stat = fs.statSync(real)
|
|
1084
|
+
if (stat.isDirectory()) {
|
|
919
1085
|
if (fs.existsSync(path.join(full, 'Package.swift'))) continue
|
|
920
1086
|
walk(full)
|
|
921
|
-
} else if (
|
|
1087
|
+
} else if (stat.isFile()) {
|
|
922
1088
|
found.push(full)
|
|
923
1089
|
if (found.length > 4096) throw new Error('swift package exceeds 4096 input files')
|
|
924
1090
|
}
|
|
925
1091
|
}
|
|
1092
|
+
ancestors.delete(realDirectory)
|
|
926
1093
|
}
|
|
927
|
-
if (fs.existsSync(dir)) walk(
|
|
1094
|
+
if (fs.existsSync(dir)) walk(packageInputPath(canonicalRoot, dir))
|
|
928
1095
|
return found
|
|
929
1096
|
}
|
|
930
1097
|
|
|
@@ -1361,6 +1528,7 @@ export function sourceStamp(
|
|
|
1361
1528
|
if (libraries) hash.update(JSON.stringify(libraries))
|
|
1362
1529
|
hash.update(JSON.stringify(projects.get(packagePath)?.nativeTargets ?? []))
|
|
1363
1530
|
hash.update(JSON.stringify(projects.get(packagePath)?.resourceBundles ?? []))
|
|
1531
|
+
hash.update(JSON.stringify(projects.get(packagePath)?.bundleFiles ?? null))
|
|
1364
1532
|
const projectInputs = new Set(packageFiles(packagePath))
|
|
1365
1533
|
for (const file of [...projectInputs].sort()) {
|
|
1366
1534
|
hash.update(path.relative(packagePath, file))
|
|
@@ -1383,6 +1551,7 @@ export function sourceContentStamp(
|
|
|
1383
1551
|
if (libraries) hash.update(JSON.stringify(libraries))
|
|
1384
1552
|
hash.update(JSON.stringify(projects.get(packagePath)?.nativeTargets ?? []))
|
|
1385
1553
|
hash.update(JSON.stringify(projects.get(packagePath)?.resourceBundles ?? []))
|
|
1554
|
+
hash.update(JSON.stringify(projects.get(packagePath)?.bundleFiles ?? null))
|
|
1386
1555
|
for (const file of [...new Set(packageFiles(packagePath))].sort()) {
|
|
1387
1556
|
hash.update(path.relative(packagePath, file))
|
|
1388
1557
|
hash.update(fs.readFileSync(file))
|
|
@@ -1474,7 +1643,7 @@ function packageSources(
|
|
|
1474
1643
|
const limits = inputLimits(hosted)
|
|
1475
1644
|
for (const file of sourceFiles(packagePath)) {
|
|
1476
1645
|
const relative = path.relative(packagePath, file).split(path.sep).join(path.posix.sep)
|
|
1477
|
-
if (manifests.has(file)) continue
|
|
1646
|
+
if (manifests.has(file) || xcode?.packageFiles.has(file)) continue
|
|
1478
1647
|
files[xcode ? xcodeInputKey(xcode, file, relative) : relative] = (
|
|
1479
1648
|
xcode?.nativeFiles.get(file) ??
|
|
1480
1649
|
readPackageFile(packagePath, file, limits.sourceBytes)
|
|
@@ -1490,6 +1659,7 @@ function packageSources(
|
|
|
1490
1659
|
)
|
|
1491
1660
|
] = contents.toString('utf8')
|
|
1492
1661
|
files['Package.swift'] = xcodeManifest(xcode)
|
|
1662
|
+
Object.assign(files, xcode.generatedSources)
|
|
1493
1663
|
for (const standin of xcode.standins)
|
|
1494
1664
|
for (const [file, text] of Object.entries(standin.files))
|
|
1495
1665
|
files[path.posix.join(SWIFT_STANDINS_DIR, standin.module, file)] =
|
|
@@ -1501,6 +1671,9 @@ function packageSources(
|
|
|
1501
1671
|
}
|
|
1502
1672
|
|
|
1503
1673
|
interface SwiftPackageSnapshot {
|
|
1674
|
+
nativeModules: string[]
|
|
1675
|
+
packageFiles?: SwiftPackageFiles
|
|
1676
|
+
packageGuestImports?: string[]
|
|
1504
1677
|
files: Record<string, string>
|
|
1505
1678
|
nativeTargets?: SwiftNativeTarget[]
|
|
1506
1679
|
entry: string
|
|
@@ -1523,8 +1696,42 @@ function packageSnapshot(project: SwiftProject, entry: string): SwiftPackageSnap
|
|
|
1523
1696
|
new Set([...linked.values()].flat()),
|
|
1524
1697
|
)
|
|
1525
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')
|
|
1526
1706
|
return {
|
|
1527
1707
|
files,
|
|
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
|
+
: {}),
|
|
1528
1735
|
...((project.nativeTargets ?? layout?.nativeTargets)?.length
|
|
1529
1736
|
? { nativeTargets: project.nativeTargets ?? layout?.nativeTargets }
|
|
1530
1737
|
: {}),
|
|
@@ -1541,12 +1748,14 @@ function packageSnapshot(project: SwiftProject, entry: string): SwiftPackageSnap
|
|
|
1541
1748
|
}),
|
|
1542
1749
|
),
|
|
1543
1750
|
resources: buildSwiftResourceTable(project, '', files),
|
|
1544
|
-
bundleFiles:
|
|
1545
|
-
project.
|
|
1546
|
-
|
|
1547
|
-
|
|
1548
|
-
|
|
1549
|
-
|
|
1751
|
+
bundleFiles:
|
|
1752
|
+
project.bundleFiles ??
|
|
1753
|
+
buildSwiftBundleFiles(
|
|
1754
|
+
project.packagePath,
|
|
1755
|
+
Boolean(project.hosted),
|
|
1756
|
+
files,
|
|
1757
|
+
project.resourceBundles,
|
|
1758
|
+
),
|
|
1550
1759
|
native,
|
|
1551
1760
|
...(linked.size > 0 || project.libraries
|
|
1552
1761
|
? {
|
|
@@ -1576,6 +1785,12 @@ function packageSnapshot(project: SwiftProject, entry: string): SwiftPackageSnap
|
|
|
1576
1785
|
function snapshotCompileInput(snapshot: SwiftPackageSnapshot): SwiftCompileInput {
|
|
1577
1786
|
const input: SwiftCompileInput = {
|
|
1578
1787
|
files: snapshot.files,
|
|
1788
|
+
...(snapshot.packageFiles
|
|
1789
|
+
? {
|
|
1790
|
+
packageFiles: snapshot.packageFiles,
|
|
1791
|
+
packageGuestImports: snapshot.packageGuestImports,
|
|
1792
|
+
}
|
|
1793
|
+
: {}),
|
|
1579
1794
|
...(snapshot.nativeTargets ? { nativeTargets: snapshot.nativeTargets } : {}),
|
|
1580
1795
|
metalSources: snapshot.resources.metalUploads,
|
|
1581
1796
|
resourcePaths: snapshot.resourcePaths,
|
|
@@ -1659,6 +1874,7 @@ async function compile(
|
|
|
1659
1874
|
...swiftAvailableModules(moduleRoot, toolchain.toolchainBin),
|
|
1660
1875
|
// a project without a manifest compiles as the template's one App target
|
|
1661
1876
|
...(targets.length > 0 ? targets : ['App']),
|
|
1877
|
+
...snapshot.nativeModules,
|
|
1662
1878
|
]),
|
|
1663
1879
|
providedByFile,
|
|
1664
1880
|
)
|
|
@@ -1831,18 +2047,20 @@ async function missingModulesMessage(
|
|
|
1831
2047
|
)
|
|
1832
2048
|
if (packaged.size > 0)
|
|
1833
2049
|
await Promise.all(
|
|
1834
|
-
(layout?.packages.binaries ?? [])
|
|
1835
|
-
|
|
1836
|
-
|
|
1837
|
-
|
|
1838
|
-
|
|
1839
|
-
|
|
1840
|
-
|
|
1841
|
-
|
|
1842
|
-
|
|
1843
|
-
|
|
1844
|
-
|
|
1845
|
-
|
|
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
|
+
}),
|
|
1846
2064
|
)
|
|
1847
2065
|
const width = Math.max(...[...missing.keys()].map((name) => name.length))
|
|
1848
2066
|
const opened = xcodeProjects.get(packagePath)?.xcodeproj
|
|
@@ -1898,13 +2116,14 @@ async function compileRemote(
|
|
|
1898
2116
|
})
|
|
1899
2117
|
if (!submit) throw new Error('swift compile: no credential to submit with')
|
|
1900
2118
|
const sources = Object.values(snapshot.files)
|
|
1901
|
-
const
|
|
1902
|
-
|
|
1903
|
-
|
|
1904
|
-
|
|
1905
|
-
|
|
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) {
|
|
1906
2125
|
throw new Error(
|
|
1907
|
-
`${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`,
|
|
1908
2127
|
)
|
|
1909
2128
|
}
|
|
1910
2129
|
const descriptor = snapshot.native
|
|
@@ -1912,6 +2131,12 @@ async function compileRemote(
|
|
|
1912
2131
|
submit,
|
|
1913
2132
|
{
|
|
1914
2133
|
files: snapshot.files,
|
|
2134
|
+
...(snapshot.packageFiles
|
|
2135
|
+
? {
|
|
2136
|
+
packageFiles: snapshot.packageFiles,
|
|
2137
|
+
packageGuestImports: snapshot.packageGuestImports,
|
|
2138
|
+
}
|
|
2139
|
+
: {}),
|
|
1915
2140
|
...(snapshot.nativeTargets ? { nativeTargets: snapshot.nativeTargets } : {}),
|
|
1916
2141
|
metalSources: snapshot.resources.metalUploads,
|
|
1917
2142
|
resourcePaths: snapshot.resourcePaths,
|
|
@@ -2079,23 +2304,74 @@ export async function swiftPackageMetadata(
|
|
|
2079
2304
|
const project = projectFor(packagePath, hosted, signal)
|
|
2080
2305
|
const limits = inputLimits(Boolean(project.hosted))
|
|
2081
2306
|
// an xcode project runs its selected application target: the entry is one
|
|
2082
|
-
// of the target's own swift
|
|
2083
|
-
// target's @main elsewhere in the inputs. a plain
|
|
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.
|
|
2084
2310
|
const registered = xcodeProjects.get(packagePath)
|
|
2085
|
-
const
|
|
2311
|
+
const app = registered
|
|
2086
2312
|
? readXcodeAppTargetPrepared(
|
|
2087
2313
|
registered.xcodeproj,
|
|
2088
2314
|
registered.target,
|
|
2089
2315
|
registered.configuration,
|
|
2090
2316
|
{ prepareGeneratedSources: true, installedPods: true },
|
|
2091
|
-
)
|
|
2317
|
+
)
|
|
2318
|
+
: null
|
|
2319
|
+
const candidates = app
|
|
2320
|
+
? [...app.sources, ...app.allSources.filter(isSwiftNativeTranslationUnit)]
|
|
2092
2321
|
: sourceFiles(packagePath).filter((file) => file.endsWith('.swift'))
|
|
2093
|
-
|
|
2094
|
-
|
|
2095
|
-
|
|
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) =>
|
|
2096
2350
|
readPackageFile(packagePath, file, limits.sourceBytes).toString('utf8'),
|
|
2097
|
-
)
|
|
2098
|
-
|
|
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
|
+
})
|
|
2099
2375
|
const native = nativeSourceDescriptor(packagePath)
|
|
2100
2376
|
if (mains.length > 1 || (mains.length === 0 && !native)) {
|
|
2101
2377
|
throw new Error(
|