Skip to content

Commit

Permalink
Add the ability to run tests using Buck via CrazyFun
Browse files Browse the repository at this point in the history
We make the assumption that ':run' means "run a test", which
is not always true. To test:

  ./go //java/client/test/org/openqa/selenium/htmlunit:htmlunit:run
  • Loading branch information
shs96c committed Apr 21, 2016
1 parent 9865a5f commit 0787083
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion rake-tasks/buck.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ def self.buck_cmd
stdin.close

while line = stderr.gets
if command == 'build'
if command == 'build' || command == 'test'
puts line
end
err += line
Expand Down Expand Up @@ -95,11 +95,23 @@ def buck(*args, &block)
Buck::enhance_task(task)
end

rule /\/\/.*:run/ => [ proc {|task_name| task_name[0..-5]} ] do |task|
Buck::enhance_task(task)

short = task.name[0..-5]

task.enhance do
Buck::buck_cmd.call('test', short)
end
end

rule /\/\/.*/ do |task|
# Task is a FileTask, but that's not what we need. Instead, just delegate down to buck in all
# cases where the rule was not created by CrazyFun. Rules created by the "rule" method will
# be a FileTask, whereas those created by CrazyFun are normal rake Tasks.

puts "Making things the old way: #{task.name}"

if task.class == Rake::FileTask && !task.out
task.enhance do
Buck::buck_cmd.call('build', task.name)
Expand Down

0 comments on commit 0787083

Please sign in to comment.