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

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: 54445e00ec8c44ad6d9223ec3da424542ba80a292d260832074c82bdee156001
4
- data.tar.gz: c1f8a2743f149b5b93988ede26dc24ac310950337cbba6171dfe617a241840db
3
+ metadata.gz: 31aa509b926c753841f3739996fad1be623bac4ceee8ae30ae9b1ee254f2ddb3
4
+ data.tar.gz: 56df221c8e00be54c33cfa491629d0d13a22087108d8722a8bf925cbd85e959e
5
5
  SHA512:
6
- metadata.gz: e05523420cc3c9c0fb5ae88d18141d3df8d3db2526db282b5d5328e38dadd45da29a600668ef5fe2b71f0d21116e0544ce5c63dda47c3185570fd7643ef32e23
7
- data.tar.gz: b4cf94efd2e57b77f4e5068a15fcdc85bd0f25cd69d85f4169feaebd1dee83f55c6fb4e208733ff5a0b7c33c7ebea751c48684e96c2e9fa4fb55e67c4747b336
6
+ metadata.gz: 3b55c31c20f5e676ff8c004d233449cbd57acac51d2fb7925340e7e25c949e9c72743ba2683255b34e5ea72bf13da5394b39f2cd0383fa95d82f9ebbb263c948
7
+ data.tar.gz: 05e76c637a0dcb3856698ce8f144e9ca734e4463edfe19ed9677c87dee7447b473da3e0918fb7c0c79f78b90604938ebe7d2b22ba1826f74377fb808ba77818e
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
 
@@ -300,18 +306,6 @@ PodBuilder writes a plist and markdown license files of pods specified in the Po
300
306
  }
