Mercurial > hg > graal-jvmci-8
comparison mxtool/mx.py @ 20983:b99da6d86cfe
relax expectations on JDK library locations (bug fixes)
author | Doug Simon <doug.simon@oracle.com> |
---|---|
date | Wed, 15 Apr 2015 21:35:51 +0200 |
parents | 05e1ab8c5c6a |
children | 5ea65fe64368 |
comparison
equal
deleted
inserted
replaced
20982:23d6b95bd687 | 20983:b99da6d86cfe |
---|---|
2113 self.javac = exe_suffix(join(self.jdk, 'bin', 'javac')) | 2113 self.javac = exe_suffix(join(self.jdk, 'bin', 'javac')) |
2114 self.javap = exe_suffix(join(self.jdk, 'bin', 'javap')) | 2114 self.javap = exe_suffix(join(self.jdk, 'bin', 'javap')) |
2115 self.javadoc = exe_suffix(join(self.jdk, 'bin', 'javadoc')) | 2115 self.javadoc = exe_suffix(join(self.jdk, 'bin', 'javadoc')) |
2116 self.pack200 = exe_suffix(join(self.jdk, 'bin', 'pack200')) | 2116 self.pack200 = exe_suffix(join(self.jdk, 'bin', 'pack200')) |
2117 self.toolsjar = join(self.jdk, 'lib', 'tools.jar') | 2117 self.toolsjar = join(self.jdk, 'lib', 'tools.jar') |
2118 self._classpaths_initialized = False | |
2118 self._bootclasspath = None | 2119 self._bootclasspath = None |
2119 self._extdirs = None | 2120 self._extdirs = None |
2120 self._endorseddirs = None | 2121 self._endorseddirs = None |
2121 | 2122 |
2122 if not exists(self.java): | 2123 if not exists(self.java): |
2156 | 2157 |
2157 if self.debug_port is not None: | 2158 if self.debug_port is not None: |
2158 self.java_args += ['-Xdebug', '-Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=' + str(self.debug_port)] | 2159 self.java_args += ['-Xdebug', '-Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=' + str(self.debug_port)] |
2159 | 2160 |
2160 def _init_classpaths(self): | 2161 def _init_classpaths(self): |
2161 myDir = dirname(__file__) | 2162 if not self._classpaths_initialized: |
2162 outDir = join(dirname(__file__), '.jdk' + str(self.version)) | 2163 myDir = dirname(__file__) |
2163 if not exists(outDir): | 2164 outDir = join(dirname(__file__), '.jdk' + str(self.version)) |
2164 os.makedirs(outDir) | 2165 if not exists(outDir): |
2165 javaSource = join(myDir, 'ClasspathDump.java') | 2166 os.makedirs(outDir) |
2166 javaClass = join(outDir, 'ClasspathDump.class') | 2167 javaSource = join(myDir, 'ClasspathDump.java') |
2167 if not exists(javaClass) or getmtime(javaClass) < getmtime(javaSource): | 2168 javaClass = join(outDir, 'ClasspathDump.class') |
2168 subprocess.check_call([self.javac, '-d', _cygpathU2W(outDir), _cygpathU2W(javaSource)], stderr=subprocess.PIPE, stdout=subprocess.PIPE) | 2169 if not exists(javaClass) or getmtime(javaClass) < getmtime(javaSource): |
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('|')] | 2170 subprocess.check_call([self.javac, '-d', _cygpathU2W(outDir), _cygpathU2W(javaSource)], stderr=subprocess.PIPE, stdout=subprocess.PIPE) |
2170 if self.javaCompliance <= JavaCompliance('1.8'): | 2171 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('|')] |
2171 # All 3 system properties accessed by ClasspathDump are expected to exist | 2172 if self.javaCompliance <= JavaCompliance('1.8'): |
2172 if not self._bootclasspath or not self._extdirs or not self._endorseddirs: | 2173 # All 3 system properties accessed by ClasspathDump are expected to exist |
2173 warn("Could not find all classpaths: boot='" + str(self._bootclasspath) + "' extdirs='" + str(self._extdirs) + "' endorseddirs='" + str(self._endorseddirs) + "'") | 2174 if not self._bootclasspath or not self._extdirs or not self._endorseddirs: |
2174 self._bootclasspath = _filter_non_existant_paths(self._bootclasspath) | 2175 warn("Could not find all classpaths: boot='" + str(self._bootclasspath) + "' extdirs='" + str(self._extdirs) + "' endorseddirs='" + str(self._endorseddirs) + "'") |
2175 self._extdirs = _filter_non_existant_paths(self._extdirs) | 2176 self._bootclasspath = _filter_non_existant_paths(self._bootclasspath) |
2176 self._endorseddirs = _filter_non_existant_paths(self._endorseddirs) | 2177 self._extdirs = _filter_non_existant_paths(self._extdirs) |
2178 self._endorseddirs = _filter_non_existant_paths(self._endorseddirs) | |
2179 self._classpaths_initialized = True | |
2177 | 2180 |
2178 def __repr__(self): | 2181 def __repr__(self): |
2179 return "JavaConfig(" + str(self.jdk) + ", " + str(self.debug_port) + ")" | 2182 return "JavaConfig(" + str(self.jdk) + ", " + str(self.debug_port) + ")" |
2180 | 2183 |
2181 def __str__(self): | 2184 def __str__(self): |
2203 | 2206 |
2204 def processArgs(self, args): | 2207 def processArgs(self, args): |
2205 return self.java_args_pfx + self.java_args + self.java_args_sfx + args | 2208 return self.java_args_pfx + self.java_args + self.java_args_sfx + args |
2206 | 2209 |
2207 def bootclasspath(self): | 2210 def bootclasspath(self): |
2208 if self._bootclasspath is None: | 2211 self._init_classpaths() |
2209 self._init_classpaths() | |
2210 return _separatedCygpathU2W(self._bootclasspath) | 2212 return _separatedCygpathU2W(self._bootclasspath) |
2211 | 2213 |
2212 def extdirs(self): | |
2213 if self._extdirs is None: | |
2214 self._init_classpaths() | |
2215 return _separatedCygpathU2W(self._extdirs) | |
2216 | |
2217 def endorseddirs(self): | |
2218 if self._endorseddirs is None: | |
2219 self._init_classpaths() | |
2220 return _separatedCygpathU2W(self._endorseddirs) | |
2221 | 2214 |
2222 """ | 2215 """ |
2223 Add javadoc style options for the library paths of this JDK. | 2216 Add javadoc style options for the library paths of this JDK. |
2224 """ | 2217 """ |
2225 def javadocLibOptions(self, args): | 2218 def javadocLibOptions(self, args): |
2219 self._init_classpaths() | |
2226 if args is None: | 2220 if args is None: |
2227 args = [] | 2221 args = [] |
2228 if self.bootclasspath(): | 2222 if self._bootclasspath: |
2229 args.append('-bootclasspath') | 2223 args.append('-bootclasspath') |
2230 args.append(self.bootclasspath()) | 2224 args.append(self._bootclasspath) |
2231 if self.endorseddirs(): | 2225 if self._extdirs: |
2232 args.append('-endorseddirs') | |
2233 args.append(self.endorseddirs()) | |
2234 if self.extdirs(): | |
2235 args.append('-extdirs') | 2226 args.append('-extdirs') |
2236 args.append(self.extdirs()) | 2227 args.append(self._extdirs) |
2237 return args | 2228 return args |
2238 | 2229 |
2239 """ | 2230 """ |
2240 Add javac style options for the library paths of this JDK. | 2231 Add javac style options for the library paths of this JDK. |
2241 """ | 2232 """ |
2242 def javacLibOptions(self, args): | 2233 def javacLibOptions(self, args): |
2243 args = self.javadocLibOptions(args) | 2234 args = self.javadocLibOptions(args) |
2244 if self.endorseddirs(): | 2235 if self._endorseddirs: |
2245 args.append('-endorseddirs') | 2236 args.append('-endorseddirs') |
2246 args.append(self.endorseddirs()) | 2237 args.append(self._endorseddirs) |
2247 return args | 2238 return args |
2248 | 2239 |
2249 def containsJar(self, jar): | 2240 def containsJar(self, jar): |
2250 if self._bootclasspath is None: | 2241 self._init_classpaths() |
2251 self._init_classpaths() | 2242 |
2252 | 2243 if self._bootclasspath: |
2253 for e in self._bootclasspath.split(os.pathsep): | 2244 for e in self._bootclasspath.split(os.pathsep): |
2254 if basename(e) == jar: | 2245 if basename(e) == jar: |
2255 return True | 2246 return True |
2256 for d in self._extdirs.split(os.pathsep): | 2247 if self._extdirs: |
2257 if len(d) and jar in os.listdir(d): | 2248 for d in self._extdirs.split(os.pathsep): |
2258 return True | 2249 if len(d) and jar in os.listdir(d): |
2259 for d in self._endorseddirs.split(os.pathsep): | 2250 return True |
2260 if len(d) and jar in os.listdir(d): | 2251 if self._endorseddirs: |
2261 return True | 2252 for d in self._endorseddirs.split(os.pathsep): |
2253 if len(d) and jar in os.listdir(d): | |
2254 return True | |
2262 return False | 2255 return False |
2263 | 2256 |
2264 def check_get_env(key): | 2257 def check_get_env(key): |
2265 """ | 2258 """ |
2266 Gets an environment variable, aborting with a useful message if it is not set. | 2259 Gets an environment variable, aborting with a useful message if it is not set. |
4871 '-quiet', | 4864 '-quiet', |
4872 '-d', out, | 4865 '-d', out, |
4873 '-overview', overviewFile, | 4866 '-overview', overviewFile, |
4874 '-sourcepath', sp, | 4867 '-sourcepath', sp, |
4875 '-source', str(projectJava.javaCompliance)] + | 4868 '-source', str(projectJava.javaCompliance)] + |
4876 projectJava.javadocLibOptions() + | 4869 projectJava.javadocLibOptions([]) + |
4877 ([] if projectJava.javaCompliance < JavaCompliance('1.8') else ['-Xdoclint:none']) + | 4870 ([] if projectJava.javaCompliance < JavaCompliance('1.8') else ['-Xdoclint:none']) + |
4878 links + | 4871 links + |
4879 extraArgs + | 4872 extraArgs + |
4880 nowarnAPI + | 4873 nowarnAPI + |
4881 windowTitle + | 4874 windowTitle + |