pod-builder 2.0.0.beta.30 → 2.0.0.beta.35

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: d4cde0acf0b503aaa846162710c25456d306b0ae6e53492b717795e4540f5b9f
4
- data.tar.gz: ddfc897b5dd2d280a2b5e636706d62c854d01bb34f605b813d70a48ace6fad75
3
+ metadata.gz: 037b4a3f456716c55d38e1ec98307ff27e87b97c908dd5e80e5895e9686f6e3f
4
+ data.tar.gz: 82dbc45cb9220beb68fe1b76c26ac11f6f8d45927e35fa73ecdd754609742830
5
5
  SHA512:
6
- metadata.gz: 5f468d84983dc689b5dceef947da7d3ce586bd2d34be76ec439a236ba45435a6865b54d154233fdae038352ff1582cb68fcfdc520e5a101ed4842d86cde3e973
7
- data.tar.gz: f45e9377fd79dff65b9c72580a29308172cc3cf3410093c2a6d2a7c9245c7000bc732b4d78473dd58ef14a3712a7cb9697bf87e7cd8331f8b413e0f550c04cc4
6
+ metadata.gz: d067c51f54eea74198b8d9ae7a85a25d271666ca3301836ab14920f52c5d9dc47aae4dfafea4de43953c09b5d15cbede4f7bcd0841772c55e7a6f057e61a737b
7
+ data.tar.gz: 504fd2e0adec760b4a58d26bec752b3dcf7755b425a0b109662e8cc4e852387b21d003c6d2abbe87e3d92d40412c9d544eb2c2bc65f41ae9e9a94a5e1eec58c3
data/README.md CHANGED
@@ -12,6 +12,10 @@ Unless you're using a Ruby version manager you should generally install using `s
12
12
 
13
13
  $ sudo gem install pod-builder
14
14
 
15
+ ## Requirements
16
+
17
+ Ruby 2.6.3 or newer. Cocoapods 1.9.0 or newer
18
+
15
19
  # Quick start
16
20
 
17
21
  You can the initialize your project to use the tool using the `init` command
@@ -21,15 +25,15 @@ You can the initialize your project to use the tool using the `init` command
21
25
 
22
26
  This will add a _PodBuilder_ folder which will contain all files needed and generated by the PodBuilder.
23
27
 
24
- To prebuild all dependencies run
25
-
26
- $ pod_builder build_all
27
-
28
28
  To prebuild just one or more specific dependencies run
29
29
 
30
30
  $ pod_builder build Pod1 Pod2
31
31
 
32
- This will generate the pod frameworks which can be committed to your repo for a much faster compilation.
32
+ To prebuild all dependencies run
33
+
34
+ $ pod_builder build_all
35
+
36
+ This will generate the pod frameworks which can be committed to your repo (using git LFS is highly suggested) for much faster compilation.
33
37
 
34
38
  Should PodBuilder not work the way you expect you can get rid of it by running
35
39
 
@@ -57,7 +61,7 @@ This acts as a sort of lockfile and reflects the current state of what is instal
57
61
 
58
62
  ## Commands
59
63
 
60
- Podbuilder comes with a set of commands:
64
+ PodBuilder comes with a rich set of commands:
61
65
 
62
66
  - `init`: initializes a project to use PodBuilder
63
67
  - `deintegrate`: deintegrates PodBuilder's initialization
@@ -81,7 +85,7 @@ The following will happen:
81
85
 
82
86
  - Create a _PodBuilder_ folder in your repo's root.
83
87
  - Copy your original Podfile to _PodBuilder/Podfile_ (PodBuilder-Podfile)
84
- - Add an initially empty _PodBuilder.json_ configuration file
88
+ - Add a _PodBuilder.json_ configuration file
85
89
  - Modify the original Podfile (Application-Podfile) with some minor customizations
86
90
  - Create/Update your Gemfile adding the `gem 'pod-builder'` entry
87
91
 
@@ -116,7 +120,7 @@ Will recompile all pods to the versions defined in the Restore-Podfile. You woul
116
120
 
117
121
  #### `install_sources` command
118
122
 
