pod-builder 2.3.0 → 3.0.0

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: 9bb2a7642ff281371f45e15c62966fd461fc47d79c573d553926e8ac37327b34
4
- data.tar.gz: b4ea4ef42a12bdeb1b23a4824c07ecdf7f24d459e2c4ed00a39e3ab664961214
3
+ metadata.gz: 0dada31dddd8303f3429e7ebbb13665f6c1e8b4d66ad618795971c652ecb3f7b
4
+ data.tar.gz: 290cdba5a29f1672372057f28ec9a867dcba0172b97b1e4c7a6a0cc2a83b6aed
5
5
  SHA512:
6
- metadata.gz: 2b686f329d928e794cf6809eb6c51078692e6e9fdf8f522e345c6bedfc8a1f68fa883613c0e86f7faf202246eb278478a194c60155916996edf24c2b5d3619e2
7
- data.tar.gz: 0df40657505a0d8fc5af1319d695929a883ba304acb79ece94caeaaebe454a7285f183f9a2fa9284915a315e1756f077b35f689d73f7b09aa1843b5c602594f8
6
+ metadata.gz: f0af1cd519bdea4f141c374853c631bfb46813ae0c2caad40d92c7716fbc941e9f5dc4772b6358c368b76840937478fe75f3cb3c4df2508b7593ac527c582ebf
7
+ data.tar.gz: 3087670122ad1420438ac6944056e11858b62752aa7b1749b0b4411515d4ceacc80178b045027da3fcfe2404ad33b44be3ab5de64dd1b689fbd5753988783eff
data/README.md CHANGED
@@ -280,9 +280,17 @@ Like `build_settings` but per pod. Pod name can also refer to subspec.
280
280
 
281
281
  Specify which build system to use to compile frameworks. Either `Legacy` (standard build system) or `Latest` (new build system). Default value: `Latest`.
282
282
 
283
- #### `build_xcframeworks`
283
+ #### `build_xcframeworks_all`
284
284
 
285
- Specify if PodBuilder will build .xcframeworks. Will enable `library_evolution_support`. Default value: false
285
+ Specify if PodBuilder should build all pods as .xcframeworks. Will enable `library_evolution_support`. Default value: false
286
+
287
+ #### `build_xcframeworks_exclude`
288
+
289
+ Specify which pods PodBuilder should NOT be built as .xcframeworks when `build_xcframeworks_all` is true. Default value: []
290
+
291
+ #### `build_xcframeworks_include`
292
+
293
+ Specify which pods PodBuilder should be built as .xcframeworks. Will enable `library_evolution_support`. Default value: []
286
294
 
287
295
  #### `library_evolution_support`
288
296
 
@@ -327,11 +335,8 @@ The podspec of the Pod you're trying to build doesn't specify the swift_version
327
335
 
328
336
  ```json
329
337
  "spec_overrides": {
330
- "Google-Mobile-Ads-SDK": {
331
- "module_name": "GoogleMobileAds"
332
- },
333
338
  "PodWithError": {
334
- "swift_version": "5.0"
339
+ "swift_version": "5.3"
335
340
  }
336
341
  }
337
342
  ```
@@ -63,9 +63,21 @@ module PodBuilder
63
63
  pods_to_build_debug = pods_to_build.select { |x| x.build_configuration == "debug" }
64
64
  pods_to_build_release = pods_to_build - pods_to_build_debug
65
65
 
66
+ pods_to_build_debug_xcframework = pods_to_build_debug.select { |x| x.build_xcframework }
67
+ pods_to_build_debug -= pods_to_build_debug_xcframework
68
+
69
+ pods_to_build_release_xcframework = pods_to_build_release.select { |x| x.build_xcframework }
70
+ pods_to_build_release -= pods_to_build_release_xcframework
71
+
66
72
  check_dependencies_build_configurations(all_buildable_items)
67
73
 
