pod-builder 3.4.0 → 4.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 +4 -4
- data/README.md +19 -0
- data/lib/pod_builder/{post_actions.rb → actions.rb} +1 -1
- data/lib/pod_builder/analyze.rb +4 -1
- data/lib/pod_builder/command/build.rb +16 -3
- data/lib/pod_builder/command/switch.rb +59 -30
- data/lib/pod_builder/configuration.rb +8 -1
- data/lib/pod_builder/core.rb +1 -1
- data/lib/pod_builder/install.rb +2 -13
- data/lib/pod_builder/podfile.rb +3 -1
- data/lib/pod_builder/podfile_item.rb +11 -2
- data/lib/pod_builder/version.rb +1 -2
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3f124024bc7aa2aec5af41460be8461e8e3e0dbade8d118637c77dbfb63b125d
|
4
|
+
data.tar.gz: cde1502b7bcbb9a03434ba897d2ac4ab0af5cf4c341ba16aee15f7c6f0695b9b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 030bc3bc42c5a5958a6fb63e0dcc1ea3d917e27958495e20f2e60da8e2f73301647edcfe529ebc48fb65b033e4b99802afa1a03b601d76516f365bb094985d0e
|
7
|
+
data.tar.gz: eeb5eac3de6e946bcdc9ab84eabaf5a527b73cec86935b1e2da7d87e319550fb98a055d911e61de6031ed369e6f631e0ff60457bbf99dc79a89d4fbc989d202c
|
data/README.md
CHANGED
@@ -324,6 +324,24 @@ PodBuilder writes a plist and markdown license files of pods specified in the Po
|
|
324
324
|
|
325
325
|
If you use bundler to pin the version of CocoaPods in your project set this to true. Default false.
|
326
326
|
|
327
|
+
#### `pre_actions`
|
328
|
+
|
329
|
+
Pre actions allow to execute custom scripts before a given command (`switch`, `build`) has been performed.
|
330
|
+
|
331
|
+
You need to specify a `path` to the executable script which is relative to the _PodBuilder_ folder. Optionally you can also specify whether the command should or should not print the output to stdout/stderr by passing a bool to the `quiet` key (default: false).
|
332
|
+
|
333
|
+
```json
|
334
|
+
{
|
335
|
+
"pre_actions": {
|
336
|
+
"switch" : { "path": "pre_switch_action.rb", "quiet": true },
|
337
|
+
"build" : { "path": "pre_build_action.rb", "quiet": false }
|
338
|
+
}
|
339
|
+
}
|
340
|
+
```
|
341
|
+
|
342
|
+
**Note:** The build action might be invoked more than once depending on the build strategy that PodBuilder needs to perform.
|
343
|
+
|
344
|
+
|
327
345
|
#### `post_actions`
|
328
346
|
|
329
347
|
Post actions allow to execute custom scripts after a given command (`switch`, `build`) has been performed.
|
@@ -339,6 +357,7 @@ You need to specify a `path` to the executable script which is relative to the _
|
|
339
357
|
}
|
340
358
|
```
|
341
359
|
|
360
|
+
**Note:** The build action might be invoked more than once depending on the build strategy that PodBuilder needs to perform.
|
342
361
|
|
343
362
|
|
344
363
|
# Behind the scenes
|
data/lib/pod_builder/analyze.rb
CHANGED
@@ -52,7 +52,10 @@ module PodBuilder
|
|
52
52
|
|
53
53
|
supported_platforms = analyzer.instance_variable_get("@result").targets.map { |t| t.platform.safe_string_name.downcase }
|
54
54
|
|
55
|
-
|
55
|
+
target_definitions = installer.podfile.target_definitions.values
|
56
|
+
items = all_specs.map { |spec| PodfileItem.new(spec, all_specs, target_definitions, checkout_options, supported_platforms) }.sort_by(&:name)
|
57
|
+
|
58
|
+
return items
|
56
59
|
end
|
57
60
|
end
|
58
61
|
end
|
@@ -114,10 +114,19 @@ module PodBuilder
|
|
114
114
|
podfile_items = podfile_items.map { |t| t.recursive_dependencies(all_buildable_items) }.flatten.uniq
|
115
115
|
|
116
116
|
podfile_content = Podfile.from_podfile_items(podfile_items, analyzer, build_configuration, install_using_frameworks, build_catalyst, podfile_items.first.build_xcframework)
|
117
|
+
|
118
|
+
PodBuilder::safe_rm_rf(Configuration.build_path)
|
119
|
+
FileUtils.mkdir_p(Configuration.build_path)
|
120
|
+
|
121
|
+
init_git(Configuration.build_path) # this is needed to be able to call safe_rm_rf
|
122
|
+
|
123
|
+
Configuration.pre_actions[:build]&.execute()
|
117
124
|
|
118
125
|
install_result += Install.podfile(podfile_content, podfile_items, argument_pods, podfile_items.first.build_configuration)
|
119
126
|
|
120
127
|
FileUtils.rm_f(PodBuilder::basepath("Podfile.lock"))
|
128
|
+
|
129
|
+
Configuration.post_actions[:build]&.execute()
|
121
130
|
end
|
122
131
|
|
123
132
|
install_result.write_prebuilt_info_files
|
@@ -145,9 +154,7 @@ module PodBuilder
|
|
145
154
|
|
146
155
|
if (restore_file_error = restore_file_error) && Configuration.restore_enabled
|
147
156
|
puts "\n\n⚠️ Podfile.restore was found invalid and was overwritten. Error:\n #{restore_file_error}".red
|
148
|
-
end
|
149
|
-
|
150
|
-
Configuration.post_actions[:build]&.execute()
|
157
|
+
end
|
151
158
|
|
152
159
|
puts "\n\n🎉 done!\n".green
|
153
160
|
return 0
|
@@ -155,6 +162,12 @@ module PodBuilder
|
|
155
162
|
|
156
163
|
private
|
157
164
|
|
165
|
+
def self.init_git(path)
|
166
|
+
Dir.chdir(path) do
|
167
|
+
system("git init")
|
168
|
+
end
|
169
|
+
end
|
170
|
+
|
158
171
|
def self.should_build_catalyst(installer)
|
159
172
|
integrate_targets = installer.podfile.installation_options.integrate_targets
|
160
173
|
|
@@ -1,4 +1,5 @@
|
|
1
1
|
require 'pod_builder/core'
|
2
|
+
require 'set'
|
2
3
|
|
3
4
|
module PodBuilder
|
4
5
|
module Command
|
@@ -13,6 +14,8 @@ module PodBuilder
|
|
13
14
|
return -1
|
14
15
|
end
|
15
16
|
|
17
|
+
Configuration.pre_actions[:switch]&.execute()
|
18
|
+
|
16
19
|
pods_not_found = []
|
17
20
|
pod_names_to_switch = []
|
18
21
|
argument_pods.each do |pod|
|
@@ -85,14 +88,16 @@ module PodBuilder
|
|
85
88
|
pod_names_to_switch = pod_names_to_switch.map { |t| t.split("/").first }.uniq
|
86
89
|
dep_pod_names_to_switch.reject { |t| pod_names_to_switch.include?(t) }
|
87
90
|
end
|
91
|
+
|
92
|
+
inhibit_warnings = inhibit_warnings_pods()
|
88
93
|
|
89
94
|
pod_names_to_switch.each do |pod_name_to_switch|
|
90
95
|
development_path = ""
|
91
|
-
|
96
|
+
default_entry = nil
|
92
97
|
|
93
98
|
case OPTIONS[:switch_mode]
|
94
99
|
when "development"
|
95
|
-
development_path = find_podspec(pod_name_to_switch)
|
100
|
+
development_path = find_podspec(pod_name_to_switch)
|
96
101
|
when "prebuilt"
|
97
102
|
podfile_path = PodBuilder::basepath("Podfile.restore")
|
98
103
|
content = File.read(podfile_path)
|
@@ -103,23 +108,15 @@ module PodBuilder
|
|
103
108
|
podfile_path = PodBuilder::basepath("Podfile")
|
104
109
|
content = File.read(podfile_path)
|
105
110
|
|
106
|
-
|
107
|
-
|
108
|
-
stripped_line = line.strip
|
109
|
-
if stripped_line.start_with?("def ") || stripped_line.start_with?("target ")
|
110
|
-
current_section = line.split(" ")[1]
|
111
|
-
next
|
112
|
-
end
|
113
|
-
|
114
|
-
matches = line.gsub("\"", "'").match(/pod '(.*?)'/)
|
115
|
-
if matches&.size == 2
|
111
|
+
content.each_line do |line|
|
112
|
+
if (matches = line.match(/^\s*pod ['|"](.*?)['|"](.*)/)) && matches.size == 3
|
116
113
|
if matches[1].split("/").first == pod_name_to_switch
|
117
|
-
|
114
|
+
default_entry = line
|
118
115
|
end
|
119
116
|
end
|
120
117
|
end
|
121
118
|
|
122
|
-
raise "\n\n'#{pod_name_to_switch}' not found in PodBuilder's Podfile.\n\nYou might need to explictly add:\n\n pod '#{pod_name_to_switch}'\n\nto #{podfile_path}\n".red if
|
119
|
+
raise "\n\n'#{pod_name_to_switch}' not found in PodBuilder's Podfile.\n\nYou might need to explictly add:\n\n pod '#{pod_name_to_switch}'\n\nto #{podfile_path}\n".red if default_entry.nil?
|
123
120
|
end
|
124
121
|
|
125
122
|
if development_path.nil?
|
@@ -134,15 +131,8 @@ module PodBuilder
|
|
134
131
|
content = File.read(podfile_path)
|
135
132
|
|
136
133
|
lines = []
|
137
|
-
current_section = ""
|
138
134
|
content.each_line do |line|
|
139
|
-
|
140
|
-
if stripped_line.start_with?("def ") || stripped_line.start_with?("target ")
|
141
|
-
current_section = line.split(" ")[1]
|
142
|
-
end
|
143
|
-
|
144
|
-
matches = line.gsub("\"", "'").match(/pod '(.*?)'/)
|
145
|
-
if matches&.size == 2
|
135
|
+
if (matches = line.match(/^\s*pod ['|"](.*?)['|"](.*)/)) && matches.size == 3
|
146
136
|
if matches[1].split("/").first == pod_name_to_switch
|
147
137
|
case OPTIONS[:switch_mode]
|
148
138
|
when "prebuilt"
|
@@ -159,6 +149,9 @@ module PodBuilder
|
|
159
149
|
indentation = line.split("pod '").first
|
160
150
|
rel_path = Pathname.new(development_path).relative_path_from(Pathname.new(PodBuilder::project_path)).to_s
|
161
151
|
development_line = "#{indentation}pod '#{matches[1]}', :path => '#{rel_path}'\n"
|
152
|
+
if inhibit_warnings.include?(matches[1])
|
153
|
+
development_line = development_line.chomp("\n") + ", :inhibit_warnings => true\n"
|
154
|
+
end
|
162
155
|
if line.include?("# pb<") && marker = line.split("# pb<").last
|
163
156
|
development_line = development_line.chomp("\n") + " # pb<#{marker}"
|
164
157
|
end
|
@@ -166,7 +159,8 @@ module PodBuilder
|
|
166
159
|
lines.append(development_line)
|
167
160
|
next
|
168
161
|
when "default"
|
169
|
-
if default_line =
|
162
|
+
if default_line = default_entry
|
163
|
+
# default_line is already extracted from PodBuilder's Podfile and already includes :inhibit_warnings
|
170
164
|
if line.include?("# pb<") && marker = line.split("# pb<").last
|
171
165
|
default_line = default_line.chomp("\n") + " # pb<#{marker}"
|
172
166
|
end
|
@@ -180,8 +174,6 @@ module PodBuilder
|
|
180
174
|
|
181
175
|
lines.append(default_line)
|
182
176
|
next
|
183
|
-
elsif
|
184
|
-
raise "\n\nLine for pod '#{matches[1]}' in section '#{current_section}' not found in PodBuilder's Podfile".red
|
185
177
|
end
|
186
178
|
else
|
187
179
|
raise "\n\nUnsupported mode '#{OPTIONS[:switch_mode]}'".red
|
@@ -208,6 +200,26 @@ module PodBuilder
|
|
208
200
|
end
|
209
201
|
|
210
202
|
private
|
203
|
+
|
204
|
+
def self.inhibit_warnings_pods
|
205
|
+
ret = Set.new
|
206
|
+
|
207
|
+
podfile_path = PodBuilder::basepath("Podfile")
|
208
|
+
content = File.read(podfile_path)
|
209
|
+
|
210
|
+
content.each_line do |line|
|
211
|
+
unless (name_match = line.match(/^\s*pod ['|"](.*?)['|"](.*)/)) && name_match.size == 3
|
212
|
+
next
|
213
|
+
end
|
214
|
+
|
215
|
+
if line.gsub(" ", "").include?(":inhibit_warnings=>true")
|
216
|
+
pod_name = name_match[1]
|
217
|
+
ret.add?(pod_name)
|
218
|
+
end
|
219
|
+
end
|
220
|
+
|
221
|
+
return ret
|
222
|
+
end
|
211
223
|
|
212
224
|
def self.is_absolute_path(path)
|
213
225
|
return ["~", "/"].any? { |t| path.start_with?(t) }
|
@@ -223,11 +235,28 @@ module PodBuilder
|
|
223
235
|
if Pathname.new(path).relative?
|
224
236
|
path = PodBuilder::basepath(path)
|
225
237
|
end
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
if
|
230
|
-
|
238
|
+
podspec_paths = Dir.glob(File.expand_path("#{path}/**/#{podname}*.podspec*"))
|
239
|
+
podspec_paths.select! { |t| !t.include?("/Local Podspecs/") }
|
240
|
+
podspec_paths.select! { |t| Dir.glob(File.join(File.dirname(t), "*")).count > 1 } # exclude podspec folder (which has one file per folder)
|
241
|
+
if podspec_paths.count > 1
|
242
|
+
if match_name_path = podspec_paths.find{ |t| File.basename(t, ".*") == podname }
|
243
|
+
podspec_path = Pathname.new(match_name_path).dirname.to_s
|
244
|
+
else
|
245
|
+
# Try parsing podspec
|
246
|
+
podspec_paths.each do |path|
|
247
|
+
content = File.read(path).gsub("\"", "'").gsub(" ", "")
|
248
|
+
if content.include?("name='#{podname}'")
|
249
|
+
podspec_path = path
|
250
|
+
end
|
251
|
+
unless podspec_path.nil?
|
252
|
+
break
|
253
|
+
end
|
254
|
+
end
|
255
|
+
end
|
256
|
+
|
257
|
+
break
|
258
|
+
elsif podspec_paths.count == 1
|
259
|
+
podspec_path = Pathname.new(podspec_paths.first).dirname.to_s
|
231
260
|
break
|
232
261
|
end
|
233
262
|
end
|
@@ -75,6 +75,7 @@ module PodBuilder
|
|
75
75
|
attr_accessor :build_xcframeworks_all
|
76
76
|
attr_accessor :build_xcframeworks_include
|
77
77
|
attr_accessor :build_xcframeworks_exclude
|
78
|
+
attr_accessor :pre_actions
|
78
79
|
attr_accessor :post_actions
|
79
80
|
end
|
80
81
|
|
@@ -113,6 +114,7 @@ module PodBuilder
|
|
113
114
|
@build_xcframeworks_include = []
|
114
115
|
@build_xcframeworks_exclude = []
|
115
116
|
|
117
|
+
@pre_actions = {}
|
116
118
|
@post_actions = {}
|
117
119
|
|
118
120
|
def self.check_inited
|
@@ -232,9 +234,14 @@ module PodBuilder
|
|
232
234
|
Configuration.build_xcframeworks_exclude = value
|
233
235
|
end
|
234
236
|
end
|
237
|
+
if value = json["pre_actions"]
|
238
|
+
if value.is_a?(Hash)
|
239
|
+
Configuration.pre_actions = PodBuilder::Actions.load(value)
|
240
|
+
end
|
241
|
+
end
|
235
242
|
if value = json["post_actions"]
|
236
243
|
if value.is_a?(Hash)
|
237
|
-
Configuration.post_actions = PodBuilder::
|
244
|
+
Configuration.post_actions = PodBuilder::Actions.load(value)
|
238
245
|
end
|
239
246
|
end
|
240
247
|
|
data/lib/pod_builder/core.rb
CHANGED
data/lib/pod_builder/install.rb
CHANGED
@@ -140,12 +140,7 @@ module PodBuilder
|
|
140
140
|
class Install
|
141
141
|
# This method will generate prebuilt data by building from "/tmp/pod_builder/Podfile"
|
142
142
|
def self.podfile(podfile_content, podfile_items, argument_pods, build_configuration)
|
143
|
-
puts "Preparing build Podfile".yellow
|
144
|
-
|
145
|
-
PodBuilder::safe_rm_rf(Configuration.build_path)
|
146
|
-
FileUtils.mkdir_p(Configuration.build_path)
|
147
|
-
|
148
|
-
init_git(Configuration.build_path) # this is needed to be able to call safe_rm_rf
|
143
|
+
puts "Preparing build Podfile".yellow
|
149
144
|
|
150
145
|
podfile_content = copy_development_pods_source_code(podfile_content, podfile_items)
|
151
146
|
|
@@ -452,13 +447,7 @@ module PodBuilder
|
|
452
447
|
File.write(gitattributes_path, expected_attributes, mode: 'a')
|
453
448
|
end
|
454
449
|
end
|
455
|
-
|
456
|
-
def self.init_git(path)
|
457
|
-
Dir.chdir(path) do
|
458
|
-
system("git init")
|
459
|
-
end
|
460
|
-
end
|
461
|
-
|
450
|
+
|
462
451
|
def self.build_folder_hash_in_prebuilt_info_file(podfile_item)
|
463
452
|
prebuilt_info_path = PodBuilder::prebuiltpath(File.join(podfile_item.root_name, Configuration.prebuilt_info_filename))
|
464
453
|
|
data/lib/pod_builder/podfile.rb
CHANGED
@@ -591,8 +591,10 @@ module PodBuilder
|
|
591
591
|
if matches&.size == 4 && !stripped_line.start_with?("#")
|
592
592
|
path = matches[2]
|
593
593
|
|
594
|
+
file_exists = File.exist?(File.expand_path(path))
|
595
|
+
|
594
596
|
is_absolute = ["~", "/"].include?(path[0])
|
595
|
-
|
597
|
+
if is_absolute || !file_exists
|
596
598
|
podfile_lines.push(line)
|
597
599
|
next
|
598
600
|
end
|
@@ -142,6 +142,10 @@ module PodBuilder
|
|
142
142
|
# @return [Bool] True if it's a pod that doesn't provide source code (is already shipped as a prebuilt pod)
|
143
143
|
#
|
144
144
|
attr_accessor :is_prebuilt
|
145
|
+
|
146
|
+
# @return [Bool] True if warnings should be inhibited for the pod
|
147
|
+
#
|
148
|
+
attr_accessor :inhibit_warnings
|
145
149
|
|
146
150
|
# Initialize a new instance
|
147
151
|
#
|
@@ -149,7 +153,7 @@ module PodBuilder
|
|
149
153
|
#
|
150
154
|
# @param [Hash] checkout_options
|
151
155
|
#
|
152
|
-
def initialize(spec, all_specs, checkout_options, supported_platforms)
|
156
|
+
def initialize(spec, all_specs, target_definitions, checkout_options, supported_platforms)
|
153
157
|
@name = spec.name
|
154
158
|
@root_name = spec.name.split("/").first
|
155
159
|
|
@@ -264,6 +268,7 @@ module PodBuilder
|
|
264
268
|
@build_xcframework = build_as_xcframework
|
265
269
|
|
266
270
|
@is_prebuilt = extract_is_prebuilt(spec, all_specs, checkout_options, supported_platforms)
|
271
|
+
@inhibit_warnings = target_definitions.any? { |t| t.inhibits_warnings_for_pod?(@name) }
|
267
272
|
end
|
268
273
|
|
269
274
|
def pod_specification(all_poditems, parent_spec = nil)
|
@@ -370,6 +375,10 @@ module PodBuilder
|
|
370
375
|
def entry(include_version = true, include_pb_entry = true)
|
371
376
|
e = "pod '#{@name}'"
|
372
377
|
|
378
|
+
if !is_prebuilt && inhibit_warnings
|
379
|
+
e += ", :inhibit_warnings => true"
|
380
|
+
end
|
381
|
+
|
373
382
|
unless include_version
|
374
383
|
return e
|
375
384
|
end
|
@@ -478,7 +487,7 @@ module PodBuilder
|
|
478
487
|
if default_subspecs != nil && default_subspecs.count > 0
|
479
488
|
default_subspecs.each do |default_subspec_name|
|
480
489
|
if (default_spec = all_specs.detect { |t| t.name == "#{root_name}/#{default_subspec_name}" })
|
481
|
-
default_item = PodfileItem.new(default_spec, all_specs, checkout_options, supported_platforms)
|
490
|
+
default_item = PodfileItem.new(default_spec, all_specs, [], checkout_options, supported_platforms)
|
482
491
|
if default_item.is_prebuilt
|
483
492
|
return true
|
484
493
|
end
|
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:
|
4
|
+
version: 4.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: 2021-
|
11
|
+
date: 2021-10-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -181,6 +181,7 @@ files:
|
|
181
181
|
- bin/setup
|
182
182
|
- exe/pod_builder
|
183
183
|
- lib/core_ext/string.rb
|
184
|
+
- lib/pod_builder/actions.rb
|
184
185
|
- lib/pod_builder/analyze.rb
|
185
186
|
- lib/pod_builder/analyzer.rb
|
186
187
|
- lib/pod_builder/command.rb
|
@@ -208,7 +209,6 @@ files:
|
|
208
209
|
- lib/pod_builder/podfile_cp.rb
|
209
210
|
- lib/pod_builder/podfile_item.rb
|
210
211
|
- lib/pod_builder/podspec.rb
|
211
|
-
- lib/pod_builder/post_actions.rb
|
212
212
|
- lib/pod_builder/rome/post_install.rb
|
213
213
|
- lib/pod_builder/rome/pre_install.rb
|
214
214
|
- lib/pod_builder/templates/build_podfile.template
|
@@ -234,7 +234,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
234
234
|
- !ruby/object:Gem::Version
|
235
235
|
version: '0'
|
236
236
|
requirements: []
|
237
|
-
rubygems_version: 3.
|
237
|
+
rubygems_version: 3.1.2
|
238
238
|
signing_key:
|
239
239
|
specification_version: 4
|
240
240
|
summary: Prebuild CocoaPods pods
|