Skip to content
This repository has been archived by the owner on Oct 17, 2020. It is now read-only.

Commit

Permalink
Fix issue where .scala files would be passed to javac
Browse files Browse the repository at this point in the history
git-svn-id: https://svn.apache.org/repos/asf/buildr/trunk@819614 13f79535-47bb-0310-9956-ffa450edef68
  • Loading branch information
Alex Boisvert committed Sep 28, 2009
1 parent 87e3321 commit 1bc84f7
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions lib/buildr/scala/compiler.rb
Original file line number Diff line number Diff line change
Expand Up @@ -155,22 +155,23 @@ def compile(sources, target, dependencies) #:nodoc:
end
fail 'Failed to compile, see errors above' if Java.scala.tools.nsc.Main.reporter.hasErrors
end

if java_applies? sources

java_sources = java_sources(sources)
unless java_sources.empty?
trace 'Compiling mixed Java/Scala sources'

# TODO includes scala-compiler.jar
deps = dependencies + Scalac.dependencies + [ File.expand_path(target) ]
@java.compile(sources, target, deps)
@java.compile(java_sources, target, deps)
end
end
end

private
def java_applies?(sources)
not sources.flatten.map { |source| File.directory?(source) ? FileList["#{source}/**/*.java"] : source }.
flatten.reject { |file| File.directory?(file) }.map { |file| File.expand_path(file) }.uniq.empty?

def java_sources(sources)
sources.flatten.map { |source| File.directory?(source) ? FileList["#{source}/**/*.java"] : source } .
flatten.reject { |file| File.directory?(file) || File.extname(file) != 'java' }.map { |file| File.expand_path(file) }.uniq
end

# Returns Scalac command line arguments from the set of options.
Expand Down

0 comments on commit 1bc84f7

Please sign in to comment.