301
307
  ```
302
308
 
303
- #### `subspecs_to_split`
304
-
305
- Normally when multiple subspecs are specified in a target a single framework is produced. There are rare cases where you specify different subspecs in different targets: a typical case is subspec specifically designed for app extensions, where you want to use a subspec in the main app and another one in the app extension.
306
-
307
- **Warning**: This will work properly only for static frameworks (_static_framework = true_ specified in the podspec). See [issue](https://github.com/CocoaPods/CocoaPods/issues/5708) and [issue](https://github.com/CocoaPods/CocoaPods/issues/5643)
308
-
309
- ```json
310
- {
311
- "subspecs_to_split": ["Podname1/Subspec1", "Podname1/Subspec2", "Podname2/Subspec1", "Podname2/Subspec1"]
312
- }
313
- ```
314
-
315
309
  #### `use_bundler`
316
310
 
317
311
  If you use bundler to pin the version of CocoaPods in your project set this to true. Default false.
@@ -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,12 @@ 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
+ opts.on("-s", "--no-stdin", "Never request interaction with sdtin (e.g. in CI environment)") do |o|
83
+ OPTIONS[:no_stdin_available] = o
84
+ end
82
85
  opts.on("-d", "--debug", "Don't clean build folder") do |o|
83
86
  OPTIONS[:debug] = o
84
87
  end
@@ -108,6 +111,9 @@ Options:
108
111
  opts.on("-w", "--allow-warnings", "Allow warnings") do |o|
109
112
  OPTIONS[:allow_warnings] = o
110
113
  end
114
+ opts.on("-s", "--no-stdin", "Never request interaction with sdtin (e.g. in CI environment)") do |o|
115
+ OPTIONS[:no_stdin_available] = o
116
+ end
111
117
  opts.on("-d", "--debug", "Don't clean build folder") do |o|
112
118
  OPTIONS[:debug] = o
113
119
  end
@@ -367,7 +373,7 @@ end
367
373
 
368
374
  command_ret = -1
369
375
  begin
370
- unless ENV['USER'] != "root"
376
+ unless ENV["USER"] != "root"
371
377
  raise "\n\nFor safety do not run this as root\n".red
372
378
  end
373
379
 
@@ -49,36 +49,33 @@ module PodBuilder
49
49
 
50
50
  restore_file_error = Podfile.restore_file_sanity_check
51
51
 
52
- check_splitted_subspecs_are_buildable(all_buildable_items, installer)
53
52
  check_pods_exists(argument_pods, all_buildable_items)
54
53
 
55
54
  pods_to_build = resolve_pods_to_build(argument_pods, buildable_items)
56
55
  buildable_items -= pods_to_build
57
56
 
58
57
  # We need to split pods to build in 3 groups
59
- # 1. subspecs: because the resulting .framework path is treated differently when added to Configuration.subspecs_to_split
60
- # 2. pods to build in release
61
- # 3. pods to build in debug
58
+ # 1. pods to build in release
59
+ # 2. pods to build in debug
62
60
 
63
61
  check_not_building_development_pods(pods_to_build)
64
62
 
65
- pods_to_build_subspecs = splitted_pods_to_build(pods_to_build, installer)
66
-
67
63
  # Remove dependencies from pods to build
68
64
  all_dependencies_name = pods_to_build.map(&:dependency_names).flatten.uniq
69
65
  pods_to_build.select! { |x| !all_dependencies_name.include?(x.name) }
70
66
 
71
- pods_to_build -= pods_to_build_subspecs.flatten
72
67
  pods_to_build_debug = pods_to_build.select { |x| x.build_configuration == "debug" }
73
68
  pods_to_build_release = pods_to_build - pods_to_build_debug
74
69
 
75
70
  check_dependencies_build_configurations(all_buildable_items)
76
71
 
77
- podfiles_items = pods_to_build_subspecs
78
- podfiles_items.push(pods_to_build_debug)
79
- podfiles_items.push(pods_to_build_release)
72
+ podfiles_items = [pods_to_build_debug] + [pods_to_build_release]
80
73
 
81
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
82
79
 
83
80
  install_result = InstallResult.new
84
81
  podfiles_items.reject { |x| x.empty? }.each do |podfile_items|
@@ -125,18 +122,12 @@ module PodBuilder
125
122
 
126
123
  private
127
124
 
128
- def self.splitted_pods_to_build(pods_to_build, installer)
129
- specs_by_target = installer.analysis_result.specs_by_target
130
-
131
- pods_to_build_subspecs = pods_to_build.select { |x| x.is_subspec && Configuration.subspecs_to_split.include?(x.name) }
132
-
133
- pods = []
134
- specs_by_target.each do |target, specs|
135
- grouped = pods_to_build_subspecs.group_by { |t| specs.map(&:name).include?(t.name) }
136
- pods.push(grouped[true])
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
137
130
  end
138
-
139
- return pods.compact
140
131
  end
141
132
 
142
133
  def self.check_not_building_subspecs(pods_to_build)
@@ -156,55 +147,6 @@ module PodBuilder
156
147
  end
157
148
  end
158
149
 
159
- def self.check_splitted_subspecs_are_buildable(all_buildable_items, installer)
160
- check_splitted_subspecs_are_static(all_buildable_items)
161
- check_splitted_subspecs_have_valid_dependencies(all_buildable_items)
162
- check_splitted_subspecs_not_in_multiple_targets(all_buildable_items, installer)
163
- end
164
-
165
- def self.check_splitted_subspecs_have_valid_dependencies(all_buildable_items)
166
- splitted_items = all_buildable_items.select { |t| Configuration.subspecs_to_split.include?(t.name) }
167
- splitted_items.each do |splitted_item|
168
- common_deps = splitted_item.dependency_names.select { |t| t.start_with?(splitted_item.root_name) }
169
-
170
- if common_deps.count > 0
171
- raise "\n\nSubspecs included in 'subspecs_to_split' cannot have dependencies to other subspecs within the spec.\n\n#{splitted_item.name} has dependencies to: '#{common_deps.join(', ')}'\n\n".red
172
- end
173
- end
174
- end
175
-
176
- def self.check_splitted_subspecs_not_in_multiple_targets(all_buildable_items, installer)
177
- specs_by_target = installer.analysis_result.specs_by_target
178
-
179
- flat_item_names = specs_by_target.values.flatten.map(&:name)
180
-
181
- splitted_items = all_buildable_items.select { |t| Configuration.subspecs_to_split.include?(t.name) }
182
-
183
- splitted_items.each do |splitted_item|
184
- if flat_item_names.count(splitted_item.name) > 1
185
- raise "\n\n'#{splitted_item.name}' is included in 'subspecs_to_split' but it is used in multiple targets. This is unsupported.\nIf possible duplicate the subspec '#{splitted_item.name}' in the podspec using different names for each target.\n".red
186
- end
187
- end
188
- end
189
-
190
- def self.check_splitted_subspecs_are_static(all_buildable_items)
191
- non_static_subspecs = all_buildable_items.select { |x| x.is_subspec && x.is_static == false }
192
- non_static_subspecs_names = non_static_subspecs.map(&:name)
193
-
194
- invalid_subspecs = Configuration.subspecs_to_split & non_static_subspecs_names # intersect
195
-
196
- unless invalid_subspecs.count > 0
197
- return
198
- end
199
-
200
- warn_message = "The following pods `#{invalid_subspecs.join(" ")}` are non static binaries which are being splitted over different targets. Beware that this is an unsafe setup as per https://github.com/CocoaPods/CocoaPods/issues/5708 and https://github.com/CocoaPods/CocoaPods/issues/5643\n\nYou can ignore this error by passing the `--allow-warnings` flag to the build command\n"
201
- if OPTIONS[:allow_warnings]
202
- puts "\n\n#{warn_message}".yellow
203
- else
204
- raise "\n\n#{warn_message}".red
205
- end
206
- end
207
-
208
150
  def self.check_dependencies_build_configurations(pods)
