cocoapods-generate 1.4.0 → 2.0.1

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: 067262b8308a92713c42f4ddbce02e2ccd49706d6c63fb362579b4940304787b
4
- data.tar.gz: 3a3b21887162068fd52413481196ade377203cab85b6529577858fb3d6bae541
3
+ metadata.gz: 1ff4789b445c0e00d7e00d2808dd4ed69e0d02f5e43547ef710d83bcc0dbce62
4
+ data.tar.gz: cc8ab4c9925c136e06706ced54b25b419327a4d9b4625bfac7e17ed02b5f58a2
5
5
  SHA512:
6
- metadata.gz: b12fabd58e79a33e9ecb3c997e2f26abacc8b049faf23e52a81121f46391355ffbbe247f488db7e326768be85510a4170bfed08498d0bb975579eff5a2e081fb
7
- data.tar.gz: d908644512ac74a4e0748113ab7ed34459f4a7a0a3d9b45acc4abc4d7898740280a24e0981bc19d0583999d5081265b411cfc13b23b43eae94405aebd2a789cb
6
+ metadata.gz: 3bf5669db86616bdc81af45c12d51a7a4fc10b1f7168173394290632522a5e1e4a65c2c9f100573018022fd3feaac3599ec80f853f62b24384d0f6a5f77d0c3b
7
+ data.tar.gz: 003a8045475b4fc18dbf57e2c4bc12e2ade7b07da9d62b129870c52984f2ba2a27ce5eec00b6e7fa4f66e1cec43b149f433265422a3c194227ace7429c0b427f
@@ -0,0 +1,9 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2019
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
6
+
7
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
8
+
9
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md CHANGED
@@ -47,6 +47,7 @@ Usage:
47
47
 
48
48
  Options:
49
49
 
50
+ --allow-root Allows CocoaPods to run as root
50
51
  --silent Show nothing
51
52
  --verbose Show more debugging information
52
53
  --no-ansi Show output without ANSI codes
@@ -62,6 +63,8 @@ Options:
62
63
  be used
63
64
  --use-libraries Whether to use libraries instead of
64
65
  frameworks
66
+ --generate-multiple-pod-projects Whether to generate multiple Xcode projects
67
+ --incremental-installation Whether to use incremental installation
65
68
  --gen-directory=PATH Path to generate workspaces in
66
69
  --auto-open Whether to automatically open the generated
67
70
  workspaces
@@ -69,11 +72,17 @@ Options:
69
72
  before generating
70
73
  --app-host-source-dir=DIR A directory containing sources to use for
71
74
  the app host
72
- --sources=SOURCE1,SOURCE2 The sources from which to pull dependant
75
+ --sources=SOURCE1,SOURCE2 The sources from which to pull dependent
73
76
  pods (defaults to all repos in the podfile
74
77
  if using the podfile, else all available
75
78
  repos). Can be a repo name or URL. Multiple
76
79
  sources must be comma-delimited.
80
+ --local-sources=SOURCE1,SOURCE2 Paths from which to find local podspecs for
81
+ transitive dependencies. Multiple
82
+ local-sources must be comma-delimited.
83
+ --platforms=ios,macos Limit to specific platforms. Default is all
84
+ platforms supported by the podspec.
85
+ Multiple platforms must be comma-delimited.
77
86
  --repo-update Force running `pod repo update` before
78
87
  install
79
88
  --use-default-plugins Whether installation should activate
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.4.0
1
+ 2.0.1
@@ -86,10 +86,12 @@ module Pod
86
86
  path = dir + '.gen_config.yml'
87
87
  next unless path.file?
88
88
  Pod::Generate::Configuration.from_file(path)
89
- end
89
+ end.compact
90
+
91
+ options.delete(:podspec_paths) if options[:podspec_paths].empty? && config_hashes.any? { |h| h.include?(:podspec_paths) }
90
92
 
91
93
  env = Generate::Configuration.from_env(ENV)
92
- config_hashes.insert(-2, env)
94
+ config_hashes = [env] + config_hashes
93
95
  config_hashes << options
94
96
 
95
97
  configuration = config_hashes.compact.each_with_object({}) { |e, h| h.merge!(e) }
@@ -178,10 +178,25 @@ module Pod
178
178
  # installer options
179
179
  option :sources, ArrayOf.new(String),
180
180
  'if use_podfile && podfile then ::Pod::Installer::Analyzer.new(:sandbox, podfile).sources.map(&:url) else pod_config.sources_manager.all.map(&:url) end',
181
- 'The sources from which to pull dependant pods (defaults to all repos in the podfile if using the podfile, else all available repos). Can be a repo name or URL. Multiple sources must be comma-delimited.',
181
+ 'The sources from which to pull dependent pods (defaults to all repos in the podfile if using the podfile, else all available repos). Can be a repo name or URL. Multiple sources must be comma-delimited.',
182
182
  'SOURCE1,SOURCE2',
183
183
  ->(_) { nil },
184
184
  ->(sources) { Array(sources).flat_map { |s| s.split(',') } }
185
+ option :local_sources, ArrayOf.new(String),
186
+ [],
187
+ 'Paths from which to find local podspecs for transitive dependencies. Multiple local-sources must be comma-delimited.',
188
+ 'SOURCE1,SOURCE2',
189
+ ->(_) { nil },
190
+ ->(local_sources) { Array(local_sources).flat_map { |s| s.split(',') } }
191
+ option :platforms, ArrayOf.new(String),
192
+ nil,
193
+ 'Limit to specific platforms. Default is all platforms supported by the podspec. Multiple platforms must be comma-delimited.',
194
+ 'ios,macos',
195
+ lambda { |platforms|
196
+ valid_platforms = Platform.all.map { |p| p.string_name.downcase }
197
+ valid_platforms unless (platforms - valid_platforms).empty?
198
+ }, # validates platforms is a subset of Platform.all
199
+ ->(platforms) { Array(platforms).flat_map { |s| s.split(',') } }
185
200
  option :repo_update, BOOLEAN, 'false', 'Force running `pod repo update` before install', nil, nil, coerce_to_bool
186
201
  option :use_default_plugins, BOOLEAN, 'false', 'Whether installation should activate default plugins', nil, nil, coerce_to_bool
187
202
  option :deterministic_uuids, BOOLEAN, 'false', 'Whether installation should use deterministic UUIDs for pods projects', nil, nil, coerce_to_bool
@@ -301,6 +316,19 @@ module Pod
301
316
  !use_libraries?
302
317
  end
303
318
 
319
+ # @return [String] The project name to use for generating this workspace.
320
+ #
321
+ # @param [Specification] spec
322
+ # the specification to generate project name for.
323
+ #
324
+ def project_name_for_spec(spec)
325
+ project_name = spec.name.dup
326
+ # When using multiple Xcode project the project name will collide with the actual .xcodeproj meant for the pod
327
+ # that we are generating the workspace for.
328
+ project_name << 'Sample' if generate_multiple_pod_projects?
329
+ project_name
330
+ end
331
+
304
332
  # @return [Array<Specification>] the podspecs found at the given paths.
305
333
  # This method will download specs from URLs and traverse a directory's children.
306
334
  #
@@ -325,7 +353,7 @@ module Pod
325
353
  elsif path.directory?
326
354
  glob = Pathname.glob(path + '*.podspec{.json,}')
327
355
  next StandardError.new "no specs found in #{UI.path path}" if glob.empty?
328
- glob.map { |f| Pod::Specification.from_file(f) }
356
+ glob.map { |f| Pod::Specification.from_file(f) }.sort_by(&:name)
329
357
  else
330
358
  Pod::Specification.from_file(path)
331
359
  end
@@ -4,18 +4,6 @@ module Pod
4
4
  # given a configuration and a generated podfile.
5
5
  #
6
6
  class Installer
