pod-builder 1.9.2 → 2.0.0.beta.19
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.
- checksums.yaml +4 -4
- data/.gitignore +9 -0
- data/Example/Frameworks/.gitignore +6 -0
- data/Example/Frameworks/.pod_builder/pod_builder +0 -0
- data/Example/Frameworks/PodBuilder.json +10 -4
- data/Example/Frameworks/Podfile +23 -0
- data/Example/Frameworks/Podfile.restore +40 -0
- data/Example/PodBuilderExample.xcodeproj/project.pbxproj +3 -8
- data/Example/{PodBuilderExample.xcodeproj/xcuserdata/tomas.xcuserdatad/xcschemes/xcschememanagement.plist → PodBuilderExample.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist} +2 -8
- data/Example/PodBuilderExample/AppDelegate.swift +4 -0
- data/Example/Podfile +44 -1
- data/Example/Podfile.lock +426 -7
- data/Example/Pods-acknowledgements.md +210 -0
- data/Example/Pods-acknowledgements.plist +206 -0
- data/README.md +38 -1
- data/exe/pod_builder +14 -14
- data/lib/pod_builder/analyze.rb +32 -7
- data/lib/pod_builder/analyzer.rb +16 -0
- data/lib/pod_builder/command/build.rb +110 -96
- data/lib/pod_builder/command/clean.rb +9 -11
- data/lib/pod_builder/command/clear_lldbinit.rb +1 -1
- data/lib/pod_builder/command/deintegrate.rb +2 -1
- data/lib/pod_builder/command/generate_lfs.rb +2 -2
- data/lib/pod_builder/command/install_sources.rb +1 -1
- data/lib/pod_builder/command/switch.rb +99 -99
- data/lib/pod_builder/command/sync_podfile.rb +2 -1
- data/lib/pod_builder/command/update.rb +1 -1
- data/lib/pod_builder/command/update_lldbinit.rb +2 -2
- data/lib/pod_builder/configuration.rb +62 -7
- data/lib/pod_builder/core.rb +60 -5
- data/lib/pod_builder/info.rb +24 -90
- data/lib/pod_builder/install.rb +149 -83
- data/lib/pod_builder/podfile.rb +87 -14
- data/lib/pod_builder/podfile/post_actions.rb +0 -1
- data/lib/pod_builder/podfile_item.rb +152 -74
- data/lib/pod_builder/podspec.rb +125 -133
- data/lib/pod_builder/rome/post_install.rb +248 -0
- data/lib/pod_builder/rome/pre_install.rb +6 -0
- data/lib/pod_builder/templates/build_podfile.template +1 -1
- data/lib/pod_builder/version.rb +1 -1
- data/pod-builder.gemspec +4 -4
- metadata +32 -64
- data/Example/Pods/Alamofire/LICENSE +0 -19
- data/Example/Pods/Alamofire/README.md +0 -242
- data/Example/Pods/Alamofire/Source/AFError.swift +0 -460
- data/Example/Pods/Alamofire/Source/Alamofire.swift +0 -465
- data/Example/Pods/Alamofire/Source/DispatchQueue+Alamofire.swift +0 -37
- data/Example/Pods/Alamofire/Source/MultipartFormData.swift +0 -580
- data/Example/Pods/Alamofire/Source/NetworkReachabilityManager.swift +0 -233
- data/Example/Pods/Alamofire/Source/Notifications.swift +0 -55
- data/Example/Pods/Alamofire/Source/ParameterEncoding.swift +0 -483
- data/Example/Pods/Alamofire/Source/Request.swift +0 -654
- data/Example/Pods/Alamofire/Source/Response.swift +0 -567
- data/Example/Pods/Alamofire/Source/ResponseSerialization.swift +0 -715
- data/Example/Pods/Alamofire/Source/Result.swift +0 -300
- data/Example/Pods/Alamofire/Source/ServerTrustPolicy.swift +0 -307
- data/Example/Pods/Alamofire/Source/SessionDelegate.swift +0 -725
- data/Example/Pods/Alamofire/Source/SessionManager.swift +0 -896
- data/Example/Pods/Alamofire/Source/TaskDelegate.swift +0 -466
- data/Example/Pods/Alamofire/Source/Timeline.swift +0 -136
- data/Example/Pods/Alamofire/Source/Validation.swift +0 -315
- data/Example/Pods/Manifest.lock +0 -16
- data/Example/Pods/Pods.xcodeproj/project.pbxproj +0 -673
- data/Example/Pods/Pods.xcodeproj/xcuserdata/tomas.xcuserdatad/xcschemes/Alamofire.xcscheme +0 -60
- data/Example/Pods/Pods.xcodeproj/xcuserdata/tomas.xcuserdatad/xcschemes/Pods-PodBuilderExample.xcscheme +0 -60
- data/Example/Pods/Pods.xcodeproj/xcuserdata/tomas.xcuserdatad/xcschemes/xcschememanagement.plist +0 -21
- data/Example/Pods/Target Support Files/Alamofire/Alamofire-dummy.m +0 -5
- data/Example/Pods/Target Support Files/Alamofire/Alamofire-prefix.pch +0 -12
- data/Example/Pods/Target Support Files/Alamofire/Alamofire-umbrella.h +0 -16
- data/Example/Pods/Target Support Files/Alamofire/Alamofire.modulemap +0 -6
- data/Example/Pods/Target Support Files/Alamofire/Alamofire.xcconfig +0 -9
- data/Example/Pods/Target Support Files/Alamofire/Info.plist +0 -26
- data/Example/Pods/Target Support Files/Pods-PodBuilderExample/Info.plist +0 -26
- data/Example/Pods/Target Support Files/Pods-PodBuilderExample/Pods-PodBuilderExample-acknowledgements.markdown +0 -26
- data/Example/Pods/Target Support Files/Pods-PodBuilderExample/Pods-PodBuilderExample-acknowledgements.plist +0 -58
- data/Example/Pods/Target Support Files/Pods-PodBuilderExample/Pods-PodBuilderExample-dummy.m +0 -5
- data/Example/Pods/Target Support Files/Pods-PodBuilderExample/Pods-PodBuilderExample-frameworks.sh +0 -153
- data/Example/Pods/Target Support Files/Pods-PodBuilderExample/Pods-PodBuilderExample-resources.sh +0 -118
- data/Example/Pods/Target Support Files/Pods-PodBuilderExample/Pods-PodBuilderExample-umbrella.h +0 -16
- data/Example/Pods/Target Support Files/Pods-PodBuilderExample/Pods-PodBuilderExample.debug.xcconfig +0 -11
- data/Example/Pods/Target Support Files/Pods-PodBuilderExample/Pods-PodBuilderExample.modulemap +0 -6
- data/Example/Pods/Target Support Files/Pods-PodBuilderExample/Pods-PodBuilderExample.release.xcconfig +0 -11
- data/lib/pod_builder/cocoapods/specification.rb +0 -27
data/lib/pod_builder/podfile.rb
CHANGED
@@ -6,7 +6,7 @@ module PodBuilder
|
|
6
6
|
PRE_INSTALL_ACTIONS = ["Pod::Installer::Xcode::TargetValidator.send(:define_method, :verify_no_duplicate_framework_and_library_names) {}"].freeze
|
7
7
|
private_constant :PRE_INSTALL_ACTIONS
|
8
8
|
|
9
|
-
def self.from_podfile_items(items, analyzer)
|
9
|
+
def self.from_podfile_items(items, analyzer, build_configuration)
|
10
10
|
raise "no items" unless items.count > 0
|
11
11
|
|
12
12
|
sources = analyzer.sources
|
@@ -20,9 +20,7 @@ module PodBuilder
|
|
20
20
|
|
21
21
|
podfile.sub!("%%%sources%%%", sources.map { |x| "source '#{x.url}'" }.join("\n"))
|
22
22
|
|
23
|
-
|
24
|
-
raise "Found different build configurations in #{items}" if build_configurations.count != 1
|
25
|
-
podfile.sub!("%%%build_configuration%%%", build_configurations.first.capitalize)
|
23
|
+
podfile.sub!("%%%build_configuration%%%", build_configuration.capitalize)
|
26
24
|
|
27
25
|
podfile_build_settings = ""
|
28
26
|
|
@@ -35,10 +33,27 @@ module PodBuilder
|
|
35
33
|
|
36
34
|
# These settings need to be set as is to properly build frameworks
|
37
35
|
build_settings['SWIFT_COMPILATION_MODE'] = 'wholemodule'
|
38
|
-
build_settings['CLANG_ENABLE_MODULE_DEBUGGING'] = 'NO'
|
39
36
|
build_settings['ONLY_ACTIVE_ARCH'] = 'NO'
|
40
37
|
build_settings['DEBUG_INFORMATION_FORMAT'] = "dwarf-with-dsym"
|
41
38
|
|
39
|
+
build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = platform.deployment_target.version # Fix compilation warnings on Xcode 12
|
40
|
+
|
41
|
+
# Don't store .pcm info in binary, see https://forums.swift.org/t/swift-behavior-of-gmodules-and-dsyms/23211/3
|
42
|
+
build_settings['CLANG_ENABLE_MODULE_DEBUGGING'] = 'NO'
|
43
|
+
build_settings['OTHER_SWIFT_FLAGS'] = "-Xfrontend -no-clang-module-breadcrumbs"
|
44
|
+
|
45
|
+
# Improve compile speed
|
46
|
+
build_settings['COMPILER_INDEX_STORE_ENABLE'] = 'NO'
|
47
|
+
build_settings['SWIFT_INDEX_STORE_ENABLE'] = 'NO'
|
48
|
+
build_settings['MTL_ENABLE_INDEX_STORE'] = 'NO'
|
49
|
+
|
50
|
+
if Configuration.build_system == "Legacy"
|
51
|
+
build_settings['BUILD_LIBRARY_FOR_DISTRIBUTION'] = "NO"
|
52
|
+
raise "\n\nCan't enable library evolution support with legacy build system!" if Configuration.library_evolution_support
|
53
|
+
elsif Configuration.library_evolution_support
|
54
|
+
build_settings['BUILD_LIBRARY_FOR_DISTRIBUTION'] = "YES"
|
55
|
+
end
|
56
|
+
|
42
57
|
build_settings['SWIFT_VERSION'] = item_build_settings["SWIFT_VERSION"] || item.swift_version || project_swift_version(analyzer)
|
43
58
|
|
44
59
|
item_build_settings.each do |k, v|
|
@@ -51,7 +66,7 @@ module PodBuilder
|
|
51
66
|
if x.split("/").first == item.root_name
|
52
67
|
next nil # remove dependency to parent spec
|
53
68
|
end
|
54
|
-
if overridded_module_name = Configuration.spec_overrides.fetch(x, {})["module_name"]
|
69
|
+
if overridded_module_name = Configuration.spec_overrides.fetch(x, {})["module_name"] # this might no longer be needed after
|
55
70
|
next overridded_module_name
|
56
71
|
end
|
57
72
|
}.compact
|
@@ -100,9 +115,6 @@ module PodBuilder
|
|
100
115
|
}
|
101
116
|
end
|
102
117
|
|
103
|
-
multiple_buildable_items = podfile_items.uniq { |t| t.root_name }
|
104
|
-
buildable_items = podfile_items.reject { |t| multiple_buildable_items.map(&:root_name).include?(t.root_name) && t.is_external == false }
|
105
|
-
|
106
118
|
result_targets = analyzer.instance_variable_get("@result").targets.map(&:name)
|
107
119
|
podfile_content = ["# Autogenerated by PodBuilder (https://github.com/Subito-it/PodBuilder)", "# Please don't modify this file", "\n"]
|
108
120
|
podfile_content += analyzer.podfile.sources.map { |x| "source '#{x}'" }
|
@@ -128,7 +140,7 @@ module PodBuilder
|
|
128
140
|
|
129
141
|
specifications.each do |spec|
|
130
142
|
item = podfile_items.detect { |x| x.name == spec.name }
|
131
|
-
if
|
143
|
+
if podfile_items.map(&:name).include?(spec.name)
|
132
144
|
podfile_content.push("\t#{item.entry}")
|
133
145
|
end
|
134
146
|
end
|
@@ -142,6 +154,9 @@ module PodBuilder
|
|
142
154
|
def self.write_prebuilt(all_buildable_items, analyzer)
|
143
155
|
puts "Updating Application Podfile".yellow
|
144
156
|
|
157
|
+
explicit_deps = analyzer.explicit_pods()
|
158
|
+
explicit_deps.map! { |t| all_buildable_items.detect { |x| x.name == t.name } }
|
159
|
+
explicit_deps.uniq!
|
145
160
|
podbuilder_podfile_path = PodBuilder::basepath("Podfile")
|
146
161
|
rel_path = Pathname.new(podbuilder_podfile_path).relative_path_from(Pathname.new(PodBuilder::project_path)).to_s
|
147
162
|
|
@@ -158,18 +173,41 @@ module PodBuilder
|
|
158
173
|
|
159
174
|
if pod_name = pod_definition_in(line, true)
|
160
175
|
if podfile_item = all_buildable_items.detect { |x| x.name == pod_name }
|
161
|
-
if Podspec.include?(podfile_item.
|
176
|
+
if Podspec.include?(podfile_item.root_name)
|
162
177
|
if podfile_item.vendored_framework_path.nil?
|
163
178
|
marker = podfile_item.prebuilt_marker()
|
164
179
|
|
165
180
|
podfile_item_dependency_items = all_buildable_items.select { |x| podfile_item.dependency_names.include?(x.name) && x.vendored_framework_path.nil? == false }
|
166
181
|
if podfile_item_dependency_items.count > 0
|
167
|
-
prebuilt_lines += podfile_item_dependency_items.map { |x| "#{line.detect_indentation}#{x.prebuilt_entry(
|
182
|
+
prebuilt_lines += podfile_item_dependency_items.map { |x| "#{line.detect_indentation}#{x.prebuilt_entry(false)}#{marker}\n" }.uniq
|
168
183
|
else
|
169
184
|
prebuilt_lines.push(line)
|
170
185
|
end
|
171
186
|
else
|
172
187
|
prebuilt_lines.push("#{line.detect_indentation}#{podfile_item.prebuilt_entry}\n")
|
188
|
+
|
189
|
+
marker = podfile_item.prebuilt_marker()
|
190
|
+
non_explicit_dependencies = podfile_item.recursive_dependencies(all_buildable_items) - explicit_deps
|
191
|
+
non_explicit_dependencies_root_names = non_explicit_dependencies.map(&:root_name).uniq.filter { |t| t != podfile_item.root_name }
|
192
|
+
non_explicit_dependencies = non_explicit_dependencies_root_names.map { |x|
|
193
|
+
if item = all_buildable_items.detect { |t| x == t.name }
|
194
|
+
item
|
195
|
+
else
|
196
|
+
item = all_buildable_items.detect { |t| x == t.root_name }
|
197
|
+
end
|
198
|
+
}.compact
|
199
|
+
|
200
|
+
non_explicit_dependencies.each do |dep|
|
201
|
+
dep_item = all_buildable_items.detect { |x| x.name == dep.name }
|
202
|
+
|
203
|
+
if Podspec.include?(dep_item.root_name)
|
204
|
+
pod_name = dep_item.prebuilt_entry(false)
|
205
|
+
pod_name.gsub!(dep.name, dep.root_name)
|
206
|
+
prebuilt_lines.push("#{line.detect_indentation}#{pod_name}#{marker}\n")
|
207
|
+
end
|
208
|
+
|
209
|
+
explicit_deps.push(dep)
|
210
|
+
end
|
173
211
|
end
|
174
212
|
|
175
213
|
next
|
@@ -193,7 +231,8 @@ module PodBuilder
|
|
193
231
|
puts "Running pod install".yellow
|
194
232
|
|
195
233
|
Dir.chdir(PodBuilder::project_path) do
|
196
|
-
|
234
|
+
bundler_prefix = Configuration.use_bundler ? "bundle exec " : ""
|
235
|
+
system("#{bundler_prefix}pod install;")
|
197
236
|
end
|
198
237
|
end
|
199
238
|
|
@@ -249,6 +288,8 @@ module PodBuilder
|
|
249
288
|
return nil
|
250
289
|
end
|
251
290
|
|
291
|
+
puts "Checking Podfile.restore".yellow
|
292
|
+
|
252
293
|
podfile_restore_path = PodBuilder::basepath("Podfile.restore")
|
253
294
|
unless File.exist?(podfile_restore_path)
|
254
295
|
return
|
@@ -294,6 +335,38 @@ module PodBuilder
|
|
294
335
|
end
|
295
336
|
end
|
296
337
|
|
338
|
+
def self.resolve_pod_names(names, all_buildable_items)
|
339
|
+
resolved_names = []
|
340
|
+
|
341
|
+
names.each do |name|
|
342
|
+
if item = all_buildable_items.detect { |t| t.root_name.downcase == name.downcase }
|
343
|
+
resolved_names.push(item.root_name)
|
344
|
+
end
|
345
|
+
end
|
346
|
+
|
347
|
+
return resolved_names.uniq
|
348
|
+
end
|
349
|
+
|
350
|
+
def self.resolve_pod_names_from_podfile(names)
|
351
|
+
resolved_names = []
|
352
|
+
|
353
|
+
# resolve potentially wrong pod name case
|
354
|
+
podfile_path = PodBuilder::basepath("Podfile")
|
355
|
+
content = File.read(podfile_path)
|
356
|
+
|
357
|
+
current_section = ""
|
358
|
+
content.each_line do |line|
|
359
|
+
matches = line.gsub("\"", "'").match(/pod '(.*?)'/)
|
360
|
+
if matches&.size == 2
|
361
|
+
if resolved_name = names.detect { |t| matches[1].split("/").first.downcase == t.downcase }
|
362
|
+
resolved_names.push(matches[1].split("/").first)
|
363
|
+
end
|
364
|
+
end
|
365
|
+
end
|
366
|
+
|
367
|
+
resolved_names.uniq
|
368
|
+
end
|
369
|
+
|
297
370
|
private
|
298
371
|
|
299
372
|
def self.indentation_from_file(path)
|
@@ -406,7 +479,7 @@ module PodBuilder
|
|
406
479
|
path = matches[6]
|
407
480
|
|
408
481
|
is_absolute = ["~", "/"].include?(path[0])
|
409
|
-
unless !
|
482
|
+
unless !PodBuilder::prebuiltpath.end_with?(path) && !is_absolute
|
410
483
|
podfile_lines.push(line)
|
411
484
|
next
|
412
485
|
end
|
@@ -1,5 +1,3 @@
|
|
1
|
-
require 'pod_builder/cocoapods/specification'
|
2
|
-
|
3
1
|
module PodBuilder
|
4
2
|
class PodfileItem
|
5
3
|
# @return [String] The git repo
|
@@ -10,6 +8,10 @@ module PodBuilder
|
|
10
8
|
#
|
11
9
|
attr_reader :branch
|
12
10
|
|
11
|
+
# @return [String] A checksum for the spec
|
12
|
+
#
|
13
|
+
attr_reader :checksum
|
14
|
+
|
13
15
|
# @return [String] Matches @name unless for subspecs were it stores the name of the root pod
|
14
16
|
#
|
15
17
|
attr_reader :root_name
|
@@ -49,6 +51,10 @@ module PodBuilder
|
|
49
51
|
# @return [Array<String>] The pod's dependency names, if any. Use dependencies() to get the [Array<PodfileItem>]
|
50
52
|
#
|
51
53
|
attr_reader :dependency_names
|
54
|
+
|
55
|
+
# @return [Array<String>] The pod's external dependency names (excluding subspecs), if any
|
56
|
+
#
|
57
|
+
attr_reader :external_dependency_names
|
52
58
|
|
53
59
|
# @return [Bool] True if the pod is shipped as a static framework
|
54
60
|
#
|
@@ -66,9 +72,13 @@ module PodBuilder
|
|
66
72
|
#
|
67
73
|
attr_accessor :build_configuration
|
68
74
|
|
69
|
-
# @return [String] The pod's vendored
|
75
|
+
# @return [String] The pod's vendored frameworks
|
70
76
|
#
|
71
|
-
attr_accessor :
|
77
|
+
attr_accessor :vendored_frameworks
|
78
|
+
|
79
|
+
# @return [String] The pod's vendored libraries
|
80
|
+
#
|
81
|
+
attr_accessor :vendored_libraries
|
72
82
|
|
73
83
|
# @return [String] Framweworks the pod needs to link to
|
74
84
|
#
|
@@ -86,25 +96,42 @@ module PodBuilder
|
|
86
96
|
#
|
87
97
|
attr_accessor :source_files
|
88
98
|
|
99
|
+
# @return [String] license
|
100
|
+
#
|
101
|
+
attr_accessor :license
|
102
|
+
|
103
|
+
# @return [String] summary
|
104
|
+
#
|
105
|
+
attr_accessor :summary
|
106
|
+
|
107
|
+
# @return [Hash] source
|
108
|
+
#
|
109
|
+
attr_accessor :source
|
110
|
+
|
111
|
+
# @return [Hash] authors
|
112
|
+
#
|
113
|
+
attr_accessor :authors
|
114
|
+
|
115
|
+
# @return [String] homepage
|
116
|
+
#
|
117
|
+
attr_accessor :homepage
|
118
|
+
|
119
|
+
# @return [Array<String>] Default subspecs
|
120
|
+
#
|
121
|
+
attr_accessor :default_subspecs
|
122
|
+
|
89
123
|
# Initialize a new instance
|
90
124
|
#
|
91
125
|
# @param [Specification] spec
|
92
126
|
#
|
93
127
|
# @param [Hash] checkout_options
|
94
128
|
#
|
95
|
-
def initialize(spec, all_specs, checkout_options)
|
96
|
-
if overrides = Configuration.spec_overrides[spec.name]
|
97
|
-
overrides.each do |k, v|
|
98
|
-
spec.root.attributes_hash[k] = v
|
99
|
-
if checkout_options.has_key?(spec.name)
|
100
|
-
checkout_options[spec.name][k] = v
|
101
|
-
end
|
102
|
-
end
|
103
|
-
end
|
104
|
-
|
129
|
+
def initialize(spec, all_specs, checkout_options, supported_platforms)
|
105
130
|
@name = spec.name
|
106
131
|
@root_name = spec.name.split("/").first
|
107
132
|
|
133
|
+
@checksum = spec.checksum
|
134
|
+
|
108
135
|
checkout_options_keys = [@root_name, @name]
|
109
136
|
|
110
137
|
if opts_key = checkout_options_keys.detect { |x| checkout_options.has_key?(x) }
|
@@ -120,22 +147,22 @@ module PodBuilder
|
|
120
147
|
@commit = spec.root.source[:commit]
|
121
148
|
@is_external = false
|
122
149
|
end
|
123
|
-
|
124
|
-
@
|
150
|
+
|
151
|
+
@vendored_frameworks = extract_vendored_frameworks(spec, all_specs)
|
152
|
+
@vendored_libraries = extract_vendored_libraries(spec, all_specs)
|
125
153
|
|
126
154
|
@frameworks = []
|
127
155
|
@weak_frameworks = []
|
128
156
|
@libraries = []
|
129
|
-
spec_and_dependencies(spec, all_specs).each do |spec|
|
130
|
-
@frameworks += extract_array(spec, "framework")
|
131
|
-
@frameworks += extract_array(spec, "frameworks")
|
132
|
-
|
133
|
-
@weak_frameworks += extract_array(spec, "weak_framework")
|
134
|
-
@weak_frameworks += extract_array(spec, "weak_frameworks")
|
135
157
|
|
136
|
-
|
137
|
-
|
138
|
-
|
158
|
+
@frameworks += extract_array(spec, "framework")
|
159
|
+
@frameworks += extract_array(spec, "frameworks")
|
160
|
+
|
161
|
+
@weak_frameworks += extract_array(spec, "weak_framework")
|
162
|
+
@weak_frameworks += extract_array(spec, "weak_frameworks")
|
163
|
+
|
164
|
+
@libraries += extract_array(spec, "library")
|
165
|
+
@libraries += extract_array(spec, "libraries")
|
139
166
|
|
140
167
|
@version = spec.root.version.version
|
141
168
|
@available_versions = spec.respond_to?(:spec_source) ? spec.spec_source.versions(@root_name)&.map(&:to_s) : [@version]
|
@@ -143,7 +170,18 @@ module PodBuilder
|
|
143
170
|
@swift_version = spec.root.swift_version&.to_s
|
144
171
|
@module_name = spec.root.module_name
|
145
172
|
|
146
|
-
@
|
173
|
+
@default_subspecs = extract_array(spec, "default_subspecs")
|
174
|
+
if default_subspec = spec.attributes_hash["default_subspec"]
|
175
|
+
@default_subspecs.push(default_subspec)
|
176
|
+
end
|
177
|
+
|
178
|
+
@dependency_names = spec.attributes_hash.fetch("dependencies", {}).keys + default_subspecs.map { |t| "#{@root_name}/#{t}" }
|
179
|
+
supported_platforms.each do |platform|
|
180
|
+
@dependency_names += (spec.attributes_hash.dig(platform, "dependencies") || {}).keys
|
181
|
+
end
|
182
|
+
@dependency_names.uniq!
|
183
|
+
|
184
|
+
@external_dependency_names = @dependency_names.select { |t| !t.start_with?(root_name) }
|
147
185
|
|
148
186
|
@is_static = spec.root.attributes_hash["static_framework"] || false
|
149
187
|
@xcconfig = spec.root.attributes_hash["xcconfig"] || {}
|
@@ -152,6 +190,13 @@ module PodBuilder
|
|
152
190
|
|
153
191
|
@build_configuration = spec.root.attributes_hash.dig("pod_target_xcconfig", "prebuild_configuration") || "release"
|
154
192
|
@build_configuration.downcase!
|
193
|
+
|
194
|
+
default_license = "MIT"
|
195
|
+
@license = spec.root.attributes_hash.fetch("license", {"type"=>"#{default_license}"})["type"] || default_license
|
196
|
+
@summary = spec.root.attributes_hash.fetch("summary", "A summary for #{@name}")
|
197
|
+
@source = spec.root.attributes_hash.fetch("source", { "git"=>"https://github.com/Subito-it/PodBuilder.git" })
|
198
|
+
@authors = spec.root.attributes_hash.fetch("authors", {"PodBuilder"=>"pod@podbuilder.com"})
|
199
|
+
@homepage = spec.root.attributes_hash.fetch("homepage", "https://github.com/Subito-it/PodBuilder")
|
155
200
|
end
|
156
201
|
|
157
202
|
def pod_specification(all_poditems, parent_spec = nil)
|
@@ -204,6 +249,43 @@ module PodBuilder
|
|
204
249
|
return available_pods.select { |x| @dependency_names.include?(x.name) }
|
205
250
|
end
|
206
251
|
|
252
|
+
def recursive_dependencies(available_pods)
|
253
|
+
names = [name]
|
254
|
+
|
255
|
+
deps = []
|
256
|
+
last_count = -1
|
257
|
+
while deps.count != last_count do
|
258
|
+
last_count = deps.count
|
259
|
+
|
260
|
+
updated_names = []
|
261
|
+
names.each do |name|
|
262
|
+
if pod = available_pods.detect { |t| t.name == name }
|
263
|
+
deps.push(pod)
|
264
|
+
updated_names += pod.dependency_names
|
265
|
+
end
|
266
|
+
end
|
267
|
+
|
268
|
+
names = updated_names.uniq
|
269
|
+
|
270
|
+
deps.uniq!
|
271
|
+
end
|
272
|
+
|
273
|
+
root_names = deps.map(&:root_name).uniq
|
274
|
+
|
275
|
+
# We need to build all other common subspecs to properly build the framework
|
276
|
+
# Ex.
|
277
|
+
# PodA depends on DepA/subspec1
|
278
|
+
# PodB depends on DepA/subspec2
|
279
|
+
#
|
280
|
+
# When building PodA we need to build both DepA subspecs because they might
|
281
|
+
# contain different code
|
282
|
+
deps += available_pods.select { |t| root_names.include?(t.root_name) }
|
283
|
+
|
284
|
+
deps.uniq!
|
285
|
+
|
286
|
+
return deps
|
287
|
+
end
|
288
|
+
|
207
289
|
# @return [Bool] True if it's a pod that doesn't provide source code (is already shipped as a prebuilt pod)
|
208
290
|
#
|
209
291
|
def is_prebuilt
|
@@ -218,14 +300,17 @@ module PodBuilder
|
|
218
300
|
|
219
301
|
# Podspecs aren't always properly written (source_file key is often used instead of header_files)
|
220
302
|
# Therefore it can become tricky to understand which pods are already precompiled by boxing a .framework or .a
|
221
|
-
|
222
|
-
|
223
|
-
embedded_as_static_lib = vendored_items_paths.any? { |x| x.match(/#{module_name}.*\\.a/) != nil }
|
303
|
+
embedded_as_vendored = vendored_frameworks.map { |x| File.basename(x) }.include?("#{module_name}.framework")
|
304
|
+
embedded_as_static_lib = vendored_libraries.map { |x| File.basename(x) }.include?("lib#{module_name}.a")
|
224
305
|
|
225
306
|
only_headers = (source_files.count > 0 && @source_files.all? { |x| x.end_with?(".h") })
|
226
|
-
no_sources = (@source_files.count == 0 || only_headers) && @
|
307
|
+
no_sources = (@source_files.count == 0 || only_headers) && (@vendored_frameworks + @vendored_libraries).count > 0
|
227
308
|
|
228
|
-
|
309
|
+
if !no_sources && !only_headers
|
310
|
+
return false
|
311
|
+
else
|
312
|
+
return embedded_as_static_lib || embedded_as_vendored
|
313
|
+
end
|
229
314
|
end
|
230
315
|
|
231
316
|
# @return [Bool] True if it's a subspec
|
@@ -271,7 +356,7 @@ module PodBuilder
|
|
271
356
|
end
|
272
357
|
|
273
358
|
if include_pb_entry && !is_prebuilt
|
274
|
-
plists = Dir.glob(PodBuilder::
|
359
|
+
plists = Dir.glob(PodBuilder::prebuiltpath("**/#{module_name}.framework/#{Configuration::framework_plist_filename}"))
|
275
360
|
if plists.count > 0
|
276
361
|
plist = CFPropertyList::List.new(:file => plists.first)
|
277
362
|
data = CFPropertyList.native_types(plist.value)
|
@@ -302,15 +387,18 @@ module PodBuilder
|
|
302
387
|
end
|
303
388
|
end
|
304
389
|
|
305
|
-
def prebuilt_entry(include_pb_entry = true)
|
306
|
-
|
390
|
+
def prebuilt_entry(include_pb_entry = true, absolute_path = false)
|
391
|
+
if absolute_path
|
392
|
+
pod_path = PodBuilder::prebuiltpath
|
393
|
+
else
|
394
|
+
pod_path = Pathname.new(Configuration.base_path).relative_path_from(Pathname.new(PodBuilder::project_path)).to_s
|
395
|
+
pod_path += "/Rome"
|
396
|
+
end
|
307
397
|
|
308
398
|
if Configuration.subspecs_to_split.include?(name)
|
309
|
-
entry = "pod '
|
310
|
-
elsif override_name = Configuration.spec_overrides.dig(name, "module_name")
|
311
|
-
entry = "pod 'PodBuilder/#{override_name}', :path => '#{relative_path}'"
|
399
|
+
entry = "pod '#{podspec_name}', :path => '#{pod_path}'"
|
312
400
|
else
|
313
|
-
entry = "pod '
|
401
|
+
entry = "pod '#{name}', :path => '#{pod_path}'"
|
314
402
|
end
|
315
403
|
|
316
404
|
if include_pb_entry && !is_prebuilt
|
@@ -337,45 +425,48 @@ module PodBuilder
|
|
337
425
|
end
|
338
426
|
|
339
427
|
def vendored_framework_path
|
340
|
-
if File.exist?(PodBuilder::
|
341
|
-
return
|
342
|
-
elsif File.exist?(PodBuilder::
|
343
|
-
return
|
428
|
+
if File.exist?(PodBuilder::prebuiltpath(vendored_subspec_framework_name))
|
429
|
+
return vendored_subspec_framework_name
|
430
|
+
elsif File.exist?(PodBuilder::prebuiltpath(vendored_spec_framework_name))
|
431
|
+
return vendored_spec_framework_name
|
344
432
|
end
|
345
433
|
|
346
434
|
return nil
|
347
435
|
end
|
348
436
|
|
349
|
-
def
|
350
|
-
return "
|
437
|
+
def vendored_subspec_framework_name
|
438
|
+
return "#{prebuilt_rel_path}"
|
351
439
|
end
|
352
440
|
|
353
|
-
def
|
354
|
-
return "
|
355
|
-
end
|
356
|
-
|
357
|
-
def self.vendored_name_framework_path(name)
|
358
|
-
return "Rome/#{name}"
|
441
|
+
def vendored_spec_framework_name
|
442
|
+
return "#{module_name}.framework"
|
359
443
|
end
|
360
444
|
|
361
445
|
private
|
362
446
|
|
363
|
-
def
|
447
|
+
def extract_vendored_frameworks(spec, all_specs)
|
364
448
|
items = []
|
365
449
|
|
366
450
|
supported_platforms = spec.available_platforms.flatten.map(&:name).map(&:to_s)
|
451
|
+
items += [spec.attributes_hash["vendored_frameworks"]]
|
452
|
+
items += [spec.attributes_hash["vendored_framework"]]
|
367
453
|
|
368
|
-
|
369
|
-
|
370
|
-
items += [spec.attributes_hash["vendored_framework"]]
|
371
|
-
items += [spec.attributes_hash["vendored_libraries"]]
|
372
|
-
items += [spec.attributes_hash["vendored_library"]]
|
454
|
+
items += supported_platforms.map { |x| spec.attributes_hash.fetch(x, {})["vendored_frameworks"] }
|
455
|
+
items += supported_platforms.map { |x| spec.attributes_hash.fetch(x, {})["vendored_framework"] }
|
373
456
|
|
374
|
-
|
375
|
-
|
376
|
-
|
377
|
-
|
378
|
-
|
457
|
+
return items.flatten.uniq.compact
|
458
|
+
end
|
459
|
+
|
460
|
+
def extract_vendored_libraries(spec, all_specs)
|
461
|
+
items = []
|
462
|
+
|
463
|
+
supported_platforms = spec.available_platforms.flatten.map(&:name).map(&:to_s)
|
464
|
+
|
465
|
+
items += [spec.attributes_hash["vendored_libraries"]]
|
466
|
+
items += [spec.attributes_hash["vendored_library"]]
|
467
|
+
|
468
|
+
items += supported_platforms.map { |x| spec.attributes_hash.fetch(x, {})["vendored_libraries"] }
|
469
|
+
items += supported_platforms.map { |x| spec.attributes_hash.fetch(x, {})["vendored_library"] }
|
379
470
|
|
380
471
|
return items.flatten.uniq.compact
|
381
472
|
end
|
@@ -429,18 +520,5 @@ module PodBuilder
|
|
429
520
|
|
430
521
|
return source_files + root_source_files + subspec_source_files
|
431
522
|
end
|
432
|
-
|
433
|
-
def spec_and_dependencies(spec, all_specs)
|
434
|
-
specs = all_specs.select { |x| spec.dependencies.map(&:name).include?(x.name) }
|
435
|
-
specs += all_specs.select { |x| spec.default_subspecs.any? { |y| x.name == "#{spec.name}/#{y}" } }
|
436
|
-
specs += [spec, spec.root].flatten.uniq
|
437
|
-
|
438
|
-
all_remaining_specs = all_specs.reject { |x| specs.map(&:name).include?(x.name) }
|
439
|
-
if all_remaining_specs.count < all_specs.count
|
440
|
-
specs += specs.reject { |x| x == spec }.map { |x| spec_and_dependencies(x, all_remaining_specs) }
|
441
|
-
end
|
442
|
-
|
443
|
-
return specs.flatten.compact.uniq
|
444
|
-
end
|
445
523
|
end
|
446
524
|
end
|