209
151
  pods.each do |pod|
210
152
  pod_dependency_names = pod.dependency_names.select { |x| !pod.has_common_spec(x) }
@@ -257,7 +199,17 @@ module PodBuilder
257
199
  pods_to_build = buildable_items.select { |x| argument_pods.include?(x.root_name) }
258
200
  pods_to_build += other_subspecs(pods_to_build, buildable_items)
259
201
 
260
- 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
261
213
  end
262
214
  end
263
215
  end
@@ -31,19 +31,6 @@ module PodBuilder
31
31
  end
32
32
  end
33
33
 
34
- splitted_specs = buildable_items.select { |t| Configuration.subspecs_to_split.include?(t.name) }
35
- splitted_specs.each do |splitted_spec|
36
- root_name = splitted_spec.root_name
37
-
38
- Dir.glob(PodBuilder::prebuiltpath("#{root_name}/Subspecs/*")).each do |path|
39
- basename = File.basename(path)
40
- unless splitted_specs.map(&:podspec_name).include?(basename)
41
- puts "Cleanining up `#{root_name}/#{basename}`, no longer found among dependencies".blue
42
- PodBuilder::safe_rm_rf(path)
43
- end
44
- end
45
- end
46
-
47
34
  puts "Cleaning dSYM folder".yellow
48
35
  module_names = buildable_items.map(&:module_name).uniq
49
36
  Dir.glob(File.join(PodBuilder::dsympath, "**/*.dSYM")).each do |path|
@@ -78,7 +65,7 @@ module PodBuilder
78
65
 
79
66
  paths_to_delete.flatten.each do |path|
80
67
  confirm = ask("#{path} unused.\nDelete it? [Y/N] ") { |yn| yn.limit = 1, yn.validate = /[yn]/i }
81
- if confirm.downcase == 'y'
68
+ if confirm.downcase == 'y' || OPTIONS.has_key?(:no_stdin_available)
82
69
  PodBuilder::safe_rm_rf(path)
83
70
  end
84
71
  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
 
@@ -61,7 +64,6 @@ module PodBuilder
61
64
  attr_accessor :skip_pods
62
65
  attr_accessor :force_prebuild_pods
63
66
  attr_accessor :license_filename
