peachsim 0.1.1655 → 0.1.1660
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/app-config.ts +4 -0
- package/cli/app-stubs.ts +43 -6
- package/cli/commands/inspect/shared.ts +5 -2
- package/cli/commands/inspect/url.ts +2 -1
- package/cli/commands/screenshot.ts +5 -5
- package/cli/commands/state.ts +9 -6
- package/cli/outbound-endpoints.ts +9 -1
- package/cli/output-redaction.ts +49 -0
- package/detox/index.ts +0 -1
- 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 +12772 -1132
- 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 +29 -5
- package/dist-lib/config.mjs +29 -5
- package/dist-lib/detox/index.cjs +19 -6
- package/dist-lib/dev-bundle-resolution.cjs +1 -1
- package/dist-lib/expo-swift-bundle.cjs +10411 -73
- 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 +11220 -670
- package/dist-lib/host/fetch-proxy-handler.cjs +260 -197
- 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 +653 -338
- 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 +443 -312
- 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 +548 -163
- package/dist-lib/native-app-identity-project.cjs +179 -33
- package/dist-lib/native-app-identity-project.mjs +179 -33
- package/dist-lib/native-app-identity.cjs +1 -1
- package/dist-lib/native-app-identity.mjs +1 -1
- package/dist-lib/native-firebase-metadata.cjs +1 -1
- package/dist-lib/native-firebase-metadata.mjs +1 -1
- package/dist-lib/plist.cjs +1 -1
- package/dist-lib/plist.mjs +1 -1
- package/dist-lib/profiles.cjs +1 -1
- package/dist-lib/public-brand.cjs +1 -1
- package/dist-lib/public-origins-lib-esm.json +23 -23
- package/dist-lib/public-origins-lib.json +96 -63
- package/dist-lib/react-native-host-modules.cjs +1 -1
- package/dist-lib/react-native-host-modules.mjs +1 -1
- package/dist-lib/scripts/dev-server-scanner.cjs +2 -2
- package/dist-lib/sdk.cjs +1 -1
- package/dist-lib/sdk.mjs +1 -1
- package/dist-lib/skills.cjs +12193 -1448
- package/dist-lib/swift-compile.cjs +10348 -172
- package/dist-lib/swift-compile.mjs +10348 -172
- 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 +1 -1
- package/dist-lib/swift.cjs +1 -1
- package/dist-lib/vite-swift.cjs +10411 -73
- package/dist-lib/vite.cjs +149 -163
- package/dist-lib/worklet-executable.cjs +1 -1
- package/dist-lib/worklet-executable.mjs +1 -1
- package/dist-types/packages/peach-compat/src/stubs/native-seams/react-native-gesture-handler.d.ts +2 -0
- package/dist-types/packages/peach-engine/src/engine/app-font-registry.d.ts +14 -0
- package/dist-types/packages/peach-engine/src/engine/image-loader.d.ts +8 -0
- package/dist-types/packages/peach-engine/src/engine/node.d.ts +3 -0
- package/dist-types/packages/peach-engine/src/render-worker/compositor-protocol.d.ts +21 -0
- package/dist-types/packages/peach-engine/src/render-worker/gesture-seam-protocol.d.ts +2 -1
- package/dist-types/packages/peach-engine/src/render-worker/test-bridge-protocol.d.ts +1 -1
- package/dist-types/packages/peach-engine/src/rolldown-bundle-inventory.d.ts +1 -0
- package/dist-types/packages/peach-globals/src/index.d.ts +34 -0
- package/kotlin/README.md +38 -23
- package/kotlin/sdk.tar.gz +0 -0
- package/package.json +2 -12
- package/runtime-companion.json +1 -1
- package/src/bundleGlobalFooter.ts +0 -2
- package/src/config.ts +54 -2
- package/src/configured-bundle-producer.ts +7 -1
- package/src/host/fetch-proxy-handler.ts +14 -50
- package/src/host/rolldown-bundle-forward.ts +71 -0
- package/src/installed-package-versions.ts +54 -2
- package/src/kotlin-host.ts +138 -285
- package/src/kotlin-module.ts +4 -7
- package/src/kotlin-sdk.ts +81 -0
- package/src/kotlin-toolchain.ts +152 -0
- package/src/kotlin-view-models.ts +1 -1
- package/src/kotlinSdkContract.ts +113 -0
- package/src/nitro-adapter.lock.json +3 -3
- package/src/nitro-bundle.ts +18 -4
- package/src/nitro-compile.ts +5 -1
- package/src/nitro-source.ts +112 -28
- package/src/nitroContract.ts +16 -4
- package/src/stub-pattern-matcher.ts +4 -0
- package/src/swift-compile.ts +44 -14
- package/src/swift-host.ts +2 -1
- package/src/swift-objc-compile.ts +117 -4
- package/src/swift-objc-sdk.ts +10215 -59
- package/src/swift-objc-standin.ts +5 -2
- package/src/vite-plugin-one.ts +73 -134
- package/src/worker-system-chunks.ts +14 -4
- package/src/xcode-project.ts +261 -34
- package/kotlin/AndroidViewSources/android/content/Context.kt +0 -22
- package/kotlin/AndroidViewSources/android/content/res/Configuration.kt +0 -25
- package/kotlin/AndroidViewSources/android/content/res/Resources.kt +0 -72
- package/kotlin/AndroidViewSources/android/graphics/Canvas.kt +0 -22
- package/kotlin/AndroidViewSources/android/graphics/Color.kt +0 -13
- package/kotlin/AndroidViewSources/android/graphics/Paint.kt +0 -18
- package/kotlin/AndroidViewSources/android/util/DisplayMetrics.kt +0 -12
- package/kotlin/AndroidViewSources/android/view/View.kt +0 -211
- package/kotlin/AndroidViewSources/android/widget/FrameLayout.kt +0 -61
- package/kotlin/AndroidViewSources/android/widget/LinearLayout.kt +0 -49
- package/kotlin/AndroidViewSources/dev/peach/app/JavaFormat.kt +0 -272
- package/kotlin/AppSources/android/app/Activity.kt +0 -174
- package/kotlin/AppSources/android/app/Application.kt +0 -11
- package/kotlin/AppSources/android/app/UiModeManager.kt +0 -9
- package/kotlin/AppSources/android/content/Intent.kt +0 -16
- package/kotlin/AppSources/android/os/Bundle.kt +0 -11
- package/kotlin/AppSources/android/util/SuperNotCalledException.kt +0 -3
- package/kotlin/AppSources/android/view/Window.kt +0 -182
- package/kotlin/AppSources/android/view/WindowInsets.kt +0 -9
- package/kotlin/AppSources/android/view/WindowInsetsController.kt +0 -17
- package/kotlin/AppSources/android/view/WindowManager.kt +0 -16
- package/kotlin/AppSources/android/window/BackEvent.kt +0 -24
- package/kotlin/AppSources/android/window/OnBackAnimationCallback.kt +0 -7
- package/kotlin/AppSources/android/window/OnBackInvokedDispatcher.kt +0 -84
- package/kotlin/AppSources/androidx/activity/ActivityFlags.kt +0 -9
- package/kotlin/AppSources/androidx/activity/ActivityViewModelLazy.kt +0 -21
- package/kotlin/AppSources/androidx/activity/BackEventCompat.kt +0 -43
- package/kotlin/AppSources/androidx/activity/ComponentActivity.kt +0 -122
- package/kotlin/AppSources/androidx/activity/EdgeToEdge.kt +0 -75
- package/kotlin/AppSources/androidx/activity/ExperimentalActivityApi.kt +0 -6
- package/kotlin/AppSources/androidx/activity/OnBackPressedCallback.kt +0 -69
- package/kotlin/AppSources/androidx/activity/OnBackPressedDispatcher.kt +0 -144
- package/kotlin/AppSources/androidx/activity/OnBackPressedDispatcherOwner.kt +0 -7
- package/kotlin/AppSources/androidx/activity/compose/BackHandler.kt +0 -86
- package/kotlin/AppSources/androidx/activity/compose/ComponentActivity.kt +0 -29
- package/kotlin/AppSources/androidx/activity/compose/internal/BackHandlerCompat.kt +0 -38
- package/kotlin/AppSources/androidx/activity/compose/internal/BackHandlerDispatcherCompat.kt +0 -27
- package/kotlin/AppSources/androidx/compose/foundation/layout/WindowInsets.kt +0 -15
- package/kotlin/AppSources/androidx/compose/ui/platform/AndroidCompositionLocals.kt +0 -27
- package/kotlin/AppSources/androidx/compose/ui/platform/ComposeView.kt +0 -68
- package/kotlin/AppSources/androidx/compose/ui/res/ColorResources.kt +0 -16
- package/kotlin/AppSources/androidx/compose/ui/res/PainterResources.kt +0 -70
- package/kotlin/AppSources/androidx/compose/ui/res/StringResources.kt +0 -38
- package/kotlin/AppSources/androidx/core/view/WindowCompat.kt +0 -32
- package/kotlin/AppSources/androidx/lifecycle/AndroidViewModel.kt +0 -10
- package/kotlin/AppSources/dev/peach/app/PeachApp.kt +0 -388
- package/kotlin/AppSources/dev/peach/app/PeachDrawable.kt +0 -102
- package/kotlin/AppSources/dev/peach/app/PeachWindowHost.kt +0 -14
- package/kotlin/CompilerSources/META-INF/services/org.jetbrains.kotlin.compiler.plugin.CompilerPluginRegistrar +0 -1
- package/kotlin/CompilerSources/PeachJniIncoming.kt +0 -243
- package/kotlin/CompilerSources/PeachJniPlugin.kt +0 -116
- package/kotlin/ComposeSources/PeachComposeHost.kt +0 -724
- package/kotlin/ComposeSources/PeachMagnifier.kt +0 -185
- package/kotlin/ComposeSources/PeachSemantics.kt +0 -127
- package/kotlin/ExpoComposeSources/PeachAndroidView.kt +0 -103
- package/kotlin/ExpoComposeSources/PeachExpoViewMount.kt +0 -24
- package/kotlin/ExpoComposeSources/dev/peach/expo/PeachExpoCompose.kt +0 -28
- package/kotlin/ExpoComposeSources/expo/modules/kotlin/views/ExpoComposeView.kt +0 -70
- package/kotlin/ExpoSources/dev/peach/expo/PeachExpoRuntime.kt +0 -516
- package/kotlin/ExpoSources/dev/peach/expo/PeachExpoTypes.kt +0 -173
- package/kotlin/ExpoSources/expo/modules/kotlin/AppContext.kt +0 -20
- package/kotlin/ExpoSources/expo/modules/kotlin/Promise.kt +0 -19
- package/kotlin/ExpoSources/expo/modules/kotlin/classcomponent/ClassComponentBuilder.kt +0 -198
- package/kotlin/ExpoSources/expo/modules/kotlin/exception/CodedException.kt +0 -126
- package/kotlin/ExpoSources/expo/modules/kotlin/functions/Functions.kt +0 -132
- package/kotlin/ExpoSources/expo/modules/kotlin/jni/JavaScriptTypedArray.kt +0 -81
- package/kotlin/ExpoSources/expo/modules/kotlin/modules/Module.kt +0 -98
- package/kotlin/ExpoSources/expo/modules/kotlin/objects/ObjectDefinitionBuilder.kt +0 -236
- package/kotlin/ExpoSources/expo/modules/kotlin/records/Record.kt +0 -12
- package/kotlin/ExpoSources/expo/modules/kotlin/runtime/Runtime.kt +0 -9
- package/kotlin/ExpoSources/expo/modules/kotlin/sharedobjects/SharedObject.kt +0 -50
- package/kotlin/ExpoSources/expo/modules/kotlin/sharedobjects/SharedObjectRegistry.kt +0 -57
- package/kotlin/ExpoSources/expo/modules/kotlin/sharedobjects/SharedRef.kt +0 -19
- package/kotlin/ExpoSources/expo/modules/kotlin/typedarray/ConcreteTypedArrays.kt +0 -158
- package/kotlin/ExpoSources/expo/modules/kotlin/typedarray/GenericTypedArray.kt +0 -8
- package/kotlin/ExpoSources/expo/modules/kotlin/typedarray/TypedArray.kt +0 -29
- package/kotlin/ExpoSources/expo/modules/kotlin/typedarray/TypedArrayIterator.kt +0 -9
- package/kotlin/ExpoSources/expo/modules/kotlin/types/AnyType.kt +0 -155
- package/kotlin/ExpoSources/expo/modules/kotlin/types/Either.kt +0 -91
- package/kotlin/ExpoSources/expo/modules/kotlin/types/Enumerable.kt +0 -6
- package/kotlin/ExpoSources/expo/modules/kotlin/viewevent/ViewEvent.kt +0 -68
- package/kotlin/ExpoSources/expo/modules/kotlin/views/ExpoView.kt +0 -20
- package/kotlin/ExpoSources/expo/modules/kotlin/views/ViewDefinitionBuilder.kt +0 -72
- package/kotlin/ExpoSources/expo/modules/kotlin/views/ViewProps.kt +0 -36
- package/kotlin/JniPlatformSources/androidx/annotation/CallSuper.kt +0 -5
- package/kotlin/JniPlatformSources/com/facebook/proguard/annotations/DoNotStrip.kt +0 -5
- package/kotlin/JniPlatformSources/dalvik/annotation/optimization/FastNative.kt +0 -5
- package/kotlin/JniPlatformSources/kotlin/Synchronized.kt +0 -6
- package/kotlin/JniPlatformSources/kotlin/jvm/JvmField.kt +0 -5
- package/kotlin/JniPlatformSources/kotlin/jvm/JvmStatic.kt +0 -5
- package/kotlin/JniSources/com/facebook/jni/HybridData.kt +0 -66
- package/kotlin/JniSources/dev/peach/jni/IncomingBindings.kt +0 -157
- package/kotlin/JniSources/dev/peach/jni/NativeBindings.kt +0 -77
- package/kotlin/JniTransportSources/dev/peach/jni/integration/JniTransport.kt +0 -89
- package/kotlin/Sources/android/os/Build.kt +0 -17
- package/kotlin/Sources/android/os/Handler.kt +0 -35
- package/kotlin/Sources/android/os/Looper.kt +0 -17
- package/kotlin/Sources/android/os/MessageQueue.kt +0 -56
- package/kotlin/Sources/android/os/SystemClock.kt +0 -14
- package/kotlin/Sources/android/util/Log.kt +0 -64
- package/kotlin/Sources/androidx/annotation/DrawableRes.kt +0 -14
- package/kotlin/Sources/androidx/annotation/Keep.kt +0 -4
- package/kotlin/Sources/dev/onejs/one/OneNativeSourceDispatch.kt +0 -7
- package/kotlin/Sources/dev/onejs/one/OneNativeSourceViewDispatch.kt +0 -13
- package/kotlin/Sources/dev/onejs/one/source/OneModule.kt +0 -4
- package/kotlin/Sources/java/lang/Runnable.kt +0 -6
- package/kotlin/Sources/java/security/MessageDigest.kt +0 -114
- package/kotlin/Sources/java/util/IllegalFormatCodePointException.kt +0 -10
- package/kotlin/Sources/java/util/IllegalFormatException.kt +0 -5
- package/kotlin/Sources/kotlin/text/StringFormat.kt +0 -9
- package/kotlin/Sources/org/json/JSON.kt +0 -307
- package/kotlin/tools/abi-classes.main.kts +0 -41
- package/kotlin/tools/expo-types.main.kts +0 -127
package/src/swift-compile.ts
CHANGED
|
@@ -34,7 +34,11 @@ import {
|
|
|
34
34
|
} from './swift-distribution-contract'
|
|
35
35
|
import { swiftIcuAsset, type SwiftIcuAsset } from './swift-icu'
|
|
36
36
|
import { swiftObjCExports } from './swift-objc-export'
|
|
37
|
-
import {
|
|
37
|
+
import {
|
|
38
|
+
SwiftObjCImportError,
|
|
39
|
+
swiftObjCImports,
|
|
40
|
+
swiftObjCPrivateImports,
|
|
41
|
+
} from './swift-objc-import'
|
|
38
42
|
import { validateObjcPeerStartupLibraries } from './swift-objc-metadata'
|
|
39
43
|
import { materializeObjcSdk, objcView } from './swift-objc-standin'
|
|
40
44
|
import {
|
|
@@ -178,9 +182,15 @@ const SWIFTPM_PROGRESS = /^\[\d+\/\d+\] /
|
|
|
178
182
|
const SWIFTPM_NOISE =
|
|
179
183
|
/^(?:\[\d+\/\d+\] |Building for production\.\.\.$|warning: '--build-system native' has been deprecated)/
|
|
180
184
|
|
|
181
|
-
// compiler jobs match the fixture builder's cap to fit a 16GiB Linux slot
|
|
185
|
+
// compiler jobs match the fixture builder's cap to fit a 16GiB Linux slot, and
|
|
186
|
+
// never exceed the cores an admitted build scope granted (TM_EXEC_CPU_CORES).
|
|
187
|
+
const admittedCores = Number(process.env.TM_EXEC_CPU_CORES)
|
|
182
188
|
const BUILD_JOBS = String(
|
|
183
|
-
Math.min(
|
|
189
|
+
Math.min(
|
|
190
|
+
4,
|
|
191
|
+
Math.max(1, Math.floor(os.availableParallelism() / 2)),
|
|
192
|
+
Number.isInteger(admittedCores) && admittedCores > 0 ? admittedCores : 4,
|
|
193
|
+
),
|
|
184
194
|
)
|
|
185
195
|
|
|
186
196
|
export interface SwiftCompileInput {
|
|
@@ -6276,10 +6286,19 @@ export function writeSwiftProject(
|
|
|
6276
6286
|
},
|
|
6277
6287
|
})
|
|
6278
6288
|
} catch (error) {
|
|
6279
|
-
// a
|
|
6280
|
-
//
|
|
6281
|
-
|
|
6289
|
+
// a target that fails here compiles only its swift, and its failure
|
|
6290
|
+
// joins the build's diagnostic, so one target hides no other. a pure
|
|
6291
|
+
// clang target becomes an empty swift module: swiftpm stops at a
|
|
6292
|
+
// target that fails to compile, so a failing stand-in would hide the
|
|
6293
|
+
// other targets' errors, and a missing one breaks every importer.
|
|
6294
|
+
if (!(error instanceof Error)) throw error
|
|
6282
6295
|
targetFailures.push(`${target.name}: ${error.message}`)
|
|
6296
|
+
imports.delete(target.name)
|
|
6297
|
+
if (!swift)
|
|
6298
|
+
files.set(
|
|
6299
|
+
path.join(layout.root, target.path, 'PeachUnprepared.generated.swift'),
|
|
6300
|
+
`// ${target.name} failed preparation; its dependents import nothing from it.\n`,
|
|
6301
|
+
)
|
|
6283
6302
|
native.set(target.name, {
|
|
6284
6303
|
mixed: true,
|
|
6285
6304
|
path: target.path,
|
|
@@ -6516,6 +6535,24 @@ export function writeSwiftProject(
|
|
|
6516
6535
|
}
|
|
6517
6536
|
const original = imports.get(name)
|
|
6518
6537
|
if (!exported && !original) continue
|
|
6538
|
+
let generated: ReturnType<typeof swiftObjCImports> | undefined
|
|
6539
|
+
try {
|
|
6540
|
+
generated =
|
|
6541
|
+
original &&
|
|
6542
|
+
swiftObjCImports(original.view.graphs, {
|
|
6543
|
+
module: swiftTargetModuleName(name),
|
|
6544
|
+
headers: original.headers,
|
|
6545
|
+
classes: original.classes,
|
|
6546
|
+
clangAST: original.view.clangAST,
|
|
6547
|
+
peerTypes: exported?.types,
|
|
6548
|
+
})
|
|
6549
|
+
} catch (error) {
|
|
6550
|
+
// a refused import registers nothing, and the target's swift then fails
|
|
6551
|
+
// on the missing declarations in the same build.
|
|
6552
|
+
if (!(error instanceof SwiftObjCImportError)) throw error
|
|
6553
|
+
targetFailures.push(`${name}: ${error.message}`)
|
|
6554
|
+
continue
|
|
6555
|
+
}
|
|
6519
6556
|
objcModules.add(name)
|
|
6520
6557
|
rootOwner ??= exported
|
|
6521
6558
|
? [...exported.swift.keys()][0]
|
|
@@ -6548,14 +6585,7 @@ export function writeSwiftProject(
|
|
|
6548
6585
|
for (const type of original?.classes ?? []) registeredClasses.add(type)
|
|
6549
6586
|
for (const [file, text] of exported?.swift ?? [])
|
|
6550
6587
|
compiled.set(file, compiled.get(file)! + text)
|
|
6551
|
-
if (
|
|
6552
|
-
const generated = swiftObjCImports(original.view.graphs, {
|
|
6553
|
-
module: swiftTargetModuleName(name),
|
|
6554
|
-
headers: original.headers,
|
|
6555
|
-
classes: original.classes,
|
|
6556
|
-
clangAST: original.view.clangAST,
|
|
6557
|
-
peerTypes: exported?.types,
|
|
6558
|
-
})
|
|
6588
|
+
if (generated) {
|
|
6559
6589
|
const register = `_peach_objc_imports_${swiftTargetModuleName(name)}`
|
|
6560
6590
|
files.set(
|
|
6561
6591
|
path.join(layout.root, target.path, 'PeachObjCImports.generated.swift'),
|
package/src/swift-host.ts
CHANGED
|
@@ -270,6 +270,7 @@ export function openXcodeProject(
|
|
|
270
270
|
): string {
|
|
271
271
|
const app = readXcodeAppTarget(xcodeproj, target, configuration, {
|
|
272
272
|
prepareGeneratedSources: true,
|
|
273
|
+
installedPods: true,
|
|
273
274
|
})
|
|
274
275
|
const root = app.rootDir
|
|
275
276
|
xcodeProjects.set(root, {
|
|
@@ -461,7 +462,7 @@ function xcodeLayout(root: string): XcodeLayout | null {
|
|
|
461
462
|
registered.xcodeproj,
|
|
462
463
|
registered.target,
|
|
463
464
|
registered.configuration,
|
|
464
|
-
{ prepareGeneratedSources: true },
|
|
465
|
+
{ prepareGeneratedSources: true, installedPods: true },
|
|
465
466
|
)
|
|
466
467
|
const appSources = app.allSources
|
|
467
468
|
const files = new Set([
|
|
@@ -11,7 +11,7 @@ import {
|
|
|
11
11
|
validateObjcPeerClasses,
|
|
12
12
|
} from './swift-objc-metadata'
|
|
13
13
|
import { IOS_SDK_ID, materializeObjcSdk, OBJC_IMPORT_VERSION } from './swift-objc-standin'
|
|
14
|
-
import { swiftTargetModuleName } from './swift-package'
|
|
14
|
+
import { SWIFT_NATIVE_SOURCE_EXTENSIONS, swiftTargetModuleName } from './swift-package'
|
|
15
15
|
import { swiftPackageManifest, swiftTargetFiles } from './swift-package-manifest'
|
|
16
16
|
import { remoteSwiftCheckouts, type SwiftPackageBinary } from './swift-packages'
|
|
17
17
|
import { readPackageFile } from './swift-source-file'
|
|
@@ -24,6 +24,9 @@ import type { XcodeAppTarget } from './xcode-project'
|
|
|
24
24
|
|
|
25
25
|
export class SwiftObjCCompilationError extends Error {}
|
|
26
26
|
|
|
27
|
+
// a search path names headers only when it is a directory, as clang reads it.
|
|
28
|
+
const isDirectory = (file: string): boolean => linkedStat(file)?.isDirectory() ?? false
|
|
29
|
+
|
|
27
30
|
// a link's target, or null when the target is proven absent; other failures surface.
|
|
28
31
|
function linkedStat(file: string): fs.Stats | null {
|
|
29
32
|
try {
|
|
@@ -37,6 +40,50 @@ function linkedStat(file: string): fs.Stats | null {
|
|
|
37
40
|
const isSdkInclude = (file: string): boolean =>
|
|
38
41
|
file === '/usr/include' || file.startsWith('/usr/include/')
|
|
39
42
|
|
|
43
|
+
// clang's header map format: case-insensitive keys hashed into a power-of-two
|
|
44
|
+
// bucket table, each value split into a prefix and suffix string.
|
|
45
|
+
function headerMap(entries: readonly (readonly [string, string])[]): Buffer {
|
|
46
|
+
const unique = new Map<string, readonly [string, string]>()
|
|
47
|
+
for (const entry of entries)
|
|
48
|
+
if (!unique.has(entry[0].toLowerCase())) unique.set(entry[0].toLowerCase(), entry)
|
|
49
|
+
let buckets = 8
|
|
50
|
+
while (buckets < unique.size * 2) buckets *= 2
|
|
51
|
+
const strings: Buffer[] = [Buffer.alloc(1)]
|
|
52
|
+
let length = 1
|
|
53
|
+
const offsets = new Map<string, number>()
|
|
54
|
+
const offset = (text: string): number => {
|
|
55
|
+
const known = offsets.get(text)
|
|
56
|
+
if (known !== undefined) return known
|
|
57
|
+
const at = length
|
|
58
|
+
const bytes = Buffer.from(`${text}\0`)
|
|
59
|
+
offsets.set(text, at)
|
|
60
|
+
strings.push(bytes)
|
|
61
|
+
length += bytes.length
|
|
62
|
+
return at
|
|
63
|
+
}
|
|
64
|
+
const table = Buffer.alloc(24 + buckets * 12)
|
|
65
|
+
let longest = 0
|
|
66
|
+
for (const [lower, [key, value]] of unique) {
|
|
67
|
+
let bucket = 0
|
|
68
|
+
for (const character of Buffer.from(lower)) bucket = (bucket + character * 13) >>> 0
|
|
69
|
+
bucket &= buckets - 1
|
|
70
|
+
while (table.readUInt32LE(24 + bucket * 12) !== 0)
|
|
71
|
+
bucket = (bucket + 1) & (buckets - 1)
|
|
72
|
+
const split = value.lastIndexOf('/') + 1
|
|
73
|
+
table.writeUInt32LE(offset(key), 24 + bucket * 12)
|
|
74
|
+
table.writeUInt32LE(offset(value.slice(0, split)), 28 + bucket * 12)
|
|
75
|
+
table.writeUInt32LE(offset(value.slice(split)), 32 + bucket * 12)
|
|
76
|
+
longest = Math.max(longest, Buffer.byteLength(value))
|
|
77
|
+
}
|
|
78
|
+
table.writeUInt32LE(0x686d6170, 0)
|
|
79
|
+
table.writeUInt16LE(1, 4)
|
|
80
|
+
table.writeUInt32LE(table.length, 8)
|
|
81
|
+
table.writeUInt32LE(unique.size, 12)
|
|
82
|
+
table.writeUInt32LE(buckets, 16)
|
|
83
|
+
table.writeUInt32LE(longest, 20)
|
|
84
|
+
return Buffer.concat([table, ...strings])
|
|
85
|
+
}
|
|
86
|
+
|
|
40
87
|
/** one original source snapshot serves declaration import and implementation compile. */
|
|
41
88
|
export function xcodeObjCInputs(
|
|
42
89
|
app: XcodeAppTarget,
|
|
@@ -88,6 +135,8 @@ export function xcodeObjCInputs(
|
|
|
88
135
|
prefix: string | null
|
|
89
136
|
fileFlags: Record<string, string[]>
|
|
90
137
|
publicHeaders?: string
|
|
138
|
+
headerMaps: { flag: '-I' | '-iquote'; entries: [string, string][] }[]
|
|
139
|
+
productHeaders: Record<string, string>
|
|
91
140
|
}[] = []
|
|
92
141
|
const configuration = app.configuration === 'Debug' ? 'debug' : 'release'
|
|
93
142
|
for (const binary of binaries) {
|
|
@@ -97,7 +146,9 @@ export function xcodeObjCInputs(
|
|
|
97
146
|
if (!target)
|
|
98
147
|
throw new Error(`missing original implementation target ${binary.target}`)
|
|
99
148
|
const files = swiftTargetFiles(manifest, target)
|
|
100
|
-
for (const file of files)
|
|
149
|
+
for (const file of files)
|
|
150
|
+
if (SWIFT_NATIVE_SOURCE_EXTENSIONS.some((extension) => file.endsWith(extension)))
|
|
151
|
+
add(file)
|
|
101
152
|
// explicit sources select compile units, not the private headers they include.
|
|
102
153
|
addHeaders(target.dir)
|
|
103
154
|
for (const dependency of binary.headerDependencies ?? [])
|
|
@@ -145,6 +196,8 @@ export function xcodeObjCInputs(
|
|
|
145
196
|
prefix: null,
|
|
146
197
|
fileFlags: {},
|
|
147
198
|
publicHeaders: path.join(target.dir, target.publicHeadersPath),
|
|
199
|
+
headerMaps: [],
|
|
200
|
+
productHeaders: {},
|
|
148
201
|
})
|
|
149
202
|
}
|
|
150
203
|
for (const target of [...app.frameworks, app]) {
|
|
@@ -156,6 +209,12 @@ export function xcodeObjCInputs(
|
|
|
156
209
|
...[target.objc.prefixHeader, target.objc.bridgingHeader].filter(
|
|
157
210
|
(file): file is string => file !== null,
|
|
158
211
|
),
|
|
212
|
+
...Object.values(target.objc.productHeaders),
|
|
213
|
+
...target.objc.headerMaps.flatMap((map) =>
|
|
214
|
+
map.entries.flatMap(([, file]) =>
|
|
215
|
+
path.isAbsolute(file) && fs.existsSync(file) ? [file] : [],
|
|
216
|
+
),
|
|
217
|
+
),
|
|
159
218
|
])
|
|
160
219
|
add(file, true)
|
|
161
220
|
// search paths name directories of headers the target includes; /usr/include maps to the wasm sysroot.
|
|
@@ -163,7 +222,7 @@ export function xcodeObjCInputs(
|
|
|
163
222
|
...target.objc.headerSearchPaths,
|
|
164
223
|
...target.objc.frameworkSearchPaths,
|
|
165
224
|
])
|
|
166
|
-
if (!isSdkInclude(directory) &&
|
|
225
|
+
if (!isSdkInclude(directory) && isDirectory(directory)) addHeaders(directory)
|
|
167
226
|
const flags = [
|
|
168
227
|
...target.objc.flags,
|
|
169
228
|
...target.objc.cxxFlags,
|
|
@@ -192,6 +251,8 @@ export function xcodeObjCInputs(
|
|
|
192
251
|
cxxFlags: target.objc.cxxFlags,
|
|
193
252
|
prefix: target.objc.prefixHeader,
|
|
194
253
|
fileFlags: target.objc.fileFlags,
|
|
254
|
+
headerMaps: target.objc.headerMaps,
|
|
255
|
+
productHeaders: target.objc.productHeaders,
|
|
195
256
|
})
|
|
196
257
|
}
|
|
197
258
|
return { sources, links, targets }
|
|
@@ -215,7 +276,7 @@ export function prepareXcodeObjCImplementations(
|
|
|
215
276
|
[...sources].map(([file, bytes]) => [file, digest(bytes)]),
|
|
216
277
|
)
|
|
217
278
|
const identity = {
|
|
218
|
-
version:
|
|
279
|
+
version: 11,
|
|
219
280
|
importer: OBJC_IMPORT_VERSION,
|
|
220
281
|
peers,
|
|
221
282
|
metadataDeploymentTarget: peers ? app.iosDeploymentTarget : undefined,
|
|
@@ -357,6 +418,53 @@ export function prepareXcodeObjCImplementations(
|
|
|
357
418
|
fs.mkdirSync(path.dirname(output), { recursive: true })
|
|
358
419
|
fs.writeFileSync(output, bytes)
|
|
359
420
|
}
|
|
421
|
+
// xcode's product header overlay: each framework directory lists the
|
|
422
|
+
// original headers and module map it publishes, so a header reached by its
|
|
423
|
+
// framework path and by its own path is one file.
|
|
424
|
+
const productDirectories = new Map<string, { name: string; file: string }[]>()
|
|
425
|
+
for (const target of targets)
|
|
426
|
+
for (const [product, file] of Object.entries(target.productHeaders)) {
|
|
427
|
+
const directory = staged(path.dirname(product))
|
|
428
|
+
const listed = productDirectories.get(directory) ?? []
|
|
429
|
+
productDirectories.set(directory, listed)
|
|
430
|
+
listed.push({ name: path.basename(product), file: staged(file) })
|
|
431
|
+
}
|
|
432
|
+
const overlay = path.join(work, 'all-product-headers.yaml')
|
|
433
|
+
fs.writeFileSync(
|
|
434
|
+
overlay,
|
|
435
|
+
JSON.stringify({
|
|
436
|
+
'case-sensitive': 'false',
|
|
437
|
+
roots: [...productDirectories].map(([name, files]) => ({
|
|
438
|
+
contents: files.map((entry) => ({
|
|
439
|
+
'external-contents': entry.file,
|
|
440
|
+
name: entry.name,
|
|
441
|
+
type: 'file',
|
|
442
|
+
})),
|
|
443
|
+
name,
|
|
444
|
+
type: 'directory',
|
|
445
|
+
})),
|
|
446
|
+
version: 0,
|
|
447
|
+
}),
|
|
448
|
+
)
|
|
449
|
+
// xcode's header maps, naming the staged originals.
|
|
450
|
+
const headerMaps = targets.map((target, index) =>
|
|
451
|
+
target.headerMaps.map((map, order) => {
|
|
452
|
+
const output = path.join(work, `${index}-${order}.hmap`)
|
|
453
|
+
fs.writeFileSync(
|
|
454
|
+
output,
|
|
455
|
+
headerMap(
|
|
456
|
+
map.entries.flatMap(([key, file]): [string, string][] =>
|
|
457
|
+
!path.isAbsolute(file)
|
|
458
|
+
? [[key, file]]
|
|
459
|
+
: sources.has(file)
|
|
460
|
+
? [[key, staged(file)]]
|
|
461
|
+
: [],
|
|
462
|
+
),
|
|
463
|
+
),
|
|
464
|
+
)
|
|
465
|
+
return { flag: map.flag, file: output }
|
|
466
|
+
}),
|
|
467
|
+
)
|
|
360
468
|
const headers = materializeObjcSdk(path.join(cacheDir(), 'swift-standins'))
|
|
361
469
|
const modulemaps = targets.flatMap((target, index) => {
|
|
362
470
|
if (!target.publicHeaders) return []
|
|
@@ -395,6 +503,8 @@ export function prepareXcodeObjCImplementations(
|
|
|
395
503
|
const files = [
|
|
396
504
|
...[...sources.keys()].map(staged),
|
|
397
505
|
...modulemaps.map((flag) => flag.slice('-fmodule-map-file='.length)),
|
|
506
|
+
overlay,
|
|
507
|
+
...headerMaps.flat().map((map) => map.file),
|
|
398
508
|
receipt,
|
|
399
509
|
...metadataFiles,
|
|
400
510
|
...additionalFiles,
|
|
@@ -521,6 +631,9 @@ export function prepareXcodeObjCImplementations(
|
|
|
521
631
|
// installed libc and objc runtime headers own the target ABI.
|
|
522
632
|
'-idirafter',
|
|
523
633
|
path.join(headers, 'usr/include'),
|
|
634
|
+
'-ivfsoverlay',
|
|
635
|
+
overlay,
|
|
636
|
+
...headerMaps[index]!.flatMap((map) => [map.flag, map.file]),
|
|
524
637
|
...target.includes.flatMap((include) => ['-I', staged(include)]),
|
|
525
638
|
...target.frameworks.flatMap((framework) => ['-F', staged(framework)]),
|
|
526
639
|
...modulemaps,
|