pod-builder 2.1.1 → 2.2.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: 81ee77b8206a7bda4fb55dd0fe30d3702aa1c9baad18017177b7c05d87ef1ea9
4
- data.tar.gz: 12d28eb2a3b4329a2242bcf0477742178998209f895392ac8e4c6e4bdf234b9c
3
+ metadata.gz: 6ffc11e0c2a085b295c06e71951ba737c6143103fdb77441d5c9e7abb71d04df
4
+ data.tar.gz: bc96bf60f8890a3a7737ce6632575a34fc8d28ec4de08465efa65d2a9a8805a1
5
5
  SHA512:
6
- metadata.gz: 0bd009a46f76cff1a1423b5131e187c22d5cbfd34d0c1c2475f6ce172862ddd3044853e3a7dd1428e7daeb7bcc21cea81d1b449988f0ee34cba3cae6d6cae541
7
- data.tar.gz: b11f54906c2c800623f48775a646cf6a1e8f01faf1ffeeceb64df503785035f67d86b63725413f4feca732d3ddd486e53312e29b5aad58f90428b24d79335128
6
+ metadata.gz: '008bbc4406aaef09090a52073aa9fc5d892112b830964da0830d356423fbee898ae5d663f7c1845ffe918b2a6e9c35e718428d78aaeb53d29a1918b77b9891b4'
7
+ data.tar.gz: a16426dfc2fa06a58f61dec05ef37a2ca3a6817e5e5a0307bb9e1f6d20fb5f424563dd4a480cf2cee5a288d1c2dba587571a0e0093296f8777332cedce792575
@@ -79,16 +79,17 @@ module PodBuilder
79
79
  end
80
80
  end
81
81
 
82
+ build_catalyst = should_build_catalyst(installer)
83
+
82
84
  install_result = InstallResult.new
83
85
  podfiles_items.reject { |x| x.empty? }.each do |podfile_items|
84
86
  build_configuration = podfile_items.map(&:build_configuration).uniq.first
85
87
 
86
88
  podfile_items = podfile_items.map { |t| t.recursive_dependencies(all_buildable_items) }.flatten.uniq
87
- podfile_content = Podfile.from_podfile_items(podfile_items, analyzer, build_configuration, install_using_frameworks, Configuration.build_xcframeworks)
89
+ podfile_content = Podfile.from_podfile_items(podfile_items, analyzer, build_configuration, install_using_frameworks, build_catalyst, Configuration.build_xcframeworks)
88
90
 
89
91
  install_result += Install.podfile(podfile_content, podfile_items, podfile_items.first.build_configuration)
90
92
 
91
- # remove lockfile which gets unexplicably created
92
93
  FileUtils.rm_f(PodBuilder::basepath("Podfile.lock"))
93
94
  end
94
95
 
@@ -124,6 +125,15 @@ module PodBuilder
124
125
 
125
126
  private
126
127
 
128
+ def self.should_build_catalyst(installer)
129
+ build_settings = installer.analysis_result.targets.map { |t| t.user_project.root_object.targets.map { |u| u.build_configuration_list.build_configurations.map { |v| v.build_settings } } }.flatten
130
+ build_catalyst = build_settings.detect { |t| t["SUPPORTS_MACCATALYST"] == "YES" } != nil
131
+
132
+ puts "\nTo support Catalyst you should enable 'build_xcframeworks' in PodBuilder.json\n".red unless Configuration.build_xcframeworks
133
+
134
+ return build_catalyst
135
+ end
136
+
127
137
  def self.prepare_defines_modules_override(all_buildable_items)
128
138
  all_buildable_items.each do |item|
129
139
  unless item.defines_module.nil?
@@ -5,7 +5,7 @@ module PodBuilder
5
5
 
6
6
  PRE_INSTALL_ACTIONS = ["Pod::Installer::Xcode::TargetValidator.send(:define_method, :verify_no_duplicate_framework_and_library_names) {}", "require 'pod_builder/podfile/pre_actions_swizzles'"].freeze
7
7
 
8
- def self.from_podfile_items(items, analyzer, build_configuration, install_using_frameworks, build_xcframeworks)
8
+ def self.from_podfile_items(items, analyzer, build_configuration, install_using_frameworks, build_catalyst, build_xcframeworks)
9
9
  raise "\n\nno items".red unless items.count > 0
10
10
 
11
11
  sources = analyzer.sources
@@ -18,7 +18,8 @@ module PodBuilder
18
18
  podfile.sub!("%%%use_frameworks%%%", install_using_frameworks ? "use_frameworks!" : "use_modular_headers!")