64
- attr_accessor :subspecs_to_split
65
67
  attr_accessor :development_pods_paths
66
68
  attr_accessor :build_base_path
67
69
  attr_accessor :build_path
@@ -83,7 +85,7 @@ module PodBuilder
83
85
 
84
86
  @allow_building_development_pods = false
85
87
  @build_settings = DEFAULT_BUILD_SETTINGS
86
- @build_settings_overrides = {}
88
+ @build_settings_overrides = DEFAULT_BUILD_SETTINGS_OVERRIDES
87
89
  @build_system = DEFAULT_BUILD_SYSTEM
88
90
  @library_evolution_support = DEFAULT_LIBRARY_EVOLUTION_SUPPORT
89
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
@@ -92,7 +94,6 @@ module PodBuilder
92
94
  @skip_pods = DEFAULT_SKIP_PODS
93
95
  @force_prebuild_pods = DEFAULT_FORCE_PREBUILD_PODS
94
96
  @license_filename = "Pods-acknowledgements"
95
- @subspecs_to_split = []
96
97
  @development_pods_paths = []
97
98
  @build_base_path = "/tmp/pod_builder".freeze
98
99
  @build_path = build_base_path
@@ -180,11 +181,6 @@ module PodBuilder
180
181
  Configuration.license_filename = value
181
182
  end
182
183
  end
183
- if value = json["subspecs_to_split"]
184
- if value.is_a?(Array) && value.count > 0
185
- Configuration.subspecs_to_split = value
186
- end
187
- end
188
184
  if value = json["project_name"]
189
185
  if value.is_a?(String) && value.length > 0
190
186
  Configuration.project_name = value
@@ -263,7 +259,6 @@ module PodBuilder
263
259
  config["build_system"] = Configuration.build_system
264
260
  config["library_evolution_support"] = Configuration.library_evolution_support
265
261
  config["license_filename"] = Configuration.license_filename
266
- config["subspecs_to_split"] = Configuration.subspecs_to_split
267
262
  config["restore_enabled"] = Configuration.restore_enabled
268
263
  config["allow_building_development_pods"] = Configuration.allow_building_development_pods
269
264
  config["use_bundler"] = Configuration.use_bundler
@@ -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
- else
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
@@ -217,9 +219,6 @@ module PodBuilder
217
219
 
218
220
  podbuilder_file = File.join(path, Configuration.prebuilt_info_filename)
219
221
  entry = podfile_item.entry(true, false)
220
- if Configuration.subspecs_to_split.include?(podfile_item.name)
221
- entry.gsub!("'#{podfile_item.name}'", "'#{podfile_item.root_name}'")
222
- end
223
222
 
224
223
  data = {}
225
224
  data["entry"] = entry
@@ -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"
@@ -313,11 +302,8 @@ module PodBuilder
313
302
  podspec_path = item.prebuilt_podspec_path
314
303
  if last_build_folder_hash = build_folder_hash_in_prebuilt_info_file(item)
315
304
  if last_build_folder_hash == build_folder_hash(item, gitignored_files)
316
- if Configuration.subspecs_to_split.include?(item.name)
317
- puts "No changes detected to '#{item.name}', will skip rebuild".blue
318
- else
319
- puts "No changes detected to '#{item.root_name}', will skip rebuild".blue
320
- end
305
+ puts "No changes detected to '#{item.root_name}', will skip rebuild".blue
306
+
321
307
  replaced_items.push(item)
322
308
 
323
309
  podfile_items.select { |t| t.root_name == item.root_name }.each do |replace_item|
@@ -341,7 +327,7 @@ module PodBuilder
341
327
  end
342
328
 
343
329
  def self.install
344
- puts "Prebuilding items".yellow
330
+ puts "Preparing build".yellow
345
331
 
346
332
  CLAide::Command::PluginManager.load_plugins("cocoapods")
347
333
 
@@ -385,33 +371,21 @@ module PodBuilder
385
371
 
