peachsim 0.1.2689 → 0.1.2691
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 +154 -128
- 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-AK33HM6U.mjs → acorn-FRAAGSQN.mjs} +3 -3
- package/dist-lib/esm-chunks/{chunk-6VXRFNWN.mjs → chunk-3P3T6XDR.mjs} +1 -1
- package/dist-lib/esm-chunks/{chunk-W367O5CY.mjs → chunk-677F6CA3.mjs} +3 -3
- package/dist-lib/esm-chunks/{chunk-EN52IJHF.mjs → chunk-6Y4USKQV.mjs} +1 -1
- package/dist-lib/esm-chunks/{chunk-S67TTMU7.mjs → chunk-GHEIKIKL.mjs} +3 -16
- package/dist-lib/esm-chunks/{chunk-6ZOJHY7N.mjs → chunk-GLMVKIM6.mjs} +1 -1
- package/dist-lib/esm-chunks/{chunk-DBS6IBYN.mjs → chunk-GN3IKMG6.mjs} +1 -1
- package/dist-lib/esm-chunks/{chunk-3P2PXDAA.mjs → chunk-HDZZNHQA.mjs} +1 -1
- package/dist-lib/esm-chunks/{chunk-URRVRAYX.mjs → chunk-JAWBF6H2.mjs} +1 -1
- package/dist-lib/esm-chunks/{chunk-QZLWJLMA.mjs → chunk-KBD22EMH.mjs} +4 -4
- package/dist-lib/esm-chunks/{chunk-4AVYJY57.mjs → chunk-LDYW2OW2.mjs} +5 -5
- package/dist-lib/esm-chunks/{chunk-KHBU2LR4.mjs → chunk-NZXLU5VV.mjs} +1 -1
- package/dist-lib/esm-chunks/{chunk-V7YGTZIH.mjs → chunk-O63LOL3D.mjs} +6 -6
- package/dist-lib/esm-chunks/{chunk-LZYR7ZMM.mjs → chunk-OIYXX7IL.mjs} +1 -1
- package/dist-lib/esm-chunks/{chunk-TZKKIPK7.mjs → chunk-Q6JOJQEF.mjs} +1 -1
- package/dist-lib/esm-chunks/{chunk-PMOT2K7W.mjs → chunk-QUF75PSG.mjs} +1 -1
- package/dist-lib/esm-chunks/{chunk-PMGSVLOD.mjs → chunk-R2Y3VVPG.mjs} +1 -1
- package/dist-lib/esm-chunks/{chunk-B2V6VQF4.mjs → chunk-RDBWKQEO.mjs} +1 -1
- package/dist-lib/esm-chunks/{chunk-OO6D27TE.mjs → chunk-SNPB7L3I.mjs} +140 -103
- package/dist-lib/esm-chunks/{chunk-TZ5HWPHI.mjs → chunk-SWFEY33A.mjs} +1 -1
- package/dist-lib/esm-chunks/{chunk-FPYHVMB5.mjs → chunk-VGERVNUM.mjs} +1 -1
- package/dist-lib/esm-chunks/{chunk-43MLLKBY.mjs → chunk-WTQRJ7GJ.mjs} +6 -6
- package/dist-lib/esm-chunks/{chunk-SP7K4OG3.mjs → chunk-Y4AEL73Z.mjs} +1 -1
- package/dist-lib/esm-chunks/{chunk-63AVADYP.mjs → chunk-Z6OSVLDH.mjs} +1 -1
- package/dist-lib/esm-chunks/{chunk-VE2UKUSG.mjs → chunk-ZPKIEF24.mjs} +1 -1
- package/dist-lib/esm-chunks/{metro-layout-parser-P3HTLHV4.mjs → metro-layout-parser-6OLSOOML.mjs} +3 -3
- package/dist-lib/esm-chunks/{swift-package-prebuilt-4QU3YDI5.mjs → swift-package-prebuilt-5JCJ24DB.mjs} +12 -12
- package/dist-lib/esm-chunks/{swift-sdk-app-module-NSDCR32Y.mjs → swift-sdk-app-module-ZIJDA775.mjs} +16 -16
- package/dist-lib/esm-chunks/{swift-sdk-image-N4YBIJIH.mjs → swift-sdk-image-JSEDATID.mjs} +16 -16
- package/dist-lib/esm-chunks/{swift-sdk-image-producer-IUBLMTML.mjs → swift-sdk-image-producer-MPF3H7PU.mjs} +5 -5
- package/dist-lib/expo-swift-bundle.cjs +144 -118
- 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 +161 -136
- package/dist-lib/host/fetch-proxy-handler.cjs +28 -27
- 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 +64 -64
- 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 +165 -140
- package/dist-lib/swift-compile.cjs +129 -103
- 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/package.json +1 -1
- package/src/swift-compile.ts +139 -95
- package/src/swift-root-lock.ts +1 -16
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! peach v0.1.
|
|
1
|
+
/*! peach v0.1.2691 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
|
|
2
2
|
let __sootsim_import_meta_url = '', __sootsim_import_meta_dirname = '', __sootsim_import_meta_filename = ''; try { __sootsim_import_meta_url = require('url').pathToFileURL(__filename).href; __sootsim_import_meta_dirname = __dirname; __sootsim_import_meta_filename = __filename; } catch {}
|
|
3
3
|
"use strict";
|
|
4
4
|
var __defProp = Object.defineProperty;
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
/*! peach v0.1.
|
|
1
|
+
/*! peach v0.1.2691 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
|
|
2
2
|
import {
|
|
3
3
|
parse
|
|
4
|
-
} from "./esm-chunks/chunk-
|
|
4
|
+
} from "./esm-chunks/chunk-GLMVKIM6.mjs";
|
|
5
5
|
import {
|
|
6
6
|
__privateAdd,
|
|
7
7
|
__privateGet,
|
|
8
8
|
__publicField
|
|
9
|
-
} from "./esm-chunks/chunk-
|
|
9
|
+
} from "./esm-chunks/chunk-Y4AEL73Z.mjs";
|
|
10
10
|
|
|
11
11
|
// src/worklet-kernel.ts
|
|
12
12
|
var Unsupported = class extends Error {
|
package/package.json
CHANGED
package/src/swift-compile.ts
CHANGED
|
@@ -21,6 +21,7 @@ import {
|
|
|
21
21
|
} from 'node:fs'
|
|
22
22
|
import os from 'node:os'
|
|
23
23
|
import path from 'node:path'
|
|
24
|
+
import { setTimeout as delay } from 'node:timers/promises'
|
|
24
25
|
import * as v from 'valibot'
|
|
25
26
|
import { windowAdmission } from './admitted-mac-build'
|
|
26
27
|
import cPredefinesJson from './generated/swift-c-predefines.json' with { type: 'json' }
|
|
@@ -121,7 +122,6 @@ import {
|
|
|
121
122
|
acquireSwiftRootReadHold,
|
|
122
123
|
hasLiveSwiftRootReaders,
|
|
123
124
|
retainSwiftRootReadHold,
|
|
124
|
-
waitForNoSwiftRootReaders,
|
|
125
125
|
withSwiftRootLock,
|
|
126
126
|
type SwiftRootLease,
|
|
127
127
|
type SwiftRootReadHold,
|
|
@@ -6349,7 +6349,8 @@ function readFrameworkProductsReceipt(
|
|
|
6349
6349
|
async function buildFrameworkProducts(
|
|
6350
6350
|
scratch: string,
|
|
6351
6351
|
args: FrameworkBuildArgs,
|
|
6352
|
-
|
|
6352
|
+
allowWrite: boolean,
|
|
6353
|
+
): Promise<SwiftFrameworkProducts | undefined> {
|
|
6353
6354
|
const linkedTargets = linkedFrameworkTargets(args.moduleRoot, args.input)
|
|
6354
6355
|
const unoptimized = args.input.unoptimized === true
|
|
6355
6356
|
const sdkOptions = swiftCompileSdkOptions(args.moduleRoot, args.toolchainBin)
|
|
@@ -6373,7 +6374,7 @@ async function buildFrameworkProducts(
|
|
|
6373
6374
|
.slice(0, 32)
|
|
6374
6375
|
const ready = readFrameworkProductsReceipt(scratch, receiptKey)
|
|
6375
6376
|
if (ready) return ready
|
|
6376
|
-
|
|
6377
|
+
if (!allowWrite) return
|
|
6377
6378
|
|
|
6378
6379
|
const linkRoot = path.join(scratch, 'link')
|
|
6379
6380
|
writeFrameworkLinkPackage(linkRoot, args.moduleRoot, linkedTargets.products)
|
|
@@ -6669,7 +6670,11 @@ async function withSwiftFrameworkSlot<T>(
|
|
|
6669
6670
|
release: string,
|
|
6670
6671
|
moduleRoot: string,
|
|
6671
6672
|
signal: AbortSignal | undefined,
|
|
6672
|
-
work: (
|
|
6673
|
+
work: (
|
|
6674
|
+
slot: string,
|
|
6675
|
+
lease: SwiftRootLease,
|
|
6676
|
+
allowWrite: boolean,
|
|
6677
|
+
) => Promise<T | undefined>,
|
|
6673
6678
|
unoptimized = false,
|
|
6674
6679
|
): Promise<T> {
|
|
6675
6680
|
const slotCount = unoptimized
|
|
@@ -6681,14 +6686,40 @@ async function withSwiftFrameworkSlot<T>(
|
|
|
6681
6686
|
mkdirSync(slot, { recursive: true })
|
|
6682
6687
|
return slot
|
|
6683
6688
|
})
|
|
6684
|
-
const
|
|
6685
|
-
|
|
6686
|
-
|
|
6687
|
-
|
|
6688
|
-
|
|
6689
|
+
const trySlot = (
|
|
6690
|
+
slot: string,
|
|
6691
|
+
mode: 'reuse' | 'extend' | 'restage',
|
|
6692
|
+
logSelection?: () => void,
|
|
6693
|
+
) => {
|
|
6694
|
+
return withSwiftRootLock(
|
|
6695
|
+
slot,
|
|
6696
|
+
async (lease) => {
|
|
6697
|
+
const matches = swiftFrameworkSlotKey(slot) === frameworkKey
|
|
6698
|
+
if (mode !== 'restage' && !matches) return
|
|
6699
|
+
const allowWrite = mode !== 'reuse'
|
|
6700
|
+
if (allowWrite && (await hasLiveSwiftRootReaders(slot, signal))) return
|
|
6701
|
+
if (!matches) logSelection?.()
|
|
6702
|
+
const value = await work(slot, lease, allowWrite)
|
|
6703
|
+
if (value === undefined) return
|
|
6704
|
+
const now = new Date()
|
|
6705
|
+
utimesSync(slot, now, now)
|
|
6706
|
+
return { value }
|
|
6707
|
+
},
|
|
6708
|
+
signal,
|
|
6709
|
+
false,
|
|
6710
|
+
)
|
|
6711
|
+
}
|
|
6712
|
+
const tryExactSlots = async () => {
|
|
6713
|
+
const matching = slots.filter((slot) => swiftFrameworkSlotKey(slot) === frameworkKey)
|
|
6714
|
+
for (const mode of ['reuse', 'extend'] satisfies ('reuse' | 'extend')[]) {
|
|
6715
|
+
for (const slot of matching) {
|
|
6716
|
+
const result = await trySlot(slot, mode)
|
|
6717
|
+
if (result) return result
|
|
6718
|
+
}
|
|
6719
|
+
}
|
|
6689
6720
|
}
|
|
6690
|
-
const
|
|
6691
|
-
if (
|
|
6721
|
+
const ready = await tryExactSlots()
|
|
6722
|
+
if (ready) return ready.value
|
|
6692
6723
|
const built = new Map(slots.map((slot) => [slot, statSync(slot).mtimeMs]))
|
|
6693
6724
|
const own = (slot: string) =>
|
|
6694
6725
|
swiftFrameworkSlotRecord(slot, SWIFT_FRAMEWORK_SLOT_ORIGIN) === moduleRoot
|
|
@@ -6737,24 +6768,28 @@ async function withSwiftFrameworkSlot<T>(
|
|
|
6737
6768
|
if (left.tier === 1) return left.index - right.index
|
|
6738
6769
|
return (built.get(left.slot) ?? 0) - (built.get(right.slot) ?? 0)
|
|
6739
6770
|
})
|
|
6740
|
-
|
|
6741
|
-
|
|
6742
|
-
|
|
6743
|
-
|
|
6744
|
-
|
|
6745
|
-
|
|
6771
|
+
let announced = false
|
|
6772
|
+
for (;;) {
|
|
6773
|
+
signal?.throwIfAborted()
|
|
6774
|
+
for (const { slot, tier, changes } of ranked) {
|
|
6775
|
+
if (swiftFrameworkSlotKey(slot) === frameworkKey) continue
|
|
6776
|
+
const result = await trySlot(slot, 'restage', () => {
|
|
6746
6777
|
console.error(
|
|
6747
6778
|
`[swift-framework-cache] ${path.basename(slot)} release=${release} tier=${tier} changedInputs=${changes} totalInputs=${inputs.size}`,
|
|
6748
6779
|
)
|
|
6749
|
-
|
|
6750
|
-
|
|
6751
|
-
|
|
6752
|
-
|
|
6753
|
-
|
|
6754
|
-
|
|
6780
|
+
})
|
|
6781
|
+
if (result) return result.value
|
|
6782
|
+
}
|
|
6783
|
+
if (!announced) {
|
|
6784
|
+
console.error(
|
|
6785
|
+
`[swift-framework-cache] waiting for an available slot in ${slotsDir}`,
|
|
6786
|
+
)
|
|
6787
|
+
announced = true
|
|
6788
|
+
}
|
|
6789
|
+
await delay(1_000, undefined, { signal })
|
|
6790
|
+
const ready = await tryExactSlots()
|
|
6791
|
+
if (ready) return ready.value
|
|
6755
6792
|
}
|
|
6756
|
-
const nearest = ranked[0]!.slot
|
|
6757
|
-
return withSwiftRootLock(nearest, run(nearest), signal)
|
|
6758
6793
|
}
|
|
6759
6794
|
|
|
6760
6795
|
// normalized shared build roots (such as OneNativeControls) serve concurrent
|
|
@@ -7173,36 +7208,34 @@ async function compileSwiftProjectOnce(
|
|
|
7173
7208
|
waitedMs: number,
|
|
7174
7209
|
) => Promise<SwiftCompileArtifact | void>,
|
|
7175
7210
|
) => {
|
|
7176
|
-
|
|
7177
|
-
|
|
7211
|
+
const runInBuildRoot = () => {
|
|
7212
|
+
if (canPoolBuildRoot)
|
|
7213
|
+
return withSwiftBuildRootSlot(
|
|
7214
|
+
baseRoot,
|
|
7215
|
+
exactShape,
|
|
7216
|
+
compatShape,
|
|
7217
|
+
budget.signal,
|
|
7218
|
+
work,
|
|
7219
|
+
)
|
|
7220
|
+
const waitStart = Date.now()
|
|
7178
7221
|
return withSwiftRootLock(
|
|
7179
|
-
|
|
7180
|
-
|
|
7181
|
-
// a concurrent caller with the exact same hash may have finished
|
|
7182
|
-
// while we waited on sharedRoot; return before touching any slot.
|
|
7183
|
-
const built = readCompiledArtifact(
|
|
7184
|
-
path.join(sharedRoot, 'artifact'),
|
|
7185
|
-
hash,
|
|
7186
|
-
)
|
|
7187
|
-
if (built) {
|
|
7188
|
-
stage('reusing verified disk artifact')
|
|
7189
|
-
return retain(baseRoot, built)
|
|
7190
|
-
}
|
|
7191
|
-
return withSwiftBuildRootSlot(
|
|
7192
|
-
baseRoot,
|
|
7193
|
-
exactShape,
|
|
7194
|
-
compatShape,
|
|
7195
|
-
budget.signal,
|
|
7196
|
-
work,
|
|
7197
|
-
)
|
|
7198
|
-
},
|
|
7222
|
+
baseRoot,
|
|
7223
|
+
(lease) => work(baseRoot, lease, Date.now() - waitStart),
|
|
7199
7224
|
budget.signal,
|
|
7200
7225
|
)
|
|
7201
7226
|
}
|
|
7202
|
-
|
|
7227
|
+
if (options.intermediates || baseRoot === sharedRoot) return runInBuildRoot()
|
|
7203
7228
|
return withSwiftRootLock(
|
|
7204
|
-
|
|
7205
|
-
(
|
|
7229
|
+
sharedRoot,
|
|
7230
|
+
async () => {
|
|
7231
|
+
const built = readCompiledArtifact(path.join(sharedRoot, 'artifact'), hash)
|
|
7232
|
+
if (built) {
|
|
7233
|
+
renewSharedArtifact(sharedRoot)
|
|
7234
|
+
stage('reusing verified disk artifact')
|
|
7235
|
+
return retain(baseRoot, built)
|
|
7236
|
+
}
|
|
7237
|
+
return runInBuildRoot()
|
|
7238
|
+
},
|
|
7206
7239
|
budget.signal,
|
|
7207
7240
|
)
|
|
7208
7241
|
}
|
|
@@ -7236,19 +7269,6 @@ async function compileSwiftProjectOnce(
|
|
|
7236
7269
|
}
|
|
7237
7270
|
// a distribution's immutable modules and host plugins need no source build.
|
|
7238
7271
|
const unoptimized = input.unoptimized === true
|
|
7239
|
-
const withFrameworkLock = <T>(
|
|
7240
|
-
work: (slot: string | null, frameworkLease?: SwiftRootLease) => Promise<T>,
|
|
7241
|
-
) =>
|
|
7242
|
-
distribution
|
|
7243
|
-
? work(null)
|
|
7244
|
-
: withSwiftFrameworkSlot(
|
|
7245
|
-
frameworkKey,
|
|
7246
|
-
options.release,
|
|
7247
|
-
moduleRoot,
|
|
7248
|
-
budget.signal,
|
|
7249
|
-
work,
|
|
7250
|
-
unoptimized,
|
|
7251
|
-
)
|
|
7252
7272
|
const baseBuildEnv = options.project?.env
|
|
7253
7273
|
? {
|
|
7254
7274
|
...options.project.env,
|
|
@@ -7271,18 +7291,12 @@ async function compileSwiftProjectOnce(
|
|
|
7271
7291
|
// building framework products; take a shared read hold before
|
|
7272
7292
|
// releasing it so other builds on the same framework revision
|
|
7273
7293
|
// compile and link their apps concurrently.
|
|
7274
|
-
const
|
|
7275
|
-
|
|
7276
|
-
|
|
7277
|
-
|
|
7278
|
-
|
|
7279
|
-
|
|
7280
|
-
prebuilt,
|
|
7281
|
-
readHold: frameworkReadHold,
|
|
7282
|
-
} = await withFrameworkLock(async (slot, frameworkLease) => {
|
|
7283
|
-
budget.startCompile()
|
|
7284
|
-
if (slot && swiftFrameworkSlotKey(slot) !== frameworkKey)
|
|
7285
|
-
await waitForNoSwiftRootReaders(slot, budget.signal)
|
|
7294
|
+
const prepareFrameworks = async (
|
|
7295
|
+
slot: string | null,
|
|
7296
|
+
frameworkLease?: SwiftRootLease,
|
|
7297
|
+
allowWrite = true,
|
|
7298
|
+
) => {
|
|
7299
|
+
if (allowWrite) budget.startCompile()
|
|
7286
7300
|
// project users own their build roots; resolve their sdk outside them.
|
|
7287
7301
|
const frameworkRoot = mirrorDistribution
|
|
7288
7302
|
? syncSwiftDistributionMirror(root, moduleRoot, mirrorDistribution)
|
|
@@ -7291,7 +7305,8 @@ async function compileSwiftProjectOnce(
|
|
|
7291
7305
|
: stageFrameworkSource(moduleRoot, slot, frameworkKey, options.release)
|
|
7292
7306
|
if (!swiftModuleDigest(frameworkRoot).equals(moduleDigest))
|
|
7293
7307
|
throw new Error('Swift staged project source differs from the caller')
|
|
7294
|
-
|
|
7308
|
+
if (!allowWrite && swiftMacroPlugins(frameworkRoot).stale) return
|
|
7309
|
+
if (allowWrite) stage('preparing compiler plugins')
|
|
7295
7310
|
const macroPlugins = await ensureMacroPlugins(
|
|
7296
7311
|
frameworkRoot,
|
|
7297
7312
|
options.toolchainBin,
|
|
@@ -7308,24 +7323,33 @@ async function compileSwiftProjectOnce(
|
|
|
7308
7323
|
const icu = options.linkOnly ? null : swiftIcuAsset(options.toolchainBin, sdk)
|
|
7309
7324
|
let prebuilt: SwiftFrameworkProducts | undefined
|
|
7310
7325
|
if (!distribution) {
|
|
7311
|
-
stage('compiling framework products')
|
|
7312
|
-
prebuilt = await buildFrameworkProducts(
|
|
7313
|
-
|
|
7314
|
-
|
|
7315
|
-
|
|
7316
|
-
|
|
7317
|
-
|
|
7318
|
-
|
|
7319
|
-
|
|
7320
|
-
|
|
7321
|
-
|
|
7322
|
-
|
|
7323
|
-
|
|
7324
|
-
|
|
7325
|
-
|
|
7326
|
-
|
|
7326
|
+
if (allowWrite) stage('compiling framework products')
|
|
7327
|
+
prebuilt = await buildFrameworkProducts(
|
|
7328
|
+
slot!,
|
|
7329
|
+
{
|
|
7330
|
+
moduleRoot: frameworkRoot,
|
|
7331
|
+
frameworkKey,
|
|
7332
|
+
input,
|
|
7333
|
+
swift,
|
|
7334
|
+
sdk,
|
|
7335
|
+
toolchainBin: options.toolchainBin,
|
|
7336
|
+
plugins: macroPlugins,
|
|
7337
|
+
buildOptions: {
|
|
7338
|
+
env: baseBuildEnv,
|
|
7339
|
+
maxBuffer: 64 * 1024 * 1024,
|
|
7340
|
+
signal: budget.signal,
|
|
7341
|
+
onOutput: budget.progress,
|
|
7342
|
+
lease,
|
|
7343
|
+
frameworkLease,
|
|
7344
|
+
},
|
|
7327
7345
|
},
|
|
7328
|
-
|
|
7346
|
+
allowWrite,
|
|
7347
|
+
)
|
|
7348
|
+
if (!prebuilt) return
|
|
7349
|
+
if (!allowWrite) {
|
|
7350
|
+
budget.startCompile()
|
|
7351
|
+
stage('reusing verified framework products')
|
|
7352
|
+
}
|
|
7329
7353
|
}
|
|
7330
7354
|
const readHold: SwiftRootReadHold | undefined = slot
|
|
7331
7355
|
? acquireSwiftRootReadHold(slot)
|
|
@@ -7339,8 +7363,28 @@ async function compileSwiftProjectOnce(
|
|
|
7339
7363
|
prebuilt,
|
|
7340
7364
|
readHold,
|
|
7341
7365
|
}
|
|
7342
|
-
}
|
|
7343
|
-
|
|
7366
|
+
}
|
|
7367
|
+
const frameworks = distribution
|
|
7368
|
+
? await prepareFrameworks(null)
|
|
7369
|
+
: await withSwiftFrameworkSlot(
|
|
7370
|
+
frameworkKey,
|
|
7371
|
+
options.release,
|
|
7372
|
+
moduleRoot,
|
|
7373
|
+
budget.signal,
|
|
7374
|
+
prepareFrameworks,
|
|
7375
|
+
unoptimized,
|
|
7376
|
+
)
|
|
7377
|
+
if (!frameworks)
|
|
7378
|
+
throw new Error('Swift distribution did not provide its frameworks')
|
|
7379
|
+
const {
|
|
7380
|
+
frameworkRoot,
|
|
7381
|
+
compileFrameworkRoot,
|
|
7382
|
+
macroPlugins,
|
|
7383
|
+
sdk,
|
|
7384
|
+
icu,
|
|
7385
|
+
prebuilt,
|
|
7386
|
+
} = frameworks
|
|
7387
|
+
let readHold = frameworks.readHold
|
|
7344
7388
|
const buildOptions = {
|
|
7345
7389
|
env: baseBuildEnv,
|
|
7346
7390
|
maxBuffer: 64 * 1024 * 1024,
|
package/src/swift-root-lock.ts
CHANGED
|
@@ -322,21 +322,6 @@ export async function hasLiveSwiftRootReaders(
|
|
|
322
322
|
return false
|
|
323
323
|
}
|
|
324
324
|
|
|
325
|
-
export async function waitForNoSwiftRootReaders(
|
|
326
|
-
root: string,
|
|
327
|
-
signal?: AbortSignal,
|
|
328
|
-
): Promise<void> {
|
|
329
|
-
let announced = false
|
|
330
|
-
while (await hasLiveSwiftRootReaders(root, signal)) {
|
|
331
|
-
signal?.throwIfAborted()
|
|
332
|
-
if (!announced) {
|
|
333
|
-
announced = true
|
|
334
|
-
process.stderr.write(`[swift-root-lock] waiting for readers of ${root}\n`)
|
|
335
|
-
}
|
|
336
|
-
await pause(POLL_MS, signal)
|
|
337
|
-
}
|
|
338
|
-
}
|
|
339
|
-
|
|
340
325
|
export async function withSwiftRootLock<T>(
|
|
341
326
|
root: string,
|
|
342
327
|
work: (lease: SwiftRootLease) => Promise<T>,
|
|
@@ -392,11 +377,11 @@ export async function withSwiftRootLock<T>(
|
|
|
392
377
|
const table = await processTableWithRetry(undefined, signal)
|
|
393
378
|
const orphaned = children.filter((child) => groupAlive(table, child))
|
|
394
379
|
if (orphaned.length) {
|
|
395
|
-
if (!wait) return undefined
|
|
396
380
|
// nothing reads a dead holder's compiler output, so its groups only
|
|
397
381
|
// keep the root from the next build. the root stays held until they
|
|
398
382
|
// are gone, and a group that refuses the kill keeps it held.
|
|
399
383
|
for (const child of orphaned) killOrphanedProcessGroup(child.pid)
|
|
384
|
+
if (!wait) return undefined
|
|
400
385
|
await waiting(
|
|
401
386
|
`stopping compiler groups ${orphaned.map((child) => child.pid).join(', ')} left by dead pid ${identity.pid}`,
|
|
402
387
|
)
|