Skip to content

Commit 36730d2

Browse files
committed
Fix things so Buck doesn't get added to every target
Oops.
1 parent 3537483 commit 36730d2

File tree

2 files changed

+14
-8
lines changed

2 files changed

+14
-8
lines changed

Rakefile

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,6 @@ Rake.application.instance_variable_set "@name", "go"
1414
orig_verbose = verbose
1515
verbose(false)
1616

17-
# Buck integration
18-
require 'rake-tasks/buck'
19-
2017
# The CrazyFun build grammar. There's no magic here, just ruby
2118
require 'rake-tasks/crazy_fun'
2219
require 'rake-tasks/crazy_fun/mappings/export'
@@ -102,6 +99,11 @@ end
10299
# from rake.
103100
crazy_fun.create_tasks(Dir["**/build.desc"])
104101

102+
# Buck integration. Loaded after CrazyFun has initialized all the tasks it'll handle.
103+
# This is because the buck integration creates a rule for "//.*"
104+
require 'rake-tasks/buck'
105+
106+
105107
# Notice that because we're using rake, anything you can do in a normal rake
106108
# build can also be done here. For example, here we set the default task
107109
task :default => [:test]

rake-tasks/buck.rb

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -96,11 +96,15 @@ def buck(*args, &block)
9696
end
9797

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

101-
task.enhance do
102-
Buck::buck_cmd.call('build', task.name)
103-
end
103+
if task.class == Rake::FileTask && !task.out
104+
task.enhance do
105+
Buck::buck_cmd.call('build', task.name)
106+
end
104107

105-
Buck::enhance_task(task)
108+
Buck::enhance_task(task)
109+
end
106110
end

0 commit comments

Comments
 (0)