386
372
  non_prebuilt_items = podfile_items.reject(&:is_prebuilt)
387
373
 
388
- splitted_pods = non_prebuilt_items.map { |t| splitted_pod(t, podfile_items) }.flatten.uniq
389
- splitted_pods_root_name = splitted_pods.map { |t| t.root_name }.uniq
390
-
391
- pod_names = non_prebuilt_items.reject { |t| splitted_pods_root_name.include?(t.root_name) }.map(&:root_name).uniq + splitted_pods.map(&:name)
374
+ pod_names = non_prebuilt_items.map(&:root_name).uniq
392
375
 
393
376
  pod_names.reject! { |t|
394
377
  folder_path = PodBuilder::buildpath_prebuiltpath(t)
395
378
  File.directory?(folder_path) && Dir.empty?(folder_path) # When using prebuilt items we end up with empty folders
396
379
  }
397
380
 
398
- # Selectively delete destination folder.
399
- # If it's a splitted spec we just need to wipe the Subspecs/#{pod_name}
400
- # If it's not we need to wipe everything except the Subspecs folder
401
381
  pod_names.each do |pod_name|
402
382
  root_name = pod_name.split("/").first
403
- if pod_name.include?("/") # Splitted pod
404
- PodBuilder::safe_rm_rf(PodBuilder::prebuiltpath("#{root_name}/Subspecs/#{pod_name.gsub("/", "_") }"))
405
- else
406
- items_to_delete = Dir.glob("#{PodBuilder::prebuiltpath(root_name)}/**/*")
407
- items_to_delete.reject! { |t| t.include?(PodBuilder::prebuiltpath("#{root_name}/Subspecs")) }
408
383
 
409
- items_to_delete.each { |t| PodBuilder::safe_rm_rf(t) }
410
- end
384
+ items_to_delete = Dir.glob("#{PodBuilder::prebuiltpath(root_name)}/**/*")
385
+ items_to_delete.each { |t| PodBuilder::safe_rm_rf(t) }
411
386
  end
412
387
 
413
388
  # Now copy
414
- splitted_items_copied = false
415
389
  pod_names.each do |pod_name|
416
390
  root_name = pod_name.split("/").first
417
391
  source_path = PodBuilder::buildpath_prebuiltpath(root_name)
@@ -421,14 +395,7 @@ module PodBuilder
421
395
  next
422
396
  end
423
397
 
424
- if Configuration.subspecs_to_split.include?(pod_name)
425
- destination_folder = PodBuilder::prebuiltpath("#{root_name}/Subspecs/#{pod_name.gsub("/", "_") }")
426
- FileUtils.mkdir_p(destination_folder)
427
- unless splitted_items_copied
428
- FileUtils.cp_r("#{source_path}/.", destination_folder)
429
- splitted_items_copied = true
430
- end
431
- else
398
+ unless Dir.glob("#{source_path}/**/*").select { |t| File.file?(t) }.empty?
432
399
  destination_folder = PodBuilder::prebuiltpath(root_name)
433
400
  FileUtils.mkdir_p(destination_folder)
434
401
  FileUtils.cp_r("#{source_path}/.", destination_folder)
@@ -523,8 +490,18 @@ module PodBuilder
523
490
  end
524
491
  end
525
492
 
526
- def self.splitted_pod(podfile_item, podfile_items)
527
- return podfile_items.select { |t| t.root_name == podfile_item.root_name && Configuration.subspecs_to_split.include?(t.name) }
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
528
505
  end
529
506
  end
530
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,7 +394,7 @@ 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?
397
+ if target_settings.first == false && ENV["DEBUGGING"].nil?
391
398
  raise "\n\nOnly framework packaging currently supported. Please add 'use_frameworks!' at Podfile root level (not nested in targets)".red
392
399
  end
393
400
  return target_settings.first
@@ -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}")
@@ -295,16 +304,14 @@ module PodBuilder
295
304
 
296
305
  root_names = deps.map(&:root_name).uniq
297
306
 
