Skip to content
Newer
Older
100644 57 lines (38 sloc) 1.41 KB
72ad3d4 @drbrain Hook up more dependencies in vm.rake, especially for generated files.
drbrain authored Jul 31, 2008
1 namespace :debug do
2
3 desc "Create a dot graph of the Rakefile's dependencies. Use :exclude to exclude rules and dependencies."
4 task :graph, :exclude, :filter do |_, args|
5 begin
6 require 'graph'
7 rescue LoadError
8 abort 'install ZenHacks'
9 end
10
11 exclude = /#{args[:exclude]}/ if args[:exclude]
12
13 graph = Graph.new
14 graph.prefix << 'rankdir="LR"'
15
16 Rake::Task.tasks.each do |task|
17 next if task.name =~ /^stats|^vm\/.depends.mf$/ # too many
18 next if exclude and task.name =~ exclude
19
20 prereqs = task.prerequisites
21 prereqs = prereqs.reject do |prereq|
22 prereq =~ exclude
23 end if exclude
24
25 graph[task.name] = prereqs
26 end
27
28 open 'rubinius_tasks.dot', 'w' do |io| io << graph end
29 end
30
31 desc "Display prerequisites for a task"
32 task :prereqs, :task do |_, args|
33 raise "supply task argument" unless args[:task]
34
35 task = Rake::Task.tasks.find { |t| t.name == args[:task] }
36
37 raise "No such task #{args[:task].inspect}" unless task
38
39 puts task.prerequisites.join(', ')
40 end
41
42 desc "Display tasks that depend on a task"
43 task :dependees, :task do |_, args|
44 raise "supply task argument" unless args[:task]
45
46 task = Rake::Task.tasks.find { |t| t.name == args[:task] }
47
48 raise "No such task #{args[:task].inspect}" unless task
49
50 tasks = Rake::Task.tasks.select { |t| t.prerequisites.include? task.name }
51
52 puts tasks.join(', ')
53 end
54
55 end
56
Something went wrong with that request. Please try again.