peachsim 0.1.1667 → 0.1.1673
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/cli/bridge-flow-runner.ts +4 -1
- package/cli/commands/coverage-swift.ts +291 -0
- package/cli/commands/coverage.ts +168 -24
- package/cli/commands/diagnose.ts +1 -19
- package/cli/commands/react.ts +3 -18
- package/cli/commands/screenshot.ts +1 -1
- package/cli/commands/screenshots-capture.ts +1 -1
- package/cli/drivers/playwright-provisioning.ts +1 -4
- package/cli/drivers/playwright.ts +15 -1
- package/cli/scene-video.ts +1 -1
- package/cli/ui.ts +20 -0
- package/cli/ws-bridge.ts +7 -36
- package/detox/frame-identity.cjs +21 -0
- package/detox/frame-identity.d.cts +6 -0
- package/detox/index.ts +39 -33
- package/detox/jest-environment.cjs +4 -1
- package/detox/jest-setup-after-env.cjs +0 -4
- package/detox/navigation-lifecycle.ts +2 -2
- package/detox/proof-observer.ts +126 -0
- package/dist-lib/agent-daemon-client.cjs +29 -1
- package/dist-lib/agent-events.cjs +1 -1
- package/dist-lib/attached-projects.cjs +10 -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 +530 -154
- 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 +5074 -7353
- package/dist-lib/detox/jest-environment.cjs +4 -1
- package/dist-lib/dev-bundle-resolution.cjs +1 -1
- package/dist-lib/expo-swift-bundle.cjs +578 -151
- 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 +660 -192
- package/dist-lib/host/fetch-proxy-handler.cjs +2 -2
- 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 +206 -6
- 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 +10 -1
- package/dist-lib/metro-production-bundle.mjs +12 -1
- package/dist-lib/metro.cjs +155 -5
- package/dist-lib/native-app-identity-project.cjs +43 -5
- package/dist-lib/native-app-identity-project.mjs +43 -5
- 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 +21 -1
- package/dist-lib/public-brand.cjs +1 -1
- package/dist-lib/public-origins-lib-esm.json +73 -27
- package/dist-lib/public-origins-lib-static.json +1 -1
- package/dist-lib/public-origins-lib.json +563 -183
- 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 +964 -0
- package/dist-lib/scripts/dev-server-scanner.cjs +1 -1
- package/dist-lib/sdk.cjs +1 -1
- package/dist-lib/sdk.mjs +1 -1
- package/dist-lib/skills.cjs +963 -521
- package/dist-lib/swift-compile.cjs +276 -86
- package/dist-lib/swift-compile.mjs +276 -86
- package/dist-lib/swift-package.cjs +34 -4
- package/dist-lib/swift-package.mjs +33 -4
- package/dist-lib/swift-submit.cjs +2 -2
- package/dist-lib/swift-submit.mjs +2 -2
- package/dist-lib/swift-toolchain.cjs +25 -44
- package/dist-lib/swift.cjs +1 -1
- package/dist-lib/vite-swift.cjs +579 -113
- package/dist-lib/vite.cjs +61 -2
- package/dist-lib/worklet-executable.cjs +1 -1
- package/dist-lib/worklet-executable.mjs +1 -1
- package/dist-types/packages/peach-engine/src/engine/clipboardContract.d.ts +7 -0
- package/dist-types/packages/peach-engine/src/engine/glass-material.d.ts +1 -1
- package/dist-types/packages/peach-engine/src/engine/image-loader.d.ts +2 -0
- package/dist-types/packages/peach-engine/src/engine/inspect-outline.d.ts +2 -1
- package/dist-types/packages/peach-engine/src/engine/liquid-glass.d.ts +1 -0
- package/dist-types/packages/peach-engine/src/engine/paint-boundary.d.ts +3 -1
- package/dist-types/packages/peach-engine/src/render-worker/host-service-protocol.d.ts +7 -0
- package/dist-types/packages/peach-engine/src/render-worker/worklet-runtime-kind.d.ts +24 -0
- package/dist-types/packages/peach-engine/src/render-worker/worklet-runtime.d.ts +4 -2
- package/dist-types/packages/peach-engine/src/settings/devices.d.ts +1 -0
- package/dist-types/packages/peach-globals/src/clipboardBridgeContract.d.ts +18 -0
- package/dist-types/packages/peach-globals/src/index.d.ts +1 -1
- package/dist-types/packages/peach-globals/src/nodeContract.d.ts +1 -0
- 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/CFString.h +2 -0
- package/sdk/ios/System/Library/Frameworks/CoreFoundation.framework/Headers/CoreFoundation.h +36 -0
- package/sdk/ios/System/Library/Frameworks/SystemConfiguration.framework/Headers/SCDynamicStore.h +439 -0
- package/sdk/ios/System/Library/Frameworks/SystemConfiguration.framework/Headers/SCDynamicStoreCopySpecific.h +216 -0
- package/sdk/ios/System/Library/Frameworks/SystemConfiguration.framework/Headers/SCDynamicStoreKey.h +267 -0
- package/sdk/ios/System/Library/Frameworks/SystemConfiguration.framework/Headers/SCNetwork.h +204 -0
- package/sdk/ios/System/Library/Frameworks/SystemConfiguration.framework/Headers/SCNetworkConfiguration.h +1393 -0
- package/sdk/ios/System/Library/Frameworks/SystemConfiguration.framework/Headers/SCNetworkConnection.h +568 -0
- package/sdk/ios/System/Library/Frameworks/SystemConfiguration.framework/Headers/SCNetworkReachability.h +369 -0
- package/sdk/ios/System/Library/Frameworks/SystemConfiguration.framework/Headers/SCPreferences.h +473 -0
- package/sdk/ios/System/Library/Frameworks/SystemConfiguration.framework/Headers/SCPreferencesPath.h +179 -0
- package/sdk/ios/System/Library/Frameworks/SystemConfiguration.framework/Headers/SCPreferencesSetSpecific.h +95 -0
- package/sdk/ios/System/Library/Frameworks/SystemConfiguration.framework/Headers/SCSchemaDefinitions.h +2395 -0
- package/sdk/ios/System/Library/Frameworks/SystemConfiguration.framework/Headers/SystemConfiguration.h +184 -0
- package/sdk/ios/usr/include/libkern/OSByteOrder.h +315 -0
- package/sdk/ios/usr/include/libkern/machine/OSByteOrder.h +147 -0
- package/src/bridge-contract.ts +42 -0
- package/src/chromium-admission.ts +196 -0
- package/src/host/bridge-host.ts +6 -43
- package/src/launch-deadline.ts +74 -0
- package/src/nitro-adapter.lock.json +3 -3
- package/src/profiles.ts +21 -0
- package/src/react-native-coverage/capability-reference-resolution.ts +402 -0
- package/src/react-native-coverage/capability-source-references.ts +1296 -0
- package/src/react-native-coverage/native-typescript-parser.ts +74 -0
- package/src/react-native-coverage/project-aliases.ts +207 -0
- package/src/react-native-coverage/verified-reach.ts +47 -0
- package/src/reap-browser.ts +1019 -0
- package/src/skills/builtin/a11y-review.ts +1 -1
- package/src/skills/builtin/perf-profile.ts +1 -1
- package/src/skills/builtin/screenshot-all.ts +1 -1
- package/src/skills/builtin/visual-diff.ts +1 -1
- package/src/swift-compile.ts +107 -56
- package/src/swift-coverage/indexdump.ts +80 -0
- package/src/swift-coverage/indexing.ts +147 -0
- package/src/swift-coverage/package.ts +230 -0
- package/src/swift-coverage/provenance.ts +47 -0
- package/src/swift-coverage/reader.ts +81 -0
- package/src/swift-coverage/source.ts +252 -0
- package/src/swift-coverage/types.ts +58 -0
- package/src/swift-coverage/xcode-assets.ts +175 -0
- package/src/swift-coverage/xcode-bridging.ts +160 -0
- package/src/swift-coverage/xcode-packages.ts +251 -0
- package/src/swift-coverage/xcode-strings.ts +78 -0
- package/src/swift-coverage/xcode.ts +656 -0
- package/src/swift-distribution.lock.json +8 -8
- package/src/swift-host.ts +21 -1
- package/src/swift-objc-import.ts +191 -27
- package/src/swift-objc-standin.ts +4 -2
- package/src/swift-package-manifest.ts +134 -13
- package/src/swift-package.ts +46 -4
- package/src/swift-submit.ts +2 -1
- package/src/swift-toolchain.ts +36 -61
- package/src/worker-system-chunks.ts +3 -10
- package/src/xcode-project.ts +5 -5
- package/detox/attempt-events.cjs +0 -914
- package/detox/attempt-events.d.cts +0 -113
- package/detox/motion-change.cjs +0 -524
- package/detox/motion-change.d.cts +0 -140
- package/detox/motion-leg-starts.cjs +0 -20
- package/detox/motion-leg-starts.d.cts +0 -8
- package/detox/proof-frame.cjs +0 -190
- package/detox/record-block-execution.cjs +0 -78
|
@@ -0,0 +1,230 @@
|
|
|
1
|
+
import { createHash } from 'node:crypto'
|
|
2
|
+
import { readdirSync, realpathSync } from 'node:fs'
|
|
3
|
+
import { basename, dirname, isAbsolute, join, relative, sep } from 'node:path'
|
|
4
|
+
import { isSwiftManifestFile } from '../swift-package'
|
|
5
|
+
import {
|
|
6
|
+
swiftPackageManifest,
|
|
7
|
+
swiftPackageDescription,
|
|
8
|
+
type SwiftManifestTarget,
|
|
9
|
+
} from '../swift-package-manifest'
|
|
10
|
+
import { readPackageFile } from '../swift-source-file'
|
|
11
|
+
import { swiftCoverageProvenance } from './provenance'
|
|
12
|
+
import { indexSwiftApp } from './source'
|
|
13
|
+
import type { SwiftPackageSourceInput, SwiftSourceInput, SwiftSourceLeg } from './types'
|
|
14
|
+
|
|
15
|
+
export type { SwiftPackageSourceInput } from './types'
|
|
16
|
+
|
|
17
|
+
const sha256 = (bytes: string | Buffer) =>
|
|
18
|
+
createHash('sha256').update(bytes).digest('hex')
|
|
19
|
+
|
|
20
|
+
// the compilation conditions swiftpm defines for a target in a build configuration.
|
|
21
|
+
export const swiftPackageConditions = (
|
|
22
|
+
target: SwiftManifestTarget,
|
|
23
|
+
configuration: 'debug' | 'release',
|
|
24
|
+
) => [
|
|
25
|
+
'SWIFT_PACKAGE',
|
|
26
|
+
...(configuration === 'debug' ? ['DEBUG'] : []),
|
|
27
|
+
...target.defines
|
|
28
|
+
.filter(
|
|
29
|
+
(define) => define.configuration === null || define.configuration === configuration,
|
|
30
|
+
)
|
|
31
|
+
.map((define) => define.name),
|
|
32
|
+
]
|
|
33
|
+
|
|
34
|
+
// the -package-name swiftpm passes: a path package's identity is its lowercased
|
|
35
|
+
// directory name, mangled to a c99 extended identifier.
|
|
36
|
+
export const swiftPackageName = (dir: string) =>
|
|
37
|
+
basename(dir)
|
|
38
|
+
.toLowerCase()
|
|
39
|
+
.replace(/[^a-z0-9_]/g, '_')
|
|
40
|
+
.replace(/^(?=\d)/, '_')
|
|
41
|
+
|
|
42
|
+
// swiftpm evaluation and target membership stay with their existing owner.
|
|
43
|
+
// dependency modules need a separate artifact input; their source is never folded in.
|
|
44
|
+
export function swiftPackageSourceInput(request: SwiftPackageSourceInput) {
|
|
45
|
+
const unknown = (reason: string) => ({ status: 'unknown' as const, reasons: [reason] })
|
|
46
|
+
try {
|
|
47
|
+
const root = realpathSync(request.root)
|
|
48
|
+
const compile = request.compile
|
|
49
|
+
if (compile.oneModule)
|
|
50
|
+
return unknown(
|
|
51
|
+
'One module inputs need generated glue and implicit imports; source reach remains unknown.',
|
|
52
|
+
)
|
|
53
|
+
if (
|
|
54
|
+
compile.objcPeerStartup ||
|
|
55
|
+
compile.nativeTargets?.length ||
|
|
56
|
+
Object.keys(compile.libraries ?? {}).length
|
|
57
|
+
)
|
|
58
|
+
return unknown('Native peer and linked-library compile inputs are unsupported.')
|
|
59
|
+
if (!Object.hasOwn(compile.files, 'Package.swift'))
|
|
60
|
+
return unknown(
|
|
61
|
+
'A root Package.swift snapshot is required; Xcode inputs are unsupported.',
|
|
62
|
+
)
|
|
63
|
+
const manifests = readdirSync(root)
|
|
64
|
+
.filter((name) => /^Package(?:@swift-[\d.]+)?\.swift$/.test(name))
|
|
65
|
+
.sort()
|
|
66
|
+
.map((path) => {
|
|
67
|
+
const bytes = readPackageFile(root, join(root, path), 4 * 1024 * 1024)
|
|
68
|
+
if (compile.files[path] !== bytes.toString('utf8'))
|
|
69
|
+
throw new Error(`Manifest differs from the compiler input snapshot: ${path}`)
|
|
70
|
+
return { path, sha256: sha256(bytes) }
|
|
71
|
+
})
|
|
72
|
+
const nested = Object.keys(compile.files).find(
|
|
73
|
+
(file) => dirname(file) !== '.' && isSwiftManifestFile(file),
|
|
74
|
+
)
|
|
75
|
+
if (nested) return unknown(`Nested package input is unsupported: ${nested}`)
|
|
76
|
+
|
|
77
|
+
const manifest = swiftPackageManifest(root)
|
|
78
|
+
const executables = [...manifest.targets.values()].filter(
|
|
79
|
+
(target) => target.type === 'executable',
|
|
80
|
+
)
|
|
81
|
+
const target = request.target
|
|
82
|
+
? manifest.targets.get(request.target)
|
|
83
|
+
: executables.length === 1
|
|
84
|
+
? executables[0]
|
|
85
|
+
: undefined
|
|
86
|
+
if (!target || target.type !== 'executable')
|
|
87
|
+
return unknown(
|
|
88
|
+
`Select one executable SwiftPM target; found ${executables.map((target) => target.name).join(', ') || 'none'}.`,
|
|
89
|
+
)
|
|
90
|
+
if (target.dependencies.length)
|
|
91
|
+
return unknown(
|
|
92
|
+
`Dependency module artifacts and closure are unknown for ${target.name}: ${target.dependencies
|
|
93
|
+
.map((dependency) =>
|
|
94
|
+
dependency.kind === 'product'
|
|
95
|
+
? `${dependency.package}/${dependency.name}`
|
|
96
|
+
: dependency.name,
|
|
97
|
+
)
|
|
98
|
+
.join(', ')}. Dependencies are not indexed as app sources.`,
|
|
99
|
+
)
|
|
100
|
+
if (
|
|
101
|
+
target.declaresResources ||
|
|
102
|
+
target.nativeSettings.length ||
|
|
103
|
+
target.hasPluginUsages ||
|
|
104
|
+
target.unsupportedSwiftSettings.length ||
|
|
105
|
+
[...manifest.targets.values()].some(
|
|
106
|
+
(candidate) => candidate.type === 'plugin' || candidate.type === 'macro',
|
|
107
|
+
)
|
|
108
|
+
)
|
|
109
|
+
return unknown(
|
|
110
|
+
'Generated resources, native settings, plugins, macros and unsupported Swift settings cannot establish source reach.',
|
|
111
|
+
)
|
|
112
|
+
if (target.languageMode !== 5 && target.languageMode !== 6)
|
|
113
|
+
return unknown(`Unsupported Swift language mode: ${target.languageMode}`)
|
|
114
|
+
const description = swiftPackageDescription(manifest)
|
|
115
|
+
const described = description.targets.find((item) => item.name === target.name)
|
|
116
|
+
if (!described || described.moduleType !== 'SwiftTarget')
|
|
117
|
+
return unknown('SwiftPM did not describe a Swift source target.')
|
|
118
|
+
|
|
119
|
+
if (!described.sources.length || described.sources.length > 2_000)
|
|
120
|
+
return unknown('Swift target needs 1 to 2000 source files.')
|
|
121
|
+
let sourceBytes = 0
|
|
122
|
+
const files = described.sources.map((source) => {
|
|
123
|
+
const file = join(root, described.path, source)
|
|
124
|
+
const path = relative(root, file)
|
|
125
|
+
if (path === '..' || path.startsWith(`..${sep}`) || isAbsolute(path))
|
|
126
|
+
throw new Error(`Target source escapes the package: ${file}`)
|
|
127
|
+
if (!file.endsWith('.swift') || isSwiftManifestFile(path))
|
|
128
|
+
throw new Error(
|
|
129
|
+
`Non-Swift or nested manifest target input is unsupported: ${path}`,
|
|
130
|
+
)
|
|
131
|
+
const bytes = readPackageFile(root, file, 4 * 1024 * 1024)
|
|
132
|
+
sourceBytes += bytes.length
|
|
133
|
+
if (sourceBytes > 32 * 1024 * 1024) throw new Error('Swift module exceeds 32 MiB')
|
|
134
|
+
if (compile.files[path] !== bytes.toString('utf8'))
|
|
135
|
+
throw new Error(
|
|
136
|
+
`Source is missing or differs from the compiler input snapshot: ${path}`,
|
|
137
|
+
)
|
|
138
|
+
return path
|
|
139
|
+
})
|
|
140
|
+
if (!files.length || !files.includes(compile.entry))
|
|
141
|
+
return unknown('The compiler entry must belong to the selected nonempty target.')
|
|
142
|
+
const flags = [
|
|
143
|
+
...swiftPackageConditions(target, request.configuration).flatMap((name) => [
|
|
144
|
+
'-D',
|
|
145
|
+
name,
|
|
146
|
+
]),
|
|
147
|
+
...(target.mainActorIsolation ? ['-default-isolation', 'MainActor'] : []),
|
|
148
|
+
'-package-name',
|
|
149
|
+
swiftPackageName(root),
|
|
150
|
+
]
|
|
151
|
+
const leg = (source: SwiftSourceLeg): SwiftSourceLeg => ({
|
|
152
|
+
swiftc: source.swiftc,
|
|
153
|
+
flags: [...source.flags, ...flags],
|
|
154
|
+
})
|
|
155
|
+
const input: SwiftSourceInput = {
|
|
156
|
+
root,
|
|
157
|
+
moduleName: described.moduleName,
|
|
158
|
+
languageVersion: String(target.languageMode),
|
|
159
|
+
files,
|
|
160
|
+
parseAsLibrary: !files.some((file) => basename(file) === 'main.swift'),
|
|
161
|
+
...(request.primaries ? { primaries: request.primaries } : {}),
|
|
162
|
+
indexdump: request.indexdump,
|
|
163
|
+
native: leg(request.native),
|
|
164
|
+
...(request.peach ? { peach: leg(request.peach) } : {}),
|
|
165
|
+
}
|
|
166
|
+
return {
|
|
167
|
+
status: 'ready' as const,
|
|
168
|
+
input,
|
|
169
|
+
package: {
|
|
170
|
+
name: manifest.name,
|
|
171
|
+
target: target.name,
|
|
172
|
+
entry: compile.entry,
|
|
173
|
+
directory: relative(root, target.dir),
|
|
174
|
+
sources: target.sources ? [...target.sources] : null,
|
|
175
|
+
exclusions: [...target.exclude],
|
|
176
|
+
languageMode: target.languageMode,
|
|
177
|
+
mainActorIsolation: target.mainActorIsolation,
|
|
178
|
+
configuration: request.configuration,
|
|
179
|
+
defines: target.defines.map((define) => ({ ...define })),
|
|
180
|
+
dependencies: [...target.dependencies],
|
|
181
|
+
manifests,
|
|
182
|
+
membership: description,
|
|
183
|
+
toolchain: manifest.toolchain,
|
|
184
|
+
owners: Object.fromEntries(
|
|
185
|
+
['swift-package-manifest.ts', 'swift-package.ts', 'swift-source-file.ts'].map(
|
|
186
|
+
(name) => [name, swiftCoverageProvenance[name]],
|
|
187
|
+
),
|
|
188
|
+
),
|
|
189
|
+
adapter: swiftCoverageProvenance['swift-coverage/package.ts'],
|
|
190
|
+
},
|
|
191
|
+
unknowns: [
|
|
192
|
+
'Membership is SwiftPM describe output for the original compiler snapshot. Defines use iOS/default traits and the requested configuration; this is not dependency closure or a complete build.',
|
|
193
|
+
'Unsupported Swift settings, generated sources and dependency modules are rejected. SDK and dependency artifact identity remain unknown. Caller compiler flags are retained; no dependencies are resolved or built.',
|
|
194
|
+
],
|
|
195
|
+
}
|
|
196
|
+
} catch (error) {
|
|
197
|
+
return unknown(error instanceof Error ? error.message : String(error))
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
export async function indexSwiftPackage(request: SwiftPackageSourceInput) {
|
|
202
|
+
const resolution = swiftPackageSourceInput(request)
|
|
203
|
+
if (resolution.status === 'unknown') return resolution
|
|
204
|
+
try {
|
|
205
|
+
const index = await indexSwiftApp(resolution.input)
|
|
206
|
+
const after = swiftPackageSourceInput(request)
|
|
207
|
+
if (
|
|
208
|
+
after.status === 'unknown' ||
|
|
209
|
+
JSON.stringify([after.package, after.input.files]) !==
|
|
210
|
+
JSON.stringify([resolution.package, resolution.input.files])
|
|
211
|
+
)
|
|
212
|
+
return {
|
|
213
|
+
status: 'unknown' as const,
|
|
214
|
+
reasons: [
|
|
215
|
+
'SwiftPM membership changed while indexing; refusing mixed provenance.',
|
|
216
|
+
],
|
|
217
|
+
}
|
|
218
|
+
return {
|
|
219
|
+
status: 'indexed' as const,
|
|
220
|
+
package: resolution.package,
|
|
221
|
+
unknowns: resolution.unknowns,
|
|
222
|
+
index,
|
|
223
|
+
}
|
|
224
|
+
} catch (error) {
|
|
225
|
+
return {
|
|
226
|
+
status: 'unknown' as const,
|
|
227
|
+
reasons: [error instanceof Error ? error.message : String(error)],
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { createHash } from 'node:crypto'
|
|
2
|
+
import { readFileSync } from 'node:fs'
|
|
3
|
+
import { join } from 'node:path'
|
|
4
|
+
|
|
5
|
+
// the same build-time digest path as the Swift compiler: bundled commands
|
|
6
|
+
// retain original source identities without reading a checkout at runtime.
|
|
7
|
+
export const SWIFT_COVERAGE_DIGEST_SOURCES = [
|
|
8
|
+
'swift-coverage/indexdump.ts',
|
|
9
|
+
'swift-coverage/indexing.ts',
|
|
10
|
+
'swift-coverage/types.ts',
|
|
11
|
+
'swift-coverage/source.ts',
|
|
12
|
+
'swift-coverage/package.ts',
|
|
13
|
+
'swift-coverage/xcode.ts',
|
|
14
|
+
'swift-coverage/xcode-assets.ts',
|
|
15
|
+
'swift-coverage/xcode-bridging.ts',
|
|
16
|
+
'swift-coverage/xcode-packages.ts',
|
|
17
|
+
'swift-coverage/xcode-strings.ts',
|
|
18
|
+
'swift-coverage/reader.ts',
|
|
19
|
+
'swift-coverage/provenance.ts',
|
|
20
|
+
'swift-package-manifest.ts',
|
|
21
|
+
'swift-package.ts',
|
|
22
|
+
'swift-source-file.ts',
|
|
23
|
+
'swift-toolchain.ts',
|
|
24
|
+
'home-paths.ts',
|
|
25
|
+
'xcode-header-search.ts',
|
|
26
|
+
'xcode-project.ts',
|
|
27
|
+
'xcode-target-members.ts',
|
|
28
|
+
'xcode-json-project.ts',
|
|
29
|
+
'openstep-plist.ts',
|
|
30
|
+
]
|
|
31
|
+
|
|
32
|
+
export function swiftCoverageSourceDigests(srcDir: string): Record<string, string> {
|
|
33
|
+
return Object.fromEntries(
|
|
34
|
+
SWIFT_COVERAGE_DIGEST_SOURCES.map((file) => [
|
|
35
|
+
file,
|
|
36
|
+
createHash('sha256')
|
|
37
|
+
.update(readFileSync(join(srcDir, file)))
|
|
38
|
+
.digest('hex'),
|
|
39
|
+
]),
|
|
40
|
+
)
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
declare const __SWIFT_COVERAGE_SOURCE_DIGESTS__: Record<string, string> | undefined
|
|
44
|
+
export const swiftCoverageProvenance =
|
|
45
|
+
typeof __SWIFT_COVERAGE_SOURCE_DIGESTS__ === 'object'
|
|
46
|
+
? __SWIFT_COVERAGE_SOURCE_DIGESTS__
|
|
47
|
+
: swiftCoverageSourceDigests(join(import.meta.dirname, '..'))
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import { execFileSync } from 'node:child_process'
|
|
2
|
+
import { createHash } from 'node:crypto'
|
|
3
|
+
import { existsSync, mkdirSync, readFileSync, realpathSync, writeFileSync } from 'node:fs'
|
|
4
|
+
import { dirname, join } from 'node:path'
|
|
5
|
+
import { SWIFT_INDEX_READER_SOURCE } from './indexdump'
|
|
6
|
+
import { swiftCoverageProvenance } from './provenance'
|
|
7
|
+
|
|
8
|
+
const sha256 = (bytes: string | Buffer) =>
|
|
9
|
+
createHash('sha256').update(bytes).digest('hex')
|
|
10
|
+
|
|
11
|
+
// the corpus and app scanner compile this same tiny c reader against the
|
|
12
|
+
// selected installed toolchain. no toolchain or sdk is installed here.
|
|
13
|
+
export function buildSwiftIndexReader(
|
|
14
|
+
swiftc: string,
|
|
15
|
+
output: string,
|
|
16
|
+
installInstructions?: () => string,
|
|
17
|
+
) {
|
|
18
|
+
const prerequisite = (missing: string[]) => {
|
|
19
|
+
throw new Error(
|
|
20
|
+
[
|
|
21
|
+
'Swift source indexing requires a complete installed Swift toolchain with libIndexStore and indexstore/indexstore.h; Xcode alone does not provide the reader header.',
|
|
22
|
+
`Missing reader prerequisites: ${missing.join(', ')}`,
|
|
23
|
+
installInstructions?.() ??
|
|
24
|
+
'Install a complete Swift toolchain and select its compiler before retrying.',
|
|
25
|
+
].join('\n'),
|
|
26
|
+
)
|
|
27
|
+
}
|
|
28
|
+
if (!existsSync(swiftc)) prerequisite([swiftc])
|
|
29
|
+
const toolchain = dirname(dirname(realpathSync(swiftc)))
|
|
30
|
+
const library = join(
|
|
31
|
+
toolchain,
|
|
32
|
+
'lib',
|
|
33
|
+
process.platform === 'darwin' ? 'libIndexStore.dylib' : 'libIndexStore.so',
|
|
34
|
+
)
|
|
35
|
+
const include = join(toolchain, 'local/include')
|
|
36
|
+
const header = join(include, 'indexstore/indexstore.h')
|
|
37
|
+
const missing = [library, header].filter((file) => !existsSync(file))
|
|
38
|
+
if (missing.length) prerequisite(missing)
|
|
39
|
+
const source = `${output}.c`
|
|
40
|
+
const compiler =
|
|
41
|
+
process.platform === 'darwin'
|
|
42
|
+
? execFileSync('xcrun', ['--find', 'clang'], { encoding: 'utf8' }).trim()
|
|
43
|
+
: join(toolchain, 'bin/clang')
|
|
44
|
+
const identity = {
|
|
45
|
+
compiler: {
|
|
46
|
+
path: compiler,
|
|
47
|
+
version: execFileSync(compiler, ['--version'], { encoding: 'utf8' }).trim(),
|
|
48
|
+
sha256: sha256(readFileSync(compiler)),
|
|
49
|
+
},
|
|
50
|
+
library: sha256(readFileSync(library)),
|
|
51
|
+
header: sha256(readFileSync(header)),
|
|
52
|
+
source: sha256(SWIFT_INDEX_READER_SOURCE),
|
|
53
|
+
builder: swiftCoverageProvenance['swift-coverage/reader.ts'],
|
|
54
|
+
}
|
|
55
|
+
const sdk =
|
|
56
|
+
process.platform === 'darwin'
|
|
57
|
+
? [
|
|
58
|
+
'-isysroot',
|
|
59
|
+
execFileSync('xcrun', ['--sdk', 'macosx', '--show-sdk-path'], {
|
|
60
|
+
encoding: 'utf8',
|
|
61
|
+
}).trim(),
|
|
62
|
+
]
|
|
63
|
+
: []
|
|
64
|
+
const args = [
|
|
65
|
+
'-O2',
|
|
66
|
+
...sdk,
|
|
67
|
+
'-I',
|
|
68
|
+
include,
|
|
69
|
+
'-L',
|
|
70
|
+
dirname(library),
|
|
71
|
+
'-lIndexStore',
|
|
72
|
+
`-Wl,-rpath,${dirname(library)}`,
|
|
73
|
+
'-o',
|
|
74
|
+
output,
|
|
75
|
+
source,
|
|
76
|
+
]
|
|
77
|
+
mkdirSync(dirname(output), { recursive: true })
|
|
78
|
+
writeFileSync(source, SWIFT_INDEX_READER_SOURCE)
|
|
79
|
+
execFileSync(compiler, args, { stdio: ['ignore', 'pipe', 'pipe'] })
|
|
80
|
+
return { identity, arguments: args, binary: sha256(readFileSync(output)) }
|
|
81
|
+
}
|
|
@@ -0,0 +1,252 @@
|
|
|
1
|
+
import { execFileSync } from 'node:child_process'
|
|
2
|
+
import { createHash } from 'node:crypto'
|
|
3
|
+
import { mkdtempSync, readFileSync, realpathSync, rmSync, statSync } from 'node:fs'
|
|
4
|
+
import { tmpdir } from 'node:os'
|
|
5
|
+
import { basename, isAbsolute, join, relative, resolve, sep } from 'node:path'
|
|
6
|
+
import { SWIFT_INDEX_READER_SOURCE } from './indexdump'
|
|
7
|
+
import { createSwiftIndexer } from './indexing'
|
|
8
|
+
import { swiftCoverageProvenance } from './provenance'
|
|
9
|
+
import type { SwiftIndexRef, SwiftSourceInput, SwiftSourceLeg } from './types'
|
|
10
|
+
|
|
11
|
+
const sha256 = (bytes: string | Buffer) =>
|
|
12
|
+
createHash('sha256').update(bytes).digest('hex')
|
|
13
|
+
|
|
14
|
+
// configuration and source membership come from the caller's build owner.
|
|
15
|
+
// no project parser, folded packages, synthetic source or sdk symbol allowlist.
|
|
16
|
+
export async function indexSwiftApp(input: SwiftSourceInput) {
|
|
17
|
+
if (!input.moduleName || !input.languageVersion)
|
|
18
|
+
throw new Error('Swift source input needs a module and language version')
|
|
19
|
+
if (!input.files.length || input.files.length > 2_000)
|
|
20
|
+
throw new Error('Swift source input needs 1 to 2000 explicit module files')
|
|
21
|
+
const root = realpathSync(input.root)
|
|
22
|
+
const sourcePath = (path: string) => {
|
|
23
|
+
const file = realpathSync(resolve(root, path))
|
|
24
|
+
const local = relative(root, file)
|
|
25
|
+
if (local === '..' || local.startsWith(`..${sep}`) || isAbsolute(local))
|
|
26
|
+
throw new Error(`Swift source is outside the app root: ${path}`)
|
|
27
|
+
if (!file.endsWith('.swift')) throw new Error(`not Swift source: ${path}`)
|
|
28
|
+
return file
|
|
29
|
+
}
|
|
30
|
+
const files = [...new Set(input.files.map(sourcePath))].sort()
|
|
31
|
+
const primaries = [...new Set((input.primaries ?? input.files).map(sourcePath))].sort()
|
|
32
|
+
if (!primaries.length || primaries.some((file) => !files.includes(file)))
|
|
33
|
+
throw new Error('Swift primaries must be a nonempty subset of the module files')
|
|
34
|
+
let bytes = 0
|
|
35
|
+
const sources = files.map((file) => {
|
|
36
|
+
const stat = statSync(file)
|
|
37
|
+
if (
|
|
38
|
+
!stat.isFile() ||
|
|
39
|
+
stat.size > 4 * 1024 * 1024 ||
|
|
40
|
+
bytes + stat.size > 32 * 1024 * 1024
|
|
41
|
+
)
|
|
42
|
+
throw new Error('Swift module exceeds source file or byte limits')
|
|
43
|
+
const content = readFileSync(file)
|
|
44
|
+
bytes += content.length
|
|
45
|
+
if (bytes > 32 * 1024 * 1024) throw new Error('Swift module exceeds 32 MiB')
|
|
46
|
+
return {
|
|
47
|
+
path: relative(root, file),
|
|
48
|
+
sha256: sha256(content),
|
|
49
|
+
bytes: content.length,
|
|
50
|
+
primary: primaries.includes(file),
|
|
51
|
+
}
|
|
52
|
+
})
|
|
53
|
+
const generated = (input.generated ?? []).map(({ path, producer }) => {
|
|
54
|
+
if (!isAbsolute(path) || !path.endsWith('.swift'))
|
|
55
|
+
throw new Error('Generated Swift members need an explicit absolute .swift path')
|
|
56
|
+
const file = realpathSync(path)
|
|
57
|
+
const content = readFileSync(file)
|
|
58
|
+
bytes += content.length
|
|
59
|
+
if (content.length > 4 * 1024 * 1024 || bytes > 32 * 1024 * 1024)
|
|
60
|
+
throw new Error('Swift module exceeds source file or byte limits')
|
|
61
|
+
return { file, sha256: sha256(content), bytes: content.length, producer }
|
|
62
|
+
})
|
|
63
|
+
const generatedRecords = generated.map(({ file, ...member }) => ({
|
|
64
|
+
name: basename(file),
|
|
65
|
+
...member,
|
|
66
|
+
}))
|
|
67
|
+
const binaryIdentity = (path: string) => {
|
|
68
|
+
if (!isAbsolute(path)) throw new Error('Swift tools need explicit absolute paths')
|
|
69
|
+
return { path, realpath: realpathSync(path), sha256: sha256(readFileSync(path)) }
|
|
70
|
+
}
|
|
71
|
+
const reader = binaryIdentity(input.indexdump)
|
|
72
|
+
const work = realpathSync(mkdtempSync(join(tmpdir(), 'peach-swift-source-')))
|
|
73
|
+
try {
|
|
74
|
+
const { indexModule } = createSwiftIndexer(input.indexdump, 1, root)
|
|
75
|
+
const collect = async (name: 'native' | 'peach', leg: SwiftSourceLeg) => {
|
|
76
|
+
// accept only the argument shapes this adapter supports. never forward
|
|
77
|
+
// arbitrary frontend arguments, response files or additional source inputs.
|
|
78
|
+
const flags = [...leg.flags]
|
|
79
|
+
const value = /^[^-@].*$/s
|
|
80
|
+
const supported: (string | RegExp)[][] = [
|
|
81
|
+
...[
|
|
82
|
+
'-target',
|
|
83
|
+
'-sdk',
|
|
84
|
+
'-resource-dir',
|
|
85
|
+
'-I',
|
|
86
|
+
'-F',
|
|
87
|
+
'-D',
|
|
88
|
+
'-default-isolation',
|
|
89
|
+
'-package-name',
|
|
90
|
+
'-enable-experimental-feature',
|
|
91
|
+
'-enable-upcoming-feature',
|
|
92
|
+
'-load-plugin-library',
|
|
93
|
+
].map((option) => [option, value]),
|
|
94
|
+
['-enable-bare-slash-regex'],
|
|
95
|
+
['-Xfrontend', '-enable-cross-import-overlays'],
|
|
96
|
+
['-Xfrontend', '-import-module', '-Xfrontend', value],
|
|
97
|
+
[
|
|
98
|
+
'-Xfrontend',
|
|
99
|
+
'-swift-module-cross-import',
|
|
100
|
+
'-Xfrontend',
|
|
101
|
+
value,
|
|
102
|
+
'-Xfrontend',
|
|
103
|
+
value,
|
|
104
|
+
],
|
|
105
|
+
['-Xcc', /^-D[A-Za-z_]\w*(?:=.*)?$/s],
|
|
106
|
+
['-Xcc', /^-fmodule-map-file=[^-@].*$/s],
|
|
107
|
+
['-Xcc', '-I', '-Xcc', value],
|
|
108
|
+
['-Xcc', '-iquote', '-Xcc', value],
|
|
109
|
+
['-import-objc-header', value],
|
|
110
|
+
]
|
|
111
|
+
for (let at = 0; at < flags.length; ) {
|
|
112
|
+
const shape = supported.find((shape) =>
|
|
113
|
+
shape.every((part, offset) => {
|
|
114
|
+
const argument = flags[at + offset]
|
|
115
|
+
return (
|
|
116
|
+
argument !== undefined &&
|
|
117
|
+
(typeof part === 'string' ? part === argument : part.test(argument))
|
|
118
|
+
)
|
|
119
|
+
}),
|
|
120
|
+
)
|
|
121
|
+
if (!shape)
|
|
122
|
+
throw new Error(
|
|
123
|
+
`unsupported project flags may override Swift index configuration: ${flags[at]}`,
|
|
124
|
+
)
|
|
125
|
+
at += shape.length
|
|
126
|
+
}
|
|
127
|
+
const compiler = {
|
|
128
|
+
...binaryIdentity(leg.swiftc),
|
|
129
|
+
version: execFileSync(leg.swiftc, ['--version'], {
|
|
130
|
+
encoding: 'utf8',
|
|
131
|
+
cwd: root,
|
|
132
|
+
stdio: ['ignore', 'pipe', 'pipe'],
|
|
133
|
+
}).trim(),
|
|
134
|
+
}
|
|
135
|
+
const result = await indexModule(
|
|
136
|
+
{ name, swiftc: leg.swiftc, flags: () => flags },
|
|
137
|
+
'',
|
|
138
|
+
input.moduleName,
|
|
139
|
+
[...files, ...generated.map(({ file }) => file)],
|
|
140
|
+
primaries,
|
|
141
|
+
join(work, name),
|
|
142
|
+
{ languageVersion: input.languageVersion, parseAsLibrary: input.parseAsLibrary },
|
|
143
|
+
)
|
|
144
|
+
return {
|
|
145
|
+
refs: result.refs,
|
|
146
|
+
errors: result.errors,
|
|
147
|
+
provenance: {
|
|
148
|
+
compiler,
|
|
149
|
+
flags,
|
|
150
|
+
commands: primaries.map((file) => ({
|
|
151
|
+
file: relative(root, file),
|
|
152
|
+
...result.commands.get(file)!,
|
|
153
|
+
})),
|
|
154
|
+
succeeded: result.errors.size === 0,
|
|
155
|
+
},
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
const native = await collect('native', input.native)
|
|
159
|
+
const peach = input.peach ? await collect('peach', input.peach) : null
|
|
160
|
+
for (let at = 0; at < files.length; at++)
|
|
161
|
+
if (sha256(readFileSync(files[at]!)) !== sources[at]!.sha256)
|
|
162
|
+
throw new Error('Swift source changed while indexing; refusing mixed provenance')
|
|
163
|
+
for (const member of generated)
|
|
164
|
+
if (sha256(readFileSync(member.file)) !== member.sha256)
|
|
165
|
+
throw new Error(
|
|
166
|
+
'Generated Swift source changed while indexing; refusing mixed provenance',
|
|
167
|
+
)
|
|
168
|
+
|
|
169
|
+
const bySite = new Map<string, SwiftIndexRef[]>()
|
|
170
|
+
for (const [file, refs] of peach?.refs ?? [])
|
|
171
|
+
for (const ref of refs) {
|
|
172
|
+
const key = JSON.stringify([file, ref.line, ref.col])
|
|
173
|
+
const candidates = bySite.get(key) ?? []
|
|
174
|
+
candidates.push(ref)
|
|
175
|
+
bySite.set(key, candidates)
|
|
176
|
+
}
|
|
177
|
+
const sites = primaries.flatMap((file) => {
|
|
178
|
+
const seen = new Set<string>()
|
|
179
|
+
return (native.refs.get(file) ?? []).flatMap((ref) => {
|
|
180
|
+
const path = relative(root, file)
|
|
181
|
+
const id = JSON.stringify([input.moduleName, path, ref.line, ref.col, ref.usr])
|
|
182
|
+
if (seen.has(id)) return []
|
|
183
|
+
seen.add(id)
|
|
184
|
+
const candidates = bySite.get(JSON.stringify([file, ref.line, ref.col])) ?? []
|
|
185
|
+
const comparison: 'unknown' | 'same-usr' | 'different-usr' | 'missing' =
|
|
186
|
+
!peach || native.errors.has(file) || peach.errors.has(file)
|
|
187
|
+
? 'unknown'
|
|
188
|
+
: candidates.some((candidate) => candidate.usr === ref.usr)
|
|
189
|
+
? 'same-usr'
|
|
190
|
+
: candidates.length
|
|
191
|
+
? 'different-usr'
|
|
192
|
+
: 'missing'
|
|
193
|
+
return [
|
|
194
|
+
{
|
|
195
|
+
id,
|
|
196
|
+
file: path,
|
|
197
|
+
...ref,
|
|
198
|
+
nativeTypechecked: !native.errors.has(file),
|
|
199
|
+
comparison,
|
|
200
|
+
peachCandidates: candidates,
|
|
201
|
+
declarationModule: null,
|
|
202
|
+
origin: 'unknown',
|
|
203
|
+
mapping: 'unknown',
|
|
204
|
+
verification: 'unknown',
|
|
205
|
+
},
|
|
206
|
+
]
|
|
207
|
+
})
|
|
208
|
+
})
|
|
209
|
+
return {
|
|
210
|
+
input: {
|
|
211
|
+
kind: 'swift-source-index',
|
|
212
|
+
root,
|
|
213
|
+
moduleName: input.moduleName,
|
|
214
|
+
languageVersion: input.languageVersion,
|
|
215
|
+
parseAsLibrary: input.parseAsLibrary !== false,
|
|
216
|
+
sources,
|
|
217
|
+
generated: generatedRecords,
|
|
218
|
+
fingerprint: sha256(
|
|
219
|
+
JSON.stringify([
|
|
220
|
+
input.moduleName,
|
|
221
|
+
input.languageVersion,
|
|
222
|
+
input.parseAsLibrary !== false,
|
|
223
|
+
sources,
|
|
224
|
+
generatedRecords,
|
|
225
|
+
]),
|
|
226
|
+
),
|
|
227
|
+
},
|
|
228
|
+
indexReader: reader,
|
|
229
|
+
producer: {
|
|
230
|
+
indexer: swiftCoverageProvenance['swift-coverage/indexing.ts'],
|
|
231
|
+
reader: sha256(SWIFT_INDEX_READER_SOURCE),
|
|
232
|
+
adapter: swiftCoverageProvenance['swift-coverage/source.ts'],
|
|
233
|
+
sources: swiftCoverageProvenance,
|
|
234
|
+
},
|
|
235
|
+
native: native.provenance,
|
|
236
|
+
peach: peach?.provenance ?? null,
|
|
237
|
+
sites,
|
|
238
|
+
unknowns: [
|
|
239
|
+
'The caller supplies source membership and compiler flags; project discovery and dependency closure are unknown.',
|
|
240
|
+
'Flags and compiler versions are recorded; SDK versions, dependency module contents and IndexStore library provenance are unknown.',
|
|
241
|
+
'The reader source hash identifies this repository source only; its binding to the caller-supplied reader binary is unknown.',
|
|
242
|
+
'USR sites include app and library symbols; declaration modules, front doors, features and native proof are unknown.',
|
|
243
|
+
'Missing sites do not establish platform inactivity. Failed primaries may omit references; partial indexes establish no coverage percentage.',
|
|
244
|
+
...(peach
|
|
245
|
+
? []
|
|
246
|
+
: ['No Peach compiler leg was supplied; site comparison is unknown.']),
|
|
247
|
+
],
|
|
248
|
+
}
|
|
249
|
+
} finally {
|
|
250
|
+
rmSync(work, { recursive: true, force: true })
|
|
251
|
+
}
|
|
252
|
+
}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import type { SwiftCompileInput } from '../swift-compile'
|
|
2
|
+
|
|
3
|
+
export type SwiftIndexRef = {
|
|
4
|
+
line: number
|
|
5
|
+
col: number
|
|
6
|
+
usr: string
|
|
7
|
+
name: string
|
|
8
|
+
kind: number
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export type SwiftIndexLeg = {
|
|
12
|
+
name: 'native' | 'peach'
|
|
13
|
+
swiftc: string
|
|
14
|
+
flags: (modules: string) => string[]
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export type SwiftIndexCommand = {
|
|
18
|
+
arguments: string[]
|
|
19
|
+
code: number
|
|
20
|
+
diagnostics: string
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export type SwiftSourceLeg = {
|
|
24
|
+
swiftc: string
|
|
25
|
+
flags: string[]
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/** a module member produced by a build tool, never an original or a primary. */
|
|
29
|
+
export type SwiftGeneratedSource = {
|
|
30
|
+
path: string
|
|
31
|
+
producer: Record<string, unknown>
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export type SwiftSourceInput = {
|
|
35
|
+
root: string
|
|
36
|
+
moduleName: string
|
|
37
|
+
languageVersion: string
|
|
38
|
+
files: string[]
|
|
39
|
+
generated?: SwiftGeneratedSource[]
|
|
40
|
+
primaries?: string[]
|
|
41
|
+
parseAsLibrary?: boolean
|
|
42
|
+
indexdump: string
|
|
43
|
+
native: SwiftSourceLeg
|
|
44
|
+
peach?: SwiftSourceLeg
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
export interface SwiftPackageSourceInput {
|
|
48
|
+
root: string
|
|
49
|
+
/** the existing build owner's original file snapshot, never lowered sources. */
|
|
50
|
+
compile: SwiftCompileInput
|
|
51
|
+
/** omission is unambiguous only for one executable target. */
|
|
52
|
+
target?: string
|
|
53
|
+
primaries?: string[]
|
|
54
|
+
configuration: 'debug' | 'release'
|
|
55
|
+
indexdump: string
|
|
56
|
+
native: SwiftSourceLeg
|
|
57
|
+
peach?: SwiftSourceLeg
|
|
58
|
+
}
|