Author: lacton
Date: Sat Sep 13 05:21:06 2008
New Revision: 694936

URL: http://svn.apache.org/viewvc?rev=694936&view=rev
Log:
Quick fix so that javac is called with tools.jar in its classpath (there is 
some code duplication, refactoring is coming next)

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

Modified: incubator/buildr/trunk/lib/buildr/java/compilers.rb
URL: 
http://svn.apache.org/viewvc/incubator/buildr/trunk/lib/buildr/java/compilers.rb?rev=694936&r1=694935&r2=694936&view=diff
==============================================================================
--- incubator/buildr/trunk/lib/buildr/java/compilers.rb (original)
+++ incubator/buildr/trunk/lib/buildr/java/compilers.rb Sat Sep 13 05:21:06 2008
@@ -54,7 +54,13 @@
       def compile(sources, target, dependencies) #:nodoc:
         check_options options, OPTIONS
         cmd_args = []
-        dependencies << Java.tools_jar
+        # Most platforms requires tools.jar to be on the classpath, tools.jar 
contains the
+        # Java compiler (OS X and AIX are two exceptions we know about, may be 
more).
+        # Guess where tools.jar is from JAVA_HOME, which hopefully points to 
the JDK,
+        # but maybe the JRE.
+        tools_jar = [File.expand_path('lib/tools.jar', ENV['JAVA_HOME']), 
File.expand_path('../lib/tools.jar', ENV['JAVA_HOME'])].
+          find { |path| File.exist?(path) }
+        dependencies << tools_jar if File.exist?(tools_jar)
         cmd_args << '-classpath' << dependencies.join(File::PATH_SEPARATOR) 
unless dependencies.empty?
         source_paths = sources.select { |source| File.directory?(source) }
         cmd_args << '-sourcepath' << source_paths.join(File::PATH_SEPARATOR) 
unless source_paths.empty?


Reply via email to