7
- # A subclass of the CocoaPods installer that vends analyzer classes
8
- # that skip validating podfiles
9
- #
10
- class InstallerNoValidatePodfile < ::Pod::Installer
11
- def create_analyzer(*)
12
- super.tap do |analyzer|
13
- def analyzer.validate_podfile!; end
14
- end
15
- end
16
- end
17
- private_constant :InstallerNoValidatePodfile
18
-
19
7
  # @return [Configuration]
20
8
  # the configuration to use when installing
21
9
  #
@@ -63,15 +51,25 @@ module Pod
63
51
 
64
52
  installer = nil
65
53
  UI.section 'Installing...' do
66
- configuration.pod_config.with_changes(installation_root: install_directory, podfile: podfile, lockfile: configuration.lockfile, sandbox: nil, sandbox_root: install_directory, podfile_path: podfile.defined_in_file, silent: !configuration.pod_config.verbose?, verbose: false, lockfile_path: nil) do
67
- installer = InstallerNoValidatePodfile.new(configuration.pod_config.sandbox, podfile, configuration.lockfile)
54
+ configuration.pod_config.with_changes(installation_root: install_directory, podfile: podfile,
55
+ lockfile: configuration.lockfile, sandbox: nil,
56
+ sandbox_root: install_directory + 'Pods',
57
+ podfile_path: podfile.defined_in_file,
58
+ silent: !configuration.pod_config.verbose?, verbose: false,
59
+ lockfile_path: nil) do
60
+ installer = ::Pod::Installer.new(configuration.pod_config.sandbox, podfile, configuration.lockfile)
68
61
  installer.use_default_plugins = configuration.use_default_plugins
69
62
  installer.install!
70
63
  end
71
64
  end
72
65
 
73
66
  UI.section 'Performing post-installation steps' do
74
- perform_post_install_steps(open_app_project, installer)
67
+ should_perform_post_install = if installer.respond_to?(:generated_aggregate_targets) # CocoaPods 1.7.0
68
+ !installer.generated_aggregate_targets.empty?
69
+ else
70
+ true
71
+ end
72
+ perform_post_install_steps(open_app_project, installer) if should_perform_post_install
75
73
  end
76
74
 
77
75
  print_post_install_message
@@ -91,7 +89,7 @@ module Pod
91
89
  end
92
90
 
93
91
  def open_app_project(recreate: false)
94
- app_project_path = install_directory.join("#{spec.name}.xcodeproj")
92
+ app_project_path = install_directory.join("#{configuration.project_name_for_spec(spec)}.xcodeproj")
95
93
  if !recreate && app_project_path.exist?
96
94
  Xcodeproj::Project.open(app_project_path)
97
95
  else
@@ -104,30 +102,40 @@ module Pod
104
102
  # @return [Xcodeproj::Project]
105
103
  #
106
104
  def create_app_project
107
- app_project = open_app_project(recreate: true)
108
-
109
- spec.available_platforms.map do |platform|
110
- consumer = spec.consumer(platform)
111
- target_name = "App-#{Platform.string_name(consumer.platform_name)}"
112
- native_app_target = Pod::Generator::AppTargetHelper.add_app_target(app_project, consumer.platform_name, deployment_target(consumer), target_name)
113
- # Temporarily set Swift version to pass validator checks for pods which do not specify Swift version.
114
- # It will then be re-set again within #perform_post_install_steps.
115
- Pod::Generator::AppTargetHelper.add_swift_version(native_app_target, Pod::Validator::DEFAULT_SWIFT_VERSION)
116
- native_app_target
105
+ app_project = open_app_project(recreate: !configuration.incremental_installation?)
106
+
107
+ spec_platforms = spec.available_platforms.flatten.reject do |platform|
108
+ !configuration.platforms.nil? && !configuration.platforms.include?(platform.string_name.downcase)
117
109
  end