119
- When using PodBuilder you loose ability to directly access to the source code of a pod. To overcome this limitation you can use this command which downloads the pod's source code to _PodBuilder/Sources_ and with some [tricks](https://medium.com/@t.camin/debugging-prebuilt-frameworks-c9f52d42600b) restores the ability to use the debugger and step into the code of your prebuilt dependencies. This can be very helpful to catch the exact location of a crash when it occurs (showing something more useful than assembly code). It is however advisable to switch to the original pod when doing any advanced debugging during development of code that involves a pod.
123
+ Once you prebuild a pod you can no longer debug its origianl code, to overcome this limitation you can use this command which downloads the pod's source code to _PodBuilder/Sources_ and with some [tricks](https://medium.com/@t.camin/debugging-prebuilt-frameworks-c9f52d42600b) restores the ability to use the debugger and step into the code of your prebuilt dependencies. This can be very helpful to catch the exact location of a crash when it occurs (showing something more useful than assembly code). It is however advisable to switch to the original pod when doing any advanced debugging during development of code that involves a pod.
120
124
 
121
125
  #### `generate_lldbinit` command
122
126
 
@@ -253,6 +257,8 @@ Xcode build settings to use. You can override the default values which are:
253
257
  }
254
258
  ```
255
259
 
260
+ If your project uses bitcode change "ENABLE_BITCODE" to "YES". Please note that all pods that have dependencies to XCTest need to be add a `"ENABLE_BITCODE": "NO"` to the `build_settings_overrides` below.
261
+
256
262
  #### `build_settings_overrides`
257
263
 
258
264
  Like `build_settings` but per pod. Pod name can also refer to subspec.
@@ -272,7 +278,7 @@ Like `build_settings` but per pod. Pod name can also refer to subspec.
272
278
 
273
279
  #### `build_system`
274
280
 
275
- Specify which build system to use to compile frameworks. Either `Legacy` (standard build system) or `Latest` (new build system). Default value: `Legacy`.
281
+ Specify which build system to use to compile frameworks. Either `Legacy` (standard build system) or `Latest` (new build system). Default value: `Latest`.
276
282
 
277
283
  #### `library_evolution_support`
278
284
 
@@ -8,7 +8,7 @@ if show_version
8
8
  exit(0)
9
9
  end
10
10
 
11
- if ENV['DEBUGGING']
11
+ if ENV["DEBUGGING"]
12
12
  puts "Running in debug, injecting $LOAD_PATH"
13
13
  libdir = File.expand_path("#{File.dirname(__FILE__)}/../lib")
14
14
  $LOAD_PATH.unshift(libdir) unless $LOAD_PATH.include?(libdir)
@@ -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 => [
@@ -373,7 +379,7 @@ end
373
379
 
374
380
  command_ret = -1
375
381
  begin
376
- unless ENV['USER'] != "root"
382
+ unless ENV["USER"] != "root"
377
383
  raise "\n\nFor safety do not run this as root\n".red
378
384
  end
379
385
 
@@ -72,6 +72,12 @@ 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
+ 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 if Configuration.react_native_project
78
+ else
79
+ prepare_defines_modules_override(all_buildable_items)
80
+ end
75
81
 
76
82
  install_result = InstallResult.new
77
83
  podfiles_items.reject { |x| x.empty? }.each do |podfile_items|
@@ -118,6 +124,14 @@ module PodBuilder
118
124
 
119
125
  private
120
126
 
127
+ def self.prepare_defines_modules_override(all_buildable_items)
128
+ all_buildable_items.each do |item|
129
+ unless item.defines_module.nil?
130
+ Pod::PodTarget.modules_override[item.root_name] = item.defines_module
131
+ end
132
+ end
133
+ end
134
+
121
135
  def self.check_not_building_subspecs(pods_to_build)
122
136
  pods_to_build.each do |pod_to_build|
123
137
  if pod_to_build.include?("/")
@@ -150,7 +164,7 @@ module PodBuilder
150
164
  end
151
165
 
152
166
  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)
167
+ 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
168
  pod_names = development_pods.map(&:name).join(", ")
155
169
  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
170
  end
@@ -187,7 +201,17 @@ module PodBuilder
187
201
  pods_to_build = buildable_items.select { |x| argument_pods.include?(x.root_name) }
188
202
  pods_to_build += other_subspecs(pods_to_build, buildable_items)
189
203
 
190
- return pods_to_build
204
+ if OPTIONS[:resolve_parent_dependencies]
205
+ dependencies = []
206
+ buildable_items.each do |pod|
207
+ if !(pod.dependencies(buildable_items) & pods_to_build).empty?
208
+ dependencies.push(pod)
209
+ end
210
+ end
211
+ pods_to_build += dependencies
212
+ end
213
+
214
+ return pods_to_build.uniq
191
215
  end
192
216
  end
193
217
  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,34 +18,37 @@ 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" }
35
+ }
36
+ }.freeze
37
+ DEFAULT_BUILD_SETTINGS_OVERRIDES = {
38
+ "SBTUITestTunnelClient" => {
39
+ "ENABLE_BITCODE": "NO"
38
40
  }
39
41
  }.freeze
40
42
  DEFAULT_SKIP_PODS = ["GoogleMaps"]
41
- DEFAULT_FORCE_PREBUILD_PODS = ["GoogleTagManager"]
42
- DEFAULT_BUILD_SYSTEM = "Legacy".freeze # either Latest (New build system) or Legacy (Standard build system)
43
+ DEFAULT_FORCE_PREBUILD_PODS = []
44
+ DEFAULT_BUILD_SYSTEM = "Latest".freeze # either Latest (New build system) or Legacy (Standard build system)
43
45
  DEFAULT_LIBRARY_EVOLUTION_SUPPORT = false
44
46
  DEFAULT_PLATFORMS = ["iphoneos", "iphonesimulator", "appletvos", "appletvsimulator"].freeze
45
47
  DEFAULT_BUILD_FOR_APPLE_SILICON = false
46
48
  DEFAULT_BUILD_USING_REPO_PATHS = false
47
49
 
48
50
  private_constant :DEFAULT_BUILD_SETTINGS
51
+ private_constant :DEFAULT_BUILD_SETTINGS_OVERRIDES
49
52
  private_constant :DEFAULT_BUILD_SYSTEM
50
53
  private_constant :DEFAULT_LIBRARY_EVOLUTION_SUPPORT
51
54
 
@@ -82,7 +85,7 @@ module PodBuilder
82
85
 
83
86
  @allow_building_development_pods = false
84
87
  @build_settings = DEFAULT_BUILD_SETTINGS
85
- @build_settings_overrides = {}
88
+ @build_settings_overrides = DEFAULT_BUILD_SETTINGS_OVERRIDES
86
89
  @build_system = DEFAULT_BUILD_SYSTEM
87
90
  @library_evolution_support = DEFAULT_LIBRARY_EVOLUTION_SUPPORT
88
91
  @base_path = "PodBuilder" # Not nice. This value is used only for initial initization. Once config is loaded it will be an absolute path. FIXME
@@ -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
 
@@ -177,10 +176,13 @@ module PodBuilder
177
176
  return InstallResult.new(licenses, prebuilt_info)
178
177
  rescue Exception => e
179
178
  if File.directory?("#{Configuration.build_path}/Pods/Pods.xcodeproj")
180
- if ENV['DEBUGGING']
179
+ activate_pod_scheme()
180
+
181
+ if ENV["DEBUGGING"]
181
182
  system("xed #{Configuration.build_path}/Pods")
182
183
  elsif !OPTIONS.has_key?(:no_stdin_available)
183
184
  confirm = ask("\n\nOh no! Something went wrong during prebuild phase! Do you want to open the prebuild project to debug the error, you will need to add and run the Pods-Dummy scheme? [Y/N] ".red) { |yn| yn.limit = 1, yn.validate = /[yn]/i }
185
+
184
186
  if confirm.downcase == 'y'
185
187
  system("xed #{Configuration.build_path}/Pods")
186
188
  end
@@ -241,16 +243,6 @@ module PodBuilder
241
243
  return ret
242
244
  end
243
245
  private
244
-
245
- def self.prepare_for_static_framework_workarounds(podfile_content, podfile_items)
246
- unless podfile_content.include?("use_modular_headers!")
247
- return
248
- end
249
-
250
- podfile_items.each do |podfile_item|
251
- Pod::Target::BuildSettings.specs_remove_module_maps[podfile_item.root_name] = podfile_item.remove_module_maps
252
- end
253
- end
254
246
 
255
247
  def self.license_specifiers
256
248
  acknowledge_file = "#{Configuration.build_path}/Pods/Target Support Files/Pods-DummyTarget/Pods-DummyTarget-acknowledgements.plist"
@@ -335,7 +327,7 @@ module PodBuilder
335
327
  end
336
328
 
337
329
  def self.install
338
- puts "Prebuilding items".yellow
330
+ puts "Preparing build".yellow
339
331
 
340
332
  CLAide::Command::PluginManager.load_plugins("cocoapods")
341
333
 
@@ -403,9 +395,11 @@ module PodBuilder
403
395
  next
404
396
  end
405
397
 
406
- destination_folder = PodBuilder::prebuiltpath(root_name)
407
- FileUtils.mkdir_p(destination_folder)
408
- 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
409
403
  end
410
404
 
411
405
  # Folder won't exist if no dSYM were generated (all static libs)
@@ -495,5 +489,19 @@ module PodBuilder
495
489
  return replace_path
496
490
  end
497
491
  end
492
+
493
+ def self.activate_pod_scheme
494
+ if scheme_file = Dir.glob("#{Configuration.build_path}/Pods/**/xcschememanagement.plist").first
495
+ plist = CFPropertyList::List.new(:file => scheme_file)
496
+ data = CFPropertyList.native_types(plist.value)
497
+
498
+ if !data.dig("SchemeUserState", "Pods-DummyTarget.xcscheme").nil?
499
+ data["SchemeUserState"]["Pods-DummyTarget.xcscheme"]["isShown"] = true
500
+ end
501
+
502
+ plist.value = CFPropertyList.guess(data)
503
+ plist.save(scheme_file, CFPropertyList::List::FORMAT_BINARY)
504
+ end
505
+ end
498
506
  end
499
507
  end
@@ -37,29 +37,36 @@ module PodBuilder
37
37
  item_build_settings = Configuration.build_settings_overrides[item.name] || {}
38
38
 
39
39
  # These settings need to be set as is to properly build frameworks
40
- build_settings['SWIFT_COMPILATION_MODE'] = 'wholemodule'
41
- build_settings['ONLY_ACTIVE_ARCH'] = 'NO'
42
- build_settings['DEBUG_INFORMATION_FORMAT'] = "dwarf-with-dsym"
40
+ build_settings["SWIFT_COMPILATION_MODE"] = "wholemodule"
41
+ build_settings["ONLY_ACTIVE_ARCH"] = "NO"
42
+ build_settings["DEBUG_INFORMATION_FORMAT"] = "dwarf-with-dsym"
43
43
 
44
- build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = platform.deployment_target.version # Fix compilation warnings on Xcode 12
44
+ build_settings["IPHONEOS_DEPLOYMENT_TARGET"] = platform.deployment_target.version # Fix compilation warnings on Xcode 12
45
45
 
46
46
  # Don't store .pcm info in binary, see https://forums.swift.org/t/swift-behavior-of-gmodules-and-dsyms/23211/3
47
- build_settings['CLANG_ENABLE_MODULE_DEBUGGING'] = 'NO'
48
- build_settings['OTHER_SWIFT_FLAGS'] = "$(inherited) -Xfrontend -no-clang-module-breadcrumbs"
47
+ build_settings["CLANG_ENABLE_MODULE_DEBUGGING"] = "NO"
48
+ build_settings["OTHER_SWIFT_FLAGS"] = "$(inherited) -Xfrontend -no-clang-module-breadcrumbs"
49
+
50
+ # Ignore deprecation warnings
51
+ build_settings["GCC_WARN_ABOUT_DEPRECATED_FUNCTIONS"] = "NO"
49
52
 
50
53
  # Improve compile speed
51
- build_settings['COMPILER_INDEX_STORE_ENABLE'] = 'NO'
52
- build_settings['SWIFT_INDEX_STORE_ENABLE'] = 'NO'
53
- build_settings['MTL_ENABLE_INDEX_STORE'] = 'NO'
54
+ build_settings["COMPILER_INDEX_STORE_ENABLE"] = "NO"
55
+ build_settings["SWIFT_INDEX_STORE_ENABLE"] = "NO"
56
+ build_settings["MTL_ENABLE_INDEX_STORE"] = "NO"
54
57
 
55
58
  if Configuration.build_system == "Legacy"
56
- build_settings['BUILD_LIBRARY_FOR_DISTRIBUTION'] = "NO"
59
+ build_settings["BUILD_LIBRARY_FOR_DISTRIBUTION"] = "NO"
57
60
  raise "\n\nCan't enable library evolution support with legacy build system!".red if Configuration.library_evolution_support
58
61
  elsif Configuration.library_evolution_support
59
- build_settings['BUILD_LIBRARY_FOR_DISTRIBUTION'] = "YES"
62
+ build_settings["BUILD_LIBRARY_FOR_DISTRIBUTION"] = "YES"
60
63
  end
61
64
 
62
- build_settings['SWIFT_VERSION'] = item_build_settings["SWIFT_VERSION"] || item.swift_version || project_swift_version(analyzer)
65
+ build_settings["SWIFT_VERSION"] = item_build_settings["SWIFT_VERSION"] || item.swift_version || project_swift_version(analyzer)
66
+
67
+ if build_settings["ENABLE_BITCODE"] == "YES"
68
+ build_settings["BITCODE_GENERATION_MODE"] = "bitcode"
69
+ end
63
70
 
64
71
  item_build_settings.each do |k, v|
65
72
  build_settings[k] = v
@@ -387,8 +394,8 @@ module PodBuilder
387
394
  def self.install_using_frameworks(analyzer)
388
395
  target_settings = analyzer.podfile.target_definition_list.map(&:uses_frameworks?).uniq
389
396
  if target_settings.count == 1
390
- if target_settings.first == false && ENV['DEBUGGING'].nil?
391
- raise "\n\nOnly framework packaging currently supported. Please add 'use_frameworks!' at Podfile root level (not nested in targets)".red
397
+ if target_settings.first == false && ENV["DEBUGGING"].nil?
398
+ raise "\n\nOnly framework packaging currently supported. Please add 'use_frameworks!' at root level (not nested in targets) in #{PodBuilder::basepath("Podfile")}".red
392
399
  end
393
400
  return target_settings.first
394
401
  elsif target_settings.count > 1
@@ -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
@@ -17,7 +17,8 @@ module PodBuilder
17
17
  target_label = target.cocoapods_target_label
18
18
 
19
19
  xcodebuild(sandbox, target_label, device, deployment_target, configuration, deterministic_build, [], {})
20
- excluded_archs = build_for_apple_silicon ? [] : ["arm64"]
20
+ excluded_archs = ["i386"] # Fixes https://github.com/Subito-it/PodBuilder/issues/17
21
+ excluded_archs += build_for_apple_silicon ? [] : ["arm64"]
21
22
  xcodebuild(sandbox, target_label, simulator, deployment_target, configuration, deterministic_build, excluded_archs, {})
22
23
 
23
24
  spec_names = target.specs.map { |spec| [spec.root.name, spec.root.module_name] }.uniq
@@ -80,25 +81,27 @@ module PodBuilder
80
81
 
81
82
  spec_names.each do |root_name, module_name|
82
83
  simulator_base = "#{build_dir}/#{configuration}-#{simulator}/#{root_name}"
83
- simulator_lib = "#{simulator_base}/lib#{module_name}.a"
84
+ simulator_lib = "#{simulator_base}/lib#{root_name}.a"
84
85
 
85
86
  device_base = "#{build_dir}/#{configuration}-#{device}/#{root_name}"
86
87
  device_lib = "#{device_base}/lib#{root_name}.a"
87
88
 
88
- if File.file?(device_lib) && File.file?(simulator_lib)
89
- # Starting with Xcode 12b3 the simulator binary contains an arm64 slice as well which conflict with the one in the device_lib
90
- # when creating the fat library. A naive workaround is to remove the arm64 from the simulator_lib however this is wrong because
91
- # we might actually need to have 2 separated arm64 slices, one for simulator and one for device each built with different
92
- # compile time directives (e.g #if targetEnvironment(simulator))
93
- #
94
- # For the time being we remove the arm64 slice bacause otherwise the `xcrun lipo -create -output ...` would fail.
95
- if `xcrun lipo -info #{simulator_lib}`.include?("arm64")
96
- `xcrun lipo -remove arm64 #{simulator_lib} -o #{simulator_lib}`
97
- end
98
-
99
- 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
100
91
  end
