pod-builder 2.0.0.beta.19 → 2.0.0.beta.21
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/.gitignore +2 -2
- data/Example/{Frameworks → PodBuilder}/.gitignore +0 -0
- data/Example/{Frameworks → PodBuilder}/.pod_builder/pod_builder +0 -0
- data/Example/{Frameworks → PodBuilder}/PodBuilder.json +0 -0
- data/Example/{Frameworks → PodBuilder}/Podfile +0 -0
- data/Example/{Frameworks → PodBuilder}/Podfile.restore +0 -0
- data/Example/Podfile +27 -29
- data/Example/Podfile.lock +42 -42
- data/README.md +13 -13
- data/exe/pod_builder +27 -16
- data/lib/pod_builder/command/build.rb +28 -159
- data/lib/pod_builder/command/build_all.rb +2 -2
- data/lib/pod_builder/command/clean.rb +34 -53
- data/lib/pod_builder/command/clear_lldbinit.rb +6 -2
- data/lib/pod_builder/command/deintegrate.rb +27 -6
- data/lib/pod_builder/command/generate_lfs.rb +1 -1
- data/lib/pod_builder/command/generate_podspec.rb +3 -2
- data/lib/pod_builder/command/info.rb +1 -1
- data/lib/pod_builder/command/init.rb +37 -14
- data/lib/pod_builder/command/install_sources.rb +20 -13
- data/lib/pod_builder/command/none.rb +2 -2
- data/lib/pod_builder/command/restore_all.rb +4 -4
- data/lib/pod_builder/command/switch.rb +56 -14
- data/lib/pod_builder/command/sync_podfile.rb +3 -2
- data/lib/pod_builder/command/update.rb +5 -6
- data/lib/pod_builder/command/update_lldbinit.rb +10 -8
- data/lib/pod_builder/configuration.rb +27 -7
- data/lib/pod_builder/core.rb +35 -9
- data/lib/pod_builder/info.rb +11 -11
- data/lib/pod_builder/install.rb +178 -184
- data/lib/pod_builder/licenses.rb +4 -4
- data/lib/pod_builder/podfile.rb +226 -85
- data/lib/pod_builder/podfile/post_actions.rb +9 -14
- data/lib/pod_builder/podfile_cp.rb +93 -0
- data/lib/pod_builder/podfile_item.rb +41 -20
- data/lib/pod_builder/podspec.rb +33 -16
- data/lib/pod_builder/rome/post_install.rb +121 -129
- data/lib/pod_builder/rome/pre_install.rb +1 -1
- data/lib/pod_builder/templates/build_podfile.template +2 -2
- data/lib/pod_builder/version.rb +1 -1
- metadata +8 -7
@@ -3,7 +3,7 @@ require 'pod_builder/core'
|
|
3
3
|
module PodBuilder
|
4
4
|
module Command
|
5
5
|
class Build
|
6
|
-
def self.call
|
6
|
+
def self.call
|
7
7
|
Configuration.check_inited
|
8
8
|
PodBuilder::prepare_basepath
|
9
9
|
|
@@ -13,14 +13,14 @@ module PodBuilder
|
|
13
13
|
return -1
|
14
14
|
end
|
15
15
|
|
16
|
-
raise "\n\nPlease rename your Xcode installation path removing spaces, current `#{`xcode-select -p`.strip()}`\n" if `xcode-select -p`.strip().include?(" ")
|
16
|
+
raise "\n\nPlease rename your Xcode installation path removing spaces, current `#{`xcode-select -p`.strip()}`\n".red if `xcode-select -p`.strip().include?(" ")
|
17
17
|
|
18
18
|
Podfile.sanity_check()
|
19
19
|
check_not_building_subspecs(argument_pods)
|
20
20
|
|
21
21
|
puts "Loading Podfile".yellow
|
22
22
|
|
23
|
-
install_update_repo =
|
23
|
+
install_update_repo = OPTIONS.fetch(:update_repos, true)
|
24
24
|
installer, analyzer = Analyze.installer_at(PodBuilder::basepath, install_update_repo)
|
25
25
|
|
26
26
|
all_buildable_items = Analyze.podfile_items(installer, analyzer)
|
@@ -29,9 +29,12 @@ module PodBuilder
|
|
29
29
|
|
30
30
|
build_all = argument_pods.first == "*"
|
31
31
|
if build_all
|
32
|
-
argument_pods =
|
32
|
+
argument_pods = all_buildable_items.map(&:root_name).uniq
|
33
33
|
else
|
34
34
|
argument_pods = Podfile::resolve_pod_names(argument_pods, all_buildable_items)
|
35
|
+
deps = all_buildable_items.select { |t| argument_pods.include?(t.root_name) }.map(&:dependency_names).flatten.map { |t| t.split("/").first }
|
36
|
+
argument_pods += deps
|
37
|
+
argument_pods.uniq!
|
35
38
|
end
|
36
39
|
|
37
40
|
available_argument_pods = argument_pods.select { |x| all_buildable_items.map(&:root_name).include?(x) }
|
@@ -46,10 +49,10 @@ module PodBuilder
|
|
46
49
|
|
47
50
|
restore_file_error = Podfile.restore_file_sanity_check
|
48
51
|
|
49
|
-
check_splitted_subspecs_are_static(all_buildable_items
|
52
|
+
check_splitted_subspecs_are_static(all_buildable_items)
|
50
53
|
check_pods_exists(argument_pods, all_buildable_items)
|
51
54
|
|
52
|
-
pods_to_build = resolve_pods_to_build(argument_pods, buildable_items
|
55
|
+
pods_to_build = resolve_pods_to_build(argument_pods, buildable_items)
|
53
56
|
buildable_items -= pods_to_build
|
54
57
|
|
55
58
|
# We need to split pods to build in 3 groups
|
@@ -57,7 +60,7 @@ module PodBuilder
|
|
57
60
|
# 2. pods to build in release
|
58
61
|
# 3. pods to build in debug
|
59
62
|
|
60
|
-
check_not_building_development_pods(pods_to_build
|
63
|
+
check_not_building_development_pods(pods_to_build)
|
61
64
|
|
62
65
|
pods_to_build_subspecs = pods_to_build.select { |x| x.is_subspec && Configuration.subspecs_to_split.include?(x.name) }
|
63
66
|
|
@@ -83,19 +86,17 @@ module PodBuilder
|
|
83
86
|
podfile_items = podfile_items.map { |t| t.recursive_dependencies(all_buildable_items) }.flatten.uniq
|
84
87
|
podfile_content = Podfile.from_podfile_items(podfile_items, analyzer, build_configuration)
|
85
88
|
|
86
|
-
Install.podfile(podfile_content, podfile_items, podfile_items.first.build_configuration)
|
87
|
-
|
88
|
-
licenses += license_specifiers
|
89
|
+
licenses += Install.podfile(podfile_content, podfile_items, podfile_items.first.build_configuration)
|
89
90
|
|
90
91
|
# remove lockfile which gets unexplicably created
|
91
92
|
FileUtils.rm_f(PodBuilder::basepath("Podfile.lock"))
|
92
93
|
end
|
93
94
|
|
94
|
-
|
95
|
+
Clean::prebuilt_items(all_buildable_items)
|
95
96
|
|
96
97
|
Licenses::write(licenses, all_buildable_items)
|
97
98
|
|
98
|
-
GenerateLFS::call(
|
99
|
+
GenerateLFS::call()
|
99
100
|
Podspec::generate(all_buildable_items, analyzer)
|
100
101
|
|
101
102
|
builded_pods = podfiles_items.flatten
|
@@ -104,13 +105,13 @@ module PodBuilder
|
|
104
105
|
builded_pods_and_deps.select! { |x| !x.is_prebuilt }
|
105
106
|
|
106
107
|
Podfile::write_restorable(builded_pods_and_deps + prebuilt_pods_to_install, all_buildable_items, analyzer)
|
107
|
-
if !
|
108
|
+
if !OPTIONS.has_key?(:skip_prebuild_update)
|
108
109
|
Podfile::write_prebuilt(all_buildable_items, analyzer)
|
109
110
|
end
|
110
111
|
|
111
112
|
Podfile::install
|
112
113
|
|
113
|
-
sanity_checks
|
114
|
+
sanity_checks
|
114
115
|
|
115
116
|
if (restore_file_error = restore_file_error) && Configuration.restore_enabled
|
116
117
|
puts "\n\n⚠️ Podfile.restore was found invalid and was overwritten. Error:\n #{restore_file_error}".red
|
@@ -122,89 +123,6 @@ module PodBuilder
|
|
122
123
|
|
123
124
|
private
|
124
125
|
|
125
|
-
def self.license_specifiers
|
126
|
-
acknowledge_files = Dir.glob("#{PodBuilder::Configuration.build_path}/Pods/**/*acknowledgements.plist")
|
127
|
-
raise "Too many ackwnoledge files found" if acknowledge_files.count > 1
|
128
|
-
|
129
|
-
if acknowledge_file = acknowledge_files.first
|
130
|
-
plist = CFPropertyList::List.new(:file => acknowledge_file)
|
131
|
-
data = CFPropertyList.native_types(plist.value)
|
132
|
-
|
133
|
-
return data["PreferenceSpecifiers"]
|
134
|
-
end
|
135
|
-
|
136
|
-
return []
|
137
|
-
end
|
138
|
-
|
139
|
-
# def self.buildable_dependencies(pod, buildable_items)
|
140
|
-
# deps = []
|
141
|
-
|
142
|
-
# pod.dependency_names.each do |dependency|
|
143
|
-
# buildable_pods = buildable_items.select { |t| t.root_name == dependency }
|
144
|
-
# if buildable_pods.any? { |t| t.source_files.count > 0 }
|
145
|
-
# deps.push(dependency)
|
146
|
-
# end
|
147
|
-
# end
|
148
|
-
|
149
|
-
# return deps
|
150
|
-
# end
|
151
|
-
|
152
|
-
# def self.expected_common_dependencies(pods_to_build, buildable_items, options)
|
153
|
-
# warned_expected_pod_list = []
|
154
|
-
# expected_pod_list = []
|
155
|
-
# errors = []
|
156
|
-
|
157
|
-
# pods_to_build.each do |pod_to_build|
|
158
|
-
# buildable_dependencies(pod_to_build, buildable_items).each do |dependency|
|
159
|
-
# unless buildable_items.detect { |x| x.root_name == dependency || x.name == dependency } != nil
|
160
|
-
# next
|
161
|
-
# end
|
162
|
-
|
163
|
-
# buildable_items.each do |buildable_pod|
|
164
|
-
# unless !buildable_dependencies(pod_to_build, buildable_items).include?(buildable_pod.name)
|
165
|
-
# next
|
166
|
-
# end
|
167
|
-
|
168
|
-
# if buildable_dependencies(buildable_pod, buildable_items).include?(dependency) && !buildable_pod.has_subspec(dependency) && !buildable_pod.has_common_spec(dependency) then
|
169
|
-
# expected_pod_list += pods_to_build.map(&:root_name) + [buildable_pod.root_name]
|
170
|
-
# expected_pod_list.uniq!
|
171
|
-
|
172
|
-
# expected_list = expected_pod_list.join(" ")
|
173
|
-
# if !warned_expected_pod_list.include?(expected_list)
|
174
|
-
# errors.push("Can't build #{pod_to_build.name} because it has common dependencies (#{dependency}) with #{buildable_pod.name}.\n\nUse `pod_builder build #{expected_list}` instead or use `pod_builder build -a #{pod_to_build.name}` to automatically resolve missing dependencies\n\n")
|
175
|
-
# errors.uniq!
|
176
|
-
# warned_expected_pod_list.push(expected_list)
|
177
|
-
|
178
|
-
# if options.has_key?(:auto_resolve_dependencies)
|
179
|
-
# puts "`#{pod_to_build.name}` has the following dependencies:\n`#{buildable_dependencies(pod_to_build, buildable_items).join("`, `")}`\nWhich are in common with `#{buildable_pod.name}` and requires it to be recompiled\n\n".yellow
|
180
|
-
# end
|
181
|
-
# end
|
182
|
-
# end
|
183
|
-
# end
|
184
|
-
# end
|
185
|
-
# end
|
186
|
-
|
187
|
-
# return expected_pod_list, errors
|
188
|
-
# end
|
189
|
-
|
190
|
-
# def self.expected_parent_dependencies(pods_to_build, buildable_items, options)
|
191
|
-
# expected_pod_list = []
|
192
|
-
# errors = []
|
193
|
-
|
194
|
-
# buildable_items_dependencies = buildable_items.map(&:dependency_names).flatten.uniq
|
195
|
-
# pods_to_build.each do |pod_to_build|
|
196
|
-
# if buildable_items_dependencies.include?(pod_to_build.name)
|
197
|
-
# parent = buildable_items.detect { |x| x.dependency_names.include?(pod_to_build.name) }
|
198
|
-
|
199
|
-
# expected_pod_list += (pods_to_build + [parent]).map(&:root_name)
|
200
|
-
# expected_pod_list.uniq!
|
201
|
-
# errors.push("Can't build #{pod_to_build.name} because it is a dependency of #{parent.name}.\n\nUse `pod_builder build #{expected_pod_list.join(" ")}` instead\n\n")
|
202
|
-
# end
|
203
|
-
# end
|
204
|
-
|
205
|
-
# return expected_pod_list, errors
|
206
|
-
# end
|
207
|
-
|
208
126
|
def self.check_not_building_subspecs(pods_to_build)
|
209
127
|
pods_to_build.each do |pod_to_build|
|
210
128
|
if pod_to_build.include?("/")
|
@@ -214,7 +132,7 @@ module PodBuilder
|
|
214
132
|
end
|
215
133
|
|
216
134
|
def self.check_pods_exists(pods, buildable_items)
|
217
|
-
raise "
|
135
|
+
raise "\n\nEmpty Podfile?".red if buildable_items.nil?
|
218
136
|
|
219
137
|
buildable_items = buildable_items.map(&:root_name)
|
220
138
|
pods.each do |pod|
|
@@ -222,7 +140,7 @@ module PodBuilder
|
|
222
140
|
end
|
223
141
|
end
|
224
142
|
|
225
|
-
def self.check_splitted_subspecs_are_static(all_buildable_items
|
143
|
+
def self.check_splitted_subspecs_are_static(all_buildable_items)
|
226
144
|
non_static_subspecs = all_buildable_items.select { |x| x.is_subspec && x.is_static == false }
|
227
145
|
non_static_subspecs_names = non_static_subspecs.map(&:name)
|
228
146
|
|
@@ -232,11 +150,11 @@ module PodBuilder
|
|
232
150
|
return
|
233
151
|
end
|
234
152
|
|
235
|
-
warn_message = "The following pods `#{invalid_subspecs.join(" ")}` are non static
|
236
|
-
if
|
153
|
+
warn_message = "The following pods `#{invalid_subspecs.join(" ")}` are non static binaries which are being splitted over different targets. Beware that this is an unsafe setup as per https://github.com/CocoaPods/CocoaPods/issues/5708 and https://github.com/CocoaPods/CocoaPods/issues/5643\n\nYou can ignore this error by passing the `--allow-warnings` flag to the build command\n"
|
154
|
+
if OPTIONS[:allow_warnings]
|
237
155
|
puts "\n\n⚠️ #{warn_message}".yellow
|
238
156
|
else
|
239
|
-
raise "\n\n🚨️ #{warn_message}".
|
157
|
+
raise "\n\n🚨️ #{warn_message}".red
|
240
158
|
end
|
241
159
|
end
|
242
160
|
|
@@ -250,14 +168,14 @@ module PodBuilder
|
|
250
168
|
pods_with_unaligned_build_configuration = pods_with_common_deps.select { |x| x.build_configuration != pod.build_configuration }
|
251
169
|
pods_with_unaligned_build_configuration.map!(&:name)
|
252
170
|
|
253
|
-
raise "
|
171
|
+
raise "\n\nDependencies of `#{pod.name}` don't have the same build configuration (#{pod.build_configuration}) of `#{pods_with_unaligned_build_configuration.join(",")}`'s dependencies".red if pods_with_unaligned_build_configuration.count > 0
|
254
172
|
end
|
255
173
|
end
|
256
174
|
|
257
|
-
def self.check_not_building_development_pods(pods
|
258
|
-
if (development_pods = pods.select { |x| x.is_development_pod }) && development_pods.count > 0 && (
|
175
|
+
def self.check_not_building_development_pods(pods)
|
176
|
+
if (development_pods = pods.select { |x| x.is_development_pod }) && development_pods.count > 0 && (OPTIONS[:allow_warnings].nil? && Configuration.allow_building_development_pods == false)
|
259
177
|
pod_names = development_pods.map(&:name).join(", ")
|
260
|
-
raise "
|
178
|
+
raise "\n\nThe following pods are in development mode: `#{pod_names}`, won't proceed building.\n\nYou can ignore this error by passing the `--allow-warnings` flag to the build command\n".red
|
261
179
|
end
|
262
180
|
end
|
263
181
|
|
@@ -270,7 +188,7 @@ module PodBuilder
|
|
270
188
|
return buildable_subspecs - pods_to_build
|
271
189
|
end
|
272
190
|
|
273
|
-
def self.sanity_checks
|
191
|
+
def self.sanity_checks
|
274
192
|
lines = File.read(PodBuilder::project_path("Podfile")).split("\n")
|
275
193
|
stripped_lines = lines.map { |x| Podfile.strip_line(x) }.select { |x| !x.start_with?("#")}
|
276
194
|
|
@@ -278,7 +196,7 @@ module PodBuilder
|
|
278
196
|
|
279
197
|
if !expected_stripped.all? { |x| stripped_lines.include?(x) }
|
280
198
|
warn_message = "PodBuilder's post install actions missing from application Podfile!\n"
|
281
|
-
if
|
199
|
+
if OPTIONS[:allow_warnings]
|
282
200
|
puts "\n\n⚠️ #{warn_message}".yellow
|
283
201
|
else
|
284
202
|
raise "\n\n🚨️ #{warn_message}".red
|
@@ -286,63 +204,14 @@ module PodBuilder
|
|
286
204
|
end
|
287
205
|
end
|
288
206
|
|
289
|
-
def self.resolve_pods_to_build(argument_pods, buildable_items
|
207
|
+
def self.resolve_pods_to_build(argument_pods, buildable_items)
|
290
208
|
pods_to_build = []
|
291
209
|
|
292
|
-
# fns = [method(:expected_common_dependencies), method(:expected_parent_dependencies)]
|
293
|
-
# fns.each do |fn|
|
294
|
-
# loop do
|
295
|
-
# pods_to_build = buildable_items.select { |x| argument_pods.include?(x.root_name) }
|
296
|
-
# pods_to_build += other_subspecs(pods_to_build, buildable_items)
|
297
|
-
# tmp_buildable_items = buildable_items - pods_to_build
|
298
|
-
|
299
|
-
# expected_pods, errors = fn.call(pods_to_build, tmp_buildable_items, options)
|
300
|
-
# if expected_pods.count > 0
|
301
|
-
# if !options.has_key?(:auto_resolve_dependencies) && expected_pods.count > 0
|
302
|
-
# raise "\n\n#{errors.join("\n")}".red
|
303
|
-
# else
|
304
|
-
# argument_pods = expected_pods.uniq
|
305
|
-
# end
|
306
|
-
# end
|
307
|
-
|
308
|
-
# if !options.has_key?(:auto_resolve_dependencies) || expected_pods.count == 0
|
309
|
-
# break
|
310
|
-
# end
|
311
|
-
# end
|
312
|
-
# end
|
313
|
-
|
314
210
|
pods_to_build = buildable_items.select { |x| argument_pods.include?(x.root_name) }
|
315
211
|
pods_to_build += other_subspecs(pods_to_build, buildable_items)
|
316
212
|
|
317
213
|
return pods_to_build
|
318
|
-
end
|
319
|
-
|
320
|
-
def self.clean_frameworks_folder(buildable_items)
|
321
|
-
puts "Cleaning framework folder".yellow
|
322
|
-
|
323
|
-
expected_frameworks = buildable_items.map { |x| "#{x.module_name}.framework" }
|
324
|
-
expected_frameworks += buildable_items.map { |x| x.vendored_frameworks }.flatten.map { |x| File.basename(x) }
|
325
|
-
expected_frameworks.uniq!
|
326
|
-
|
327
|
-
existing_frameworks = Dir.glob(PodBuilder::prebuiltpath("*.framework"))
|
328
|
-
|
329
|
-
existing_frameworks.each do |existing_framework|
|
330
|
-
existing_framework_name = File.basename(existing_framework)
|
331
|
-
if !expected_frameworks.include?(existing_framework_name)
|
332
|
-
puts "Cleanining up `#{existing_framework_name}`, no longer found among dependencies".blue
|
333
|
-
FileUtils.rm_rf(existing_framework)
|
334
|
-
end
|
335
|
-
end
|
336
|
-
|
337
|
-
existing_dsyms = Dir.glob(PodBuilder::dsympath("**/*.dSYM"))
|
338
|
-
existing_dsyms.each do |existing_dsym|
|
339
|
-
existing_dsym_name = File.basename(existing_dsym)
|
340
|
-
if !expected_frameworks.include?(existing_dsym_name.gsub(".dSYM", ""))
|
341
|
-
puts "Cleanining up `#{existing_dsym_name}`, no longer found among dependencies".blue
|
342
|
-
FileUtils.rm_rf(existing_dsym)
|
343
|
-
end
|
344
|
-
end
|
345
|
-
end
|
214
|
+
end
|
346
215
|
end
|
347
216
|
end
|
348
217
|
end
|
@@ -3,12 +3,12 @@ require 'pod_builder/core'
|
|
3
3
|
module PodBuilder
|
4
4
|
module Command
|
5
5
|
class BuildAll
|
6
|
-
def self.call
|
6
|
+
def self.call
|
7
7
|
Configuration.check_inited
|
8
8
|
PodBuilder::prepare_basepath
|
9
9
|
|
10
10
|
ARGV << "*"
|
11
|
-
return Command::Build::call
|
11
|
+
return Command::Build::call
|
12
12
|
end
|
13
13
|
end
|
14
14
|
end
|
@@ -4,90 +4,71 @@ require 'highline/import'
|
|
4
4
|
module PodBuilder
|
5
5
|
module Command
|
6
6
|
class Clean
|
7
|
-
def self.call
|
7
|
+
def self.call
|
8
8
|
Configuration.check_inited
|
9
9
|
PodBuilder::prepare_basepath
|
10
10
|
|
11
|
-
install_update_repo =
|
11
|
+
install_update_repo = OPTIONS.fetch(:update_repos, true)
|
12
12
|
installer, analyzer = Analyze.installer_at(PodBuilder::basepath, install_update_repo)
|
13
13
|
all_buildable_items = Analyze.podfile_items(installer, analyzer)
|
14
14
|
|
15
|
-
|
16
|
-
|
17
|
-
rel_paths.uniq!
|
18
|
-
|
19
|
-
base_path = PodBuilder::prebuiltpath
|
20
|
-
framework_files = Dir.glob("#{base_path}/**/*.framework")
|
21
|
-
puts "Looking for unused frameworks".yellow
|
22
|
-
clean(framework_files, base_path, rel_paths)
|
23
|
-
|
24
|
-
rel_paths.map! { |x| "#{x}.dSYM"}
|
25
|
-
|
26
|
-
Configuration.supported_platforms.each do |platform|
|
27
|
-
base_path = PodBuilder::dsympath(platform)
|
28
|
-
dSYM_files = Dir.glob("#{base_path}/**/*.dSYM")
|
29
|
-
puts "Looking for #{platform} unused dSYMs".yellow
|
30
|
-
clean(dSYM_files, base_path, rel_paths)
|
31
|
-
end
|
32
|
-
|
33
|
-
puts "Looking for unused sources".yellow
|
34
|
-
clean_sources(podspec_names)
|
15
|
+
prebuilt_items(all_buildable_items)
|
16
|
+
install_sources(all_buildable_items)
|
35
17
|
|
36
18
|
puts "\n\n🎉 done!\n".green
|
37
19
|
return 0
|
38
20
|
end
|
39
|
-
|
40
|
-
def self.
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
unless !podspec_names.include?(podspec_name)
|
50
|
-
next
|
21
|
+
|
22
|
+
def self.prebuilt_items(buildable_items)
|
23
|
+
puts "Cleaning prebuilt folder".yellow
|
24
|
+
|
25
|
+
root_names = buildable_items.map(&:root_name).uniq
|
26
|
+
Dir.glob(File.join(PodBuilder::prebuiltpath, "*")).each do |path|
|
27
|
+
basename = File.basename(path)
|
28
|
+
unless root_names.include?(basename)
|
29
|
+
puts "Cleanining up `#{basename}`, no longer found among dependencies".blue
|
30
|
+
PodBuilder::safe_rm_rf(path)
|
51
31
|
end
|
52
|
-
|
53
|
-
paths_to_delete.push(path)
|
54
32
|
end
|
55
33
|
|
56
|
-
|
57
|
-
|
58
|
-
|
34
|
+
puts "Cleaning dSYM folder".yellow
|
35
|
+
module_names = buildable_items.map(&:module_name).uniq
|
36
|
+
Dir.glob(File.join(PodBuilder::dsympath, "**/*.dSYM")).each do |path|
|
37
|
+
dsym_basename = File.basename(path, ".*")
|
38
|
+
dsym_basename.gsub!(/\.framework$/, "")
|
39
|
+
unless module_names.include?(dsym_basename)
|
40
|
+
puts "Cleanining up `#{dsym_basename}`, no longer found among dependencies".blue
|
59
41
|
PodBuilder::safe_rm_rf(path)
|
60
42
|
end
|
61
43
|
end
|
44
|
+
|
62
45
|
end
|
63
46
|
|
64
|
-
|
47
|
+
def self.install_sources(buildable_items)
|
48
|
+
puts "Looking for unused sources".yellow
|
49
|
+
|
50
|
+
podspec_names = buildable_items.map(&:root_name).uniq
|
65
51
|
|
66
|
-
|
67
|
-
files = files.map { |x| [Pathname.new(x).relative_path_from(Pathname.new(base_path)).to_s, x] }.to_h
|
52
|
+
base_path = PodBuilder::basepath("Sources")
|
68
53
|
|
69
54
|
paths_to_delete = []
|
70
|
-
|
71
|
-
|
55
|
+
repo_paths = Dir.glob("#{base_path}/*")
|
56
|
+
repo_paths.each do |path|
|
57
|
+
podspec_name = File.basename(path)
|
58
|
+
|
59
|
+
if podspec_names.include?(podspec_name)
|
72
60
|
next
|
73
61
|
end
|
74
62
|
|
75
63
|
paths_to_delete.push(path)
|
76
64
|
end
|
77
65
|
|
78
|
-
paths_to_delete.each do |path|
|
79
|
-
confirm = ask("
|
66
|
+
paths_to_delete.flatten.each do |path|
|
67
|
+
confirm = ask("#{path} unused.\nDelete it? [Y/N] ") { |yn| yn.limit = 1, yn.validate = /[yn]/i }
|
80
68
|
if confirm.downcase == 'y'
|
81
69
|
PodBuilder::safe_rm_rf(path)
|
82
70
|
end
|
83
71
|
end
|
84
|
-
|
85
|
-
Dir.chdir(base_path) do
|
86
|
-
# Before deleting anything be sure we're in a git repo
|
87
|
-
h = `git rev-parse --show-toplevel`.strip()
|
88
|
-
raise "\n\nNo git repository found in current folder `#{Dir.pwd}`!\n".red if h.empty?
|
89
|
-
system("find . -type d -empty -delete") # delete empty folders
|
90
|
-
end
|
91
72
|
end
|
92
73
|
end
|
93
74
|
end
|