mirror of
https://gitlab.com/mbunkus/mkvtoolnix.git
synced 2024-12-25 04:11:44 +00:00
Rakefile: add task for dumping a task's dependencies
This commit is contained in:
parent
71d6291318
commit
17eb6205e0
19
Rakefile
19
Rakefile
@ -752,6 +752,25 @@ namespace :dev do
|
||||
revision = `git rev-parse --short HEAD`.chomp
|
||||
create_source_tarball "-#{revision}"
|
||||
end
|
||||
|
||||
desc "Dump dependencies of the task given with TASK environment variable"
|
||||
task "dependencies" do
|
||||
if ENV['TASK'].blank?
|
||||
puts "'TASK' environment variable not set"
|
||||
exit 1
|
||||
end
|
||||
|
||||
task = Rake::Task[ENV['TASK']]
|
||||
if !task
|
||||
puts "No task named '#{ENV['MTASK']}'"
|
||||
exit 1
|
||||
end
|
||||
|
||||
prereqs = task.mo_all_prerequisites
|
||||
longest = prereqs.map { |p| p[0].length }.max
|
||||
|
||||
puts prereqs.map { |p| sprintf("%-#{longest}s => %s", p[0], p[1].sort.join(" ")) }.join("\n")
|
||||
end
|
||||
end
|
||||
|
||||
# Installation tasks
|
||||
|
@ -185,6 +185,23 @@ def list_targets? *targets
|
||||
end
|
||||
|
||||
class Rake::Task
|
||||
def mo_all_prerequisites
|
||||
todo = [name]
|
||||
result = []
|
||||
|
||||
while !todo.empty?
|
||||
current = todo.shift
|
||||
prereqs = Rake::Task[current].prerequisites
|
||||
|
||||
next if prereqs.empty?
|
||||
|
||||
result << [current, prereqs]
|
||||
todo += prereqs
|
||||
end
|
||||
|
||||
result.uniq
|
||||
end
|
||||
|
||||
def investigate
|
||||
result = "------------------------------\n"
|
||||
result << "Investigating #{name}\n"
|
||||
|
Loading…
Reference in New Issue
Block a user