You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@buildr.apache.org by as...@apache.org on 2008/01/29 02:26:49 UTC

svn commit: r616130 - in /incubator/buildr/trunk: lib/java/compilers.rb spec/java_compilers.rb

Author: assaf
Date: Mon Jan 28 17:26:47 2008
New Revision: 616130

URL: http://svn.apache.org/viewvc?rev=616130&view=rev
Log:
Minor cleanup for Scalac

Modified:
    incubator/buildr/trunk/lib/java/compilers.rb
    incubator/buildr/trunk/spec/java_compilers.rb

Modified: incubator/buildr/trunk/lib/java/compilers.rb
URL: http://svn.apache.org/viewvc/incubator/buildr/trunk/lib/java/compilers.rb?rev=616130&r1=616129&r2=616130&view=diff
==============================================================================
--- incubator/buildr/trunk/lib/java/compilers.rb (original)
+++ incubator/buildr/trunk/lib/java/compilers.rb Mon Jan 28 17:26:47 2008
@@ -97,12 +97,16 @@
         end
 
         def dependencies
-          FileList["#{scala_home}/lib/*"]
+          FileList["#{scala_home}/lib/*.jar"]
+        end
+
+        def use_fsc
+          !(ENV["USE_FSC"] =~ /^(no|off|false)$/i)
         end
       end
 
       OPTIONS = [:warnings, :deprecation, :optimise, :source, :target, :debug, :other]
-      REQUIRES = Scalac.dependencies
+      Java.classpath << dependencies if ENV['SCALA_HOME']
 
       specify :language=>:scala, :target=>'classes', :target_ext=>'class', :packaging=>:jar
 
@@ -116,11 +120,9 @@
 
       def compile(sources, target, dependencies) #:nodoc:
         check_options options, OPTIONS
-        home = Scalac.scala_home
 
         cmd_args = []
         cmd_args << '-cp' << (dependencies + Scalac.dependencies).join(File::PATH_SEPARATOR)
-        use_fsc = !(ENV["USE_FSC"] =~ /^(no|off|false)$/i)
         source_paths = sources.select { |source| File.directory?(source) }
         cmd_args << '-sourcepath' << source_paths.join(File::PATH_SEPARATOR) unless source_paths.empty?
         cmd_args << '-d' << File.expand_path(target)
@@ -129,8 +131,8 @@
 
         unless Rake.application.options.dryrun
           puts (['scalac'] + cmd_args).join(' ') if Rake.application.options.trace
-          if use_fsc
-            system(([File.expand_path('bin/fsc', home)] + cmd_args).join(' '))
+          if Scalac.use_fsc
+            system(([File.expand_path('bin/fsc', Scalac.scala_home)] + cmd_args).join(' '))
           else
             Java.load
             Java.scala.tools.nsc.Main.main(cmd_args.to_java(Java.java.lang.String)) == 0 or

Modified: incubator/buildr/trunk/spec/java_compilers.rb
URL: http://svn.apache.org/viewvc/incubator/buildr/trunk/spec/java_compilers.rb?rev=616130&r1=616129&r2=616130&view=diff
==============================================================================
--- incubator/buildr/trunk/spec/java_compilers.rb (original)
+++ incubator/buildr/trunk/spec/java_compilers.rb Mon Jan 28 17:26:47 2008
@@ -38,7 +38,8 @@
       package(:jar)
     end
     write 'src/test/DependencyTest.java', 'class DependencyTest { Dependency _var; }'
-    lambda { define('foo').compile.from('src/test').with(project('dependency')).invoke }.should run_task('foo:compile')
+    define('foo').compile.from('src/test').with(project('dependency')).invoke
+    file('target/classes/DependencyTest.class').should exist
   end
 end