pod-builder 0.9.1 → 0.9.2

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
2
  SHA256:
3
- metadata.gz: d9fb023de3a59b5da37e534937a7cdb9cc8d9af2774a2085227818c418cbf0de
4
- data.tar.gz: f3edce26103792eec8c88afca3b7f1627a0944d27a063b1f272a20b16ac6108a
3
+ metadata.gz: d36d9f96e5add40dcfea2b813f2f2e7c7a8bf9dc92f66c18d9a9908b8b08acf9
4
+ data.tar.gz: 9277379ff44774e76b71ee3daa8763dcdf73733800561baa6c12ce4c98b9f649
5
5
  SHA512:
6
- metadata.gz: a0c6616c2e103b282d66f3c209bfad1b606cbda83e6a7b978930cc09954838ed89bcedc67a2fc576aacaf3c7ffc0222303b9e94695b91adbd47f851f1ad917f7
7
- data.tar.gz: 7932ef4ea77d4b5c7e55e27e3eb058ef282c05e0c7c1e44b0ab3f47967da7433a05dca6d1e920cc029e3343b00ae5451d52c5b8dcc69814c377da22c49f26442
6
+ metadata.gz: 49c7bfd632020dfb7d1ce681599652e4d5b7f4f44082a62b9440a6c5f45eccb571db1005f1b8d320aea8cdcc5ba4f9f571fe68c8cd7d824b8c681e22b01f4384
7
+ data.tar.gz: 97ade0e62f14c2128937b5abd4f734fd123ad82ab506d0992a7dd5ee28318596fb600d4781fd1c1e000743eef41ed30e0e1ff46d2ee528af7fefe60ea8282bc4
@@ -4,33 +4,15 @@
4
4
  "Google-Mobile-Ads-SDK": {
5
5
  "module_name": "GoogleMobileAds"
6
6
  },
7
- "Firebase/Core": {
8
- "module_name": "FirebaseCore"
9
- },
10
- "Firebase/Performance": {
11
- "module_name": "FirebasePerformance"
12
- },
13
- "Firebase/RemoteConfig": {
14
- "module_name": "FirebaseRemoteConfig"
15
- }
16
7
  },
17
8
  "skip_licenses": [
18
9
 
19
10
  ],
20
11
  "skip_pods": [
21
-
12
+ "GoogleMaps"
22
13
  ],
23
14
  "force_prebuild_pods": [
24
- "FirebaseAnalytics",
25
- "FirebaseAnalyticsInterop",
26
- "Firebase/Core",
27
- "Firebase/CoreOnly",
28
- "FirebaseCoreDiagnosticsInterop",
29
- "FirebasePerformance",
30
- "Firebase/Performance",
31
- "FirebaseRemoteConfig",
32
- "GoogleAppMeasurement",
33
- "GoogleToolboxForMac"
15
+ "Firebase"
34
16
  ],
