pod-builder 6.0.2 → 6.2.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: 1fed719cee7d859bf10cd194913e5814f3b0bcd91371bdd11952123bff998caa
4
- data.tar.gz: b2767ef27bc60333be2c62c4e07fc4fba007af810cac78d8862ef3017b25186a
3
+ metadata.gz: 306492a077037cf3f5d3147f969c0d5a10d7192b6b62b753f976447d295e03e5
4
+ data.tar.gz: 2d02289b4e4916f87b1d46b11a3469f0067f9b904b299b9d0753e270db51b967
5
5
  SHA512:
6
- metadata.gz: d7b18e54ac32ce7e4bdc9ddf00c2026f35a0965ba44030216a26a028384dda4a74dca769d476778e4680c118023c8666bda2914f61a292a62ace2825fb19d2b4
7
- data.tar.gz: 42f4e22b67180fbeb45290028341227139bf40dbbb5071260457c5530932108972d95101e73d23f5c3ae633e40692b740464da7902d37993bcefd0767ce658c1
6
+ metadata.gz: 0ed234e2e919b8055e3e8e40c5e9e3bcca6722cfd65bc1a5c043748e5d21f487dc9af4eedc20c68913083e52118c76826127862340b691ae902bc97cfa463a3b
7
+ data.tar.gz: 2ad0db58b1c33e415e6591a45dbfae27e47f805adb11be645701896b64a17eaa55a7d86e1b7eaef0b3eab1d933c7dcefe9c304f161405c0c7ea148d2696e363c
data/README.md CHANGED
@@ -322,6 +322,10 @@ Specify which pods PodBuilder should NOT be built as .xcframeworks when `build_x
322
322
 
323
323
  Specify which pods PodBuilder should be built as .xcframeworks. Will enable `library_evolution_support`. Default value: []
324
324
 
325
+ #### `default_build_configuration`
326
+
327
+ Specify the build configuration used to prebuild pods, either `debug` or `release`. Pods that specify a `prebuild_configuration` in the `pod_target_xcconfig` of their podspec (or via `spec_overrides`) are unaffected. Default value: `release`
328
+
325
329
  #### `generate_coverage`
326
330
 
327
331
  Specify if coverage data for use with profiled execution should be generated. Default value: false
@@ -396,6 +400,24 @@ You need to specify a `path` to the executable script which is relative to the _
396
400
 
397
401
  **Note:** The build action might be invoked more than once depending on the build strategy that PodBuilder needs to perform.
398
402
 
403
+ #### Environment variables available to `pre_actions`/`post_actions` scripts
404
+
405
+ `switch` and `build`/`install` actions are invoked with a set of environment variables describing the pods involved, so scripts don't need to re-parse the Podfile or `ARGV` themselves.
406
+
407
+ | Variable | Description | `switch` | `install`/`build` |
408
+ |---|---|---|---|
409
+ | `PB_PODS` | Comma-separated pod names explicitly passed on the command line | ✅ | ✅ |
410
+ | `PB_SWITCH_MODE` | `prebuilt`, `development` or `default` | ✅ | |
411
+ | `PB_PARENT_DEPS` | Comma-separated pods added because they depend on `PB_PODS` (via `switch`'s `-r`; always resolved for `build`) | ✅ | ✅ |
412
+ | `PB_CHILD_DEPS` | Comma-separated pods added because `PB_PODS` depends on them (via `switch`'s `-c`; always resolved for `build`) | ✅ | ✅ |
413
+ | `PB_UPDATE_REPOS` | `true`/`false`, whether the CocoaPods repo was updated (`-u` sets this to `false`) | ✅ | ✅ |
414
+ | `PB_CONFIGURATION` | `debug` or `release` | | ✅ |
415
+ | `PB_XCFRAMEWORK` | `true`/`false`, whether this pod is being built as an xcframework | | ✅ |
416
+
417
+ Note: For `pre_actions[:switch]`, dependency resolution (`-r`/`-c`) hasn't run yet, so `PB_PARENT_DEPS`/`PB_CHILD_DEPS` are always empty there; `PB_PODS` is also the raw, unresolved argument list. Check `post_actions[:switch]` if you need the fully resolved set.
418
+
419
+ `pre_actions[:build]` is invoked from a different context than `pre_actions[:install]`/`post_actions[:build]` — a CocoaPods `post_install` hook nested inside the build's own `pod install`, rather than directly from the `build` command loop. All the same variables are set there too, threaded through via the internal `podbuilder-rome` plugin options.
420
+
399
421
 
400
422
  # Behind the scenes
401
423
 
@@ -32,7 +32,7 @@ module PodBuilder
32
32
  raise "\n\nEmpty or missing #{step} #{name} action path\n".red if @path.empty?()
33
33
  end
34
34
 
35
- def execute()
35
+ def execute(env = {})
36
36
  cmd = PodBuilder::basepath(path)
37
37
  unless File.exist?(cmd)
38
38
  raise "\n\n#{@step.capitalize} #{@name} action path '#{cmd}' does not exists!\n".red
@@ -43,7 +43,22 @@ module PodBuilder
43
43
  end
44
44
 
45
45
  puts "Executing #{@step} #{@name} action".yellow
46
+
47
+ previous_env = {}
48
+ env.each do |key, value|
49
+ previous_env[key] = ENV[key]
50
+ ENV[key] = value.to_s
51
+ end
52
+
46
53
  `#{cmd}`
