You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@buildr.apache.org by do...@apache.org on 2012/12/11 21:24:04 UTC

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

Author: donaldp
Date: Tue Dec 11 20:24:03 2012
New Revision: 1420385

URL: http://svn.apache.org/viewvc?rev=1420385&view=rev
Log:
The scala zinc compiler will throw ClassNotFound errors when loaded into the same JVM as modern jruby. Avoid this scenario by forking the compile.

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=1420385&r1=1420384&r2=1420385&view=diff
==============================================================================
--- buildr/trunk/lib/buildr/scala/compiler.rb (original)
+++ buildr/trunk/lib/buildr/scala/compiler.rb Tue Dec 11 20:24:03 2012
@@ -140,7 +140,7 @@ module Buildr::Scala
 
         zinc_dependencies = ZINC_REQUIRES.artifacts.map(&:to_s)
 
-        scala_dependencies + zinc_dependencies
+        (scala_dependencies + zinc_dependencies).compact
       end
 
       def use_fsc
@@ -239,8 +239,6 @@ module Buildr::Scala
 
     def compile_with_zinc(sources, target, dependencies) #:nodoc:
 
-      java_sources = java_sources(sources)
-
       dependencies.unshift target
 
       cmd_args = []
@@ -262,9 +260,8 @@ module Buildr::Scala
       unless Buildr.application.options.dryrun
         trace((['com.typesafe.zinc.Main.main'] + cmd_args).join(' '))
 
-        Java.load
         begin
-          Java.com.typesafe.zinc.Main.main(cmd_args.to_java(Java.java.lang.String))
+          Java::Commands.java 'com.typesafe.zinc.Main', *(cmd_args + [{ :classpath => Scalac.dependencies}])
         rescue => e
           fail "Zinc compiler crashed:\n#{e.inspect}\n#{e.backtrace.join("\n")}"
         end