101
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
+ end
102
+
103
+ raise "Lipo failed on #{device_lib}" unless system("xcrun lipo -create -output #{device_lib} #{device_lib} #{simulator_lib}")
104
+
102
105
  device_headers = Dir.glob("#{device_base}/**/*.h")
103
106
  simulator_headers = Dir.glob("#{simulator_base}/**/*.h")
104
107
  device_headers.each do |device_path|
@@ -129,7 +132,7 @@ module PodBuilder
129
132
  if public_headers_path.downcase != module_public_headers_path.downcase && File.directory?(public_headers_path) && File.directory?(module_public_headers_path)
130
133
  # For pods with module_name != name we have to move the modulemap files to the root_name one
131
134
  module_public_headers_path = "#{Configuration.build_path}/Pods/Headers/Public/#{module_name}"
132
- FileUtils.cp_r("#{module_public_headers_path}/.", public_headers_path)
135
+ FileUtils.cp_r("#{module_public_headers_path}/.", public_headers_path, :remove_destination => true)
133
136
  end
134
137
  Dir.glob("#{public_headers_path}/**/*.*").each do |path|
135
138
  destination_folder = "#{device_base}/Headers" + path.gsub(public_headers_path, "")
@@ -258,14 +261,16 @@ module PodBuilder
258
261
  project = Xcodeproj::Project.open(project_path)
259
262
  project.targets.each do |target|
260
263
  config = target.build_configurations.find { |config| config.name.eql? configuration }
261
- config.build_settings['DEBUG_INFORMATION_FORMAT'] = 'dwarf-with-dsym'
262
- config.build_settings['ONLY_ACTIVE_ARCH'] = 'NO'
264
+ config.build_settings["DEBUG_INFORMATION_FORMAT"] = "dwarf-with-dsym"
265
+ config.build_settings["ONLY_ACTIVE_ARCH"] = "NO"
263
266
  end
264
267
  project.save
265
268
  end
266
269
  end
267
270
 
268
271
  Pod::HooksManager.register('podbuilder-rome', :post_install) do |installer_context, user_options|
272
+ puts "Building".yellow
273
+
269
274
  enable_dsym = user_options.fetch('dsym', true)
270
275
  configuration = user_options.fetch('configuration', 'Debug')
271
276
  uses_frameworks = user_options.fetch('uses_frameworks', true)
@@ -323,7 +328,10 @@ Pod::HooksManager.register('podbuilder-rome', :post_install) do |installer_conte
323
328
  file_accessor = Pod::Sandbox::FileAccessor.new(sandbox.pod_dir(spec.root.name), consumer)
324
329
  files += file_accessor.vendored_libraries
