peachsim 0.1.2429 → 0.1.2432
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/preview.ts +2 -1
- package/cli/outbound-endpoints.ts +10 -2
- 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 +15792 -5999
- 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 +1 -1
- package/dist-lib/dev-bundle-resolution.cjs +1 -1
- package/dist-lib/expo-swift-bundle.cjs +14638 -4887
- 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 +15465 -5754
- package/dist-lib/host/fetch-proxy-handler.cjs +3205 -54
- 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 +3542 -391
- 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 +3438 -287
- 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 +174 -81
- 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 +16787 -6994
- package/dist-lib/swift-compile.cjs +2 -2
- package/dist-lib/swift-compile.mjs +2 -2
- 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 +95 -27
- package/dist-lib/vite.cjs +3331 -180
- package/dist-lib/worklet-executable.cjs +1 -1
- package/dist-lib/worklet-executable.mjs +1 -1
- package/package.json +1 -1
- package/src/expo-native-workspace.ts +23 -63
- package/src/pbx-table.ts +200 -0
- package/src/pod-sources.ts +628 -0
- package/src/podfile-cocoapods.ts +40 -3
- package/src/pods-analysis.ts +488 -0
- package/src/pods-build-settings.ts +1015 -0
- package/src/pods-files.ts +478 -0
- package/src/pods-install.ts +475 -0
- package/src/pods-integration.ts +778 -0
- package/src/pods-post-install.ts +1811 -0
- package/src/pods-project.ts +2416 -0
- package/src/pods-scripts.ts +409 -0
- package/src/pods-targets.ts +757 -0
- package/src/pods-xcconfig.ts +198 -0
- package/src/podspec-cocoapods.ts +29 -3
- package/src/podspec-ruby-stdlib.ts +111 -10
- package/src/podspec-ruby.ts +52 -8
- package/src/swift-catalog-png.ts +75 -0
- package/src/swift-host.ts +4 -3
- package/src/swift-root-lock.ts +0 -10
- package/src/swift-source-pods.ts +29 -73
- package/src/turbo-source.ts +16 -37
|
@@ -0,0 +1,1015 @@
|
|
|
1
|
+
// CocoaPods 1.17's Target::BuildSettings for library specifications and
|
|
2
|
+
// aggregate targets (MIT, Eloy Durán and the CocoaPods team): the xcconfig
|
|
3
|
+
// each generated target builds with, before post_install hooks edit it.
|
|
4
|
+
import path from 'node:path'
|
|
5
|
+
import {
|
|
6
|
+
type AggregateTarget,
|
|
7
|
+
CONFIGURATION_BUILD_DIR_VARIABLE,
|
|
8
|
+
type ConfigurationType,
|
|
9
|
+
type PodTarget,
|
|
10
|
+
relativePath,
|
|
11
|
+
} from './pods-targets'
|
|
12
|
+
import { XcodeConfig } from './pods-xcconfig'
|
|
13
|
+
import type { XcconfigValue } from './pods-analysis'
|
|
14
|
+
import type { XCFramework } from './pods-files'
|
|
15
|
+
|
|
16
|
+
export const PLURAL_SETTINGS = new Set([
|
|
17
|
+
'ALTERNATE_PERMISSIONS_FILES',
|
|
18
|
+
'ARCHS',
|
|
19
|
+
'BUILD_VARIANTS',
|
|
20
|
+
'EXCLUDED_SOURCE_FILE_NAMES',
|
|
21
|
+
'FRAMEWORK_SEARCH_PATHS',
|
|
22
|
+
'GCC_PREPROCESSOR_DEFINITIONS',
|
|
23
|
+
'GCC_PREPROCESSOR_DEFINITIONS_NOT_USED_IN_PRECOMPS',
|
|
24
|
+
'HEADER_SEARCH_PATHS',
|
|
25
|
+
'INCLUDED_SOURCE_FILE_NAMES',
|
|
26
|
+
'INFOPLIST_PREPROCESSOR_DEFINITIONS',
|
|
27
|
+
'LD_RUNPATH_SEARCH_PATHS',
|
|
28
|
+
'LIBRARY_SEARCH_PATHS',
|
|
29
|
+
'LOCALIZED_STRING_MACRO_NAMES',
|
|
30
|
+
'OTHER_CFLAGS',
|
|
31
|
+
'OTHER_CPLUSPLUSFLAGS',
|
|
32
|
+
'OTHER_LDFLAGS',
|
|
33
|
+
'OTHER_MODULE_VERIFIER_FLAGS',
|
|
34
|
+
'OTHER_SWIFT_FLAGS',
|
|
35
|
+
'REZ_SEARCH_PATHS',
|
|
36
|
+
'SECTORDER_FLAGS',
|
|
37
|
+
'SWIFT_ACTIVE_COMPILATION_CONDITIONS',
|
|
38
|
+
'SWIFT_INCLUDE_PATHS',
|
|
39
|
+
'SYSTEM_FRAMEWORK_SEARCH_PATHS',
|
|
40
|
+
'SYSTEM_HEADER_SEARCH_PATHS',
|
|
41
|
+
'USER_HEADER_SEARCH_PATHS',
|
|
42
|
+
'WARNING_CFLAGS',
|
|
43
|
+
'WARNING_LDFLAGS',
|
|
44
|
+
])
|
|
45
|
+
|
|
46
|
+
const XCFRAMEWORKS_BUILD_DIR_VARIABLE = '${PODS_XCFRAMEWORKS_BUILD_DIR}'
|
|
47
|
+
|
|
48
|
+
type Setting = string | string[] | null
|
|
49
|
+
|
|
50
|
+
export const xcframeworkIntermediateDir = (xcframework: XCFramework) =>
|
|
51
|
+
`${XCFRAMEWORKS_BUILD_DIR_VARIABLE}/${xcframework.targetName}`
|
|
52
|
+
|
|
53
|
+
const uniq = <T>(values: T[]) => [...new Set(values)]
|
|
54
|
+
const sorted = (values: string[]) => [...values].sort()
|
|
55
|
+
const sortedUniq = (values: string[]) => uniq(values).sort()
|
|
56
|
+
|
|
57
|
+
const linkerNames = (libraries: string[]) =>
|
|
58
|
+
libraries.map((library) =>
|
|
59
|
+
path.basename(library, path.extname(library)).replace(/^lib/, ''),
|
|
60
|
+
)
|
|
61
|
+
|
|
62
|
+
const frameworkBasenames = (frameworks: string[]) =>
|
|
63
|
+
frameworks.map((framework) => path.basename(framework, '.framework'))
|
|
64
|
+
|
|
65
|
+
const isStaticFramework = (x: XCFramework) => !x.dynamic && x.packaging === 'framework'
|
|
66
|
+
const isDynamicFramework = (x: XCFramework) => x.dynamic && x.packaging === 'framework'
|
|
67
|
+
const isStaticLibrary = (x: XCFramework) => !x.dynamic && x.packaging === 'library'
|
|
68
|
+
const isDynamicLibrary = (x: XCFramework) => x.dynamic && x.packaging === 'library'
|
|
69
|
+
|
|
70
|
+
function compareVersions(a: string, b: string): number {
|
|
71
|
+
const left = a.split('.').map(Number)
|
|
72
|
+
const right = b.split('.').map(Number)
|
|
73
|
+
for (let i = 0; i < Math.max(left.length, right.length); i++) {
|
|
74
|
+
const diff = (left[i] ?? 0) - (right[i] ?? 0)
|
|
75
|
+
if (diff !== 0) return diff
|
|
76
|
+
}
|
|
77
|
+
return 0
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
function quoteArray(values: string[]): string {
|
|
81
|
+
return values
|
|
82
|
+
.map((element) => {
|
|
83
|
+
const assignment = /^([\w-]+?)=(.+)$/s.exec(element)
|
|
84
|
+
if (assignment) {
|
|
85
|
+
const value = /[^\w\d]/.test(assignment[2]!)
|
|
86
|
+
? `"${assignment[2]}"`
|
|
87
|
+
: assignment[2]
|
|
88
|
+
return `${assignment[1]}=${value}`
|
|
89
|
+
}
|
|
90
|
+
return /[$[\] ]/.test(element) ? `"${element}"` : element
|
|
91
|
+
})
|
|
92
|
+
.join(' ')
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
function ldRunpathSearchPaths(
|
|
96
|
+
platform: string,
|
|
97
|
+
options: {
|
|
98
|
+
requiresHostTarget: boolean
|
|
99
|
+
testBundle: boolean
|
|
100
|
+
usesSwift: boolean
|
|
101
|
+
},
|
|
102
|
+
): string[] {
|
|
103
|
+
const paths: string[] = []
|
|
104
|
+
if (options.usesSwift) {
|
|
105
|
+
paths.push('/usr/lib/swift')
|
|
106
|
+
if (options.testBundle) paths.push('$(PLATFORM_DIR)/Developer/Library/Frameworks')
|
|
107
|
+
}
|
|
108
|
+
if (platform === 'osx') {
|
|
109
|
+
paths.push("'@executable_path/../Frameworks'")
|
|
110
|
+
paths.push(
|
|
111
|
+
options.testBundle ? "'@loader_path/../Frameworks'" : "'@loader_path/Frameworks'",
|
|
112
|
+
)
|
|
113
|
+
if (options.usesSwift) paths.push('${TOOLCHAIN_DIR}/usr/lib/swift/${PLATFORM_NAME}')
|
|
114
|
+
} else {
|
|
115
|
+
paths.push("'@executable_path/Frameworks'")
|
|
116
|
+
paths.push("'@loader_path/Frameworks'")
|
|
117
|
+
if (options.requiresHostTarget) paths.push("'@executable_path/../../Frameworks'")
|
|
118
|
+
}
|
|
119
|
+
return paths
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
/** BuildSettings#merged_xcconfigs: spec xcconfig values merged across consumers. */
|
|
123
|
+
function mergedXcconfigs(
|
|
124
|
+
xcconfigs: Record<string, XcconfigValue>[],
|
|
125
|
+
ignored: string | null = null,
|
|
126
|
+
): Map<string, string> {
|
|
127
|
+
const valuesByKey = new Map<string, XcconfigValue[]>()
|
|
128
|
+
for (const xcconfig of xcconfigs)
|
|
129
|
+
for (const [key, value] of Object.entries(xcconfig)) {
|
|
130
|
+
if (key === ignored) continue
|
|
131
|
+
const values = valuesByKey.get(key)
|
|
132
|
+
if (values) values.push(value)
|
|
133
|
+
else valuesByKey.set(key, [value])
|
|
134
|
+
}
|
|
135
|
+
const merged = new Map<string, string>()
|
|
136
|
+
for (const [key, values] of valuesByKey) {
|
|
137
|
+
const unique = new Map(values.map((value) => [JSON.stringify(value), value]))
|
|
138
|
+
const first = [...unique.values()][0]!
|
|
139
|
+
if (
|
|
140
|
+
[...unique.values()].every(
|
|
141
|
+
(value) => typeof value === 'string' && /^(yes|no)$/i.test(value),
|
|
142
|
+
)
|
|
143
|
+
) {
|
|
144
|
+
if (unique.size === 1 && typeof first === 'string') merged.set(key, first)
|
|
145
|
+
} else if (PLURAL_SETTINGS.has(key))
|
|
146
|
+
// Array#join flattens array values
|
|
147
|
+
merged.set(key, [...unique.values()].flat().join(' '))
|
|
148
|
+
else if (unique.size === 1) {
|
|
149
|
+
if (typeof first !== 'string')
|
|
150
|
+
throw new Error(
|
|
151
|
+
`the singular build setting ${key} has the list value ${JSON.stringify(first)}`,
|
|
152
|
+
)
|
|
153
|
+
merged.set(key, first)
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
return merged
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
abstract class BuildSettings {
|
|
160
|
+
abstract readonly platformName: string
|
|
161
|
+
abstract usesSwift(): boolean
|
|
162
|
+
abstract frameworks(): string[]
|
|
163
|
+
abstract weakFrameworks(): string[]
|
|
164
|
+
abstract libraries(): string[]
|
|
165
|
+
abstract moduleMapFiles(): string[]
|
|
166
|
+
abstract requiresObjcLinkerFlag(): boolean
|
|
167
|
+
abstract requiresFobjcArc(): boolean
|
|
168
|
+
protected abstract settings(): Record<string, () => Setting>
|
|
169
|
+
|
|
170
|
+
otherSwiftFlagsWithoutSwift(): boolean {
|
|
171
|
+
return false
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
protected baseSettings(): Record<string, () => Setting> {
|
|
175
|
+
return {
|
|
176
|
+
PODS_BUILD_DIR: () => '${BUILD_DIR}',
|
|
177
|
+
PODS_CONFIGURATION_BUILD_DIR: () =>
|
|
178
|
+
'${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)',
|
|
179
|
+
PODS_XCFRAMEWORKS_BUILD_DIR: () =>
|
|
180
|
+
'$(PODS_CONFIGURATION_BUILD_DIR)/XCFrameworkIntermediates',
|
|
181
|
+
USE_RECURSIVE_SCRIPT_INPUTS_IN_SCRIPT_PHASES: () => 'YES',
|
|
182
|
+
CODE_SIGN_IDENTITY: () => null,
|
|
183
|
+
FRAMEWORK_SEARCH_PATHS: () => this.frameworkSearchPaths(),
|
|
184
|
+
GCC_PREPROCESSOR_DEFINITIONS: () => ['COCOAPODS=1'],
|
|
185
|
+
OTHER_CFLAGS: () => this.otherCflags(),
|
|
186
|
+
OTHER_MODULE_VERIFIER_FLAGS: () => this.otherModuleVerifierFlags(),
|
|
187
|
+
OTHER_SWIFT_FLAGS: () => this.otherSwiftFlags(),
|
|
188
|
+
CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER: () => 'NO',
|
|
189
|
+
OTHER_LDFLAGS: () => this.otherLdflags(),
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
frameworkSearchPaths(): string[] {
|
|
194
|
+
return developerFrameworkSearchPaths([...this.frameworks(), ...this.weakFrameworks()])
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
otherCflags(): string[] {
|
|
198
|
+
return this.moduleMapFiles().map((file) => `-fmodule-map-file=${file}`)
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
otherModuleVerifierFlags(): string[] {
|
|
202
|
+
return []
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
otherSwiftFlags(): string[] | null {
|
|
206
|
+
if (!this.usesSwift() && !this.otherSwiftFlagsWithoutSwift()) return null
|
|
207
|
+
return [
|
|
208
|
+
'-D',
|
|
209
|
+
'COCOAPODS',
|
|
210
|
+
...this.moduleMapFiles().flatMap((file) => ['-Xcc', `-fmodule-map-file=${file}`]),
|
|
211
|
+
]
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
otherLdflags(): string[] {
|
|
215
|
+
const flags: string[] = []
|
|
216
|
+
if (this.requiresObjcLinkerFlag()) flags.push('-ObjC')
|
|
217
|
+
if (this.requiresFobjcArc()) flags.push('-fobjc-arc')
|
|
218
|
+
for (const library of this.libraries()) flags.push(`-l"${library}"`)
|
|
219
|
+
for (const framework of this.frameworks()) flags.push('-framework', `"${framework}"`)
|
|
220
|
+
for (const framework of this.weakFrameworks())
|
|
221
|
+
flags.push('-weak_framework', `"${framework}"`)
|
|
222
|
+
return flags
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
/** BuildSettings#xcconfig before the spec xcconfig merge. */
|
|
226
|
+
protected baseXcconfig(): XcodeConfig {
|
|
227
|
+
const entries = Object.entries(this.settings()).sort(([a], [b]) =>
|
|
228
|
+
a < b ? -1 : a > b ? 1 : 0,
|
|
229
|
+
)
|
|
230
|
+
const hash: Record<string, string> = {}
|
|
231
|
+
for (const [key, compute] of entries) {
|
|
232
|
+
const value = compute()
|
|
233
|
+
if (value === null) hash[key] = '$(inherited)'
|
|
234
|
+
else if (PLURAL_SETTINGS.has(key)) {
|
|
235
|
+
if (!Array.isArray(value))
|
|
236
|
+
throw new Error(
|
|
237
|
+
`${key} is a plural setting, cannot have ${JSON.stringify(value)} as its value`,
|
|
238
|
+
)
|
|
239
|
+
hash[key] = `$(inherited) ${quoteArray(value)}`
|
|
240
|
+
} else {
|
|
241
|
+
if (typeof value !== 'string')
|
|
242
|
+
throw new Error(
|
|
243
|
+
`${key} is not a plural setting, cannot have ${JSON.stringify(value)} as its value`,
|
|
244
|
+
)
|
|
245
|
+
hash[key] = value
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
return new XcodeConfig(hash)
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
protected static mergeSpecXcconfig(
|
|
252
|
+
spec: Map<string, string>,
|
|
253
|
+
xcconfig: XcodeConfig,
|
|
254
|
+
): XcodeConfig {
|
|
255
|
+
const plural = new Map<string, string>()
|
|
256
|
+
for (const [key, value] of spec)
|
|
257
|
+
if (PLURAL_SETTINGS.has(key)) plural.set(key, value)
|
|
258
|
+
else xcconfig.attributes.set(key, value)
|
|
259
|
+
xcconfig.merge(plural)
|
|
260
|
+
return xcconfig
|
|
261
|
+
}
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
const developerFrameworkSearchPaths = (frameworks: string[]) =>
|
|
265
|
+
frameworks.includes('XCTest') || frameworks.includes('SenTestingKit')
|
|
266
|
+
? ['$(PLATFORM_DIR)/Developer/Library/Frameworks']
|
|
267
|
+
: []
|
|
268
|
+
|
|
269
|
+
/** a library specification's settings for one configuration type. */
|
|
270
|
+
export class PodTargetSettings extends BuildSettings {
|
|
271
|
+
constructor(
|
|
272
|
+
readonly target: PodTarget,
|
|
273
|
+
readonly configuration: ConfigurationType,
|
|
274
|
+
readonly settingsFor: (
|
|
275
|
+
target: PodTarget,
|
|
276
|
+
configuration: ConfigurationType,
|
|
277
|
+
) => PodTargetSettings,
|
|
278
|
+
readonly setArcCompatibilityFlag: boolean,
|
|
279
|
+
) {
|
|
280
|
+
super()
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
get platformName() {
|
|
284
|
+
return this.target.platform.name
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
#of(target: PodTarget) {
|
|
288
|
+
return this.settingsFor(target, this.configuration)
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
usesSwift() {
|
|
292
|
+
return this.target.usesSwift
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
get fileAccessors() {
|
|
296
|
+
return this.target.fileAccessors
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
get specConsumers() {
|
|
300
|
+
return this.target.specs.map((spec) => spec.consumer)
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
xcconfig(): XcodeConfig {
|
|
304
|
+
return BuildSettings.mergeSpecXcconfig(
|
|
305
|
+
this.mergedPodTargetXcconfigs(),
|
|
306
|
+
this.baseXcconfig(),
|
|
307
|
+
)
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
protected settings(): Record<string, () => Setting> {
|
|
311
|
+
return {
|
|
312
|
+
...this.baseSettings(),
|
|
313
|
+
PODS_ROOT: () => '${SRCROOT}',
|
|
314
|
+
PODS_TARGET_SRCROOT: () => this.target.podTargetSrcroot,
|
|
315
|
+
PODS_DEVELOPMENT_LANGUAGE: () => '${DEVELOPMENT_LANGUAGE}',
|
|
316
|
+
SYSTEM_FRAMEWORK_SEARCH_PATHS: () => this.systemFrameworkSearchPaths(),
|
|
317
|
+
LIBRARY_SEARCH_PATHS: () => this.librarySearchPaths(),
|
|
318
|
+
HEADER_SEARCH_PATHS: () => this.headerSearchPaths(),
|
|
319
|
+
SWIFT_INCLUDE_PATHS: () => this.swiftIncludePaths(),
|
|
320
|
+
LD_RUNPATH_SEARCH_PATHS: () => null,
|
|
321
|
+
SKIP_INSTALL: () => 'YES',
|
|
322
|
+
PRODUCT_BUNDLE_IDENTIFIER: () => 'org.cocoapods.${PRODUCT_NAME:rfc1034identifier}',
|
|
323
|
+
CONFIGURATION_BUILD_DIR: () =>
|
|
324
|
+
this.target.configurationBuildDir(CONFIGURATION_BUILD_DIR_VARIABLE),
|
|
325
|
+
APPLICATION_EXTENSION_API_ONLY: () => null,
|
|
326
|
+
BUILD_LIBRARY_FOR_DISTRIBUTION: () => null,
|
|
327
|
+
}
|
|
328
|
+
}
|
|
329
|
+
|
|
330
|
+
consumerFrameworks(): string[] {
|
|
331
|
+
return this.specConsumers.flatMap((consumer) => consumer.frameworks)
|
|
332
|
+
}
|
|
333
|
+
|
|
334
|
+
frameworks(): string[] {
|
|
335
|
+
if (this.target.buildAsStatic) return []
|
|
336
|
+
const frameworks = [...this.consumerFrameworks()]
|
|
337
|
+
if (this.target.shouldBuild) {
|
|
338
|
+
frameworks.push(...frameworkBasenames(this.vendoredStaticFrameworks()))
|
|
339
|
+
frameworks.push(
|
|
340
|
+
...uniq(
|
|
341
|
+
this.vendoredXcframeworks()
|
|
342
|
+
.filter(isStaticFramework)
|
|
343
|
+
.map((x) => x.name),
|
|
344
|
+
),
|
|
345
|
+
)
|
|
346
|
+
frameworks.push(
|
|
347
|
+
...this.target.dependentTargetsByConfig[this.configuration].flatMap((pt) =>
|
|
348
|
+
this.#of(pt).dynamicFrameworksToImport(),
|
|
349
|
+
),
|
|
350
|
+
)
|
|
351
|
+
} else
|
|
352
|
+
frameworks.push(
|
|
353
|
+
...this.dependentTargets()
|
|
354
|
+
.filter((pt) => !pt.shouldBuild)
|
|
355
|
+
.flatMap((pt) => this.#of(pt).dynamicFrameworksToImport()),
|
|
356
|
+
)
|
|
357
|
+
return sortedUniq(frameworks)
|
|
358
|
+
}
|
|
359
|
+
|
|
360
|
+
staticFrameworksToImport(): string[] {
|
|
361
|
+
const frameworks: string[] = []
|
|
362
|
+
const builtDynamic = this.target.shouldBuild && this.target.buildAsDynamic
|
|
363
|
+
if (!builtDynamic) {
|
|
364
|
+
frameworks.push(...frameworkBasenames(this.vendoredStaticFrameworks()))
|
|
365
|
+
frameworks.push(
|
|
366
|
+
...uniq(
|
|
367
|
+
this.vendoredXcframeworks()
|
|
368
|
+
.filter(isStaticFramework)
|
|
369
|
+
.map((x) => x.name),
|
|
370
|
+
),
|
|
371
|
+
)
|
|
372
|
+
}
|
|
373
|
+
if (this.target.shouldBuild && this.target.buildAsStaticFramework)
|
|
374
|
+
frameworks.push(this.target.productBasename)
|
|
375
|
+
return frameworks
|
|
376
|
+
}
|
|
377
|
+
|
|
378
|
+
dynamicFrameworksToImport(): string[] {
|
|
379
|
+
const frameworks = frameworkBasenames(this.vendoredDynamicFrameworks())
|
|
380
|
+
frameworks.push(
|
|
381
|
+
...uniq(
|
|
382
|
+
this.vendoredXcframeworks()
|
|
383
|
+
.filter(isDynamicFramework)
|
|
384
|
+
.map((x) => x.name),
|
|
385
|
+
),
|
|
386
|
+
)
|
|
387
|
+
if (this.target.shouldBuild && this.target.buildAsDynamicFramework)
|
|
388
|
+
frameworks.push(this.target.productBasename)
|
|
389
|
+
frameworks.push(...this.consumerFrameworks())
|
|
390
|
+
return frameworks
|
|
391
|
+
}
|
|
392
|
+
|
|
393
|
+
weakFrameworks(): string[] {
|
|
394
|
+
if (this.target.buildAsStatic) return []
|
|
395
|
+
return [
|
|
396
|
+
...this.specConsumers.flatMap((consumer) => consumer.weak_frameworks),
|
|
397
|
+
...this.dependentTargets().flatMap((pt) => this.#of(pt).weakFrameworksToImport()),
|
|
398
|
+
]
|
|
399
|
+
}
|
|
400
|
+
|
|
401
|
+
frameworksToImport(): string[] {
|
|
402
|
+
return sortedUniq([
|
|
403
|
+
...this.staticFrameworksToImport(),
|
|
404
|
+
...this.dynamicFrameworksToImport(),
|
|
405
|
+
])
|
|
406
|
+
}
|
|
407
|
+
|
|
408
|
+
weakFrameworksToImport(): string[] {
|
|
409
|
+
return sortedUniq(this.specConsumers.flatMap((consumer) => consumer.weak_frameworks))
|
|
410
|
+
}
|
|
411
|
+
|
|
412
|
+
override frameworkSearchPaths(): string[] {
|
|
413
|
+
const own = this.target.configurationBuildDir(CONFIGURATION_BUILD_DIR_VARIABLE)
|
|
414
|
+
return sortedUniq(
|
|
415
|
+
[
|
|
416
|
+
...super.frameworkSearchPaths(),
|
|
417
|
+
...this.dependentTargets().flatMap((pt) =>
|
|
418
|
+
this.#of(pt).frameworkSearchPathsToImport(),
|
|
419
|
+
),
|
|
420
|
+
...this.frameworkSearchPathsToImport(),
|
|
421
|
+
].filter((entry) => entry !== own),
|
|
422
|
+
)
|
|
423
|
+
}
|
|
424
|
+
|
|
425
|
+
frameworkHeaderSearchPath(): string | null {
|
|
426
|
+
return this.target.buildAsFramework
|
|
427
|
+
? `${this.target.buildProductPath()}/Headers`
|
|
428
|
+
: null
|
|
429
|
+
}
|
|
430
|
+
|
|
431
|
+
vendoredFrameworkSearchPaths(): string[] {
|
|
432
|
+
return [
|
|
433
|
+
...this.fileAccessors
|
|
434
|
+
.flatMap((fa) => fa.vendoredFrameworks)
|
|
435
|
+
.map(
|
|
436
|
+
(framework) =>
|
|
437
|
+
`\${PODS_ROOT}/${relativePath(path.dirname(framework), this.target.sandbox.root)}`,
|
|
438
|
+
),
|
|
439
|
+
...uniq(
|
|
440
|
+
this.vendoredXcframeworks()
|
|
441
|
+
.filter((x) => x.packaging === 'framework')
|
|
442
|
+
.map(xcframeworkIntermediateDir),
|
|
443
|
+
),
|
|
444
|
+
]
|
|
445
|
+
}
|
|
446
|
+
|
|
447
|
+
frameworkSearchPathsToImport(): string[] {
|
|
448
|
+
const paths = [
|
|
449
|
+
...developerFrameworkSearchPaths(this.consumerFrameworks()),
|
|
450
|
+
...this.vendoredFrameworkSearchPaths(),
|
|
451
|
+
]
|
|
452
|
+
if (!(this.target.buildAsFramework && this.target.shouldBuild)) return paths
|
|
453
|
+
return [...paths, this.target.configurationBuildDir(CONFIGURATION_BUILD_DIR_VARIABLE)]
|
|
454
|
+
}
|
|
455
|
+
|
|
456
|
+
vendoredStaticFrameworks(): string[] {
|
|
457
|
+
return this.fileAccessors.flatMap((fa) => fa.vendoredStaticFrameworks)
|
|
458
|
+
}
|
|
459
|
+
|
|
460
|
+
vendoredDynamicFrameworks(): string[] {
|
|
461
|
+
return this.fileAccessors.flatMap((fa) => fa.vendoredDynamicFrameworks)
|
|
462
|
+
}
|
|
463
|
+
|
|
464
|
+
vendoredXcframeworks(): XCFramework[] {
|
|
465
|
+
return [...this.target.xcframeworks.values()].flat()
|
|
466
|
+
}
|
|
467
|
+
|
|
468
|
+
shouldApplyXctunwrapFix(): boolean {
|
|
469
|
+
return (
|
|
470
|
+
this.target.platform.name === 'ios' &&
|
|
471
|
+
compareVersions(this.target.platform.deploymentTarget, '12.2') < 0 &&
|
|
472
|
+
[...this.frameworksToImport(), ...this.weakFrameworksToImport()].includes('XCTest')
|
|
473
|
+
)
|
|
474
|
+
}
|
|
475
|
+
|
|
476
|
+
systemFrameworkSearchPaths(): string[] {
|
|
477
|
+
return this.shouldApplyXctunwrapFix()
|
|
478
|
+
? ['$(PLATFORM_DIR)/Developer/Library/Frameworks']
|
|
479
|
+
: []
|
|
480
|
+
}
|
|
481
|
+
|
|
482
|
+
libraries(): string[] {
|
|
483
|
+
if (this.target.buildAsStatic) return []
|
|
484
|
+
return sortedUniq([
|
|
485
|
+
...linkerNames(this.vendoredStaticLibraries()),
|
|
486
|
+
...this.librariesToImport(),
|
|
487
|
+
...uniq(
|
|
488
|
+
this.vendoredXcframeworks()
|
|
489
|
+
.filter(isStaticLibrary)
|
|
490
|
+
.flatMap((x) => linkerNames([x.slices[0]!.binaryPath])),
|
|
491
|
+
),
|
|
492
|
+
])
|
|
493
|
+
}
|
|
494
|
+
|
|
495
|
+
staticLibrariesToImport(): string[] {
|
|
496
|
+
const libraries: string[] = []
|
|
497
|
+
if (!(this.target.shouldBuild && this.target.buildAsDynamic)) {
|
|
498
|
+
libraries.push(...linkerNames(this.vendoredStaticLibraries()))
|
|
499
|
+
const xcframeworkLibraries = uniq(
|
|
500
|
+
this.vendoredXcframeworks()
|
|
501
|
+
.filter(isStaticLibrary)
|
|
502
|
+
.flatMap((x) => linkerNames([x.slices[0]!.binaryPath])),
|
|
503
|
+
)
|
|
504
|
+
libraries.push(...linkerNames(xcframeworkLibraries))
|
|
505
|
+
}
|
|
506
|
+
if (this.target.shouldBuild && this.target.buildAsStaticLibrary)
|
|
507
|
+
libraries.push(this.target.productBasename)
|
|
508
|
+
return libraries
|
|
509
|
+
}
|
|
510
|
+
|
|
511
|
+
dynamicLibrariesToImport(): string[] {
|
|
512
|
+
const libraries = linkerNames(this.vendoredDynamicLibraries())
|
|
513
|
+
libraries.push(...this.specConsumers.flatMap((consumer) => consumer.libraries))
|
|
514
|
+
if (this.target.shouldBuild && this.target.buildAsDynamicLibrary)
|
|
515
|
+
libraries.push(this.target.productBasename)
|
|
516
|
+
return libraries
|
|
517
|
+
}
|
|
518
|
+
|
|
519
|
+
librariesToImport(): string[] {
|
|
520
|
+
return sortedUniq([
|
|
521
|
+
...this.staticLibrariesToImport(),
|
|
522
|
+
...this.dynamicLibrariesToImport(),
|
|
523
|
+
])
|
|
524
|
+
}
|
|
525
|
+
|
|
526
|
+
librarySearchPaths(): string[] {
|
|
527
|
+
const paths = this.shouldApplyXctunwrapFix()
|
|
528
|
+
? ['$(PLATFORM_DIR)/Developer/usr/lib']
|
|
529
|
+
: []
|
|
530
|
+
if (this.target.buildAsStatic) return sortedUniq(paths)
|
|
531
|
+
paths.push(...this.librarySearchPathsToImport())
|
|
532
|
+
paths.push(
|
|
533
|
+
...this.dependentTargets().flatMap((pt) =>
|
|
534
|
+
this.#of(pt).vendoredDynamicLibrarySearchPaths(),
|
|
535
|
+
),
|
|
536
|
+
)
|
|
537
|
+
const own = this.target.configurationBuildDir(CONFIGURATION_BUILD_DIR_VARIABLE)
|
|
538
|
+
return sortedUniq(paths.filter((entry) => entry !== own))
|
|
539
|
+
}
|
|
540
|
+
|
|
541
|
+
vendoredStaticLibraries(): string[] {
|
|
542
|
+
return this.fileAccessors.flatMap((fa) => fa.vendoredStaticLibraries)
|
|
543
|
+
}
|
|
544
|
+
|
|
545
|
+
vendoredDynamicLibraries(): string[] {
|
|
546
|
+
return this.fileAccessors.flatMap((fa) => fa.vendoredDynamicLibraries)
|
|
547
|
+
}
|
|
548
|
+
|
|
549
|
+
vendoredStaticLibrarySearchPaths(): string[] {
|
|
550
|
+
return [
|
|
551
|
+
...this.vendoredStaticLibraries().map(
|
|
552
|
+
(file) =>
|
|
553
|
+
`\${PODS_ROOT}/${relativePath(path.dirname(file), this.target.sandbox.root)}`,
|
|
554
|
+
),
|
|
555
|
+
...this.vendoredXcframeworks()
|
|
556
|
+
.filter(isStaticLibrary)
|
|
557
|
+
.map(xcframeworkIntermediateDir),
|
|
558
|
+
]
|
|
559
|
+
}
|
|
560
|
+
|
|
561
|
+
vendoredDynamicLibrarySearchPaths(): string[] {
|
|
562
|
+
return [
|
|
563
|
+
...this.vendoredDynamicLibraries().map(
|
|
564
|
+
(file) =>
|
|
565
|
+
`\${PODS_ROOT}/${relativePath(path.dirname(file), this.target.sandbox.root)}`,
|
|
566
|
+
),
|
|
567
|
+
...this.vendoredXcframeworks()
|
|
568
|
+
.filter(isDynamicLibrary)
|
|
569
|
+
.map(xcframeworkIntermediateDir),
|
|
570
|
+
]
|
|
571
|
+
}
|
|
572
|
+
|
|
573
|
+
librarySearchPathsToImport(): string[] {
|
|
574
|
+
const paths = [
|
|
575
|
+
...this.vendoredStaticLibrarySearchPaths(),
|
|
576
|
+
...this.vendoredDynamicLibrarySearchPaths(),
|
|
577
|
+
]
|
|
578
|
+
if (this.target.usesSwift)
|
|
579
|
+
paths.push('/usr/lib/swift', '${TOOLCHAIN_DIR}/usr/lib/swift/${PLATFORM_NAME}')
|
|
580
|
+
if (this.target.buildAsFramework || !this.target.shouldBuild) return paths
|
|
581
|
+
return [...paths, this.target.configurationBuildDir(CONFIGURATION_BUILD_DIR_VARIABLE)]
|
|
582
|
+
}
|
|
583
|
+
|
|
584
|
+
moduleMapFiles(): string[] {
|
|
585
|
+
return sorted(
|
|
586
|
+
this.dependentTargets()
|
|
587
|
+
.map((pt) => this.#of(pt).moduleMapFileToImport())
|
|
588
|
+
.filter((file) => file !== null),
|
|
589
|
+
)
|
|
590
|
+
}
|
|
591
|
+
|
|
592
|
+
moduleMapFileToImport(): string | null {
|
|
593
|
+
const target = this.target
|
|
594
|
+
if (!target.shouldBuild || target.buildAsFramework || !target.definesModule)
|
|
595
|
+
return null
|
|
596
|
+
if (target.usesSwift)
|
|
597
|
+
return `\${PODS_CONFIGURATION_BUILD_DIR}/${target.label}/${target.productModuleName}.modulemap`
|
|
598
|
+
return `\${PODS_ROOT}/${relativePath(target.moduleMapPath, target.sandbox.root)}`
|
|
599
|
+
}
|
|
600
|
+
|
|
601
|
+
headerSearchPaths(): string[] {
|
|
602
|
+
const paths = this.target.headerSearchPaths({
|
|
603
|
+
configuration: this.configuration,
|
|
604
|
+
})
|
|
605
|
+
const xcframeworks = [
|
|
606
|
+
...this.vendoredXcframeworks(),
|
|
607
|
+
...this.dependentTargets().flatMap((pt) => this.#of(pt).vendoredXcframeworks()),
|
|
608
|
+
]
|
|
609
|
+
paths.push(
|
|
610
|
+
...xcframeworks
|
|
611
|
+
.filter(isStaticLibrary)
|
|
612
|
+
.map((x) => `${xcframeworkIntermediateDir(x)}/Headers`),
|
|
613
|
+
)
|
|
614
|
+
return sorted(paths)
|
|
615
|
+
}
|
|
616
|
+
|
|
617
|
+
publicHeaderSearchPaths(): string[] {
|
|
618
|
+
return sorted(
|
|
619
|
+
this.target.headerSearchPaths({
|
|
620
|
+
includePrivateHeaders: false,
|
|
621
|
+
configuration: this.configuration,
|
|
622
|
+
}),
|
|
623
|
+
)
|
|
624
|
+
}
|
|
625
|
+
|
|
626
|
+
override otherSwiftFlags(): string[] | null {
|
|
627
|
+
const flags = super.otherSwiftFlags()
|
|
628
|
+
if (flags === null) return null
|
|
629
|
+
if (this.target.inhibitWarnings) flags.push('-suppress-warnings')
|
|
630
|
+
if (!this.target.buildAsFramework && this.target.definesModule)
|
|
631
|
+
flags.push(
|
|
632
|
+
'-import-underlying-module',
|
|
633
|
+
'-Xcc',
|
|
634
|
+
'-fmodule-map-file=${SRCROOT}/${MODULEMAP_FILE}',
|
|
635
|
+
)
|
|
636
|
+
return flags
|
|
637
|
+
}
|
|
638
|
+
|
|
639
|
+
swiftIncludePaths(): string[] {
|
|
640
|
+
return sortedUniq([
|
|
641
|
+
...this.dependentTargets().flatMap((pt) =>
|
|
642
|
+
this.#of(pt).swiftIncludePathsToImport(),
|
|
643
|
+
),
|
|
644
|
+
...this.dependentTargets().flatMap((pt) =>
|
|
645
|
+
this.#of(pt).vendoredStaticLibrarySearchPaths(),
|
|
646
|
+
),
|
|
647
|
+
...(this.shouldApplyXctunwrapFix() ? ['$(PLATFORM_DIR)/Developer/usr/lib'] : []),
|
|
648
|
+
])
|
|
649
|
+
}
|
|
650
|
+
|
|
651
|
+
swiftIncludePathsToImport(): string[] {
|
|
652
|
+
return this.target.usesSwift && !this.target.buildAsFramework
|
|
653
|
+
? [this.target.configurationBuildDir(CONFIGURATION_BUILD_DIR_VARIABLE)]
|
|
654
|
+
: []
|
|
655
|
+
}
|
|
656
|
+
|
|
657
|
+
requiresObjcLinkerFlag(): boolean {
|
|
658
|
+
return false
|
|
659
|
+
}
|
|
660
|
+
|
|
661
|
+
requiresFobjcArc(): boolean {
|
|
662
|
+
return (
|
|
663
|
+
this.setArcCompatibilityFlag &&
|
|
664
|
+
this.specConsumers.some((consumer) => consumer.requires_arc !== false)
|
|
665
|
+
)
|
|
666
|
+
}
|
|
667
|
+
|
|
668
|
+
dependentTargets(): PodTarget[] {
|
|
669
|
+
return uniq(this.target.recursiveDependentTargets(this.configuration))
|
|
670
|
+
}
|
|
671
|
+
|
|
672
|
+
mergedPodTargetXcconfigs(): Map<string, string> {
|
|
673
|
+
return mergedXcconfigs(
|
|
674
|
+
this.specConsumers.map((consumer) => consumer.pod_target_xcconfig),
|
|
675
|
+
)
|
|
676
|
+
}
|
|
677
|
+
}
|
|
678
|
+
|
|
679
|
+
/** an aggregate target's settings for one of the application's configurations. */
|
|
680
|
+
export class AggregateTargetSettings extends BuildSettings {
|
|
681
|
+
constructor(
|
|
682
|
+
readonly target: AggregateTarget,
|
|
683
|
+
readonly configurationName: string,
|
|
684
|
+
readonly podSettings: (
|
|
685
|
+
target: PodTarget,
|
|
686
|
+
configuration: ConfigurationType,
|
|
687
|
+
) => PodTargetSettings,
|
|
688
|
+
readonly aggregateSettings: (
|
|
689
|
+
target: AggregateTarget,
|
|
690
|
+
configurationName: string,
|
|
691
|
+
) => AggregateTargetSettings,
|
|
692
|
+
) {
|
|
693
|
+
super()
|
|
694
|
+
}
|
|
695
|
+
|
|
696
|
+
get platformName() {
|
|
697
|
+
return this.target.platform.name
|
|
698
|
+
}
|
|
699
|
+
|
|
700
|
+
get configuration(): ConfigurationType {
|
|
701
|
+
const type = this.target.userBuildConfigurations[this.configurationName]
|
|
702
|
+
if (!type)
|
|
703
|
+
throw new Error(
|
|
704
|
+
`No configuration ${this.configurationName} for ${this.target.label}`,
|
|
705
|
+
)
|
|
706
|
+
return type
|
|
707
|
+
}
|
|
708
|
+
|
|
709
|
+
#pod(target: PodTarget) {
|
|
710
|
+
return this.podSettings(target, this.configuration)
|
|
711
|
+
}
|
|
712
|
+
|
|
713
|
+
#searchAggregates() {
|
|
714
|
+
return this.target.searchPathsAggregateTargets.map((at) =>
|
|
715
|
+
this.aggregateSettings(at, this.configurationName),
|
|
716
|
+
)
|
|
717
|
+
}
|
|
718
|
+
|
|
719
|
+
xcconfig(): XcodeConfig {
|
|
720
|
+
return BuildSettings.mergeSpecXcconfig(
|
|
721
|
+
this.mergedUserTargetXcconfigs(),
|
|
722
|
+
this.baseXcconfig(),
|
|
723
|
+
)
|
|
724
|
+
}
|
|
725
|
+
|
|
726
|
+
protected settings(): Record<string, () => Setting> {
|
|
727
|
+
return {
|
|
728
|
+
...this.baseSettings(),
|
|
729
|
+
PODS_PODFILE_DIR_PATH: () => this.target.podfileDirRelativePath,
|
|
730
|
+
PODS_ROOT: () => this.target.relativePodsRoot,
|
|
731
|
+
LIBRARY_SEARCH_PATHS: () => this.librarySearchPaths(),
|
|
732
|
+
HEADER_SEARCH_PATHS: () => this.headerSearchPaths(),
|
|
733
|
+
SWIFT_INCLUDE_PATHS: () => this.swiftIncludePaths(),
|
|
734
|
+
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES: () =>
|
|
735
|
+
this.mustEmbedSwift() && compareVersions(this.targetSwiftVersion(), '2.3') >= 0
|
|
736
|
+
? 'YES'
|
|
737
|
+
: null,
|
|
738
|
+
EMBEDDED_CONTENT_CONTAINS_SWIFT: () =>
|
|
739
|
+
this.mustEmbedSwift() && compareVersions(this.targetSwiftVersion(), '2.3') < 0
|
|
740
|
+
? 'YES'
|
|
741
|
+
: null,
|
|
742
|
+
LD_RUNPATH_SEARCH_PATHS: () => this.ldRunpathSearchPaths(),
|
|
743
|
+
}
|
|
744
|
+
}
|
|
745
|
+
|
|
746
|
+
usesSwift(): boolean {
|
|
747
|
+
return this.target.usesSwift
|
|
748
|
+
}
|
|
749
|
+
|
|
750
|
+
podTargets(): PodTarget[] {
|
|
751
|
+
return this.target.podTargetsFor(this.configurationName)
|
|
752
|
+
}
|
|
753
|
+
|
|
754
|
+
podTargetsToLink(): PodTarget[] {
|
|
755
|
+
const excluded = new Set(
|
|
756
|
+
this.#searchAggregates().flatMap((settings) => settings.podTargetsToLink()),
|
|
757
|
+
)
|
|
758
|
+
return this.podTargets().filter((target) => !excluded.has(target))
|
|
759
|
+
}
|
|
760
|
+
|
|
761
|
+
#searchAggregatePodSettings(): PodTargetSettings[] {
|
|
762
|
+
return uniq(
|
|
763
|
+
uniq(this.#searchAggregates().flatMap((settings) => settings.podTargets())).map(
|
|
764
|
+
(pt) => this.#pod(pt),
|
|
765
|
+
),
|
|
766
|
+
)
|
|
767
|
+
}
|
|
768
|
+
|
|
769
|
+
#collected(
|
|
770
|
+
fromPods: (settings: PodTargetSettings) => string[],
|
|
771
|
+
fromAggregates: (settings: PodTargetSettings) => string[],
|
|
772
|
+
) {
|
|
773
|
+
return sortedUniq([
|
|
774
|
+
...this.podTargetsToLink().flatMap((pt) => fromPods(this.#pod(pt))),
|
|
775
|
+
...this.#searchAggregatePodSettings().flatMap(fromAggregates),
|
|
776
|
+
])
|
|
777
|
+
}
|
|
778
|
+
|
|
779
|
+
frameworks(): string[] {
|
|
780
|
+
return this.#collected(
|
|
781
|
+
(s) => s.frameworksToImport(),
|
|
782
|
+
(s) => s.dynamicFrameworksToImport(),
|
|
783
|
+
)
|
|
784
|
+
}
|
|
785
|
+
|
|
786
|
+
weakFrameworks(): string[] {
|
|
787
|
+
return this.#collected(
|
|
788
|
+
(s) => s.weakFrameworksToImport(),
|
|
789
|
+
(s) => s.weakFrameworks(),
|
|
790
|
+
)
|
|
791
|
+
}
|
|
792
|
+
|
|
793
|
+
override frameworkSearchPaths(): string[] {
|
|
794
|
+
return this.#collected(
|
|
795
|
+
(s) => s.frameworkSearchPathsToImport(),
|
|
796
|
+
(s) => s.frameworkSearchPathsToImport(),
|
|
797
|
+
)
|
|
798
|
+
}
|
|
799
|
+
|
|
800
|
+
libraries(): string[] {
|
|
801
|
+
return this.#collected(
|
|
802
|
+
(s) => s.librariesToImport(),
|
|
803
|
+
(s) => s.dynamicLibrariesToImport(),
|
|
804
|
+
)
|
|
805
|
+
}
|
|
806
|
+
|
|
807
|
+
librarySearchPaths(): string[] {
|
|
808
|
+
return this.#collected(
|
|
809
|
+
(s) => s.librarySearchPathsToImport(),
|
|
810
|
+
(s) => s.vendoredDynamicLibrarySearchPaths(),
|
|
811
|
+
)
|
|
812
|
+
}
|
|
813
|
+
|
|
814
|
+
swiftIncludePaths(): string[] {
|
|
815
|
+
return this.#collected(
|
|
816
|
+
(s) => s.swiftIncludePathsToImport(),
|
|
817
|
+
(s) => s.swiftIncludePathsToImport(),
|
|
818
|
+
)
|
|
819
|
+
}
|
|
820
|
+
|
|
821
|
+
headerSearchPaths(): string[] {
|
|
822
|
+
const pods = this.podTargets()
|
|
823
|
+
const paths: string[] = []
|
|
824
|
+
if (!this.target.buildAsFramework || !pods.every((pt) => pt.shouldBuild))
|
|
825
|
+
paths.push(
|
|
826
|
+
...this.target.sandbox.publicHeaders.searchPaths(this.target.platform.name),
|
|
827
|
+
)
|
|
828
|
+
paths.push(
|
|
829
|
+
...pods
|
|
830
|
+
.filter((pt) => pt.buildAsFramework && pt.shouldBuild)
|
|
831
|
+
.map((pt) => this.#pod(pt).frameworkHeaderSearchPath())
|
|
832
|
+
.filter((entry) => entry !== null),
|
|
833
|
+
)
|
|
834
|
+
paths.push(
|
|
835
|
+
...pods
|
|
836
|
+
.flatMap((pt) => this.#pod(pt).vendoredXcframeworks())
|
|
837
|
+
.filter(isStaticLibrary)
|
|
838
|
+
.map((x) => `${xcframeworkIntermediateDir(x)}/Headers`),
|
|
839
|
+
)
|
|
840
|
+
paths.push(
|
|
841
|
+
...this.#searchAggregates().flatMap((settings) => settings.headerSearchPaths()),
|
|
842
|
+
)
|
|
843
|
+
return sortedUniq(paths)
|
|
844
|
+
}
|
|
845
|
+
|
|
846
|
+
override otherCflags(): string[] {
|
|
847
|
+
const silencedHeaders: string[] = []
|
|
848
|
+
const silencedFrameworks: string[] = []
|
|
849
|
+
for (const pt of this.podTargets().filter((target) => target.inhibitWarnings)) {
|
|
850
|
+
const settings = this.#pod(pt)
|
|
851
|
+
if (pt.buildAsFramework && pt.shouldBuild) {
|
|
852
|
+
const header = settings.frameworkHeaderSearchPath()
|
|
853
|
+
if (header !== null) silencedHeaders.push(header)
|
|
854
|
+
} else silencedHeaders.push(...settings.publicHeaderSearchPaths())
|
|
855
|
+
silencedFrameworks.push(...settings.frameworkSearchPathsToImport())
|
|
856
|
+
}
|
|
857
|
+
return [
|
|
858
|
+
...super.otherCflags(),
|
|
859
|
+
...uniq(silencedHeaders).flatMap((entry) => ['-isystem', entry]),
|
|
860
|
+
...uniq(silencedFrameworks).flatMap((entry) => ['-iframework', entry]),
|
|
861
|
+
]
|
|
862
|
+
}
|
|
863
|
+
|
|
864
|
+
override otherModuleVerifierFlags(): string[] {
|
|
865
|
+
return this.podTargets().map(
|
|
866
|
+
(pt) => `-F${pt.configurationBuildDir(CONFIGURATION_BUILD_DIR_VARIABLE)}`,
|
|
867
|
+
)
|
|
868
|
+
}
|
|
869
|
+
|
|
870
|
+
moduleMapFiles(): string[] {
|
|
871
|
+
return sortedUniq(
|
|
872
|
+
[
|
|
873
|
+
...this.podTargets().map((pt) => this.#pod(pt).moduleMapFileToImport()),
|
|
874
|
+
...this.#searchAggregatePodSettings().map((settings) =>
|
|
875
|
+
settings.moduleMapFileToImport(),
|
|
876
|
+
),
|
|
877
|
+
].filter((file) => file !== null),
|
|
878
|
+
)
|
|
879
|
+
}
|
|
880
|
+
|
|
881
|
+
override otherSwiftFlagsWithoutSwift(): boolean {
|
|
882
|
+
return this.moduleMapFiles().length > 0
|
|
883
|
+
}
|
|
884
|
+
|
|
885
|
+
mustEmbedSwift(): boolean {
|
|
886
|
+
return this.podTargets().some((pt) => pt.usesSwift)
|
|
887
|
+
}
|
|
888
|
+
|
|
889
|
+
targetSwiftVersion(): string {
|
|
890
|
+
return this.target.analyzed.swiftVersion || '0'
|
|
891
|
+
}
|
|
892
|
+
|
|
893
|
+
ldRunpathSearchPaths(): string[] | null {
|
|
894
|
+
const pods = this.podTargets()
|
|
895
|
+
if (!pods.some((pt) => pt.buildAsDynamic) && !this.anyVendoredDynamicArtifacts())
|
|
896
|
+
return null
|
|
897
|
+
return uniq(
|
|
898
|
+
ldRunpathSearchPaths(this.target.platform.name, {
|
|
899
|
+
requiresHostTarget: false,
|
|
900
|
+
testBundle: false,
|
|
901
|
+
usesSwift: pods.some((pt) => pt.usesSwift),
|
|
902
|
+
}),
|
|
903
|
+
)
|
|
904
|
+
}
|
|
905
|
+
|
|
906
|
+
anyVendoredDynamicArtifacts(): boolean {
|
|
907
|
+
return this.podTargets().some((pt) =>
|
|
908
|
+
pt.fileAccessors.some(
|
|
909
|
+
(fa) =>
|
|
910
|
+
fa.vendoredDynamicArtifacts.length > 0 ||
|
|
911
|
+
fa.vendoredXCFrameworks.some(
|
|
912
|
+
(file) =>
|
|
913
|
+
pt.xcframeworks.get(fa.specName)?.find((x) => x.path === file)?.dynamic,
|
|
914
|
+
),
|
|
915
|
+
),
|
|
916
|
+
)
|
|
917
|
+
}
|
|
918
|
+
|
|
919
|
+
anyVendoredStaticArtifacts(): boolean {
|
|
920
|
+
return this.podTargets().some((pt) =>
|
|
921
|
+
pt.fileAccessors.some(
|
|
922
|
+
(fa) =>
|
|
923
|
+
fa.vendoredStaticFrameworks.length > 0 ||
|
|
924
|
+
fa.vendoredStaticLibraries.length > 0 ||
|
|
925
|
+
fa.vendoredXCFrameworks.some(
|
|
926
|
+
(file) =>
|
|
927
|
+
pt.xcframeworks.get(fa.specName)?.find((x) => x.path === file)?.dynamic ===
|
|
928
|
+
false,
|
|
929
|
+
),
|
|
930
|
+
),
|
|
931
|
+
)
|
|
932
|
+
}
|
|
933
|
+
|
|
934
|
+
requiresObjcLinkerFlag(): boolean {
|
|
935
|
+
return (
|
|
936
|
+
this.podTargets().some((pt) => pt.buildAsStatic) ||
|
|
937
|
+
this.anyVendoredStaticArtifacts()
|
|
938
|
+
)
|
|
939
|
+
}
|
|
940
|
+
|
|
941
|
+
requiresFobjcArc(): boolean {
|
|
942
|
+
return (
|
|
943
|
+
this.target.analyzed.setArcCompatibilityFlag &&
|
|
944
|
+
this.podTargets().some((pt) =>
|
|
945
|
+
pt.specs.some((spec) => spec.consumer.requires_arc !== false),
|
|
946
|
+
)
|
|
947
|
+
)
|
|
948
|
+
}
|
|
949
|
+
|
|
950
|
+
mergedUserTargetXcconfigs(): Map<string, string> {
|
|
951
|
+
const targets = uniq([
|
|
952
|
+
...this.podTargets(),
|
|
953
|
+
...this.target.searchPathsAggregateTargets.flatMap((at) => at.podTargets),
|
|
954
|
+
])
|
|
955
|
+
return mergedXcconfigs(
|
|
956
|
+
targets.flatMap((target) =>
|
|
957
|
+
target.specs.map((spec) => spec.consumer.user_target_xcconfig),
|
|
958
|
+
),
|
|
959
|
+
'USE_HEADERMAP',
|
|
960
|
+
)
|
|
961
|
+
}
|
|
962
|
+
}
|
|
963
|
+
|
|
964
|
+
/** every generated target's settings, created on first use. */
|
|
965
|
+
export class PodsBuildSettings {
|
|
966
|
+
readonly #pods = new Map<PodTarget, Map<ConfigurationType, PodTargetSettings>>()
|
|
967
|
+
readonly #aggregates = new Map<AggregateTarget, Map<string, AggregateTargetSettings>>()
|
|
968
|
+
|
|
969
|
+
constructor(readonly setArcCompatibilityFlag: boolean) {}
|
|
970
|
+
|
|
971
|
+
pod = (target: PodTarget, configuration: ConfigurationType): PodTargetSettings => {
|
|
972
|
+
let byConfig = this.#pods.get(target)
|
|
973
|
+
if (!byConfig) {
|
|
974
|
+
byConfig = new Map()
|
|
975
|
+
this.#pods.set(target, byConfig)
|
|
976
|
+
}
|
|
977
|
+
let settings = byConfig.get(configuration)
|
|
978
|
+
if (!settings) {
|
|
979
|
+
if (!target.configVariants.includes(configuration))
|
|
980
|
+
throw new Error(
|
|
981
|
+
`No build settings for ${target.label} (configuration ${configuration})`,
|
|
982
|
+
)
|
|
983
|
+
settings = new PodTargetSettings(
|
|
984
|
+
target,
|
|
985
|
+
configuration,
|
|
986
|
+
this.pod,
|
|
987
|
+
this.setArcCompatibilityFlag,
|
|
988
|
+
)
|
|
989
|
+
byConfig.set(configuration, settings)
|
|
990
|
+
}
|
|
991
|
+
return settings
|
|
992
|
+
}
|
|
993
|
+
|
|
994
|
+
aggregate = (
|
|
995
|
+
target: AggregateTarget,
|
|
996
|
+
configurationName: string,
|
|
997
|
+
): AggregateTargetSettings => {
|
|
998
|
+
let byName = this.#aggregates.get(target)
|
|
999
|
+
if (!byName) {
|
|
1000
|
+
byName = new Map()
|
|
1001
|
+
this.#aggregates.set(target, byName)
|
|
1002
|
+
}
|
|
1003
|
+
let settings = byName.get(configurationName)
|
|
1004
|
+
if (!settings) {
|
|
1005
|
+
settings = new AggregateTargetSettings(
|
|
1006
|
+
target,
|
|
1007
|
+
configurationName,
|
|
1008
|
+
this.pod,
|
|
1009
|
+
this.aggregate,
|
|
1010
|
+
)
|
|
1011
|
+
byName.set(configurationName, settings)
|
|
1012
|
+
}
|
|
1013
|
+
return settings
|
|
1014
|
+
}
|
|
1015
|
+
}
|