Mercurial > hg > graal-jvmci-8
comparison mxtool/mx.py @ 14913:2d1cc640512c
Add possibility to build using error-prone instead of javac.
author | Gilles Duboscq <duboscq@ssw.jku.at> |
---|---|
date | Fri, 28 Mar 2014 10:46:48 +0100 |
parents | 7683ad455d81 |
children | a6bd486b1b44 |
comparison
equal
deleted
inserted
replaced
14912:898e6a259f67 | 14913:2d1cc640512c |
---|---|
1124 if java.javaCompliance == requiredCompliance: | 1124 if java.javaCompliance == requiredCompliance: |
1125 return java | 1125 return java |
1126 return None | 1126 return None |
1127 | 1127 |
1128 | 1128 |
1129 def run_java(args, nonZeroIsFatal=True, out=None, err=None, cwd=None, addDefaultArgs=True): | 1129 def run_java(args, nonZeroIsFatal=True, out=None, err=None, cwd=None, addDefaultArgs=True, javaConfig=None): |
1130 return run(java().format_cmd(args, addDefaultArgs), nonZeroIsFatal=nonZeroIsFatal, out=out, err=err, cwd=cwd) | 1130 if not javaConfig: |
1131 javaConfig = java() | |
1132 return run(javaConfig.format_cmd(args, addDefaultArgs), nonZeroIsFatal=nonZeroIsFatal, out=out, err=err, cwd=cwd) | |
1131 | 1133 |
1132 def _kill_process_group(pid, sig): | 1134 def _kill_process_group(pid, sig): |
1133 if not sig: | 1135 if not sig: |
1134 sig = signal.SIGKILL | 1136 sig = signal.SIGKILL |
1135 pgid = os.getpgid(pid) | 1137 pgid = os.getpgid(pid) |
1386 self.jar = exe_suffix(join(self.jdk, 'bin', 'jar')) | 1388 self.jar = exe_suffix(join(self.jdk, 'bin', 'jar')) |
1387 self.java = exe_suffix(join(self.jdk, 'bin', 'java')) | 1389 self.java = exe_suffix(join(self.jdk, 'bin', 'java')) |
1388 self.javac = exe_suffix(join(self.jdk, 'bin', 'javac')) | 1390 self.javac = exe_suffix(join(self.jdk, 'bin', 'javac')) |
1389 self.javap = exe_suffix(join(self.jdk, 'bin', 'javap')) | 1391 self.javap = exe_suffix(join(self.jdk, 'bin', 'javap')) |
1390 self.javadoc = exe_suffix(join(self.jdk, 'bin', 'javadoc')) | 1392 self.javadoc = exe_suffix(join(self.jdk, 'bin', 'javadoc')) |
1393 self.toolsjar = join(self.jdk, 'lib', 'tools.jar') | |
1391 self._bootclasspath = None | 1394 self._bootclasspath = None |
1392 | 1395 |
1393 if not exists(self.java): | 1396 if not exists(self.java): |
1394 abort('Java launcher does not exist: ' + self.java) | 1397 abort('Java launcher does not exist: ' + self.java) |
1395 | 1398 |
1675 parser.add_argument('--no-java', action='store_false', dest='java', help='do not build Java projects') | 1678 parser.add_argument('--no-java', action='store_false', dest='java', help='do not build Java projects') |
1676 parser.add_argument('--no-native', action='store_false', dest='native', help='do not build native projects') | 1679 parser.add_argument('--no-native', action='store_false', dest='native', help='do not build native projects') |
1677 parser.add_argument('--force-javac', action='store_true', dest='javac', help='use javac despite ecj.jar is found or not') | 1680 parser.add_argument('--force-javac', action='store_true', dest='javac', help='use javac despite ecj.jar is found or not') |
1678 parser.add_argument('--jdt', help='path to ecj.jar, the Eclipse batch compiler (default: ' + defaultEcjPath + ')', default=defaultEcjPath, metavar='<path>') | 1681 parser.add_argument('--jdt', help='path to ecj.jar, the Eclipse batch compiler (default: ' + defaultEcjPath + ')', default=defaultEcjPath, metavar='<path>') |
1679 parser.add_argument('--jdt-warning-as-error', action='store_true', help='convert all Eclipse batch compiler warnings to errors') | 1682 parser.add_argument('--jdt-warning-as-error', action='store_true', help='convert all Eclipse batch compiler warnings to errors') |
1683 parser.add_argument('--error-prone', dest='error_prone', help='path to error-prone.jar', metavar='<path>') | |
1680 | 1684 |
1681 if suppliedParser: | 1685 if suppliedParser: |
1682 parser.add_argument('remainder', nargs=REMAINDER, metavar='...') | 1686 parser.add_argument('remainder', nargs=REMAINDER, metavar='...') |
1683 | 1687 |
1684 args = parser.parse_args(args) | 1688 args = parser.parse_args(args) |
1855 else: | 1859 else: |
1856 processorArgs += ['-proc:none'] | 1860 processorArgs += ['-proc:none'] |
1857 | 1861 |
1858 toBeDeleted = [argfileName] | 1862 toBeDeleted = [argfileName] |
1859 try: | 1863 try: |
1860 if jdtJar is None: | 1864 if not jdtJar: |
1861 log('Compiling Java sources for {0} with javac...'.format(p.name)) | 1865 if not args.error_prone: |
1862 javacCmd = [jdk.javac, '-g', '-J-Xmx1g', '-source', compliance, '-target', compliance, '-classpath', cp, '-d', outputDir] | 1866 log('Compiling Java sources for {0} with javac...'.format(p.name)) |
1863 if jdk.debug_port is not None: | 1867 javacCmd = [jdk.javac, '-g', '-J-Xmx1g', '-source', compliance, '-target', compliance, '-classpath', cp, '-d', outputDir] |
1864 javacCmd += ['-J-Xdebug', '-J-Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=' + str(jdk.debug_port)] | 1868 if jdk.debug_port is not None: |
1865 javacCmd += processorArgs | 1869 javacCmd += ['-J-Xdebug', '-J-Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=' + str(jdk.debug_port)] |
1866 javacCmd += ['@' + argfile.name] | 1870 javacCmd += processorArgs |
1867 | 1871 javacCmd += ['@' + argfile.name] |
1868 if not args.warnAPI: | 1872 |
1869 javacCmd.append('-XDignore.symbol.file') | 1873 if not args.warnAPI: |
1870 run(javacCmd) | 1874 javacCmd.append('-XDignore.symbol.file') |
1875 run(javacCmd) | |
1876 else: | |
1877 log('Compiling Java sources for {0} with javac (with error-prone)...'.format(p.name)) | |
1878 javaArgs = ['-Xmx1g'] | |
1879 javacArgs = ['-g', '-source', compliance, '-target', compliance, '-classpath', cp, '-d', outputDir] | |
1880 javacArgs += processorArgs | |
1881 javacArgs += ['@' + argfile.name] | |
1882 if not args.warnAPI: | |
1883 javacArgs.append('-XDignore.symbol.file') | |
1884 run_java(javaArgs + ['-cp', os.pathsep.join([jdk.toolsjar, args.error_prone]), 'com.google.errorprone.ErrorProneCompiler'] + javacArgs, javaConfig=jdk) | |
1871 else: | 1885 else: |
1872 log('Compiling Java sources for {0} with JDT...'.format(p.name)) | 1886 log('Compiling Java sources for {0} with JDT...'.format(p.name)) |
1873 | 1887 |
1874 jdtArgs = [jdk.java, '-Xmx1g'] | 1888 jdtArgs = [jdk.java, '-Xmx1g'] |
1875 if jdk.debug_port is not None: | 1889 if jdk.debug_port is not None: |