35
17
  "build_settings": {
36
18
  "ENABLE_BITCODE": "NO",
@@ -82,10 +82,12 @@ module PodBuilder
82
82
  FileUtils.rm_f(PodBuilder::basepath("Podfile.lock"))
83
83
  end
84
84
 
85
+ cleanup_framework_folder(all_buildable_items)
86
+
85
87
  Licenses::write(licenses, all_buildable_items)
86
88
 
87
89
  GenerateLFS::call(nil)
88
- Podspec::generate(analyzer)
90
+ Podspec::generate(all_buildable_items, analyzer)
89
91
 
90
92
  builded_pods = podfiles_items.flatten
91
93
  builded_pods_and_deps = add_dependencies(builded_pods, all_buildable_items).select { |x| !x.is_prebuilt }
@@ -294,6 +296,22 @@ module PodBuilder
294
296
 
295
297
  return pods_to_build
296
298
  end
299
+
300
+ def self.cleanup_framework_folder(buildable_items)
301
+ expected_frameworks = buildable_items.map { |x| "#{x.module_name}.framework" }
302
+ expected_frameworks += buildable_items.map { |x| x.vendored_items }.flatten.map { |x| x.split("/").last }
303
+ expected_frameworks.uniq!
304
+
305
+ existing_frameworks = Dir.glob("#{PodBuilder::basepath("Rome")}/*.framework")
306
+
307
+ existing_frameworks.each do |existing_framework|
308
+ existing_framework_name = File.basename(existing_framework)
309
+ if !expected_frameworks.include?(existing_framework_name)
310
+ puts "Cleanining up `#{existing_framework_name}`, no longer found among dependencies".blue
311
+ FileUtils.rm_rf(existing_framework)
312
+ end
313
+ end
314
+ end
297
315
  end
298
316
  end
299
317
  end
@@ -47,11 +47,26 @@ module PodBuilder
47
47
 
48
48
  Dir.chdir(repo_dir)
49
49
  puts "Checking out #{spec.podspec_name}".yellow
50
- raise "Failed cheking out #{spec.name}" if !system(spec.git_hard_checkout)
50
+ raise "Failed cheking out #{spec.name}" if !system(git_hard_checkout_cmd(spec))
51
51
 
52
52
  Dir.chdir(current_dir)
53
53
  end
54
54
 
55
+ def self.git_hard_checkout_cmd(spec)
56
+ prefix = "git fetch --all --tags --prune; git reset --hard"
57
+ if @tag
58
+ return "#{prefix} tags/#{spec.tag}"
59
+ end
60
+ if @commit
61
+ return "#{prefix} #{spec.commit}"
62
+ end
63
+ if @branch
64
+ return "#{prefix} origin/#{spec.branch}"
65
+ end
66
+
67
+ return nil
68
+ end
69
+
55
70
  def self.rewrite_lldinit
56
71
  puts "Writing ~/.lldbinit-Xcode".yellow
57
72
 
@@ -14,6 +14,8 @@ module PodBuilder
14
14
  "module_name": "GoogleMobileAds"
15
15
  }
16
16
  }.freeze
17
+ DEFAULT_SKIP_PODS = ["GoogleMaps"]
18
+ DEFAULT_FORCE_PREBUILD_PODS = ["Firebase"]
17
19
  DEFAULT_BUILD_SYSTEM = "Legacy".freeze # either Latest (New build system) or Legacy (Standard build system)
18
20
  MIN_LFS_SIZE_KB = 256.freeze
19
21
 
@@ -51,8 +53,8 @@ module PodBuilder
51
53
  @base_path = "Frameworks" # Not nice. This value is used only for initial initization. Once config is loaded it will be an absolute path. FIXME
52
54
  @spec_overrides = DEFAULT_SPEC_OVERRIDE
53
55
  @skip_licenses = []
54
- @skip_pods = []
55
- @force_prebuild_pods = []
56
+ @skip_pods = DEFAULT_SKIP_PODS
57
+ @force_prebuild_pods = DEFAULT_FORCE_PREBUILD_PODS
56
58
  @license_filename = "Pods-acknowledgements"
57
59
  @subspecs_to_split = []
58
60
  @development_pods_paths = []
@@ -10,10 +10,14 @@
10
10
  dict = CFPropertyList.native_types(plist.value)
11
11
  current_licenses = dict["PreferenceSpecifiers"]
12
12
 
13
- licenses_header = current_licenses.shift
14
- raise "Unexpected license found in header" if licenses_header.has_key?("License")
15
- license_footer = current_licenses.pop
16
- raise "Unexpected license found in footer" if license_footer.has_key?("License")
13
+ if current_licenses.count > 0
14
+ licenses_header = current_licenses.shift
15
+ raise "Unexpected license found in header" if licenses_header.has_key?("License")
16
+ end
17
+ if current_licenses.count > 0
18
+ license_footer = current_licenses.pop
19
+ raise "Unexpected license found in footer" if license_footer.has_key?("License")
20
+ end
17
21
  end
18
22
 
19
23
  if licenses.count > 0
@@ -33,7 +37,7 @@
33
37
  licenses.select! { |x| all_buildable_items.map(&:root_name).include?(x["Title"]) } # Remove items that are no longer included
