cocoapods-generate 2.0.1 → 2.1.0

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: 1ff4789b445c0e00d7e00d2808dd4ed69e0d02f5e43547ef710d83bcc0dbce62
4
- data.tar.gz: cc8ab4c9925c136e06706ced54b25b419327a4d9b4625bfac7e17ed02b5f58a2
3
+ metadata.gz: f21262cc4824565c6d34162cb6e20312ddfa2d0ff3331c7b58fac561f2432e2f
4
+ data.tar.gz: 72fdfa72cca275404202ddbffcf6805fa22598b1897a379b49a77586a328cb52
5
5
  SHA512:
6
- metadata.gz: 3bf5669db86616bdc81af45c12d51a7a4fc10b1f7168173394290632522a5e1e4a65c2c9f100573018022fd3feaac3599ec80f853f62b24384d0f6a5f77d0c3b
7
- data.tar.gz: 003a8045475b4fc18dbf57e2c4bc12e2ade7b07da9d62b129870c52984f2ba2a27ce5eec00b6e7fa4f66e1cec43b149f433265422a3c194227ace7429c0b427f
6
+ metadata.gz: 523fe6d21ea621a6c3035a59c950beea558cfbaaac1dcba17ba23ee999103e195845413bbf62a400baa8d3aff031d11a7980b4e2fe5d5e315fce370726be890d
7
+ data.tar.gz: 2229639a9d3ef51e44aa73ec7b3347fc049421da8ed4430e40d03ac984671ea78ebb594cb027afca83b184c25c052642a7319212980f7607ebb795583c6f12b4
data/README.md CHANGED
@@ -89,6 +89,9 @@ Options:
89
89
  default plugins
90
90
  --deterministic-uuids Whether installation should use
91
91
  deterministic UUIDs for pods projects
92
+ --disable-input-output-paths Whether to disable the input & output paths
93
+ of the CocoaPods script phases (Copy
94
+ Frameworks & Copy Resources)
92
95
  --share-schemes-for-development-pods Whether installation should share schemes
93
96
  for development pods
94
97
  --warn-for-multiple-pod-sources Whether installation should warn when a pod
@@ -98,6 +101,8 @@ Options:
98
101
  modules, as if `use_modular_headers!` were
99
102
  specified. Will error if both this option
100
103
  and a podfile are specified
104
+ --single-workspace Whether to produce a single workspace for
105
+ all podspecs specified.
101
106
  ```
102
107
  <!-- end cli usage -->
103
108
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 2.0.1
1
+ 2.1.0
@@ -64,8 +64,8 @@ module Pod
64
64
  # even if there are multiple podspecs
65
65
  update_sources if configuration.repo_update?
66
66
 
67
- Generate::PodfileGenerator.new(configuration).podfiles_by_spec.each do |spec, podfile|
68
- Generate::Installer.new(configuration, spec, podfile).install!
67
+ Generate::PodfileGenerator.new(configuration).podfiles_by_specs.each do |specs, podfile|
68
+ Generate::Installer.new(configuration, specs, podfile).install!
69
69
  end
70
70
 
71
71
  remove_warnings(UI.warnings)
@@ -169,7 +169,7 @@ module Pod
169
169
  ->(paths) { ('paths do not exist' unless paths.all? { |p| p.is_a?(URI) || p.exist? }) },
170
170
  ->(paths) { paths && paths.map { |path| path.to_s =~ %r{https?://} ? URI(path) : Pathname(path).expand_path } }
171
171
  option :podspecs, ArrayOf.new(Pod::Specification),
172
- 'self.class.podspecs_from_paths(podspec_paths)',
172
+ 'self.class.podspecs_from_paths(podspec_paths, gen_directory)',
173
173
  nil,
174
174
  nil,
175
175
  ->(specs) { 'no podspecs found' if specs.empty? },
@@ -199,10 +199,12 @@ module Pod
199
199
  ->(platforms) { Array(platforms).flat_map { |s| s.split(',') } }
200
200
  option :repo_update, BOOLEAN, 'false', 'Force running `pod repo update` before install', nil, nil, coerce_to_bool
201
201
  option :use_default_plugins, BOOLEAN, 'false', 'Whether installation should activate default plugins', nil, nil, coerce_to_bool
202
- option :deterministic_uuids, BOOLEAN, 'false', 'Whether installation should use deterministic UUIDs for pods projects', nil, nil, coerce_to_bool
203
- option :share_schemes_for_development_pods, BOOLEAN, 'true', 'Whether installation should share schemes for development pods', nil, nil, coerce_to_bool
204
- option :warn_for_multiple_pod_sources, BOOLEAN, 'false', 'Whether installation should warn when a pod is found in multiple sources', nil, nil, coerce_to_bool
202
+ option :deterministic_uuids, BOOLEAN, '(use_podfile && podfile) ? podfile.installation_options.deterministic_uuids : false', 'Whether installation should use deterministic UUIDs for pods projects', nil, nil, coerce_to_bool
203
+ option :disable_input_output_paths, BOOLEAN, '(use_podfile && podfile) ? podfile.installation_options.disable_input_output_paths : false', 'Whether to disable the input & output paths of the CocoaPods script phases (Copy Frameworks & Copy Resources)', nil, nil, coerce_to_bool
204
+ option :share_schemes_for_development_pods, [TrueClass, FalseClass, Array], '(use_podfile && podfile) ? podfile.installation_options.share_schemes_for_development_pods : true', 'Whether installation should share schemes for development pods', nil, nil
205
+ option :warn_for_multiple_pod_sources, BOOLEAN, '(use_podfile && podfile) ? podfile.installation_options.warn_for_multiple_pod_sources : false', 'Whether installation should warn when a pod is found in multiple sources', nil, nil, coerce_to_bool
205
206
  option :use_modular_headers, BOOLEAN, 'false', 'Whether the target should be generated as a clang module, treating dependencies as modules, as if `use_modular_headers!` were specified. Will error if both this option and a podfile are specified', nil, nil, coerce_to_bool
207
+ option :single_workspace, BOOLEAN, 'false', 'Whether to produce a single workspace for all podspecs specified.', nil, nil, coerce_to_bool
206
208
 
207
209
  options.freeze
208
210
  options.each do |o|
@@ -302,12 +304,13 @@ module Pod
302
304
  end << ' }'
303
305
  end
304
306
 
305
- # @return [Pathname] the directory for installation of the generated workspace
307
+ # @return [Pathname] the directory for installation of the generated workspace.
306
308
  #
307
- # @param [String] name the name of the pod
309
+ # @param [Array<Specification>] specs The specs to get a directory name for.
308
310
  #
309
- def gen_dir_for_pod(name)
310
- gen_directory.join(name)
311
+ def gen_dir_for_specs(specs)
312
+ basename = specs.count == 1 ? specs.first.name : 'Workspace'
313
+ gen_directory.join(basename)
311
314
  end
312
315
 
313
316
  # @return [Boolean] whether gen should install with dynamic frameworks
@@ -318,14 +321,14 @@ module Pod
318
321
 
319
322
  # @return [String] The project name to use for generating this workspace.
320
323
  #
321
- # @param [Specification] spec
322
- # the specification to generate project name for.
324
+ # @param [Array<Specification>] specs
325
+ # the specifications to generate project name for.
323
326
  #
324
- def project_name_for_spec(spec)
325
- project_name = spec.name.dup
327
+ def project_name_for_specs(specs)
328
+ project_name = specs.count == 1 ? +specs.first.name.dup : +'Workspace'
326
329
  # When using multiple Xcode project the project name will collide with the actual .xcodeproj meant for the pod
327
330
  # that we are generating the workspace for.
328
- project_name << 'Sample' if generate_multiple_pod_projects?
331
+ project_name << 'Sample' if generate_multiple_pod_projects? && specs.count == 1
329
332
  project_name
330
333
  end
331
334
 
@@ -335,7 +338,10 @@ module Pod
335
338
  # @param [Array<Pathname,URI>] paths
336
339
  # the paths to search for podspecs
337
340
  #
338
- def self.podspecs_from_paths(paths)
341
+ # @param [Pathname] gen_directory
342
+ # the directory that the gen installation would occur into.
343
+ #
344
+ def self.podspecs_from_paths(paths, gen_directory)
339
345
  paths = [Pathname('.')] if paths.empty?
340
346
  paths.flat_map do |path|
341
347
  if path.is_a?(URI)
@@ -351,7 +357,7 @@ module Pod
351
357
  $ERROR_INFO
352
358
  end
353
359
  elsif path.directory?
354
- glob = Pathname.glob(path + '*.podspec{.json,}')
360
+ glob = Pathname.glob(path.expand_path + '**/*.podspec{.json,}').select { |f| f.relative_path_from(gen_directory).to_s.start_with?('..') }
355
361
  next StandardError.new "no specs found in #{UI.path path}" if glob.empty?
356
362
  glob.map { |f| Pod::Specification.from_file(f) }.sort_by(&:name)
357
363
  else
@@ -9,19 +9,19 @@ module Pod
9
9
  #
10
10
  attr_reader :configuration
11
11
 
12
- # @return [Specification]
12
+ # @return [Array<Specification>]
13
13
  # the spec whose workspace is being created
14
14
  #
15
- attr_reader :spec
15
+ attr_reader :specs
16
16
 
17
17
  # @return [Podfile]
18
18
  # the podfile to install
19
19
  #
20
20
  attr_reader :podfile
21
21
 
22
- def initialize(configuration, spec, podfile)
22
+ def initialize(configuration, specs, podfile)
23
23
  @configuration = configuration
24
- @spec = spec
24
+ @specs = specs
25
25
  @podfile = podfile
26
26
  end
27
27
 
@@ -37,7 +37,7 @@ module Pod
37
37
  # @return [void]
38
38
  #
39
39
  def install!
40
- UI.title "Generating #{spec.name} in #{UI.path install_directory}" do
40
+ UI.title "Generating workspace in #{UI.path install_directory}" do
41
41
  clean! if configuration.clean?
42
42
  install_directory.mkpath
43
43
 
@@ -89,7 +89,7 @@ module Pod
89
89
  end
90
90
 
91
91
  def open_app_project(recreate: false)
92
- app_project_path = install_directory.join("#{configuration.project_name_for_spec(spec)}.xcodeproj")
92
+ app_project_path = install_directory.join("#{configuration.project_name_for_specs(specs)}.xcodeproj")
93
93
  if !recreate && app_project_path.exist?
94
94
  Xcodeproj::Project.open(app_project_path)
95
95
  else
@@ -104,27 +104,32 @@ module Pod
104
104
  def create_app_project
105
105
  app_project = open_app_project(recreate: !configuration.incremental_installation?)
106
106
 
107
- spec_platforms = spec.available_platforms.flatten.reject do |platform|
108
- !configuration.platforms.nil? && !configuration.platforms.include?(platform.string_name.downcase)
109
- end
107
+ platforms_by_spec = Hash[specs.map do |spec|
108
+ platforms = spec.available_platforms.flatten.reject do |platform|
109
+ !configuration.platforms.nil? && !configuration.platforms.include?(platform.string_name.downcase)
110
+ end
111
+ [spec, platforms]
112
+ end]
110
113
 
111
- if spec_platforms.empty?
112
- Pod::Command::Gen.help! Pod::StandardError.new "No available platforms in #{spec.name}.podspec match requested platforms: #{configuration.platforms}"
114
+ if platforms_by_spec.values.all?(&:empty?)
115
+ Pod::Command::Gen.help! Pod::StandardError.new "No available platforms for podspecs #{specs.map(&:name).to_sentence} match requested platforms: #{configuration.platforms}"
113
116
  end
114
117
 
115
- spec_platforms
116
- .map do |platform|
117
- consumer = spec.consumer(platform)
118
- target_name = "App-#{Platform.string_name(consumer.platform_name)}"
119
- next if app_project.targets.map(&:name).include? target_name
120
- native_app_target = Pod::Generator::AppTargetHelper.add_app_target(app_project, consumer.platform_name,
121
- deployment_target(consumer), target_name)
122
- # Temporarily set Swift version to pass validator checks for pods which do not specify Swift version.
123
- # It will then be re-set again within #perform_post_install_steps.
124
- Pod::Generator::AppTargetHelper.add_swift_version(native_app_target, Pod::Validator::DEFAULT_SWIFT_VERSION)
125
- native_app_target
118
+ platforms_by_spec
119
+ .flat_map do |spec, platforms|
120
+ platforms.map do |platform|
121
+ consumer = spec.consumer(platform)
122
+ target_name = "App-#{Platform.string_name(consumer.platform_name)}"
123
+ next if app_project.targets.map(&:name).include? target_name
124
+ native_app_target = Pod::Generator::AppTargetHelper.add_app_target(app_project, consumer.platform_name,
125
+ deployment_target(consumer), target_name)
126
+ # Temporarily set Swift version to pass validator checks for pods which do not specify Swift version.
127
+ # It will then be re-set again within #perform_post_install_steps.
128
+ Pod::Generator::AppTargetHelper.add_swift_version(native_app_target, Pod::Validator::DEFAULT_SWIFT_VERSION)
129
+ native_app_target
130
+ end
126
131
  end
127
- .compact.tap do
132
+ .compact.uniq.tap do
128
133
  app_project.recreate_user_schemes do |scheme, target|
129
134
  installation_result = installation_result_from_target(target)
130
135
  next unless installation_result
@@ -134,9 +139,10 @@ module Pod
134
139
  end
135
140
  end
136
141
  .each do |target|
137
- Xcodeproj::XCScheme.share_scheme(app_project.path, target.name) if target
142
+ Xcodeproj::XCScheme.share_scheme(app_project.path.to_s, target.name) if target
138
143
  end
139
144
  app_project.save
145
+ app_project
140
146
  end
141
147
 
142
148
  def deployment_target(consumer)
@@ -152,8 +158,10 @@ module Pod
152
158
  app_project.native_targets.each do |native_app_target|
153
159
  remove_script_phase_from_target(native_app_target, 'Check Pods Manifest.lock')
154
160
 
155
- pod_target = installer.pod_targets.find { |pt| pt.platform.name == native_app_target.platform_name && pt.pod_name == spec.name }
156
- raise "Unable to find a pod target for #{native_app_target} / #{spec}" unless pod_target
161
+ spec_names = specs.map(&:name)
162
+ pod_targets = installer.pod_targets.select do |pt|
163
+ pt.platform.name == native_app_target.platform_name && spec_names.include?(pt.pod_name)
164
+ end
157
165
 
158
166
  native_app_target.source_build_phase.clear
159
167
  native_app_target.resources_build_phase.clear
@@ -189,22 +197,18 @@ module Pod
189
197
  source_file_ref = group.new_file(file.basename)
190
198
  native_app_target.add_file_references([source_file_ref])
191
199
  end
192
- elsif Pod::Generator::AppTargetHelper.method(:add_app_project_import).arity == -5 # CocoaPods >= 1.6
193
- # If we are doing incremental installation then the file might already be there.
200
+ else
194
201
  platform_name = Platform.string_name(native_app_target.platform_name)
195
202
  group = group_for_platform_name(app_project, platform_name)
196
203
  main_file_ref = group.files.find { |f| f.display_name == 'main.m' }
197
204
  if main_file_ref.nil?
198
- Pod::Generator::AppTargetHelper.add_app_project_import(app_project, native_app_target, pod_target,
199
- pod_target.platform.name, native_app_target.name)
205
+ source_file = create_main_source_file(app_project, pod_targets, native_app_target.name)
206
+ group = app_project[group.name] || app_project.new_group(group.name, group.name)
207
+ source_file_ref = group.new_file(source_file)
208
+ native_app_target.add_file_references([source_file_ref])
200
209
  else
201
210
  native_app_target.add_file_references([main_file_ref])
202
211
  end
203
- else
204
- Pod::Generator::AppTargetHelper.add_app_project_import(app_project, native_app_target, pod_target,
205
- pod_target.platform.name,
206
- pod_target.requires_frameworks?,
207
- native_app_target.name)
208
212
  end
209
213
 
210
214
  # Set `PRODUCT_BUNDLE_IDENTIFIER`
@@ -217,18 +221,22 @@ module Pod
217
221
  make_ios_app_launchable(app_project, native_app_target)
218
222
  end
219
223
 
220
- Pod::Generator::AppTargetHelper.add_swift_version(native_app_target, pod_target.swift_version) unless pod_target.swift_version.blank?
224
+ swift_version = pod_targets.map { |pt| Pod::Version.new(pt.swift_version) }.max.to_s
225
+
226
+ Pod::Generator::AppTargetHelper.add_swift_version(native_app_target, swift_version) unless swift_version.blank?
221
227
  if installer.pod_targets.any? { |pt| pt.spec_consumers.any? { |c| c.frameworks.include?('XCTest') } }
222
228
  Pod::Generator::AppTargetHelper.add_xctest_search_paths(native_app_target)
223
229
  end
224
230
 
225
- # Share the pods xcscheme only if it exists. For pre-built vendored pods there is no xcscheme generated.
226
- if installer.respond_to?(:generated_projects) # CocoaPods 1.7.0
227
- installer.generated_projects.each do |project|
228
- Xcodeproj::XCScheme.share_scheme(project.path, pod_target.label) if File.exist?(project.path + pod_target.label)
231
+ pod_targets.each do |pod_target|
232
+ result = installer.target_installation_results.pod_target_installation_results[pod_target.name]
233
+ share_scheme(result.native_target.project, pod_target.label)
234
+ pod_target.test_specs.each do |test_spec|
235
+ share_scheme(result.native_target.project, pod_target.test_target_label(test_spec))
236
+ end
237
+ pod_target.app_specs.each do |app_spec|
238
+ share_scheme(result.native_target.project, pod_target.app_target_label(app_spec))
229
239
  end
230
- elsif File.exist?(installer.pods_project.path + pod_target.label)
231
- Xcodeproj::XCScheme.share_scheme(installer.pods_project.path, pod_target.label)
232
240
  end
233
241
 
234
242
  add_test_spec_schemes_to_app_scheme(installer, app_project)
@@ -252,23 +260,19 @@ module Pod
252
260
  end
253
261
 
254
262
  def add_test_spec_schemes_to_app_scheme(installer, app_project)
263
+ spec_root_names = Set.new(specs.map { |s| s.root.name })
264
+
255
265
  test_native_targets =
256
- if installer.respond_to?(:target_installation_results) # CocoaPods >= 1.6
257
- installer
258
- .target_installation_results
259
- .pod_target_installation_results
260
- .values
261
- .flatten(1)
262
- .select { |installation_result| installation_result.target.pod_name == spec.root.name }
263
- else
264
- installer
265
- .pod_targets
266
- .select { |pod_target| pod_target.pod_name == spec.root.name }
267
- end
266
+ installer
267
+ .target_installation_results
268
+ .pod_target_installation_results
269
+ .values
270
+ .flatten(1)
271
+ .select { |installation_result| spec_root_names.include?(installation_result.target.pod_name) }
268
272
  .flat_map(&:test_native_targets)
269
273
  .group_by(&:platform_name)
270
274
 
271
- workspace_path = install_directory + "#{spec.name}.xcworkspace"
275
+ workspace_path = install_directory + (configuration.project_name_for_specs(specs) + '.xcworkspace')
272
276
  Xcodeproj::Plist.write_to_path(
273
277
  { 'IDEWorkspaceSharedSettings_AutocreateContextsIfNeeded' => false },
274
278
  workspace_path.join('xcshareddata').tap(&:mkpath).join('WorkspaceSettings.xcsettings')
@@ -287,7 +291,7 @@ module Pod
287
291
 
288
292
  testable = Xcodeproj::XCScheme::TestAction::TestableReference.new(target)
289
293
  testable.buildable_references.each do |buildable|
290
- buildable.xml_element.attributes['ReferencedContainer'] = 'container:Pods.xcodeproj'
294
+ buildable.xml_element.attributes['ReferencedContainer'] = "container:Pods/#{File.basename(target.project.path)}"
291
295
  end
292
296
  test_action.add_testable(testable)
293
297
  end
@@ -380,9 +384,37 @@ module Pod
380
384
  Executable.execute_command 'open', [workspace_path]
381
385
  end
382
386
  else
383
- UI.info "Open #{UI.path workspace_path} to work on #{spec.name}"
387
+ UI.info "Open #{UI.path workspace_path} to work on it!"
384
388
  end
385
389
  end
390
+
391
+ def share_scheme(project, scheme_name)
392
+ scheme = Xcodeproj::XCScheme.user_data_dir(project.path) + "#{scheme_name}.xcscheme"
393
+ return unless File.exist?(scheme)
394
+ Xcodeproj::XCScheme.share_scheme(project.path, scheme_name)
395
+ end
396
+
397
+ def create_main_source_file(project, pod_targets, name)
398
+ source_file = project.path.dirname.+("#{name}/main.m")
399
+ source_file.parent.mkpath
400
+
401
+ import_statements = pod_targets.map do |pod_target|
402
+ if pod_target.should_build? && pod_target.defines_module?
403
+ "@import #{pod_target.product_module_name};"
404
+ else
405
+ header_name = "#{pod_target.product_module_name}/#{pod_target.product_module_name}.h"
406
+ "#import <#{header_name}>" if pod_target.sandbox.public_headers.root.+(header_name).file?
407
+ end
408
+ end.compact
409
+
410
+ source_file.open('w') do |f|
411
+ f << import_statements.join("\n")
412
+ f << "\n" unless import_statements.empty?
413
+ f << "int main() {}\n"
414
+ end
415
+
416
+ source_file
417
+ end
386
418
  end
387
419
  end
388
420
  end
@@ -14,27 +14,27 @@ module Pod
14
14
  @configuration = configuration
15
15
  end
16
16
 
17
- # @return [Hash<Specification, Podfile>]
18
- # a hash of specifications to generated podfiles
17
+ # @return [Hash<Array<Specification>, Podfile>] the podfiles keyed by the specs that are part of each.
19
18
  #
20
- def podfiles_by_spec
19
+ def podfiles_by_specs
20
+ return { configuration.podspecs => podfile_for_specs(configuration.podspecs) } if configuration.single_workspace?
21
21
  Hash[configuration.podspecs.map do |spec|
22
- [spec, podfile_for_spec(spec)]
22
+ [[spec], podfile_for_specs([spec])]
23
23
  end]
24
24
  end
25
25
 
26
26
  # @return [Podfile] a podfile suitable for installing the given spec
27
27
  #
28
- # @param [Specification] spec
28
+ # @param [Array<Specification>] specs
29
29
  #
30
- def podfile_for_spec(spec)
30
+ def podfile_for_specs(specs)
31
31
  generator = self
32
- dir = configuration.gen_dir_for_pod(spec.name)
33
- project_name = configuration.project_name_for_spec(spec)
32
+ dir = configuration.gen_dir_for_specs(specs)
33
+ project_name = configuration.project_name_for_specs(specs)
34
34
 
35
35
  Pod::Podfile.new do
36
36
  project "#{project_name}.xcodeproj"
37
- workspace "#{spec.name}.xcworkspace"
37
+ workspace "#{project_name}.xcworkspace"
38
38
 
39
39
  plugin 'cocoapods-generate'
40
40
 
@@ -57,24 +57,32 @@ module Pod
57
57
 
58
58
  self.defined_in_file = dir.join('CocoaPods.podfile.yaml')
59
59
 
60
- test_specs = spec.recursive_subspecs.select(&:test_specification?)
61
- app_specs = if spec.respond_to?(:app_specification?)
62
- spec.recursive_subspecs.select(&:app_specification?)
63
- else
64
- []
65
- end
60
+ test_specs_by_spec = Hash[specs.map do |spec|
61
+ [spec, spec.recursive_subspecs.select(&:test_specification?)]
62
+ end]
63
+ app_specs_by_spec = Hash[specs.map do |spec|
64
+ app_specs = if spec.respond_to?(:app_specification?)
65
+ spec.recursive_subspecs.select(&:app_specification?)
66
+ else
67
+ []
68
+ end
69
+ [spec, app_specs]
70
+ end]
66
71
 
67
72
  # Stick all of the transitive dependencies in an abstract target.
68
73
  # This allows us to force CocoaPods to use the versions / sources / external sources
69
74
  # that we want.
70
- # By using an abstract target,
71
75
  abstract_target 'Transitive Dependencies' do
72
- pods_for_transitive_dependencies = [spec.name]
73
- .concat(test_specs.map(&:name))
74
- .concat(test_specs.flat_map { |ts| ts.dependencies.flat_map(&:name) })
75
- .concat(app_specs.map(&:name))
76
- .concat(app_specs.flat_map { |as| as.dependencies.flat_map(&:name) })
76
+ pods_for_transitive_dependencies = specs.flat_map do |spec|
77
+ [spec.name]
78
+ .concat(test_specs_by_spec.keys.map(&:name))
79
+ .concat(test_specs_by_spec.values.flatten.flat_map { |ts| ts.dependencies.flat_map(&:name) })
80
+ .concat(app_specs_by_spec.keys.map(&:name))
81
+ .concat(app_specs_by_spec.values.flatten.flat_map { |as| as.dependencies.flat_map(&:name) })
82
+ end
83
+ pods_for_transitive_dependencies.uniq!
77
84
 
85
+ spec_names = specs.map { |s| s.root.name }
78
86
  dependencies = generator
79
87
  .transitive_dependencies_by_pod
80
88
  .values_at(*pods_for_transitive_dependencies)
@@ -82,7 +90,7 @@ module Pod
82
90
  .flatten(1)
83
91
  .uniq
84
92
  .sort_by(&:name)
85
- .reject { |d| d.root_name == spec.root.name }
93
+ .reject { |d| spec_names.include?(d.root_name) }
86
94
 
87
95
  dependencies.each do |dependency|
88
96
  pod_args = generator.pod_args_for_dependency(self, dependency)
@@ -90,9 +98,8 @@ module Pod
90
98
  end
91
99
  end
92
100
 
93
- # Add platform-specific concrete targets that inherit the
94
- # `pod` declaration for the local pod.
95
- spec_platform_names = spec.available_platforms.map(&:string_name).flatten.each.reject do |platform_name|
101
+ # Add platform-specific concrete targets that inherit the `pod` declaration for the local pod.
102
+ spec_platform_names = specs.flat_map { |s| s.available_platforms.map(&:string_name) }.uniq.each.reject do |platform_name|
96
103
  !generator.configuration.platforms.nil? && !generator.configuration.platforms.include?(platform_name.downcase)
97
104
  end
98
105
 
@@ -117,26 +124,31 @@ module Pod
117
124
  inhibit_all_warnings! if generator.inhibit_all_warnings?
118
125
  use_modular_headers! if generator.use_modular_headers?
119
126
 
120
- # This is the pod declaration for the local pod,
121
- # it will be inherited by the concrete target definitions below
122
- pod_options = generator.dependency_compilation_kwargs(spec.name)
123
- pod_options[:path] = spec.defined_in_file.relative_path_from(dir).to_s
124
- { testspecs: test_specs, appspecs: app_specs }.each do |key, specs|
125
- pod_options[key] = specs.map { |s| s.name.sub(%r{^#{Regexp.escape spec.root.name}/}, '') }.sort unless specs.empty?
126
- end
127
+ specs.each do |spec|
128
+ # This is the pod declaration for the local pod,
129
+ # it will be inherited by the concrete target definitions below
130
+ pod_options = generator.dependency_compilation_kwargs(spec.name)
127
131
 
128
- pod spec.name, **pod_options
132
+ path = spec.defined_in_file.relative_path_from(dir).to_s
133
+ pod_options[:path] = path
134
+ { testspecs: test_specs_by_spec[spec], appspecs: app_specs_by_spec[spec] }.each do |key, subspecs|
135
+ pod_options[key] = subspecs.map { |s| s.name.sub(%r{^#{Regexp.escape spec.root.name}/}, '') }.sort unless subspecs.blank?
136
+ end
137
+ pod spec.name, **pod_options
138
+ end
129
139
 
130
140
  # Implement local-sources option to set up dependencies to podspecs in the local filesystem.
131
141
  next if generator.configuration.local_sources.empty?
132
- generator.transitive_local_dependencies(spec, generator.configuration.local_sources).sort_by(&:first).each do |dependency, podspec_file|
133
- pod_options = generator.dependency_compilation_kwargs(dependency.name)
134
- pod_options[:path] = if podspec_file[0] == '/' # absolute path
135
- podspec_file
136
- else
137
- '../../' + podspec_file
138
- end
139
- pod dependency.name, **pod_options
142
+ specs.each do |spec|
143
+ generator.transitive_local_dependencies(spec, generator.configuration.local_sources).sort_by(&:first).each do |dependency, podspec_file|
144
+ pod_options = generator.dependency_compilation_kwargs(dependency.name)
145
+ pod_options[:path] = if podspec_file[0] == '/' # absolute path
146
+ podspec_file
147
+ else
148
+ '../../' + podspec_file
149
+ end
150
+ pod dependency.name, **pod_options
151
+ end
140
152
  end
141
153
  end
142
154
  end
@@ -325,7 +337,7 @@ module Pod
325
337
  def installation_options
326
338
  installation_options = {
327
339
  deterministic_uuids: configuration.deterministic_uuids?,
328
- share_schemes_for_development_pods: configuration.share_schemes_for_development_pods?,
340
+ share_schemes_for_development_pods: configuration.share_schemes_for_development_pods,
329
341
  warn_for_multiple_pod_sources: configuration.warn_for_multiple_pod_sources?
330
342
  }
331
343
 
@@ -337,6 +349,10 @@ module Pod
337
349
  installation_options[:incremental_installation] = configuration.incremental_installation?
338
350
  end
339
351
 
352
+ if Pod::Installer::InstallationOptions.all_options.include?('disable_input_output_paths')
353
+ installation_options[:disable_input_output_paths] = configuration.disable_input_output_paths
354
+ end
355
+
340
356
  installation_options
341
357
  end
342
358
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cocoapods-generate
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.1
4
+ version: 2.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Samuel Giddins
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-11-03 00:00:00.000000000 Z
11
+ date: 2021-01-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: cocoapods-disable-podfile-validations
@@ -101,7 +101,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
101
101
  - !ruby/object:Gem::Version
102
102
  version: '0'
103
103
  requirements: []
104
- rubygems_version: 3.0.1
104
+ rubygems_version: 3.0.3
105
105
  signing_key:
106
106
  specification_version: 4
107
107
  summary: Generates Xcode workspaces from a podspec.