19
19
  podfile.sub!("%%%uses_frameworks%%%", install_using_frameworks ? "true" : "false")
20
20
  podfile.sub!("%%%build_xcframeworks%%%", build_xcframeworks ? "true" : "false")
21
-
21
+ podfile.sub!("%%%build_catalyst%%%", build_catalyst ? "true" : "false")
22
+
22
23
  podfile.sub!("%%%platform_name%%%", platform.name.to_s)
23
24
  podfile.sub!("%%%deployment_version%%%", platform.deployment_target.version)
24
25
 
@@ -3,6 +3,26 @@ require 'colored'
3
3
  require 'pathname'
4
4
 
5
5
  module PodBuilder
6
+ class XcodeBuildSettings
7
+ attr_reader :platform_name
8
+ attr_reader :build_destination
9
+
10
+ def initialize(platform_name)
11
+ @platform_name = platform_name
12
+
13
+ case platform_name
14
+ when "iphoneos" then @build_destination = "generic/platform=iOS"
15
+ when "iphonesimulator" then @build_destination = "generic/platform=iOS Simulator"
16
+ when "catalyst" then @build_destination = "platform=macOS,arch=x86_64,variant=Mac Catalyst"
17
+ when "macos" then @build_destination = "generic/platform=OS X"
18
+ when "tvos" then @build_destination = "generic/platform=tvOS"
19
+ when "tvossimulator" then @build_destination = "generic/platform=tvOS Simulator"
20
+ when "watchos" then @build_destination = "generic/platform=watchOS"
21
+ when "watchossimulator" then @build_destination = "generic/platform=watchOS Simulator"
22
+ else raise "\n\nUnknown platform '#{platform_name}'".red end
23
+ end
24
+ end
25
+
6
26
  def self.build_for_iosish_platform_framework(sandbox, build_dir, target, device, simulator, configuration, deterministic_build)
7
27
  dsym_device_folder = File.join(build_dir, "dSYM", device)
8
28
  dsym_simulator_folder = File.join(build_dir, "dSYM", simulator)
@@ -269,6 +289,7 @@ Pod::HooksManager.register('podbuilder-rome', :post_install) do |installer_conte
269
289
  if user_options["pre_compile"]
270
290
  user_options["pre_compile"].call(installer_context)
271
291
  end
292
+ build_catalyst = user_options.fetch('build_catalyst', false)
272
293
  build_xcframeworks = user_options.fetch('build_xcframeworks', false)
273
294
 
274
295
  prebuilt_root_paths = JSON.parse(user_options["prebuilt_root_paths"].gsub('=>', ':'))
@@ -291,23 +312,27 @@ Pod::HooksManager.register('podbuilder-rome', :post_install) do |installer_conte
291
312
  project_path = sandbox_root.parent + 'Pods/Pods.xcodeproj'
292
313
 
293
314
  case target.platform_name
294
- when :ios then platforms = ['iphoneos', 'iphonesimulator']
295
- when :osx then platforms = ['macos']
296
- when :tvos then platforms = ['appletvos', 'appletvsimulator']
297
- when :watchos then platforms = ['watchos', 'watchsimulator']
315
+ when :ios then
316
+ xcodebuild_settings = [PodBuilder::XcodeBuildSettings.new("iphoneos"), PodBuilder::XcodeBuildSettings.new("iphonesimulator")]
317
+ if build_catalyst
318
+ xcodebuild_settings += [PodBuilder::XcodeBuildSettings.new("catalyst")]
319
+ end
320
+ when :osx then xcodebuild_settings = [PodBuilder::XcodeBuildSettings.new("macos")]
321
+ when :tvos then xcodebuild_settings = [PodBuilder::XcodeBuildSettings.new("tvos"), PodBuilder::XcodeBuildSettings.new("tvossimulator")]
322
+ when :watchos then xcodebuild_settings = [PodBuilder::XcodeBuildSettings.new("watchos"), PodBuilder::XcodeBuildSettings.new("watchossimulator")]
298
323
  else raise "\n\nUnknown platform '#{target.platform_name}'".red end
299
324
 
