pod-builder 1.9.4 → 2.0.0.beta.23
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/README.md +50 -13
- data/exe/pod_builder +39 -28
- data/lib/pod_builder/analyze.rb +32 -7
- data/lib/pod_builder/analyzer.rb +16 -0
- data/lib/pod_builder/command/build.rb +44 -174
- data/lib/pod_builder/command/build_all.rb +2 -2
- data/lib/pod_builder/command/clean.rb +34 -55
- data/lib/pod_builder/command/clear_lldbinit.rb +7 -3
- data/lib/pod_builder/command/deintegrate.rb +29 -7
- data/lib/pod_builder/command/generate_lfs.rb +3 -3
- data/lib/pod_builder/command/generate_podspec.rb +3 -2
- data/lib/pod_builder/command/info.rb +1 -1
- data/lib/pod_builder/command/init.rb +37 -14
- data/lib/pod_builder/command/install_sources.rb +21 -14
- data/lib/pod_builder/command/none.rb +2 -2
- data/lib/pod_builder/command/restore_all.rb +4 -4
- data/lib/pod_builder/command/switch.rb +137 -95
- data/lib/pod_builder/command/sync_podfile.rb +5 -3
- data/lib/pod_builder/command/update.rb +5 -6
- data/lib/pod_builder/command/update_lldbinit.rb +11 -9
- data/lib/pod_builder/configuration.rb +88 -13
- data/lib/pod_builder/core.rb +95 -14
- data/lib/pod_builder/info.rb +32 -98
- data/lib/pod_builder/install.rb +255 -195
- data/lib/pod_builder/licenses.rb +4 -4
- data/lib/pod_builder/podfile.rb +300 -73
- data/lib/pod_builder/podfile/post_actions.rb +9 -15
- data/lib/pod_builder/podfile_cp.rb +93 -0
- data/lib/pod_builder/podfile_item.rb +181 -82
- data/lib/pod_builder/podspec.rb +144 -135
- data/lib/pod_builder/rome/post_install.rb +240 -0
- data/lib/pod_builder/rome/pre_install.rb +6 -0
- data/lib/pod_builder/templates/build_podfile.template +3 -3
- data/lib/pod_builder/version.rb +1 -1
- data/pod-builder.gemspec +5 -5
- metadata +23 -76
- data/Example/Frameworks/PodBuilder.json +0 -32
- data/Example/PodBuilderExample.xcodeproj/project.pbxproj +0 -416
- data/Example/PodBuilderExample.xcodeproj/project.xcworkspace/contents.xcworkspacedata +0 -7
- data/Example/PodBuilderExample.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +0 -8
- data/Example/PodBuilderExample.xcodeproj/project.xcworkspace/xcuserdata/tomas.xcuserdatad/UserInterfaceState.xcuserstate +0 -0
- data/Example/PodBuilderExample.xcodeproj/xcuserdata/tomas.xcuserdatad/xcschemes/xcschememanagement.plist +0 -14
- data/Example/PodBuilderExample.xcworkspace/contents.xcworkspacedata +0 -10
- data/Example/PodBuilderExample/AppDelegate.swift +0 -47
- data/Example/PodBuilderExample/Assets.xcassets/AppIcon.appiconset/Contents.json +0 -98
- data/Example/PodBuilderExample/Assets.xcassets/Contents.json +0 -6
- data/Example/PodBuilderExample/Base.lproj/LaunchScreen.storyboard +0 -25
- data/Example/PodBuilderExample/Base.lproj/Main.storyboard +0 -24
- data/Example/PodBuilderExample/Info.plist +0 -45
- data/Example/PodBuilderExample/ViewController.swift +0 -25
- data/Example/Podfile +0 -8
- data/Example/Podfile.lock +0 -16
- 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
@@ -1,29 +1,23 @@
|
|
1
|
-
require 'colored'
|
2
1
|
require 'xcodeproj'
|
3
2
|
require 'pod_builder/core'
|
4
3
|
|
5
4
|
module PodBuilder
|
6
5
|
class Podfile
|
7
|
-
def self.
|
8
|
-
puts "[PodBuilder] Removing target support duplicated entries".yellow
|
9
|
-
|
6
|
+
def self.pod_builder_post_process
|
10
7
|
Configuration.load
|
11
|
-
|
8
|
+
|
9
|
+
targets = find_xcodeproj_targets
|
10
|
+
target_names = targets.map(&:name)
|
11
|
+
|
12
|
+
puts "[PodBuilder] Removing target support duplicated entries".yellow
|
12
13
|
# Frameworks and resources
|
13
|
-
|
14
|
+
target_names.each do |target|
|
14
15
|
remove_duplicate_entries("Pods/Target Support Files/Pods-#{target}/Pods-#{target}-frameworks.sh")
|
15
16
|
remove_duplicate_entries("Pods/Target Support Files/Pods-#{target}/Pods-#{target}-resources.sh")
|
16
17
|
end
|
17
|
-
end
|
18
18
|
|
19
|
-
def self.check_target_support_resource_collisions
|
20
19
|
puts "[PodBuilder] Checking target support resource collisions".yellow
|
21
|
-
|
22
|
-
Configuration.load
|
23
|
-
|
24
|
-
targets = find_xcodeproj_targets
|
25
|
-
|
26
|
-
targets.map(&:name).each do |target|
|
20
|
+
target_names.each do |target|
|
27
21
|
check_for_colliding_resources("Pods/Target Support Files/Pods-#{target}/Pods-#{target}-resources.sh", target, targets)
|
28
22
|
end
|
29
23
|
end
|
@@ -75,7 +69,7 @@ module PodBuilder
|
|
75
69
|
resource_files = resource_files.map { |i| File.basename(i) }
|
76
70
|
resource_files = resource_files.map { |i| i.gsub(".xib", ".nib") }
|
77
71
|
else
|
78
|
-
raise "#{target} not found!".red
|
72
|
+
raise "\n\n#{target} not found!".red
|
79
73
|
end
|
80
74
|
|
81
75
|
# Check that Pods-TARGET-resources.sh doesn't contain colliding entries (Cocoapods 1.4.0)
|
@@ -0,0 +1,93 @@
|
|
1
|
+
require 'cocoapods/podfile.rb'
|
2
|
+
|
3
|
+
module Pod
|
4
|
+
class Podfile
|
5
|
+
class TargetDefinition
|
6
|
+
def pb_to_s(all_buildable_items, indent_level = 0)
|
7
|
+
indentation = " " * indent_level
|
8
|
+
target_s = "#{indentation}target '#{self.name}' do\n"
|
9
|
+
|
10
|
+
child_indentation = " " * (indent_level + 1)
|
11
|
+
|
12
|
+
explicit_deps = self.dependencies.map { |t| all_buildable_items.detect { |u| u.name == t.name } }.compact
|
13
|
+
|
14
|
+
pod_entries = []
|
15
|
+
prebuild_entries = []
|
16
|
+
self.dependencies.each do |dep|
|
17
|
+
if podfile_item = all_buildable_items.detect { |t| t.name == dep.name }
|
18
|
+
if File.exist?(podfile_item.prebuilt_podspec_path) && !podfile_item.is_prebuilt
|
19
|
+
prebuild_entries.push(podfile_item)
|
20
|
+
else
|
21
|
+
pod_entries.push(podfile_item)
|
22
|
+
end
|
23
|
+
|
24
|
+
non_explicit_dependencies = podfile_item.recursive_dependencies(all_buildable_items) - explicit_deps
|
25
|
+
non_explicit_dependencies_root_names = non_explicit_dependencies.map(&:root_name).uniq.filter { |t| t != podfile_item.root_name }
|
26
|
+
non_explicit_dependencies = non_explicit_dependencies_root_names.map { |x|
|
27
|
+
if item = all_buildable_items.detect { |t| x == t.name }
|
28
|
+
item
|
29
|
+
else
|
30
|
+
item = all_buildable_items.detect { |t| x == t.root_name }
|
31
|
+
end
|
32
|
+
}.compact
|
33
|
+
|
34
|
+
non_explicit_dependencies.each do |dep|
|
35
|
+
dep_item = all_buildable_items.detect { |x| x.name == dep.name }
|
36
|
+
|
37
|
+
if File.exist?(dep_item.prebuilt_podspec_path) && !dep_item.is_prebuilt
|
38
|
+
prebuild_entries.push(dep_item)
|
39
|
+
else
|
40
|
+
pod_entries.push(dep_item)
|
41
|
+
end
|
42
|
+
|
43
|
+
explicit_deps.push(dep)
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
prebuild_entries = prebuild_entries.uniq.sort_by { |t| t.name }
|
49
|
+
pod_entries = pod_entries.uniq.sort_by { |t| t.name }
|
50
|
+
|
51
|
+
prebuild_entries.each do |pod|
|
52
|
+
target_s += "#{child_indentation}#{pod.prebuilt_entry(false, false)}\n"
|
53
|
+
end
|
54
|
+
pod_entries.each do |pod|
|
55
|
+
target_s += "#{child_indentation}#{pod.entry(true, false)}\n"
|
56
|
+
end
|
57
|
+
|
58
|
+
if self.children.count > 0
|
59
|
+
target_s += "\n"
|
60
|
+
target_s += @children.map { |t| t.pb_to_s(all_buildable_items, indent_level + 1) }.join("\n\n")
|
61
|
+
end
|
62
|
+
|
63
|
+
target_s += "#{indentation}end\n"
|
64
|
+
end
|
65
|
+
end
|
66
|
+
end
|
67
|
+
end
|
68
|
+
|
69
|
+
module Pod
|
70
|
+
class Podfile
|
71
|
+
def pb_to_s(all_buildable_items)
|
72
|
+
initial_targets = root_target_definitions.first.children
|
73
|
+
|
74
|
+
platform = @current_target_definition.platform
|
75
|
+
|
76
|
+
podfile_s = "platform :#{platform.to_sym}, '#{platform.deployment_target.to_s}'\n\n"
|
77
|
+
podfile_s += initial_targets.map { |t| t.pb_to_s(all_buildable_items) }.join("\n\n")
|
78
|
+
|
79
|
+
return podfile_s
|
80
|
+
end
|
81
|
+
end
|
82
|
+
end
|
83
|
+
|
84
|
+
class PodfileCP
|
85
|
+
def self.podfile_path_transform(path)
|
86
|
+
prebuilt_prefix = PodBuilder::prebuiltpath.gsub(PodBuilder::project_path, "")[1..] + "/"
|
87
|
+
if path.start_with?(prebuilt_prefix)
|
88
|
+
return path
|
89
|
+
else
|
90
|
+
return PodBuilder::Podfile.podfile_path_transform(path)
|
91
|
+
end
|
92
|
+
end
|
93
|
+
end
|
@@ -1,4 +1,5 @@
|
|
1
|
-
|
1
|
+
# This class is the model that PodBuilder uses for every pod spec. The model is instantiated
|
2
|
+
# from Pod::Specification
|
2
3
|
|
3
4
|
module PodBuilder
|
4
5
|
class PodfileItem
|
@@ -10,6 +11,10 @@ module PodBuilder
|
|
10
11
|
#
|
11
12
|
attr_reader :branch
|
12
13
|
|
14
|
+
# @return [String] A checksum for the spec
|
15
|
+
#
|
16
|
+
attr_reader :checksum
|
17
|
+
|
13
18
|
# @return [String] Matches @name unless for subspecs were it stores the name of the root pod
|
14
19
|
#
|
15
20
|
attr_reader :root_name
|
@@ -34,6 +39,10 @@ module PodBuilder
|
|
34
39
|
#
|
35
40
|
attr_accessor :path
|
36
41
|
|
42
|
+
# @return [String] Local podspec path, if any
|
43
|
+
#
|
44
|
+
attr_accessor :podspec_path
|
45
|
+
|
37
46
|
# @return [String] The pinned commit of the pod, if any
|
38
47
|
#
|
39
48
|
attr_reader :commit
|
@@ -49,8 +58,12 @@ module PodBuilder
|
|
49
58
|
# @return [Array<String>] The pod's dependency names, if any. Use dependencies() to get the [Array<PodfileItem>]
|
50
59
|
#
|
51
60
|
attr_reader :dependency_names
|
61
|
+
|
62
|
+
# @return [Array<String>] The pod's external dependency names (excluding subspecs), if any
|
63
|
+
#
|
64
|
+
attr_reader :external_dependency_names
|
52
65
|
|
53
|
-
# @return [Bool] True if the pod is shipped as a static
|
66
|
+
# @return [Bool] True if the pod is shipped as a static binary
|
54
67
|
#
|
55
68
|
attr_reader :is_static
|
56
69
|
|
@@ -66,9 +79,13 @@ module PodBuilder
|
|
66
79
|
#
|
67
80
|
attr_accessor :build_configuration
|
68
81
|
|
69
|
-
# @return [String] The pod's vendored
|
82
|
+
# @return [String] The pod's vendored frameworks
|
83
|
+
#
|
84
|
+
attr_accessor :vendored_frameworks
|
85
|
+
|
86
|
+
# @return [String] The pod's vendored libraries
|
70
87
|
#
|
71
|
-
attr_accessor :
|
88
|
+
attr_accessor :vendored_libraries
|
72
89
|
|
73
90
|
# @return [String] Framweworks the pod needs to link to
|
74
91
|
#
|
@@ -86,25 +103,42 @@ module PodBuilder
|
|
86
103
|
#
|
87
104
|
attr_accessor :source_files
|
88
105
|
|
106
|
+
# @return [String] license
|
107
|
+
#
|
108
|
+
attr_accessor :license
|
109
|
+
|
110
|
+
# @return [String] summary
|
111
|
+
#
|
112
|
+
attr_accessor :summary
|
113
|
+
|
114
|
+
# @return [Hash] source
|
115
|
+
#
|
116
|
+
attr_accessor :source
|
117
|
+
|
118
|
+
# @return [Hash] authors
|
119
|
+
#
|
120
|
+
attr_accessor :authors
|
121
|
+
|
122
|
+
# @return [String] homepage
|
123
|
+
#
|
124
|
+
attr_accessor :homepage
|
125
|
+
|
126
|
+
# @return [Array<String>] Default subspecs
|
127
|
+
#
|
128
|
+
attr_accessor :default_subspecs
|
129
|
+
|
89
130
|
# Initialize a new instance
|
90
131
|
#
|
91
132
|
# @param [Specification] spec
|
92
133
|
#
|
93
134
|
# @param [Hash] checkout_options
|
94
135
|
#
|
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
|
-
|
136
|
+
def initialize(spec, all_specs, checkout_options, supported_platforms)
|
105
137
|
@name = spec.name
|
106
138
|
@root_name = spec.name.split("/").first
|
107
139
|
|
140
|
+
@checksum = spec.checksum
|
141
|
+
|
108
142
|
checkout_options_keys = [@root_name, @name]
|
109
143
|
|
110
144
|
if opts_key = checkout_options_keys.detect { |x| checkout_options.has_key?(x) }
|
@@ -112,6 +146,7 @@ module PodBuilder
|
|
112
146
|
@tag = checkout_options[opts_key][:tag]
|
113
147
|
@commit = checkout_options[opts_key][:commit]
|
114
148
|
@path = checkout_options[opts_key][:path]
|
149
|
+
@podspec_path = checkout_options[opts_key][:podspec]
|
115
150
|
@branch = checkout_options[opts_key][:branch]
|
116
151
|
@is_external = true
|
117
152
|
else
|
@@ -120,22 +155,22 @@ module PodBuilder
|
|
120
155
|
@commit = spec.root.source[:commit]
|
121
156
|
@is_external = false
|
122
157
|
end
|
123
|
-
|
124
|
-
@
|
158
|
+
|
159
|
+
@vendored_frameworks = extract_vendored_frameworks(spec, all_specs)
|
160
|
+
@vendored_libraries = extract_vendored_libraries(spec, all_specs)
|
125
161
|
|
126
162
|
@frameworks = []
|
127
163
|
@weak_frameworks = []
|
128
164
|
@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
165
|
|
136
|
-
|
137
|
-
|
138
|
-
|
166
|
+
@frameworks += extract_array(spec, "framework")
|
167
|
+
@frameworks += extract_array(spec, "frameworks")
|
168
|
+
|
169
|
+
@weak_frameworks += extract_array(spec, "weak_framework")
|
170
|
+
@weak_frameworks += extract_array(spec, "weak_frameworks")
|
171
|
+
|
172
|
+
@libraries += extract_array(spec, "library")
|
173
|
+
@libraries += extract_array(spec, "libraries")
|
139
174
|
|
140
175
|
@version = spec.root.version.version
|
141
176
|
@available_versions = spec.respond_to?(:spec_source) ? spec.spec_source.versions(@root_name)&.map(&:to_s) : [@version]
|
@@ -143,7 +178,18 @@ module PodBuilder
|
|
143
178
|
@swift_version = spec.root.swift_version&.to_s
|
144
179
|
@module_name = spec.root.module_name
|
145
180
|
|
146
|
-
@
|
181
|
+
@default_subspecs = extract_array(spec, "default_subspecs")
|
182
|
+
if default_subspec = spec.attributes_hash["default_subspec"]
|
183
|
+
@default_subspecs.push(default_subspec)
|
184
|
+
end
|
185
|
+
|
186
|
+
@dependency_names = spec.attributes_hash.fetch("dependencies", {}).keys + default_subspecs.map { |t| "#{@root_name}/#{t}" }
|
187
|
+
supported_platforms.each do |platform|
|
188
|
+
@dependency_names += (spec.attributes_hash.dig(platform, "dependencies") || {}).keys
|
189
|
+
end
|
190
|
+
@dependency_names.uniq!
|
191
|
+
|
192
|
+
@external_dependency_names = @dependency_names.select { |t| !t.start_with?(root_name) }
|
147
193
|
|
148
194
|
@is_static = spec.root.attributes_hash["static_framework"] || false
|
149
195
|
@xcconfig = spec.root.attributes_hash["xcconfig"] || {}
|
@@ -152,6 +198,13 @@ module PodBuilder
|
|
152
198
|
|
153
199
|
@build_configuration = spec.root.attributes_hash.dig("pod_target_xcconfig", "prebuild_configuration") || "release"
|
154
200
|
@build_configuration.downcase!
|
201
|
+
|
202
|
+
default_license = "MIT"
|
203
|
+
@license = spec.root.attributes_hash.fetch("license", {"type"=>"#{default_license}"})["type"] || default_license
|
204
|
+
@summary = spec.root.attributes_hash.fetch("summary", "A summary for #{@name}")
|
205
|
+
@source = spec.root.attributes_hash.fetch("source", { "git"=>"https://github.com/Subito-it/PodBuilder.git" })
|
206
|
+
@authors = spec.root.attributes_hash.fetch("authors", {"PodBuilder"=>"pod@podbuilder.com"})
|
207
|
+
@homepage = spec.root.attributes_hash.fetch("homepage", "https://github.com/Subito-it/PodBuilder")
|
155
208
|
end
|
156
209
|
|
157
210
|
def pod_specification(all_poditems, parent_spec = nil)
|
@@ -204,6 +257,43 @@ module PodBuilder
|
|
204
257
|
return available_pods.select { |x| @dependency_names.include?(x.name) }
|
205
258
|
end
|
206
259
|
|
260
|
+
def recursive_dependencies(available_pods)
|
261
|
+
names = [name]
|
262
|
+
|
263
|
+
deps = []
|
264
|
+
last_count = -1
|
265
|
+
while deps.count != last_count do
|
266
|
+
last_count = deps.count
|
267
|
+
|
268
|
+
updated_names = []
|
269
|
+
names.each do |name|
|
270
|
+
if pod = available_pods.detect { |t| t.name == name }
|
271
|
+
deps.push(pod)
|
272
|
+
updated_names += pod.dependency_names
|
273
|
+
end
|
274
|
+
end
|
275
|
+
|
276
|
+
names = updated_names.uniq
|
277
|
+
|
278
|
+
deps.uniq!
|
279
|
+
end
|
280
|
+
|
281
|
+
root_names = deps.map(&:root_name).uniq
|
282
|
+
|
283
|
+
# We need to build all other common subspecs to properly build the item
|
284
|
+
# Ex.
|
285
|
+
# PodA depends on DepA/subspec1
|
286
|
+
# PodB depends on DepA/subspec2
|
287
|
+
#
|
288
|
+
# When building PodA we need to build both DepA subspecs because they might
|
289
|
+
# contain different code
|
290
|
+
deps += available_pods.select { |t| root_names.include?(t.root_name) }
|
291
|
+
|
292
|
+
deps.uniq!
|
293
|
+
|
294
|
+
return deps
|
295
|
+
end
|
296
|
+
|
207
297
|
# @return [Bool] True if it's a pod that doesn't provide source code (is already shipped as a prebuilt pod)
|
208
298
|
#
|
209
299
|
def is_prebuilt
|
@@ -218,14 +308,17 @@ module PodBuilder
|
|
218
308
|
|
219
309
|
# Podspecs aren't always properly written (source_file key is often used instead of header_files)
|
220
310
|
# 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 }
|
311
|
+
embedded_as_vendored = vendored_frameworks.map { |x| File.basename(x) }.include?("#{module_name}.framework")
|
312
|
+
embedded_as_static_lib = vendored_libraries.map { |x| File.basename(x) }.include?("lib#{module_name}.a")
|
224
313
|
|
225
314
|
only_headers = (source_files.count > 0 && @source_files.all? { |x| x.end_with?(".h") })
|
226
|
-
no_sources = (@source_files.count == 0 || only_headers) && @
|
315
|
+
no_sources = (@source_files.count == 0 || only_headers) && (@vendored_frameworks + @vendored_libraries).count > 0
|
227
316
|
|
228
|
-
|
317
|
+
if !no_sources && !only_headers
|
318
|
+
return false
|
319
|
+
else
|
320
|
+
return (no_sources || only_headers || embedded_as_static_lib || embedded_as_vendored)
|
321
|
+
end
|
229
322
|
end
|
230
323
|
|
231
324
|
# @return [Bool] True if it's a subspec
|
@@ -252,6 +345,8 @@ module PodBuilder
|
|
252
345
|
if is_external
|
253
346
|
if @path
|
254
347
|
e += ", :path => '#{@path}'"
|
348
|
+
elsif @podspec_path
|
349
|
+
e += ", :podspec => '#{@podspec_path}'"
|
255
350
|
else
|
256
351
|
if @repo
|
257
352
|
e += ", :git => '#{@repo}'"
|
@@ -271,10 +366,9 @@ module PodBuilder
|
|
271
366
|
end
|
272
367
|
|
273
368
|
if include_pb_entry && !is_prebuilt
|
274
|
-
|
275
|
-
if
|
276
|
-
|
277
|
-
data = CFPropertyList.native_types(plist.value)
|
369
|
+
prebuilt_info_path = PodBuilder::prebuiltpath("#{root_name}/#{Configuration::prebuilt_info_filename}")
|
370
|
+
if File.exist?(prebuilt_info_path)
|
371
|
+
data = JSON.parse(File.read(prebuilt_info_path))
|
278
372
|
swift_version = data["swift_version"]
|
279
373
|
is_static = data["is_static"] || false
|
280
374
|
|
@@ -302,15 +396,22 @@ module PodBuilder
|
|
302
396
|
end
|
303
397
|
end
|
304
398
|
|
305
|
-
def
|
306
|
-
|
399
|
+
def prebuilt_podspec_path(absolute_path = true)
|
400
|
+
podspec_path = PodBuilder::prebuiltpath("#{@root_name}/#{@root_name}.podspec")
|
401
|
+
if absolute_path
|
402
|
+
return podspec_path
|
403
|
+
else
|
404
|
+
pod_path = Pathname.new(podspec_path).relative_path_from(Pathname.new(PodBuilder::basepath)).to_s
|
405
|
+
end
|
406
|
+
end
|
407
|
+
|
408
|
+
def prebuilt_entry(include_pb_entry = true, absolute_path = false)
|
409
|
+
podspec_dirname = File.dirname(prebuilt_podspec_path(absolute_path = absolute_path))
|
307
410
|
|
308
411
|
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}'"
|
412
|
+
entry = "pod '#{podspec_name}', :path => '#{podspec_dirname}'"
|
312
413
|
else
|
313
|
-
entry = "pod '
|
414
|
+
entry = "pod '#{name}', :path => '#{podspec_dirname}'"
|
314
415
|
end
|
315
416
|
|
316
417
|
if include_pb_entry && !is_prebuilt
|
@@ -337,45 +438,48 @@ module PodBuilder
|
|
337
438
|
end
|
338
439
|
|
339
440
|
def vendored_framework_path
|
340
|
-
if File.exist?(PodBuilder::
|
341
|
-
return
|
342
|
-
elsif File.exist?(PodBuilder::
|
343
|
-
return
|
441
|
+
if File.exist?(PodBuilder::prebuiltpath("#{root_name}/#{vendored_subspec_framework_name}"))
|
442
|
+
return vendored_subspec_framework_name
|
443
|
+
elsif File.exist?(PodBuilder::prebuiltpath("#{root_name}/#{vendored_spec_framework_name}"))
|
444
|
+
return vendored_spec_framework_name
|
344
445
|
end
|
345
446
|
|
346
447
|
return nil
|
347
448
|
end
|
348
449
|
|
349
|
-
def
|
350
|
-
return "
|
450
|
+
def vendored_subspec_framework_name
|
451
|
+
return "#{prebuilt_rel_path}"
|
351
452
|
end
|
352
453
|
|
353
|
-
def
|
354
|
-
return "
|
355
|
-
end
|
356
|
-
|
357
|
-
def self.vendored_name_framework_path(name)
|
358
|
-
return "Rome/#{name}"
|
454
|
+
def vendored_spec_framework_name
|
455
|
+
return "#{module_name}.framework"
|
359
456
|
end
|
360
457
|
|
361
458
|
private
|
362
459
|
|
363
|
-
def
|
460
|
+
def extract_vendored_frameworks(spec, all_specs)
|
364
461
|
items = []
|
365
462
|
|
366
463
|
supported_platforms = spec.available_platforms.flatten.map(&:name).map(&:to_s)
|
464
|
+
items += [spec.attributes_hash["vendored_frameworks"]]
|
465
|
+
items += [spec.attributes_hash["vendored_framework"]]
|
367
466
|
|
368
|
-
|
369
|
-
|
370
|
-
items += [spec.attributes_hash["vendored_framework"]]
|
371
|
-
items += [spec.attributes_hash["vendored_libraries"]]
|
372
|
-
items += [spec.attributes_hash["vendored_library"]]
|
467
|
+
items += supported_platforms.map { |x| spec.attributes_hash.fetch(x, {})["vendored_frameworks"] }
|
468
|
+
items += supported_platforms.map { |x| spec.attributes_hash.fetch(x, {})["vendored_framework"] }
|
373
469
|
|
374
|
-
|
375
|
-
|
376
|
-
|
377
|
-
|
378
|
-
|
470
|
+
return items.flatten.uniq.compact
|
471
|
+
end
|
472
|
+
|
473
|
+
def extract_vendored_libraries(spec, all_specs)
|
474
|
+
items = []
|
475
|
+
|
476
|
+
supported_platforms = spec.available_platforms.flatten.map(&:name).map(&:to_s)
|
477
|
+
|
478
|
+
items += [spec.attributes_hash["vendored_libraries"]]
|
479
|
+
items += [spec.attributes_hash["vendored_library"]]
|
480
|
+
|
481
|
+
items += supported_platforms.map { |x| spec.attributes_hash.fetch(x, {})["vendored_libraries"] }
|
482
|
+
items += supported_platforms.map { |x| spec.attributes_hash.fetch(x, {})["vendored_library"] }
|
379
483
|
|
380
484
|
return items.flatten.uniq.compact
|
381
485
|
end
|
@@ -390,18 +494,26 @@ module PodBuilder
|
|
390
494
|
end
|
391
495
|
|
392
496
|
def source_files_from_string(source)
|
497
|
+
# Transform source file entries
|
498
|
+
# "Networking{Response,Request}*.{h,m}" -> ["NetworkingResponse*.h", "NetworkingResponse*.m", "NetworkingRequest*.h", "NetworkingRequest*.m"]
|
393
499
|
files = []
|
394
500
|
if source.is_a? String
|
395
|
-
matches = source.match(/(.*)
|
396
|
-
if matches&.size ==
|
397
|
-
|
398
|
-
if
|
399
|
-
|
501
|
+
matches = source.match(/(.*){(.*)}(.*)/)
|
502
|
+
if matches&.size == 4
|
503
|
+
res = matches[2].split(",").map { |t| "#{matches[1]}#{t}#{matches[3]}" }
|
504
|
+
if res.any? { |t| t.include?("{") }
|
505
|
+
return res.map { |t| source_files_from_string(t) }.flatten
|
400
506
|
end
|
507
|
+
|
508
|
+
return res
|
401
509
|
end
|
402
510
|
|
403
511
|
return source.split(",")
|
404
512
|
else
|
513
|
+
if source.any? { |t| t.include?("{") }
|
514
|
+
return source.map { |t| source_files_from_string(t) }.flatten
|
515
|
+
end
|
516
|
+
|
405
517
|
return source
|
406
518
|
end
|
407
519
|
end
|
@@ -429,18 +541,5 @@ module PodBuilder
|
|
429
541
|
|
430
542
|
return source_files + root_source_files + subspec_source_files
|
431
543
|
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
544
|
end
|
446
545
|
end
|