34
38
 
35
39
  license_dict = {}
36
- license_dict["PreferenceSpecifiers"] = [licenses_header, licenses, license_footer].flatten
40
+ license_dict["PreferenceSpecifiers"] = [licenses_header, licenses, license_footer].compact.flatten
37
41
  license_dict["StringsTable"] = "Acknowledgements"
38
42
  license_dict["Title"] = license_dict["StringsTable"]
39
43
 
@@ -41,7 +45,9 @@
41
45
  plist.value = CFPropertyList.guess(license_dict)
42
46
  plist.save(license_file_path, CFPropertyList::List::FORMAT_BINARY)
43
47
 
44
- write_markdown(license_file_path)
48
+ if licenses.count > 0
49
+ write_markdown(license_file_path)
50
+ end
45
51
  end
46
52
 
47
53
  private
@@ -50,6 +56,7 @@
50
56
  plist = CFPropertyList::List.new(:file => plist_path)
51
57
  dict = CFPropertyList.native_types(plist.value)
52
58
  licenses = dict["PreferenceSpecifiers"]
59
+
53
60
  header = licenses.shift
54
61
 
55
62
  markdown = []
@@ -147,20 +147,28 @@ module PodBuilder
147
147
  prebuilt_lines = ["# Autogenerated by PodBuilder (https://github.com/Subito-it/PodBuilder)\n", "# Any change to this file should be done on #{rel_path}\n", "\n"]
148
148
  podfile_content.each_line do |line|
149
149
  stripped_line = strip_line(line)
150
+ if exclude_lines.include?(stripped_line)
151
+ next
152
+ end
150
153
 
151
154
  if pod_name = pod_definition_in(line, true)
152
155
  if podfile_item = all_buildable_items.detect { |x| x.name == pod_name }
153
156
  if Podspec.include?(podfile_item.name)
154
- if podfile_item.is_prebuilt == false
155
- line = "#{line.detect_indentation}#{podfile_item.prebuilt_entry}\n"
157
+ if podfile_item.vendored_framework_path.nil?
158
+ marker = podfile_item.prebuilt_marker()
159
+
160
+ podfile_item_dependency_items = all_buildable_items.select { |x| podfile_item.dependency_names.include?(x.name) && x.vendored_framework_path.nil? == false }
161
+ prebuilt_lines += podfile_item_dependency_items.map { |x| "#{line.detect_indentation}#{x.prebuilt_entry(include_pb_entry = false)}#{marker}\n" }.uniq
162
+ else
163
+ prebuilt_lines.push("#{line.detect_indentation}#{podfile_item.prebuilt_entry}\n")
156
164
  end
165
+
166
+ next
157
167
  end
158
168
  end
159
169
  end
160
170
 
161
- if !exclude_lines.include?(stripped_line)
162
- prebuilt_lines.push(line)
163
- end
171
+ prebuilt_lines.push(line)
164
172
  end
165
173
 
166
174
  project_podfile_path = PodBuilder::project_path("Podfile")
@@ -278,12 +278,12 @@ module PodBuilder
278
278
  swift_version = data["swift_version"]
279
279
  is_static = data["is_static"] || false
280
280
 
281
- e += " # pb<#{name}> is<#{is_static}>"
281
+ e += "#{prebuilt_marker()} is<#{is_static}>"
282
282
  if swift_version
283
283
  e += " sv<#{swift_version}>"
284
284
  end
285
285
  else
286
- e += " # pb<#{name}>"
286
+ e += prebuilt_marker()
287
287
  end
288
288
  end
289
289
 
@@ -314,12 +314,16 @@ module PodBuilder
314
314
  end
315
315
 
316
316
  if include_pb_entry && !is_prebuilt
317
- entry += " # pb<#{name}>"
317
+ entry += prebuilt_marker()
318
318
  end
319
319
 
320
320
  return entry
321
321
  end
322
322
 