300
- platforms.each do |platform|
301
- puts "Building xcframeworks for #{platform}".yellow
302
- raise "\n\n#{platform} xcframework archive failed!".red if !system("xcodebuild archive -project #{project_path.to_s} -scheme Pods-DummyTarget -sdk #{platform} -archivePath '#{build_dir}/#{platform}' SKIP_INSTALL=NO > /dev/null")
325
+ xcodebuild_settings.each do |xcodebuild_setting|
326
+ puts "Building xcframeworks for #{xcodebuild_setting.platform_name}".yellow
327
+ raise "\n\n#{build_destination} xcframework archive failed!".red if !system("xcodebuild archive -project #{project_path.to_s} -scheme Pods-DummyTarget -destination '#{xcodebuild_setting.build_destination}' -archivePath '#{build_dir}/#{xcodebuild_setting.platform_name}' SKIP_INSTALL=NO > /dev/null 2>&1")
303
328
  end
304
329
 
305
- built_items = Dir.glob("#{build_dir}/#{platforms.first}.xcarchive/Products/Library/Frameworks/*").reject { |t| File.basename(t, ".*") == "Pods_DummyTarget" }
330
+ built_items = Dir.glob("#{build_dir}/#{xcodebuild_settings[0].platform_name}.xcarchive/Products/Library/Frameworks/*").reject { |t| File.basename(t, ".*") == "Pods_DummyTarget" }
306
331
 
307
332
  built_items.each do |built_item|
308
333
  built_item_paths = [built_item]
309
- platforms.drop(1).each do |platform|
310
- path = "#{build_dir}/#{platform}.xcarchive/Products/Library/Frameworks/#{File.basename(built_item)}"
334
+ xcodebuild_settings.drop(1).each do |xcodebuild_setting|
335
+ path = "#{build_dir}/#{xcodebuild_setting.platform_name}.xcarchive/Products/Library/Frameworks/#{File.basename(built_item)}"
311
336
  if File.directory?(path)
312
337
  built_item_paths.push(path)
313
338
  else
@@ -321,16 +346,16 @@ Pod::HooksManager.register('podbuilder-rome', :post_install) do |installer_conte
321
346
  framework_name = File.basename(built_item_paths.first, ".*")
322
347
  xcframework_path = "#{base_destination}/#{framework_name}/#{framework_name}.xcframework"
323
348
  framework_params = built_item_paths.map { |t| "-framework '#{t}'"}.join(" ")
324
- raise "\n\nFailed packing xcframework!".red if !system("xcodebuild -create-xcframework #{framework_params} -output '#{xcframework_path}' > /dev/null")
349
+ raise "\n\nFailed packing xcframework!".red if !system("xcodebuild -create-xcframework #{framework_params} -output '#{xcframework_path}' > /dev/null 2>&1")
325
350
 
326
351
  if enable_dsym
327
- platforms.each do |platform|
328
- dsym_source = "#{build_dir}/#{platform}.xcarchive/dSYMs/"
352
+ xcodebuild_settings.each do |xcodebuild_setting|
353
+ dsym_source = "#{build_dir}/#{xcodebuild_setting.platform_name}.xcarchive/dSYMs/"
329
354
  if File.directory?(dsym_source)
330
355
  destination = sandbox_root.parent + "dSYMs"
331
356
  FileUtils.mkdir_p(destination)
332
357
  FileUtils.mv(dsym_source, destination)
333
- FileUtils.mv("#{destination}/dSYMs", "#{destination}/#{platform}")
358
+ FileUtils.mv("#{destination}/dSYMs", "#{destination}/#{xcodebuild_setting.platform_name}")
334
359
  end
335
360
  end
336
361
  else
@@ -4,7 +4,7 @@ require 'cfpropertylist'
4
4
 
5
5
  %%%use_frameworks%%%
6
6
 
7
- plugin 'podbuilder-rome', { dsym: true, configuration: '%%%build_configuration%%%', uses_frameworks: %%%uses_frameworks%%%, build_xcframeworks: %%%build_xcframeworks%%%, prebuilt_root_paths: '%%%prebuilt_root_paths%%%', pre_compile: Proc.new { |installer|
7
+ plugin 'podbuilder-rome', { dsym: true, configuration: '%%%build_configuration%%%', uses_frameworks: %%%uses_frameworks%%%, build_catalyst: %%%build_catalyst%%%, build_xcframeworks: %%%build_xcframeworks%%%, prebuilt_root_paths: '%%%prebuilt_root_paths%%%', pre_compile: Proc.new { |installer|
8
8
 
9
9
  def set_build_settings(target_name, build_configurations, installer)
10
10
  installer.pods_project.targets.each do |target|
@@ -1,4 +1,4 @@
1
1
  module PodBuilder
2
- VERSION = "2.1.1"
2
+ VERSION = "2.2.0"
3
3
  end
4
4
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pod-builder
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.1
4
+ version: 2.2.0
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-11-22 00:00:00.000000000 Z
11
+ date: 2020-12-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler