buildr-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From boisv...@apache.org
Subject svn commit: r616038 - /incubator/buildr/trunk/lib/java/compilers.rb
Date Mon, 28 Jan 2008 20:57:37 GMT
Author: boisvert
Date: Mon Jan 28 12:57:35 2008
New Revision: 616038

URL: http://svn.apache.org/viewvc?rev=616038&view=rev
Log:
Scalac:  Supply REQUIRED dependencies so tests also use scala base libraries.

Modified:
    incubator/buildr/trunk/lib/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=616038&r1=616037&r2=616038&view=diff
==============================================================================
--- incubator/buildr/trunk/lib/java/compilers.rb (original)
+++ incubator/buildr/trunk/lib/java/compilers.rb Mon Jan 28 12:57:35 2008
@@ -89,8 +89,20 @@
     # * :debug       -- Generate debugging info.
     # * :other       -- Array of options to pass to the Scalac compiler as is, e.g. -Xprint-types
     class Scalac < Base
+      class << self
+        def scala_home
+          home = ENV['SCALA_HOME'] or fail 'Missing SCALA_HOME environment variable'
+          fail 'Invalid SCALA_HOME environment variable' unless File.directory?(home)
+          home
+        end
+
+        def dependencies
+          FileList["#{scala_home}/lib/*"]
+        end
+      end
 
       OPTIONS = [:warnings, :deprecation, :optimise, :source, :target, :debug, :other]
+      REQUIRES = Scalac.dependencies
 
       specify :language=>:scala, :target=>'classes', :target_ext=>'class', :packaging=>:jar
 
@@ -104,11 +116,10 @@
 
       def compile(sources, target, dependencies) #:nodoc:
         check_options options, OPTIONS
-        home = ENV['SCALA_HOME'] or fail 'Missing SCALA_HOME environment variable'
-        fail 'Invalid SCALA_HOME environment variable' unless File.directory?(home)
+        home = Scalac.scala_home
 
         cmd_args = []
-        cmd_args << '-cp' << (dependencies + FileList["#{home}/lib/*"]).join(File::PATH_SEPARATOR)
+        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?



Mime
View raw message