peachsim 0.1.2633 → 0.1.2634
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/dist-lib/agent-daemon-client.cjs +1 -1
- package/dist-lib/agent-events.cjs +1 -1
- package/dist-lib/attached-projects.cjs +1 -1
- package/dist-lib/auth/shared-session.cjs +1 -1
- package/dist-lib/backend-origin.cjs +1 -1
- package/dist-lib/beta.cjs +1 -1
- package/dist-lib/beta.mjs +2 -2
- package/dist-lib/bridge-constants.cjs +1 -1
- package/dist-lib/bridge-contract-input.cjs +1 -1
- package/dist-lib/bridge-contract-input.mjs +5 -5
- package/dist-lib/bridge-contract.cjs +1 -1
- package/dist-lib/bridge-contract.mjs +3 -3
- package/dist-lib/bundle-channel.cjs +1027 -900
- package/dist-lib/capture-contract.cjs +1 -1
- package/dist-lib/capture-contract.mjs +3 -3
- package/dist-lib/cloud-contract.cjs +1 -1
- package/dist-lib/cloud-contract.mjs +3 -3
- package/dist-lib/cloud-test-args.cjs +1 -1
- package/dist-lib/cloud-test-args.mjs +2 -2
- package/dist-lib/cloud.cjs +1 -1
- package/dist-lib/cloud.mjs +7 -7
- package/dist-lib/config.cjs +1 -1
- package/dist-lib/config.mjs +5 -5
- package/dist-lib/detox/index.cjs +1 -1
- package/dist-lib/dev-bundle-resolution.cjs +1 -1
- package/dist-lib/esm-chunks/{acorn-G52HY6SM.mjs → acorn-E7YS7T7M.mjs} +3 -3
- package/dist-lib/esm-chunks/{chunk-JXGUFZNW.mjs → chunk-2SB3P7CJ.mjs} +1 -1
- package/dist-lib/esm-chunks/{chunk-IYR6EA7F.mjs → chunk-2VYVW3RF.mjs} +1 -1
- package/dist-lib/esm-chunks/{chunk-6QNPQ4SG.mjs → chunk-4SRXXXOC.mjs} +1 -1
- package/dist-lib/esm-chunks/{chunk-GOOWNGNO.mjs → chunk-6EG4II5F.mjs} +1 -1
- package/dist-lib/esm-chunks/{chunk-AF22LKX3.mjs → chunk-6YZJ2GYO.mjs} +1 -1
- package/dist-lib/esm-chunks/{chunk-QG5X4QGH.mjs → chunk-CXDXPI7W.mjs} +5 -5
- package/dist-lib/esm-chunks/{chunk-YX3KDBUQ.mjs → chunk-ERQZXSHP.mjs} +1 -1
- package/dist-lib/esm-chunks/{chunk-JXAUTMVF.mjs → chunk-H223T2KC.mjs} +1 -1
- package/dist-lib/esm-chunks/{chunk-UIWCC5CL.mjs → chunk-N2XQ3OUI.mjs} +2 -2
- package/dist-lib/esm-chunks/{chunk-RMO7B3V3.mjs → chunk-NPVYXBWM.mjs} +1 -1
- package/dist-lib/esm-chunks/{chunk-F3YEDOHY.mjs → chunk-P4JHWOEI.mjs} +1 -1
- package/dist-lib/esm-chunks/{chunk-QNJWVYGV.mjs → chunk-PCY75YWE.mjs} +1 -1
- package/dist-lib/esm-chunks/{chunk-YGGDE6F4.mjs → chunk-PXOH2HF6.mjs} +4 -4
- package/dist-lib/esm-chunks/{chunk-53O5O5G3.mjs → chunk-RN4YJUYM.mjs} +6 -6
- package/dist-lib/esm-chunks/{chunk-2HONUZR5.mjs → chunk-S4CJUCCF.mjs} +1 -1
- package/dist-lib/esm-chunks/{chunk-5G5JC3BO.mjs → chunk-TPIVMDXH.mjs} +1 -1
- package/dist-lib/esm-chunks/{chunk-FMPZXHCH.mjs → chunk-VPM63Q6Z.mjs} +1 -1
- package/dist-lib/esm-chunks/{chunk-RDKGAR7Q.mjs → chunk-WH5NWS6Z.mjs} +1 -1
- package/dist-lib/esm-chunks/{chunk-OOH2FHFR.mjs → chunk-WWO6KGXH.mjs} +1 -1
- package/dist-lib/esm-chunks/{chunk-RK7OADCF.mjs → chunk-X2TVSD4W.mjs} +42 -32
- package/dist-lib/esm-chunks/{chunk-QRIQ2Z7A.mjs → chunk-X726CWSL.mjs} +1 -1
- package/dist-lib/esm-chunks/{chunk-GFBC7EHF.mjs → chunk-XOL6DFMM.mjs} +1 -1
- package/dist-lib/esm-chunks/{chunk-RFOIAO3R.mjs → chunk-Y4EG7XXB.mjs} +3 -3
- package/dist-lib/esm-chunks/{chunk-XIIMFZNV.mjs → chunk-YLD4VKUR.mjs} +6 -6
- package/dist-lib/esm-chunks/{metro-layout-parser-PQYC5COZ.mjs → metro-layout-parser-I7JGQQV2.mjs} +3 -3
- package/dist-lib/esm-chunks/{swift-package-prebuilt-5XWQHVOU.mjs → swift-package-prebuilt-CXXM7OME.mjs} +12 -12
- package/dist-lib/esm-chunks/{swift-sdk-app-module-ICX3VS5Z.mjs → swift-sdk-app-module-XKY52BHH.mjs} +16 -16
- package/dist-lib/esm-chunks/{swift-sdk-image-KI37XSBI.mjs → swift-sdk-image-EUTGX6FL.mjs} +16 -16
- package/dist-lib/esm-chunks/{swift-sdk-image-producer-G5HVINR2.mjs → swift-sdk-image-producer-JVAFRRME.mjs} +5 -5
- package/dist-lib/expo-swift-bundle.cjs +31 -21
- package/dist-lib/expo-swift-metadata.cjs +1 -1
- package/dist-lib/expo-swift-metadata.mjs +7 -7
- package/dist-lib/home-paths.cjs +1 -1
- package/dist-lib/host/bridge-host.cjs +7575 -7354
- 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 +2 -2
- package/dist-lib/host/replacement-module-handler.cjs +1 -1
- package/dist-lib/host/websocket-proxy.cjs +1 -1
- package/dist-lib/index.cjs +1 -1
- package/dist-lib/kotlin-host.cjs +1 -1
- package/dist-lib/menu.cjs +1 -1
- package/dist-lib/menu.mjs +3 -3
- package/dist-lib/metro-fingerprint-registry.cjs +1 -1
- package/dist-lib/metro-fingerprint-registry.mjs +3 -3
- package/dist-lib/metro-production-bundle.cjs +1 -1
- package/dist-lib/metro-production-bundle.mjs +4 -4
- package/dist-lib/native-app-identity-project.cjs +1 -1
- package/dist-lib/native-app-identity-project.mjs +15 -15
- package/dist-lib/native-app-identity.cjs +1 -1
- package/dist-lib/native-app-identity.mjs +6 -6
- package/dist-lib/native-firebase-metadata.cjs +1 -1
- package/dist-lib/native-firebase-metadata.mjs +3 -3
- package/dist-lib/pdfium-raster.cjs +1 -1
- package/dist-lib/pdfium-raster.mjs +2 -2
- package/dist-lib/plist.cjs +1 -1
- package/dist-lib/plist.mjs +3 -3
- package/dist-lib/profiles.cjs +1 -1
- package/dist-lib/public-brand.cjs +1 -1
- package/dist-lib/public-origins-lib-esm.json +85 -85
- package/dist-lib/public-origins-lib.json +89 -82
- package/dist-lib/react-native-host-modules.cjs +1 -1
- package/dist-lib/react-native-host-modules.mjs +2 -2
- package/dist-lib/reap-browser.cjs +1 -1
- package/dist-lib/scripts/dev-server-scanner.cjs +1 -1
- package/dist-lib/sdk.cjs +1 -1
- package/dist-lib/sdk.mjs +8 -8
- package/dist-lib/skills.cjs +8181 -7950
- package/dist-lib/swift-compile.cjs +29 -19
- package/dist-lib/swift-compile.mjs +12 -12
- package/dist-lib/swift-package.cjs +1 -1
- package/dist-lib/swift-package.mjs +3 -3
- package/dist-lib/swift-submit.cjs +1 -1
- package/dist-lib/swift-submit.mjs +6 -6
- package/dist-lib/swift-svg-raster.cjs +1 -1
- package/dist-lib/swift-svg-raster.mjs +2 -2
- package/dist-lib/swift-toolchain.cjs +1 -1
- package/dist-lib/swift.cjs +1 -1
- package/dist-lib/vendor/@peculiar/x509.cjs +1 -1
- package/dist-lib/vendor/@ruby/prism/src/nodes.js.cjs +1 -1
- package/dist-lib/vendor/@ruby/prism/src/parsePrism.js.cjs +1 -1
- package/dist-lib/vendor/acorn.cjs +1 -1
- package/dist-lib/vendor/magic-string.cjs +1 -1
- package/dist-lib/vendor/stream-json.cjs +1 -1
- package/dist-lib/vendor/sucrase/dist/index.js.cjs +1 -1
- package/dist-lib/vendor/sucrase/dist/parser/index.js.cjs +1 -1
- package/dist-lib/vendor/sucrase/dist/parser/tokenizer/index.js.cjs +1 -1
- package/dist-lib/vendor/sucrase/dist/parser/tokenizer/types.js.cjs +1 -1
- package/dist-lib/vendor/sucrase.cjs +1 -1
- package/dist-lib/vendor/terser.cjs +1 -1
- package/dist-lib/vendor/valibot.cjs +1 -1
- package/dist-lib/vendor/ws.cjs +1 -1
- package/dist-lib/vendor/zod.cjs +1 -1
- package/dist-lib/worklet-executable.cjs +1 -1
- package/dist-lib/worklet-executable.mjs +3 -3
- package/dist-types/packages/peach-engine/src/engine/native-node-queries.d.ts +1 -0
- package/package.json +1 -1
- package/src/host/bridge-host.ts +42 -20
- package/src/native-package-slice-build.ts +44 -31
- package/src/one-native-controls-package.ts +80 -14
- package/src/one-native-controls-release.ts +69 -0
- package/src/one-sdk/shard.ts +382 -0
- package/src/one-sdk-bundle.ts +4 -208
- package/src/swift-compile.ts +44 -19
package/src/one-sdk-bundle.ts
CHANGED
|
@@ -4,9 +4,10 @@ import path from 'node:path'
|
|
|
4
4
|
import { prepareExpoNativeProject } from './expo-native-workspace'
|
|
5
5
|
import { compiledModuleAssets, compiledModuleRequestHandler } from './nitro-bundle'
|
|
6
6
|
import { selectOneSDK } from './one-sdk-preparation'
|
|
7
|
+
import { shardOneSDKBindingSource } from './one-sdk/shard'
|
|
7
8
|
import { oneSDKApp, oneSDKHost, oneSDKModule, oneSDKTransport } from './one-sdk/source'
|
|
8
9
|
import { ONE_SDK_SOURCE_DIRECTORY, readOneSDKSourceManifest } from './oneSdkContract'
|
|
9
|
-
import {
|
|
10
|
+
import { syncSwiftTree } from './swift-compile'
|
|
10
11
|
import { resolveSwiftModule } from './swift-distribution'
|
|
11
12
|
import { artifactFor, icuUrl, projectFor } from './swift-host'
|
|
12
13
|
import { swiftCacheDir } from './swift-toolchain'
|
|
@@ -33,208 +34,6 @@ export interface OneSDKLinkSources {
|
|
|
33
34
|
modules: string[]
|
|
34
35
|
}
|
|
35
36
|
|
|
36
|
-
type BindingChunk =
|
|
37
|
-
| { kind: 'top'; text: string }
|
|
38
|
-
| { kind: 'enumMember'; enumName: string; text: string }
|
|
39
|
-
|
|
40
|
-
const ONE_SDK_BINDING_SHARDS = 8
|
|
41
|
-
const ONE_SDK_BINDING_SHARD_MIN_BYTES = 256 * 1024
|
|
42
|
-
|
|
43
|
-
// split large generated binding files across compilation units so swiftc can
|
|
44
|
-
// compile OneSDKBindings in parallel under -no-whole-module-optimization.
|
|
45
|
-
function shardOneSDKBindingSource(
|
|
46
|
-
name: string,
|
|
47
|
-
source: string,
|
|
48
|
-
shardCount = ONE_SDK_BINDING_SHARDS,
|
|
49
|
-
): [string, string][] {
|
|
50
|
-
if (
|
|
51
|
-
shardCount <= 1 ||
|
|
52
|
-
!name.endsWith('.swift') ||
|
|
53
|
-
name.endsWith('.types.swift') ||
|
|
54
|
-
source.length < ONE_SDK_BINDING_SHARD_MIN_BYTES
|
|
55
|
-
) {
|
|
56
|
-
return [[name, source]]
|
|
57
|
-
}
|
|
58
|
-
const masked = swiftCodeMask(source)
|
|
59
|
-
if (/\bfileprivate\b/.test(masked)) return [[name, source]]
|
|
60
|
-
const lines = source.split('\n')
|
|
61
|
-
const maskedLines = masked.split('\n')
|
|
62
|
-
if (lines.length !== maskedLines.length) return [[name, source]]
|
|
63
|
-
|
|
64
|
-
const headerLines: string[] = []
|
|
65
|
-
let index = 0
|
|
66
|
-
while (index < lines.length) {
|
|
67
|
-
const trimmed = lines[index]!.trim()
|
|
68
|
-
if (
|
|
69
|
-
trimmed === '' ||
|
|
70
|
-
trimmed.startsWith('// generated ') ||
|
|
71
|
-
trimmed.startsWith('import ')
|
|
72
|
-
) {
|
|
73
|
-
headerLines.push(lines[index]!)
|
|
74
|
-
index++
|
|
75
|
-
continue
|
|
76
|
-
}
|
|
77
|
-
break
|
|
78
|
-
}
|
|
79
|
-
const header = `${headerLines.join('\n').trimEnd()}\n\n`
|
|
80
|
-
const chunks: BindingChunk[] = []
|
|
81
|
-
let depth = 0
|
|
82
|
-
let pending: string[] = []
|
|
83
|
-
let hadBrace = false
|
|
84
|
-
let activeEnum: string | null = null
|
|
85
|
-
let memberLines: string[] = []
|
|
86
|
-
let memberHadBrace = false
|
|
87
|
-
|
|
88
|
-
for (; index < lines.length; index++) {
|
|
89
|
-
const line = lines[index]!
|
|
90
|
-
const maskedLine = maskedLines[index]!
|
|
91
|
-
if (depth <= 1 && /^\s*#/.test(maskedLine)) return [[name, source]]
|
|
92
|
-
let delta = 0
|
|
93
|
-
for (let i = 0; i < maskedLine.length; i++) {
|
|
94
|
-
const ch = maskedLine[i]
|
|
95
|
-
if (ch === '{') delta++
|
|
96
|
-
else if (ch === '}') delta--
|
|
97
|
-
}
|
|
98
|
-
if (activeEnum === null) {
|
|
99
|
-
if (
|
|
100
|
-
depth === 0 &&
|
|
101
|
-
!hadBrace &&
|
|
102
|
-
/^\s*(?:@\w+(?:\([^)]*\))?\s+)*private\b/.test(maskedLine)
|
|
103
|
-
) {
|
|
104
|
-
return [[name, source]]
|
|
105
|
-
}
|
|
106
|
-
const enumMatch =
|
|
107
|
-
depth === 0 &&
|
|
108
|
-
!hadBrace &&
|
|
109
|
-
pending.every((item) => item.trim() === '' || item.trim().startsWith('//'))
|
|
110
|
-
? /^enum (OneSDK_\w+)\s*\{\s*$/.exec(maskedLine)
|
|
111
|
-
: null
|
|
112
|
-
if (enumMatch && delta === 1) {
|
|
113
|
-
const enumName = enumMatch[1]!
|
|
114
|
-
const prefix = pending.filter((item) => item.trim() !== '')
|
|
115
|
-
chunks.push({
|
|
116
|
-
kind: 'top',
|
|
117
|
-
text: [...prefix, `enum ${enumName} {}`].join('\n'),
|
|
118
|
-
})
|
|
119
|
-
pending = []
|
|
120
|
-
activeEnum = enumName
|
|
121
|
-
depth = 1
|
|
122
|
-
continue
|
|
123
|
-
}
|
|
124
|
-
if (depth === 0 && !hadBrace && line.trim() === '' && pending.length === 0) {
|
|
125
|
-
continue
|
|
126
|
-
}
|
|
127
|
-
pending.push(line)
|
|
128
|
-
if (delta !== 0 || depth > 0) hadBrace = true
|
|
129
|
-
depth += delta
|
|
130
|
-
if (depth < 0) return [[name, source]]
|
|
131
|
-
if (hadBrace && depth === 0) {
|
|
132
|
-
chunks.push({ kind: 'top', text: pending.join('\n') })
|
|
133
|
-
pending = []
|
|
134
|
-
hadBrace = false
|
|
135
|
-
}
|
|
136
|
-
} else {
|
|
137
|
-
const nextDepth = depth + delta
|
|
138
|
-
if (nextDepth < 0) return [[name, source]]
|
|
139
|
-
if (depth === 1 && nextDepth === 0) {
|
|
140
|
-
if (memberHadBrace || maskedLine.trim() !== '}') return [[name, source]]
|
|
141
|
-
if (
|
|
142
|
-
memberLines.some((item) => item.trim() !== '' && !item.trim().startsWith('//'))
|
|
143
|
-
) {
|
|
144
|
-
chunks.push({
|
|
145
|
-
kind: 'enumMember',
|
|
146
|
-
enumName: activeEnum,
|
|
147
|
-
text: memberLines.join('\n'),
|
|
148
|
-
})
|
|
149
|
-
}
|
|
150
|
-
activeEnum = null
|
|
151
|
-
depth = 0
|
|
152
|
-
memberLines = []
|
|
153
|
-
continue
|
|
154
|
-
}
|
|
155
|
-
if (
|
|
156
|
-
depth === 1 &&
|
|
157
|
-
!memberHadBrace &&
|
|
158
|
-
/^\s*(?:@\w+(?:\([^)]*\))?\s+)*private\b/.test(maskedLine)
|
|
159
|
-
) {
|
|
160
|
-
return [[name, source]]
|
|
161
|
-
}
|
|
162
|
-
if (depth === 1 && !memberHadBrace && line.trim() === '') {
|
|
163
|
-
depth = nextDepth
|
|
164
|
-
continue
|
|
165
|
-
}
|
|
166
|
-
memberLines.push(line)
|
|
167
|
-
if (nextDepth > 1 || delta !== 0) memberHadBrace = true
|
|
168
|
-
depth = nextDepth
|
|
169
|
-
if (memberHadBrace && depth === 1) {
|
|
170
|
-
chunks.push({
|
|
171
|
-
kind: 'enumMember',
|
|
172
|
-
enumName: activeEnum,
|
|
173
|
-
text: memberLines.join('\n'),
|
|
174
|
-
})
|
|
175
|
-
memberLines = []
|
|
176
|
-
memberHadBrace = false
|
|
177
|
-
}
|
|
178
|
-
}
|
|
179
|
-
}
|
|
180
|
-
|
|
181
|
-
if (
|
|
182
|
-
depth !== 0 ||
|
|
183
|
-
activeEnum !== null ||
|
|
184
|
-
pending.some((item) => item.trim() !== '' && !item.trim().startsWith('//')) ||
|
|
185
|
-
chunks.length < shardCount
|
|
186
|
-
) {
|
|
187
|
-
return [[name, source]]
|
|
188
|
-
}
|
|
189
|
-
|
|
190
|
-
const totalChars = chunks.reduce((sum, chunk) => sum + chunk.text.length, 0)
|
|
191
|
-
const targetChars = Math.ceil(totalChars / shardCount)
|
|
192
|
-
const buckets: BindingChunk[][] = []
|
|
193
|
-
let current: BindingChunk[] = []
|
|
194
|
-
let currentChars = 0
|
|
195
|
-
for (const chunk of chunks) {
|
|
196
|
-
if (
|
|
197
|
-
current.length > 0 &&
|
|
198
|
-
currentChars + chunk.text.length > targetChars &&
|
|
199
|
-
buckets.length + 1 < shardCount
|
|
200
|
-
) {
|
|
201
|
-
buckets.push(current)
|
|
202
|
-
current = []
|
|
203
|
-
currentChars = 0
|
|
204
|
-
}
|
|
205
|
-
current.push(chunk)
|
|
206
|
-
currentChars += chunk.text.length
|
|
207
|
-
}
|
|
208
|
-
if (current.length > 0) buckets.push(current)
|
|
209
|
-
|
|
210
|
-
const stem = name.slice(0, -'.swift'.length)
|
|
211
|
-
return buckets.map((bucket, shardIndex) => {
|
|
212
|
-
const parts: string[] = []
|
|
213
|
-
let openEnum: string | null = null
|
|
214
|
-
let enumBody: string[] = []
|
|
215
|
-
const flushEnum = () => {
|
|
216
|
-
if (!openEnum) return
|
|
217
|
-
parts.push(`extension ${openEnum} {\n${enumBody.join('\n\n')}\n}`)
|
|
218
|
-
openEnum = null
|
|
219
|
-
enumBody = []
|
|
220
|
-
}
|
|
221
|
-
for (const chunk of bucket) {
|
|
222
|
-
if (chunk.kind === 'enumMember') {
|
|
223
|
-
if (openEnum !== chunk.enumName) {
|
|
224
|
-
flushEnum()
|
|
225
|
-
openEnum = chunk.enumName
|
|
226
|
-
}
|
|
227
|
-
enumBody.push(chunk.text)
|
|
228
|
-
} else {
|
|
229
|
-
flushEnum()
|
|
230
|
-
parts.push(chunk.text)
|
|
231
|
-
}
|
|
232
|
-
}
|
|
233
|
-
flushEnum()
|
|
234
|
-
return [`${stem}_${shardIndex}.swift`, `${header}${parts.join('\n\n')}\n`]
|
|
235
|
-
})
|
|
236
|
-
}
|
|
237
|
-
|
|
238
37
|
export async function oneSDKLinkSources(
|
|
239
38
|
appRoot: string,
|
|
240
39
|
preparedRoot: string,
|
|
@@ -284,11 +83,8 @@ export async function oneSDKLinkSources(
|
|
|
284
83
|
const filePath = `Sources/OneSDKBindings/${name}`
|
|
285
84
|
const source = fs.readFileSync(path.join(sourceRoot, name), 'utf8')
|
|
286
85
|
if (options.shard) {
|
|
287
|
-
for (const
|
|
288
|
-
|
|
289
|
-
source,
|
|
290
|
-
))
|
|
291
|
-
targets.set(shardedName, shardedSource)
|
|
86
|
+
for (const shard of shardOneSDKBindingSource(filePath, source))
|
|
87
|
+
targets.set(shard.name, shard.source)
|
|
292
88
|
} else {
|
|
293
89
|
targets.set(filePath, source)
|
|
294
90
|
}
|
package/src/swift-compile.ts
CHANGED
|
@@ -2241,7 +2241,8 @@ export function syncSwiftTree(
|
|
|
2241
2241
|
// must not remove them.
|
|
2242
2242
|
entry.name === CLANG_DISTRIBUTION_MODULES ||
|
|
2243
2243
|
entry.name === SWIFT_DISTRIBUTION_MIRROR ||
|
|
2244
|
-
entry.name === SWIFT_LINK_STAMP
|
|
2244
|
+
entry.name === SWIFT_LINK_STAMP ||
|
|
2245
|
+
entry.name === SWIFT_BUILD_ROOT_SHAPE)
|
|
2245
2246
|
)
|
|
2246
2247
|
continue
|
|
2247
2248
|
if (entry.isDirectory()) walk(full)
|
|
@@ -6726,7 +6727,8 @@ async function withSwiftFrameworkSlot<T>(
|
|
|
6726
6727
|
// slots without blocking or thrashing each other's incremental objects.
|
|
6727
6728
|
async function withSwiftBuildRootSlot<T>(
|
|
6728
6729
|
baseRoot: string,
|
|
6729
|
-
|
|
6730
|
+
exactShape: string,
|
|
6731
|
+
compatShape: string,
|
|
6730
6732
|
signal: AbortSignal | undefined,
|
|
6731
6733
|
work: (slotRoot: string, lease: SwiftRootLease, waitedMs: number) => Promise<T>,
|
|
6732
6734
|
): Promise<T> {
|
|
@@ -6744,15 +6746,23 @@ async function withSwiftBuildRootSlot<T>(
|
|
|
6744
6746
|
const built = new Map(slots.map((slot) => [slot, statSync(slot).mtimeMs]))
|
|
6745
6747
|
const ranked = slots
|
|
6746
6748
|
.map((slot, index) => {
|
|
6747
|
-
const
|
|
6748
|
-
const
|
|
6749
|
+
const record = swiftFrameworkSlotRecord(slot, SWIFT_BUILD_ROOT_SHAPE)
|
|
6750
|
+
const [slotExact, slotCompat] = record ? record.split('\n') : [null, null]
|
|
6751
|
+
const tier =
|
|
6752
|
+
slotExact === exactShape
|
|
6753
|
+
? 0
|
|
6754
|
+
: slotCompat === compatShape
|
|
6755
|
+
? 1
|
|
6756
|
+
: record === null
|
|
6757
|
+
? 2
|
|
6758
|
+
: 3
|
|
6749
6759
|
return { slot, index, tier }
|
|
6750
6760
|
})
|
|
6751
6761
|
.sort((left, right) => {
|
|
6752
6762
|
if (left.tier !== right.tier) return left.tier - right.tier
|
|
6753
|
-
if (left.tier
|
|
6763
|
+
if (left.tier <= 1)
|
|
6754
6764
|
return (built.get(right.slot) ?? 0) - (built.get(left.slot) ?? 0)
|
|
6755
|
-
if (left.tier ===
|
|
6765
|
+
if (left.tier === 2) return left.index - right.index
|
|
6756
6766
|
return (built.get(left.slot) ?? 0) - (built.get(right.slot) ?? 0)
|
|
6757
6767
|
})
|
|
6758
6768
|
for (const { slot } of ranked) {
|
|
@@ -7174,24 +7184,33 @@ async function compileSwiftProjectOnce(
|
|
|
7174
7184
|
!options.project &&
|
|
7175
7185
|
!options.linkOnly &&
|
|
7176
7186
|
path.basename(path.dirname(baseRoot)) === 'swift-builds'
|
|
7177
|
-
const
|
|
7187
|
+
const compatShapeParts = canPoolBuildRoot
|
|
7188
|
+
? [
|
|
7189
|
+
frameworkKey,
|
|
7190
|
+
Boolean(sdkImage),
|
|
7191
|
+
compileTargets(input)
|
|
7192
|
+
.map((target) => target.name)
|
|
7193
|
+
.sort(),
|
|
7194
|
+
input.oneModule === true,
|
|
7195
|
+
input.optimize === true,
|
|
7196
|
+
input.unoptimized === true,
|
|
7197
|
+
]
|
|
7198
|
+
: null
|
|
7199
|
+
const compatShape = compatShapeParts
|
|
7200
|
+
? createHash('sha256')
|
|
7201
|
+
.update(JSON.stringify(compatShapeParts))
|
|
7202
|
+
.digest('hex')
|
|
7203
|
+
.slice(0, 16)
|
|
7204
|
+
: ''
|
|
7205
|
+
const exactShape = compatShapeParts
|
|
7178
7206
|
? createHash('sha256')
|
|
7179
7207
|
.update(
|
|
7180
|
-
JSON.stringify([
|
|
7181
|
-
frameworkKey,
|
|
7182
|
-
Boolean(sdkImage),
|
|
7183
|
-
compileTargets(input)
|
|
7184
|
-
.map((target) => target.name)
|
|
7185
|
-
.sort(),
|
|
7186
|
-
input.oneModule === true,
|
|
7187
|
-
input.optimize === true,
|
|
7188
|
-
input.unoptimized === true,
|
|
7189
|
-
Object.keys(input.files).sort(),
|
|
7190
|
-
]),
|
|
7208
|
+
JSON.stringify([...compatShapeParts, Object.keys(input.files).sort()]),
|
|
7191
7209
|
)
|
|
7192
7210
|
.digest('hex')
|
|
7193
7211
|
.slice(0, 16)
|
|
7194
7212
|
: ''
|
|
7213
|
+
const buildShape = compatShapeParts ? `${exactShape}\n${compatShape}` : ''
|
|
7195
7214
|
return withSwiftCompileBudget(options.timeoutMs, options.signal, async (budget) => {
|
|
7196
7215
|
const stage = (message: string) => {
|
|
7197
7216
|
budget.progress()
|
|
@@ -7219,7 +7238,13 @@ async function compileSwiftProjectOnce(
|
|
|
7219
7238
|
stage('reusing verified disk artifact')
|
|
7220
7239
|
return retain(baseRoot, built)
|
|
7221
7240
|
}
|
|
7222
|
-
return withSwiftBuildRootSlot(
|
|
7241
|
+
return withSwiftBuildRootSlot(
|
|
7242
|
+
baseRoot,
|
|
7243
|
+
exactShape,
|
|
7244
|
+
compatShape,
|
|
7245
|
+
budget.signal,
|
|
7246
|
+
work,
|
|
7247
|
+
)
|
|
7223
7248
|
},
|
|
7224
7249
|
budget.signal,
|
|
7225
7250
|
)
|