pod-builder 5.1.1 → 5.1.2
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/Gemfile +1 -1
- data/exe/pod_builder +105 -77
- data/lib/pod_builder/command/build.rb +41 -41
- data/lib/pod_builder/command/build_swiftmodules.rb +123 -0
- data/lib/pod_builder/command/init.rb +16 -16
- data/lib/pod_builder/command.rb +16 -15
- data/lib/pod_builder/configuration.rb +42 -34
- data/lib/pod_builder/install.rb +92 -90
- data/lib/pod_builder/podfile.rb +66 -59
- data/lib/pod_builder/podfile_item.rb +52 -52
- data/lib/pod_builder/rome/post_install.rb +151 -119
- data/lib/pod_builder/templates/build_podfile.template +1 -1
- data/lib/pod_builder/version.rb +1 -1
- metadata +3 -2
data/lib/pod_builder/install.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
|
-
require
|
2
|
-
require
|
3
|
-
require
|
4
|
-
require
|
1
|
+
require "digest"
|
2
|
+
require "colored"
|
3
|
+
require "highline/import"
|
4
|
+
require "pod_builder/core"
|
5
5
|
|
6
6
|
module PodBuilder
|
7
7
|
class InstallResult
|
@@ -18,7 +18,7 @@ module PodBuilder
|
|
18
18
|
@prebuilt_info = prebuilt_info
|
19
19
|
end
|
20
20
|
|
21
|
-
def +(obj)
|
21
|
+
def +(obj)
|
22
22
|
merged_licenses = @licenses.dup + obj.licenses
|
23
23
|
merged_prebuilt_info = @prebuilt_info.dup
|
24
24
|
|
@@ -32,7 +32,7 @@ module PodBuilder
|
|
32
32
|
|
33
33
|
merged_prebuilt_info = obj.prebuilt_info.merge(merged_prebuilt_info)
|
34
34
|
|
35
|
-
return InstallResult.new(merged_licenses, merged_prebuilt_info)
|
35
|
+
return InstallResult.new(merged_licenses, merged_prebuilt_info)
|
36
36
|
end
|
37
37
|
|
38
38
|
def write_prebuilt_info_files
|
@@ -45,10 +45,10 @@ module PodBuilder
|
|
45
45
|
class Install
|
46
46
|
# This method will generate prebuilt data by building from "/tmp/pod_builder/Podfile"
|
47
47
|
def self.podfile(podfile_content, podfile_items, argument_pods, build_configuration)
|
48
|
-
puts "Preparing build Podfile".yellow
|
49
|
-
|
48
|
+
puts "Preparing build Podfile".yellow
|
49
|
+
|
50
50
|
podfile_content = copy_development_pods_source_code(podfile_content, podfile_items)
|
51
|
-
|
51
|
+
|
52
52
|
podfile_content = Podfile.update_path_entries(podfile_content, Install.method(:podfile_path_transform))
|
53
53
|
podfile_content = Podfile.update_project_entries(podfile_content, Install.method(:podfile_path_transform))
|
54
54
|
podfile_content = Podfile.update_require_entries(podfile_content, Install.method(:podfile_path_transform))
|
@@ -56,79 +56,79 @@ module PodBuilder
|
|
56
56
|
if Configuration.react_native_project
|
57
57
|
podfile_content = Podfile.prepare_react_native_compilation_workarounds(podfile_content)
|
58
58
|
end
|
59
|
-
|
59
|
+
|
60
60
|
podfile_path = File.join(Configuration.build_path, "Podfile")
|
61
61
|
File.write(podfile_path, podfile_content)
|
62
|
-
|
63
|
-
begin
|
62
|
+
|
63
|
+
begin
|
64
64
|
lock_file = "#{Configuration.build_path}/pod_builder.lock"
|
65
65
|
FileUtils.touch(lock_file)
|
66
|
-
|
66
|
+
|
67
67
|
prebuilt_entries = use_prebuilt_entries_for_unchanged_pods(podfile_path, podfile_items, argument_pods)
|
68
|
-
|
68
|
+
|
69
69
|
install
|
70
|
-
|
71
|
-
copy_prebuilt_items(podfile_items - prebuilt_entries)
|
70
|
+
|
71
|
+
copy_prebuilt_items(podfile_items - prebuilt_entries)
|
72
72
|
|
73
73
|
prebuilt_info = prebuilt_info(podfile_items)
|
74
74
|
licenses = license_specifiers()
|
75
|
-
|
75
|
+
|
76
76
|
if !OPTIONS.has_key?(:debug)
|
77
77
|
PodBuilder::safe_rm_rf(Configuration.build_path)
|
78
|
-
end
|
79
|
-
|
78
|
+
end
|
79
|
+
|
80
80
|
return InstallResult.new(licenses, prebuilt_info)
|
81
81
|
rescue Exception => e
|
82
82
|
if File.directory?("#{Configuration.build_path}/Pods/Pods.xcodeproj")
|
83
83
|
activate_pod_scheme()
|
84
84
|
|
85
85
|
if ENV["DEBUGGING"]
|
86
|
-
system("xed #{Configuration.build_path}/Pods")
|
86
|
+
system("xed #{Configuration.build_path}/Pods")
|
87
87
|
elsif !OPTIONS.has_key?(:no_stdin_available)
|
88
88
|
confirm = ask("\n\nOh no! Something went wrong during prebuild phase! Do you want to open the prebuild project to debug the error, you will need to add and run the Pods-Dummy scheme? [Y/N] ".red) { |yn| yn.limit = 1, yn.validate = /[yn]/i }
|
89
89
|
|
90
|
-
if confirm.downcase ==
|
91
|
-
system("xed #{Configuration.build_path}/Pods")
|
90
|
+
if confirm.downcase == "y"
|
91
|
+
system("xed #{Configuration.build_path}/Pods")
|
92
92
|
end
|
93
93
|
end
|
94
94
|
end
|
95
|
-
|
95
|
+
|
96
96
|
raise e
|
97
|
-
ensure
|
97
|
+
ensure
|
98
98
|
FileUtils.rm(lock_file) if File.exist?(lock_file)
|
99
99
|
end
|
100
100
|
end
|
101
101
|
|
102
102
|
def self.prebuilt_info(podfile_items)
|
103
103
|
gitignored_files = PodBuilder::gitignoredfiles
|
104
|
-
|
104
|
+
|
105
105
|
swift_version = PodBuilder::system_swift_version
|
106
|
-
|
106
|
+
|
107
107
|
ret = Hash.new
|
108
108
|
root_names = podfile_items.reject(&:is_prebuilt).map(&:root_name).uniq
|
109
|
-
root_names.each do |prebuilt_name|
|
109
|
+
root_names.each do |prebuilt_name|
|
110
110
|
path = PodBuilder::prebuiltpath(prebuilt_name)
|
111
|
-
|
111
|
+
|
112
112
|
unless File.directory?(path)
|
113
113
|
puts "Prebuilt items for #{prebuilt_name} not found".blue
|
114
114
|
next
|
115
115
|
end
|
116
|
-
|
116
|
+
|
117
117
|
unless podfile_item = podfile_items.detect { |t| t.name == prebuilt_name } || podfile_items.detect { |t| t.root_name == prebuilt_name }
|
118
118
|
puts "Prebuilt items for #{prebuilt_name} not found #2".blue
|
119
119
|
next
|
120
120
|
end
|
121
|
-
|
121
|
+
|
122
122
|
podbuilder_file = File.join(path, Configuration.prebuilt_info_filename)
|
123
123
|
entry = podfile_item.entry(true, false)
|
124
|
-
|
124
|
+
|
125
125
|
data = {}
|
126
126
|
data["entry"] = entry
|
127
|
-
data["is_prebuilt"] = podfile_item.is_prebuilt
|
127
|
+
data["is_prebuilt"] = podfile_item.is_prebuilt
|
128
128
|
if Dir.glob(File.join(path, "#{podfile_item.prebuilt_rel_path}/Headers/*-Swift.h")).count > 0
|
129
129
|
data["swift_version"] = swift_version
|
130
130
|
end
|
131
|
-
|
131
|
+
|
132
132
|
specs = podfile_items.select { |x| x.root_name == podfile_item.root_name }
|
133
133
|
subspecs_deps = specs.map(&:dependency_names).flatten
|
134
134
|
subspec_self_deps = subspecs_deps.select { |x| x.start_with?("#{prebuilt_name}/") }
|
@@ -138,54 +138,54 @@ module PodBuilder
|
|
138
138
|
if hash = build_folder_hash(podfile_item, gitignored_files)
|
139
139
|
data["build_folder_hash"] = hash
|
140
140
|
end
|
141
|
-
|
141
|
+
|
142
142
|
ret.merge!({ podbuilder_file => data })
|
143
143
|
end
|
144
144
|
|
145
145
|
return ret
|
146
146
|
end
|
147
|
-
|
148
|
-
private
|
149
|
-
|
147
|
+
|
148
|
+
private
|
149
|
+
|
150
150
|
def self.license_specifiers
|
151
151
|
acknowledge_file = "#{Configuration.build_path}/Pods/Target Support Files/Pods-DummyTarget/Pods-DummyTarget-acknowledgements.plist"
|
152
152
|
unless File.exist?(acknowledge_file)
|
153
153
|
raise "\n\nLicense file not found\n".red
|
154
154
|
end
|
155
|
-
|
155
|
+
|
156
156
|
plist = CFPropertyList::List.new(:file => acknowledge_file)
|
157
157
|
data = CFPropertyList.native_types(plist.value)
|
158
|
-
|
158
|
+
|
159
159
|
return data["PreferenceSpecifiers"] || []
|
160
160
|
end
|
161
|
-
|
162
|
-
def self.copy_development_pods_source_code(podfile_content, podfile_items)
|
161
|
+
|
162
|
+
def self.copy_development_pods_source_code(podfile_content, podfile_items)
|
163
163
|
# Development pods are normally built/integrated without moving files from their original paths.
|
164
|
-
# It is important that CocoaPods compiles the files under Configuration.build_path in order that
|
165
|
-
# DWARF debug info reference to this constant path. Doing otherwise breaks the assumptions that
|
164
|
+
# It is important that CocoaPods compiles the files under Configuration.build_path in order that
|
165
|
+
# DWARF debug info reference to this constant path. Doing otherwise breaks the assumptions that
|
166
166
|
# makes the `generate_lldbinit` command work.
|
167
|
-
development_pods = podfile_items.select { |x| x.is_development_pod }
|
167
|
+
development_pods = podfile_items.select { |x| x.is_development_pod }
|
168
168
|
development_pods.each do |podfile_item|
|
169
169
|
destination_path = "#{Configuration.build_path}/Pods/#{podfile_item.name}"
|
170
170
|
FileUtils.mkdir_p(destination_path)
|
171
|
-
|
171
|
+
|
172
172
|
if Pathname.new(podfile_item.path).absolute?
|
173
173
|
FileUtils.cp_r("#{podfile_item.path}/.", destination_path)
|
174
|
-
else
|
174
|
+
else
|
175
175
|
FileUtils.cp_r("#{PodBuilder::basepath(podfile_item.path)}/.", destination_path)
|
176
176
|
end
|
177
|
-
|
177
|
+
|
178
178
|
unless Configuration.build_using_repo_paths
|
179
179
|
podfile_content.gsub!("'#{podfile_item.path}'", "'#{destination_path}'")
|
180
180
|
end
|
181
181
|
end
|
182
|
-
|
182
|
+
|
183
183
|
return podfile_content
|
184
184
|
end
|
185
|
-
|
185
|
+
|
186
186
|
def self.use_prebuilt_entries_for_unchanged_pods(podfile_path, podfile_items, argument_pods)
|
187
187
|
podfile_content = File.read(podfile_path)
|
188
|
-
|
188
|
+
|
189
189
|
replaced_items = []
|
190
190
|
|
191
191
|
download # Copy files under #{Configuration.build_path}/Pods so that we can determine build folder hashes
|
@@ -216,14 +216,14 @@ module PodBuilder
|
|
216
216
|
|
217
217
|
items -= rebuild_pods
|
218
218
|
end
|
219
|
-
|
219
|
+
|
220
220
|
items.each do |item|
|
221
221
|
podspec_path = item.prebuilt_podspec_path
|
222
222
|
unless last_build_folder_hash = build_folder_hash_in_prebuilt_info_file(item)
|
223
223
|
prebuild_log.call(item, "(folder hash missing)")
|
224
224
|
next
|
225
225
|
end
|
226
|
-
|
226
|
+
|
227
227
|
if last_build_folder_hash == build_folder_hash(item, gitignored_files)
|
228
228
|
puts "#{item.root_name} reuse PodBuilder cache"
|
229
229
|
|
@@ -248,35 +248,35 @@ module PodBuilder
|
|
248
248
|
|
249
249
|
return replaced_items
|
250
250
|
end
|
251
|
-
|
251
|
+
|
252
252
|
def self.install
|
253
253
|
puts "Preparing build".yellow
|
254
|
-
|
254
|
+
|
255
255
|
CLAide::Command::PluginManager.load_plugins("cocoapods")
|
256
|
-
|
256
|
+
|
257
257
|
Dir.chdir(Configuration.build_path) do
|
258
258
|
config = Pod::Config.new()
|
259
259
|
installer = Pod::Installer.new(config.sandbox, config.podfile, config.lockfile)
|
260
260
|
installer.repo_update = false
|
261
261
|
installer.update = false
|
262
|
-
|
262
|
+
|
263
263
|
install_start_time = Time.now
|
264
264
|
|
265
|
-
installer.install!
|
265
|
+
installer.install!
|
266
266
|
install_time = Time.now - install_start_time
|
267
|
-
|
267
|
+
|
268
268
|
puts "Build completed in #{install_time.to_i} seconds".blue
|
269
269
|
end
|
270
270
|
end
|
271
|
-
|
271
|
+
|
272
272
|
def self.download
|
273
273
|
puts "Downloading Pods source code".yellow
|
274
|
-
|
274
|
+
|
275
275
|
CLAide::Command::PluginManager.load_plugins("cocoapods")
|
276
|
-
|
276
|
+
|
277
277
|
Dir.chdir(Configuration.build_path) do
|
278
278
|
Pod::UserInterface::config.silent = true
|
279
|
-
|
279
|
+
|
280
280
|
config = Pod::Config.new()
|
281
281
|
installer = Pod::Installer.new(config.sandbox, config.podfile, config.lockfile)
|
282
282
|
installer.repo_update = false
|
@@ -284,11 +284,11 @@ module PodBuilder
|
|
284
284
|
installer.prepare
|
285
285
|
installer.resolve_dependencies
|
286
286
|
installer.download_dependencies
|
287
|
-
|
287
|
+
|
288
288
|
Pod::UserInterface::config.silent = false
|
289
289
|
end
|
290
290
|
end
|
291
|
-
|
291
|
+
|
292
292
|
def self.copy_prebuilt_items(podfile_items)
|
293
293
|
FileUtils.mkdir_p(PodBuilder::prebuiltpath)
|
294
294
|
|
@@ -297,9 +297,9 @@ module PodBuilder
|
|
297
297
|
non_prebuilt_items.reject! { |item|
|
298
298
|
[item.module_name, item.root_name]
|
299
299
|
.map { |t| PodBuilder::buildpath_prebuiltpath(t) }
|
300
|
-
.select { |t| File.directory?(t) }
|
300
|
+
.select { |t| File.directory?(t) }
|
301
301
|
.all? { |t| Dir.empty?(t) } # When using prebuilt items we end up with empty folders
|
302
|
-
}
|
302
|
+
}
|
303
303
|
|
304
304
|
non_prebuilt_items.each do |item|
|
305
305
|
# Remove existing files
|
@@ -316,16 +316,18 @@ module PodBuilder
|
|
316
316
|
next
|
317
317
|
end
|
318
318
|
|
319
|
-
|
320
|
-
if
|
321
|
-
|
322
|
-
|
323
|
-
|
319
|
+
unless Configuration.keep_swiftmodules
|
320
|
+
if podfile_item = podfile_items.detect { |t| t.root_name == item.root_name }
|
321
|
+
if Dir.glob("#{source_path}/**/Modules/**/*.swiftmodule/*.swiftinterface").count > 0
|
322
|
+
# We can safely remove .swiftmodule if .swiftinterface exists
|
323
|
+
swiftmodule_files = Dir.glob("#{source_path}/**/Modules/**/*.swiftmodule/*.swiftmodule")
|
324
|
+
swiftmodule_files.each { |t| PodBuilder::safe_rm_rf(t) }
|
325
|
+
end
|
324
326
|
end
|
325
327
|
end
|
326
328
|
|
327
329
|
# Cleanup unneeded files (see https://github.com/bazelbuild/rules_apple/pull/1113)
|
328
|
-
ignore_files = Dir.glob(
|
330
|
+
ignore_files = Dir.glob("#{source_path}/**/Modules/**/*.swiftmodule/*.{swiftdoc,swiftsourceinfo,private.swiftinterface}")
|
329
331
|
ignore_files.each { |t| PodBuilder::safe_rm_rf(t) }
|
330
332
|
|
331
333
|
project_folder = Dir.glob("#{source_path}/**/Modules/**/*.swiftmodule/Project")
|
@@ -334,36 +336,36 @@ module PodBuilder
|
|
334
336
|
unless Dir.glob("#{source_path}/**/*").select { |t| File.file?(t) }.empty?
|
335
337
|
destination_folder = PodBuilder::prebuiltpath(item.root_name)
|
336
338
|
FileUtils.mkdir_p(destination_folder)
|
337
|
-
FileUtils.cp_r("#{source_path}/.", destination_folder)
|
339
|
+
FileUtils.cp_r("#{source_path}/.", destination_folder)
|
338
340
|
end
|
339
341
|
end
|
340
|
-
|
342
|
+
|
341
343
|
# Folder won't exist if no dSYM were generated (all static libs)
|
342
344
|
if File.directory?(PodBuilder::buildpath_dsympath)
|
343
345
|
FileUtils.mkdir_p(PodBuilder::dsympath)
|
344
346
|
FileUtils.cp_r(PodBuilder::buildpath_dsympath, PodBuilder::basepath)
|
345
347
|
end
|
346
348
|
end
|
347
|
-
|
349
|
+
|
348
350
|
def self.build_folder_hash_in_prebuilt_info_file(podfile_item)
|
349
351
|
prebuilt_info_path = PodBuilder::prebuiltpath(File.join(podfile_item.root_name, Configuration.prebuilt_info_filename))
|
350
|
-
|
352
|
+
|
351
353
|
if File.exist?(prebuilt_info_path)
|
352
354
|
data = JSON.parse(File.read(prebuilt_info_path))
|
353
|
-
return data[
|
355
|
+
return data["build_folder_hash"]
|
354
356
|
else
|
355
357
|
return nil
|
356
358
|
end
|
357
359
|
end
|
358
|
-
|
360
|
+
|
359
361
|
def self.build_folder_hash(podfile_item, exclude_files)
|
360
362
|
if podfile_item.is_development_pod
|
361
363
|
if Pathname.new(podfile_item.path).absolute?
|
362
364
|
item_path = podfile_item.path
|
363
|
-
else
|
365
|
+
else
|
364
366
|
item_path = PodBuilder::basepath(podfile_item.path)
|
365
367
|
end
|
366
|
-
|
368
|
+
|
367
369
|
rootpath = PodBuilder::git_rootpath
|
368
370
|
file_hashes = []
|
369
371
|
Dir.glob("#{item_path}/**/*", File::FNM_DOTMATCH) do |path|
|
@@ -378,7 +380,7 @@ module PodBuilder
|
|
378
380
|
file_hashes.push(Digest::MD5.hexdigest(File.read(path)))
|
379
381
|
end
|
380
382
|
end
|
381
|
-
|
383
|
+
|
382
384
|
return Digest::MD5.hexdigest(file_hashes.sort.join)
|
383
385
|
else
|
384
386
|
# Pod folder might be under .gitignore
|
@@ -390,7 +392,7 @@ module PodBuilder
|
|
390
392
|
end
|
391
393
|
end
|
392
394
|
end
|
393
|
-
|
395
|
+
|
394
396
|
def self.podfile_path_transform(path)
|
395
397
|
if Configuration.build_using_repo_paths
|
396
398
|
return File.expand_path(PodBuilder::basepath(path))
|
@@ -398,18 +400,18 @@ module PodBuilder
|
|
398
400
|
use_absolute_paths = true
|
399
401
|
podfile_path = File.join(Configuration.build_path, "Podfile")
|
400
402
|
original_basepath = PodBuilder::basepath
|
401
|
-
|
403
|
+
|
402
404
|
podfile_base_path = Pathname.new(File.dirname(podfile_path))
|
403
|
-
|
405
|
+
|
404
406
|
original_path = Pathname.new(File.join(original_basepath, path))
|
405
407
|
replace_path = original_path.relative_path_from(podfile_base_path)
|
406
408
|
if use_absolute_paths
|
407
409
|
replace_path = replace_path.expand_path(podfile_base_path)
|
408
410
|
end
|
409
|
-
|
411
|
+
|
410
412
|
return replace_path
|
411
413
|
end
|
412
|
-
end
|
414
|
+
end
|
413
415
|
|
414
416
|
def self.activate_pod_scheme
|
415
417
|
if scheme_file = Dir.glob("#{Configuration.build_path}/Pods/**/xcschememanagement.plist").first
|
@@ -421,18 +423,18 @@ module PodBuilder
|
|
421
423
|
end
|
422
424
|
|
423
425
|
plist.value = CFPropertyList.guess(data)
|
424
|
-
plist.save(scheme_file, CFPropertyList::List::FORMAT_BINARY)
|
426
|
+
plist.save(scheme_file, CFPropertyList::List::FORMAT_BINARY)
|
425
427
|
end
|
426
428
|
end
|
427
429
|
end
|
428
430
|
end
|
429
431
|
|
430
432
|
# CocoaPods seems to hard code the development language to english
|
431
|
-
# By monkey patching the project save we make sure that the to manually rewrite the
|
433
|
+
# By monkey patching the project save we make sure that the to manually rewrite the
|
432
434
|
# development language if it has been manually specified in PodBuilder's configuration
|
433
435
|
class Xcodeproj::Project
|
434
436
|
alias_method :swz_save, :save
|
435
|
-
|
437
|
+
|
436
438
|
def save(save_path = nil)
|
437
439
|
if development_language = PodBuilder::Configuration.development_language
|
438
440
|
root_object.development_region = development_language
|
@@ -440,4 +442,4 @@ class Xcodeproj::Project
|
|
440
442
|
|
441
443
|
swz_save(save_path)
|
442
444
|
end
|
443
|
-
end
|
445
|
+
end
|