54
+ ensure
55
+ previous_env&.each do |key, value|
56
+ if value.nil?
57
+ ENV.delete(key)
58
+ else
59
+ ENV[key] = value
60
+ end
61
+ end
47
62
  end
48
63
  end
49
64
  end
@@ -41,6 +41,8 @@ module PodBuilder
41
41
  }
42
42
  argument_pods = available_argument_pods.uniq
43
43
 
44
+ explicit_pod_names = argument_pods.dup
45
+
44
46
  Podfile.restore_podfile_clean(all_buildable_items)
45
47
 
46
48
  restore_file_error = Podfile.restore_file_sanity_check
@@ -50,6 +52,8 @@ module PodBuilder
50
52
  pods_to_build = resolve_pods_to_build(argument_pods, buildable_items)
51
53
  buildable_items -= pods_to_build
52
54
 
55
+ parent_dep_names = pods_to_build.map(&:root_name).uniq - explicit_pod_names
56
+
53
57
  argument_pods += pods_to_build.map(&:root_name)
54
58
  argument_pods.uniq!
55
59
 
@@ -67,7 +71,9 @@ module PodBuilder
67
71
  # 2. PodB is marked to be built as xcframework
68
72
  # 3. We rebuild PodA only (pods_to_build contains only PodA)
69
73
  # 4. We need to add dependencies recursively so that PodB is is added to pods_to_build_release_xcframework
74
+ pre_recursive_dep_names = pods_to_build.map(&:root_name).uniq
70
75
  pods_to_build = pods_to_build.map { |t| t.recursive_dependencies(all_buildable_items) }.flatten.uniq
76
+ child_dep_names = pods_to_build.map(&:root_name).uniq - pre_recursive_dep_names
71
77
 
72
78
  pods_to_build_debug = pods_to_build.select { |x| x.build_configuration == "debug" }
73
79
  pods_to_build_release = pods_to_build - pods_to_build_debug
@@ -113,20 +119,24 @@ module PodBuilder
113
119
  # pods_to_build_release and therefore build will fail
114
120
  podfile_items = podfile_items.map { |t| t.recursive_dependencies(all_buildable_items) }.flatten.uniq
115
121
 
116
- podfile_content = Podfile.from_podfile_items(podfile_items, analyzer, build_configuration, install_using_frameworks, build_catalyst, podfile_items.first.build_xcframework)
122
+ podfile_content = Podfile.from_podfile_items(podfile_items, analyzer, build_configuration, install_using_frameworks, build_catalyst, podfile_items.first.build_xcframework,
123
+ pods: explicit_pod_names, parent_deps: parent_dep_names, child_deps: child_dep_names)
117
124
 
118
125
  PodBuilder::safe_rm_rf(Configuration.build_path)
119
126
  FileUtils.mkdir_p(Configuration.build_path)
120
127
 
121
128
  init_git(Configuration.build_path) # this is needed to be able to call safe_rm_rf
122
129
 
123
- Configuration.pre_actions[:install]&.execute()
130
+ env = build_env(explicit_pod_names, parent_deps: parent_dep_names, child_deps: child_dep_names,
131
+ configuration: build_configuration, xcframework: podfile_items.first.build_xcframework)
132
+
133
+ Configuration.pre_actions[:install]&.execute(env)
124
134
 
125
135
  install_result += Install.podfile(podfile_content, podfile_items, argument_pods, podfile_items.first.build_configuration)
126
136
 
127
137
  FileUtils.rm_f(PodBuilder::basepath("Podfile.lock"))
128
138
 
129
- Configuration.post_actions[:build]&.execute()
139
+ Configuration.post_actions[:build]&.execute(env)
130
140
  end
131
141
 
132
142
  install_result.write_prebuilt_info_files
@@ -265,6 +275,17 @@ module PodBuilder
265
275
  return buildable_subspecs - pods_to_build
266
276
  end
267
277
 
278
+ def self.build_env(pods, parent_deps: [], child_deps: [], configuration: nil, xcframework: false)
279
+ {
280
+ "PB_PODS" => pods.join(","),
281
+ "PB_PARENT_DEPS" => parent_deps.join(","),
282
+ "PB_CHILD_DEPS" => child_deps.join(","),
283
+ "PB_UPDATE_REPOS" => (OPTIONS[:update_repos] != false).to_s,
284
+ "PB_CONFIGURATION" => configuration.to_s,
285
+ "PB_XCFRAMEWORK" => xcframework.to_s,
286
+ }
287
+ end
288
+
268
289
  def self.resolve_pods_to_build(argument_pods, buildable_items)
269
290
  pods_to_build = []
270
291
 
@@ -25,11 +25,11 @@ module PodBuilder
25
25
  end
26
26
  end
27
27
 
28
- unless argument_pods.count > 0
28
+ unless argument_pods.count > 0
29
29
  return -1
30
30
  end
31
31
 
32
- Configuration.pre_actions[:switch]&.execute()
32
+ Configuration.pre_actions[:switch]&.execute(switch_env(argument_pods))
33
33
 
34
34
  pods_not_found = []
35
35
  pod_names_to_switch = []
@@ -40,12 +40,14 @@ module PodBuilder
40
40
  if pod_name_to_switch.nil?
41
41
  raise "\n\n'#{pod}' not found in PodBuilder's Podfile.\n\nYou might need to explictly add:\n\n pod '#{pod}'\n\nto #{PodBuilder::basepath("Podfile")}\n".red
42
42
  else
43
- check_not_building_subspec(pod_name_to_switch)
43
+ check_not_building_subspec(pod_name_to_switch)
44
44
 
45
- pod_names_to_switch.push(pod_name_to_switch)
46
- end
45
+ pod_names_to_switch.push(pod_name_to_switch)
46
+ end
47
47
  end
48
48
 
49
+ explicit_pod_names = pod_names_to_switch.dup
50
+
49
51
  if OPTIONS[:resolve_parent_dependencies] == true
50
52
  install_update_repo = OPTIONS.fetch(:update_repos, false)
51
53
  installer, analyzer = Analyze.installer_at(PodBuilder::basepath, install_update_repo)
@@ -67,6 +69,8 @@ module PodBuilder
67
69
  pod_names_to_switch.uniq!
68
70
  end
69
71
 
72
+ parent_dep_names = pod_names_to_switch - explicit_pod_names
73
+
70
74
  dep_pod_names_to_switch = []
71
75
  if OPTIONS[:resolve_child_dependencies] == true
72
76
  pod_names_to_switch.each do |pod|
@@ -207,7 +211,7 @@ module PodBuilder
207
211
  system("#{bundler_prefix}pod install;")
208
212
  end
209
213
 
210
- Configuration.post_actions[:switch]&.execute()
214
+ Configuration.post_actions[:switch]&.execute(switch_env(explicit_pod_names, parent_deps: parent_dep_names, child_deps: dep_pod_names_to_switch))
211
215
 
212
216
  puts "\n\n🎉 done!\n".green
213
217
 
@@ -284,6 +288,16 @@ module PodBuilder
284
288
  raise "\n\nCan't switch subspec #{pod_to_switch} refer to podspec name.\n\nUse `pod_builder switch #{pod_to_switch.split("/").first}` instead\n".red
285
289
  end
286
290
  end
291
+
292
+ def self.switch_env(pods, parent_deps: [], child_deps: [])
293
+ {
294
+ "PB_PODS" => pods.join(","),
295
+ "PB_SWITCH_MODE" => OPTIONS[:switch_mode].to_s,
296
+ "PB_PARENT_DEPS" => parent_deps.join(","),
297
+ "PB_CHILD_DEPS" => child_deps.join(","),
298
+ "PB_UPDATE_REPOS" => (OPTIONS[:update_repos] != false).to_s,
299
+ }
300
+ end
287
301
  end
288
302
  end
289
303
  end
@@ -49,6 +49,7 @@ module PodBuilder
49
49
  attr_accessor :build_settings
50
50
  attr_accessor :build_settings_overrides
51
51
  attr_accessor :build_system
52
+ attr_accessor :default_build_configuration
52
53
  attr_accessor :library_evolution_support
53
54
  attr_accessor :base_path
54
55
  attr_accessor :spec_overrides
@@ -91,6 +92,7 @@ module PodBuilder
91
92
 
92
93
  @allow_building_development_pods = false
93
94
  @build_system = "Latest".freeze # either Latest (New build system) or Legacy (Standard build system)
95
+ @default_build_configuration = "release" # either debug or release, overridable per pod via podspec's `prebuild_configuration`
94
96
  @library_evolution_support = false
95
97
  @base_path = "PodBuilder" # Not nice. This value is used only for initial initization. Once config is loaded it will be an absolute path. FIXME
96
98
  @skip_licenses = []
@@ -186,6 +188,10 @@ module PodBuilder
186
188
  if value.is_a?(String) && ["Latest", "Legacy"].include?(value)
187
189
  Configuration.build_system = value
188
190
  end
191
+ value = json["default_build_configuration"]
192
+ if value.is_a?(String) && ["debug", "release"].include?(value.downcase)
193
+ Configuration.default_build_configuration = value.downcase
194
+ end
189
195
  value = json["library_evolution_support"]
190
196
  if [TrueClass, FalseClass].include?(value.class)
191
197
  Configuration.library_evolution_support = value
@@ -4,7 +4,7 @@ module PodBuilder
4
4
  class Podfile
5
5
  PODBUILDER_LOCK_ACTION = ["raise \"\\n🚨 Do not launch 'pod install' manually, use `pod_builder` instead!\\n\" if !File.exist?('pod_builder.lock')"].freeze
6
6
 
7
- def self.from_podfile_items(items, analyzer, build_configuration, install_using_frameworks, build_catalyst, build_xcframeworks)
7
+ def self.from_podfile_items(items, analyzer, build_configuration, install_using_frameworks, build_catalyst, build_xcframeworks, pods: [], parent_deps: [], child_deps: [])
8
8
  raise "\n\nno items\n".red unless items.count > 0
9
9
 
10
10
  # Xcode 14 requires a development team to be specified for the compilation to succeed
@@ -54,6 +54,10 @@ module PodBuilder
54
54
 
