changeset 14915:32121774dfea

When building with javac, use the one from JAVA_HOME but set the booclasspath, extdirs and endorseddirs to the correct JDK for cross-compilation.
author Gilles Duboscq <duboscq@ssw.jku.at>
date Tue, 01 Apr 2014 16:22:05 +0200
parents a6bd486b1b44
children 66e9855f4ae8
files mxtool/mx.py
diffstat 1 files changed, 4 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/mxtool/mx.py	Tue Apr 01 16:21:49 2014 +0200
+++ b/mxtool/mx.py	Tue Apr 01 16:22:05 2014 +0200
@@ -1866,9 +1866,10 @@
         toBeDeleted = [argfileName]
         try:
             if not jdtJar:
+                mainJava = java()
                 if not args.error_prone:
                     log('Compiling Java sources for {0} with javac...'.format(p.name))
-                    javacCmd = [jdk.javac, '-g', '-J-Xmx1g', '-source', compliance, '-target', compliance, '-classpath', cp, '-d', outputDir]
+                    javacCmd = [mainJava.javac, '-g', '-J-Xmx1g', '-source', compliance, '-target', compliance, '-classpath', cp, '-d', outputDir, '-bootclasspath', jdk.bootclasspath(), '-endorseddirs', jdk.endorseddirs(), '-extdirs', jdk.extdirs()]
                     if jdk.debug_port is not None:
                         javacCmd += ['-J-Xdebug', '-J-Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=' + str(jdk.debug_port)]
                     javacCmd += processorArgs
@@ -1880,12 +1881,12 @@
                 else:
                     log('Compiling Java sources for {0} with javac (with error-prone)...'.format(p.name))
                     javaArgs = ['-Xmx1g']
-                    javacArgs = ['-g', '-source', compliance, '-target', compliance, '-classpath', cp, '-d', outputDir]
+                    javacArgs = ['-g', '-source', compliance, '-target', compliance, '-classpath', cp, '-d', outputDir, '-bootclasspath', jdk.bootclasspath(), '-endorseddirs', jdk.endorseddirs(), '-extdirs', jdk.extdirs()]
                     javacArgs += processorArgs
                     javacArgs += ['@' + argfile.name]
                     if not args.warnAPI:
                         javacArgs.append('-XDignore.symbol.file')
-                    run_java(javaArgs + ['-cp', os.pathsep.join([jdk.toolsjar, args.error_prone]), 'com.google.errorprone.ErrorProneCompiler'] + javacArgs, javaConfig=jdk)
+                    run_java(javaArgs + ['-cp', os.pathsep.join([mainJava.toolsjar, args.error_prone]), 'com.google.errorprone.ErrorProneCompiler'] + javacArgs)
             else:
                 log('Compiling Java sources for {0} with JDT...'.format(p.name))