323
+ def prebuilt_marker
324
+ return " # pb<#{name}>"
325
+ end
326
+
323
327
  def has_subspec(named)
324
328
  unless !is_subspec
325
329
  return false
@@ -332,20 +336,27 @@ module PodBuilder
332
336
  return root_name == named.split("/").first
333
337
  end
334
338
 
335
- def git_hard_checkout
336
- prefix = "git fetch --all --tags --prune; git reset --hard"
337
- if @tag
338
- return "#{prefix} tags/#{@tag}"
339
- end
340
- if @commit
341
- return "#{prefix} #{@commit}"
342
- end
343
- if @branch
344
- return "#{prefix} origin/#{@branch}"
339
+ def vendored_framework_path
340
+ if File.exist?(PodBuilder::basepath(vendored_subspec_framework_path))
341
+ return vendored_subspec_framework_path
342
+ elsif File.exist?(PodBuilder::basepath(vendored_spec_framework_path))
343
+ return vendored_spec_framework_path
345
344
  end
346
-
345
+
347
346
  return nil
348
347
  end
348
+
349
+ def vendored_subspec_framework_path
350
+ return "Rome/#{prebuilt_rel_path}"
351
+ end
352
+
353
+ def vendored_spec_framework_path
354
+ return "Rome/#{module_name}.framework"
355
+ end
356
+
357
+ def self.vendored_name_framework_path(name)
358
+ return "Rome/#{name}"
359
+ end
349
360
 
350
361
  private
351
362
 
@@ -421,9 +432,15 @@ module PodBuilder
421
432
 
422
433
  def spec_and_dependencies(spec, all_specs)
423
434
  specs = all_specs.select { |x| spec.dependencies.map(&:name).include?(x.name) }
435
+ specs += all_specs.select { |x| spec.default_subspecs.include?(x.name.split("/").last) }
424
436
  specs += [spec, spec.root]
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.map { |x| spec_and_dependencies(x, all_remaining_specs) }
441
+ end
425
442
 
426
- return specs.compact.uniq
443
+ return specs.flatten.compact.uniq
427
444
  end
428
445
  end
429
446
  end
@@ -31,12 +31,10 @@ module PodBuilder
31
31
  end
32
32
  private_constant :PodspecItem
33
33
 
34
- def self.generate(analyzer)
34
+ def self.generate(all_buildable_items, analyzer)
35
35
  puts "Generating PodBuilder's local podspec".yellow
36
-
37
- buildable_items = Podfile.podfile_items_at(PodBuilder::basepath("Podfile")).sort_by { |x| x.name }
38
-
39
- podspec_items = podspec_items_from(buildable_items)
36
+
37
+ podspec_items = podspec_items_from(all_buildable_items)
40
38
 
41
39
  platform = analyzer.instance_variable_get("@result").targets.first.platform
42
40
  generate_podspec_from(podspec_items, platform)
@@ -66,8 +64,8 @@ module PodBuilder
66
64
  def self.generate_podspec_from(podspec_items, platform)
67
65
  podspecs = []
68
66
  podspec_items.each do |item|
69
- vendored_frameworks = item.vendored_frameworks.map { |x| vendored_framework_path(x) }.compact
70
- vendored_frameworks += item.vendored_items.select { |x| File.exist?(PodBuilder::basepath(vendored_name_framework_path(x))) }.map { |x| "Rome/#{x}" }
67
+ vendored_frameworks = item.vendored_frameworks.map { |x| x.vendored_framework_path }.compact
68
+ vendored_frameworks += item.vendored_items.map { |x| File.basename(x) }.select { |x| File.exist?(PodBuilder::basepath(PodfileItem::vendored_name_framework_path(x))) }.map { |x| "Rome/#{x}" }
71
69
  vendored_frameworks.uniq!
72
70
  vendored_libraries = Dir.glob(PodBuilder::basepath("Rome/#{item.module_name}/**/*.a")).map { |x| x.to_s.gsub(PodBuilder::basepath, "")[1..-1] }
73
71
 
@@ -114,8 +112,8 @@ module PodBuilder
114
112
  podspec_items = []
115
113
 
116
114
  buildable_items.each do |pod|
117
- spec_exists = File.exist?(PodBuilder::basepath(vendored_spec_framework_path(pod)))
118
- subspec_exists = File.exist?(PodBuilder::basepath(vendored_subspec_framework_path(pod)))
115
+ spec_exists = File.exist?(PodBuilder::basepath(pod.vendored_spec_framework_path))
116
+ subspec_exists = File.exist?(PodBuilder::basepath(pod.vendored_subspec_framework_path))
119
117
 
120
118
  unless spec_exists || subspec_exists
121
119
  puts "Skipping `#{pod.name}`, not prebuilt".blue
@@ -138,10 +136,10 @@ module PodBuilder
138
136
  podspec_item.libraries = podspec_item.vendored_frameworks.map { |x| x.libraries }.flatten.uniq.sort
139
137
 
140
138
  static_vendored_frameworks = podspec_item.vendored_frameworks.select { |x| x.is_static }
141
-
142
- podspec_item.resources = static_vendored_frameworks.map { |x| vendored_framework_path(x).nil? ? nil : "#{vendored_framework_path(x)}/*.{nib,bundle,xcasset,strings,png,jpg,tif,tiff,otf,ttf,ttc,plist,json,caf,wav,p12,momd}" }.compact.flatten.uniq
143
- podspec_item.exclude_files = static_vendored_frameworks.map { |x| vendored_framework_path(x).nil? ? nil : "#{vendored_framework_path(x)}/Info.plist" }.compact.flatten.uniq
144
- podspec_item.exclude_files += podspec_item.vendored_frameworks.map { |x| vendored_framework_path(x).nil? ? nil : "#{vendored_framework_path(x)}/#{Configuration.framework_plist_filename}" }.compact.flatten.uniq.sort
139
+
140
+ podspec_item.resources = static_vendored_frameworks.map { |x| x.vendored_framework_path.nil? ? nil : "#{x.vendored_framework_path}/*.{nib,bundle,xcasset,strings,png,jpg,tif,tiff,otf,ttf,ttc,plist,json,caf,wav,p12,momd}" }.compact.flatten.uniq
141
+ podspec_item.exclude_files = static_vendored_frameworks.map { |x| x.vendored_framework_path.nil? ? nil : "#{x.vendored_framework_path}/Info.plist" }.compact.flatten.uniq
142
+ podspec_item.exclude_files += podspec_item.vendored_frameworks.map { |x| x.vendored_framework_path.nil? ? nil : "#{x.vendored_framework_path}/#{Configuration.framework_plist_filename}" }.compact.flatten.uniq.sort
145
143
 
146
144
  # Merge xcconfigs
147
145
  if !pod.xcconfig.empty?
@@ -166,27 +164,5 @@ module PodBuilder
166
164
 
167
165
  return podspec_items
168
166
  end
169
-
170
- def self.vendored_framework_path(pod)
171
- if File.exist?(PodBuilder::basepath(vendored_subspec_framework_path(pod)))
172
- return vendored_subspec_framework_path(pod)
173
- elsif File.exist?(PodBuilder::basepath(vendored_spec_framework_path(pod)))
174
- return vendored_spec_framework_path(pod)
175
- end
176
-
177
- return nil
178
- end
179
-
180
- def self.vendored_subspec_framework_path(pod)
181
- return "Rome/#{pod.prebuilt_rel_path}"
182
- end
183
-
184
- def self.vendored_spec_framework_path(pod)
185
- return "Rome/#{pod.module_name}.framework"
186
- end
187
-
188
- def self.vendored_name_framework_path(name)
189
- return "Rome/#{name}"
190
- end
191
167
  end
192
168
  end
@@ -1,4 +1,4 @@
1
1
  module PodBuilder
2
- VERSION = "0.9.1"
2
+ VERSION = "0.9.2"
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.9.1
4
+ version: 0.9.2
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-12-05 00:00:00.000000000 Z
11
+ date: 2019-12-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler