pod-builder 6.0.2 → 6.1.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 +4 -4
- data/README.md +18 -0
- data/lib/pod_builder/actions.rb +16 -1
- data/lib/pod_builder/command/build.rb +24 -3
- data/lib/pod_builder/command/switch.rb +20 -6
- data/lib/pod_builder/podfile.rb +5 -1
- data/lib/pod_builder/rome/post_install.rb +8 -1
- data/lib/pod_builder/templates/build_podfile.template +1 -1
- data/lib/pod_builder/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 80ded6f213c9086a27740b25a687db1738b791e3f9558e9cb161d0d7feb4a8c0
|
|
4
|
+
data.tar.gz: 0bed40e1d4a6ec73af065c1c1984e876e9a3b38138b6ef2c72aaea3ceefa1708
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: f771e31b9761f1b37fd977c4f3528cbf8fa2d17d2c8a11a48ae4c7a410e19318bad8047a6766d345cd8775db8c0c9502490bc24e425bc5210c279cd76362bbd4
|
|
7
|
+
data.tar.gz: b24f8bb9aea6f6a8840d9c2b94a129efeb114696aa9cfef5f31748767d6d41667f58a06c5098f6a8ed692c8682a68bac30f3435d3063489b918447a7d8df9e86
|
data/README.md
CHANGED
|
@@ -396,6 +396,24 @@ You need to specify a `path` to the executable script which is relative to the _
|
|
|
396
396
|
|
|
397
397
|
**Note:** The build action might be invoked more than once depending on the build strategy that PodBuilder needs to perform.
|
|
398
398
|
|
|
399
|
+
#### Environment variables available to `pre_actions`/`post_actions` scripts
|
|
400
|
+
|
|
401
|
+
`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.
|
|
402
|
+
|
|
403
|
+
| Variable | Description | `switch` | `install`/`build` |
|
|
404
|
+
|---|---|---|---|
|
|
405
|
+
| `PB_PODS` | Comma-separated pod names explicitly passed on the command line | ✅ | ✅ |
|
|
406
|
+
| `PB_SWITCH_MODE` | `prebuilt`, `development` or `default` | ✅ | |
|
|
407
|
+
| `PB_PARENT_DEPS` | Comma-separated pods added because they depend on `PB_PODS` (via `switch`'s `-r`; always resolved for `build`) | ✅ | ✅ |
|
|
408
|
+
| `PB_CHILD_DEPS` | Comma-separated pods added because `PB_PODS` depends on them (via `switch`'s `-c`; always resolved for `build`) | ✅ | ✅ |
|
|
409
|
+
| `PB_UPDATE_REPOS` | `true`/`false`, whether the CocoaPods repo was updated (`-u` sets this to `false`) | ✅ | ✅ |
|
|
410
|
+
| `PB_CONFIGURATION` | `debug` or `release` | | ✅ |
|
|
411
|
+
| `PB_XCFRAMEWORK` | `true`/`false`, whether this pod is being built as an xcframework | | ✅ |
|
|
412
|
+
|
|
413
|
+
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.
|
|
414
|
+
|
|
415
|
+
`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.
|
|
416
|
+
|
|
399
417
|
|
|
400
418
|
# Behind the scenes
|
|
401
419
|
|
data/lib/pod_builder/actions.rb
CHANGED
|
@@ -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
|
-
|
|
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
|
data/lib/pod_builder/podfile.rb
CHANGED
|
@@ -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
|
|
@@ -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|
|
data/lib/pod_builder/version.rb
CHANGED
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
|
|
4
|
+
version: 6.1.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-
|
|
11
|
+
date: 2026-08-27 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: bundler
|