I'm running buildr 1.2.10 against a project that contains
package-info.java files. The Java compiler happily ignores them
although comments in them are later incorporated into javadoc.
The problem is that the CompileTask is always considered necessary
(always rebuilds) because there aren't .class files to match the
package-info.java files. I'm new to buildr/ruby so I'm far from sure
this is the best solution to problem, but here is one:
----------------------------------------------------------------
class Buildr::Java::CompileTask
def valid_class_file?(c) #:nodoc:
not File.basename(c).include? '-' # no package-info.class, for example
end
def needed?() #:nodoc:
return false if source_files.empty?
return true unless File.exist?(target.to_s)
compiled_source_files = []
source_files.each do |j, c|
compiled_source_files << [j, c] if valid_class_file? c
end
return true if compiled_source_files.any? { |j, c| !File.exist?(c)
|| File.stat(j).mtime > File.stat(c).time }
oldest = compiled_source_files.map { |j, c| File.stat(c).mtime }.min
return classpath.any? { |path| application[path].timestamp > oldest }
end
end
----------------------------------------------------------------
Does this or something it like seem like an appropriate change to make
down at the task level (rather than mucking with source file filtering
in all buildfiles)? If so (Assaf and company), would this be more
welcome as a patch? :)
Mike
|