You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@buildr.apache.org by bo...@apache.org on 2009/09/28 17:54:44 UTC

svn commit: r819614 - /buildr/trunk/lib/buildr/scala/compiler.rb

Author: boisvert
Date: Mon Sep 28 15:54:44 2009
New Revision: 819614

URL: http://svn.apache.org/viewvc?rev=819614&view=rev
Log:
Fix issue where .scala files would be passed to javac

Modified:
    buildr/trunk/lib/buildr/scala/compiler.rb

Modified: buildr/trunk/lib/buildr/scala/compiler.rb
URL: http://svn.apache.org/viewvc/buildr/trunk/lib/buildr/scala/compiler.rb?rev=819614&r1=819613&r2=819614&view=diff
==============================================================================
--- buildr/trunk/lib/buildr/scala/compiler.rb (original)
+++ buildr/trunk/lib/buildr/scala/compiler.rb Mon Sep 28 15:54:44 2009
@@ -155,22 +155,23 @@
           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.