lib/java/compile.rb in buildr-0.15.0 vs lib/java/compile.rb in buildr-0.16.0
- old
+ new
@@ -98,11 +98,11 @@
# Do we have any files to compile?
if target && files.empty?
puts "All source files are up to date" if Rake.application.options.trace && !sources.empty?
elsif target
mkpath target, :verbose=>false
- Java.javac files, :sourcepath=>sourcepath, :classpath=>classpath,
+ Java.javac files, :sourcepath=>sourcepath, :classpath=>real_classpath,
:output=>target, :javac_args=>options.javac_args, :name=>task.name
# By touching the target we let other tasks know we did something,
# and also prevent recompiling again for classpath dependencies.
touch target, :verbose=>false
end
@@ -174,10 +174,14 @@
# Returns true if any classes were compiled.
def compiled?()
@files && !@files.empty?
end
+ def timestamp()
+ File.exist?(target) ? File.stat(target).mtime : Rake::EARLY
+ end
+
protected
# Returns the real classpath. Uses the values of #classpath, but resolves
# artifact specifications, projects and other conveniences, executes tasks
# (see #sanitize) and returns a compact array of unique file names.
@@ -293,23 +297,24 @@
end
end
- Project.on_create do |project|
+ Project.on_define do |project|
# Prepare is prerequisite for compile, resources follows compile.
project.compile.enhance([project.prepare]) { |task| project.resources.invoke }
project.recursive_task("compile")
task("build").enhance [ project.compile ]
task("clean") { rm_rf project.path_to(:target_dir), :verbose=>false }
- project.enhance do |project|
+ project.after_block do |project|
# Automagic compilation only if the source directory exists.
project.compile.sources << project.path_to(:java_src_dir) if File.exist?(project.path_to(:java_src_dir))
project.compile.target ||= project.path_to(:java_target_dir)
project.resources.include project.path_to(:resources_dir, "*") if File.exist?(project.path_to(:resources_dir))
project.resources.target ||= project.compile.target
- file(project.compile.target).enhance([ project.compile, project.resources ])
+ file(project.compile.target).enhance [ project.compile ]
+ file(project.resources.target).enhance [ project.resources ]
end
end
end