55
55
  podfile.sub!("%%%code_sign_identity%%%", code_sign_identity)
56
56
 
57
+ podfile.sub!("%%%pods%%%", pods.join(","))
58
+ podfile.sub!("%%%parent_deps%%%", parent_deps.join(","))
59
+ podfile.sub!("%%%child_deps%%%", child_deps.join(","))
60
+
57
61
  podfile_build_settings = ""
58
62
 
59
63
  git_rootpath = PodBuilder::git_rootpath
@@ -250,7 +250,7 @@ module PodBuilder
250
250
  root_spec = all_specs.detect { |t| t.name == @root_name } || spec
251
251
  @source_files = source_files_from([spec, root_spec] + default_subspecs_specs)
252
252
 
253
- @build_configuration = spec.root.attributes_hash.dig("pod_target_xcconfig", "prebuild_configuration") || "release"
253
+ @build_configuration = spec.root.attributes_hash.dig("pod_target_xcconfig", "prebuild_configuration") || Configuration.default_build_configuration
254
254
  @build_configuration.downcase!
255
255
 
256
256
  default_license = "MIT"
@@ -342,7 +342,14 @@ Pod::HooksManager.register("podbuilder-rome", :post_install) do |installer_conte
342
342
  raise "\n\nUnsupported target count\n".red unless targets.count == 1
343
343
  target = targets.first
344
344
 
345
- PodBuilder::Configuration.pre_actions[:build]&.execute()
345
+ PodBuilder::Configuration.pre_actions[:build]&.execute({
346
+ "PB_PODS" => user_options.fetch("pods", ""),
347
+ "PB_PARENT_DEPS" => user_options.fetch("parent_deps", ""),
348
+ "PB_CHILD_DEPS" => user_options.fetch("child_deps", ""),
349
+ "PB_UPDATE_REPOS" => (OPTIONS[:update_repos] != false).to_s,
350
+ "PB_CONFIGURATION" => configuration.to_s.downcase,
351
+ "PB_XCFRAMEWORK" => build_xcframeworks.to_s,
352
+ })
346
353
 
347
354
  if build_xcframeworks
348
355
  project_path = sandbox_root.parent + "Pods/Pods.xcodeproj"
@@ -7,7 +7,7 @@ PodBuilder::Configuration::load
7
7
 
8
8
  %%%use_frameworks%%%
9
9
 
10
- plugin 'podbuilder-rome', { dsym: true, configuration: '%%%build_configuration%%%', uses_frameworks: %%%uses_frameworks%%%, keep_swiftmodules: %%%keep_swiftmodules%%%, build_catalyst: %%%build_catalyst%%%, build_xcframeworks: %%%build_xcframeworks%%%, code_sign_identity: '%%%code_sign_identity%%%', prebuilt_root_paths: '%%%prebuilt_root_paths%%%', pre_compile: Proc.new { |installer|
10
+ plugin 'podbuilder-rome', { dsym: true, configuration: '%%%build_configuration%%%', uses_frameworks: %%%uses_frameworks%%%, keep_swiftmodules: %%%keep_swiftmodules%%%, build_catalyst: %%%build_catalyst%%%, build_xcframeworks: %%%build_xcframeworks%%%, code_sign_identity: '%%%code_sign_identity%%%', prebuilt_root_paths: '%%%prebuilt_root_paths%%%', pods: '%%%pods%%%', parent_deps: '%%%parent_deps%%%', child_deps: '%%%child_deps%%%', pre_compile: Proc.new { |installer|
11
11
 
12
12
  def set_build_settings(target_name, build_configurations, installer)
13
13
  installer.pods_project.targets.each do |target|
@@ -1,3 +1,3 @@
1
1
  module PodBuilder
2
- VERSION = "6.0.2"
2
+ VERSION = "6.2.0"
3
3
  end
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: 6.0.2
4
+ version: 6.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: 2026-06-30 00:00:00.000000000 Z
11
+ date: 2026-08-31 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler