Mercurial > hg > graal-compiler
comparison mx/mx_graal.py @ 14595:ff2095ec7bdb
Merge
author | Tom Rodriguez <tom.rodriguez@oracle.com> |
---|---|
date | Tue, 18 Mar 2014 11:51:37 -0700 |
parents | e754ac1331ef 942c4daa9db9 |
children | 591f4a575ebf |
comparison
equal
deleted
inserted
replaced
14594:3eda945af90a | 14595:ff2095ec7bdb |
---|---|
1636 err=subprocess.STDOUT) | 1636 err=subprocess.STDOUT) |
1637 | 1637 |
1638 valueMap = parser.parse(output.getvalue()) | 1638 valueMap = parser.parse(output.getvalue()) |
1639 return valueMap | 1639 return valueMap |
1640 | 1640 |
1641 def findbugs(args): | |
1642 '''run FindBugs against non-test Java projects''' | |
1643 findBugsHome = mx.get_env('FINDBUGS_HOME', None) | |
1644 if findBugsHome: | |
1645 findbugsJar = join(findBugsHome, 'lib', 'findbugs.jar') | |
1646 else: | |
1647 findbugsLib = join(_graal_home, 'lib', 'findbugs-3.0.0') | |
1648 if not exists(findbugsLib): | |
1649 tmp = tempfile.mkdtemp(prefix='findbugs-download-tmp', dir=_graal_home) | |
1650 try: | |
1651 findbugsDist = join(tmp, 'findbugs.zip') | |
1652 mx.download(findbugsDist, ['http://sourceforge.net/projects/findbugs/files/findbugs/3.0.0/findbugs-3.0.0-dev-20131204-e3cbbd5.zip']) | |
1653 with zipfile.ZipFile(findbugsDist) as zf: | |
1654 candidates = [e for e in zf.namelist() if e.endswith('/lib/findbugs.jar')] | |
1655 assert len(candidates) == 1, candidates | |
1656 libDirInZip = os.path.dirname(candidates[0]) | |
1657 zf.extractall(tmp) | |
1658 shutil.copytree(join(tmp, libDirInZip), findbugsLib) | |
1659 finally: | |
1660 shutil.rmtree(tmp) | |
1661 findbugsJar = join(findbugsLib, 'findbugs.jar') | |
1662 assert exists(findbugsJar) | |
1663 nonTestProjects = [p for p in mx.projects() if not p.name.endswith('.test') and not p.name.endswith('.jtt')] | |
1664 outputDirs = [p.output_dir() for p in nonTestProjects] | |
1665 findbugsResults = join(_graal_home, 'findbugs.results') | |
1666 exitcode = mx.run_java(['-jar', findbugsJar, '-textui', '-low', '-maxRank', '15', '-exclude', join(_graal_home, 'graal', 'findbugsExcludeFilter.xml'), | |
1667 '-auxclasspath', mx.classpath([p.name for p in nonTestProjects]), '-output', findbugsResults, '-progress', '-exitcode'] + args + outputDirs, nonZeroIsFatal=False) | |
1668 if exitcode != 0: | |
1669 with open(findbugsResults) as fp: | |
1670 mx.log(fp.read()) | |
1671 os.unlink(findbugsResults) | |
1672 return exitcode | |
1641 | 1673 |
1642 def mx_init(suite): | 1674 def mx_init(suite): |
1643 commands = { | 1675 commands = { |
1644 'build': [build, ''], | 1676 'build': [build, ''], |
1645 'buildvars': [buildvars, ''], | 1677 'buildvars': [buildvars, ''], |
1646 'buildvms': [buildvms, '[-options]'], | 1678 'buildvms': [buildvms, '[-options]'], |
1647 'c1visualizer' : [c1visualizer, ''], | 1679 'c1visualizer' : [c1visualizer, ''], |
1648 'clean': [clean, ''], | 1680 'clean': [clean, ''], |
1681 'findbugs': [findbugs, ''], | |
1649 'generateZshCompletion' : [generateZshCompletion, ''], | 1682 'generateZshCompletion' : [generateZshCompletion, ''], |
1650 'hsdis': [hsdis, '[att]'], | 1683 'hsdis': [hsdis, '[att]'], |
1651 'hcfdis': [hcfdis, ''], | 1684 'hcfdis': [hcfdis, ''], |
1652 'igv' : [igv, ''], | 1685 'igv' : [igv, ''], |
1653 'jdkhome': [print_jdkhome, ''], | 1686 'jdkhome': [print_jdkhome, ''], |