68
- podfiles_items = [pods_to_build_debug] + [pods_to_build_release]
74
+ # When building mixed framwork/xcframeworks pods xcframeworks should be built last
75
+ # so that the .xcframework overwrite the .framwork if the same pod needs to be built
76
+ # in both ways.
77
+ # For example we might have configured to build onlt PodA as xcframework, another pod
78
+ # PodB has a dependency to PodA. When Building PodB, PodA gets rebuilt as .framework
79
+ # but then PodA gets rebuilt again as .xcframework overwriting the .framework.
80
+ podfiles_items = [pods_to_build_debug] + [pods_to_build_release] + [pods_to_build_debug_xcframework] + [pods_to_build_release_xcframework]
69
81
 
70
82
  install_using_frameworks = Podfile::install_using_frameworks(analyzer)
71
83
  if Configuration.react_native_project
@@ -86,7 +98,8 @@ module PodBuilder
86
98
  build_configuration = podfile_items.map(&:build_configuration).uniq.first
87
99
 
88
100
  podfile_items = podfile_items.map { |t| t.recursive_dependencies(all_buildable_items) }.flatten.uniq
89
- podfile_content = Podfile.from_podfile_items(podfile_items, analyzer, build_configuration, install_using_frameworks, build_catalyst, Configuration.build_xcframeworks)
101
+
102
+ podfile_content = Podfile.from_podfile_items(podfile_items, analyzer, build_configuration, install_using_frameworks, build_catalyst, podfile_items.first.build_xcframework)
90
103
 
91
104
  install_result += Install.podfile(podfile_content, podfile_items, podfile_items.first.build_configuration)
92
105
 
@@ -39,19 +39,10 @@ module PodBuilder
39
39
  "ENABLE_BITCODE": "NO"
40
40
  }
41
41
  }.freeze
42
- DEFAULT_SKIP_PODS = ["GoogleMaps", "React-RCTFabric", "React-Core", "React-CoreModules"] # Not including React-RCTNetwork might loose some debug warnings
43
-
44
- DEFAULT_FORCE_PREBUILD_PODS = []
45
- DEFAULT_BUILD_SYSTEM = "Latest".freeze # either Latest (New build system) or Legacy (Standard build system)
46
- DEFAULT_LIBRARY_EVOLUTION_SUPPORT = false
47
- DEFAULT_PLATFORMS = ["iphoneos", "iphonesimulator", "appletvos", "appletvsimulator"].freeze
48
- DEFAULT_BUILD_USING_REPO_PATHS = false
49
- DEFAULT_BUILD_XCFRAMEWORKS = false
50
42
 
51
43
  private_constant :DEFAULT_BUILD_SETTINGS
52
44
  private_constant :DEFAULT_BUILD_SETTINGS_OVERRIDES
53
- private_constant :DEFAULT_BUILD_SYSTEM
54
- private_constant :DEFAULT_LIBRARY_EVOLUTION_SUPPORT
45
+ private_constant :DEFAULT_SPEC_OVERRIDE
55
46
 
56
47
  class <<self
57
48
  attr_accessor :allow_building_development_pods
@@ -81,19 +72,22 @@ module PodBuilder
81
72
  attr_accessor :build_using_repo_paths
82
73
  attr_accessor :react_native_project
83
74
  attr_accessor :lldbinit_name
84
- attr_accessor :build_xcframeworks
75
+ attr_accessor :build_xcframeworks_all
76
+ attr_accessor :build_xcframeworks_include
77
+ attr_accessor :build_xcframeworks_exclude
85
78
  end
86
-
87
- @allow_building_development_pods = false
79
+
88
80
  @build_settings = DEFAULT_BUILD_SETTINGS
89
81
  @build_settings_overrides = DEFAULT_BUILD_SETTINGS_OVERRIDES
90
- @build_system = DEFAULT_BUILD_SYSTEM
91
- @library_evolution_support = DEFAULT_LIBRARY_EVOLUTION_SUPPORT
92
- @base_path = "PodBuilder" # Not nice. This value is used only for initial initization. Once config is loaded it will be an absolute path. FIXME
93
82
  @spec_overrides = DEFAULT_SPEC_OVERRIDE
