peachsim 0.1.2429 → 0.1.2431
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 +16783 -6989
- 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
package/src/podfile-cocoapods.ts
CHANGED
|
@@ -114,15 +114,46 @@ module Pod
|
|
|
114
114
|
podfile.post_install!(self)
|
|
115
115
|
end
|
|
116
116
|
|
|
117
|
+
def run_podfile_post_integrate_hooks
|
|
118
|
+
podfile.post_integrate!(self)
|
|
119
|
+
end
|
|
120
|
+
|
|
117
121
|
# upstream runs plugin hooks and prints warnings here; Peach loads no plugins
|
|
118
122
|
def perform_post_install_actions
|
|
119
123
|
end
|
|
120
124
|
|
|
125
|
+
# the workspace, deintegration of targets the Podfile dropped and the
|
|
126
|
+
# override warnings are left out: Peach builds from the projects in memory
|
|
121
127
|
class UserProjectIntegrator
|
|
128
|
+
attr_reader :podfile, :sandbox, :installation_root, :targets, :targets_to_integrate, :use_input_output_paths
|
|
129
|
+
alias use_input_output_paths? use_input_output_paths
|
|
130
|
+
|
|
131
|
+
def initialize(podfile, sandbox, installation_root, targets, targets_to_integrate, use_input_output_paths: true)
|
|
132
|
+
@podfile = podfile
|
|
133
|
+
@sandbox = sandbox
|
|
134
|
+
@installation_root = installation_root
|
|
135
|
+
@targets = targets
|
|
136
|
+
@targets_to_integrate = targets_to_integrate
|
|
137
|
+
@use_input_output_paths = use_input_output_paths
|
|
138
|
+
end
|
|
139
|
+
|
|
140
|
+
def integrate!
|
|
141
|
+
integrate_user_targets
|
|
142
|
+
save_projects(user_projects_to_integrate)
|
|
143
|
+
end
|
|
144
|
+
|
|
122
145
|
private
|
|
123
146
|
|
|
124
147
|
def integrate_user_targets
|
|
125
|
-
|
|
148
|
+
Peach::Pods.integrate_user_targets(targets_to_integrate.sort_by(&:name).map(&:label))
|
|
149
|
+
end
|
|
150
|
+
|
|
151
|
+
def user_projects_to_integrate
|
|
152
|
+
targets_to_integrate.map(&:user_project).compact.uniq
|
|
153
|
+
end
|
|
154
|
+
|
|
155
|
+
def save_projects(projects)
|
|
156
|
+
projects.each(&:save)
|
|
126
157
|
end
|
|
127
158
|
end
|
|
128
159
|
end
|
|
@@ -235,8 +266,8 @@ module Pod
|
|
|
235
266
|
set_hash_value('installation_method', 'name' => installation_method, 'options' => options)
|
|
236
267
|
end
|
|
237
268
|
|
|
269
|
+
# checks the Bundler running CocoaPods; Peach runs neither
|
|
238
270
|
def ensure_bundler!(version = '>= 0')
|
|
239
|
-
raise Informative, "Peach does not evaluate ensure_bundler! (#{version})"
|
|
240
271
|
end
|
|
241
272
|
|
|
242
273
|
def pod(name = nil, *requirements)
|
|
@@ -437,6 +468,10 @@ module Pod
|
|
|
437
468
|
@post_install_callback ? @post_install_callback.call(installer) || true : false
|
|
438
469
|
end
|
|
439
470
|
|
|
471
|
+
def post_integrate!(installer)
|
|
472
|
+
@post_integrate_callback ? @post_integrate_callback.call(installer) || true : false
|
|
473
|
+
end
|
|
474
|
+
|
|
440
475
|
def set_hash_value(key, value)
|
|
441
476
|
raise StandardError, "Unsupported hash key '#{key}'" unless HASH_KEYS.include?(key)
|
|
442
477
|
internal_hash[key] = value
|
|
@@ -1349,9 +1384,11 @@ function podClass(interp: Interpreter, name: string): RModule {
|
|
|
1349
1384
|
|
|
1350
1385
|
/** the app's `ios/Podfile`, evaluated with React Native's and the app's helpers. */
|
|
1351
1386
|
export function evaluatePodfile(
|
|
1352
|
-
|
|
1387
|
+
appPath: string,
|
|
1353
1388
|
env: Record<string, string | undefined>,
|
|
1354
1389
|
): EvaluatedPodfile {
|
|
1390
|
+
// pod install finds the Podfile below the working directory, which Ruby reports resolved
|
|
1391
|
+
const app = fs.realpathSync(appPath)
|
|
1355
1392
|
const file = path.join(app, 'ios', 'Podfile')
|
|
1356
1393
|
return rubyFailures(file, () => {
|
|
1357
1394
|
const { interp } = cocoapodsInterpreter(app, [app], env)
|
|
@@ -0,0 +1,488 @@
|
|
|
1
|
+
// the pod and aggregate targets `pod install` derives from a resolved Podfile,
|
|
2
|
+
// built in the Podfile's interpreter so its pre_install hooks (and the helpers
|
|
3
|
+
// that patch Pod::Installer) see the objects they expect. the Ruby below is
|
|
4
|
+
// kept to CocoaPods 1.17's Installer::Analyzer#generate_targets, Target and
|
|
5
|
+
// PodTarget (MIT, Eloy Durán and the CocoaPods team) for one application
|
|
6
|
+
// target; everything after analysis is TypeScript.
|
|
7
|
+
import { type ResolvedPodfile } from './podfile-cocoapods'
|
|
8
|
+
import { rubyFailures } from './podspec-cocoapods'
|
|
9
|
+
import { RModule, RObject, str, type Value } from './podspec-ruby'
|
|
10
|
+
import { toJson } from './podspec-ruby-stdlib'
|
|
11
|
+
|
|
12
|
+
const ANALYSIS = String.raw`
|
|
13
|
+
module Pod
|
|
14
|
+
class Podfile
|
|
15
|
+
class TargetDefinition
|
|
16
|
+
def supports_swift_version?(swift_version)
|
|
17
|
+
if swift_version_requirements.nil?
|
|
18
|
+
root? || parent.supports_swift_version?(swift_version)
|
|
19
|
+
else
|
|
20
|
+
Requirement.create(swift_version_requirements).satisfied_by?(swift_version)
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
end
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
class Sandbox
|
|
27
|
+
def pod_dir(name)
|
|
28
|
+
root_name = Specification.root_name(name)
|
|
29
|
+
local?(root_name) ? Pathname.new(local_path(root_name)) : root + root_name
|
|
30
|
+
end
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
class Specification
|
|
34
|
+
def static_framework
|
|
35
|
+
attributes_hash['static_framework']
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
def info_plist
|
|
39
|
+
attributes_hash['info_plist'] || {}
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
def dependency_whitelisted_for_configuration?(dependency, configuration)
|
|
43
|
+
inherited = -> { root? ? true : parent.dependency_whitelisted_for_configuration?(dependency, configuration) }
|
|
44
|
+
return inherited[] unless configuration_whitelist = attributes_hash['configuration_pod_whitelist']
|
|
45
|
+
return inherited[] unless whitelist_for_pod = configuration_whitelist[dependency.name]
|
|
46
|
+
whitelist_for_pod.include?(configuration.to_s.downcase)
|
|
47
|
+
end
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
class Target
|
|
51
|
+
DEFAULT_BUILD_CONFIGURATIONS = { 'Release' => :release, 'Debug' => :debug }.freeze
|
|
52
|
+
attr_reader :sandbox, :user_build_configurations, :archs, :platform, :build_type
|
|
53
|
+
private :build_type
|
|
54
|
+
def initialize(sandbox, build_type, user_build_configurations, archs, platform)
|
|
55
|
+
@sandbox = sandbox
|
|
56
|
+
@user_build_configurations = user_build_configurations
|
|
57
|
+
@archs = archs
|
|
58
|
+
@platform = platform
|
|
59
|
+
@build_type = build_type
|
|
60
|
+
end
|
|
61
|
+
def name; label; end
|
|
62
|
+
alias to_s name
|
|
63
|
+
def build_as_dynamic?; build_type.dynamic?; end
|
|
64
|
+
def build_as_dynamic_framework?; build_type.dynamic_framework?; end
|
|
65
|
+
def build_as_framework?; build_type.framework?; end
|
|
66
|
+
def build_as_library?; build_type.library?; end
|
|
67
|
+
def build_as_static?; build_type.static?; end
|
|
68
|
+
def build_as_static_framework?; build_type.static_framework?; end
|
|
69
|
+
def build_as_static_library?; build_type.static_library?; end
|
|
70
|
+
def requires_frameworks?; build_as_framework?; end
|
|
71
|
+
def inspect; "#<#{self.class} name=#{name}>"; end
|
|
72
|
+
end
|
|
73
|
+
|
|
74
|
+
class PodTarget < Target
|
|
75
|
+
attr_reader :specs, :library_specs, :test_specs, :app_specs, :target_definitions, :swift_version, :dependent_targets, :dependent_targets_by_config
|
|
76
|
+
def initialize(sandbox, build_type, user_build_configurations, archs, platform, specs, target_definitions, swift_version)
|
|
77
|
+
super(sandbox, build_type, user_build_configurations, archs, platform)
|
|
78
|
+
@specs = specs.dup.freeze
|
|
79
|
+
@target_definitions = target_definitions
|
|
80
|
+
@swift_version = swift_version
|
|
81
|
+
by_type = @specs.group_by(&:spec_type)
|
|
82
|
+
@library_specs = by_type[:library] || []
|
|
83
|
+
@test_specs = by_type[:test] || []
|
|
84
|
+
@app_specs = by_type[:app] || []
|
|
85
|
+
self.dependent_targets = []
|
|
86
|
+
end
|
|
87
|
+
def dependent_targets=(targets)
|
|
88
|
+
@dependent_targets = targets
|
|
89
|
+
@dependent_targets_by_config = { :debug => targets, :release => targets }
|
|
90
|
+
end
|
|
91
|
+
def dependent_targets_by_config=(by_config)
|
|
92
|
+
@dependent_targets_by_config = by_config
|
|
93
|
+
@dependent_targets = by_config.values.reduce([], &:|)
|
|
94
|
+
end
|
|
95
|
+
def label; root_spec.name; end
|
|
96
|
+
def root_spec; @root_spec ||= specs.first.root; end
|
|
97
|
+
def pod_name; root_spec.name; end
|
|
98
|
+
def product_module_name; root_spec.module_name; end
|
|
99
|
+
def podfile; target_definitions.first.podfile; end
|
|
100
|
+
def spec_consumers; specs.map { |spec| spec.consumer(platform) }; end
|
|
101
|
+
def dependencies
|
|
102
|
+
spec_consumers.flat_map { |consumer| consumer.dependencies.map { |dep| Specification.root_name(dep.name) } }.uniq
|
|
103
|
+
end
|
|
104
|
+
def inhibit_warnings?
|
|
105
|
+
answers = target_definitions.map { |td| td.inhibits_warnings_for_pod?(root_spec.name) }.uniq
|
|
106
|
+
answers.size > 1 ? podfile.root_target_definitions.first.inhibits_warnings_for_pod?(root_spec.name) : answers.first || false
|
|
107
|
+
end
|
|
108
|
+
def build_pod_as_module?
|
|
109
|
+
explicit = target_definitions.select { |td| td.dependencies.any? { |d| d.root_name == pod_name } }
|
|
110
|
+
answers = explicit.group_by { |td| td.build_pod_as_module?(pod_name) }
|
|
111
|
+
return false if answers.size > 1
|
|
112
|
+
answers.keys.first == true || target_definitions.all? { |td| td.build_pod_as_module?(pod_name) }
|
|
113
|
+
end
|
|
114
|
+
end
|
|
115
|
+
|
|
116
|
+
class AggregateTarget < Target
|
|
117
|
+
attr_reader :target_definition, :client_root, :user_project, :user_target_uuids, :pod_targets_for_build_configuration, :search_paths_aggregate_targets
|
|
118
|
+
def initialize(sandbox, build_type, user_build_configurations, archs, platform, target_definition, client_root, user_project, user_target_uuids, pod_targets_for_build_configuration)
|
|
119
|
+
super(sandbox, build_type, user_build_configurations, archs, platform)
|
|
120
|
+
@target_definition = target_definition
|
|
121
|
+
@client_root = client_root
|
|
122
|
+
@user_project = user_project
|
|
123
|
+
@user_target_uuids = user_target_uuids
|
|
124
|
+
@pod_targets_for_build_configuration = pod_targets_for_build_configuration
|
|
125
|
+
@search_paths_aggregate_targets = []
|
|
126
|
+
end
|
|
127
|
+
def label; target_definition.label; end
|
|
128
|
+
def podfile; target_definition.podfile; end
|
|
129
|
+
def pod_targets; pod_targets_for_build_configuration.values.flatten.uniq; end
|
|
130
|
+
def pod_targets_for_build_configuration(build_configuration = nil)
|
|
131
|
+
build_configuration ? @pod_targets_for_build_configuration[build_configuration] || [] : @pod_targets_for_build_configuration
|
|
132
|
+
end
|
|
133
|
+
def user_targets
|
|
134
|
+
user_target_uuids.map { |uuid| user_project.objects_by_uuid[uuid] }
|
|
135
|
+
end
|
|
136
|
+
end
|
|
137
|
+
|
|
138
|
+
class Installer
|
|
139
|
+
# Installer::Analyzer#generate_targets for one variant of each pod, which
|
|
140
|
+
# is every Podfile with one platform and no target-specific subspecs
|
|
141
|
+
def peach_analyze(resolver, user_build_configurations, user_project, user_target_uuids, user_swift_version)
|
|
142
|
+
if user_swift_version
|
|
143
|
+
podfile.target_definition_list.each { |td| td.swift_version = user_swift_version unless td.abstract? }
|
|
144
|
+
end
|
|
145
|
+
specs_by_target = resolver.specs_by_target.reject { |td, _| td.abstract? && !td.platform }
|
|
146
|
+
# keyed by names: a stored podspec is a copy whose subspecs still name the original root
|
|
147
|
+
variants = {}
|
|
148
|
+
specs_by_target.each do |td, resolver_specs|
|
|
149
|
+
resolver_specs.group_by { |spec, _| spec.root.name }.each do |root_name, entries|
|
|
150
|
+
all = entries.map(&:first)
|
|
151
|
+
root = all.first.root
|
|
152
|
+
unless all.all?(&:library_specification?)
|
|
153
|
+
raise Informative, "Peach builds no test or app specifications (#{root_name} in #{td.label})"
|
|
154
|
+
end
|
|
155
|
+
build_type = td.build_type.framework? ? (root.static_framework ? BuildType.static_framework : td.build_type) : BuildType.static_library
|
|
156
|
+
key = [all.map(&:name).sort, td.platform.to_s, build_type.to_s].join(' ')
|
|
157
|
+
variants[root_name] ||= {}
|
|
158
|
+
(variants[root_name][key] ||= [all, build_type, []])[2] << td
|
|
159
|
+
end
|
|
160
|
+
end
|
|
161
|
+
@pod_targets = variants.map do |root_name, by_variant|
|
|
162
|
+
if by_variant.size > 1
|
|
163
|
+
raise Informative, "Peach builds one variant of each pod; #{root_name} differs between #{by_variant.values.map { |v| v[2].map(&:label) }.flatten.join(', ')}"
|
|
164
|
+
end
|
|
165
|
+
specs, build_type, target_definitions = by_variant.values.first
|
|
166
|
+
root = specs.first.root
|
|
167
|
+
target_definitions.reject!(&:abstract?) unless target_definitions.all?(&:abstract?)
|
|
168
|
+
swift_version = peach_swift_version(root, target_definitions)
|
|
169
|
+
PodTarget.new(sandbox, build_type, user_build_configurations, [], peach_platform(specs, target_definitions, build_type), specs, target_definitions, swift_version)
|
|
170
|
+
end
|
|
171
|
+
all_specs = specs_by_target.values.flatten(1).map(&:first).uniq.group_by(&:name)
|
|
172
|
+
by_name = @pod_targets.group_by(&:pod_name)
|
|
173
|
+
@pod_targets.each do |target|
|
|
174
|
+
target.dependent_targets_by_config = Hash[[:debug, :release].map do |config|
|
|
175
|
+
specs = {}
|
|
176
|
+
target.library_specs.each do |s|
|
|
177
|
+
s.dependencies(target.platform).each do |dep|
|
|
178
|
+
all_specs[dep.name].each do |spec|
|
|
179
|
+
raise Informative, "#{s} depends upon #{spec}, which is a #{spec.spec_type} spec." if spec.non_library_specification?
|
|
180
|
+
specs[spec.name] ||= spec if s.dependency_whitelisted_for_configuration?(dep, config)
|
|
181
|
+
end
|
|
182
|
+
end
|
|
183
|
+
end
|
|
184
|
+
own = target.library_specs.map(&:name)
|
|
185
|
+
[config, specs.values.reject { |spec| own.include?(spec.name) }.group_by { |spec| spec.root.name }.map do |root_name, deps|
|
|
186
|
+
by_name[root_name].find { |t| t.build_as_framework? == target.build_as_framework? && deps.all? { |d| t.specs.map(&:name).include?(d.name) } }
|
|
187
|
+
end]
|
|
188
|
+
end]
|
|
189
|
+
end
|
|
190
|
+
@aggregate_targets = specs_by_target.keys.reject(&:abstract?).map do |td|
|
|
191
|
+
configurations = user_build_configurations.keys.concat(td.all_whitelisted_configurations).uniq
|
|
192
|
+
pods = @pod_targets.select { |t| t.target_definitions.include?(td) }
|
|
193
|
+
named = specs_by_target[td].group_by { |spec, _| spec.root.name }.reject { |_, entries| entries.all? { |_, non_library_only| non_library_only } }
|
|
194
|
+
pods.keep_if { |t| named.key?(t.pod_name) }
|
|
195
|
+
dependencies = td.dependencies.group_by(&:root_name)
|
|
196
|
+
by_configuration = Hash[configurations.map { |c| [c, []] }]
|
|
197
|
+
pods.each do |t|
|
|
198
|
+
configurations.each do |c|
|
|
199
|
+
answers = (dependencies[t.pod_name] || []).map { |d| td.pod_whitelisted_for_configuration?(d.name, c) }.uniq
|
|
200
|
+
raise Informative, "The subspecs of #{t.pod_name} are linked to different build configurations for #{td}" if answers.size > 1
|
|
201
|
+
by_configuration[c] << t unless answers == [false]
|
|
202
|
+
end
|
|
203
|
+
end
|
|
204
|
+
build_type = td.uses_frameworks? ? BuildType.static_framework : BuildType.static_library
|
|
205
|
+
AggregateTarget.new(sandbox, build_type, user_build_configurations, [], td.platform, td, Config.instance.installation_root, user_project, user_target_uuids, by_configuration)
|
|
206
|
+
end
|
|
207
|
+
raise Informative, "Peach builds the pods of one application target, not #{@aggregate_targets.map(&:label).join(', ')}" unless @aggregate_targets.size == 1
|
|
208
|
+
@aggregate_targets.each do |target|
|
|
209
|
+
target.search_paths_aggregate_targets.concat(@aggregate_targets.select { |other| target.target_definition.targets_to_inherit_search_paths.include?(other.target_definition) })
|
|
210
|
+
end
|
|
211
|
+
run_podfile_pre_install_hooks
|
|
212
|
+
end
|
|
213
|
+
|
|
214
|
+
private
|
|
215
|
+
|
|
216
|
+
def peach_platform(specs, target_definitions, build_type)
|
|
217
|
+
name = target_definitions.first.platform.name
|
|
218
|
+
defaults = { :ios => '4.3', :osx => '10.6', :tvos => '9.0', :visionos => '1.0', :watchos => '2.0' }
|
|
219
|
+
target = specs.select(&:library_specification?).map { |s| Version.new(s.deployment_target(name) || defaults[name]) }.max
|
|
220
|
+
target = [target, Version.new('8.0')].max if name == :ios && build_type.framework?
|
|
221
|
+
Platform.new(name, target)
|
|
222
|
+
end
|
|
223
|
+
|
|
224
|
+
def peach_swift_version(root, target_definitions)
|
|
225
|
+
if root.swift_versions.empty?
|
|
226
|
+
target_definitions.map(&:swift_version).compact.uniq.first
|
|
227
|
+
else
|
|
228
|
+
root.swift_versions.sort.reverse.find { |v| target_definitions.all? { |td| td.supports_swift_version?(v) } }.to_s
|
|
229
|
+
end
|
|
230
|
+
end
|
|
231
|
+
end
|
|
232
|
+
end
|
|
233
|
+
`
|
|
234
|
+
|
|
235
|
+
const CONSUMER_ATTRIBUTES = [
|
|
236
|
+
'requires_arc',
|
|
237
|
+
'frameworks',
|
|
238
|
+
'weak_frameworks',
|
|
239
|
+
'libraries',
|
|
240
|
+
'compiler_flags',
|
|
241
|
+
'prefix_header_contents',
|
|
242
|
+
'prefix_header_file',
|
|
243
|
+
'module_map',
|
|
244
|
+
'header_dir',
|
|
245
|
+
'header_mappings_dir',
|
|
246
|
+
'script_phases',
|
|
247
|
+
'source_files',
|
|
248
|
+
'public_header_files',
|
|
249
|
+
'project_header_files',
|
|
250
|
+
'private_header_files',
|
|
251
|
+
'vendored_frameworks',
|
|
252
|
+
'vendored_libraries',
|
|
253
|
+
'resource_bundles',
|
|
254
|
+
'resources',
|
|
255
|
+
'exclude_files',
|
|
256
|
+
'preserve_paths',
|
|
257
|
+
'on_demand_resources',
|
|
258
|
+
]
|
|
259
|
+
|
|
260
|
+
const EXPORT = String.raw`
|
|
261
|
+
lambda do |installer, attributes|
|
|
262
|
+
spec_json = lambda do |spec, platform|
|
|
263
|
+
consumer = spec.consumer(platform)
|
|
264
|
+
values = attributes.each_with_object({}) { |a, h| h[a] = consumer.value_for_attribute(a.to_sym) }
|
|
265
|
+
values['pod_target_xcconfig'] = consumer.pod_target_xcconfig
|
|
266
|
+
values['user_target_xcconfig'] = consumer.user_target_xcconfig
|
|
267
|
+
values['dependencies'] = consumer.dependencies.map(&:name)
|
|
268
|
+
{ 'name' => spec.name, 'root' => spec.root?, 'deploymentTarget' => spec.deployment_target(platform.name), 'consumer' => values }
|
|
269
|
+
end
|
|
270
|
+
{
|
|
271
|
+
'pods' => installer.pod_targets.map do |t|
|
|
272
|
+
root = t.root_spec
|
|
273
|
+
local = installer.sandbox.local_path(root.name)
|
|
274
|
+
{
|
|
275
|
+
'label' => t.label,
|
|
276
|
+
'name' => t.pod_name,
|
|
277
|
+
'version' => root.version.to_s,
|
|
278
|
+
'moduleName' => t.product_module_name,
|
|
279
|
+
'local' => local && local.to_s,
|
|
280
|
+
'source' => root.source,
|
|
281
|
+
'license' => root.attributes_hash['license'],
|
|
282
|
+
'platform' => { 'name' => t.platform.name.to_s, 'deploymentTarget' => t.platform.deployment_target.to_s },
|
|
283
|
+
'framework' => t.build_as_framework?,
|
|
284
|
+
'dynamic' => t.build_as_dynamic?,
|
|
285
|
+
'swiftVersion' => t.swift_version,
|
|
286
|
+
'swiftVersions' => root.swift_versions.map(&:to_s),
|
|
287
|
+
'targetDefinitions' => t.target_definitions.map(&:label),
|
|
288
|
+
'dependencies' => { 'debug' => t.dependent_targets_by_config[:debug].map(&:label), 'release' => t.dependent_targets_by_config[:release].map(&:label) },
|
|
289
|
+
'inhibitWarnings' => t.inhibit_warnings?,
|
|
290
|
+
'buildPodAsModule' => t.build_pod_as_module?,
|
|
291
|
+
'infoPlist' => root.info_plist,
|
|
292
|
+
'specs' => t.specs.map { |s| spec_json.call(s, t.platform) },
|
|
293
|
+
}
|
|
294
|
+
end,
|
|
295
|
+
'aggregates' => installer.aggregate_targets.map do |t|
|
|
296
|
+
td = t.target_definition
|
|
297
|
+
{
|
|
298
|
+
'label' => t.label,
|
|
299
|
+
'name' => td.name,
|
|
300
|
+
'platform' => { 'name' => t.platform.name.to_s, 'deploymentTarget' => t.platform.deployment_target.to_s },
|
|
301
|
+
'framework' => t.build_as_framework?,
|
|
302
|
+
'userBuildConfigurations' => t.user_build_configurations.transform_values(&:to_s),
|
|
303
|
+
'podsByConfiguration' => t.pod_targets_for_build_configuration.transform_values { |pods| pods.map(&:label) },
|
|
304
|
+
'searchPathsAggregates' => t.search_paths_aggregate_targets.map(&:label),
|
|
305
|
+
'inhibitAllWarnings' => td.inhibits_warnings_for_pod?(''),
|
|
306
|
+
'swiftVersion' => td.swift_version.to_s,
|
|
307
|
+
'setArcCompatibilityFlag' => td.podfile.set_arc_compatibility_flag? ? true : false,
|
|
308
|
+
'userTargets' => t.user_target_uuids,
|
|
309
|
+
'scriptPhases' => td.script_phases,
|
|
310
|
+
}
|
|
311
|
+
end,
|
|
312
|
+
}
|
|
313
|
+
end
|
|
314
|
+
`
|
|
315
|
+
|
|
316
|
+
/** a spec xcconfig value, which a podspec may give as a list. */
|
|
317
|
+
export type XcconfigValue = string | string[]
|
|
318
|
+
|
|
319
|
+
export interface PodConsumer {
|
|
320
|
+
requires_arc: boolean | string | string[]
|
|
321
|
+
frameworks: string[]
|
|
322
|
+
weak_frameworks: string[]
|
|
323
|
+
libraries: string[]
|
|
324
|
+
compiler_flags: string[]
|
|
325
|
+
prefix_header_contents: string | string[] | null
|
|
326
|
+
prefix_header_file: boolean | string | null
|
|
327
|
+
module_map: boolean | string | null
|
|
328
|
+
header_dir: string | null
|
|
329
|
+
header_mappings_dir: string | null
|
|
330
|
+
script_phases: Record<string, unknown>[]
|
|
331
|
+
source_files: string[]
|
|
332
|
+
public_header_files: string[]
|
|
333
|
+
project_header_files: string[]
|
|
334
|
+
private_header_files: string[]
|
|
335
|
+
vendored_frameworks: string[]
|
|
336
|
+
vendored_libraries: string[]
|
|
337
|
+
resource_bundles: Record<string, string | string[]>
|
|
338
|
+
resources: string[]
|
|
339
|
+
exclude_files: string[]
|
|
340
|
+
preserve_paths: string[]
|
|
341
|
+
pod_target_xcconfig: Record<string, XcconfigValue>
|
|
342
|
+
user_target_xcconfig: Record<string, XcconfigValue>
|
|
343
|
+
dependencies: string[]
|
|
344
|
+
on_demand_resources: Record<string, unknown>
|
|
345
|
+
}
|
|
346
|
+
|
|
347
|
+
export interface PodSpec {
|
|
348
|
+
name: string
|
|
349
|
+
root: boolean
|
|
350
|
+
/** the deployment target the spec, or the nearest parent, declares for the pod's platform. */
|
|
351
|
+
deploymentTarget: string | null
|
|
352
|
+
consumer: PodConsumer
|
|
353
|
+
}
|
|
354
|
+
|
|
355
|
+
export interface AnalyzedPodTarget {
|
|
356
|
+
label: string
|
|
357
|
+
name: string
|
|
358
|
+
version: string
|
|
359
|
+
moduleName: string
|
|
360
|
+
/** the development pod's directory, or null for a downloaded pod. */
|
|
361
|
+
local: string | null
|
|
362
|
+
source: Record<string, unknown> | null
|
|
363
|
+
/** the root spec's license as the podspec declares it: a type, or a hash of type, file and text. */
|
|
364
|
+
license: string | Record<string, unknown> | null
|
|
365
|
+
platform: { name: string; deploymentTarget: string }
|
|
366
|
+
framework: boolean
|
|
367
|
+
dynamic: boolean
|
|
368
|
+
swiftVersion: string | null
|
|
369
|
+
swiftVersions: string[]
|
|
370
|
+
targetDefinitions: string[]
|
|
371
|
+
dependencies: { debug: string[]; release: string[] }
|
|
372
|
+
inhibitWarnings: boolean
|
|
373
|
+
buildPodAsModule: boolean
|
|
374
|
+
infoPlist: Record<string, unknown>
|
|
375
|
+
specs: PodSpec[]
|
|
376
|
+
}
|
|
377
|
+
|
|
378
|
+
export interface AnalyzedAggregateTarget {
|
|
379
|
+
label: string
|
|
380
|
+
name: string
|
|
381
|
+
platform: { name: string; deploymentTarget: string }
|
|
382
|
+
framework: boolean
|
|
383
|
+
userBuildConfigurations: Record<string, 'debug' | 'release'>
|
|
384
|
+
podsByConfiguration: Record<string, string[]>
|
|
385
|
+
searchPathsAggregates: string[]
|
|
386
|
+
inhibitAllWarnings: boolean
|
|
387
|
+
/** the Podfile target's swift version, empty when it names none. */
|
|
388
|
+
swiftVersion: string
|
|
389
|
+
setArcCompatibilityFlag: boolean
|
|
390
|
+
/** the user project's native targets this Podfile target integrates. */
|
|
391
|
+
userTargets: string[]
|
|
392
|
+
/** the Podfile target's script_phase declarations, as CocoaPods keeps them. */
|
|
393
|
+
scriptPhases: Record<string, unknown>[]
|
|
394
|
+
}
|
|
395
|
+
|
|
396
|
+
export interface PodsAnalysis {
|
|
397
|
+
installer: RObject
|
|
398
|
+
pods: AnalyzedPodTarget[]
|
|
399
|
+
aggregates: AnalyzedAggregateTarget[]
|
|
400
|
+
}
|
|
401
|
+
|
|
402
|
+
const isRecord = (value: unknown): value is Record<string, unknown> =>
|
|
403
|
+
typeof value === 'object' && value !== null && !Array.isArray(value)
|
|
404
|
+
|
|
405
|
+
/**
|
|
406
|
+
* the targets `pod install` generates for the resolved Podfile, after its
|
|
407
|
+
* pre_install hooks ran. `userBuildConfigurations` are the application's
|
|
408
|
+
* configuration names and types; `userProject` is the Ruby object the hooks
|
|
409
|
+
* see as the application's project.
|
|
410
|
+
*/
|
|
411
|
+
export function analyzePods(
|
|
412
|
+
resolved: ResolvedPodfile,
|
|
413
|
+
user: {
|
|
414
|
+
buildConfigurations: Record<string, 'debug' | 'release'>
|
|
415
|
+
project: Value
|
|
416
|
+
targetIds: string[]
|
|
417
|
+
/** the application targets' SWIFT_VERSION, which CocoaPods' target inspection gives the Podfile target. */
|
|
418
|
+
swiftVersion: string | null
|
|
419
|
+
},
|
|
420
|
+
): PodsAnalysis {
|
|
421
|
+
const userBuildConfigurations = user.buildConfigurations
|
|
422
|
+
const { interp, file, podfile, sandbox, resolver } = resolved
|
|
423
|
+
return rubyFailures(file, () => {
|
|
424
|
+
interp.evalString(ANALYSIS, 'cocoapods/installer/analyzer')
|
|
425
|
+
const pod = interp.object.consts.get('Pod')
|
|
426
|
+
const installerClass =
|
|
427
|
+
pod instanceof RModule ? interp.constIn(pod, 'Installer', null, '-') : null
|
|
428
|
+
const installer = interp.callMethod(
|
|
429
|
+
installerClass,
|
|
430
|
+
'new',
|
|
431
|
+
[sandbox, podfile],
|
|
432
|
+
null,
|
|
433
|
+
null,
|
|
434
|
+
null,
|
|
435
|
+
null,
|
|
436
|
+
)
|
|
437
|
+
if (!(installer instanceof RObject))
|
|
438
|
+
throw new Error('Pod::Installer.new returned no object')
|
|
439
|
+
const configurations = interp.evalString(
|
|
440
|
+
`{ ${Object.entries(userBuildConfigurations)
|
|
441
|
+
.map(([name, type]) => `${JSON.stringify(name)} => :${type}`)
|
|
442
|
+
.join(', ')} }`,
|
|
443
|
+
'user_build_configurations',
|
|
444
|
+
)
|
|
445
|
+
interp.callMethod(
|
|
446
|
+
installer,
|
|
447
|
+
'peach_analyze',
|
|
448
|
+
[
|
|
449
|
+
resolver,
|
|
450
|
+
configurations,
|
|
451
|
+
user.project,
|
|
452
|
+
user.targetIds.map((id) => str(id)),
|
|
453
|
+
user.swiftVersion === null ? null : str(user.swiftVersion),
|
|
454
|
+
],
|
|
455
|
+
null,
|
|
456
|
+
null,
|
|
457
|
+
null,
|
|
458
|
+
null,
|
|
459
|
+
)
|
|
460
|
+
const exporter = interp.evalString(EXPORT, 'peach/analysis')
|
|
461
|
+
const json = toJson(
|
|
462
|
+
interp,
|
|
463
|
+
interp.callMethod(
|
|
464
|
+
exporter,
|
|
465
|
+
'call',
|
|
466
|
+
[installer, CONSUMER_ATTRIBUTES.map((name) => str(name))],
|
|
467
|
+
null,
|
|
468
|
+
null,
|
|
469
|
+
null,
|
|
470
|
+
null,
|
|
471
|
+
),
|
|
472
|
+
)
|
|
473
|
+
if (!isRecord(json) || !Array.isArray(json.pods) || !Array.isArray(json.aggregates))
|
|
474
|
+
throw new Error('the pod analysis exported no targets')
|
|
475
|
+
return {
|
|
476
|
+
installer,
|
|
477
|
+
pods: json.pods.filter(isAnalyzedPod),
|
|
478
|
+
aggregates: json.aggregates.filter(isAnalyzedAggregate),
|
|
479
|
+
}
|
|
480
|
+
})
|
|
481
|
+
}
|
|
482
|
+
|
|
483
|
+
const isAnalyzedPod = (value: unknown): value is AnalyzedPodTarget =>
|
|
484
|
+
isRecord(value) && typeof value.label === 'string' && Array.isArray(value.specs)
|
|
485
|
+
const isAnalyzedAggregate = (value: unknown): value is AnalyzedAggregateTarget =>
|
|
486
|
+
isRecord(value) &&
|
|
487
|
+
typeof value.label === 'string' &&
|
|
488
|
+
isRecord(value.podsByConfiguration)
|