298
- unless Configuration.subspecs_to_split.include?(name)
299
- # We need to build all other common subspecs to properly build the item
300
- # Ex.
301
- # PodA depends on DepA/subspec1
302
- # PodB depends on DepA/subspec2
303
- #
304
- # When building PodA we need to build both DepA subspecs because they might
305
- # contain different code
306
- deps += available_pods.select { |t| root_names.include?(t.root_name) && t.root_name != t.name && !Configuration.subspecs_to_split.include?(t.name) }
307
- end
307
+ # We need to build all other common subspecs to properly build the item
308
+ # Ex.
309
+ # PodA depends on DepA/subspec1
310
+ # PodB depends on DepA/subspec2
311
+ #
312
+ # When building PodA we need to build both DepA subspecs because they might
313
+ # contain different code
314
+ deps += available_pods.select { |t| root_names.include?(t.root_name) && t.root_name != t.name }
308
315
 
309
316
  deps.uniq!
310
317
 
@@ -406,11 +413,7 @@ module PodBuilder
406
413
  end
407
414
 
408
415
  def prebuilt_rel_path
409
- if is_subspec && Configuration.subspecs_to_split.include?(name)
410
- return "Subspecs/#{podspec_name}/#{module_name}.framework"
411
- else
412
- return "#{module_name}.framework"
413
- end
416
+ return "#{module_name}.framework"
414
417
  end
415
418
 
416
419
  def prebuilt_podspec_path(absolute_path = true)
@@ -24,16 +24,12 @@ module PodBuilder
24
24
  indentation = " " * slash_count
25
25
  spec_var = "p#{slash_count}"
26
26
 
27
- subspec_prefix = Configuration.subspecs_to_split.include?(item.name) ? "Subspecs/#{item.podspec_name}/" : ""
28
-
29
27
  if spec_var == "p1" && item.default_subspecs.count > 0
30
28
  podspec += "#{indentation}#{spec_var}.default_subspecs = '#{item.default_subspecs.join("', '")}'\n"
31
29
  end
32
30
 