83
+
84
+ @allow_building_development_pods = false
85
+ @build_system = "Latest".freeze # either Latest (New build system) or Legacy (Standard build system)
86
+ @library_evolution_support = false
87
+ @base_path = "PodBuilder" # Not nice. This value is used only for initial initization. Once config is loaded it will be an absolute path. FIXME
94
88
  @skip_licenses = []
95
- @skip_pods = DEFAULT_SKIP_PODS
96
- @force_prebuild_pods = DEFAULT_FORCE_PREBUILD_PODS
89
+ @skip_pods = ["GoogleMaps", "React-RCTFabric", "React-Core", "React-CoreModules"] # Not including React-RCTNetwork might loose some debug warnings
90
+ @force_prebuild_pods = []
97
91
  @license_filename = "Pods-acknowledgements"
98
92
  @development_pods_paths = []
99
93
  @build_base_path = "/tmp/pod_builder".freeze
@@ -110,11 +104,13 @@ module PodBuilder
110
104
  @use_bundler = false
111
105
  @deterministic_build = false
112
106
 
113
- @supported_platforms = DEFAULT_PLATFORMS
114
- @build_using_repo_paths = DEFAULT_BUILD_USING_REPO_PATHS
107
+ @supported_platforms = ["iphoneos", "iphonesimulator", "appletvos", "appletvsimulator"].freeze
108
+ @build_using_repo_paths = false
115
109
  @react_native_project = false
116
110
 
117
- @build_xcframeworks = DEFAULT_BUILD_XCFRAMEWORKS
111
+ @build_xcframeworks_all = false
112
+ @build_xcframeworks_include = []
113
+ @build_xcframeworks_exclude = []
118
114
 
119
115
  def self.check_inited
120
116
  raise "\n\nNot inited, run `pod_builder init`\n".red if podbuilder_path.nil?
@@ -218,12 +214,22 @@ module PodBuilder
218
214
  Configuration.react_native_project = value
219
215
  end
220
216
  end
221
- if value = json["build_xcframeworks"]
217
+ if value = json["build_xcframeworks_all"]
222
218
  if [TrueClass, FalseClass].include?(value.class)
223
- Configuration.build_xcframeworks = value
219
+ Configuration.build_xcframeworks_all = value
224
220
  end
225
221
  end
226
-
222
+ if value = json["build_xcframeworks_include"]
223
+ if value.is_a?(Array)
224
+ Configuration.build_xcframeworks_include = value
225
+ end
226
+ end
227
+ if value = json["build_xcframeworks_exclude"]
228
+ if value.is_a?(Array)
229
+ Configuration.build_xcframeworks_exclude = value
230
+ end
231
+ end
232
+
227
233
  Configuration.build_settings.freeze
228
234
 
229
235
  sanity_check()
@@ -279,6 +285,11 @@ module PodBuilder
279
285
  puts "PodBuilder.json contains '#{pod}' both in `force_prebuild_pods` and `skip_pods`. Will force prebuilding.".yellow
280
286
  end
281
287
  end
288
+ if Configuration.build_xcframeworks_all
289
+ raise "Invalid PodBuilder.json configuration: 'build_xcframeworks_all' is true and 'build_xcframeworks_include' is not empty" if Configuration.build_xcframeworks_include.count > 0
290
+ else
291
+ raise "Invalid PodBuilder.json configuration: 'build_xcframeworks_all' is false and 'build_xcframeworks_exclude' is not empty" if Configuration.build_xcframeworks_exclude.count > 0
292
+ end
282
293
  end
283
294
 
284
295
  def self.config_path
@@ -379,6 +379,7 @@ module PodBuilder
379
379
  pod_names.each do |pod_name|
380
380
  root_name = pod_name.split("/").first
381
381
 
382
+ # Remove existing files
382
383
  items_to_delete = Dir.glob("#{PodBuilder::prebuiltpath(root_name)}/**/*")
383
384
  items_to_delete.each { |t| PodBuilder::safe_rm_rf(t) }
