Mercurial > hg > truffle
comparison mxtool/mx.py @ 12042:fbe1ee508936
added ability to suppress duplicate lines on an output stream and used it to filter the GC verification log messages in the gate
author | Doug Simon <doug.simon@oracle.com> |
---|---|
date | Thu, 10 Oct 2013 18:07:20 +0200 |
parents | 039b133ded75 |
children | 3de38bb7bc1d |
comparison
equal
deleted
inserted
replaced
11959:23ccaa863eda | 12042:fbe1ee508936 |
---|---|
156 _suites = dict() | 156 _suites = dict() |
157 _annotationProcessors = None | 157 _annotationProcessors = None |
158 _mainSuite = None | 158 _mainSuite = None |
159 _opts = None | 159 _opts = None |
160 _java = None | 160 _java = None |
161 _check_global_structures = True # can be set False to allow suites with duplicate definitions to load without aborting | 161 _check_global_structures = True # can be set False to allow suites with duplicate definitions to load without aborting |
162 | 162 |
163 | 163 |
164 """ | 164 """ |
165 A distribution is a jar or zip file containing the output from one or more Java projects. | 165 A distribution is a jar or zip file containing the output from one or more Java projects. |
166 """ | 166 """ |
1275 if os == 'darwin': | 1275 if os == 'darwin': |
1276 return name + '.dylib' | 1276 return name + '.dylib' |
1277 return name | 1277 return name |
1278 | 1278 |
1279 """ | 1279 """ |
1280 Utility for filtering duplicate lines. | |
1281 """ | |
1282 class DuplicateSuppressingStream: | |
1283 """ | |
1284 Creates an object that will suppress duplicate lines sent to 'out'. | |
1285 The lines considered for suppression are those that contain one of the | |
1286 strings in 'restrictTo' if it is not None. | |
1287 """ | |
1288 def __init__(self, restrictTo=None, out=sys.stdout): | |
1289 self.restrictTo = restrictTo | |
1290 self.seen = set() | |
1291 self.out = out | |
1292 | |
1293 def isSuppressionCandidate(self, line): | |
1294 if self.restrictTo: | |
1295 for p in self.restrictTo: | |
1296 if p in line: | |
1297 return True | |
1298 return False | |
1299 else: | |
1300 return True | |
1301 | |
1302 def write(self, line): | |
1303 if self.isSuppressionCandidate(line): | |
1304 if line in self.seen: | |
1305 return | |
1306 self.seen.add(line) | |
1307 self.out.write(line) | |
1308 | |
1309 """ | |
1280 A JavaCompliance simplifies comparing Java compliance values extracted from a JDK version string. | 1310 A JavaCompliance simplifies comparing Java compliance values extracted from a JDK version string. |
1281 """ | 1311 """ |
1282 class JavaCompliance: | 1312 class JavaCompliance: |
1283 def __init__(self, ver): | 1313 def __init__(self, ver): |
1284 m = re.match(r'1\.(\d+).*', ver) | 1314 m = re.match(r'1\.(\d+).*', ver) |
2516 if not timestamp.outOfDate(projectsFile): | 2546 if not timestamp.outOfDate(projectsFile): |
2517 logv('[Eclipse configurations are up to date - skipping]') | 2547 logv('[Eclipse configurations are up to date - skipping]') |
2518 return | 2548 return |
2519 | 2549 |
2520 if buildProcessorJars: | 2550 if buildProcessorJars: |
2521 ## todo suite specific | 2551 # todo suite specific |
2522 processorjars() | 2552 processorjars() |
2523 | 2553 |
2524 projToDist = dict() | 2554 projToDist = dict() |
2525 for dist in _dists.values(): | 2555 for dist in _dists.values(): |
2526 distDeps = sorted_deps(dist.deps) | 2556 distDeps = sorted_deps(dist.deps) |
2808 def _find_eclipse_wsroot(wsdir): | 2838 def _find_eclipse_wsroot(wsdir): |
2809 md = join(wsdir, '.metadata') | 2839 md = join(wsdir, '.metadata') |
2810 if exists(md): | 2840 if exists(md): |
2811 return wsdir | 2841 return wsdir |
2812 split = os.path.split(wsdir) | 2842 split = os.path.split(wsdir) |
2813 if split[0] == wsdir: # root directory | 2843 if split[0] == wsdir: # root directory |
2814 return None | 2844 return None |
2815 else: | 2845 else: |
2816 return _find_eclipse_wsroot(split[0]) | 2846 return _find_eclipse_wsroot(split[0]) |
2817 | 2847 |
2818 def _foobar(val): | 2848 def _foobar(val): |