pod-builder 3.5.0 → 4.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +19 -0
- data/exe/pod_builder +9 -2
- 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/clean.rb +15 -4
- data/lib/pod_builder/command/install_sources.rb +5 -3
- data/lib/pod_builder/command/switch.rb +37 -25
- data/lib/pod_builder/configuration.rb +9 -2
- data/lib/pod_builder/core.rb +1 -1
- data/lib/pod_builder/install.rb +20 -29
- data/lib/pod_builder/podfile.rb +60 -5
- data/lib/pod_builder/podfile_item.rb +11 -2
- data/lib/pod_builder/podspec.rb +1 -1
- data/lib/pod_builder/rome/post_install.rb +34 -29
- data/lib/pod_builder/version.rb +1 -2
- metadata +7 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e63869c0a451bb9da5d5ecb974125bb7bc7e30a959d4f76f513734dc4cff8d10
|
4
|
+
data.tar.gz: be4e23baac9d74eadc8ef402b6fbc388598dedaaab2bae2f4fdeebe9e96c79f1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 93cee03862ea2a53db8a181b2a37e245618e4c0945322f4bca4e37e1db377daab61cc18ef9057d85ce61f59749f85e33cd14f50fa2438d676b7f842910f4f908
|
7
|
+
data.tar.gz: 8279100eacb50a378422e64595437dc1246d83ac62b49f3bdb5f92e325aa76b1a5220795271880a8b9b5ccf7720d5cd67ccb99d2f0f6d3a882e69962eb3b8baa
|
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/exe/pod_builder
CHANGED
@@ -242,11 +242,18 @@ Options:
|
|
242
242
|
opts.banner = "
|
243
243
|
Usage:
|
244
244
|
|
245
|
-
$ pod_builder install_sources
|
245
|
+
$ pod_builder install_sources [OPTIONS] <PODNAME...>
|
246
246
|
|
247
247
|
Install source of prebuilt pods to be able to step into and debug prebuilt's code.
|
248
248
|
|
249
|
-
|
249
|
+
Options:
|
250
|
+
"
|
251
|
+
opts.on("-a", "--all", "Install all available sources") do |o|
|
252
|
+
OPTIONS[:all] = o
|
253
|
+
end
|
254
|
+
opts.on("-s", "--no-stdin", "Never request interaction with sdtin (e.g. in CI environment)") do |o|
|
255
|
+
OPTIONS[:no_stdin_available] = o
|
256
|
+
end
|
250
257
|
end,
|
251
258
|
:call => [
|
252
259
|
PodBuilder::Command::InstallSources
|
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
|
|
@@ -26,7 +26,15 @@ module PodBuilder
|
|
26
26
|
Dir.glob(PodBuilder::prebuiltpath("*")).each do |path|
|
27
27
|
basename = File.basename(path)
|
28
28
|
unless root_names.include?(basename)
|
29
|
-
puts "
|
29
|
+
puts "Cleaning up `#{basename}`, no longer found among dependencies".blue
|
30
|
+
PodBuilder::safe_rm_rf(path)
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
Dir.glob(PodBuilder::prebuiltpath("*")).each do |path|
|
35
|
+
basename = File.basename(path)
|
36
|
+
if (Dir.glob("#{path}/**/*.framework").count + Dir.glob("#{path}/**/*.a").count) == 0
|
37
|
+
puts "Cleaning up `#{basename}`, no prebuilt items found".blue
|
30
38
|
PodBuilder::safe_rm_rf(path)
|
31
39
|
end
|
32
40
|
end
|
@@ -37,11 +45,10 @@ module PodBuilder
|
|
37
45
|
dsym_basename = File.basename(path, ".*")
|
38
46
|
dsym_basename.gsub!(/\.framework$/, "")
|
39
47
|
unless module_names.include?(dsym_basename)
|
40
|
-
puts "
|
48
|
+
puts "Cleaning up `#{dsym_basename}`, no longer found among dependencies".blue
|
41
49
|
PodBuilder::safe_rm_rf(path)
|
42
50
|
end
|
43
51
|
end
|
44
|
-
|
45
52
|
end
|
46
53
|
|
47
54
|
def self.install_sources(buildable_items)
|
@@ -64,8 +71,12 @@ module PodBuilder
|
|
64
71
|
end
|
65
72
|
|
66
73
|
paths_to_delete.flatten.each do |path|
|
74
|
+
if OPTIONS.has_key?(:no_stdin_available)
|
75
|
+
PodBuilder::safe_rm_rf(path)
|
76
|
+
next
|
77
|
+
end
|
67
78
|
confirm = ask("#{path} unused.\nDelete it? [Y/N] ") { |yn| yn.limit = 1, yn.validate = /[yn]/i }
|
68
|
-
if confirm.downcase == 'y'
|
79
|
+
if confirm.downcase == 'y'
|
69
80
|
PodBuilder::safe_rm_rf(path)
|
70
81
|
end
|
71
82
|
end
|
@@ -11,6 +11,8 @@ module PodBuilder
|
|
11
11
|
|
12
12
|
PodBuilder::prepare_basepath
|
13
13
|
|
14
|
+
argument_pods = ARGV.dup
|
15
|
+
|
14
16
|
install_update_repo = OPTIONS.fetch(:update_repos, true)
|
15
17
|
installer, analyzer = Analyze.installer_at(PodBuilder::basepath, install_update_repo)
|
16
18
|
podfile_items = Analyze.podfile_items(installer, analyzer).select { |x| !x.is_prebuilt }
|
@@ -20,9 +22,9 @@ module PodBuilder
|
|
20
22
|
framework_files = Dir.glob("#{base_path}/**/*.framework")
|
21
23
|
|
22
24
|
framework_files.each do |path|
|
23
|
-
|
25
|
+
next if !OPTIONS.has_key?(:all) && !argument_pods.include?(File.basename(path, ".*"))
|
24
26
|
|
25
|
-
if podfile_spec = podfile_items.detect { |x|
|
27
|
+
if podfile_spec = podfile_items.detect { |x| x.root_name == File.basename(path, ".*") }
|
26
28
|
update_repo(podfile_spec)
|
27
29
|
end
|
28
30
|
end
|
@@ -45,8 +47,8 @@ module PodBuilder
|
|
45
47
|
dest_path = PodBuilder::basepath("Sources")
|
46
48
|
FileUtils.mkdir_p(dest_path)
|
47
49
|
|
50
|
+
repo_dir = File.join(dest_path, spec.podspec_name)
|
48
51
|
Dir.chdir(dest_path) do
|
49
|
-
repo_dir = File.join(dest_path, spec.podspec_name)
|
50
52
|
if !File.directory?(repo_dir)
|
51
53
|
raise "\n\nFailed cloning #{spec.name}".red if !system("git clone #{spec.repo} #{spec.podspec_name}")
|
52
54
|
end
|
@@ -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) }
|
@@ -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
|
|
@@ -87,7 +88,7 @@ module PodBuilder
|
|
87
88
|
@library_evolution_support = false
|
88
89
|
@base_path = "PodBuilder" # Not nice. This value is used only for initial initization. Once config is loaded it will be an absolute path. FIXME
|
89
90
|
@skip_licenses = []
|
90
|
-
@skip_pods = ["GoogleMaps", "React-RCTFabric", "React-Core", "React-CoreModules"] # Not including React-RCTNetwork might loose some debug warnings
|
91
|
+
@skip_pods = ["GoogleMaps", "React-RCTFabric", "React-Core", "React-CoreModules", "FBReactNativeSpec", "fmt", "RCT-Folly", "React-jsi"] # Not including React-RCTNetwork might loose some debug warnings
|
91
92
|
@force_prebuild_pods = []
|
92
93
|
@license_filename = "Pods-acknowledgements"
|
93
94
|
@development_pods_paths = []
|
@@ -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,18 +140,17 @@ 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
|
|
152
147
|
podfile_content = Podfile.update_path_entries(podfile_content, Install.method(:podfile_path_transform))
|
153
148
|
podfile_content = Podfile.update_project_entries(podfile_content, Install.method(:podfile_path_transform))
|
154
149
|
podfile_content = Podfile.update_require_entries(podfile_content, Install.method(:podfile_path_transform))
|
150
|
+
|
151
|
+
if Configuration.react_native_project
|
152
|
+
podfile_content = Podfile.prepare_react_native_compilation_workarounds(podfile_content)
|
153
|
+
end
|
155
154
|
|
156
155
|
podfile_path = File.join(Configuration.build_path, "Podfile")
|
157
156
|
File.write(podfile_path, podfile_content)
|
@@ -227,7 +226,7 @@ module PodBuilder
|
|
227
226
|
data["swift_version"] = swift_version
|
228
227
|
end
|
229
228
|
|
230
|
-
specs = podfile_items.select { |x| x.
|
229
|
+
specs = podfile_items.select { |x| x.root_name == podfile_item.root_name }
|
231
230
|
subspecs_deps = specs.map(&:dependency_names).flatten
|
232
231
|
subspec_self_deps = subspecs_deps.select { |x| x.start_with?("#{prebuilt_name}/") }
|
233
232
|
data["specs"] = (specs.map(&:name) + subspec_self_deps).uniq
|
@@ -242,6 +241,7 @@ module PodBuilder
|
|
242
241
|
|
243
242
|
return ret
|
244
243
|
end
|
244
|
+
|
245
245
|
private
|
246
246
|
|
247
247
|
def self.license_specifiers
|
@@ -391,32 +391,29 @@ module PodBuilder
|
|
391
391
|
|
392
392
|
non_prebuilt_items = podfile_items.reject(&:is_prebuilt)
|
393
393
|
|
394
|
-
|
395
|
-
|
396
|
-
|
397
|
-
|
398
|
-
|
394
|
+
non_prebuilt_items.reject! { |item|
|
395
|
+
[item.module_name, item.root_name]
|
396
|
+
.map { |t| PodBuilder::buildpath_prebuiltpath(t) }
|
397
|
+
.select { |t| File.directory?(t) }
|
398
|
+
.all? { |t| Dir.empty?(t) } # When using prebuilt items we end up with empty folders
|
399
399
|
}
|
400
400
|
|
401
|
-
|
402
|
-
root_name = pod_name.split("/").first
|
403
|
-
|
401
|
+
non_prebuilt_items.each do |item|
|
404
402
|
# Remove existing files
|
405
|
-
items_to_delete = Dir.glob("#{PodBuilder::prebuiltpath(root_name)}/**/*")
|
403
|
+
items_to_delete = Dir.glob("#{PodBuilder::prebuiltpath(item.root_name)}/**/*")
|
406
404
|
items_to_delete.each { |t| PodBuilder::safe_rm_rf(t) }
|
407
405
|
end
|
408
406
|
|
409
407
|
# Now copy
|
410
|
-
|
411
|
-
|
412
|
-
source_path = PodBuilder::buildpath_prebuiltpath(root_name)
|
408
|
+
non_prebuilt_items.each do |item|
|
409
|
+
source_path = PodBuilder::buildpath_prebuiltpath(item.module_name)
|
413
410
|
|
414
411
|
unless File.directory?(source_path)
|
415
|
-
puts "Prebuilt items for #{
|
412
|
+
puts "Prebuilt items for #{item.root_name} not found".blue
|
416
413
|
next
|
417
414
|
end
|
418
415
|
|
419
|
-
if podfile_item = podfile_items.detect { |t| t.root_name ==
|
416
|
+
if podfile_item = podfile_items.detect { |t| t.root_name == item.root_name }
|
420
417
|
if Dir.glob("#{source_path}/**/Modules/**/*.swiftmodule/*.swiftinterface").count > 0
|
421
418
|
# We can safely remove .swiftmodule if .swiftinterface exists
|
422
419
|
swiftmodule_files = Dir.glob("#{source_path}/**/Modules/**/*.swiftmodule/*.swiftmodule")
|
@@ -432,7 +429,7 @@ module PodBuilder
|
|
432
429
|
project_folder.select { |t| File.directory?(t) && Dir.empty?(t) }.each { |t| PodBuilder::safe_rm_rf(t) }
|
433
430
|
|
434
431
|
unless Dir.glob("#{source_path}/**/*").select { |t| File.file?(t) }.empty?
|
435
|
-
destination_folder = PodBuilder::prebuiltpath(root_name)
|
432
|
+
destination_folder = PodBuilder::prebuiltpath(item.root_name)
|
436
433
|
FileUtils.mkdir_p(destination_folder)
|
437
434
|
FileUtils.cp_r("#{source_path}/.", destination_folder)
|
438
435
|
end
|
@@ -452,13 +449,7 @@ module PodBuilder
|
|
452
449
|
File.write(gitattributes_path, expected_attributes, mode: 'a')
|
453
450
|
end
|
454
451
|
end
|
455
|
-
|
456
|
-
def self.init_git(path)
|
457
|
-
Dir.chdir(path) do
|
458
|
-
system("git init")
|
459
|
-
end
|
460
|
-
end
|
461
|
-
|
452
|
+
|
462
453
|
def self.build_folder_hash_in_prebuilt_info_file(podfile_item)
|
463
454
|
prebuilt_info_path = PodBuilder::prebuiltpath(File.join(podfile_item.root_name, Configuration.prebuilt_info_filename))
|
464
455
|
|
data/lib/pod_builder/podfile.rb
CHANGED
@@ -44,7 +44,11 @@ module PodBuilder
|
|
44
44
|
# https://thi.imhttps://thi.im/posts/swift-serialize-debugging-options/
|
45
45
|
build_settings["SWIFT_SERIALIZE_DEBUGGING_OPTIONS"] = "NO"
|
46
46
|
|
47
|
-
|
47
|
+
if Configuration.react_native_project && item.name.include?("Folly")
|
48
|
+
build_settings["IPHONEOS_DEPLOYMENT_TARGET"] = "9.0" # https://github.com/facebook/flipper/issues/834#issuecomment-899725463
|
49
|
+
else
|
50
|
+
build_settings["IPHONEOS_DEPLOYMENT_TARGET"] = platform.deployment_target.version # Fix compilation warnings on Xcode 12
|
51
|
+
end
|
48
52
|
|
49
53
|
# Ignore deprecation warnings
|
50
54
|
build_settings["GCC_WARN_ABOUT_DEPRECATED_FUNCTIONS"] = "NO"
|
@@ -266,6 +270,11 @@ module PodBuilder
|
|
266
270
|
|
267
271
|
Dir.chdir(PodBuilder::project_path) do
|
268
272
|
bundler_prefix = Configuration.use_bundler ? "bundle exec " : ""
|
273
|
+
|
274
|
+
if Configuration.react_native_project
|
275
|
+
system("#{bundler_prefix}pod deintegrate;")
|
276
|
+
end
|
277
|
+
|
269
278
|
system("#{bundler_prefix}pod install;")
|
270
279
|
end
|
271
280
|
end
|
@@ -591,8 +600,10 @@ module PodBuilder
|
|
591
600
|
if matches&.size == 4 && !stripped_line.start_with?("#")
|
592
601
|
path = matches[2]
|
593
602
|
|
603
|
+
file_exists = [path, "#{path}.rb"].any? { |t| File.exist?(File.expand_path(t)) }
|
604
|
+
|
594
605
|
is_absolute = ["~", "/"].include?(path[0])
|
595
|
-
|
606
|
+
if is_absolute || !file_exists
|
596
607
|
podfile_lines.push(line)
|
597
608
|
next
|
598
609
|
end
|
@@ -639,17 +650,32 @@ module PodBuilder
|
|
639
650
|
end
|
640
651
|
|
641
652
|
def self.prepare_for_react_native_rn_pods_file(podfile_content)
|
653
|
+
use_react_native_open_found = false
|
654
|
+
enable_hermes = false
|
655
|
+
indentation = ""
|
656
|
+
|
642
657
|
lines = []
|
643
658
|
podfile_content.each_line do |line|
|
644
|
-
if line.include?("use_react_native!")
|
659
|
+
if line.include?("use_react_native!(")
|
660
|
+
use_react_native_open_found = true
|
661
|
+
|
645
662
|
matches = line.match(/(\s*)/)
|
646
663
|
unless matches&.size == 2
|
647
664
|
return podfile_content
|
648
665
|
end
|
649
|
-
|
650
666
|
indentation = matches[1]
|
651
|
-
|
667
|
+
end
|
668
|
+
|
669
|
+
if use_react_native_open_found
|
670
|
+
if line.gsub(" ", "").include?(":hermes_enabled=>true")
|
671
|
+
enable_hermes = true
|
672
|
+
end
|
652
673
|
lines.push("#{indentation}# #{line.strip} # pb removed\n")
|
674
|
+
|
675
|
+
if line.strip.end_with?(")")
|
676
|
+
use_react_native_open_found = false
|
677
|
+
lines.push("#{indentation}use_react_native!(:path => rn_config[\"reactNativePath\"], :hermes_enabled => #{enable_hermes ? "true" : "false"}) # pb added\n")
|
678
|
+
end
|
653
679
|
else
|
654
680
|
lines.push(line)
|
655
681
|
end
|
@@ -698,5 +724,34 @@ module PodBuilder
|
|
698
724
|
|
699
725
|
return podfile_content
|
700
726
|
end
|
727
|
+
|
728
|
+
def self.prepare_react_native_compilation_workarounds(podfile_content)
|
729
|
+
return podfile_content + """
|
730
|
+
def prepare_rn_compilation_libevent
|
731
|
+
path = \"Pods/libevent/include/event.h\"
|
732
|
+
replace(path, \"#include <evutil.h>\", \"// #include <evutil.h>\")
|
733
|
+
end
|
734
|
+
|
735
|
+
def prepare_rn_flipper_module_redefinition
|
736
|
+
module_maps = [\"Pods/Target Support Files/Flipper-Fmt/Flipper-Fmt.modulemap\", \"Pods/Target Support Files/fmt/fmt.modulemap\"]
|
737
|
+
if module_maps.all? { |t| File.exist?(t) }
|
738
|
+
commented_module = \"/* \" + File.read(module_maps[0]) + \" */\"
|
739
|
+
File.write(module_maps[0], commented_module)
|
740
|
+
end
|
741
|
+
end
|
742
|
+
|
743
|
+
def replace(path, find, replace)
|
744
|
+
if File.exist?(path)
|
745
|
+
content = File.read(path).gsub(find, replace)
|
746
|
+
File.write(path, content)
|
747
|
+
end
|
748
|
+
end
|
749
|
+
|
750
|
+
post_install do |installer|
|
751
|
+
prepare_rn_compilation_libevent()
|
752
|
+
prepare_rn_flipper_module_redefinition()
|
753
|
+
end
|
754
|
+
"""
|
755
|
+
end
|
701
756
|
end
|
702
757
|
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/podspec.rb
CHANGED
@@ -242,7 +242,7 @@ module PodBuilder
|
|
242
242
|
podspec += " p1.license = { :type => '#{item.license}' }\n"
|
243
243
|
|
244
244
|
podspec += "\n"
|
245
|
-
podspec += " p1.#{platform.safe_string_name.downcase}.deployment_target
|
245
|
+
podspec += " p1.#{platform.safe_string_name.downcase}.deployment_target = '#{platform.deployment_target.version}'\n"
|
246
246
|
podspec += "\n"
|
247
247
|
|
248
248
|
main_keys, valid = generate_spec_keys_for(item, item.root_name, all_buildable_items, install_using_frameworks)
|
@@ -284,6 +284,34 @@ module PodBuilder
|
|
284
284
|
end
|
285
285
|
end
|
286
286
|
|
287
|
+
def self.copy_resources_and_vendored_items(installer_context, uses_frameworks, base_destination, sandbox)
|
288
|
+
installer_context.umbrella_targets.each do |umbrella|
|
289
|
+
umbrella.specs.each do |spec|
|
290
|
+
root_name = spec.name.split("/").first
|
291
|
+
|
292
|
+
if uses_frameworks
|
293
|
+
destination = File.join(base_destination, root_name)
|
294
|
+
else
|
295
|
+
destination = File.join(base_destination, root_name, root_name)
|
296
|
+
end
|
297
|
+
# Make sure the device target overwrites anything in the simulator build, otherwise iTunesConnect
|
298
|
+
# can get upset about Info.plist containing references to the simulator SDK
|
299
|
+
files = Pathname.glob("build/#{root_name}/*").reject { |f| f.to_s =~ /Pods[^.]+\.framework/ }
|
300
|
+
|
301
|
+
consumer = spec.consumer(umbrella.platform_name)
|
302
|
+
file_accessor = Pod::Sandbox::FileAccessor.new(sandbox.pod_dir(spec.root.name), consumer)
|
303
|
+
files += file_accessor.vendored_libraries
|
304
|
+
files += file_accessor.vendored_frameworks
|
305
|
+
files += file_accessor.resources
|
306
|
+
|
307
|
+
FileUtils.mkdir_p(destination)
|
308
|
+
files.each do |file|
|
309
|
+
FileUtils.cp_r(file, destination)
|
310
|
+
end
|
311
|
+
end
|
312
|
+
end
|
313
|
+
end
|
314
|
+
|
287
315
|
Pod::HooksManager.register('podbuilder-rome', :post_install) do |installer_context, user_options|
|
288
316
|
enable_dsym = user_options.fetch('dsym', true)
|
289
317
|
configuration = user_options.fetch('configuration', 'Debug')
|
@@ -303,8 +331,9 @@ Pod::HooksManager.register('podbuilder-rome', :post_install) do |installer_conte
|
|
303
331
|
|
304
332
|
build_dir = sandbox_root.parent + 'build'
|
305
333
|
base_destination = sandbox_root.parent + 'Prebuilt'
|
306
|
-
|
334
|
+
|
307
335
|
build_dir.rmtree if build_dir.directory?
|
336
|
+
base_destination.rmtree if base_destination.directory?
|
308
337
|
|
309
338
|
targets = installer_context.umbrella_targets.select { |t| t.specs.any? }
|
310
339
|
raise "\n\nUnsupported target count\n".red unless targets.count == 1
|
@@ -367,6 +396,8 @@ Pod::HooksManager.register('podbuilder-rome', :post_install) do |installer_conte
|
|
367
396
|
|
368
397
|
built_count = built_items.count
|
369
398
|
Pod::UI.puts "Built #{built_count} #{'item'.pluralize(built_count)}"
|
399
|
+
|
400
|
+
copy_resources_and_vendored_items(installer_context, true, base_destination, sandbox)
|
370
401
|
else
|
371
402
|
case [target.platform_name, uses_frameworks]
|
372
403
|
when [:ios, true] then PodBuilder::build_for_iosish_platform_framework(sandbox, build_dir, target, 'iphoneos', 'iphonesimulator', configuration, PodBuilder::Configuration.deterministic_build)
|
@@ -383,35 +414,9 @@ Pod::HooksManager.register('podbuilder-rome', :post_install) do |installer_conte
|
|
383
414
|
|
384
415
|
specs = installer_context.umbrella_targets.map { |t| t.specs.map(&:name) }.flatten.map { |t| t.split("/").first }.uniq
|
385
416
|
built_count = Dir["#{build_dir}/*"].select { |t| specs.include?(File.basename(t)) }.count
|
386
|
-
Pod::UI.puts "Built #{built_count} #{'item'.pluralize(built_count)}, copying..."
|
417
|
+
Pod::UI.puts "Built #{built_count} #{'item'.pluralize(built_count)}, copying..."
|
387
418
|
|
388
|
-
|
389
|
-
|
390
|
-
installer_context.umbrella_targets.each do |umbrella|
|
391
|
-
umbrella.specs.each do |spec|
|
392
|
-
root_name = spec.name.split("/").first
|
393
|
-
|
394
|
-
if uses_frameworks
|
395
|
-
destination = File.join(base_destination, root_name)
|
396
|
-
else
|
397
|
-
destination = File.join(base_destination, root_name, root_name)
|
398
|
-
end
|
399
|
-
# Make sure the device target overwrites anything in the simulator build, otherwise iTunesConnect
|
400
|
-
# can get upset about Info.plist containing references to the simulator SDK
|
401
|
-
files = Pathname.glob("build/#{root_name}/*").reject { |f| f.to_s =~ /Pods[^.]+\.framework/ }
|
402
|
-
|
403
|
-
consumer = spec.consumer(umbrella.platform_name)
|
404
|
-
file_accessor = Pod::Sandbox::FileAccessor.new(sandbox.pod_dir(spec.root.name), consumer)
|
405
|
-
files += file_accessor.vendored_libraries
|
406
|
-
files += file_accessor.vendored_frameworks
|
407
|
-
files += file_accessor.resources
|
408
|
-
|
409
|
-
FileUtils.mkdir_p(destination)
|
410
|
-
files.each do |file|
|
411
|
-
FileUtils.cp_r(file, destination)
|
412
|
-
end
|
413
|
-
end
|
414
|
-
end
|
419
|
+
copy_resources_and_vendored_items(installer_context, uses_frameworks, base_destination, sandbox)
|
415
420
|
|
416
421
|
# Depending on the resource it may happen that it is present twice, both in the .framework and in the parent folder
|
417
422
|
Dir.glob("#{base_destination}/*") do |path|
|
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: 3.
|
4
|
+
version: 4.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tomas Camin
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-02-01 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
|
@@ -219,7 +219,7 @@ homepage: https://github.com/Subito-it/PodBuilder
|
|
219
219
|
licenses:
|
220
220
|
- Apache-2.0
|
221
221
|
metadata: {}
|
222
|
-
post_install_message:
|
222
|
+
post_install_message:
|
223
223
|
rdoc_options: []
|
224
224
|
require_paths:
|
225
225
|
- lib
|
@@ -234,8 +234,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
234
234
|
- !ruby/object:Gem::Version
|
235
235
|
version: '0'
|
236
236
|
requirements: []
|
237
|
-
rubygems_version: 3.
|
238
|
-
signing_key:
|
237
|
+
rubygems_version: 3.2.32
|
238
|
+
signing_key:
|
239
239
|
specification_version: 4
|
240
240
|
summary: Prebuild CocoaPods pods
|
241
241
|
test_files: []
|