Mercurial > hg > graal-jvmci-8
comparison mxtool/mx.py @ 7916:9bff64f43299
Better java version numbers support in mx
author | Gilles Duboscq <duboscq@ssw.jku.at> |
---|---|
date | Mon, 04 Mar 2013 09:48:14 +0100 |
parents | 2865133eeef2 |
children | 0dea5ef60303 |
comparison
equal
deleted
inserted
replaced
7915:2fc832fbff8d | 7916:9bff64f43299 |
---|---|
999 def __cmp__ (self, other): | 999 def __cmp__ (self, other): |
1000 if isinstance(other, types.StringType): | 1000 if isinstance(other, types.StringType): |
1001 other = JavaCompliance(other) | 1001 other = JavaCompliance(other) |
1002 | 1002 |
1003 return cmp(self.value, other.value) | 1003 return cmp(self.value, other.value) |
1004 | |
1005 """ | |
1006 A Java version as defined in JSR-56 | |
1007 """ | |
1008 class JavaVersion: | |
1009 def __init__(self, versionString): | |
1010 validChar = '[\x21-\x25\x27-\x29\x2c\x2f-\x5e\x60-\x7f]' | |
1011 separator = '[.-_]' | |
1012 m = re.match(validChar + '+(' + separator + validChar + '+)*', versionString) | |
1013 assert m is not None, 'not a recognized version string: ' + versionString | |
1014 self.versionString = versionString; | |
1015 self.parts = versionString.split(separator) | |
1016 | |
1017 def __str__(self): | |
1018 return self.versionString | |
1019 | |
1020 def __cmp__(self, other): | |
1021 return cmp(self.parts, other.parts) | |
1004 | 1022 |
1005 """ | 1023 """ |
1006 A JavaConfig object encapsulates info on how Java commands are run. | 1024 A JavaConfig object encapsulates info on how Java commands are run. |
1007 """ | 1025 """ |
1008 class JavaConfig: | 1026 class JavaConfig: |
1037 print e.output | 1055 print e.output |
1038 abort(e.returncode) | 1056 abort(e.returncode) |
1039 | 1057 |
1040 output = output.split() | 1058 output = output.split() |
1041 assert output[1] == 'version' | 1059 assert output[1] == 'version' |
1042 self.version = output[2].strip('"') | 1060 self.version = JavaVersion(output[2].strip('"')) |
1043 self.javaCompliance = JavaCompliance(self.version) | 1061 self.javaCompliance = JavaCompliance(self.version.versionString) |
1044 | 1062 |
1045 if self.debug_port is not None: | 1063 if self.debug_port is not None: |
1046 self.java_args += ['-Xdebug', '-Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=' + str(self.debug_port)] | 1064 self.java_args += ['-Xdebug', '-Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=' + str(self.debug_port)] |
1047 | 1065 |
1048 def format_cmd(self, args): | 1066 def format_cmd(self, args): |
2301 out.close('configuration') | 2319 out.close('configuration') |
2302 out.close('project') | 2320 out.close('project') |
2303 updated = update_file(join(p.dir, 'nbproject', 'project.xml'), out.xml(indent=' ', newl='\n')) or updated | 2321 updated = update_file(join(p.dir, 'nbproject', 'project.xml'), out.xml(indent=' ', newl='\n')) or updated |
2304 | 2322 |
2305 out = StringIO.StringIO() | 2323 out = StringIO.StringIO() |
2306 jdkPlatform = 'JDK_' + java().version | 2324 jdkPlatform = 'JDK_' + str(java().version) |
2307 | 2325 |
2308 annotationProcessorEnabled = "false" | 2326 annotationProcessorEnabled = "false" |
2309 annotationProcessorReferences = "" | 2327 annotationProcessorReferences = "" |
2310 annotationProcessorSrcFolder = "" | 2328 annotationProcessorSrcFolder = "" |
2311 if hasattr(p, 'annotationProcessors') and len(p.annotationProcessors) > 0: | 2329 if hasattr(p, 'annotationProcessors') and len(p.annotationProcessors) > 0: |
2442 updated = update_file(join(p.dir, 'nbproject', 'project.properties'), out.getvalue()) or updated | 2460 updated = update_file(join(p.dir, 'nbproject', 'project.properties'), out.getvalue()) or updated |
2443 out.close() | 2461 out.close() |
2444 | 2462 |
2445 if updated: | 2463 if updated: |
2446 log('If using NetBeans:') | 2464 log('If using NetBeans:') |
2447 log(' 1. Ensure that a platform named "JDK ' + java().version + '" is defined (Tools -> Java Platforms)') | 2465 log(' 1. Ensure that a platform named "JDK_' + str(java().version) + '" is defined (Tools -> Java Platforms)') |
2448 log(' 2. Open/create a Project Group for the directory containing the projects (File -> Project Group -> New Group... -> Folder of Projects)') | 2466 log(' 2. Open/create a Project Group for the directory containing the projects (File -> Project Group -> New Group... -> Folder of Projects)') |
2449 | 2467 |
2450 def ideclean(args, suite=None): | 2468 def ideclean(args, suite=None): |
2451 """remove all Eclipse and NetBeans project configurations""" | 2469 """remove all Eclipse and NetBeans project configurations""" |
2452 def rm(path): | 2470 def rm(path): |