lib/java/compile.rb in buildr-1.0.0 vs lib/java/compile.rb in buildr-1.1.0
- old
+ new
@@ -47,11 +47,11 @@
OPTIONS = [:warnings, :deprecation, :source, :target, :lint, :debug, :other]
# Generate warnings (opposite of -nowarn).
attr_accessor :warnings
- inherited_attr :warnings, false
+ inherited_attr(:warnings) { verbose }
# Output source locations where deprecated APIs are used.
attr_accessor :deprecation
inherited_attr :deprecation, false
# Provide source compatibility with specified release.
attr_accessor :source
@@ -86,11 +86,11 @@
end
# Returns Javac command line arguments from the set of options.
def javac_args()
args = []
- args << "-nowarn" unless warnings && verbose
+ args << "-nowarn" unless warnings
args << "-verbose" if Rake.application.options.trace
args << "-g" if debug
args << "-deprecation" if deprecation
args << "-source" << source.to_s if source
args << "-target" << target.to_s if target
@@ -538,24 +538,24 @@
resources = Java::ResourcesTask.define_task("resources")
resources.filter.from project.path_to("src/main/resources")
# Compile task requires prepare and performs resources, if anything compiled.
compile = Java::CompileTask.define_task("compile"=>[prepare, resources])
project.path_to("src/main/java").tap { |dir| compile.from dir if File.exist?(dir) }
- compile.into project.path_to("target/classes")
+ compile.into project.path_to(:target, "classes")
resources.filter.into project.compile.target
Java::JavadocTask.define_task("javadoc"=>prepare).tap do |javadoc|
- javadoc.into project.path_to("target/javadoc")
+ javadoc.into project.path_to(:target, "javadoc")
javadoc.using :windowtitle=>project.comment || project.name
end
project.recursive_task("compile")
- project.clean { verbose(false) { rm_rf project.path_to("target") } }
project.enhance do |project|
# This comes last because the target path may change.
project.build project.compile.target
# This comes last so we can determine all the source paths and classpath dependencies.
project.javadoc.from project
+ project.clean { verbose(false) { rm_rf project.compile.target.to_s } }
end
end
class Options
@@ -567,10 +567,13 @@
# rake build DEBUG=no
#
# The release tasks runs a build with <tt>DEBUG=no</tt>.
attr_accessor :debug
- end
+ def debug()
+ @debug = (ENV["DEBUG"] || ENV["debug"]) !~ /(no|off|false)/ if @debug.nil?
+ @debug
+ end
- options.debug = (ENV["DEBUG"] || ENV["debug"]) !~ /(no|off|false)/
+ end
end