384
385
  end
@@ -393,6 +394,14 @@ module PodBuilder
393
394
  next
394
395
  end
395
396
 
397
+ if podfile_item = podfile_items.detect { |t| t.root_name == pod_name }
398
+ if Dir.glob("#{source_path}/**/Modules/**/*.swiftmodule/*.swiftinterface").count > 0
399
+ # We can safely remove .swiftmodule if .swiftinterface exists
400
+ swiftmodule_files = Dir.glob("#{source_path}/**/Modules/**/*.swiftmodule/*.swiftmodule")
401
+ swiftmodule_files.each { |t| PodBuilder::safe_rm_rf(t) }
402
+ end
403
+ end
404
+
396
405
  unless Dir.glob("#{source_path}/**/*").select { |t| File.file?(t) }.empty?
397
406
  destination_folder = PodBuilder::prebuiltpath(root_name)
398
407
  FileUtils.mkdir_p(destination_folder)
@@ -60,11 +60,7 @@ module PodBuilder
60
60
 
61
61
  if Configuration.build_system == "Legacy"
62
62
  build_settings["BUILD_LIBRARY_FOR_DISTRIBUTION"] = "NO"
63
- raise "\n\nCan't enable library evolution support with legacy build system!".red if Configuration.library_evolution_support
64
- elsif Configuration.library_evolution_support
65
- build_settings["BUILD_LIBRARY_FOR_DISTRIBUTION"] = "YES"
66
- end
67
- if Configuration.build_xcframeworks
63
+ elsif Configuration.library_evolution_support || item.build_xcframework
68
64
  build_settings["BUILD_LIBRARY_FOR_DISTRIBUTION"] = "YES"
69
65
  end
70
66
 
@@ -103,27 +103,27 @@ module PodBuilder
103
103
  #
104
104
  attr_accessor :libraries
105
105
 
106
- # @return [String] source_files
106
+ # @return [String] Source_files
107
107
  #
108
108
  attr_accessor :source_files
109
109
 
110
- # @return [String] license
110
+ # @return [String] License
111
111
  #
112
112
  attr_accessor :license
113
113
 
114
- # @return [String] summary
114
+ # @return [String] Summary
115
115
  #
116
116
  attr_accessor :summary
117
117
 
118
- # @return [Hash] source
118
+ # @return [Hash] Source
119
119
  #
120
120
  attr_accessor :source
121
121
 
122
- # @return [Hash] authors
122
+ # @return [Hash] Authors
123
123
  #
124
124
  attr_accessor :authors
125
125
 
126
- # @return [String] homepage
126
+ # @return [String] Homepage
127
127
  #
128
128
  attr_accessor :homepage
129
129
 
@@ -134,6 +134,10 @@ module PodBuilder
134
134
  # @return [Bool] Defines module
135
135
  #
136
136
  attr_accessor :defines_module
137
+
138
+ # @return [Bool] Should build as xcframework
139
+ #
140
+ attr_accessor :build_xcframework
137
141
 
138
142
  # Initialize a new instance
139
143
  #
@@ -235,6 +239,13 @@ module PodBuilder
235
239
  @source = spec.root.attributes_hash.fetch("source", { "git"=>"https://github.com/Subito-it/PodBuilder.git" })
236
240
  @authors = spec.root.attributes_hash.fetch("authors", {"PodBuilder"=>"pod@podbuilder.com"})
237
241
  @homepage = spec.root.attributes_hash.fetch("homepage", "https://github.com/Subito-it/PodBuilder")
242
+
243
+ if Configuration.build_xcframeworks_all
244
+ build_as_xcframework = !Configuration.build_xcframeworks_exclude.include?(@root_name)
245
+ else
246
+ build_as_xcframework = Configuration.build_xcframeworks_include.include?(@root_name)
247
+ end
248
+ @build_xcframework = build_as_xcframework
238
249
  end
239
250
 
240
251
  def pod_specification(all_poditems, parent_spec = nil)