33
- if subspec_prefix.length > 0 && Dir["#{PodBuilder::prebuiltpath("#{item.root_name}/#{subspec_prefix}")}/*"].empty?
34
- podspec += "#{indentation}#{spec_var}.source_files = '*.splittedspec'\n"
35
- elsif item.name == name
36
- if_exists = lambda { |t| File.exist?(PodBuilder::prebuiltpath("#{item.root_name}/#{subspec_prefix}#{t}") || "") }
31
+ if item.name == name
32
+ if_exists = lambda { |t| File.exist?(PodBuilder::prebuiltpath("#{item.root_name}/#{t}") || "") }
37
33
 
38
34
  vendored_frameworks = item.vendored_frameworks
39
35
  if item.default_subspecs.count == 0 && install_using_frameworks
@@ -43,7 +39,7 @@ module PodBuilder
43
39
  existing_vendored_frameworks = vendored_frameworks.select(&if_exists)
44
40
  existing_vendored_frameworks_basename = vendored_frameworks.map { |t| File.basename(t) }.select(&if_exists)
45
41
  vendored_frameworks = (existing_vendored_frameworks + existing_vendored_frameworks_basename).uniq
46
-
42
+
47
43
  vendored_libraries = item.vendored_libraries
48
44
  if install_using_frameworks
49
45
  existing_vendored_libraries = vendored_libraries.map { |t| "#{item.module_name}/#{t}" }.select(&if_exists)
@@ -60,10 +56,10 @@ module PodBuilder
60
56
 
61
57
  exclude_files = static_frameworks.map { |x| x.vendored_framework_path.nil? ? nil : "#{x.vendored_framework_path}/Info.plist" }.compact.flatten.uniq
62
58
  public_headers = []
63
- else
59
+ else
64
60
  public_headers = Dir.glob(PodBuilder::prebuiltpath("#{item.root_name}/#{item.root_name}/Headers/**/*.h"))
65
61
  vendored_libraries += ["#{item.root_name}/lib#{item.root_name}.a"]
66
- vendored_libraries.map! { |t| "#{item.root_name}/#{t}" }.select(&if_exists)
62
+ vendored_libraries = vendored_libraries.select(&if_exists)
67
63
 
68
64
  resources = ["#{item.root_name}/*.{nib,bundle,xcasset,strings,png,jpg,tif,tiff,otf,ttf,ttc,plist,json,caf,wav,p12,momd}"]
69
65
 
@@ -76,7 +72,7 @@ module PodBuilder
76
72
 
77
73
  entries = lambda { |spec_key, spec_value|
78
74
  key = "#{indentation}#{spec_var}.#{spec_key}"
79
- joined_values = spec_value.map { |t| "#{subspec_prefix}#{t}" }.uniq.sort.join("', '")
75
+ joined_values = spec_value.map { |t| "#{t}" }.uniq.sort.join("', '")
80
76
  "#{key} = '#{joined_values}'\n"
81
77
  }
82
78
 
@@ -101,6 +97,9 @@ module PodBuilder
101
97
  if public_headers.count > 0
102
98
  podspec += "#{indentation}#{spec_var}.public_header_files = '#{item.root_name}/Headers/**/*.h'\n"
103
99
  end
100
+ if !item.header_dir.nil? && !install_using_frameworks
101
+ podspec += "#{indentation}#{spec_var}.header_dir = '#{item.header_dir}'\n"
102
+ end
104
103
 
105
104
  if item.xcconfig.keys.count > 0
106
105
  xcconfig = Hash.new
@@ -126,20 +125,26 @@ module PodBuilder
126
125
  podspec += "#{indentation}#{spec_var}.xcconfig = #{xcconfig.to_s}\n"
127
126
  end
128
127
  end
129
- 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" )
130
129
  module_path_files = Dir.glob(PodBuilder.prebuiltpath("#{item.root_name}/**/#{item.root_name}.modulemap"))
131
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
132
136
  if module_path_file = module_path_files.first
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
137
  module_map_rel = module_path_file.gsub(PodBuilder::prebuiltpath("#{item.root_name}/#{item.root_name}/"), "")
136
- static_cfg = { prebuilt_root_var => "$(PODS_ROOT)/#{rel_path}",
137
- "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}\"",
138
139
  "OTHER_CFLAGS" => "$(inherited) -fmodule-map-file=\"$(#{prebuilt_root_var})/#{item.root_name}/#{item.root_name}/#{module_map_rel}\"",
139
140
  "OTHER_SWIFT_FLAGS" => "$(inherited) -Xcc -fmodule-map-file=\"$(#{prebuilt_root_var})/#{item.root_name}/#{item.root_name}/#{module_map_rel}\""
140
- }
141
- podspec += "#{indentation}#{spec_var}.xcconfig = #{static_cfg.to_s}\n"
142
- 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"
143
148
  end
144
149
 
145
150
  deps = item.dependency_names.sort
@@ -180,7 +185,7 @@ module PodBuilder
180
185
  end
181
186
  end
182
187
 
183
- return podspec, (valid || Configuration.subspecs_to_split.include?(item.name))
188
+ return podspec, valid
184
189
  end
185
190
 
186
191
  def self.generate_podspec_from(all_buildable_items, platform, install_using_frameworks)
@@ -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,24 +81,26 @@ 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
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}`
100
101
  end
102
+
103
+ raise "Lipo failed on #{device_lib}" unless system("xcrun lipo -create -output #{device_lib} #{device_lib} #{simulator_lib}")
101
104
 
102
105
  device_headers = Dir.glob("#{device_base}/**/*.h")
103
106
  simulator_headers = Dir.glob("#{simulator_base}/**/*.h")
@@ -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)
@@ -1,4 +1,4 @@
1
1
  module PodBuilder
2
- VERSION = "2.0.0.beta.29"
2
+ VERSION = "2.0.0.beta.34"
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.29
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-09-23 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
@@ -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
  - - ">"