16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
|
# File 'lib/cocoapods-tj/native/podfile_generator.rb', line 16
def podfile_for_spec(spec)
generator = self
dir = configuration.gen_dir_for_pod(spec.name)
Pod::Podfile.new do
project "#{spec.name}.xcodeproj"
workspace "#{spec.name}.xcworkspace"
plugin 'cocoapods-generate'
install! 'cocoapods', generator.installation_options
generator.podfile_plugins.each do |name, options|
plugin(*[name, options].compact)
end
use_frameworks!(generator.configuration.use_frameworks?)
if (supported_swift_versions = generator.supported_swift_versions)
supports_swift_versions(supported_swift_versions)
end
generator.configuration.sources.each do |source_url|
source(source_url)
end
self.defined_in_file = dir.join('CocoaPods.podfile.yaml')
test_specs = spec.recursive_subspecs.select(&:test_specification?)
app_specs = if spec.respond_to?(:app_specification?)
spec.recursive_subspecs.select(&:app_specification?)
else
[]
end
spec_platform_names = spec.available_platforms.map(&:string_name).flatten.each.reject do |platform_name|
!generator.configuration.platforms.nil? && !generator.configuration.platforms.include?(platform_name.downcase)
end
spec_platform_names.sort.each do |platform_name|
target "App-#{platform_name}" do
current_target_definition.swift_version = generator.swift_version if generator.swift_version
end
end
inhibit_all_warnings! if generator.inhibit_all_warnings?
if generator.
pod_options = generator.dependency_compilation_kwargs(spec.name)
pod_options[:path] = spec.defined_in_file.relative_path_from(dir).to_s
{ testspecs: test_specs, appspecs: app_specs }.each do |key, specs|
pod_options[key] = specs.map { |s| s.name.sub(%r{^#{Regexp.escape spec.root.name}/}, '') }.sort unless specs.empty?
end
pod spec.name, **pod_options
if Pod::Config.instance.podfile
target_definitions['Pods'].instance_exec do
target_definition = nil
Pod::Config.instance.podfile.target_definition_list.each do |target|
if target.label == "Pods-#{spec.name}"
target_definition = target
break
end
end
if(target_definition && target_definition..values.any?)
target_definition..values.each do |f|
f.each { | pod_name| self.(pod_name, true) }
end
end
if target_definition
value = target_definition.to_hash['dependencies']
next if value.blank?
value.each do |f|
if f.is_a?(Hash) && f.keys.first == spec.name
value.delete f
break
end
end
old_value = self.to_hash['dependencies'].first
value << old_value unless (old_value == nil || value.include?(old_value))
set_hash_value(%w(dependencies).first, value)
value = target_definition.to_hash['configuration_pod_whitelist']
next if value.blank?
set_hash_value(%w(configuration_pod_whitelist).first, value)
end
end
end
next if generator.configuration.local_sources.empty?
generator.transitive_local_dependencies(spec, generator.configuration.local_sources).each do |dependency, podspec_file|
pod_options = generator.dependency_compilation_kwargs(dependency.name)
pod_options[:path] = if podspec_file[0] == '/' podspec_file
else
'../../' + podspec_file
end
pod dependency.name, **pod_options
end
end
end
|