Skip to content

Commit

Permalink
Fix things so Buck doesn't get added to every target
Browse files Browse the repository at this point in the history
Oops.
  • Loading branch information
shs96c committed Apr 21, 2016
1 parent 3537483 commit 36730d2
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 8 deletions.
8 changes: 5 additions & 3 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,6 @@ Rake.application.instance_variable_set "@name", "go"
orig_verbose = verbose
verbose(false)

# Buck integration
require 'rake-tasks/buck'

# The CrazyFun build grammar. There's no magic here, just ruby
require 'rake-tasks/crazy_fun'
require 'rake-tasks/crazy_fun/mappings/export'
Expand Down Expand Up @@ -102,6 +99,11 @@ end
# from rake.
crazy_fun.create_tasks(Dir["**/build.desc"])

# Buck integration. Loaded after CrazyFun has initialized all the tasks it'll handle.
# This is because the buck integration creates a rule for "//.*"
require 'rake-tasks/buck'


# Notice that because we're using rake, anything you can do in a normal rake
# build can also be done here. For example, here we set the default task
task :default => [:test]
Expand Down
14 changes: 9 additions & 5 deletions rake-tasks/buck.rb
Original file line number Diff line number Diff line change
Expand Up @@ -96,11 +96,15 @@ def buck(*args, &block)
end

rule /\/\/.*/ do |task|
# Task is a FileTask, but that's not what we need. Instead, just delegate down to buck in all cases
# 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.

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

Buck::enhance_task(task)
Buck::enhance_task(task)
end
end

0 comments on commit 36730d2

Please sign in to comment.