peachsim 0.1.2432 → 0.1.2433
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 +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 +91 -75
- 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 +2 -2
- package/dist-lib/dev-bundle-resolution.cjs +1 -1
- package/dist-lib/expo-swift-bundle.cjs +54 -17
- 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 +91 -75
- package/dist-lib/host/fetch-proxy-handler.cjs +5 -4
- 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 +5 -4
- 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 +36 -57
- 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 +5 -4
- package/dist-lib/native-app-identity-project.cjs +2 -2
- package/dist-lib/native-app-identity-project.mjs +2 -2
- 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/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 +1 -1
- package/dist-lib/sdk.mjs +1 -1
- package/dist-lib/skills.cjs +91 -75
- package/dist-lib/swift-compile.cjs +16 -10
- package/dist-lib/swift-compile.mjs +16 -10
- 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 +52 -16
- package/dist-lib/vite.cjs +5 -4
- package/dist-lib/worklet-executable.cjs +1 -1
- package/dist-lib/worklet-executable.mjs +1 -1
- package/dist-types/packages/peach-engine/src/engine/image-loader-canvaskit.d.ts +3 -0
- package/dist-types/packages/peach-engine/src/engine/image-loader.d.ts +2 -0
- package/dist-types/packages/peach-engine/src/remote-stream/cloud-display.d.ts +3 -2
- package/dist-types/packages/peach-engine/src/render-worker/protocol.d.ts +7 -1
- package/dist-types/packages/peach-globals/src/cameraInputBridgeContract.d.ts +26 -0
- package/dist-types/packages/peach-globals/src/globalsContract.d.ts +2 -0
- package/dist-types/packages/peach-globals/src/index.d.ts +1 -0
- package/kotlin/README.md +3 -1
- package/kotlin/sdk.tar.gz +0 -0
- package/package.json +1 -1
- package/runtime-companion.json +1 -1
- package/src/java-module-abi.ts +11 -28
- package/src/kotlin-host.ts +13 -32
- package/src/kotlin-toolchain.ts +25 -0
- package/src/swift-guest-source-plan.ts +25 -9
- package/src/swift-host.ts +28 -5
- package/src/swift-xcframework.ts +24 -0
package/dist-lib/vite.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! peach v0.1.
|
|
1
|
+
/*! peach v0.1.2433 | (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 __create = Object.create;
|
|
@@ -4005,7 +4005,7 @@ var require_lib = __commonJS({
|
|
|
4005
4005
|
var runtime_companion_default;
|
|
4006
4006
|
var init_runtime_companion = __esm({
|
|
4007
4007
|
"runtime-companion.json"() {
|
|
4008
|
-
runtime_companion_default = { abi: 1, sha256: "
|
|
4008
|
+
runtime_companion_default = { abi: 1, sha256: "2d42441f509451bf1c660a06ac087056d0cc7d96ca43aead02f6fd91f5e4e367", file: "node/cli-2d42441f509451bf1c660a06ac087056d0cc7d96ca43aead02f6fd91f5e4e367.cjs" };
|
|
4009
4009
|
}
|
|
4010
4010
|
});
|
|
4011
4011
|
|
|
@@ -4392,7 +4392,7 @@ var STANDIN_SOURCE_DIGEST;
|
|
|
4392
4392
|
var init_swift_standin_digest = __esm({
|
|
4393
4393
|
"src/swift-standin-digest.ts"() {
|
|
4394
4394
|
"use strict";
|
|
4395
|
-
STANDIN_SOURCE_DIGEST = true ? "
|
|
4395
|
+
STANDIN_SOURCE_DIGEST = true ? "edbd6d6714a42d5d22c4d8b74e605e5c897358beb450af3e5605c81299e68531" : standinSourceDigest();
|
|
4396
4396
|
}
|
|
4397
4397
|
});
|
|
4398
4398
|
|
|
@@ -5822,7 +5822,7 @@ var init_swift_compile = __esm({
|
|
|
5822
5822
|
FOUNDATION_IMPLICIT_FLAGS = FOUNDATION_IMPLICIT_MODULES.map(
|
|
5823
5823
|
(module2) => `, "-Xfrontend", "-import-module", "-Xfrontend", "${module2}"`
|
|
5824
5824
|
).join("");
|
|
5825
|
-
compilerSourceDigest = true ? "
|
|
5825
|
+
compilerSourceDigest = true ? "cdc5ec2138bb4a158f783cf86ed87144cd455551e18374805c743783ac04aa46" : swiftCompilerSourceDigest2(__sootsim_import_meta_dirname);
|
|
5826
5826
|
C_WORDS = new Set(
|
|
5827
5827
|
"auto bool break case char const continue default do double else enum extern false float for goto if inline int long register restrict return short signed sizeof static struct switch true typedef union unsigned void volatile while YES NO NULL nil Nil id self super instancetype".split(
|
|
5828
5828
|
" "
|
|
@@ -6504,6 +6504,7 @@ var init_swift_host = __esm({
|
|
|
6504
6504
|
init_swift_standins();
|
|
6505
6505
|
init_swift_submit();
|
|
6506
6506
|
init_swift_toolchain();
|
|
6507
|
+
init_swift_xcframework();
|
|
6507
6508
|
init_swiftContract();
|
|
6508
6509
|
init_swiftContract();
|
|
6509
6510
|
init_xcode_project();
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! peach v0.1.
|
|
1
|
+
/*! peach v0.1.2433 | (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,5 +1,6 @@
|
|
|
1
1
|
import { type MetroAssetPathRecord } from '../metro-asset-path.d.ts';
|
|
2
2
|
import { type ImageFrameSource } from '../render-worker/image-pixel-contract.d.ts';
|
|
3
|
+
import { getImageLoaderCanvasKit } from './image-loader-canvaskit.d.ts';
|
|
3
4
|
import type { ImageLifecycleEvent } from '../render-worker/image-lifecycle-event.d.ts';
|
|
4
5
|
import type { DecodedImagePixels, ImagePixelDecodeSize } from '../render-worker/image-pixel-contract.d.ts';
|
|
5
6
|
import type { CanvasKitRenderingApi as CanvasKit } from './canvaskit-api.d.ts';
|
|
@@ -363,3 +364,4 @@ export declare function readImagePrefetchRequest(uri: string, exactCacheKey: str
|
|
|
363
364
|
export declare function prefetchImage(uri: string, requestId?: number, exactCacheKey?: string, headers?: Record<string, string>, paintNode?: SootSimNode, nativeUserAgent?: string | null): Promise<boolean>;
|
|
364
365
|
export declare function clearImageCache(uri: string): void;
|
|
365
366
|
export declare function touchPaintedImages(native: SceneNativeBinding, ctx: RenderContext, base?: number): void;
|
|
367
|
+
export { getImageLoaderCanvasKit };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export declare const DISPLAY_SERVER_VERSION = 26;
|
|
2
2
|
export declare const DISPLAY_SERVER_MAJOR = 2;
|
|
3
|
-
export declare const DISPLAY_SERVER_MINOR =
|
|
4
|
-
export declare const DISPLAY_SERVER_SUBPROTOCOL = "rnx.display-server.v2.wire26.
|
|
3
|
+
export declare const DISPLAY_SERVER_MINOR = 37;
|
|
4
|
+
export declare const DISPLAY_SERVER_SUBPROTOCOL = "rnx.display-server.v2.wire26.minor37";
|
|
5
5
|
export declare const DISPLAY_SERVER_TOKEN_SUBPROTOCOL_PREFIX = "rnx.sim-token.";
|
|
6
6
|
export declare const RNX_CLOUD_DISPLAY_GRANT_TTL_MS: number;
|
|
7
7
|
export declare const RNX_CLOUD_DISPLAY_CLOSE: {
|
|
@@ -37,6 +37,7 @@ export declare const DISPLAY_SERVER_LIMITS: {
|
|
|
37
37
|
readonly maxNativeAnimMirrorBytes: 262144;
|
|
38
38
|
readonly maxNativeAnimMirrorDepth: 64;
|
|
39
39
|
readonly maxDiagnosticsBytes: 1048576;
|
|
40
|
+
readonly maxCameraInputBytes: 1048576;
|
|
40
41
|
};
|
|
41
42
|
export type DisplayServerAppearance = 'light' | 'dark';
|
|
42
43
|
export interface RemotePeerIdentity {
|
|
@@ -32,7 +32,7 @@ import type { WorkerStorageSyncMessage } from './worker-storage.d.ts';
|
|
|
32
32
|
import type { WorkletPeerEpoch } from './worklet-runtime.d.ts';
|
|
33
33
|
import type { UiRpcMailboxes } from './worklet-sab.d.ts';
|
|
34
34
|
import type { WorkletMessage } from './worklet-wire.d.ts';
|
|
35
|
-
import type { SootSimLocationFix } from '../../../peach-globals/src/index.d.ts';
|
|
35
|
+
import type { SootSimCameraInputPayload, SootSimCameraInputState, SootSimLocationFix } from '../../../peach-globals/src/index.d.ts';
|
|
36
36
|
import type { SootsimBootMark } from '../../../peach-globals/src/index.d.ts';
|
|
37
37
|
import type { PeachPageServingAuthority, SootSimAccessibilityInput } from '../../../peach-globals/src/index.d.ts';
|
|
38
38
|
import type { SootSimAgentActionDetail, SootSimLaunchArguments } from '../../../peach-globals/src/index.d.ts';
|
|
@@ -199,6 +199,9 @@ export type HostToWorker = {
|
|
|
199
199
|
} | {
|
|
200
200
|
type: 'setSimulatedLocation';
|
|
201
201
|
location: SootSimLocationFix | null;
|
|
202
|
+
} | {
|
|
203
|
+
type: 'setCameraInput';
|
|
204
|
+
input: SootSimCameraInputPayload;
|
|
202
205
|
} | {
|
|
203
206
|
type: 'dispatchWindowEvent';
|
|
204
207
|
eventType: ForwardedWindowEventType;
|
|
@@ -744,6 +747,9 @@ export type WorkerToHost = {
|
|
|
744
747
|
} | {
|
|
745
748
|
type: 'remoteDeviceLocation';
|
|
746
749
|
location: SootSimLocationFix | null;
|
|
750
|
+
} | {
|
|
751
|
+
type: 'remoteDeviceCamera';
|
|
752
|
+
state: SootSimCameraInputState;
|
|
747
753
|
} | {
|
|
748
754
|
type: 'replayDevice';
|
|
749
755
|
posture: DevicePosture | null;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
export type SootSimCameraInputMode = 'off' | 'test-pattern' | 'photo' | 'video' | 'webcam';
|
|
2
|
+
export type SootSimCameraInputMimeType = 'image/jpeg' | 'image/png' | 'image/webp';
|
|
3
|
+
export interface SootSimCameraInputState {
|
|
4
|
+
mode: SootSimCameraInputMode;
|
|
5
|
+
label?: string;
|
|
6
|
+
}
|
|
7
|
+
export interface SootSimCameraInputFrame {
|
|
8
|
+
mode: 'photo' | 'video' | 'webcam';
|
|
9
|
+
label?: string;
|
|
10
|
+
mimeType: SootSimCameraInputMimeType;
|
|
11
|
+
bytes: Uint8Array;
|
|
12
|
+
width: number;
|
|
13
|
+
height: number;
|
|
14
|
+
}
|
|
15
|
+
export type SootSimCameraInputPayload = {
|
|
16
|
+
mode: 'off';
|
|
17
|
+
} | {
|
|
18
|
+
mode: 'test-pattern';
|
|
19
|
+
} | SootSimCameraInputFrame;
|
|
20
|
+
export interface SootSimCameraInputBridge {
|
|
21
|
+
get(): SootSimCameraInputState;
|
|
22
|
+
setTestPattern(): SootSimCameraInputState;
|
|
23
|
+
setFrame(frame: SootSimCameraInputFrame): SootSimCameraInputState;
|
|
24
|
+
clear(): SootSimCameraInputState;
|
|
25
|
+
subscribe(listener: (state: SootSimCameraInputState) => void): () => void;
|
|
26
|
+
}
|
|
@@ -3,6 +3,7 @@ import type { SootSimAndroidDateTimePickerBridge } from './androidDateTimePicker
|
|
|
3
3
|
import type { SootSimHotRemountBridge } from './appLifecycleBridgeContract.d.ts';
|
|
4
4
|
import type { SootSimAudioRecorderBridge, SootSimMediaSessionBridge } from './audioBridgeContract.d.ts';
|
|
5
5
|
import type { SootSimCameraBridge } from './cameraBridgeContract.d.ts';
|
|
6
|
+
import type { SootSimCameraInputBridge } from './cameraInputBridgeContract.d.ts';
|
|
6
7
|
import type { SootSimCaptureOptions } from './captureBridgeContract.d.ts';
|
|
7
8
|
import type { SootSimClipboardBridge } from './clipboardBridgeContract.d.ts';
|
|
8
9
|
import type { SootSimLiveCompositeBridge, SootSimVideoStreamBridge, SootSimAuxCompositorStats } from './compositorBridgeContract.d.ts';
|
|
@@ -118,6 +119,7 @@ export interface SootSimBridges {
|
|
|
118
119
|
portalManager: SootSimPortalManager | null;
|
|
119
120
|
settings: SootSimSettingsBridge | null;
|
|
120
121
|
location: SootSimLocationBridge | null;
|
|
122
|
+
cameraInput: SootSimCameraInputBridge | null;
|
|
121
123
|
windowScale: SootSimWindowScaleBridge | null;
|
|
122
124
|
electron: SootSimElectronBridge | null;
|
|
123
125
|
shellHost: SootSimShellHostBridge | null;
|
|
@@ -40,6 +40,7 @@ export type { LockstepFramePosition, PointerDeliveryTarget, PointerDeliveryPendi
|
|
|
40
40
|
export type { SootSimLaunchArguments, SootSimExternalAppLifecycleOptions, SootSimStorageResetStrategy, SootSimExternalAppResetOptions, SootSimExternalAppResetResult, SootSimExternalAppStorageClearOptions, SootSimWebStorageName, SootSimHotRemountBridge, } from './appLifecycleBridgeContract.d.ts';
|
|
41
41
|
export { PEACH_FINAL_LAUNCH_GLOBAL } from './appLifecycleBridgeContract.d.ts';
|
|
42
42
|
export type { SootSimSettingsBridge } from './settingsBridgeContract.d.ts';
|
|
43
|
+
export type { SootSimCameraInputMode, SootSimCameraInputMimeType, SootSimCameraInputState, SootSimCameraInputFrame, SootSimCameraInputPayload, SootSimCameraInputBridge, } from './cameraInputBridgeContract.d.ts';
|
|
43
44
|
export type { SootSimLocationFix, SootSimLocationResult, SootSimLocationBridge, } from './locationBridgeContract.d.ts';
|
|
44
45
|
export { SOOTSIM_CAPTURE_IMAGE_QUALITY, sootsimCaptureIsFlat, } from './captureBridgeContract.d.ts';
|
|
45
46
|
export type { SootSimCaptureFilter, SootSimCaptureOptions } from './captureBridgeContract.d.ts';
|
package/kotlin/README.md
CHANGED
|
@@ -42,7 +42,9 @@ traffic in `scripts/debug/peach-swift-lazy-network.sh`.
|
|
|
42
42
|
- `CompilerSources/`: the native member compiler plugin and JVM service
|
|
43
43
|
registration. Release producers compile it to `plugin.jar`; clients load that
|
|
44
44
|
jar without compiling or receiving plugin source. `ToolSources/` builds
|
|
45
|
-
`tools.jar` for the
|
|
45
|
+
`tools.jar` for the Expo type scan, ViewModel ABI scan, and Java bindings.
|
|
46
|
+
The host runs those tools directly on the configured JVM with the compiler
|
|
47
|
+
and standard library jars from the pinned archive.
|
|
46
48
|
`JniPlatformSources/` and `JniSources/` supply platform declarations and the
|
|
47
49
|
native invocation runtime. Incoming JNI lookup retains stable IDs, private
|
|
48
50
|
and virtual calls, constructors and backing fields. Native static companion
|
package/kotlin/sdk.tar.gz
CHANGED
|
Binary file
|
package/package.json
CHANGED
package/runtime-companion.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"abi":1,"sha256":"
|
|
1
|
+
{"abi":1,"sha256":"2d42441f509451bf1c660a06ac087056d0cc7d96ca43aead02f6fd91f5e4e367","file":"node/cli-2d42441f509451bf1c660a06ac087056d0cc7d96ca43aead02f6fd91f5e4e367.cjs"}
|
package/src/java-module-abi.ts
CHANGED
|
@@ -5,7 +5,7 @@ import path from 'node:path'
|
|
|
5
5
|
import { promisify } from 'node:util'
|
|
6
6
|
import { readBridgeMethod } from './android-bridge-packages'
|
|
7
7
|
import { isRecord } from './is-record'
|
|
8
|
-
import { kotlinHome } from './kotlin-toolchain'
|
|
8
|
+
import { kotlinHome, runKotlinTool } from './kotlin-toolchain'
|
|
9
9
|
import type { JavaModuleSpec, JavaModuleSpecs } from './javaAbiContract'
|
|
10
10
|
import type { KotlinToolchainInstallation } from './kotlinSdkContract'
|
|
11
11
|
|
|
@@ -31,19 +31,11 @@ export async function readJavaModuleSpecs(
|
|
|
31
31
|
fs.writeFileSync(target, bytes)
|
|
32
32
|
origins.set(target, file)
|
|
33
33
|
}
|
|
34
|
-
const
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
path.join(sdkRoot, 'tools.jar'),
|
|
40
|
-
path.resolve(path.dirname(toolchain.kotlinc), '../lib/kotlin-compiler.jar'),
|
|
41
|
-
path.resolve(path.dirname(toolchain.kotlinc), '../lib/kotlin-stdlib.jar'),
|
|
42
|
-
].join(path.delimiter),
|
|
43
|
-
'dev.peach.tools.javaabi.JavaModuleSpecsKt',
|
|
44
|
-
...origins.keys(),
|
|
45
|
-
],
|
|
46
|
-
{ maxBuffer: 16 * 1024 * 1024 },
|
|
34
|
+
const stdout = await runKotlinTool(
|
|
35
|
+
toolchain,
|
|
36
|
+
sdkRoot,
|
|
37
|
+
'dev.peach.tools.javaabi.JavaModuleSpecsKt',
|
|
38
|
+
[...origins.keys()],
|
|
47
39
|
).catch((cause: unknown) => {
|
|
48
40
|
if (!isRecord(cause) || typeof cause.stderr !== 'string') throw cause
|
|
49
41
|
let diagnostic = cause.stderr
|
|
@@ -134,20 +126,11 @@ export async function compileJavaModuleAbi(input: {
|
|
|
134
126
|
{ maxBuffer: 16 * 1024 * 1024 },
|
|
135
127
|
)
|
|
136
128
|
const library = path.join(directory, 'java-abi.klib')
|
|
137
|
-
await
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
path.join(sdkRoot, 'tools.jar'),
|
|
143
|
-
path.resolve(path.dirname(toolchain.kotlinc), '../lib/kotlin-compiler.jar'),
|
|
144
|
-
path.resolve(path.dirname(toolchain.kotlinc), '../lib/kotlin-stdlib.jar'),
|
|
145
|
-
].join(path.delimiter),
|
|
146
|
-
'dev.peach.tools.platform.JavaPlatformTypesKt',
|
|
147
|
-
path.join(directory, `${name}.klib`),
|
|
148
|
-
library,
|
|
149
|
-
],
|
|
150
|
-
{ maxBuffer: 16 * 1024 * 1024 },
|
|
129
|
+
await runKotlinTool(
|
|
130
|
+
toolchain,
|
|
131
|
+
sdkRoot,
|
|
132
|
+
'dev.peach.tools.platform.JavaPlatformTypesKt',
|
|
133
|
+
[path.join(directory, `${name}.klib`), library],
|
|
151
134
|
)
|
|
152
135
|
return library
|
|
153
136
|
}
|
package/src/kotlin-host.ts
CHANGED
|
@@ -30,6 +30,7 @@ import { kotlinInstanceSource } from './kotlin-instance-source'
|
|
|
30
30
|
import { installKotlinSdkArchive } from './kotlin-sdk'
|
|
31
31
|
import {
|
|
32
32
|
ensureToolchain,
|
|
33
|
+
runKotlinTool,
|
|
33
34
|
fetchVerified,
|
|
34
35
|
kotlinHome,
|
|
35
36
|
readToolchain,
|
|
@@ -404,26 +405,12 @@ async function scanSources<T>(
|
|
|
404
405
|
const key = digest.digest('hex')
|
|
405
406
|
let scan = toolScans.get(key)
|
|
406
407
|
if (!scan) {
|
|
407
|
-
scan = (
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
[
|
|
414
|
-
path.resolve(path.dirname(kotlinc), '../lib/kotlin-compiler.jar'),
|
|
415
|
-
path.join(sdk.root, 'tools.jar'),
|
|
416
|
-
].join(path.delimiter),
|
|
417
|
-
tool,
|
|
418
|
-
...files,
|
|
419
|
-
],
|
|
420
|
-
{ maxBuffer: 16 * 1024 * 1024 },
|
|
421
|
-
)
|
|
422
|
-
return stdout
|
|
423
|
-
})().catch((error: unknown) => {
|
|
424
|
-
toolScans.delete(key)
|
|
425
|
-
throw error
|
|
426
|
-
})
|
|
408
|
+
scan = ensureToolchain(toolchain)
|
|
409
|
+
.then((ready) => runKotlinTool(ready, sdk.root, tool, files))
|
|
410
|
+
.catch((error: unknown) => {
|
|
411
|
+
toolScans.delete(key)
|
|
412
|
+
throw error
|
|
413
|
+
})
|
|
427
414
|
toolScans.set(key, scan)
|
|
428
415
|
}
|
|
429
416
|
return parse(await scan)
|
|
@@ -1415,18 +1402,12 @@ async function compileKotlin(
|
|
|
1415
1402
|
)
|
|
1416
1403
|
) {
|
|
1417
1404
|
await compileKlib(path.join(work, 'abi'))
|
|
1418
|
-
const
|
|
1419
|
-
|
|
1420
|
-
|
|
1421
|
-
|
|
1422
|
-
|
|
1423
|
-
|
|
1424
|
-
path.join(sdk.root, 'tools.jar'),
|
|
1425
|
-
].join(path.delimiter),
|
|
1426
|
-
viewModels.toolClass,
|
|
1427
|
-
path.join(work, 'abi'),
|
|
1428
|
-
],
|
|
1429
|
-
{ maxBuffer: 64 * 1024 * 1024 },
|
|
1405
|
+
const stdout = await runKotlinTool(
|
|
1406
|
+
ready,
|
|
1407
|
+
sdk.root,
|
|
1408
|
+
viewModels.toolClass,
|
|
1409
|
+
[path.join(work, 'abi')],
|
|
1410
|
+
64 * 1024 * 1024,
|
|
1430
1411
|
)
|
|
1431
1412
|
fs.writeFileSync(
|
|
1432
1413
|
path.join(generatedDir, viewModels.file),
|
package/src/kotlin-toolchain.ts
CHANGED
|
@@ -14,6 +14,31 @@ import type {
|
|
|
14
14
|
|
|
15
15
|
const run = promisify(execFile)
|
|
16
16
|
|
|
17
|
+
export async function runKotlinTool(
|
|
18
|
+
toolchain: KotlinToolchainInstallation,
|
|
19
|
+
sdkRoot: string,
|
|
20
|
+
tool: string,
|
|
21
|
+
args: string[],
|
|
22
|
+
maxBuffer = 16 * 1024 * 1024,
|
|
23
|
+
): Promise<string> {
|
|
24
|
+
const lib = path.resolve(path.dirname(toolchain.kotlinc), '../lib')
|
|
25
|
+
const { stdout } = await run(
|
|
26
|
+
path.join(toolchain.javaHome, 'bin', 'java'),
|
|
27
|
+
[
|
|
28
|
+
'-cp',
|
|
29
|
+
[
|
|
30
|
+
path.join(sdkRoot, 'tools.jar'),
|
|
31
|
+
path.join(lib, 'kotlin-compiler.jar'),
|
|
32
|
+
path.join(lib, 'kotlin-stdlib.jar'),
|
|
33
|
+
].join(path.delimiter),
|
|
34
|
+
tool,
|
|
35
|
+
...args,
|
|
36
|
+
],
|
|
37
|
+
{ maxBuffer },
|
|
38
|
+
)
|
|
39
|
+
return stdout
|
|
40
|
+
}
|
|
41
|
+
|
|
17
42
|
export function readToolchain(moduleRoot: string): KotlinToolchain {
|
|
18
43
|
const parsed: unknown = JSON.parse(
|
|
19
44
|
fs.readFileSync(path.join(moduleRoot, 'toolchain.json'), 'utf8'),
|
|
@@ -34,6 +34,26 @@ function swiftPackageLinkage(
|
|
|
34
34
|
return linkage
|
|
35
35
|
}
|
|
36
36
|
|
|
37
|
+
// a static SwiftPM product holds no code of its own: each client links the
|
|
38
|
+
// product's targets, so the product groups link edges and joins no image.
|
|
39
|
+
function linkEdges(
|
|
40
|
+
targets: ReadonlyMap<string, SwiftSourceLinkGraph['targets'][number]>,
|
|
41
|
+
id: string,
|
|
42
|
+
): SwiftSourceLinkGraph['targets'][number]['dependencies'] {
|
|
43
|
+
const target = targets.get(id)
|
|
44
|
+
if (!target) throw new Error(`unknown source target ${id}`)
|
|
45
|
+
return target.dependencies.flatMap((edge) => {
|
|
46
|
+
if (edge.attributes.length)
|
|
47
|
+
throw new Error(`unsupported link attributes for ${id} -> ${edge.target}`)
|
|
48
|
+
const dependency = targets.get(edge.target)
|
|
49
|
+
if (!dependency) throw new Error(`unknown source target ${edge.target}`)
|
|
50
|
+
return dependency.productType.startsWith('swiftpm.library.') &&
|
|
51
|
+
swiftPackageLinkage(dependency) === 'static'
|
|
52
|
+
? linkEdges(targets, edge.target)
|
|
53
|
+
: [edge]
|
|
54
|
+
})
|
|
55
|
+
}
|
|
56
|
+
|
|
37
57
|
/** Build image membership from resolved source products and their direct links. */
|
|
38
58
|
export function guestSourceImages(graph: SwiftSourceLinkGraph): GuestSourceImage[] {
|
|
39
59
|
const targets = new Map(graph.targets.map((target) => [target.id, target]))
|
|
@@ -63,11 +83,8 @@ export function guestSourceImages(graph: SwiftSourceLinkGraph): GuestSourceImage
|
|
|
63
83
|
ownership.set(id, image.id)
|
|
64
84
|
image.members.push(id)
|
|
65
85
|
active.add(id)
|
|
66
|
-
for (const edge of
|
|
67
|
-
|
|
68
|
-
throw new Error(`unsupported link attributes for ${id} -> ${edge.target}`)
|
|
69
|
-
const dependency = targets.get(edge.target)
|
|
70
|
-
if (!dependency) throw new Error(`unknown source target ${edge.target}`)
|
|
86
|
+
for (const edge of linkEdges(targets, id)) {
|
|
87
|
+
const dependency = targets.get(edge.target)!
|
|
71
88
|
const type = dependency.productType
|
|
72
89
|
let dynamic: boolean
|
|
73
90
|
if (type.startsWith('swiftpm.target.')) {
|
|
@@ -77,7 +94,8 @@ export function guestSourceImages(graph: SwiftSourceLinkGraph): GuestSourceImage
|
|
|
77
94
|
type !== 'swiftpm.target.system'
|
|
78
95
|
)
|
|
79
96
|
throw new Error(`unsupported SwiftPM target ${edge.target}`)
|
|
80
|
-
dynamic
|
|
97
|
+
// a binary target's dynamic framework is its own image
|
|
98
|
+
dynamic = type === 'swiftpm.target.binary' && dependency.machOType === 'mh_dylib'
|
|
81
99
|
} else if (type.startsWith('swiftpm.library.')) {
|
|
82
100
|
dynamic = swiftPackageLinkage(dependency) === 'dynamic'
|
|
83
101
|
} else if (type === 'com.apple.product-type.library.static') {
|
|
@@ -251,9 +269,7 @@ export function planGuestSourceLink(
|
|
|
251
269
|
)
|
|
252
270
|
)
|
|
253
271
|
throw new Error(`unsupported special link flag for ${id}`)
|
|
254
|
-
for (const edge of
|
|
255
|
-
if (edge.attributes.length)
|
|
256
|
-
throw new Error(`unsupported link attributes for ${id} -> ${edge.target}`)
|
|
272
|
+
for (const edge of linkEdges(targets, id)) {
|
|
257
273
|
const dependencyImage = ownerByTarget.get(edge.target)
|
|
258
274
|
if (dependencyImage === undefined)
|
|
259
275
|
throw new Error(`linked target ${edge.target} has no guest image`)
|
package/src/swift-host.ts
CHANGED
|
@@ -100,6 +100,7 @@ import {
|
|
|
100
100
|
standinGenerationInputs,
|
|
101
101
|
standinLibrary,
|
|
102
102
|
standinDependencies,
|
|
103
|
+
swiftBinaryFramework,
|
|
103
104
|
swiftStandins,
|
|
104
105
|
type SwiftStandin,
|
|
105
106
|
type SwiftStandins,
|
|
@@ -125,6 +126,7 @@ import {
|
|
|
125
126
|
type SwiftNativeModules,
|
|
126
127
|
} from './swift-submit'
|
|
127
128
|
import { privateSwiftDistributionRoot, swiftCacheDir } from './swift-toolchain'
|
|
129
|
+
import { isDynamicLibrary, simulatorNativeLibrary } from './swift-xcframework'
|
|
128
130
|
import { swiftProjectFileProblem } from './swiftContract'
|
|
129
131
|
import {
|
|
130
132
|
type SwiftSourceLinkGraph,
|
|
@@ -349,6 +351,8 @@ interface XcodeProjectEntry {
|
|
|
349
351
|
binaries: SwiftPackageBinary[]
|
|
350
352
|
packages: SwiftPackages
|
|
351
353
|
standins: SwiftStandin[]
|
|
354
|
+
/** the framework name of each stood-in binary target that ships a dynamic library. */
|
|
355
|
+
dynamicFrameworks: Map<string, string>
|
|
352
356
|
/** why a framework the project vendors got no stand-in, by name. */
|
|
353
357
|
projectGaps: Map<string, string>
|
|
354
358
|
}
|
|
@@ -610,6 +614,7 @@ async function swiftPackages(
|
|
|
610
614
|
): Promise<{
|
|
611
615
|
packages: SwiftPackages
|
|
612
616
|
standins: SwiftStandin[]
|
|
617
|
+
dynamicFrameworks: Map<string, string>
|
|
613
618
|
projectGaps: Map<string, string>
|
|
614
619
|
binaries: SwiftPackageBinary[]
|
|
615
620
|
}> {
|
|
@@ -648,6 +653,7 @@ async function swiftPackages(
|
|
|
648
653
|
packages,
|
|
649
654
|
binaries: packages.binaries,
|
|
650
655
|
standins: [],
|
|
656
|
+
dynamicFrameworks: new Map(),
|
|
651
657
|
projectGaps: new Map(),
|
|
652
658
|
}
|
|
653
659
|
entry.packages = cached
|
|
@@ -750,6 +756,18 @@ async function swiftPackages(
|
|
|
750
756
|
for (const target of new Set(built.standins.map((standin) => standin.target)))
|
|
751
757
|
console.error(`Peach: target ${target} was replaced with a stand-in`)
|
|
752
758
|
cached.standins = built.standins
|
|
759
|
+
// a binary target shipping a dynamic framework is its own image: the app
|
|
760
|
+
// embeds the framework once for every client that links it.
|
|
761
|
+
const stoodIn = new Set(built.standins.map((standin) => standin.target))
|
|
762
|
+
cached.dynamicFrameworks = new Map(
|
|
763
|
+
cxxArtifacts.flatMap((binary) => {
|
|
764
|
+
if (!stoodIn.has(binary.target)) return []
|
|
765
|
+
const native = simulatorNativeLibrary(swiftBinaryFramework(binary).dir)
|
|
766
|
+
return native?.kind === 'framework' && isDynamicLibrary(native.file)
|
|
767
|
+
? [[binary.target, native.name] as const]
|
|
768
|
+
: []
|
|
769
|
+
}),
|
|
770
|
+
)
|
|
753
771
|
cached.projectGaps = new Map(
|
|
754
772
|
vendored.flatMap(({ target }) => {
|
|
755
773
|
const gap = built.gaps.get(target)
|
|
@@ -881,10 +899,8 @@ async function buildXcodeLayout(root: string): Promise<XcodeLayout | null> {
|
|
|
881
899
|
nativeModules: registered.nativeModules,
|
|
882
900
|
},
|
|
883
901
|
)
|
|
884
|
-
const { packages, standins, projectGaps, binaries } =
|
|
885
|
-
registered,
|
|
886
|
-
appTarget,
|
|
887
|
-
)
|
|
902
|
+
const { packages, standins, dynamicFrameworks, projectGaps, binaries } =
|
|
903
|
+
await swiftPackages(registered, appTarget)
|
|
888
904
|
const sourceFrameworks = new Map(
|
|
889
905
|
packages.sourceFrameworks.map(
|
|
890
906
|
({
|
|
@@ -1659,8 +1675,14 @@ async function buildXcodeLayout(root: string): Promise<XcodeLayout | null> {
|
|
|
1659
1675
|
)?.products ?? [])
|
|
1660
1676
|
: []
|
|
1661
1677
|
const packageTarget = target.productType.startsWith('swiftpm.')
|
|
1678
|
+
const binaryFramework =
|
|
1679
|
+
target.productType === 'swiftpm.target.binary'
|
|
1680
|
+
? (dynamicFrameworks.get(target.productName) ?? null)
|
|
1681
|
+
: null
|
|
1662
1682
|
const packageFramework =
|
|
1663
|
-
target.productType === 'swiftpm.library.dynamic'
|
|
1683
|
+
target.productType === 'swiftpm.library.dynamic'
|
|
1684
|
+
? target.productName
|
|
1685
|
+
: binaryFramework
|
|
1664
1686
|
const buildVersion = {
|
|
1665
1687
|
platform: packageTarget
|
|
1666
1688
|
? applicationBuildVersion.platform
|
|
@@ -1686,6 +1708,7 @@ async function buildXcodeLayout(root: string): Promise<XcodeLayout | null> {
|
|
|
1686
1708
|
packageFramework === null
|
|
1687
1709
|
? target.installName
|
|
1688
1710
|
: `@rpath/${packageFramework}.framework/${packageFramework}`,
|
|
1711
|
+
machOType: binaryFramework === null ? target.machOType : 'mh_dylib',
|
|
1689
1712
|
sourceTarget:
|
|
1690
1713
|
target.sourceTarget === null
|
|
1691
1714
|
? (first ?? null)
|
package/src/swift-xcframework.ts
CHANGED
|
@@ -50,3 +50,27 @@ export function simulatorNativeLibrary(
|
|
|
50
50
|
if (matches.length !== 1) throw new Error(`${dir}: ambiguous simulator library`)
|
|
51
51
|
return matches[0]!
|
|
52
52
|
}
|
|
53
|
+
|
|
54
|
+
// a Mach-O dynamic library (MH_DYLIB), thin or read from a universal file's first slice
|
|
55
|
+
export function isDynamicLibrary(file: string): boolean {
|
|
56
|
+
const fd = fs.openSync(file, 'r')
|
|
57
|
+
try {
|
|
58
|
+
const read = (offset: number) => {
|
|
59
|
+
const bytes = Buffer.alloc(16)
|
|
60
|
+
fs.readSync(fd, bytes, 0, 16, offset)
|
|
61
|
+
return bytes
|
|
62
|
+
}
|
|
63
|
+
let header = read(0)
|
|
64
|
+
const universal = header.readUInt32BE(0)
|
|
65
|
+
if (universal === 0xcafebabe || universal === 0xcafebabf) {
|
|
66
|
+
const arch = read(8)
|
|
67
|
+
header = read(
|
|
68
|
+
universal === 0xcafebabe ? arch.readUInt32BE(8) : Number(arch.readBigUInt64BE(8)),
|
|
69
|
+
)
|
|
70
|
+
}
|
|
71
|
+
const magic = header.readUInt32LE(0)
|
|
72
|
+
return (magic === 0xfeedfacf || magic === 0xfeedface) && header.readUInt32LE(12) === 6
|
|
73
|
+
} finally {
|
|
74
|
+
fs.closeSync(fd)
|
|
75
|
+
}
|
|
76
|
+
}
|