Skip to content

Commit 56d093e

Browse files
committed
Allow the CrazyFun ':run: alias to work with tests and binaries.
We now no longer assume that ':run' implicit targets are definitely tests when delegating down to Buck.
1 parent e59d6c7 commit 56d093e

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

rake-tasks/buck.rb

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,16 @@ def buck(*args, &block)
145145
short = task.name[0..-5]
146146

147147
task.enhance do
148-
Buck::buck_cmd.call('test', short)
148+
# Figure out if this is an executable or a test target.
149+
Buck::buck_cmd.call('query', "#{short} --output-attributes buck.type") do |output|
150+
hash = JSON.parse(output)
151+
type = hash[short]['buck.type']
152+
if type =~ /.*_test/
153+
Buck::buck_cmd.call('test', short)
154+
else
155+
Buck::buck_cmd.call('run', "--verbose 5 #{short}")
156+
end
157+
end
149158
end
150159
end
151160

0 commit comments

Comments
 (0)