@@ -53,7 +53,11 @@ module PodBuilder
53
53
  resources = []
54
54
  exclude_files = []
55
55
  vendored_frameworks.each do |vendored_framework|
56
- binary_path = Dir.glob(PodBuilder::prebuiltpath("#{item.root_name}/#{vendored_framework}/**/#{File.basename(vendored_framework, ".*")}")).first
56
+ if vendored_framework.end_with?(".xcframework")
57
+ binary_path = Dir.glob(PodBuilder::prebuiltpath("#{item.root_name}/#{vendored_framework}/**/#{File.basename(vendored_framework, ".*")}")).reject { |t| t.include?("simulator") }.first
58
+ else
59
+ binary_path = Dir.glob(PodBuilder::prebuiltpath("#{item.root_name}/#{vendored_framework}/**/#{File.basename(vendored_framework, ".*")}")).first
60
+ end
57
61
 
58
62
  next if binary_path.nil?
59
63
 
@@ -6,9 +6,11 @@ module PodBuilder
6
6
  class XcodeBuildSettings
7
7
  attr_reader :platform_name
8
8
  attr_reader :build_destination
9
+ attr_reader :configuration
9
10
 
10
- def initialize(platform_name)
11
+ def initialize(platform_name, configuration)
11
12
  @platform_name = platform_name
13
+ @configuration = configuration
12
14
 
13
15
  case platform_name
14
16
  when "iphoneos" then @build_destination = "generic/platform=iOS"
@@ -313,18 +315,18 @@ Pod::HooksManager.register('podbuilder-rome', :post_install) do |installer_conte
313
315
 
314
316
  case target.platform_name
315
317
  when :ios then
316
- xcodebuild_settings = [PodBuilder::XcodeBuildSettings.new("iphoneos"), PodBuilder::XcodeBuildSettings.new("iphonesimulator")]
318
+ xcodebuild_settings = [PodBuilder::XcodeBuildSettings.new("iphoneos", configuration), PodBuilder::XcodeBuildSettings.new("iphonesimulator", configuration)]
317
319
  if build_catalyst
318
- xcodebuild_settings += [PodBuilder::XcodeBuildSettings.new("catalyst")]
320
+ xcodebuild_settings += [PodBuilder::XcodeBuildSettings.new("catalyst", configuration)]
319
321
  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")]
322
+ when :osx then xcodebuild_settings = [PodBuilder::XcodeBuildSettings.new("macos", configuration)]
323
+ when :tvos then xcodebuild_settings = [PodBuilder::XcodeBuildSettings.new("tvos", configuration), PodBuilder::XcodeBuildSettings.new("tvossimulator", configuration)]
324
+ when :watchos then xcodebuild_settings = [PodBuilder::XcodeBuildSettings.new("watchos", configuration), PodBuilder::XcodeBuildSettings.new("watchossimulator", configuration)]
323
325
  else raise "\n\nUnknown platform '#{target.platform_name}'".red end
324
326
 
325
327
  xcodebuild_settings.each do |xcodebuild_setting|
326
328
  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")
329
+ raise "\n\n#{build_destination} xcframework archive failed!".red if !system("xcodebuild archive -project #{project_path.to_s} -scheme Pods-DummyTarget -configuration #{xcodebuild_setting.configuration} -destination '#{xcodebuild_setting.build_destination}' -archivePath '#{build_dir}/#{xcodebuild_setting.platform_name}' SKIP_INSTALL=NO > /dev/null 2>&1")
328
330
  end
329
331
 
330
332
  built_items = Dir.glob("#{build_dir}/#{xcodebuild_settings[0].platform_name}.xcarchive/Products/Library/Frameworks/*").reject { |t| File.basename(t, ".*") == "Pods_DummyTarget" }
@@ -1,4 +1,4 @@
1
1
  module PodBuilder
2
- VERSION = "2.3.0"
2
+ VERSION = "3.0.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.3.0
4
+ version: 3.0.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: 2021-01-11 00:00:00.000000000 Z
11
+ date: 2021-02-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler