pod-builder 0.7.2 → 0.7.3

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA256:
3
- metadata.gz: c824c35cc04aeefc113772db5ab4684c7e03f4b65040ae257cfe76de601116f6
4
- data.tar.gz: 6095e1cf375390082bc614ffe2830fced05d31c4ab369f81ebf4066be94dcffd
2
+ SHA1:
3
+ metadata.gz: 3588dfe03090d787eb486aa86b28e2a6669bf893
4
+ data.tar.gz: 608e0da72139cf4609f213996ac79bf53b42fa49
5
5
  SHA512:
6
- metadata.gz: 2a46a55904d3d85d7855329811f0676ad38c995485c4ad890ad70cd10490b56ea056fbd19ea0407db8de690068d6da2d5b6a255683187f69c4d2bc24bd9e7c5c
7
- data.tar.gz: f59570fb4f3b73309863f2aadc1d9876657ac65e2e28a37c77b94b3a9a55c8ee2ce3906613091e3e00bf07f6bb7e0cec8fb66b43c26896318a449828caf45a90
6
+ metadata.gz: a36f09e12e549f59bea9cd61ed7488e0732a3fd76bad0558d116842a2baac80bddaa34dbe73a4bf0521e150a7dd8e015f06e8119ed90491f16234449dee1065d
7
+ data.tar.gz: 8edebbdf7312fb7778db40a36561830bc45b13a163b153ad512b84d4136b1aa025704908337a86affde554a9c688328894c274750b8a477d16c02f48f9b64143
@@ -54,6 +54,8 @@ module PodBuilder
54
54
  # 2. pods to build in release
55
55
  # 3. pods to build in debug
56
56
 
57
+ check_not_building_development_pods(pods_to_build)
58
+
57
59
  pods_to_build_subspecs = pods_to_build.select { |x| x.is_subspec && Configuration.subspecs_to_split.include?(x.name) }
58
60
  pods_to_build -= pods_to_build_subspecs
59
61
  pods_to_build_debug = pods_to_build.select { |x| x.build_configuration == "debug" }
@@ -228,6 +230,13 @@ module PodBuilder
228
230
  end
229
231
  end
230
232
 
233
+ def self.check_not_building_development_pods(pods)
234
+ if (development_pods = pods.select { |x| x.is_development_pod }) && development_pods.count > 0
235
+ pod_names = development_pods.map(&:name).join(", ")
236
+ raise "Cannot build the following pods: `#{pod_names}` in development mode"
237
+ end
238
+ end
239
+
231
240
  def self.other_subspecs(pods_to_build, buildable_items)
232
241
  buildable_subspecs = buildable_items.select { |x| x.is_subspec }
233
242
  pods_to_build_subspecs = pods_to_build.select { |x| x.is_subspec }.map(&:root_name)
@@ -41,6 +41,7 @@ module PodBuilder
41
41
  add_framework_plist_info(podfile_items)
42
42
  cleanup_frameworks(podfile_items)
43
43
  copy_frameworks(podfile_items)
44
+ copy_libraries(podfile_items)
44
45
  if build_configuration != "debug"
45
46
  copy_dsyms(podfile_items)
46
47
  end
@@ -69,22 +70,24 @@ module PodBuilder
69
70
  Dir.chdir(current_dir)
70
71
  end
71
72
 
72
- def self.framework_rel_path(framework_path, podfile_items)
73
- framework_name = File.basename(framework_path)
74
- framework_name_no_ext = File.basename(framework_name, File.extname(framework_name))
75
- if podfile_item = podfile_items.detect { |x| x.module_name == framework_name_no_ext && Configuration.subspecs_to_split.include?(x.name) }
73
+ def self.rel_path(path, podfile_items)
74
+ name = File.basename(path)
75
+ name_no_ext = File.basename(name, File.extname(name))
76
+ if podfile_item = podfile_items.detect { |x| x.module_name == name_no_ext && Configuration.subspecs_to_split.include?(x.name) }
76
77
  return "#{podfile_item.prebuilt_rel_path}"
77
78
  else
78
- return framework_name
79
+ return name
79
80
  end
80
81
  end
81
82
 
82
83
  def self.add_framework_plist_info(podfile_items)
83
84
  swift_version = PodBuilder::system_swift_version
84
85
  Dir.glob("#{Configuration.build_path}/Rome/*.framework") do |framework_path|
86
+ filename_ext = File.basename(framework_path)
85
87
  filename = File.basename(framework_path, ".*")
86
88
 
87
89
  specs = podfile_items.select { |x| x.module_name == filename }
90
+ specs += podfile_items.select { |x| x.vendored_items.map { |x| File.basename(x) }.include?(filename_ext) }
88
91
  if podfile_item = specs.first
89
92
  podbuilder_file = File.join(framework_path, Configuration.framework_plist_filename)
90
93
  entry = podfile_item.entry(true, false)
@@ -111,7 +114,7 @@ module PodBuilder
111
114
 
112
115
  def self.cleanup_frameworks(podfile_items)
113
116
  Dir.glob("#{Configuration.build_path}/Rome/*.framework") do |framework_path|
114
- framework_rel_path = framework_rel_path(framework_path, podfile_items)
117
+ framework_rel_path = rel_path(framework_path, podfile_items)
115
118
  dsym_path = framework_rel_path + ".dSYM"
116
119
 
117
120
  PodBuilder::safe_rm_rf(PodBuilder::basepath("Rome/#{framework_rel_path}"))
@@ -122,7 +125,7 @@ module PodBuilder
122
125
 
123
126
  def self.copy_frameworks(podfile_items)
124
127
  Dir.glob("#{Configuration.build_path}/Rome/*.framework") do |framework_path|
125
- framework_rel_path = framework_rel_path(framework_path, podfile_items)
128
+ framework_rel_path = rel_path(framework_path, podfile_items)
126
129
 
127
130
  destination_path = PodBuilder::basepath("Rome/#{framework_rel_path}")
128
131
  FileUtils.mkdir_p(File.dirname(destination_path))
@@ -130,9 +133,69 @@ module PodBuilder
130
133
  end
131
134
  end
132
135
 
136
+ def self.copy_libraries(podfile_items)
137
+ module_names = podfile_items.map(&:root_name).uniq
138
+ module_names.each do |module_name|
139
+ base_destination_dir = PodBuilder::basepath("Rome/#{module_name}")
140
+ PodBuilder::safe_rm_rf(base_destination_dir)
141
+ end
142
+
143
+ Dir.glob("#{Configuration.build_path}/Rome/*.a") do |library_path|
144
+ library_name = File.basename(library_path)
145
+
146
+ # Find vendored libraries in the build folder:
147
+ # This allows to determine which Pod is associated to the vendored_library
148
+ # because there are cases where vendored_libraries are specified with wildcards (*.a)
149
+ # making it impossible to determine the associated Pods when building multiple pods at once
150
+ search_base = "#{Configuration.build_path}/Pods/"
151
+ podfile_items.each do |podfile_item|
152
+ podfile_item.vendored_items.each do |vendored_item|
153
+ unless vendored_item.end_with?(".a")
154
+ next
155
+ end
156
+
157
+ if result = Dir.glob("#{search_base}**/#{vendored_item}").first
158
+ result_path = result.gsub(search_base, "")
159
+ module_name = result_path.split("/").first
160
+ if module_name == podfile_item.module_name
161
+ library_rel_path = rel_path(module_name, podfile_items)
162
+
163
+ result_path = result_path.split("/").drop(1).join("/")
164
+
165
+ destination_path = PodBuilder::basepath("Rome/#{library_rel_path}/#{result_path}")
166
+ FileUtils.mkdir_p(File.dirname(destination_path))
167
+ FileUtils.cp_r(library_path, destination_path)
168
+ end
169
+ end
170
+ end
171
+
172
+ # A pod might depend upon a static library that is shipped with a prebuilt framework
173
+ # which is not added to the Rome folder and the PodBuilder.podspec
174
+ #
175
+ # An example is Google-Mobile-Ads-SDK which adds
176
+ # - vendored framework: GooleMobileAds.framework
177
+ # - vendored library: libGooleMobileAds.a
178
+ # These might be used by another pod (e.g AppNexusSDK/GoogleAdapterThatDependsOnGooglePod)
179
+ podfile_item.libraries.each do |library|
180
+ if result = Dir.glob("#{search_base}**/lib#{library}.a").first
181
+ result_path = result.gsub(search_base, "")
182
+
183
+ library_rel_path = rel_path(podfile_item.module_name, podfile_items)
184
+
185
+ result_path = result_path.split("/").drop(1).join("/")
186
+
187
+ destination_path = PodBuilder::basepath("Rome/#{library_rel_path}/#{result_path}")
188
+ FileUtils.mkdir_p(File.dirname(destination_path))
189
+ FileUtils.cp_r(library_path, destination_path)
190
+ end
191
+ end
192
+ end
193
+ end
194
+ end
195
+
133
196
  def self.copy_dsyms(podfile_items)
134
197
  Dir.glob("#{Configuration.build_path}/dSYM/*iphoneos/**/*.dSYM") do |dsym_path|
135
- framework_rel_path = framework_rel_path(dsym_path.gsub(File.extname(dsym_path), ""), podfile_items)
198
+ framework_rel_path = rel_path(dsym_path.gsub(File.extname(dsym_path), ""), podfile_items)
136
199
 
137
200
  destination_path = PodBuilder::basepath("dSYM/iphoneos/#{File.dirname(framework_rel_path)}")
138
201
  FileUtils.mkdir_p(destination_path)
@@ -140,7 +203,7 @@ module PodBuilder
140
203
  end
141
204
 
142
205
  Dir.glob("#{Configuration.build_path}/dSYM/*iphonesimulator/**/*.dSYM") do |dsym_path|
143
- framework_rel_path = framework_rel_path(dsym_path.gsub(File.extname(dsym_path), ""), podfile_items)
206
+ framework_rel_path = rel_path(dsym_path.gsub(File.extname(dsym_path), ""), podfile_items)
144
207
 
145
208
  destination_path = PodBuilder::basepath("dSYM/iphonesimulator/#{File.dirname(framework_rel_path)}")
146
209
  FileUtils.mkdir_p(destination_path)
@@ -231,6 +231,12 @@ module PodBuilder
231
231
  @root_name != @name
232
232
  end
233
233
 
234
+ # @return [Bool] True if it's a development pod
235
+ #
236
+ def is_development_pod
237
+ @path != nil
238
+ end
239
+
234
240
  # @return [String] The podfile entry
235
241
  #
236
242
  def entry(include_version = true, include_pb_entry = true)
@@ -65,9 +65,15 @@ module PodBuilder
65
65
  podspecs = []
66
66
  podspec_items.each do |item|
67
67
  vendored_frameworks = item.vendored_frameworks.map { |x| vendored_framework_path(x) }.compact.uniq
68
+ vendored_libraries = Dir.glob(PodBuilder::basepath("Rome/#{item.module_name}/**/*.a")).map { |x| x.to_s.gsub(PodBuilder::basepath, "")[1..-1] }
68
69
 
69
70
  podspec = " s.subspec '#{item.name.gsub("/", "_")}' do |p|\n"
70
- podspec += " p.vendored_frameworks = '#{vendored_frameworks.join("','")}'\n"
71
+ if vendored_frameworks.count > 0
72
+ podspec += " p.vendored_frameworks = '#{vendored_frameworks.join("','")}'\n"
73
+ end
74
+ if vendored_libraries.count > 0
75
+ podspec += " p.vendored_libraries = '#{vendored_libraries.join("','")}'\n"
76
+ end
71
77
  if item.frameworks.count > 0
72
78
  podspec += " p.frameworks = '#{item.frameworks.join("', '")}'\n"
73
79
  end
@@ -1,4 +1,4 @@
1
1
  module PodBuilder
2
- VERSION = "0.7.2"
2
+ VERSION = "0.7.3"
3
3
  end
4
-
4
+
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pod-builder
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.2
4
+ version: 0.7.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tomas Camin
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-02-24 00:00:00.000000000 Z
11
+ date: 2019-03-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -287,7 +287,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
287
287
  version: '0'
288
288
  requirements: []
289
289
  rubyforge_project:
290
- rubygems_version: 2.7.3
290
+ rubygems_version: 2.5.2.3
291
291
  signing_key:
292
292
  specification_version: 4
293
293
  summary: Prebuild CocoaPods pods