118
- .tap do
119
- app_project.recreate_user_schemes do |scheme, target|
120
- installation_result = installation_result_from_target(target)
121
- next unless installation_result
122
- installation_result.test_native_targets.each do |test_native_target|
123
- scheme.add_test_target(test_native_target)
124
- end
110
+
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}"
113
+ end
114
+
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
126
+ end
127
+ .compact.tap do
128
+ app_project.recreate_user_schemes do |scheme, target|
129
+ installation_result = installation_result_from_target(target)
130
+ next unless installation_result
131
+ installation_result.test_native_targets.each do |test_native_target|
132
+ scheme.add_test_target(test_native_target)
125
133
  end
126
134
  end
127
- .each do |target|
128
- Xcodeproj::XCScheme.share_scheme(app_project.path, target.name)
129
- end
130
-
135
+ end
136
+ .each do |target|
137
+ Xcodeproj::XCScheme.share_scheme(app_project.path, target.name) if target
138
+ end
131
139
  app_project.save
132
140
  end
133
141
 
@@ -145,7 +153,10 @@ module Pod
145
153
  remove_script_phase_from_target(native_app_target, 'Check Pods Manifest.lock')
146
154
 
147
155
  pod_target = installer.pod_targets.find { |pt| pt.platform.name == native_app_target.platform_name && pt.pod_name == spec.name }
148
- raise "unable to find a pod target for #{native_app_target} / #{spec}" unless pod_target
156
+ raise "Unable to find a pod target for #{native_app_target} / #{spec}" unless pod_target
157
+
158
+ native_app_target.source_build_phase.clear
159
+ native_app_target.resources_build_phase.clear
149
160
 
150
161
  if (app_host_source_dir = configuration.app_host_source_dir)
151
162
  relative_app_host_source_dir = app_host_source_dir.relative_path_from(installer.sandbox.root)
@@ -164,6 +175,14 @@ module Pod
164
175
  end
165
176
 
166
177
  next
178
+ elsif file.to_s.end_with?('-Bridging-Header.h')
179
+ native_app_target.build_configurations.each do |bc|
180
+ if (old_bridging_header = bc.build_settings['SWIFT_OBJC_BRIDGING_HEADER'])
181
+ raise Informative, "Conflicting Swift ObjC bridging headers specified, got #{old_bridging_header} and #{relative_path}. Only one `-Bridging-Header.h` file may be specified in the app host source dir."
182
+ end
183
+
184
+ bc.build_settings['SWIFT_OBJC_BRIDGING_HEADER'] = relative_path.to_s
185
+ end
167
186
  end
168
187
 
169
188
  group = groups[relative_path.dirname]
@@ -171,9 +190,21 @@ module Pod
171
190
  native_app_target.add_file_references([source_file_ref])
172
191
  end
173
192
  elsif Pod::Generator::AppTargetHelper.method(:add_app_project_import).arity == -5 # CocoaPods >= 1.6
174
- Pod::Generator::AppTargetHelper.add_app_project_import(app_project, native_app_target, pod_target, pod_target.platform.name, native_app_target.name)
193
+ # If we are doing incremental installation then the file might already be there.
194
+ platform_name = Platform.string_name(native_app_target.platform_name)
195
+ group = group_for_platform_name(app_project, platform_name)
196
+ main_file_ref = group.files.find { |f| f.display_name == 'main.m' }
197
+ 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)
200
+ else
201
+ native_app_target.add_file_references([main_file_ref])
202
+ end
175
203
  else
176
- Pod::Generator::AppTargetHelper.add_app_project_import(app_project, native_app_target, pod_target, pod_target.platform.name, pod_target.requires_frameworks?, native_app_target.name)
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)
177
208
  end
178
209
 
179
210
  # Set `PRODUCT_BUNDLE_IDENTIFIER`
@@ -183,7 +214,7 @@ module Pod
183
214
 
184
215
  case native_app_target.platform_name
185
216
  when :ios
186
- make_ios_app_launchable(installer, app_project, native_app_target)
217
+ make_ios_app_launchable(app_project, native_app_target)
187
218
  end
188
219
 
189
220
  Pod::Generator::AppTargetHelper.add_swift_version(native_app_target, pod_target.swift_version) unless pod_target.swift_version.blank?
