Skip to content

Commit 0787083

Browse files
committed
Add the ability to run tests using Buck via CrazyFun
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
1 parent 9865a5f commit 0787083

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

rake-tasks/buck.rb

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ def self.buck_cmd
1212
stdin.close
1313

1414
while line = stderr.gets
15-
if command == 'build'
15+
if command == 'build' || command == 'test'
1616
puts line
1717
end
1818
err += line
@@ -95,11 +95,23 @@ def buck(*args, &block)
9595
Buck::enhance_task(task)
9696
end
9797

98+
rule /\/\/.*:run/ => [ proc {|task_name| task_name[0..-5]} ] do |task|
99+
Buck::enhance_task(task)
100+
101+
short = task.name[0..-5]
102+
103+
task.enhance do
104+
Buck::buck_cmd.call('test', short)
105+
end
106+
end
107+
98108
rule /\/\/.*/ do |task|
99109
# Task is a FileTask, but that's not what we need. Instead, just delegate down to buck in all
100110
# cases where the rule was not created by CrazyFun. Rules created by the "rule" method will
101111
# be a FileTask, whereas those created by CrazyFun are normal rake Tasks.
102112

113+
puts "Making things the old way: #{task.name}"
114+
103115
if task.class == Rake::FileTask && !task.out
104116
task.enhance do
105117
Buck::buck_cmd.call('build', task.name)

0 commit comments

Comments
 (0)