peachsim 0.1.2018 → 0.1.2021
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/inspect/settling.ts +11 -6
- package/cli/commands/screenshots-capture.ts +9 -2
- package/cli/outbound-endpoints.ts +1 -1
- package/cli/telemetry.ts +19 -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 +383 -102
- package/dist-lib/capture-contract.cjs +1 -1
- package/dist-lib/capture-contract.mjs +1 -1
- package/dist-lib/cloud-contract.cjs +1 -1
- package/dist-lib/cloud-contract.mjs +1 -1
- package/dist-lib/cloud-test-args.cjs +1 -1
- package/dist-lib/cloud-test-args.mjs +1 -1
- package/dist-lib/cloud.cjs +1 -1
- package/dist-lib/cloud.mjs +1 -1
- package/dist-lib/config.cjs +1 -1
- package/dist-lib/config.mjs +1 -1
- package/dist-lib/detox/index.cjs +6 -4
- package/dist-lib/dev-bundle-resolution.cjs +1 -1
- package/dist-lib/expo-swift-bundle.cjs +377 -96
- 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 +382 -101
- package/dist-lib/host/fetch-proxy-handler.cjs +1 -1
- 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 +83 -18
- 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 +78 -15
- package/dist-lib/native-app-identity-project.cjs +76 -13
- package/dist-lib/native-app-identity-project.mjs +76 -12
- package/dist-lib/native-app-identity.cjs +5 -2
- package/dist-lib/native-app-identity.mjs +5 -2
- package/dist-lib/native-firebase-metadata.cjs +1 -1
- package/dist-lib/native-firebase-metadata.mjs +1 -1
- package/dist-lib/pdfium-raster.cjs +1 -1
- package/dist-lib/pdfium-raster.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 +24 -24
- package/dist-lib/public-origins-lib.json +53 -53
- 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 +6 -4
- package/dist-lib/sdk.mjs +6 -4
- package/dist-lib/skills.cjs +389 -106
- package/dist-lib/swift-compile.cjs +101 -66
- package/dist-lib/swift-compile.mjs +100 -65
- package/dist-lib/swift-package.cjs +1 -1
- package/dist-lib/swift-package.mjs +1 -1
- package/dist-lib/swift-submit.cjs +1 -1
- package/dist-lib/swift-submit.mjs +1 -1
- package/dist-lib/swift-toolchain.cjs +26 -1
- package/dist-lib/swift.cjs +1 -1
- package/dist-lib/vite-swift.cjs +376 -95
- package/dist-lib/vite.cjs +1 -1
- package/dist-lib/worklet-executable.cjs +1 -1
- package/dist-lib/worklet-executable.mjs +1 -1
- package/dist-types/packages/peach-engine/src/components/native-ui/context-menu-types.d.ts +84 -0
- package/dist-types/packages/peach-engine/src/engine/animated.d.ts +1 -1
- package/dist-types/packages/peach-engine/src/engine/fontDataContract.d.ts +4 -0
- package/dist-types/packages/peach-engine/src/engine/liquid-glass.d.ts +1 -0
- package/dist-types/packages/peach-engine/src/engine/rn-spring.d.ts +2 -2
- package/dist-types/packages/peach-engine/src/engine/scene-table.d.ts +1 -1
- package/dist-types/packages/peach-engine/src/engine/types.d.ts +2 -1
- package/dist-types/packages/peach-engine/src/render-worker/graph-linked-value.d.ts +4 -1
- package/dist-types/packages/peach-engine/src/render-worker/native-menu-gesture.d.ts +6 -0
- package/dist-types/packages/peach-engine/src/render-worker/protocol.d.ts +1 -0
- package/package.json +1 -1
- package/sdk/ios/System/Library/Frameworks/AuthenticationServices.framework/Headers/ASWebAuthenticationSession.h +1 -1
- package/sdk/ios/System/Library/Frameworks/CoreData.framework/Headers/CoreData.h +2 -0
- package/sdk/ios/System/Library/Frameworks/CoreData.framework/Headers/NSEntityDescription.h +10 -0
- package/sdk/ios/System/Library/Frameworks/CoreData.framework/Headers/NSFetchRequest.h +28 -0
- package/sdk/ios/System/Library/Frameworks/CoreData.framework/Headers/NSManagedObject.h +1 -1
- package/sdk/ios/System/Library/Frameworks/CoreData.framework/Headers/NSManagedObjectContext.h +16 -1
- package/sdk/ios/System/Library/Frameworks/CoreData.framework/Headers/NSManagedObjectModel.h +3 -0
- package/sdk/ios/System/Library/Frameworks/CoreData.framework/Headers/NSPersistentStoreCoordinator.h +7 -0
- package/sdk/ios/System/Library/Frameworks/CoreData.framework/Headers/NSPersistentStoreRequest.h +3 -0
- package/sdk/ios/System/Library/Frameworks/Foundation.framework/Headers/NSPredicate.h +1 -1
- package/sdk/ios/System/Library/Frameworks/Foundation.framework/Headers/NSSortDescriptor.h +1 -1
- package/sdk/ios/System/Library/Frameworks/Foundation.framework/Headers/NSURLConnection.h +1 -1
- package/sdk/ios/System/Library/Frameworks/LocalAuthentication.framework/Headers/LAContext.h +1 -1
- package/sdk/ios/System/Library/Frameworks/SafariServices.framework/Headers/SFAuthenticationSession.h +17 -0
- package/sdk/ios/System/Library/Frameworks/SafariServices.framework/Headers/SafariServices.h +1 -0
- package/sdk/ios/System/Library/Frameworks/UIKit.framework/Headers/UIInputViewController.h +1 -1
- package/sdk/ios/System/Library/Frameworks/UIKit.framework/Headers/UIPageViewController.h +1 -1
- package/sdk/ios/System/Library/Frameworks/UIKit.framework/Headers/UIPointerStyle.h +1 -6
- package/sdk/ios/System/Library/Frameworks/UIKit.framework/Modules/module.modulemap +1 -0
- package/sdk/ios/System/Library/Frameworks/UIKitTypes.framework/Headers/UIKitTypes.h +6 -0
- package/sdk/ios/System/Library/Frameworks/WatchConnectivity.framework/Headers/WCSession.h +1 -1
- package/sdk/ios/usr/include/objc/NSObject.h +1 -1
- package/sdk/ios/wasm/include/stdlib.h +1 -0
- package/src/nitro-adapter.lock.json +274 -274
- package/src/nitro-superset.lock.json +4 -4
- package/src/swift-compile.ts +70 -81
- package/src/swift-distribution.lock.json +14 -12
- package/src/swift-guest-image-ledger.ts +15 -10
- package/src/swift-guest-source-inputs.ts +6 -3
- package/src/swift-guest-source-plan.ts +5 -1
- package/src/swift-objc-compile.ts +2 -2
- package/src/swift-objc-standin.ts +197 -5
- package/src/swift-packages.ts +13 -12
- package/src/swift-shared-sdk.ts +2 -1
- package/src/swift-standin-emit.ts +43 -5
- package/src/swift-standins.ts +41 -2
- package/src/swift-toolchain.ts +24 -0
- package/src/turbo-runtime.lock.json +23 -23
- package/src/xcode-project.ts +59 -1
- package/src/xcode-target-members.ts +4 -0
package/src/swift-compile.ts
CHANGED
|
@@ -273,14 +273,15 @@ const SWIFTPM_NOISE =
|
|
|
273
273
|
/^(?:\[\d+\/\d+\] |Building for production\.\.\.$|warning: '--build-system native' has been deprecated)/
|
|
274
274
|
|
|
275
275
|
// compiler jobs match the fixture builder's cap to fit a 16GiB Linux slot, and
|
|
276
|
-
// never exceed the cores an admitted build scope granted
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
)
|
|
283
|
-
|
|
276
|
+
// never exceed the cores an admitted build scope granted.
|
|
277
|
+
export function swiftBuildJobs(): number {
|
|
278
|
+
const admittedCores = windowAdmission()?.cores ?? Number(process.env.TM_EXEC_CPU_CORES)
|
|
279
|
+
return Math.min(
|
|
280
|
+
4,
|
|
281
|
+
Math.max(1, Math.floor(os.availableParallelism() / 2)),
|
|
282
|
+
Number.isInteger(admittedCores) && admittedCores > 0 ? admittedCores : 4,
|
|
283
|
+
)
|
|
284
|
+
}
|
|
284
285
|
|
|
285
286
|
export interface SwiftCompileInput {
|
|
286
287
|
files: Record<string, string>
|
|
@@ -1543,7 +1544,7 @@ const darwinRecordsRegion = (quoted: readonly string[]): string[] =>
|
|
|
1543
1544
|
const REACTOR_FLAG = '"-Xclang-linker", "-mexec-model=reactor",\n'
|
|
1544
1545
|
|
|
1545
1546
|
/** bump with any change to the emitted multi-target manifest text. */
|
|
1546
|
-
export const MULTI_MANIFEST_VERSION =
|
|
1547
|
+
export const MULTI_MANIFEST_VERSION = 68
|
|
1547
1548
|
const SWIFT_HEADER_PRODUCTS_TARGET = 'PeachHeaderProducts'
|
|
1548
1549
|
|
|
1549
1550
|
// build-cli replaces this in every bundle; source runs read the files directly.
|
|
@@ -1735,6 +1736,7 @@ export function emitSwiftPackageManifest(args: {
|
|
|
1735
1736
|
packages?: ReadonlyMap<string, string>
|
|
1736
1737
|
cxxLanguageStandard?: string
|
|
1737
1738
|
native?: Map<string, SwiftNativeTargetPlan>
|
|
1739
|
+
sourceSwiftTargets?: ReadonlySet<string>
|
|
1738
1740
|
headerDirectory?: string
|
|
1739
1741
|
/** the objective-c runtime and sdk flags every original native unit compiles with. */
|
|
1740
1742
|
nativeFlags?: Map<string, string[]>
|
|
@@ -1802,7 +1804,29 @@ export function emitSwiftPackageManifest(args: {
|
|
|
1802
1804
|
if (distribution && distributionLink) {
|
|
1803
1805
|
const isProvider = (object: string) =>
|
|
1804
1806
|
object.startsWith(`lib/${DARWIN_RECORDS_PREFIX}`)
|
|
1805
|
-
const
|
|
1807
|
+
const sourceModules = new Set(
|
|
1808
|
+
targets
|
|
1809
|
+
.filter(
|
|
1810
|
+
(target) =>
|
|
1811
|
+
args.sourceSwiftTargets?.has(target.name) &&
|
|
1812
|
+
!args.native?.get(target.name)?.clang,
|
|
1813
|
+
)
|
|
1814
|
+
.map((target) => swiftTargetModuleName(target.name)),
|
|
1815
|
+
)
|
|
1816
|
+
const product = v.parse(
|
|
1817
|
+
swiftFrameworkProductSchema,
|
|
1818
|
+
JSON.parse(
|
|
1819
|
+
readFileSync(path.join(moduleRoot, SWIFT_FRAMEWORK_PRODUCT_FILE), 'utf8'),
|
|
1820
|
+
),
|
|
1821
|
+
)
|
|
1822
|
+
const replacedObjects = new Set(
|
|
1823
|
+
product.objects
|
|
1824
|
+
.filter((object) => sourceModules.has(swiftTargetModuleName(object.target)))
|
|
1825
|
+
.map((object) => object.path),
|
|
1826
|
+
)
|
|
1827
|
+
const available = distribution.objects.filter(
|
|
1828
|
+
(object) => !isProvider(object) && !replacedObjects.has(object),
|
|
1829
|
+
)
|
|
1806
1830
|
const objects = available.filter(
|
|
1807
1831
|
(object) =>
|
|
1808
1832
|
!targets.some((target) => object.startsWith(`lib/${target.name}-`)) &&
|
|
@@ -2304,26 +2328,6 @@ const OS_IOS = /\b(?:os\(\s*iOS\s*\)|targetEnvironment\(\s*simulator\s*\))/g
|
|
|
2304
2328
|
// compile naming itself.
|
|
2305
2329
|
const DELEGATE_CLASS =
|
|
2306
2330
|
/^class\s+[A-Za-z_]\w*\s*(?:<[^>{]*>)?\s*:[^{]*\b(?:UIApplicationDelegate|UISceneDelegate|UIWindowSceneDelegate)\b[^{]*\{/
|
|
2307
|
-
// a table makes its cells and header footer views from their class, which
|
|
2308
|
-
// here needs the initializer it calls to be required. a subclass's override
|
|
2309
|
-
// of it says `required`, the same width: the cell's
|
|
2310
|
-
// init(style:reuseIdentifier:) and the header footer view's
|
|
2311
|
-
// init(reuseIdentifier:).
|
|
2312
|
-
const REUSABLE_INIT =
|
|
2313
|
-
/^override(?=\s+(?:(?:public|open|internal)\s+)?init\s*\(\s*(?:style\s*:[^,)]*,\s*reuseIdentifier|reuseIdentifier)\s*:)/
|
|
2314
|
-
// a collection view makes its cells and supplementary views with
|
|
2315
|
-
// init(frame:), so inside a class that inherits from one, directly or
|
|
2316
|
-
// through a class declared earlier in the file, an override of it says
|
|
2317
|
-
// `required` too. a class whose base is declared in another file is not
|
|
2318
|
-
// seen and fails to compile.
|
|
2319
|
-
const REUSABLE_VIEW_BASES = [
|
|
2320
|
-
'UICollectionReusableView',
|
|
2321
|
-
'UICollectionViewCell',
|
|
2322
|
-
'UICollectionViewListCell',
|
|
2323
|
-
]
|
|
2324
|
-
const CLASS_BASE =
|
|
2325
|
-
/^class\s+([A-Za-z_]\w*)\s*(?:<[^>{]*>)?\s*:\s*([A-Za-z_][\w.]*)[^{]*\{/
|
|
2326
|
-
const FRAME_INIT = /^override(?=\s+(?:(?:public|open|internal)\s+)?init\s*\(\s*frame\s*:)/
|
|
2327
2331
|
function compiledSwiftSources(
|
|
2328
2332
|
files: Record<string, string>,
|
|
2329
2333
|
targets: SwiftPackageTarget[],
|
|
@@ -3165,11 +3169,7 @@ const CORE_FOUNDATION_HANDLE_IMPORTS = [
|
|
|
3165
3169
|
|
|
3166
3170
|
// the guest module that owns a name darwin's Foundation declares
|
|
3167
3171
|
export function foundationOwnerOf(name: string): string | undefined {
|
|
3168
|
-
if (
|
|
3169
|
-
name === 'NSClassFromString' ||
|
|
3170
|
-
name === 'NSKeyValueObservedChange' ||
|
|
3171
|
-
name === 'NSKeyValueObservation'
|
|
3172
|
-
)
|
|
3172
|
+
if (name === 'NSKeyValueObservedChange' || name === 'NSKeyValueObservation')
|
|
3173
3173
|
return 'PeachObjC'
|
|
3174
3174
|
if (name === 'DispatchData') return 'Dispatch'
|
|
3175
3175
|
if (FOUNDATION_NETWORKING_TYPES.has(name)) return 'FoundationNetworking'
|
|
@@ -3206,11 +3206,6 @@ export function swiftSourceAsIOS(
|
|
|
3206
3206
|
.join('\n')
|
|
3207
3207
|
let out = ''
|
|
3208
3208
|
let copied = 0
|
|
3209
|
-
const reusableViews = new Set(REUSABLE_VIEW_BASES)
|
|
3210
|
-
// the brace depth of each open reusable view class's body
|
|
3211
|
-
const reusableBodies: number[] = []
|
|
3212
|
-
let depth = 0
|
|
3213
|
-
let opensReusableBody = false
|
|
3214
3209
|
const sceneLifecycleBodies = new Set<number>()
|
|
3215
3210
|
for (const at of tokens) {
|
|
3216
3211
|
const rest = conditioned.slice(at, at + 400)
|
|
@@ -3221,24 +3216,6 @@ export function swiftSourceAsIOS(
|
|
|
3221
3216
|
' public var _peachUsesSceneLifecycle: Bool { true };'
|
|
3222
3217
|
copied = at + 1
|
|
3223
3218
|
}
|
|
3224
|
-
depth++
|
|
3225
|
-
if (opensReusableBody) reusableBodies.push(depth)
|
|
3226
|
-
opensReusableBody = false
|
|
3227
|
-
continue
|
|
3228
|
-
}
|
|
3229
|
-
if (rest.startsWith('}')) {
|
|
3230
|
-
if (reusableBodies.at(-1) === depth) reusableBodies.pop()
|
|
3231
|
-
depth--
|
|
3232
|
-
continue
|
|
3233
|
-
}
|
|
3234
|
-
if (rest.startsWith('override')) {
|
|
3235
|
-
if (
|
|
3236
|
-
REUSABLE_INIT.test(rest) ||
|
|
3237
|
-
(reusableBodies.at(-1) === depth && FRAME_INIT.test(rest))
|
|
3238
|
-
) {
|
|
3239
|
-
out += `${conditioned.slice(copied, at)}required`
|
|
3240
|
-
copied = at + 'override'.length
|
|
3241
|
-
}
|
|
3242
3219
|
continue
|
|
3243
3220
|
}
|
|
3244
3221
|
// keep Clang submodules the selected SDK actually owns. a framework
|
|
@@ -3316,11 +3293,6 @@ export function swiftSourceAsIOS(
|
|
|
3316
3293
|
continue
|
|
3317
3294
|
}
|
|
3318
3295
|
if (rest.startsWith('class')) {
|
|
3319
|
-
const declared = CLASS_BASE.exec(rest)
|
|
3320
|
-
if (declared && reusableViews.has(declared[2]!.split('.').pop()!)) {
|
|
3321
|
-
reusableViews.add(declared[1]!)
|
|
3322
|
-
opensReusableBody = true
|
|
3323
|
-
}
|
|
3324
3296
|
const modifiers = conditioned.slice(conditioned.lastIndexOf('\n', at - 1) + 1, at)
|
|
3325
3297
|
const delegateClass = DELEGATE_CLASS.exec(rest)
|
|
3326
3298
|
if (delegateClass && /\bUIApplicationDelegate\b/.test(delegateClass[0])) {
|
|
@@ -4022,17 +3994,15 @@ function swiftCodeScan(source: string): {
|
|
|
4022
3994
|
? 'func'
|
|
4023
3995
|
: source.startsWith('UIApplicationMain', i)
|
|
4024
3996
|
? 'UIApplicationMain'
|
|
4025
|
-
: source.startsWith('
|
|
4026
|
-
? '
|
|
4027
|
-
: source.startsWith('
|
|
4028
|
-
? '
|
|
4029
|
-
: source.startsWith('
|
|
4030
|
-
? '
|
|
4031
|
-
: source.startsWith('
|
|
4032
|
-
? '
|
|
4033
|
-
:
|
|
4034
|
-
? '_LocationEssentials'
|
|
4035
|
-
: null
|
|
3997
|
+
: source.startsWith('Foundation', i)
|
|
3998
|
+
? 'Foundation'
|
|
3999
|
+
: source.startsWith('CoreFoundation', i)
|
|
4000
|
+
? 'CoreFoundation'
|
|
4001
|
+
: source.startsWith('ObjectiveC', i)
|
|
4002
|
+
? 'ObjectiveC'
|
|
4003
|
+
: source.startsWith('_LocationEssentials', i)
|
|
4004
|
+
? '_LocationEssentials'
|
|
4005
|
+
: null
|
|
4036
4006
|
if (
|
|
4037
4007
|
keyword &&
|
|
4038
4008
|
!/[\w$]/.test(source[i - 1] ?? '') &&
|
|
@@ -5320,6 +5290,7 @@ export function writeSwiftProject(
|
|
|
5320
5290
|
)
|
|
5321
5291
|
// an application's swift module must precede its native implementations.
|
|
5322
5292
|
// the tiny executable calls the original typed entry after both are linked.
|
|
5293
|
+
const libraryEntryFiles = new Map<string, string>()
|
|
5323
5294
|
for (const target of [...targets]) {
|
|
5324
5295
|
if (
|
|
5325
5296
|
!target.executable ||
|
|
@@ -5399,7 +5370,18 @@ export function writeSwiftProject(
|
|
|
5399
5370
|
`mixed executable ${target.name} requires one typed Swift application entry`,
|
|
5400
5371
|
)
|
|
5401
5372
|
}
|
|
5402
|
-
if (!nativeEntry)
|
|
5373
|
+
if (!nativeEntry) {
|
|
5374
|
+
compiled.set(entryFile, entrySource)
|
|
5375
|
+
if (path.basename(entryFile) === 'main.swift') {
|
|
5376
|
+
const libraryEntry = path.posix.join(
|
|
5377
|
+
path.posix.dirname(entryFile),
|
|
5378
|
+
'PeachApplicationEntry.generated.swift',
|
|
5379
|
+
)
|
|
5380
|
+
if (Object.hasOwn(input.files, libraryEntry))
|
|
5381
|
+
throw new Error(`mixed application entry conflicts with ${libraryEntry}`)
|
|
5382
|
+
libraryEntryFiles.set(entryFile, libraryEntry)
|
|
5383
|
+
}
|
|
5384
|
+
}
|
|
5403
5385
|
const name = `${target.name}Executable`
|
|
5404
5386
|
if (targets.some((candidate) => candidate.name === name))
|
|
5405
5387
|
throw new Error(`mixed application executable target conflicts with ${name}`)
|
|
@@ -5552,7 +5534,7 @@ export function writeSwiftProject(
|
|
|
5552
5534
|
}
|
|
5553
5535
|
for (const [file, contents] of Object.entries(input.files)) {
|
|
5554
5536
|
if (file === 'Package.swift') continue
|
|
5555
|
-
const destination = path.join(base, file)
|
|
5537
|
+
const destination = path.join(base, libraryEntryFiles.get(file) ?? file)
|
|
5556
5538
|
const interfaceModule = /(?:^|\/)(\w+)-Swift\.h$/.exec(file)?.[1]
|
|
5557
5539
|
// an installed binary's iOS header cannot describe the local Wasm
|
|
5558
5540
|
// producer. its consumers use that producer's emitted compatibility
|
|
@@ -5662,9 +5644,16 @@ export function writeSwiftProject(
|
|
|
5662
5644
|
emitSwiftPackageManifest({
|
|
5663
5645
|
root: layout.root,
|
|
5664
5646
|
files,
|
|
5665
|
-
targets: manifestTargets
|
|
5647
|
+
targets: manifestTargets.map((target) => ({
|
|
5648
|
+
...target,
|
|
5649
|
+
sources: target.sources?.map((source) => {
|
|
5650
|
+
const entry = libraryEntryFiles.get(path.posix.join(target.path, source))
|
|
5651
|
+
return entry ? path.posix.relative(target.path, entry) : source
|
|
5652
|
+
}),
|
|
5653
|
+
})),
|
|
5666
5654
|
packages,
|
|
5667
5655
|
native,
|
|
5656
|
+
sourceSwiftTargets: swiftTargets,
|
|
5668
5657
|
nativeFlags,
|
|
5669
5658
|
nativeImportFlags,
|
|
5670
5659
|
nativeHeaderFlags,
|
|
@@ -6428,7 +6417,7 @@ async function buildFrameworkProducts(
|
|
|
6428
6417
|
'--build-system',
|
|
6429
6418
|
'native',
|
|
6430
6419
|
'-j',
|
|
6431
|
-
|
|
6420
|
+
String(swiftBuildJobs()),
|
|
6432
6421
|
'--package-path',
|
|
6433
6422
|
linkRoot,
|
|
6434
6423
|
'--scratch-path',
|
|
@@ -6446,7 +6435,7 @@ async function buildFrameworkProducts(
|
|
|
6446
6435
|
'-Xswiftc',
|
|
6447
6436
|
'-num-threads',
|
|
6448
6437
|
'-Xswiftc',
|
|
6449
|
-
|
|
6438
|
+
String(swiftBuildJobs()),
|
|
6450
6439
|
...swiftReproducibleBuildFlags([
|
|
6451
6440
|
[path.dirname(args.toolchainBin), 'toolchain'],
|
|
6452
6441
|
[args.moduleRoot, 'framework'],
|
|
@@ -7056,7 +7045,7 @@ function compileSwiftProjectOnce(
|
|
|
7056
7045
|
'--build-system',
|
|
7057
7046
|
'native',
|
|
7058
7047
|
'-j',
|
|
7059
|
-
|
|
7048
|
+
String(swiftBuildJobs()),
|
|
7060
7049
|
'--package-path',
|
|
7061
7050
|
root,
|
|
7062
7051
|
...swiftCompileSdkOptions(frameworkRoot, options.toolchainBin),
|
|
@@ -7071,7 +7060,7 @@ function compileSwiftProjectOnce(
|
|
|
7071
7060
|
'-Xswiftc',
|
|
7072
7061
|
'-num-threads',
|
|
7073
7062
|
'-Xswiftc',
|
|
7074
|
-
|
|
7063
|
+
String(swiftBuildJobs()),
|
|
7075
7064
|
...swiftReproducibleBuildFlags([
|
|
7076
7065
|
[path.dirname(options.toolchainBin), 'toolchain'],
|
|
7077
7066
|
[frameworkRoot, 'framework'],
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
|
-
"id": "
|
|
3
|
-
"release": "swift-6.4.0-RELEASE-custom-
|
|
4
|
-
"wasmSdkId": "swift-6.4.0-RELEASE_wasm-peach-
|
|
5
|
-
"wasmSdkUrl": "https://r2.sootsim.com/swift-wasm-sdk/swift-6.4.0-RELEASE_wasm-peach-
|
|
6
|
-
"wasmSdkChecksum": "
|
|
7
|
-
"source": "
|
|
2
|
+
"id": "e9ff5f11f9bc07c8",
|
|
3
|
+
"release": "swift-6.4.0-RELEASE-custom-11345d60dca47496",
|
|
4
|
+
"wasmSdkId": "swift-6.4.0-RELEASE_wasm-peach-5e5960c3",
|
|
5
|
+
"wasmSdkUrl": "https://r2.sootsim.com/swift-wasm-sdk/swift-6.4.0-RELEASE_wasm-peach-5e5960c3.artifactbundle.tar.gz",
|
|
6
|
+
"wasmSdkChecksum": "be0b68da6af43e575e9f9daaae6239c92794159a85b910d7b4530e13117be579",
|
|
7
|
+
"source": "1be98e64083c03e076385a40ddfe6d111750a3cd",
|
|
8
8
|
"targets": [
|
|
9
9
|
"ImagePlayground",
|
|
10
10
|
"QuickLookThumbnailing",
|
|
@@ -133,6 +133,7 @@
|
|
|
133
133
|
"TOCropViewController",
|
|
134
134
|
"RiveRuntime",
|
|
135
135
|
"AVRouting",
|
|
136
|
+
"CoreDataConstants",
|
|
136
137
|
"CoreData",
|
|
137
138
|
"PDFKit",
|
|
138
139
|
"ModelIOEnums",
|
|
@@ -187,6 +188,7 @@
|
|
|
187
188
|
"ReplayKit",
|
|
188
189
|
"CoreServices",
|
|
189
190
|
"MobileCoreServices",
|
|
191
|
+
"CoreTelephonyConstants",
|
|
190
192
|
"CoreTelephony",
|
|
191
193
|
"SystemConfiguration",
|
|
192
194
|
"ImageIO",
|
|
@@ -233,16 +235,16 @@
|
|
|
233
235
|
},
|
|
234
236
|
"hosts": {
|
|
235
237
|
"darwin-arm64": {
|
|
236
|
-
"sha256": "
|
|
237
|
-
"size":
|
|
238
|
+
"sha256": "3d6b7c9c47ee0e1e13c3e79bb6f92a9ee68862a27fc777f2e481c2beb7782ab9",
|
|
239
|
+
"size": 100088476
|
|
238
240
|
},
|
|
239
241
|
"linux-x64": {
|
|
240
|
-
"sha256": "
|
|
241
|
-
"size":
|
|
242
|
+
"sha256": "a9e4d05046d4105c3654808728396602eddb3012a2a1c174043dc2dc66781162",
|
|
243
|
+
"size": 102806849
|
|
242
244
|
},
|
|
243
245
|
"linux-arm64": {
|
|
244
|
-
"sha256": "
|
|
245
|
-
"size":
|
|
246
|
+
"sha256": "ccc8ecbd37dd2aacf83efd1bcfeb6b2a0ff0ba3c50768217bdb6907618d1dca3",
|
|
247
|
+
"size": 102300527
|
|
246
248
|
}
|
|
247
249
|
}
|
|
248
250
|
}
|
|
@@ -587,15 +587,20 @@ export function createGuestImageLedger(input: GuestImageLedgerInput): GuestImage
|
|
|
587
587
|
exported.set(definition.alias, definition)
|
|
588
588
|
}
|
|
589
589
|
const names = [...new Set([...exported.values()].map((definition) => definition.name))]
|
|
590
|
-
const
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
.
|
|
596
|
-
.
|
|
597
|
-
|
|
598
|
-
|
|
590
|
+
const nameOffsets = new Map<string, number>()
|
|
591
|
+
let nameSize = 0
|
|
592
|
+
const nameContents = names
|
|
593
|
+
.map((name) => {
|
|
594
|
+
const bytes = Buffer.concat([Buffer.from(name), Buffer.from([0])])
|
|
595
|
+
nameOffsets.set(name, nameSize)
|
|
596
|
+
nameSize += bytes.length
|
|
597
|
+
return [...bytes].map((byte) => `\\${byte.toString(16).padStart(2, '0')}`).join('')
|
|
598
|
+
})
|
|
599
|
+
.join('')
|
|
600
|
+
const ir = [
|
|
601
|
+
'target triple = "wasm32-unknown-wasip1"',
|
|
602
|
+
`@.names = private constant [${nameSize} x i8] c"${nameContents}"`,
|
|
603
|
+
]
|
|
599
604
|
for (const definition of exported.values()) {
|
|
600
605
|
if (definition.kind === 'function')
|
|
601
606
|
ir.push(
|
|
@@ -608,7 +613,7 @@ export function createGuestImageLedger(input: GuestImageLedgerInput): GuestImage
|
|
|
608
613
|
[...exported.values()]
|
|
609
614
|
.map(
|
|
610
615
|
(definition) =>
|
|
611
|
-
` { ptr, i32, ptr } { ptr @.
|
|
616
|
+
` { ptr, i32, ptr } { ptr getelementptr (i8, ptr @.names, i32 ${nameOffsets.get(definition.name)}), i32 ${definition.image}, ptr @${definition.alias} }`,
|
|
612
617
|
)
|
|
613
618
|
.join(',\n'),
|
|
614
619
|
)
|
|
@@ -319,10 +319,11 @@ export function sourceGuestRuntimeLinks(options: {
|
|
|
319
319
|
const links: string[] = []
|
|
320
320
|
const requests: GuestFrameworkRequest[] = []
|
|
321
321
|
const optionGroups = [
|
|
322
|
-
{ object: null, flags:
|
|
323
|
-
|
|
322
|
+
{ object: null, flags: image.linkerFlags, autoLinked: false },
|
|
323
|
+
{ object: null, flags: autolink, autoLinked: true },
|
|
324
|
+
...image.clangLinkOptions.map((options) => ({ ...options, autoLinked: true })),
|
|
324
325
|
]
|
|
325
|
-
for (const { object, flags } of optionGroups) {
|
|
326
|
+
for (const { object, flags, autoLinked } of optionGroups) {
|
|
326
327
|
for (let index = 0; index < flags.length; index++) {
|
|
327
328
|
const flag = flags[index]!
|
|
328
329
|
const artifact = artifacts.get(flag)
|
|
@@ -339,6 +340,8 @@ export function sourceGuestRuntimeLinks(options: {
|
|
|
339
340
|
if (flag === '-framework') {
|
|
340
341
|
const name = flags[++index]
|
|
341
342
|
const provider = name && frameworkAliases.get(name)
|
|
343
|
+
// autolinks are hints; wasm-ld already rejects any missing required symbol.
|
|
344
|
+
if (!provider && name && autoLinked) continue
|
|
342
345
|
if (!provider)
|
|
343
346
|
throw new Error(
|
|
344
347
|
`source image ${image.id} has unresolved framework linkage ${name}`,
|
|
@@ -66,7 +66,11 @@ export function guestSourceImages(graph: SwiftSourceLinkGraph): GuestSourceImage
|
|
|
66
66
|
const type = dependency.productType
|
|
67
67
|
let dynamic: boolean
|
|
68
68
|
if (type.startsWith('swiftpm.target.')) {
|
|
69
|
-
if (
|
|
69
|
+
if (
|
|
70
|
+
type !== 'swiftpm.target.regular' &&
|
|
71
|
+
type !== 'swiftpm.target.binary' &&
|
|
72
|
+
type !== 'swiftpm.target.system'
|
|
73
|
+
)
|
|
70
74
|
throw new Error(`unsupported SwiftPM target ${edge.target}`)
|
|
71
75
|
dynamic = false
|
|
72
76
|
} else if (type.startsWith('swiftpm.library.')) {
|
|
@@ -7,7 +7,7 @@ import { cacheDir } from './home-paths'
|
|
|
7
7
|
import { isRecord } from './is-record'
|
|
8
8
|
import { DOUBLE_CONVERSION_WASM32_BACKPORT } from './nitro-dependencies'
|
|
9
9
|
import {
|
|
10
|
-
|
|
10
|
+
swiftBuildJobs,
|
|
11
11
|
swiftSdkPaths,
|
|
12
12
|
swiftModuleSdk,
|
|
13
13
|
swiftModuleDigest,
|
|
@@ -1502,7 +1502,7 @@ export async function prepareXcodeObjCImplementations(
|
|
|
1502
1502
|
let interrupted = false
|
|
1503
1503
|
await mapLimit(
|
|
1504
1504
|
units,
|
|
1505
|
-
|
|
1505
|
+
swiftBuildJobs(),
|
|
1506
1506
|
async ({ target, index, unit, file }, position) => {
|
|
1507
1507
|
if (interrupted) return
|
|
1508
1508
|
const minimum = minimums[index]!
|