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

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b58e2c327114bf83714658e6dd24e5a54ab583f42f81b41c193e83b1c4b8b0f2
4
- data.tar.gz: fc32c5dc1aa63ad240116a0da78bfb10a9acdfb39e192d075b979dbe0828d690
3
+ metadata.gz: 31aa509b926c753841f3739996fad1be623bac4ceee8ae30ae9b1ee254f2ddb3
4
+ data.tar.gz: 56df221c8e00be54c33cfa491629d0d13a22087108d8722a8bf925cbd85e959e
5
5
  SHA512:
6
- metadata.gz: 23eb28db1f01119fed69b0a11039049fffe6e74acef44871a61cf7745972ed52d49435febf4ee35647517d001f6292b13b766fc0c18392ae71d4877d8b95ed1a
7
- data.tar.gz: ce587f760d65fcb04778838fb200f6f018fa8cdfb39ae33eee7f67de4d82ad761fae340abc65beaf92a6d03fdd594deba2819771d461c203b25e2c2e7986b470
6
+ metadata.gz: 3b55c31c20f5e676ff8c004d233449cbd57acac51d2fb7925340e7e25c949e9c72743ba2683255b34e5ea72bf13da5394b39f2cd0383fa95d82f9ebbb263c948
7
+ data.tar.gz: 05e76c637a0dcb3856698ce8f144e9ca734e4463edfe19ed9677c87dee7447b473da3e0918fb7c0c79f78b90604938ebe7d2b22ba1826f74377fb808ba77818e
@@ -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("-a", "--auto-resolve-deps", "Include all pods that depend on the specified <PODNAME...>") do |o|
80
+ OPTIONS[:auto_resolve_dependencies] = o
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
@@ -72,6 +72,10 @@ 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
+
76
+ unless install_using_frameworks
77
+ prepare_defines_modules_override(all_buildable_items)
78
+ end
75
79
 
76
80
  install_result = InstallResult.new
77
81
  podfiles_items.reject { |x| x.empty? }.each do |podfile_items|
@@ -118,6 +122,14 @@ module PodBuilder
118
122
 
119
123
  private
120
124
 
125
+ def self.prepare_defines_modules_override(all_buildable_items)
126
+ all_buildable_items.each do |item|
127
+ unless item.defines_module.nil?
128
+ Pod::PodTarget.modules_override[item.root_name] = item.defines_module
129
+ end
130
+ end
131
+ end
132
+
121
133
  def self.check_not_building_subspecs(pods_to_build)
122
134
  pods_to_build.each do |pod_to_build|
123
135
  if pod_to_build.include?("/")
@@ -187,7 +199,17 @@ module PodBuilder
187
199
  pods_to_build = buildable_items.select { |x| argument_pods.include?(x.root_name) }
188
200
  pods_to_build += other_subspecs(pods_to_build, buildable_items)
189
201
 
190
- return pods_to_build
202
+ if OPTIONS[:auto_resolve_dependencies]
203
+ dependencies = []
204
+ buildable_items.each do |pod|
205
+ if !(pod.dependencies(buildable_items) & pods_to_build).empty?
206
+ dependencies.push(pod)
207
+ end
208
+ end
209
+ pods_to_build += dependencies
210
+ end
211
+
212
+ return pods_to_build.uniq
191
213
  end
192
214
  end
193
215
  end
@@ -18,32 +18,29 @@ 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
42
  DEFAULT_SKIP_PODS = ["GoogleMaps"]
46
- DEFAULT_FORCE_PREBUILD_PODS = ["GoogleTagManager"]
43
+ DEFAULT_FORCE_PREBUILD_PODS = []
47
44
  DEFAULT_BUILD_SYSTEM = "Latest".freeze # either Latest (New build system) or Legacy (Standard build system)
48
45
  DEFAULT_LIBRARY_EVOLUTION_SUPPORT = false
49
46
  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"
@@ -406,9 +395,11 @@ module PodBuilder
406
395
  next
407
396
  end
408
397
 
409
- destination_folder = PodBuilder::prebuiltpath(root_name)
410
- FileUtils.mkdir_p(destination_folder)
411
- FileUtils.cp_r("#{source_path}/.", destination_folder)
398
+ unless Dir.glob("#{source_path}/**/*").select { |t| File.file?(t) }.empty?
399
+ destination_folder = PodBuilder::prebuiltpath(root_name)
400
+ FileUtils.mkdir_p(destination_folder)
401
+ FileUtils.cp_r("#{source_path}/.", destination_folder)
402
+ end
412
403
  end
413
404
 
414
405
  # Folder won't exist if no dSYM were generated (all static libs)
@@ -503,8 +494,10 @@ module PodBuilder
503
494
  if scheme_file = Dir.glob("#{Configuration.build_path}/Pods/**/xcschememanagement.plist").first
504
495
  plist = CFPropertyList::List.new(:file => scheme_file)
505
496
  data = CFPropertyList.native_types(plist.value)
506
-
507
- data["SchemeUserState"]["Pods-DummyTarget.xcscheme"]["isShown"] = true
497
+
498
+ if !data.dig("SchemeUserState", "Pods-DummyTarget.xcscheme").nil?
499
+ data["SchemeUserState"]["Pods-DummyTarget.xcscheme"]["isShown"] = true
500
+ end
508
501
 
509
502
  plist.value = CFPropertyList.guess(data)
510
503
  plist.save(scheme_file, CFPropertyList::List::FORMAT_BINARY)
@@ -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,9 @@ 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
+ end
100
103
 
101
104
  if item.xcconfig.keys.count > 0
102
105
  xcconfig = Hash.new
@@ -122,20 +125,26 @@ module PodBuilder
122
125
  podspec += "#{indentation}#{spec_var}.xcconfig = #{xcconfig.to_s}\n"
123
126
  end
124
127
  end
125
- if !install_using_frameworks && spec_var == "p1"
128
+ if !install_using_frameworks && spec_var == "p1" && vendored_libraries.map { |t| File.basename(t) }.include?("lib#{item.root_name}.a" )
126
129
  module_path_files = Dir.glob(PodBuilder.prebuiltpath("#{item.root_name}/**/#{item.root_name}.modulemap"))
127
130
  raise "\n\nToo many module maps found for #{item.root_name}".red if module_path_files.count > 1
131
+
132
+ rel_path = Pathname.new(PodBuilder::prebuiltpath).relative_path_from(Pathname.new(PodBuilder::project_path("Pods"))).to_s
133
+ prebuilt_root_var = "#{item.root_name.upcase.gsub("-", "_")}_PREBUILT_ROOT"
134
+
135
+ static_cfg = Hash.new
128
136
  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
137
  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}\"",
138
+ static_cfg = { "SWIFT_INCLUDE_PATHS" => "$(inherited) \"$(#{prebuilt_root_var})/#{item.root_name}/#{item.root_name}\"",
134
139
  "OTHER_CFLAGS" => "$(inherited) -fmodule-map-file=\"$(#{prebuilt_root_var})/#{item.root_name}/#{item.root_name}/#{module_map_rel}\"",
135
140
  "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
141
+ }
142
+ end
143
+ static_cfg[prebuilt_root_var] = "$(PODS_ROOT)/#{rel_path}"
144
+
145
+ podspec += "#{indentation}#{spec_var}.xcconfig = #{static_cfg.to_s}\n"
146
+ # This seems to be a viable workaround to https://github.com/CocoaPods/CocoaPods/issues/9559 and https://github.com/CocoaPods/CocoaPods/issues/8454
147
+ 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
148
  end
140
149
 
141
150
  deps = item.dependency_names.sort
@@ -81,24 +81,26 @@ module PodBuilder
81
81
 
82
82
  spec_names.each do |root_name, module_name|
83
83
  simulator_base = "#{build_dir}/#{configuration}-#{simulator}/#{root_name}"
84
- simulator_lib = "#{simulator_base}/lib#{module_name}.a"
84
+ simulator_lib = "#{simulator_base}/lib#{root_name}.a"
85
85
 
86
86
  device_base = "#{build_dir}/#{configuration}-#{device}/#{root_name}"
87
87
  device_lib = "#{device_base}/lib#{root_name}.a"
88
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
+ unless File.file?(device_lib) && File.file?(simulator_lib)
90
+ next
91
+ end
92
+
93
+ # Starting with Xcode 12b3 the simulator binary contains an arm64 slice as well which conflict with the one in the device_lib
94
+ # when creating the fat library. A naive workaround is to remove the arm64 from the simulator_lib however this is wrong because
95
+ # we might actually need to have 2 separated arm64 slices, one for simulator and one for device each built with different
96
+ # compile time directives (e.g #if targetEnvironment(simulator))
97
+ #
98
+ # For the time being we remove the arm64 slice bacause otherwise the `xcrun lipo -create -output ...` would fail.
99
+ if `xcrun lipo -info #{simulator_lib}`.include?("arm64")
100
+ `xcrun lipo -remove arm64 #{simulator_lib} -o #{simulator_lib}`
101
101
  end
102
+
103
+ raise "Lipo failed on #{device_lib}" unless system("xcrun lipo -create -output #{device_lib} #{device_lib} #{simulator_lib}")
102
104
 
103
105
  device_headers = Dir.glob("#{device_base}/**/*.h")
104
106
  simulator_headers = Dir.glob("#{simulator_base}/**/*.h")
@@ -130,7 +132,7 @@ module PodBuilder
130
132
  if public_headers_path.downcase != module_public_headers_path.downcase && File.directory?(public_headers_path) && File.directory?(module_public_headers_path)
131
133
  # For pods with module_name != name we have to move the modulemap files to the root_name one
132
134
  module_public_headers_path = "#{Configuration.build_path}/Pods/Headers/Public/#{module_name}"
133
- FileUtils.cp_r("#{module_public_headers_path}/.", public_headers_path)
135
+ FileUtils.cp_r("#{module_public_headers_path}/.", public_headers_path, :remove_destination => true)
134
136
  end
135
137
  Dir.glob("#{public_headers_path}/**/*.*").each do |path|
136
138
  destination_folder = "#{device_base}/Headers" + path.gsub(public_headers_path, "")
@@ -1,4 +1,4 @@
1
1
  module PodBuilder
2
- VERSION = "2.0.0.beta.33"
2
+ VERSION = "2.0.0.beta.34"
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: 2.0.0.beta.33
4
+ version: 2.0.0.beta.34
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-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler