lib/core/build.rb in buildr-1.0.0 vs lib/core/build.rb in buildr-1.1.0
- old
+ new
@@ -50,10 +50,21 @@
task("parallel") { Buildr.options.parallel = true }
class Project
+ # The target directory. By default, it's the target directory inside the project. Various tasks
+ # use it to determine where to place files, e.g. when compiling or packaging. The clean task
+ # nukes it.
+ def target()
+ @target ||= _("target")
+ end
+
+ def target=(dir)
+ @target = _(dir)
+ end
+
# :call-seq:
# build(*prereqs) => task
# build { |task| .. } => task
#
# Returns the project's build task. With arguments or block, also enhances that task.
@@ -68,9 +79,13 @@
# Returns the project's clean task. With arguments or block, also enhances that task.
def clean(*prereqs, &block)
task("clean").enhance prereqs, &block
end
+ end
+
+ Project.on_define do |project|
+ project.clean { verbose(false) { rm_rf project.path_to(:target) } }
end
desc "The default task it build"
task "default"=>"build"