@@ -237,9 +268,10 @@ module Pod
237
268
  .flat_map(&:test_native_targets)
238
269
  .group_by(&:platform_name)
239
270
 
271
+ workspace_path = install_directory + "#{spec.name}.xcworkspace"
240
272
  Xcodeproj::Plist.write_to_path(
241
273
  { 'IDEWorkspaceSharedSettings_AutocreateContextsIfNeeded' => false },
242
- app_project.path.sub_ext('.xcworkspace').join('xcshareddata').tap(&:mkpath).join('WorkspaceSettings.xcsettings')
274
+ workspace_path.join('xcshareddata').tap(&:mkpath).join('WorkspaceSettings.xcsettings')
243
275
  )
244
276
 
245
277
  test_native_targets.each do |platform_name, test_targets|
@@ -264,18 +296,17 @@ module Pod
264
296
  end
265
297
  end
266
298
 
267
- def make_ios_app_launchable(installer, app_project, native_app_target)
299
+ def make_ios_app_launchable(app_project, native_app_target)
268
300
  platform_name = Platform.string_name(native_app_target.platform_name)
269
- generated_source_dir = installer.sandbox.root.join('App', platform_name).tap(&:mkpath)
301
+ generated_source_dir = install_directory.join("App-#{platform_name}").tap(&:mkpath)
270
302
 
271
303
  # Add `LaunchScreen.storyboard`
272
304
  launch_storyboard = generated_source_dir.join('LaunchScreen.storyboard')
273
305
  launch_storyboard.write <<-XML.strip_heredoc
274
306
  <?xml version="1.0" encoding="UTF-8" standalone="no"?>
275
- <document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="13122.16" systemVersion="17A277" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="01J-lp-oVM">
307
+ <document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="13122.16" systemVersion="17A277" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" useTraitCollections="YES" colorMatched="YES" initialViewController="01J-lp-oVM">
276
308
  <dependencies>
277
309
  <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="13104.12"/>
278
- <capability name="Safe area layout guides" minToolsVersion="9.0"/>
279
310
  <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
280
311
  </dependencies>
281
312
  <scenes>
@@ -287,7 +318,6 @@ module Pod
287
318
  <rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
288
319
  <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
289
320
  <color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
290
- <viewLayoutGuide key="safeArea" id="6Tk-OE-BBY"/>
291
321
  </view>
292
322
  </viewController>
293
323
  <placeholder placeholderIdentifier="IBFirstResponder" id="iYj-Kq-Ea1" userLabel="First Responder" sceneMemberID="firstResponder"/>
@@ -329,12 +359,17 @@ module Pod
329
359
  Xcodeproj::Plist.write_to_path(info_plist_contents, info_plist_path)
330
360
 
331
361
  native_app_target.build_configurations.each do |bc|
332
- bc.build_settings['INFOPLIST_FILE'] = "${SRCROOT}/App/#{platform_name}/Info.plist"
362
+ bc.build_settings['INFOPLIST_FILE'] = "${SRCROOT}/App-#{platform_name}/Info.plist"
333
363
  end
334
364
 
335
- group = app_project.main_group.find_subpath("App-#{platform_name}", true)
336
- group.new_file(info_plist_path)
337
- native_app_target.resources_build_phase.add_file_reference group.new_file(launch_storyboard)
365
+ group = group_for_platform_name(app_project, platform_name)
366
+ group.files.find { |f| f.display_name == 'Info.plist' } || group.new_file(info_plist_path)
367
+ launch_storyboard_file_ref = group.files.find { |f| f.display_name == 'LaunchScreen.storyboard' } || group.new_file(launch_storyboard)
368
+ native_app_target.resources_build_phase.add_file_reference(launch_storyboard_file_ref)
369
+ end
370
+
371
+ def group_for_platform_name(project, platform_name, should_create = true)
372
+ project.main_group.find_subpath("App-#{platform_name}", should_create)
338
373
  end
339
374
 
340
375
  def print_post_install_message
