peachsim 0.1.2675 → 0.1.2677
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 +21 -5
- 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-VEOPTKVF.mjs → acorn-3YLAIYQD.mjs} +3 -3
- package/dist-lib/esm-chunks/{chunk-35JRIGP7.mjs → chunk-3FHAJIKR.mjs} +1 -1
- package/dist-lib/esm-chunks/{chunk-NNH7MSKJ.mjs → chunk-6LA56AFW.mjs} +1 -1
- package/dist-lib/esm-chunks/{chunk-K234VYDM.mjs → chunk-6YNGV3O7.mjs} +1 -1
- package/dist-lib/esm-chunks/{chunk-FOTVQGKC.mjs → chunk-ANYDUHPO.mjs} +1 -1
- package/dist-lib/esm-chunks/{chunk-3Q3LIOE4.mjs → chunk-B5YHORYS.mjs} +2 -2
- package/dist-lib/esm-chunks/{chunk-MED7BRBB.mjs → chunk-B6UPKBIR.mjs} +4 -4
- package/dist-lib/esm-chunks/{chunk-I5Z73FXT.mjs → chunk-BLJFOEG5.mjs} +1 -1
- package/dist-lib/esm-chunks/{chunk-DBPA4NE7.mjs → chunk-D67RODTX.mjs} +5 -5
- package/dist-lib/esm-chunks/{chunk-LCSKGJ7G.mjs → chunk-ECQZIWLS.mjs} +1 -1
- package/dist-lib/esm-chunks/{chunk-ZATDP3O2.mjs → chunk-EQ7YPCXU.mjs} +1 -1
- package/dist-lib/esm-chunks/{chunk-ADOQU6SI.mjs → chunk-IGUW7YCZ.mjs} +1 -1
- package/dist-lib/esm-chunks/{chunk-AJTT2VYL.mjs → chunk-N4UE7PB4.mjs} +1 -1
- package/dist-lib/esm-chunks/{chunk-YPE76EEE.mjs → chunk-NZ74ECY5.mjs} +14 -14
- package/dist-lib/esm-chunks/{chunk-E663VVCN.mjs → chunk-OCDAKEOJ.mjs} +6 -6
- package/dist-lib/esm-chunks/{chunk-5F7IW22G.mjs → chunk-PTFAOZGW.mjs} +1 -1
- package/dist-lib/esm-chunks/{chunk-SKQE5DWK.mjs → chunk-QHWLRG4A.mjs} +1 -1
- package/dist-lib/esm-chunks/{chunk-FSMKZOTX.mjs → chunk-S4NQ2K3V.mjs} +3 -3
- package/dist-lib/esm-chunks/{chunk-IZB357DH.mjs → chunk-TZC32QYF.mjs} +1 -1
- package/dist-lib/esm-chunks/{chunk-5INXUSJ3.mjs → chunk-UFHB3TM6.mjs} +1 -1
- package/dist-lib/esm-chunks/{chunk-BJGGCQKA.mjs → chunk-ULO727BG.mjs} +1 -1
- package/dist-lib/esm-chunks/{chunk-LFD67UJA.mjs → chunk-VC2LMC2M.mjs} +1 -1
- package/dist-lib/esm-chunks/{chunk-MJBRJSOV.mjs → chunk-VDIC3JG7.mjs} +1 -1
- package/dist-lib/esm-chunks/{chunk-ATBIBLXB.mjs → chunk-Y534RVBQ.mjs} +1 -1
- package/dist-lib/esm-chunks/{chunk-GM75SEKY.mjs → chunk-YPAOW7QP.mjs} +6 -6
- package/dist-lib/esm-chunks/{metro-layout-parser-RYUGORYR.mjs → metro-layout-parser-Q4CLCETG.mjs} +3 -3
- package/dist-lib/esm-chunks/{swift-package-prebuilt-M55UCSKN.mjs → swift-package-prebuilt-T7CCH7XW.mjs} +12 -12
- package/dist-lib/esm-chunks/{swift-sdk-app-module-L2HB3XBS.mjs → swift-sdk-app-module-XSXRMZNG.mjs} +16 -16
- package/dist-lib/esm-chunks/{swift-sdk-image-AHIIWTZ6.mjs → swift-sdk-image-AVIGCM53.mjs} +16 -16
- package/dist-lib/esm-chunks/{swift-sdk-image-producer-4S5ZPC2A.mjs → swift-sdk-image-producer-GVGNTICK.mjs} +5 -5
- package/dist-lib/expo-swift-bundle.cjs +21 -5
- 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 +3144 -818
- package/dist-lib/host/fetch-proxy-handler.cjs +3 -3
- package/dist-lib/host/fetch-proxy-overrides.cjs +1 -1
- package/dist-lib/host/fetch-proxy-overrides.mjs +2 -2
- package/dist-lib/host/replacement-module-handler.cjs +1 -1
- package/dist-lib/host/websocket-proxy.cjs +1 -1
- package/dist-lib/index.cjs +1 -1
- package/dist-lib/kotlin-host.cjs +1 -1
- package/dist-lib/menu.cjs +1 -1
- package/dist-lib/menu.mjs +3 -3
- package/dist-lib/metro-fingerprint-registry.cjs +1 -1
- package/dist-lib/metro-fingerprint-registry.mjs +3 -3
- package/dist-lib/metro-production-bundle.cjs +1 -1
- package/dist-lib/metro-production-bundle.mjs +4 -4
- package/dist-lib/native-app-identity-project.cjs +20 -4
- package/dist-lib/native-app-identity-project.mjs +34 -18
- 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 +68 -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 +3525 -1199
- package/dist-lib/swift-compile.cjs +1 -1
- 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/one-direct-host-source.ts +1966 -0
- package/src/one-native-controls-package.ts +157 -21
- package/src/xcode-project.ts +30 -2
|
@@ -6,6 +6,12 @@ import { createRequire } from 'node:module'
|
|
|
6
6
|
import path from 'node:path'
|
|
7
7
|
import { fileURLToPath } from 'node:url'
|
|
8
8
|
import { swiftGuestControls } from '../../peach-globals/build/one-swift-control-source'
|
|
9
|
+
import { swiftUIControls } from '../../peach-globals/build/one-swift-ui-controls'
|
|
10
|
+
import {
|
|
11
|
+
ONE_DIRECT_STAGE_SWIFT,
|
|
12
|
+
PEACH_ONE_DIRECT_HOST_MM,
|
|
13
|
+
PEACH_ONE_HOST_SHIMS,
|
|
14
|
+
} from './one-direct-host-source'
|
|
9
15
|
import {
|
|
10
16
|
shardOneSDKBindingSource,
|
|
11
17
|
translateShardedOneSDKDiagnostic,
|
|
@@ -1077,26 +1083,43 @@ private let tabStartupProfileSpec: Spec = [
|
|
|
1077
1083
|
],
|
|
1078
1084
|
]
|
|
1079
1085
|
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
@ViewBuilder func view(props: JSON) -> some View {
|
|
1083
|
-
#if PEACH_ONE_SDK
|
|
1084
|
-
if props["oneSDKHost"] != nil {
|
|
1085
|
-
OneSDKUIKitHost(props: props)
|
|
1086
|
-
} else {
|
|
1087
|
-
startupProfile
|
|
1088
|
-
}
|
|
1089
|
-
#else
|
|
1090
|
-
startupProfile
|
|
1091
|
-
#endif
|
|
1092
|
-
}
|
|
1093
|
-
|
|
1094
|
-
private var startupProfile: some View {
|
|
1086
|
+
public func oneStartupProfileView() -> AnyView {
|
|
1087
|
+
AnyView(
|
|
1095
1088
|
VStack(spacing: 0) {
|
|
1096
1089
|
NavigationStackBridge(spec: startupProfileSpec, emit: { _, _ in })
|
|
1097
1090
|
TabViewBridge(spec: tabStartupProfileSpec, emit: { _, _ in })
|
|
1098
1091
|
}
|
|
1099
1092
|
.frame(maxWidth: .infinity, maxHeight: .infinity)
|
|
1093
|
+
)
|
|
1094
|
+
}
|
|
1095
|
+
`
|
|
1096
|
+
|
|
1097
|
+
const GUEST_MAIN_SWIFT = `import SwiftUI
|
|
1098
|
+
import PeachJSON
|
|
1099
|
+
import OneNativeControlsCore
|
|
1100
|
+
import OneNativeControlsHost
|
|
1101
|
+
|
|
1102
|
+
@main
|
|
1103
|
+
struct OneNativeControlsGuest: PeachPackage {
|
|
1104
|
+
init() {
|
|
1105
|
+
PeachOneDirectHostInit()
|
|
1106
|
+
_ = peach_register_views
|
|
1107
|
+
}
|
|
1108
|
+
|
|
1109
|
+
@ViewBuilder func view(props: JSON) -> some View {
|
|
1110
|
+
if props["oneDirectStage"] != nil {
|
|
1111
|
+
OneDirectStageView()
|
|
1112
|
+
} else {
|
|
1113
|
+
#if PEACH_ONE_SDK
|
|
1114
|
+
if props["oneSDKHost"] != nil {
|
|
1115
|
+
OneSDKUIKitHost(props: props)
|
|
1116
|
+
} else {
|
|
1117
|
+
oneStartupProfileView()
|
|
1118
|
+
}
|
|
1119
|
+
#else
|
|
1120
|
+
oneStartupProfileView()
|
|
1121
|
+
#endif
|
|
1122
|
+
}
|
|
1100
1123
|
}
|
|
1101
1124
|
}
|
|
1102
1125
|
`
|
|
@@ -1205,12 +1228,62 @@ function excludedGroupSource(source: string, defines: ReadonlySet<string>): bool
|
|
|
1205
1228
|
return false
|
|
1206
1229
|
}
|
|
1207
1230
|
|
|
1231
|
+
function resolveCoreAbiIosDir(): string {
|
|
1232
|
+
const dir = path.resolve(
|
|
1233
|
+
path.dirname(fileURLToPath(import.meta.url)),
|
|
1234
|
+
'../../peach-engine/core-abi/ios',
|
|
1235
|
+
)
|
|
1236
|
+
if (!fs.existsSync(path.join(dir, 'PeachSwiftUI.mm'))) {
|
|
1237
|
+
throw new Error(`Peach core-abi iOS sources not found at ${dir}`)
|
|
1238
|
+
}
|
|
1239
|
+
return dir
|
|
1240
|
+
}
|
|
1241
|
+
|
|
1242
|
+
const DIRECT_HOST_SWIFT_SEEDS = [
|
|
1243
|
+
'OneNativeControlsGuest',
|
|
1244
|
+
'oneStartupProfileView',
|
|
1245
|
+
'peach_register_views',
|
|
1246
|
+
'PeachLeafMeasure',
|
|
1247
|
+
'PeachOneDirectStage',
|
|
1248
|
+
'OneDirectStageView',
|
|
1249
|
+
'OneNativeAsyncActionModule',
|
|
1250
|
+
'OneNativeArrangementView',
|
|
1251
|
+
'OneNativeArrangementItem',
|
|
1252
|
+
'OneNativeArrangementModifiers',
|
|
1253
|
+
'OneNativeNavigationStackView',
|
|
1254
|
+
'OneNativeNavigationSplitViewView',
|
|
1255
|
+
'OneNativeNavigationSplitViewColumnView',
|
|
1256
|
+
'OneNativeTabViewView',
|
|
1257
|
+
'OneNativeTabItem',
|
|
1258
|
+
'OneNativeToolbarView',
|
|
1259
|
+
'OneNativeToolbarMarkerView',
|
|
1260
|
+
'OneNativeUIKitHostView',
|
|
1261
|
+
'OneNativeContainerSlotView',
|
|
1262
|
+
'OneNativeSheetView',
|
|
1263
|
+
'OneNativeMenuView',
|
|
1264
|
+
'OneNativeSwiftPagerView',
|
|
1265
|
+
'OneNativeDeferredRow',
|
|
1266
|
+
] as const
|
|
1267
|
+
|
|
1268
|
+
const DIRECT_HOST_IOS_FILES = [
|
|
1269
|
+
'PeachContainer.h',
|
|
1270
|
+
'PeachSwiftUI.h',
|
|
1271
|
+
'PeachSwiftUI.mm',
|
|
1272
|
+
'PeachSheet.h',
|
|
1273
|
+
'PeachSheet.mm',
|
|
1274
|
+
'PeachMenu.h',
|
|
1275
|
+
'PeachMenu.mm',
|
|
1276
|
+
'PeachPopover.h',
|
|
1277
|
+
'PeachPopover.mm',
|
|
1278
|
+
] as const
|
|
1279
|
+
|
|
1208
1280
|
export async function oneNativeControlsPackage(
|
|
1209
1281
|
appRoot?: string,
|
|
1210
1282
|
linkedGroups?: readonly string[],
|
|
1211
1283
|
sdk?: OneNativeControlsSDKInput | null,
|
|
1212
1284
|
): Promise<OneNativeControlsPackage> {
|
|
1213
1285
|
const iosDir = resolveOneNativeAppleIosDir(appRoot)
|
|
1286
|
+
const coreAbiIosDir = resolveCoreAbiIosDir()
|
|
1214
1287
|
const generated = swiftGuestControls(
|
|
1215
1288
|
path.dirname(iosDir),
|
|
1216
1289
|
[
|
|
@@ -1246,9 +1319,21 @@ export async function oneNativeControlsPackage(
|
|
|
1246
1319
|
],
|
|
1247
1320
|
linkedGroups,
|
|
1248
1321
|
)
|
|
1322
|
+
// match the optional control groups Peach's Swift SDK actually supports (from generated.defines)
|
|
1323
|
+
const hostLinkedGroups = generated.defines
|
|
1324
|
+
.filter((flag) => flag.startsWith('ONE_GROUP_'))
|
|
1325
|
+
.map((flag) => flag.slice('ONE_GROUP_'.length).toLowerCase())
|
|
1326
|
+
const hostControls = swiftUIControls(path.dirname(iosDir), {
|
|
1327
|
+
basenameImports: true,
|
|
1328
|
+
linkedGroups: hostLinkedGroups,
|
|
1329
|
+
})
|
|
1249
1330
|
const sources: Record<string, string> = {}
|
|
1250
1331
|
const paths = new Map<string, string>()
|
|
1251
|
-
const defines = new Set([
|
|
1332
|
+
const defines = new Set([
|
|
1333
|
+
...ONE_SDK_DEFINES,
|
|
1334
|
+
...generated.defines,
|
|
1335
|
+
...hostControls.defines,
|
|
1336
|
+
])
|
|
1252
1337
|
const bindings = sdk && sdk.files.size && sdk.modules.length ? sdk : undefined
|
|
1253
1338
|
const sdkSources = new Set(ONE_SDK_RUNTIME_SOURCES.map((file) => path.basename(file)))
|
|
1254
1339
|
for (const folder of ['', 'Generated', 'SDK']) {
|
|
@@ -1265,28 +1350,68 @@ export async function oneNativeControlsPackage(
|
|
|
1265
1350
|
sources[name] = source
|
|
1266
1351
|
}
|
|
1267
1352
|
}
|
|
1353
|
+
const leafMeasurePath = path.join(coreAbiIosDir, 'PeachLeafMeasure.swift')
|
|
1354
|
+
sources['PeachLeafMeasure.swift'] = fs.readFileSync(leafMeasurePath, 'utf8')
|
|
1355
|
+
sources['OneDirectStage.swift'] = ONE_DIRECT_STAGE_SWIFT
|
|
1268
1356
|
sources['OneNativeGuestControls.swift'] = generated.source
|
|
1269
1357
|
sources['OneNativeControlsBridge.swift'] = BRIDGE_SWIFT
|
|
1270
1358
|
const controls = new Map(
|
|
1271
1359
|
Object.entries(
|
|
1272
1360
|
collectSwiftSourceClosure(
|
|
1273
1361
|
sources,
|
|
1274
|
-
[
|
|
1362
|
+
[...DIRECT_HOST_SWIFT_SEEDS, ...hostControls.viewClasses],
|
|
1275
1363
|
swiftCodeMask,
|
|
1276
1364
|
new Set(['View']),
|
|
1277
1365
|
),
|
|
1278
1366
|
),
|
|
1279
1367
|
)
|
|
1280
1368
|
const watched = new Set(generated.watched)
|
|
1369
|
+
watched.add(leafMeasurePath)
|
|
1281
1370
|
const files = new Map<string, string>()
|
|
1282
|
-
const prefix = bindings ? 'Sources/Controls/' : ''
|
|
1283
1371
|
for (const [name, source] of controls) {
|
|
1284
|
-
files.set(
|
|
1372
|
+
files.set('Sources/ControlsCore/' + name, source)
|
|
1285
1373
|
const full = paths.get(name)
|
|
1286
1374
|
if (full) watched.add(full)
|
|
1287
1375
|
}
|
|
1288
1376
|
|
|
1377
|
+
const rewriteSwiftHeaderInclude = (source: string) =>
|
|
1378
|
+
source.replace(/#(include|import)\s+"One-Swift\.h"/g, '#$1 "PeachOneControlsSwift.h"')
|
|
1289
1379
|
const oneSDKShards = new Map<string, ShardedBindingFile>()
|
|
1380
|
+
for (const [rel, content] of Object.entries(PEACH_ONE_HOST_SHIMS)) {
|
|
1381
|
+
const staged =
|
|
1382
|
+
rel === 'ios/PeachOneControlsSwift.h' && bindings
|
|
1383
|
+
? content.replace('#pragma once\n', '#pragma once\n#include "One-Swift.h"\n')
|
|
1384
|
+
: content
|
|
1385
|
+
files.set('Sources/ControlsHost/' + rel, staged)
|
|
1386
|
+
}
|
|
1387
|
+
for (const name of DIRECT_HOST_IOS_FILES) {
|
|
1388
|
+
const full = path.join(coreAbiIosDir, name)
|
|
1389
|
+
files.set(
|
|
1390
|
+
'Sources/ControlsHost/ios/' + name,
|
|
1391
|
+
rewriteSwiftHeaderInclude(fs.readFileSync(full, 'utf8')),
|
|
1392
|
+
)
|
|
1393
|
+
watched.add(full)
|
|
1394
|
+
}
|
|
1395
|
+
files.set(
|
|
1396
|
+
'Sources/ControlsHost/ios/PeachSwiftUIControls.h',
|
|
1397
|
+
rewriteSwiftHeaderInclude(hostControls.header),
|
|
1398
|
+
)
|
|
1399
|
+
for (const headerPath of hostControls.headers) {
|
|
1400
|
+
files.set(
|
|
1401
|
+
'Sources/ControlsHost/ios/' + path.basename(headerPath),
|
|
1402
|
+
rewriteSwiftHeaderInclude(fs.readFileSync(headerPath, 'utf8')),
|
|
1403
|
+
)
|
|
1404
|
+
watched.add(headerPath)
|
|
1405
|
+
}
|
|
1406
|
+
for (const sourcePath of hostControls.nativeSources) {
|
|
1407
|
+
files.set(
|
|
1408
|
+
'Sources/ControlsHost/ios/' + path.basename(sourcePath),
|
|
1409
|
+
rewriteSwiftHeaderInclude(fs.readFileSync(sourcePath, 'utf8')),
|
|
1410
|
+
)
|
|
1411
|
+
watched.add(sourcePath)
|
|
1412
|
+
}
|
|
1413
|
+
files.set('Sources/ControlsHost/ios/PeachOneDirectHost.mm', PEACH_ONE_DIRECT_HOST_MM)
|
|
1414
|
+
files.set('Sources/Controls/OneNativeControlsGuest.swift', GUEST_MAIN_SWIFT)
|
|
1290
1415
|
if (bindings) {
|
|
1291
1416
|
files.set('Sources/One/One.swift', oneSDKModule)
|
|
1292
1417
|
for (const relative of ONE_SDK_RUNTIME_SOURCES) {
|
|
@@ -1313,6 +1438,10 @@ export async function oneNativeControlsPackage(
|
|
|
1313
1438
|
|
|
1314
1439
|
const swiftDefines = (flags: Iterable<string>) =>
|
|
1315
1440
|
Array.from(flags, (flag) => '.define(' + JSON.stringify(flag) + ')')
|
|
1441
|
+
const groupDefines = [...defines].filter((flag) => flag.startsWith('ONE_GROUP_'))
|
|
1442
|
+
const hostClangDefines = groupDefines.map(
|
|
1443
|
+
(flag) => '.define(' + JSON.stringify(flag) + ', to: "1")',
|
|
1444
|
+
)
|
|
1316
1445
|
const bindingSettings = [
|
|
1317
1446
|
...swiftDefines(bindings?.defines ?? []),
|
|
1318
1447
|
'.unsafeFlags(["-suppress-warnings"])',
|
|
@@ -1324,6 +1453,9 @@ export async function oneNativeControlsPackage(
|
|
|
1324
1453
|
? ['.unsafeFlags(["-Xfrontend", "-import-module", "-Xfrontend", "One"])']
|
|
1325
1454
|
: []),
|
|
1326
1455
|
]
|
|
1456
|
+
const hostSettings = hostClangDefines.length
|
|
1457
|
+
? `, cSettings: [${hostClangDefines.join(', ')}], cxxSettings: [${hostClangDefines.join(', ')}]`
|
|
1458
|
+
: ''
|
|
1327
1459
|
|
|
1328
1460
|
let manifest: string
|
|
1329
1461
|
if (bindings) {
|
|
@@ -1333,7 +1465,9 @@ export async function oneNativeControlsPackage(
|
|
|
1333
1465
|
`let package = Package(name: "${ONE_NATIVE_CONTROLS_PACKAGE}", platforms: [.iOS(.v17)], targets: [`,
|
|
1334
1466
|
' .target(name: "One", path: "Sources/One"),',
|
|
1335
1467
|
` .target(name: "OneSDKBindings", dependencies: ["One"], path: "Sources/OneSDKBindings", swiftSettings: [${bindingSettings.join(', ')}]),`,
|
|
1336
|
-
` .
|
|
1468
|
+
` .target(name: "OneNativeControlsCore", dependencies: ["One", "OneSDKBindings"], path: "Sources/ControlsCore", swiftSettings: [${controlSettings.join(', ')}]),`,
|
|
1469
|
+
` .target(name: "OneNativeControlsHost", dependencies: ["One", "OneNativeControlsCore"], path: "Sources/ControlsHost", publicHeadersPath: "include"${hostSettings}),`,
|
|
1470
|
+
` .executableTarget(name: "Controls", dependencies: ["One", "OneSDKBindings", "OneNativeControlsCore", "OneNativeControlsHost"], path: "Sources/Controls", swiftSettings: [${controlSettings.join(', ')}]),`,
|
|
1337
1471
|
'])',
|
|
1338
1472
|
'',
|
|
1339
1473
|
].join('\n')
|
|
@@ -1342,7 +1476,9 @@ export async function oneNativeControlsPackage(
|
|
|
1342
1476
|
'// swift-tools-version: 6.2',
|
|
1343
1477
|
'import PackageDescription',
|
|
1344
1478
|
`let package = Package(name: "${ONE_NATIVE_CONTROLS_PACKAGE}", platforms: [.iOS(.v17)], targets: [`,
|
|
1345
|
-
` .
|
|
1479
|
+
` .target(name: "OneNativeControlsCore", path: "Sources/ControlsCore", swiftSettings: [${controlSettings.join(', ')}]),`,
|
|
1480
|
+
` .target(name: "OneNativeControlsHost", dependencies: ["OneNativeControlsCore"], path: "Sources/ControlsHost", publicHeadersPath: "include"${hostSettings}),`,
|
|
1481
|
+
` .executableTarget(name: "${ONE_NATIVE_CONTROLS_PACKAGE}", dependencies: ["OneNativeControlsCore", "OneNativeControlsHost"], path: "Sources/Controls", swiftSettings: [${controlSettings.join(', ')}]),`,
|
|
1346
1482
|
'])',
|
|
1347
1483
|
'',
|
|
1348
1484
|
].join('\n')
|
package/src/xcode-project.ts
CHANGED
|
@@ -862,7 +862,10 @@ function targetSettings(
|
|
|
862
862
|
if (resolving.has(marker))
|
|
863
863
|
throw new Error(`${str(target.name)} has a cyclic build setting ${key}`)
|
|
864
864
|
resolving.add(marker)
|
|
865
|
-
|
|
865
|
+
// xcode splices the inherited list where a quoted word is only $(inherited);
|
|
866
|
+
// cocoapods writes gRPC's header search paths that way
|
|
867
|
+
const raw = levels[at]![key]!.replace(/"(\$\(inherited\)|\$\{inherited\})"/g, '$1')
|
|
868
|
+
const value = expand(raw, (name) =>
|
|
866
869
|
name === 'inherited' || name === key
|
|
867
870
|
? valueAt(key, at - 1, packaging)
|
|
868
871
|
: valueAt(name, levels.length - 1, packaging),
|
|
@@ -1281,8 +1284,25 @@ function targetMembers(
|
|
|
1281
1284
|
const isPreparedOutput = (file: string) =>
|
|
1282
1285
|
file === infoPlistOutput ||
|
|
1283
1286
|
(options.requireSources !== false && file.endsWith('.swift'))
|
|
1287
|
+
// xcode runs every script phase each build, and one declaring no outputs ahead
|
|
1288
|
+
// of the sources phase is how a target writes sources it never declares
|
|
1289
|
+
// (apollo-ios codegen). peach runs such phases only while sources are absent.
|
|
1290
|
+
let absentSources = false
|
|
1291
|
+
if (options.prepareGeneratedSources === true && options.requireSources !== false)
|
|
1292
|
+
project.visitMembers(
|
|
1293
|
+
targetId,
|
|
1294
|
+
xcodePathResolver(project.objects, project.projectDir, path.join, settings),
|
|
1295
|
+
(file) => (isDirectory(file) ? walkFiles(file) : fs.existsSync(file) ? [file] : []),
|
|
1296
|
+
path.join,
|
|
1297
|
+
(file, kind) => {
|
|
1298
|
+
if (kind !== 'header' && kind !== 'resource' && !fs.existsSync(file))
|
|
1299
|
+
absentSources = true
|
|
1300
|
+
},
|
|
1301
|
+
)
|
|
1302
|
+
let beforeSources = true
|
|
1284
1303
|
for (const phaseId of list(target.buildPhases)) {
|
|
1285
1304
|
const phase = project.object(phaseId)
|
|
1305
|
+
if (phase?.isa === 'PBXSourcesBuildPhase') beforeSources = false
|
|
1286
1306
|
if (phase?.isa !== 'PBXShellScriptBuildPhase') continue
|
|
1287
1307
|
const script = str(phase.name) ?? phaseId
|
|
1288
1308
|
for (const catalog of shellAssetCatalogs(
|
|
@@ -1326,7 +1346,15 @@ function targetMembers(
|
|
|
1326
1346
|
]
|
|
1327
1347
|
if (allOutputs.some((file) => file.endsWith('.swift') || file === infoPlistOutput))
|
|
1328
1348
|
for (const file of inputFiles) if (fs.existsSync(file)) projectInputs.add(file)
|
|
1329
|
-
|
|
1349
|
+
const undeclaredGenerator =
|
|
1350
|
+
absentSources &&
|
|
1351
|
+
beforeSources &&
|
|
1352
|
+
allOutputs.length === 0 &&
|
|
1353
|
+
str(phase.runOnlyForDeploymentPostprocessing) !== '1'
|
|
1354
|
+
if (
|
|
1355
|
+
options.prepareGeneratedSources === true &&
|
|
1356
|
+
(allOutputs.some(isPreparedOutput) || undeclaredGenerator)
|
|
1357
|
+
) {
|
|
1330
1358
|
const phaseDir = path.join(settings('TARGET_TEMP_DIR'), `Script-${phaseId}`)
|
|
1331
1359
|
for (const lists of fileLists.values())
|
|
1332
1360
|
for (const { file } of lists)
|