325
330
  files += file_accessor.vendored_frameworks
326
- files += file_accessor.resources
331
+ begin
332
+ files += file_accessor.resources
333
+ rescue
334
+ end
327
335
 
328
336
  FileUtils.mkdir_p(destination)
329
337
  files.each do |file|
@@ -1,4 +1,4 @@
1
1
  module PodBuilder
2
- VERSION = "2.0.0.beta.30"
2
+ VERSION = "2.0.0.beta.35"
3
3
  end
4
4
 
@@ -21,6 +21,8 @@ Gem::Specification.new do |spec|
21
21
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
22
22
  spec.require_paths = ["lib"]
23
23
 
24
+ spec.required_ruby_version = '>= 2.6'
25
+
24
26
  spec.add_development_dependency "bundler", "~> 2.0"
25
27
  spec.add_development_dependency "rake", ">= 12.3.3"
26
28
  spec.add_development_dependency "ruby-debug-ide", '0.6.1'
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.30
4
+ version: 2.0.0.beta.35
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-09-29 00:00:00.000000000 Z
11
+ date: 2020-10-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -226,7 +226,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
226
226
  requirements:
227
227
  - - ">="
228
228
  - !ruby/object:Gem::Version
229
- version: '0'
229
+ version: '2.6'
230
230
  required_rubygems_version: !ruby/object:Gem::Requirement
231
231
  requirements:
232
232
  - - ">"