pod-builder 2.0.0.beta.33 → 2.0.0.beta.38

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: b58e2c327114bf83714658e6dd24e5a54ab583f42f81b41c193e83b1c4b8b0f2
4
- data.tar.gz: fc32c5dc1aa63ad240116a0da78bfb10a9acdfb39e192d075b979dbe0828d690
3
+ metadata.gz: 2b464e76791583a1bf1b8b993ebb7fd5084b818dd07a96d38844192928abc333
4
+ data.tar.gz: 1fd90be22ab09b7933748bd8d8ed7e1fd654fe5e1a0355b764af36d83684c37a
5
5
  SHA512:
6
- metadata.gz: 23eb28db1f01119fed69b0a11039049fffe6e74acef44871a61cf7745972ed52d49435febf4ee35647517d001f6292b13b766fc0c18392ae71d4877d8b95ed1a
7
- data.tar.gz: ce587f760d65fcb04778838fb200f6f018fa8cdfb39ae33eee7f67de4d82ad761fae340abc65beaf92a6d03fdd594deba2819771d461c203b25e2c2e7986b470
6
+ metadata.gz: 95d6ed845f6d68446f57ec9eb72b4bf14c498dd9bb05465dc259ef3225f3585489b52ec4c874cd2f92a45689827859f68bb223ed755ef06b7524d9d04f70e4d6
7
+ data.tar.gz: 0cae9e9e1d06326abd71de3c8ce5df3740df01bcef47825b49f6446c1649297281c417a1afe50086da8e4270a8e0518e47563c9d0235a3ad1f20d7f5eaf14b9f
data/README.md CHANGED
@@ -130,7 +130,7 @@ This command will generate a custom lldinit file which will be stored in the _Po
130
130
 
131
131
  The most convenient place to update the lldbinit file is in your Podfile pre_install or post_install actions. It is suggested to add the following lines
132
132
 
133
- ````
133
+ ```
134
134
  pid = spawn("pod_builder generate_lldbinit")
135
135
  Process.detach(pid)
136
136
  ```
@@ -76,9 +76,9 @@ Options:
76
76
  opts.on("-w", "--allow-warnings", "Allow warnings") do |o|
77
77
  OPTIONS[:allow_warnings] = o
78
78
  end
79
- # opts.on("-a", "--auto-resolve-deps", "Resolve pod dependencies automatically") do |o|
80
- # OPTIONS[:auto_resolve_dependencies] = o
81
- # end
79
+ opts.on("-r", "--parent-deps", "Include all pods that depend on the specified <PODNAME...>") do |o|
80
+ OPTIONS[:resolve_parent_dependencies] = true
81
+ end
82
82
  opts.on("-s", "--no-stdin", "Never request interaction with sdtin (e.g. in CI environment)") do |o|
83
83
  OPTIONS[:no_stdin_available] = o
84
84
  end
@@ -282,7 +282,7 @@ Usage:
282
282
  opts.banner = "
283
283
  Usage:
284
284
 
285
- $ pod_builder switch [OPTIONS] PODNAME[s]
285
+ $ pod_builder switch [OPTIONS] <PODNAME...>
286
286
 
287
287
  Switch integration between prebuilt/development/default pod version. Multiple space separated pods can be passed
288
288
 
@@ -297,8 +297,14 @@ Options:
297
297
  opts.on("-s", "--default", "Default version specified in PodBuilder-Podfile") do |o|
298
298
  OPTIONS[:switch_mode] = "default"
299
299
  end
300
- opts.on("-a", "--all", "Include dependencies") do |o|
301
- OPTIONS[:switch_all] = true
300
+ opts.on("-c", "--child-deps", "Include dependencies of the specified <PODNAME...>") do |o|
301
+ OPTIONS[:resolve_child_dependencies] = true
302
+ end
303
+ opts.on("-r", "--parent-deps", "Include all pods that depend on the specified <PODNAME...>") do |o|
304
+ OPTIONS[:resolve_parent_dependencies] = true
305
+ end
306
+ opts.on("-u", "--skip-repo-update", "Skip CocoaPods repo update (only when passing --parent-deps") do |o|
307
+ OPTIONS[:update_repos] = false
302
308
  end
303
309
  end,
304
310
  :call => [
@@ -72,6 +72,16 @@ module PodBuilder
72
72
  podfiles_items = [pods_to_build_debug] + [pods_to_build_release]
73
73
 
74
74
  install_using_frameworks = Podfile::install_using_frameworks(analyzer)
75
+ if Configuration.react_native_project
76
+ if install_using_frameworks
77
+ raise "\n\nOnly static library packaging currently supported for react native projects. Please remove 'use_frameworks!' in #{PodBuilder::basepath("Podfile")}".red
78
+ end
79
+ prepare_defines_modules_override(all_buildable_items)
80
+ else
81
+ unless install_using_frameworks
82
+ raise "\n\nOnly framework packaging currently supported. Please add 'use_frameworks!' at root level (not nested in targets) in #{PodBuilder::basepath("Podfile")}".red
83
+ end
84
+ end
75
85
 
76
86
  install_result = InstallResult.new
77
87
  podfiles_items.reject { |x| x.empty? }.each do |podfile_items|
@@ -118,6 +128,14 @@ module PodBuilder
118
128
 
119
129
  private
120
130
 
131
+ def self.prepare_defines_modules_override(all_buildable_items)
132
+ all_buildable_items.each do |item|
133
+ unless item.defines_module.nil?
134
+ Pod::PodTarget.modules_override[item.root_name] = item.defines_module
135
+ end
136
+ end
137
+ end
138
+
121
139
  def self.check_not_building_subspecs(pods_to_build)
122
140
  pods_to_build.each do |pod_to_build|
123
141
  if pod_to_build.include?("/")
@@ -150,7 +168,7 @@ module PodBuilder
150
168
  end
151
169
 
152
170
  def self.check_not_building_development_pods(pods)
153
- if (development_pods = pods.select { |x| x.is_development_pod }) && development_pods.count > 0 && (OPTIONS[:allow_warnings].nil? && Configuration.allow_building_development_pods == false)
171
+ if (development_pods = pods.select { |x| x.is_development_pod }) && development_pods.count > 0 && (OPTIONS[:allow_warnings].nil? && Configuration.allow_building_development_pods == false && Configuration.react_native_project == false)
154
172
  pod_names = development_pods.map(&:name).join(", ")
155
173
  raise "\n\nThe following pods are in development mode: `#{pod_names}`, won't proceed building.\n\nYou can ignore this error by passing the `--allow-warnings` flag to the build command\n".red
156
174
  end
@@ -187,7 +205,17 @@ module PodBuilder
187
205
  pods_to_build = buildable_items.select { |x| argument_pods.include?(x.root_name) }
188
206
  pods_to_build += other_subspecs(pods_to_build, buildable_items)
189
207
 
190
- return pods_to_build
208
+ if OPTIONS[:resolve_parent_dependencies]
209
+ dependencies = []
210
+ buildable_items.each do |pod|
211
+ if !(pod.dependencies(buildable_items) & pods_to_build).empty?
212
+ dependencies.push(pod)
213
+ end
214
+ end
215
+ pods_to_build += dependencies
216
+ end
217
+
218
+ return pods_to_build.uniq
191
219
  end
192
220
  end
193
221
  end
@@ -38,6 +38,7 @@ module PodBuilder
38
38
 
39
39
  if podfile_content.include?("/node_modules/react-native/")
40
40
  podfile_content = Podfile.prepare_for_react_native(podfile_content)
41
+ update_react_native_podspecs()
41
42
  end
42
43
 
43
44
  File.write(prebuilt_podfile_path, podfile_content)
@@ -116,6 +117,32 @@ module PodBuilder
116
117
  def self.trim_gemfile_line(line)
117
118
  return line.gsub("\"", "'").gsub(" ", "")
118
119
  end
120
+
121
+ def self.update_react_native_podspecs
122
+ # React-Core.podspec
123
+ file = "React-Core.podspec"
124
+ paths = Dir.glob("#{PodBuilder::git_rootpath}/node_modules/**/#{file}")
125
+ raise "Unexpected number of #{file} found" if paths.count != 1
126
+
127
+ content = File.read(paths[0])
128
+ expected_header_search_path_prefix = "s.pod_target_xcconfig = { \"HEADER_SEARCH_PATHS\" => \""
129
+ raise "Expected header search path entry not found" unless content.include?(expected_header_search_path_prefix)
130
+
131
+ content.sub!(expected_header_search_path_prefix, "#{expected_header_search_path_prefix}\\\"$(PODS_ROOT)/Headers/Public/Flipper-Folly\\\" ")
132
+ File.write(paths[0], content)
133
+
134
+ # React-CoreModules.podspec
135
+ file = "React-CoreModules.podspec"
136
+ paths = Dir.glob("#{PodBuilder::git_rootpath}/node_modules/**/#{file}")
137
+ raise "Unexpected number of #{file} found" if paths.count != 1
138
+
139
+ content = File.read(paths[0])
140
+ expected_header_search_path_prefix = "\"HEADER_SEARCH_PATHS\" => \""
141
+ raise "Expected header search path entry not found" unless content.include?(expected_header_search_path_prefix)
142
+
143
+ content.sub!(expected_header_search_path_prefix, "#{expected_header_search_path_prefix}\\\"$(PODS_ROOT)/Headers/Public/Flipper-Folly\\\" ")
144
+ File.write(paths[0], content)
145
+ end
119
146
  end
120
147
  end
121
148
  end
@@ -24,8 +24,29 @@ module PodBuilder
24
24
  pod_names_to_switch.push(pod_name_to_switch)
25
25
  end
26
26
 
27
+ if OPTIONS[:resolve_parent_dependencies] == true
28
+ install_update_repo = OPTIONS.fetch(:update_repos, true)
29
+ installer, analyzer = Analyze.installer_at(PodBuilder::basepath, install_update_repo)
30
+
31
+ all_buildable_items = Analyze.podfile_items(installer, analyzer)
32
+
33
+ pod_names_to_switch.each do |pod_name|
34
+ if pod = (all_buildable_items.detect { |t| t.name == pod_name } || all_buildable_items.detect { |t| t.root_name == pod_name })
35
+ dependencies = []
36
+ all_buildable_items.each do |pod|
37
+ if !(pod.dependency_names & pod_names_to_switch).empty?
38
+ dependencies.push(pod.root_name)
39
+ end
40
+ end
41
+ pod_names_to_switch += dependencies
42
+ end
43
+ end
44
+
45
+ pod_names_to_switch.uniq!
46
+ end
47
+
27
48
  dep_pod_names_to_switch = []
28
- if OPTIONS[:switch_all] == true
49
+ if OPTIONS[:resolve_child_dependencies] == true
29
50
  pod_names_to_switch.each do |pod|
30
51
  podspec_path = PodBuilder::prebuiltpath("#{pod}/#{pod}.podspec")
31
52
  unless File.exist?(podspec_path)
@@ -35,7 +35,7 @@ module PodBuilder
35
35
  ARGV.clear
36
36
  pods_to_update.each { |x| ARGV << x }
37
37
 
38
- # OPTIONS[:auto_resolve_dependencies] = true
38
+ # OPTIONS[:resolve_parent_dependencies] = true
39
39
  return PodBuilder::Command::Build.call
40
40
  end
41
41
  end
@@ -18,32 +18,30 @@ module PodBuilder
18
18
  "Google-Mobile-Ads-SDK" => {
19
19
  "module_name": "GoogleMobileAds"
20
20
  },
21
- "React-jsiexecutor" => {
22
- "remove_module_maps": ["glog"]
23
- },
24
- "React-Core" => {
25
- "remove_module_maps": ["glog"]
21
+ "glog" => {
22
+ "pod_target_xcconfig": { "DEFINES_MODULE": "NO" }
26
23
  },
27
- "React-Core/Default" => {
28
- "public_headers": "React/**/*.{h}"
24
+ "DoubleConversion" => {
25
+ "pod_target_xcconfig": { "DEFINES_MODULE": "NO" }
29
26
  },
30
- "React-jsi" => {
31
- "remove_module_maps": ["glog"]
32
- },
33
- "React-cxxreact" => {
34
- "remove_module_maps": ["glog"]
35
- },
36
27
  "Folly" => {
37
- "remove_module_maps": ["glog"]
28
+ "pod_target_xcconfig": { "DEFINES_MODULE": "NO" }
29
+ },
30
+ "Flipper-DoubleConversion" => {
31
+ "pod_target_xcconfig": { "DEFINES_MODULE": "NO" }
32
+ },
33
+ "Flipper-Folly" => {
34
+ "pod_target_xcconfig": { "DEFINES_MODULE": "NO" }
38
35
  }
39
36
  }.freeze
40
37
  DEFAULT_BUILD_SETTINGS_OVERRIDES = {
41
- "SBTUITestTunnelClient": {
38
+ "SBTUITestTunnelClient" => {
42
39
  "ENABLE_BITCODE": "NO"
43
40
  }
44
41
  }.freeze
45
- DEFAULT_SKIP_PODS = ["GoogleMaps"]
46
- DEFAULT_FORCE_PREBUILD_PODS = ["GoogleTagManager"]
42
+ DEFAULT_SKIP_PODS = ["GoogleMaps", "React-RCTFabric", "React-Core", "React-CoreModules"] # Not including React-RCTNetwork might loose some debug warnings
43
+
44
+ DEFAULT_FORCE_PREBUILD_PODS = []
47
45
  DEFAULT_BUILD_SYSTEM = "Latest".freeze # either Latest (New build system) or Legacy (Standard build system)
48
46
  DEFAULT_LIBRARY_EVOLUTION_SUPPORT = false
49
47
  DEFAULT_PLATFORMS = ["iphoneos", "iphonesimulator", "appletvos", "appletvsimulator"].freeze
@@ -20,7 +20,12 @@ begin
20
20
 
21
21
  if overrides = PodBuilder::Configuration.spec_overrides[spec.name]
22
22
  overrides.each do |k, v|
23
- spec.attributes_hash[k] = v
23
+ if spec.attributes_hash[k].is_a?(Hash)
24
+ current = spec.attributes_hash[k]
25
+ spec.attributes_hash[k] = current.merge(v)
26
+ else
27
+ spec.attributes_hash[k] = v
28
+ end
24
29
  end
25
30
  end
26
31
 
@@ -47,6 +52,24 @@ begin
47
52
  end
48
53
  end
49
54
  end
55
+
56
+ class Pod::PodTarget
57
+ @@modules_override = Hash.new
58
+
59
+ def self.modules_override= (x)
60
+ @@modules_override = x
61
+ end
62
+
63
+ def self.modules_override
64
+ return @@modules_override
65
+ end
66
+
67
+ alias_method :swz_defines_module?, :defines_module?
68
+
69
+ def defines_module?
70
+ return @@modules_override.has_key?(name) ? @@modules_override[name] : swz_defines_module?
71
+ end
72
+ end
50
73
 
51
74
  # Starting from CocoaPods 1.10.0 and later resources are no longer copied inside the .framework
52
75
  # when building static frameworks. While this is correct when using CP normally, for redistributable
@@ -71,28 +94,6 @@ begin
71
94
  return res
72
95
  end
73
96
  end
74
-
75
- class Pod::Target::BuildSettings
76
- alias_method :swz_save_as, :save_as
77
-
78
- @specs_remove_module_maps = Hash.new
79
-
80
- class << self
81
- attr_accessor :specs_remove_module_maps
82
- end
83
-
84
- def save_as(path)
85
- Pod::Target::BuildSettings.specs_remove_module_maps.each do |root_name, module_maps_to_remove|
86
- if target.name == root_name
87
- module_maps_to_remove.each do |module_map_to_remove|
88
- xcconfig.attributes["OTHER_CFLAGS"] = xcconfig.attributes["OTHER_CFLAGS"].gsub(/-fmodule-map-file=\S*#{module_map_to_remove}.modulemap.*?(\s|$)/, '')
89
- end
90
- end
91
- end
92
-
93
- swz_save_as(path)
94
- end
95
- end
96
97
  rescue LoadError
97
98
  # CocoaPods 1.6.2 or earlier
98
99
  end
@@ -160,8 +161,6 @@ module PodBuilder
160
161
  FileUtils.touch(lock_file)
161
162
 
162
163
  prebuilt_entries = use_prebuilt_entries_for_unchanged_pods(podfile_path, podfile_items)
163
-
164
- prepare_for_static_framework_workarounds(podfile_content, podfile_items)
165
164
 
166
165
  install
167
166
 
@@ -244,16 +243,6 @@ module PodBuilder
244
243
  return ret
245
244
  end
246
245
  private
247
-
248
- def self.prepare_for_static_framework_workarounds(podfile_content, podfile_items)
249
- unless podfile_content.include?("use_modular_headers!")
250
- return
251
- end
252
-
253
- podfile_items.each do |podfile_item|
254
- Pod::Target::BuildSettings.specs_remove_module_maps[podfile_item.root_name] = podfile_item.remove_module_maps
255
- end
256
- end
257
246
 
258
247
  def self.license_specifiers
259
248
  acknowledge_file = "#{Configuration.build_path}/Pods/Target Support Files/Pods-DummyTarget/Pods-DummyTarget-acknowledgements.plist"
@@ -267,11 +256,7 @@ module PodBuilder
267
256
  return data["PreferenceSpecifiers"] || []
268
257
  end
269
258
 
270
- def self.copy_development_pods_source_code(podfile_content, podfile_items)
271
- if Configuration.build_using_repo_paths
272
- return podfile_content
273
- end
274
-
259
+ def self.copy_development_pods_source_code(podfile_content, podfile_items)
275
260
  # Development pods are normally built/integrated without moving files from their original paths.
276
261
  # It is important that CocoaPods compiles the files under Configuration.build_path in order that
277
262
  # DWARF debug info reference to this constant path. Doing otherwise breaks the assumptions that
@@ -287,7 +272,9 @@ module PodBuilder
287
272
  FileUtils.cp_r("#{PodBuilder::basepath(podfile_item.path)}/.", destination_path)
288
273
  end
289
274
 
290
- podfile_content.gsub!("'#{podfile_item.path}'", "'#{destination_path}'")
275
+ unless Configuration.build_using_repo_paths
276
+ podfile_content.gsub!("'#{podfile_item.path}'", "'#{destination_path}'")
277
+ end
291
278
  end
292
279
 
293
280
  return podfile_content
@@ -406,9 +393,11 @@ module PodBuilder
406
393
  next
407
394
  end
408
395
 
409
- destination_folder = PodBuilder::prebuiltpath(root_name)
410
- FileUtils.mkdir_p(destination_folder)
411
- FileUtils.cp_r("#{source_path}/.", destination_folder)
396
+ unless Dir.glob("#{source_path}/**/*").select { |t| File.file?(t) }.empty?
397
+ destination_folder = PodBuilder::prebuiltpath(root_name)
398
+ FileUtils.mkdir_p(destination_folder)
399
+ FileUtils.cp_r("#{source_path}/.", destination_folder)
400
+ end
412
401
  end
413
402
 
414
403
  # Folder won't exist if no dSYM were generated (all static libs)
@@ -503,8 +492,10 @@ module PodBuilder
503
492
  if scheme_file = Dir.glob("#{Configuration.build_path}/Pods/**/xcschememanagement.plist").first
504
493
  plist = CFPropertyList::List.new(:file => scheme_file)
505
494
  data = CFPropertyList.native_types(plist.value)
506
-
507
- data["SchemeUserState"]["Pods-DummyTarget.xcscheme"]["isShown"] = true
495
+
496
+ if !data.dig("SchemeUserState", "Pods-DummyTarget.xcscheme").nil?
497
+ data["SchemeUserState"]["Pods-DummyTarget.xcscheme"]["isShown"] = true
498
+ end
508
499
 
509
500
  plist.value = CFPropertyList.guess(data)
510
501
  plist.save(scheme_file, CFPropertyList::List::FORMAT_BINARY)
@@ -394,9 +394,6 @@ module PodBuilder
394
394
  def self.install_using_frameworks(analyzer)
395
395
  target_settings = analyzer.podfile.target_definition_list.map(&:uses_frameworks?).uniq
396
396
  if target_settings.count == 1
397
- if target_settings.first == false && ENV["DEBUGGING"].nil?
398
- raise "\n\nOnly framework packaging currently supported. Please add 'use_frameworks!' at Podfile root level (not nested in targets)".red
399
- end
400
397
  return target_settings.first
401
398
  elsif target_settings.count > 1
402
399
  raise "\n\n'use_frameworks!' should be declared only once at Podfile root level (not nested in targets)".red
@@ -75,13 +75,13 @@ module PodBuilder
75
75
  #
76
76
  attr_accessor :is_external
77
77
 
78
- # @return [String] The pod's build configuration
78
+ # @return [String] Header directory name
79
79
  #
80
- attr_accessor :build_configuration
80
+ attr_accessor :header_dir
81
81
 
82
- # @return [Array<String>] When building static frameworks we sometimes have to remove module maps from Other C flags to make compilation succeed
82
+ # @return [String] The pod's build configuration
83
83
  #
84
- attr_accessor :remove_module_maps
84
+ attr_accessor :build_configuration
85
85
 
86
86
  # @return [String] The pod's vendored frameworks
87
87
  #
@@ -130,6 +130,10 @@ module PodBuilder
130
130
  # @return [Array<String>] Default subspecs
131
131
  #
132
132
  attr_accessor :default_subspecs
133
+
134
+ # @return [Bool] Defines module
135
+ #
136
+ attr_accessor :defines_module
133
137
 
134
138
  # Initialize a new instance
135
139
  #
@@ -159,6 +163,11 @@ module PodBuilder
159
163
  @commit = spec.root.source[:commit]
160
164
  @is_external = false
161
165
  end
166
+
167
+ @defines_module = nil # nil is not specified
168
+ if override = spec.attributes_hash.dig("pod_target_xcconfig", "DEFINES_MODULE")
169
+ @defines_module = (override == "YES")
170
+ end
162
171
 
163
172
  @vendored_frameworks = extract_vendored_frameworks(spec, all_specs)
164
173
  @vendored_libraries = extract_vendored_libraries(spec, all_specs)
@@ -176,6 +185,8 @@ module PodBuilder
176
185
  @libraries += extract_array(spec, "library")
177
186
  @libraries += extract_array(spec, "libraries")
178
187
 
188
+ @header_dir = spec.attributes_hash["header_dir"]
189
+
179
190
  @version = spec.root.version.version
180
191
  @available_versions = spec.respond_to?(:spec_source) ? spec.spec_source.versions(@root_name)&.map(&:to_s) : [@version]
181
192
 
@@ -212,8 +223,6 @@ module PodBuilder
212
223
  @build_configuration = spec.root.attributes_hash.dig("pod_target_xcconfig", "prebuild_configuration") || "release"
213
224
  @build_configuration.downcase!
214
225
 
215
- @remove_module_maps = spec.root.attributes_hash["remove_module_maps"] || []
216
-
217
226
  default_license = "MIT"
218
227
  @license = spec.root.attributes_hash.fetch("license", {"type"=>"#{default_license}"})["type"] || default_license
219
228
  @summary = spec.root.attributes_hash.fetch("summary", "A summary for #{@name}")
@@ -39,7 +39,7 @@ module PodBuilder
39
39
  existing_vendored_frameworks = vendored_frameworks.select(&if_exists)
40
40
  existing_vendored_frameworks_basename = vendored_frameworks.map { |t| File.basename(t) }.select(&if_exists)
41
41
  vendored_frameworks = (existing_vendored_frameworks + existing_vendored_frameworks_basename).uniq
42
-
42
+
43
43
  vendored_libraries = item.vendored_libraries
44
44
  if install_using_frameworks
45
45
  existing_vendored_libraries = vendored_libraries.map { |t| "#{item.module_name}/#{t}" }.select(&if_exists)
@@ -56,10 +56,10 @@ module PodBuilder
56
56
 
57
57
  exclude_files = static_frameworks.map { |x| x.vendored_framework_path.nil? ? nil : "#{x.vendored_framework_path}/Info.plist" }.compact.flatten.uniq
58
58
  public_headers = []
59
- else
59
+ else
60
60
  public_headers = Dir.glob(PodBuilder::prebuiltpath("#{item.root_name}/#{item.root_name}/Headers/**/*.h"))
61
61
  vendored_libraries += ["#{item.root_name}/lib#{item.root_name}.a"]
62
- vendored_libraries.map! { |t| "#{item.root_name}/#{t}" }.select(&if_exists)
62
+ vendored_libraries = vendored_libraries.select(&if_exists)
63
63
 
64
64
  resources = ["#{item.root_name}/*.{nib,bundle,xcasset,strings,png,jpg,tif,tiff,otf,ttf,ttc,plist,json,caf,wav,p12,momd}"]
65
65
 
@@ -97,6 +97,10 @@ module PodBuilder
97
97
  if public_headers.count > 0
98
98
  podspec += "#{indentation}#{spec_var}.public_header_files = '#{item.root_name}/Headers/**/*.h'\n"
99
99
  end
100
+ if !item.header_dir.nil? && !install_using_frameworks
101
+ podspec += "#{indentation}#{spec_var}.header_dir = '#{item.header_dir}'\n"
102
+ podspec += "#{indentation}#{spec_var}.header_mappings_dir = '#{item.root_name}/Headers/#{item.header_dir}'\n"
103
+ end
100
104
 
101
105
  if item.xcconfig.keys.count > 0
102
106
  xcconfig = Hash.new
@@ -122,20 +126,26 @@ module PodBuilder
122
126
  podspec += "#{indentation}#{spec_var}.xcconfig = #{xcconfig.to_s}\n"
123
127
  end
124
128
  end
125
- if !install_using_frameworks && spec_var == "p1"
129
+ if !install_using_frameworks && spec_var == "p1" && vendored_libraries.map { |t| File.basename(t) }.include?("lib#{item.root_name}.a" )
126
130
  module_path_files = Dir.glob(PodBuilder.prebuiltpath("#{item.root_name}/**/#{item.root_name}.modulemap"))
127
131
  raise "\n\nToo many module maps found for #{item.root_name}".red if module_path_files.count > 1
132
+
133
+ rel_path = Pathname.new(PodBuilder::prebuiltpath).relative_path_from(Pathname.new(PodBuilder::project_path("Pods"))).to_s
134
+ prebuilt_root_var = "#{item.root_name.upcase.gsub("-", "_")}_PREBUILT_ROOT"
135
+
136
+ static_cfg = Hash.new
128
137
  if module_path_file = module_path_files.first
129
- rel_path = Pathname.new(PodBuilder::prebuiltpath).relative_path_from(Pathname.new(PodBuilder::project_path("Pods"))).to_s
130
- prebuilt_root_var = "#{item.root_name.upcase.gsub("-", "_")}_PREBUILT_ROOT"
131
138
  module_map_rel = module_path_file.gsub(PodBuilder::prebuiltpath("#{item.root_name}/#{item.root_name}/"), "")
132
- static_cfg = { prebuilt_root_var => "$(PODS_ROOT)/#{rel_path}",
133
- "SWIFT_INCLUDE_PATHS" => "$(inherited) \"$(#{prebuilt_root_var})/#{item.root_name}/#{item.root_name}\"",
139
+ static_cfg = { "SWIFT_INCLUDE_PATHS" => "$(inherited) \"$(#{prebuilt_root_var})/#{item.root_name}/#{item.root_name}\"",
134
140
  "OTHER_CFLAGS" => "$(inherited) -fmodule-map-file=\"$(#{prebuilt_root_var})/#{item.root_name}/#{item.root_name}/#{module_map_rel}\"",
135
141
  "OTHER_SWIFT_FLAGS" => "$(inherited) -Xcc -fmodule-map-file=\"$(#{prebuilt_root_var})/#{item.root_name}/#{item.root_name}/#{module_map_rel}\""
136
- }
137
- podspec += "#{indentation}#{spec_var}.xcconfig = #{static_cfg.to_s}\n"
138
- end
142
+ }
143
+ end
144
+ static_cfg[prebuilt_root_var] = "$(PODS_ROOT)/#{rel_path}"
145
+
146
+ podspec += "#{indentation}#{spec_var}.xcconfig = #{static_cfg.to_s}\n"
147
+ # This seems to be a viable workaround to https://github.com/CocoaPods/CocoaPods/issues/9559 and https://github.com/CocoaPods/CocoaPods/issues/8454
148
+ podspec += "#{indentation}#{spec_var}.user_target_xcconfig = { \"OTHER_LDFLAGS\" => \"$(inherited) -L\\\"$(#{prebuilt_root_var})/#{item.root_name}/#{item.root_name}\\\" -l\\\"#{item.root_name}\\\"\" }\n"
139
149
  end
140
150
 
141
151
  deps = item.dependency_names.sort
@@ -3,6 +3,7 @@
3
3
  require 'fourflusher'
4
4
  require 'colored'
5
5
  require 'pathname'
6
+ require 'ruby-progressbar'
6
7
 
7
8
  module PodBuilder
8
9
  def self.build_for_iosish_platform_framework(sandbox, build_dir, target, device, simulator, configuration, deterministic_build, build_for_apple_silicon)
@@ -20,7 +21,7 @@ module PodBuilder
20
21
  excluded_archs = ["i386"] # Fixes https://github.com/Subito-it/PodBuilder/issues/17
21
22
  excluded_archs += build_for_apple_silicon ? [] : ["arm64"]
22
23
  xcodebuild(sandbox, target_label, simulator, deployment_target, configuration, deterministic_build, excluded_archs, {})
23
-
24
+
24
25
  spec_names = target.specs.map { |spec| [spec.root.name, spec.root.module_name] }.uniq
25
26
  spec_names.each do |root_name, module_name|
26
27
  device_base = "#{build_dir}/#{configuration}-#{device}/#{root_name}"
@@ -66,45 +67,47 @@ module PodBuilder
66
67
  FileUtils.rm_rf(simulator_framework_lib)
67
68
  end
68
69
  end
69
-
70
+
70
71
  def self.build_for_iosish_platform_lib(sandbox, build_dir, target, device, simulator, configuration, deterministic_build, build_for_apple_silicon, prebuilt_root_paths)
71
72
  raise "\n\nApple silicon hardware still unsupported since it requires to migrate to xcframeworks".red if build_for_apple_silicon
72
-
73
+
73
74
  deployment_target = target.platform_deployment_target
74
75
  target_label = target.cocoapods_target_label
75
-
76
+
76
77
  spec_names = target.specs.map { |spec| [spec.root.name, spec.root.module_name] }.uniq
77
-
78
+
78
79
  xcodebuild(sandbox, target_label, device, deployment_target, configuration, deterministic_build, [], prebuilt_root_paths)
79
80
  excluded_archs = build_for_apple_silicon ? [] : ["arm64"]
80
81
  xcodebuild(sandbox, target_label, simulator, deployment_target, configuration, deterministic_build, excluded_archs, prebuilt_root_paths)
81
-
82
+
82
83
  spec_names.each do |root_name, module_name|
83
84
  simulator_base = "#{build_dir}/#{configuration}-#{simulator}/#{root_name}"
84
- simulator_lib = "#{simulator_base}/lib#{module_name}.a"
85
-
85
+ simulator_lib = "#{simulator_base}/lib#{root_name}.a"
86
+
86
87
  device_base = "#{build_dir}/#{configuration}-#{device}/#{root_name}"
87
88
  device_lib = "#{device_base}/lib#{root_name}.a"
88
-
89
- if File.file?(device_lib) && File.file?(simulator_lib)
90
- # Starting with Xcode 12b3 the simulator binary contains an arm64 slice as well which conflict with the one in the device_lib
91
- # when creating the fat library. A naive workaround is to remove the arm64 from the simulator_lib however this is wrong because
92
- # we might actually need to have 2 separated arm64 slices, one for simulator and one for device each built with different
93
- # compile time directives (e.g #if targetEnvironment(simulator))
94
- #
95
- # For the time being we remove the arm64 slice bacause otherwise the `xcrun lipo -create -output ...` would fail.
96
- if `xcrun lipo -info #{simulator_lib}`.include?("arm64")
97
- `xcrun lipo -remove arm64 #{simulator_lib} -o #{simulator_lib}`
98
- end
99
-
100
- raise "Lipo failed on #{device_lib}" unless system("xcrun lipo -create -output #{device_lib} #{device_lib} #{simulator_lib}")
89
+
90
+ unless File.file?(device_lib) && File.file?(simulator_lib)
91
+ next
101
92
  end
102
-
93
+
94
+ # Starting with Xcode 12b3 the simulator binary contains an arm64 slice as well which conflict with the one in the device_lib
95
+ # when creating the fat library. A naive workaround is to remove the arm64 from the simulator_lib however this is wrong because
96
+ # we might actually need to have 2 separated arm64 slices, one for simulator and one for device each built with different
97
+ # compile time directives (e.g #if targetEnvironment(simulator))
98
+ #
99
+ # For the time being we remove the arm64 slice bacause otherwise the `xcrun lipo -create -output ...` would fail.
100
+ if `xcrun lipo -info #{simulator_lib}`.include?("arm64")
101
+ `xcrun lipo -remove arm64 #{simulator_lib} -o #{simulator_lib}`
102
+ end
103
+
104
+ raise "Lipo failed on #{device_lib}" unless system("xcrun lipo -create -output #{device_lib} #{device_lib} #{simulator_lib}")
105
+
103
106
  device_headers = Dir.glob("#{device_base}/**/*.h")
104
107
  simulator_headers = Dir.glob("#{simulator_base}/**/*.h")
105
108
  device_headers.each do |device_path|
106
109
  simulator_path = device_path.gsub(device_base, simulator_base)
107
-
110
+
108
111
  merge_header_into(device_path, simulator_path)
109
112
  end
110
113
  simulator_only_headers = simulator_headers - device_headers.map { |t| t.gsub(device_base, simulator_base) }
@@ -115,12 +118,12 @@ module PodBuilder
115
118
  FileUtils.mkdir_p(destination_folder)
116
119
  FileUtils.cp(path, destination_folder)
117
120
  end
118
-
121
+
119
122
  swiftmodule_path = "#{simulator_base}/#{root_name}.swiftmodule"
120
123
  if File.directory?(swiftmodule_path)
121
124
  FileUtils.cp_r("#{swiftmodule_path}/.", "#{device_base}/#{root_name}.swiftmodule")
122
125
  end
123
-
126
+
124
127
  if File.exist?("#{device_base}/#{root_name}.swiftmodule")
125
128
  # This is a swift pod with a swiftmodule in the root of the prebuilt folder
126
129
  else
@@ -130,7 +133,7 @@ module PodBuilder
130
133
  if public_headers_path.downcase != module_public_headers_path.downcase && File.directory?(public_headers_path) && File.directory?(module_public_headers_path)
131
134
  # For pods with module_name != name we have to move the modulemap files to the root_name one
132
135
  module_public_headers_path = "#{Configuration.build_path}/Pods/Headers/Public/#{module_name}"
133
- FileUtils.cp_r("#{module_public_headers_path}/.", public_headers_path)
136
+ FileUtils.cp_r("#{module_public_headers_path}/.", public_headers_path, :remove_destination => true)
134
137
  end
135
138
  Dir.glob("#{public_headers_path}/**/*.*").each do |path|
136
139
  destination_folder = "#{device_base}/Headers" + path.gsub(public_headers_path, "")
@@ -139,11 +142,11 @@ module PodBuilder
139
142
  FileUtils.cp(path, destination_folder)
140
143
  end
141
144
  end
142
-
145
+
143
146
  destination_path = "#{build_dir}/#{root_name}"
144
147
  if Dir.glob("#{device_base}/**/*.{a,framework,h}").count > 0
145
148
  FileUtils.mv(device_base, destination_path)
146
-
149
+
147
150
  module_maps = Dir.glob("#{destination_path}/**/*.modulemap")
148
151
  module_map_device_base = device_base.gsub(/^\/private/, "") + "/"
149
152
  module_maps.each do |module_map|
@@ -154,7 +157,7 @@ module PodBuilder
154
157
  end
155
158
  end
156
159
  end
157
-
160
+
158
161
  def self.merge_header_into(device_file, simulator_file)
159
162
  unless File.exist?(device_file) || File.exist?(simulator_file)
160
163
  return
@@ -163,33 +166,33 @@ module PodBuilder
163
166
  device_content = File.file?(device_file) ? File.read(device_file) : ""
164
167
  simulator_content = File.file?(simulator_file) ? File.read(simulator_file) : ""
165
168
  merged_content = %{
166
- #if TARGET_OS_SIMULATOR
167
- // ->
168
-
169
- #{simulator_content}
170
-
171
- // ->
172
- #else
173
- // ->
174
-
175
- #{device_content}
176
-
177
- // ->
178
- #endif
169
+ #if TARGET_OS_SIMULATOR
170
+ // ->
171
+
172
+ #{simulator_content}
173
+
174
+ // ->
175
+ #else
176
+ // ->
177
+
178
+ #{device_content}
179
+
180
+ // ->
181
+ #endif
179
182
  }
180
183
  File.write(device_file, merged_content)
181
184
  end
182
-
185
+
183
186
  def self.add_simulator_conditional(path)
184
187
  file_content = File.read(path)
185
188
  content = %{
186
- #if TARGET_OS_SIMULATOR
187
- #{file_content}
188
- #endif
189
+ #if TARGET_OS_SIMULATOR
190
+ #{file_content}
191
+ #endif
189
192
  }
190
193
  File.write(path, content)
191
194
  end
192
-
195
+
193
196
  def self.xcodebuild(sandbox, target, sdk='macosx', deployment_target=nil, configuration, deterministic_build, exclude_archs, prebuilt_root_paths)
194
197
  args = %W(-project #{sandbox.project_path.realdirpath} -scheme #{target} -configuration #{configuration} -sdk #{sdk})
195
198
  supported_platforms = { 'iphonesimulator' => 'iOS', 'appletvsimulator' => 'tvOS', 'watchsimulator' => 'watchOS' }
@@ -267,15 +270,27 @@ module PodBuilder
267
270
  end
268
271
 
269
272
  Pod::HooksManager.register('podbuilder-rome', :post_install) do |installer_context, user_options|
270
- puts "Building".yellow
273
+ build_items_count = installer_context.umbrella_targets.map(&:specs).flatten.count
274
+ progressbar = ProgressBar.create(:length => 80,
275
+ :total => build_items_count,
276
+ :title => "Building",
277
+ :format => "%t |%b>%i| %c/%C done".yellow)
271
278
 
279
+ progressbar_thread = Thread.new {
280
+ loop do
281
+ built_pods = Dir.glob("#{PodBuilder::Configuration.build_path}/build/Release*/*").count
282
+ progressbar.progress = [[0, built_pods - 1].max, progressbar.total].min
283
+ sleep(5)
284
+ end
285
+ }
286
+
272
287
  enable_dsym = user_options.fetch('dsym', true)
273
288
  configuration = user_options.fetch('configuration', 'Debug')
274
289
  uses_frameworks = user_options.fetch('uses_frameworks', true)
275
290
  if user_options["pre_compile"]
276
291
  user_options["pre_compile"].call(installer_context)
277
292
  end
278
-
293
+
279
294
  prebuilt_root_paths = JSON.parse(user_options["prebuilt_root_paths"].gsub('=>', ':'))
280
295
 
281
296
  sandbox_root = Pathname(installer_context.sandbox_root)
@@ -299,72 +314,74 @@ Pod::HooksManager.register('podbuilder-rome', :post_install) do |installer_conte
299
314
  when [:tvos, false] then PodBuilder::build_for_iosish_platform_lib(sandbox, build_dir, target, 'appletvos', 'appletvsimulator', configuration, PodBuilder::Configuration.deterministic_build, PodBuilder::Configuration.build_for_apple_silicon, prebuilt_root_paths)
300
315
  when [:watchos, false] then PodBuilder::build_for_iosish_platform_lib(sandbox, build_dir, target, 'watchos', 'watchsimulator', configuration, PodBuilder::Configuration.deterministic_build, PodBuilder::Configuration.build_for_apple_silicon, prebuilt_root_paths)
301
316
  else raise "\n\nUnknown platform '#{target.platform_name}'".red end
302
- end
317
+ end
303
318
 
304
- raise Pod::Informative, 'The build directory was not found in the expected location.' unless build_dir.directory?
305
-
306
- specs = installer_context.umbrella_targets.map { |t| t.specs.map(&:name) }.flatten.map { |t| t.split("/").first }.uniq
307
- built_count = Dir["#{build_dir}/*"].select { |t| specs.include?(File.basename(t)) }.count
308
- Pod::UI.puts "Built #{built_count} #{'items'.pluralize(built_count)}, copying..."
319
+ progressbar.finish
320
+ progressbar_thread.exit
309
321
 
310
- base_destination.rmtree if base_destination.directory?
311
-
312
- installer_context.umbrella_targets.each do |umbrella|
313
- umbrella.specs.each do |spec|
314
- root_name = spec.name.split("/").first
315
-
316
- if uses_frameworks
317
- destination = File.join(base_destination, root_name)
318
- else
319
- destination = File.join(base_destination, root_name, root_name)
320
- end
321
- # Make sure the device target overwrites anything in the simulator build, otherwise iTunesConnect
322
- # can get upset about Info.plist containing references to the simulator SDK
323
- files = Pathname.glob("build/#{root_name}/*").reject { |f| f.to_s =~ /Pods[^.]+\.framework/ }
324
-
325
- consumer = spec.consumer(umbrella.platform_name)
326
- file_accessor = Pod::Sandbox::FileAccessor.new(sandbox.pod_dir(spec.root.name), consumer)
327
- files += file_accessor.vendored_libraries
328
- files += file_accessor.vendored_frameworks
329
- files += file_accessor.resources
330
-
331
- FileUtils.mkdir_p(destination)
332
- files.each do |file|
333
- FileUtils.cp_r(file, destination)
334
- end
335
- end
336
- end
322
+ raise Pod::Informative, 'The build directory was not found in the expected location.' unless build_dir.directory?
323
+
324
+ specs = installer_context.umbrella_targets.map { |t| t.specs.map(&:name) }.flatten.map { |t| t.split("/").first }.uniq
325
+ built_count = Dir["#{build_dir}/*"].select { |t| specs.include?(File.basename(t)) }.count
326
+ Pod::UI.puts "Built #{built_count} #{'items'.pluralize(built_count)}, copying..."
327
+
328
+ base_destination.rmtree if base_destination.directory?
337
329
 
338
- # Depending on the resource it may happen that it is present twice, both in the .framework and in the parent folder
339
- Dir.glob("#{base_destination}/*") do |path|
340
- unless File.directory?(path)
341
- return
330
+ installer_context.umbrella_targets.each do |umbrella|
331
+ umbrella.specs.each do |spec|
332
+ root_name = spec.name.split("/").first
333
+
334
+ if uses_frameworks
335
+ destination = File.join(base_destination, root_name)
336
+ else
337
+ destination = File.join(base_destination, root_name, root_name)
342
338
  end
339
+ # Make sure the device target overwrites anything in the simulator build, otherwise iTunesConnect
340
+ # can get upset about Info.plist containing references to the simulator SDK
341
+ files = Pathname.glob("build/#{root_name}/*").reject { |f| f.to_s =~ /Pods[^.]+\.framework/ }
343
342
 
344
- files = Dir.glob("#{path}/*")
345
- framework_files = Dir.glob("#{path}/*.framework/**/*").map { |t| File.basename(t) }
343
+ consumer = spec.consumer(umbrella.platform_name)
344
+ file_accessor = Pod::Sandbox::FileAccessor.new(sandbox.pod_dir(spec.root.name), consumer)
345
+ files += file_accessor.vendored_libraries
346
+ files += file_accessor.vendored_frameworks
347
+ files += file_accessor.resources
346
348
 
349
+ FileUtils.mkdir_p(destination)
347
350
  files.each do |file|
348
- filename = File.basename(file.gsub(/\.xib$/, ".nib"))
349
- if framework_files.include?(filename)
350
- FileUtils.rm_rf(file)
351
- end
352
- end
351
+ FileUtils.cp_r(file, destination)
352
+ end
353
353
  end
354
-
355
- if enable_dsym
356
- dsym_source = "#{build_dir}/dSYM"
357
- if File.directory?(dsym_source)
358
- FileUtils.mv(dsym_source, sandbox_root.parent)
359
- end
360
- else
361
- raise "Not implemented"
354
+ end
355
+
356
+ # Depending on the resource it may happen that it is present twice, both in the .framework and in the parent folder
357
+ Dir.glob("#{base_destination}/*") do |path|
358
+ unless File.directory?(path)
359
+ return
362
360
  end
363
361
 
364
- build_dir.rmtree if build_dir.directory?
362
+ files = Dir.glob("#{path}/*")
363
+ framework_files = Dir.glob("#{path}/*.framework/**/*").map { |t| File.basename(t) }
365
364
 
366
- if user_options["post_compile"]
367
- user_options["post_compile"].call(installer_context)
365
+ files.each do |file|
366
+ filename = File.basename(file.gsub(/\.xib$/, ".nib"))
367
+ if framework_files.include?(filename)
368
+ FileUtils.rm_rf(file)
369
+ end
370
+ end
371
+ end
372
+
373
+ if enable_dsym
374
+ dsym_source = "#{build_dir}/dSYM"
375
+ if File.directory?(dsym_source)
376
+ FileUtils.mv(dsym_source, sandbox_root.parent)
368
377
  end
378
+ else
379
+ raise "Not implemented"
380
+ end
381
+
382
+ build_dir.rmtree if build_dir.directory?
383
+
384
+ if user_options["post_compile"]
385
+ user_options["post_compile"].call(installer_context)
369
386
  end
370
-
387
+ end
@@ -1,4 +1,4 @@
1
1
  module PodBuilder
2
- VERSION = "2.0.0.beta.33"
2
+ VERSION = "2.0.0.beta.38"
3
3
  end
4
4
 
@@ -35,4 +35,5 @@ Gem::Specification.new do |spec|
35
35
  spec.add_runtime_dependency 'cocoapods-core', '~> 1.6'
36
36
  spec.add_runtime_dependency 'CFPropertyList'
37
37
  spec.add_runtime_dependency 'json'
38
+ spec.add_runtime_dependency 'ruby-progressbar', '~> 1.10'
38
39
  end
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: 2.0.0.beta.33
4
+ version: 2.0.0.beta.38
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tomas Camin
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-10-04 00:00:00.000000000 Z
11
+ date: 2020-10-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -164,6 +164,20 @@ dependencies:
164
164
  - - ">="
165
165
  - !ruby/object:Gem::Version
166
166
  version: '0'
167
+ - !ruby/object:Gem::Dependency
168
+ name: ruby-progressbar
169
+ requirement: !ruby/object:Gem::Requirement
170
+ requirements:
171
+ - - "~>"
172
+ - !ruby/object:Gem::Version
173
+ version: '1.10'
174
+ type: :runtime
175
+ prerelease: false
176
+ version_requirements: !ruby/object:Gem::Requirement
177
+ requirements:
178
+ - - "~>"
179
+ - !ruby/object:Gem::Version
180
+ version: '1.10'
167
181
  description: Prebuild CocoaPods pods to make compiling your Xcode projects faster
168
182
  email:
169
183
  - tomas.camin@adevinta.com