@@ -30,20 +30,21 @@ module Pod
30
30
  def podfile_for_spec(spec)
31
31
  generator = self
32
32
  dir = configuration.gen_dir_for_pod(spec.name)
33
+ project_name = configuration.project_name_for_spec(spec)
33
34
 
34
35
  Pod::Podfile.new do
35
- project "#{spec.name}.xcodeproj"
36
+ project "#{project_name}.xcodeproj"
36
37
  workspace "#{spec.name}.xcworkspace"
37
38
 
38
39
  plugin 'cocoapods-generate'
39
40
 
40
41
  install! 'cocoapods', generator.installation_options
41
42
 
42
- generator.configuration.podfile_plugins.each do |name, options|
43
+ generator.podfile_plugins.each do |name, options|
43
44
  plugin(*[name, options].compact)
44
45
  end
45
46
 
46
- use_frameworks!(generator.configuration.use_frameworks?)
47
+ use_frameworks!(generator.use_frameworks_value)
47
48
 
48
49
  if (supported_swift_versions = generator.supported_swift_versions)
49
50
  supports_swift_versions(supported_swift_versions)
@@ -54,7 +55,7 @@ module Pod
54
55
  source(source_url)
55
56
  end
56
57
 
57
- self.defined_in_file = dir.join('Podfile.yaml')
58
+ self.defined_in_file = dir.join('CocoaPods.podfile.yaml')
58
59
 
59
60
  test_specs = spec.recursive_subspecs.select(&:test_specification?)
60
61
  app_specs = if spec.respond_to?(:app_specification?)
@@ -91,7 +92,11 @@ module Pod
91
92
 
92
93
  # Add platform-specific concrete targets that inherit the
93
94
  # `pod` declaration for the local pod.
94
- spec.available_platforms.map(&:string_name).sort.each do |platform_name|
95
+ spec_platform_names = spec.available_platforms.map(&:string_name).flatten.each.reject do |platform_name|
96
+ !generator.configuration.platforms.nil? && !generator.configuration.platforms.include?(platform_name.downcase)
97
+ end
98
+
99
+ spec_platform_names.sort.each do |platform_name|
95
100
  target "App-#{platform_name}" do
96
101
  current_target_definition.swift_version = generator.swift_version if generator.swift_version
97
102
  end
@@ -121,7 +126,45 @@ module Pod
121
126
  end
122
127
 
123
128
  pod spec.name, **pod_options
129
+
130
+ # Implement local-sources option to set up dependencies to podspecs in the local filesystem.
131
+ 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
140
+ end
141
+ end
142
+ end
143
+
144
+ def transitive_local_dependencies(spec, paths, found_podspecs: {}, include_non_library_subspecs: true)
145
+ if include_non_library_subspecs
146
+ non_library_specs = spec.recursive_subspecs.select do |ss|
147
+ ss.test_specification? || (ss.respond_to?(:app_specification?) && ss.app_specification?)
148
+ end
149
+ non_library_specs.each do |subspec|
150
+ transitive_local_dependencies(subspec, paths, found_podspecs: found_podspecs, include_non_library_subspecs: false)
151
+ end
152
+ end
153
+ spec.dependencies.each do |dependency|
154
+ next if found_podspecs.key?(dependency)
155
+ found_podspec_file = nil
156
+ name = dependency.name.split('/')[0]
157
+ paths.each do |path|
158
+ podspec_file = File.join(path, name + '.podspec')
159
+ next unless File.file?(podspec_file)
160
+ found_podspec_file = podspec_file
161
+ break
162
+ end
163
+ next unless found_podspec_file
164
+ found_podspecs[dependency] = found_podspec_file.sub(%r{\A\./}, '')
165
+ transitive_local_dependencies(Pod::Specification.from_file(found_podspec_file), paths, found_podspecs: found_podspecs)
124
166
  end
167
+ found_podspecs
125
168
  end
126
169
 
127
170
  # @return [Boolean]
@@ -151,6 +194,27 @@ module Pod
151
194
  end
152
195
  end
153
196
 
197
+ # @return [Boolean, Hash]
198
+ # the value to use for `use_frameworks!` DSL directive
199
+ #
200
+ def use_frameworks_value
201
+ return configuration.use_frameworks? unless configuration.use_podfile?
202
+ use_framework_values = target_definition_list.map do |target_definition|
203
+ if target_definition.respond_to?(:build_type) # CocoaPods >= 1.9
204
+ build_type = target_definition.build_type
205
+ if build_type.static_library?
206
+ false
207
+ else
208
+ { linkage: build_type == BuildType.dynamic_framework ? :dynamic : :static }
209
+ end
210
+ else
211
+ target_definition.uses_frameworks?
212
+ end
213
+ end.uniq
214
+ raise Informative, 'Multiple use_frameworks! values detected in user Podfile.' unless use_framework_values.count == 1
215
+ use_framework_values.first
216
+ end
217
+
154
218
  # @return [Hash]
155
219
  # a hash with "compilation"-related dependency options for the `pod` DSL method
156
220
  #
@@ -276,6 +340,12 @@ module Pod
276
340
  installation_options
277
341
  end
278
342
 
343
+ def podfile_plugins
344
+ configuration.podfile_plugins.merge('cocoapods-disable-podfile-validations' => { 'no_abstract_only_pods' => true }) do |_key, old_value, new_value|
345
+ old_value.merge(new_value)
346
+ end
347
+ end
348
+
279
349
  private
280
350
 
281
351
  # @return [Array<Podfile::TargetDefinition>]
@@ -309,6 +379,7 @@ module Pod
309
379
  #
310
380
  def modular_headers?(pod_name)
311
381
  return true if configuration.use_modular_headers?
382
+ return false unless configuration.use_podfile?
312
383
  target_definitions_for_pod(pod_name).all? do |target_definition|
313
384
  target_definition.build_pod_as_module?(pod_name)
314
385
  end
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- if Pod::VERSION >= '1.5.0'
3
+ if Gem::Version.new(Pod::VERSION) >= Gem::Version.new('1.5.0')
4
4
  require 'cocoapods/command/gen'
5
5
  else
6
6
  Pod::UI.warn 'cocoapods-generate requires CocoaPods >= 1.5.0'
metadata CHANGED
@@ -1,15 +1,29 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cocoapods-generate
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.4.0
4
+ version: 2.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Samuel Giddins
8
- autorequire:
8
+ autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-03-12 00:00:00.000000000 Z
11
+ date: 2020-11-03 00:00:00.000000000 Z
12
12
  dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: cocoapods-disable-podfile-validations
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: 0.1.1
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: 0.1.1
13
27
  - !ruby/object:Gem::Dependency
14
28
  name: bundler
15
29
  requirement: !ruby/object:Gem::Requirement
@@ -59,6 +73,7 @@ extensions: []
59
73
  extra_rdoc_files: []
60
74
  files:
61
75
  - CODE_OF_CONDUCT.md
76
+ - LICENSE.md
62
77
  - README.md
63
78
  - VERSION
64
79
  - lib/cocoapods/command/gen.rb
@@ -68,9 +83,10 @@ files:
68
83
  - lib/cocoapods/generate/podfile_generator.rb
69
84
  - lib/cocoapods_plugin.rb
70
85
  homepage: https://github.com/square/cocoapods-generate
71
- licenses: []
86
+ licenses:
87
+ - MIT
72
88
  metadata: {}
73
- post_install_message:
89
+ post_install_message:
74
90
  rdoc_options: []
75
91
  require_paths:
76
92
  - lib
@@ -85,8 +101,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
85
101
  - !ruby/object:Gem::Version
86
102
  version: '0'
87
103
  requirements: []
88
- rubygems_version: 3.0.2
89
- signing_key:
104
+ rubygems_version: 3.0.1
105
+ signing_key:
90
106
  specification_version: 4
91
107
  summary: Generates Xcode workspaces from a podspec.
92
108
  test_files: []