Mercurial > hg > graal-jvmci-8
comparison mxtool/mx.py @ 20965:05e1ab8c5c6a
relax expectations on JDK library locations
author | Doug Simon <doug.simon@oracle.com> |
---|---|
date | Wed, 15 Apr 2015 14:06:17 +0200 |
parents | 8dec9eea3186 |
children | b99da6d86cfe |
comparison
equal
deleted
inserted
replaced
20964:56a30cfcefaf | 20965:05e1ab8c5c6a |
---|---|
2095 | 2095 |
2096 def __cmp__(self, other): | 2096 def __cmp__(self, other): |
2097 return cmp(self.parts, other.parts) | 2097 return cmp(self.parts, other.parts) |
2098 | 2098 |
2099 def _filter_non_existant_paths(paths): | 2099 def _filter_non_existant_paths(paths): |
2100 return os.pathsep.join([path for path in _separatedCygpathW2U(paths).split(os.pathsep) if exists(path)]) | 2100 if paths: |
2101 return os.pathsep.join([path for path in _separatedCygpathW2U(paths).split(os.pathsep) if exists(path)]) | |
2102 return None | |
2101 | 2103 |
2102 """ | 2104 """ |
2103 A JavaConfig object encapsulates info on how Java commands are run. | 2105 A JavaConfig object encapsulates info on how Java commands are run. |
2104 """ | 2106 """ |
2105 class JavaConfig: | 2107 class JavaConfig: |
2159 myDir = dirname(__file__) | 2161 myDir = dirname(__file__) |
2160 outDir = join(dirname(__file__), '.jdk' + str(self.version)) | 2162 outDir = join(dirname(__file__), '.jdk' + str(self.version)) |
2161 if not exists(outDir): | 2163 if not exists(outDir): |
2162 os.makedirs(outDir) | 2164 os.makedirs(outDir) |
2163 javaSource = join(myDir, 'ClasspathDump.java') | 2165 javaSource = join(myDir, 'ClasspathDump.java') |
2164 if not exists(join(outDir, 'ClasspathDump.class')): | 2166 javaClass = join(outDir, 'ClasspathDump.class') |
2167 if not exists(javaClass) or getmtime(javaClass) < getmtime(javaSource): | |
2165 subprocess.check_call([self.javac, '-d', _cygpathU2W(outDir), _cygpathU2W(javaSource)], stderr=subprocess.PIPE, stdout=subprocess.PIPE) | 2168 subprocess.check_call([self.javac, '-d', _cygpathU2W(outDir), _cygpathU2W(javaSource)], stderr=subprocess.PIPE, stdout=subprocess.PIPE) |
2166 self._bootclasspath, self._extdirs, self._endorseddirs = [x if x != 'null' else None for x in subprocess.check_output([self.java, '-cp', _cygpathU2W(outDir), 'ClasspathDump'], stderr=subprocess.PIPE).split('|')] | 2169 self._bootclasspath, self._extdirs, self._endorseddirs = [x if x != 'null' else None for x in subprocess.check_output([self.java, '-cp', _cygpathU2W(outDir), 'ClasspathDump'], stderr=subprocess.PIPE).split('|')] |
2167 if not self._bootclasspath or not self._extdirs or not self._endorseddirs: | 2170 if self.javaCompliance <= JavaCompliance('1.8'): |
2168 warn("Could not find all classpaths: boot='" + str(self._bootclasspath) + "' extdirs='" + str(self._extdirs) + "' endorseddirs='" + str(self._endorseddirs) + "'") | 2171 # All 3 system properties accessed by ClasspathDump are expected to exist |
2172 if not self._bootclasspath or not self._extdirs or not self._endorseddirs: | |
2173 warn("Could not find all classpaths: boot='" + str(self._bootclasspath) + "' extdirs='" + str(self._extdirs) + "' endorseddirs='" + str(self._endorseddirs) + "'") | |
2169 self._bootclasspath = _filter_non_existant_paths(self._bootclasspath) | 2174 self._bootclasspath = _filter_non_existant_paths(self._bootclasspath) |
2170 self._extdirs = _filter_non_existant_paths(self._extdirs) | 2175 self._extdirs = _filter_non_existant_paths(self._extdirs) |
2171 self._endorseddirs = _filter_non_existant_paths(self._endorseddirs) | 2176 self._endorseddirs = _filter_non_existant_paths(self._endorseddirs) |
2172 | 2177 |
2173 def __repr__(self): | 2178 def __repr__(self): |
2211 | 2216 |
2212 def endorseddirs(self): | 2217 def endorseddirs(self): |
2213 if self._endorseddirs is None: | 2218 if self._endorseddirs is None: |
2214 self._init_classpaths() | 2219 self._init_classpaths() |
2215 return _separatedCygpathU2W(self._endorseddirs) | 2220 return _separatedCygpathU2W(self._endorseddirs) |
2221 | |
2222 """ | |
2223 Add javadoc style options for the library paths of this JDK. | |
2224 """ | |
2225 def javadocLibOptions(self, args): | |
2226 if args is None: | |
2227 args = [] | |
2228 if self.bootclasspath(): | |
2229 args.append('-bootclasspath') | |
2230 args.append(self.bootclasspath()) | |
2231 if self.endorseddirs(): | |
2232 args.append('-endorseddirs') | |
2233 args.append(self.endorseddirs()) | |
2234 if self.extdirs(): | |
2235 args.append('-extdirs') | |
2236 args.append(self.extdirs()) | |
2237 return args | |
2238 | |
2239 """ | |
2240 Add javac style options for the library paths of this JDK. | |
2241 """ | |
2242 def javacLibOptions(self, args): | |
2243 args = self.javadocLibOptions(args) | |
2244 if self.endorseddirs(): | |
2245 args.append('-endorseddirs') | |
2246 args.append(self.endorseddirs()) | |
2247 return args | |
2216 | 2248 |
2217 def containsJar(self, jar): | 2249 def containsJar(self, jar): |
2218 if self._bootclasspath is None: | 2250 if self._bootclasspath is None: |
2219 self._init_classpaths() | 2251 self._init_classpaths() |
2220 | 2252 |
2445 if not self.jdtJar: | 2477 if not self.jdtJar: |
2446 mainJava = java() | 2478 mainJava = java() |
2447 if not args.error_prone: | 2479 if not args.error_prone: |
2448 javac = args.alt_javac if args.alt_javac else mainJava.javac | 2480 javac = args.alt_javac if args.alt_javac else mainJava.javac |
2449 self.logCompilation('javac' if not args.alt_javac else args.alt_javac) | 2481 self.logCompilation('javac' if not args.alt_javac else args.alt_javac) |
2450 javacCmd = [javac, '-g', '-J-Xmx1g', '-source', compliance, '-target', compliance, '-classpath', cp, '-d', outputDir, '-bootclasspath', jdk.bootclasspath(), '-endorseddirs', jdk.endorseddirs(), '-extdirs', jdk.extdirs()] | 2482 javacCmd = [javac, '-g', '-J-Xmx1g', '-source', compliance, '-target', compliance, '-classpath', cp, '-d', outputDir] |
2483 jdk.javacLibOptions(javacCmd) | |
2451 if jdk.debug_port is not None: | 2484 if jdk.debug_port is not None: |
2452 javacCmd += ['-J-Xdebug', '-J-Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=' + str(jdk.debug_port)] | 2485 javacCmd += ['-J-Xdebug', '-J-Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=' + str(jdk.debug_port)] |
2453 javacCmd += processorArgs | 2486 javacCmd += processorArgs |
2454 javacCmd += ['@' + _cygpathU2W(argfile.name)] | 2487 javacCmd += ['@' + _cygpathU2W(argfile.name)] |
2455 | 2488 |
2457 javacCmd.append('-XDignore.symbol.file') | 2490 javacCmd.append('-XDignore.symbol.file') |
2458 run(javacCmd) | 2491 run(javacCmd) |
2459 else: | 2492 else: |
2460 self.logCompilation('javac (with error-prone)') | 2493 self.logCompilation('javac (with error-prone)') |
2461 javaArgs = ['-Xmx1g'] | 2494 javaArgs = ['-Xmx1g'] |
2462 javacArgs = ['-g', '-source', compliance, '-target', compliance, '-classpath', cp, '-d', outputDir, '-bootclasspath', jdk.bootclasspath(), '-endorseddirs', jdk.endorseddirs(), '-extdirs', jdk.extdirs()] | 2495 javacArgs = ['-g', '-source', compliance, '-target', compliance, '-classpath', cp, '-d', outputDir] |
2496 jdk.javacLibOptions(javacCmd) | |
2463 javacArgs += processorArgs | 2497 javacArgs += processorArgs |
2464 javacArgs += ['@' + argfile.name] | 2498 javacArgs += ['@' + argfile.name] |
2465 if not args.warnAPI: | 2499 if not args.warnAPI: |
2466 javacArgs.append('-XDignore.symbol.file') | 2500 javacArgs.append('-XDignore.symbol.file') |
2467 run_java(javaArgs + ['-cp', os.pathsep.join([mainJava.toolsjar, args.error_prone]), 'com.google.errorprone.ErrorProneCompiler'] + javacArgs) | 2501 run_java(javaArgs + ['-cp', os.pathsep.join([mainJava.toolsjar, args.error_prone]), 'com.google.errorprone.ErrorProneCompiler'] + javacArgs) |
2470 | 2504 |
2471 jdtVmArgs = ['-Xmx1g', '-jar', _cygpathU2W(self.jdtJar)] | 2505 jdtVmArgs = ['-Xmx1g', '-jar', _cygpathU2W(self.jdtJar)] |
2472 | 2506 |
2473 jdtArgs = ['-' + compliance, | 2507 jdtArgs = ['-' + compliance, |
2474 '-cp', cp, '-g', '-enableJavadoc', | 2508 '-cp', cp, '-g', '-enableJavadoc', |
2475 '-d', outputDir, | 2509 '-d', outputDir] |
2476 '-bootclasspath', jdk.bootclasspath(), | 2510 jdk.javacLibOptions(jdtArgs) |
2477 '-endorseddirs', jdk.endorseddirs(), | |
2478 '-extdirs', jdk.extdirs()] | |
2479 jdtArgs += processorArgs | 2511 jdtArgs += processorArgs |
2480 | 2512 |
2481 jdtProperties = join(self.proj.dir, '.settings', 'org.eclipse.jdt.core.prefs') | 2513 jdtProperties = join(self.proj.dir, '.settings', 'org.eclipse.jdt.core.prefs') |
2482 rootJdtProperties = join(self.proj.suite.mxDir, 'eclipse-settings', 'org.eclipse.jdt.core.prefs') | 2514 rootJdtProperties = join(self.proj.suite.mxDir, 'eclipse-settings', 'org.eclipse.jdt.core.prefs') |
2483 if not exists(jdtProperties) or os.path.getmtime(jdtProperties) < os.path.getmtime(rootJdtProperties): | 2515 if not exists(jdtProperties) or os.path.getmtime(jdtProperties) < os.path.getmtime(rootJdtProperties): |
4838 '-classpath', cp, | 4870 '-classpath', cp, |
4839 '-quiet', | 4871 '-quiet', |
4840 '-d', out, | 4872 '-d', out, |
4841 '-overview', overviewFile, | 4873 '-overview', overviewFile, |
4842 '-sourcepath', sp, | 4874 '-sourcepath', sp, |
4843 '-source', str(projectJava.javaCompliance), | 4875 '-source', str(projectJava.javaCompliance)] + |
4844 '-bootclasspath', projectJava.bootclasspath(), | 4876 projectJava.javadocLibOptions() + |
4845 '-extdirs', projectJava.extdirs()] + | |
4846 ([] if projectJava.javaCompliance < JavaCompliance('1.8') else ['-Xdoclint:none']) + | 4877 ([] if projectJava.javaCompliance < JavaCompliance('1.8') else ['-Xdoclint:none']) + |
4847 links + | 4878 links + |
4848 extraArgs + | 4879 extraArgs + |
4849 nowarnAPI + | 4880 nowarnAPI + |
4850 windowTitle + | 4881 windowTitle + |