Skip to content

Commit

Permalink
Added recursive dependency reporting
Browse files Browse the repository at this point in the history
  • Loading branch information
Ryan Davis committed Sep 12, 2008
1 parent 9404780 commit bfd65dd
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 6 deletions.
20 changes: 14 additions & 6 deletions rakelib/debug.rake
Expand Up @@ -11,12 +11,12 @@ namespace :debug do


exclude = Regexp.new(args[:exclude]) if args[:exclude] exclude = Regexp.new(args[:exclude]) if args[:exclude]
include = Regexp.new(args[:include]) if args[:exclude] include = Regexp.new(args[:include]) if args[:exclude]
minimum = (args[:minimum] || 0).to_i minimum = (args[:minimum] || 10).to_i


graph = Graph.new graph = Graph.new


Rake::Task.tasks.each do |task| Rake::Task.tasks.each do |task|
next if task.name =~ /^stats|^vm\/.depends.mf$/ # too many next unless task.name =~ /^vm/
next if include and task.name !~ include next if include and task.name !~ include
next if exclude and task.name =~ exclude next if exclude and task.name =~ exclude


Expand All @@ -39,7 +39,7 @@ namespace :debug do
invert_graph.attribs[key] << "color = orange" invert_graph.attribs[key] << "color = orange"
end end
end end

open 'rubinius_tasks.dot', 'w' do |io| io << invert_graph end open 'rubinius_tasks.dot', 'w' do |io| io << invert_graph end
end end


Expand Down Expand Up @@ -73,6 +73,16 @@ namespace :debug do
puts all.join("\n") puts all.join("\n")
end end


def print_deps(task, depth = 0, done = {})
deps = Rake::Task.tasks.select { |t| t.prerequisites.include? task.name }
deps.each do |dep|
next if done[dep.name]
done[dep.name] = true
puts "#{' ' * depth}#{dep.name}"
print_deps(dep, depth+1, done)
end
end

desc "Display tasks that depend on a task" desc "Display tasks that depend on a task"
task :dependees, :task do |_, args| task :dependees, :task do |_, args|
raise "supply task argument" unless args[:task] raise "supply task argument" unless args[:task]
Expand All @@ -81,9 +91,7 @@ namespace :debug do


raise "No such task #{args[:task].inspect}" unless task raise "No such task #{args[:task].inspect}" unless task


tasks = Rake::Task.tasks.select { |t| t.prerequisites.include? task.name } print_deps task

puts tasks.join("\n")
end end


end end
Expand Down
2 changes: 2 additions & 0 deletions rakelib/vm.rake
Expand Up @@ -39,6 +39,8 @@ TYPE_GEN = %w[ vm/gen/includes.hpp
vm/gen/primitives_declare.hpp vm/gen/primitives_declare.hpp
vm/gen/primitives_glue.gen.cpp ] vm/gen/primitives_glue.gen.cpp ]


task :bogo_field_extract => TYPE_GEN

# Files are in order based on dependencies. For example, # Files are in order based on dependencies. For example,
# CompactLookupTable inherits from Tuple, so the header # CompactLookupTable inherits from Tuple, so the header
# for compactlookuptable.hpp has to come after tuple.hpp # for compactlookuptable.hpp has to come after tuple.hpp
Expand Down

0 comments on commit bfd65dd

Please sign in to comment.