comparison mxtool/mx.py @ 9002:7844a36d0216

use a project's explicit Java compliance level instead of --source option to mx build command
author Doug Simon <doug.simon@oracle.com>
date Thu, 11 Apr 2013 13:03:20 +0200
parents 096725f4da58
children 1eb16dbb31a7
comparison
equal deleted inserted replaced
9001:94583d9eead8 9002:7844a36d0216
1342 defaultEcjPath = join(_mainSuite.dir, 'mx', 'ecj.jar') 1342 defaultEcjPath = join(_mainSuite.dir, 'mx', 'ecj.jar')
1343 1343
1344 parser = parser if parser is not None else ArgumentParser(prog='mx build') 1344 parser = parser if parser is not None else ArgumentParser(prog='mx build')
1345 parser.add_argument('-f', action='store_true', dest='force', help='force build (disables timestamp checking)') 1345 parser.add_argument('-f', action='store_true', dest='force', help='force build (disables timestamp checking)')
1346 parser.add_argument('-c', action='store_true', dest='clean', help='removes existing build output') 1346 parser.add_argument('-c', action='store_true', dest='clean', help='removes existing build output')
1347 parser.add_argument('--source', dest='compliance', help='Java compliance level', default=str(javaCompliance)) 1347 parser.add_argument('--source', dest='compliance', help='Java compliance level for projects without an explicit one', default=str(javaCompliance))
1348 parser.add_argument('--Wapi', action='store_true', dest='warnAPI', help='show warnings about using internal APIs') 1348 parser.add_argument('--Wapi', action='store_true', dest='warnAPI', help='show warnings about using internal APIs')
1349 parser.add_argument('--projects', action='store', help='comma separated projects to build (omit to build all projects)') 1349 parser.add_argument('--projects', action='store', help='comma separated projects to build (omit to build all projects)')
1350 parser.add_argument('--only', action='store', help='comma separated projects to build, without checking their dependencies (omit to build all projects)') 1350 parser.add_argument('--only', action='store', help='comma separated projects to build, without checking their dependencies (omit to build all projects)')
1351 parser.add_argument('--no-java', action='store_false', dest='java', help='do not build Java projects') 1351 parser.add_argument('--no-java', action='store_false', dest='java', help='do not build Java projects')
1352 parser.add_argument('--no-native', action='store_false', dest='native', help='do not build native projects') 1352 parser.add_argument('--no-native', action='store_false', dest='native', help='do not build native projects')
1500 else: 1500 else:
1501 javacArgs += ['-proc:none'] 1501 javacArgs += ['-proc:none']
1502 1502
1503 toBeDeleted = [argfileName] 1503 toBeDeleted = [argfileName]
1504 try: 1504 try:
1505 compliance = str(p.javaCompliance) if p.javaCompliance is not None else args.compliance
1505 if jdtJar is None: 1506 if jdtJar is None:
1506 log('Compiling Java sources for {0} with javac...'.format(p.name)) 1507 log('Compiling Java sources for {0} with javac...'.format(p.name))
1507 javacCmd = [java().javac, '-g', '-J-Xmx1g', '-source', args.compliance, '-classpath', cp, '-d', outputDir] + javacArgs + ['@' + argfile.name] 1508 javacCmd = [java().javac, '-g', '-J-Xmx1g', '-source', compliance, '-classpath', cp, '-d', outputDir] + javacArgs + ['@' + argfile.name]
1508 if not args.warnAPI: 1509 if not args.warnAPI:
1509 javacCmd.append('-XDignore.symbol.file') 1510 javacCmd.append('-XDignore.symbol.file')
1510 run(javacCmd) 1511 run(javacCmd)
1511 else: 1512 else:
1512 log('Compiling Java sources for {0} with JDT...'.format(p.name)) 1513 log('Compiling Java sources for {0} with JDT...'.format(p.name))
1513 jdtArgs = [java().java, '-Xmx1g', '-jar', jdtJar, 1514 jdtArgs = [java().java, '-Xmx1g', '-jar', jdtJar,
1514 '-' + args.compliance, 1515 '-' + compliance,
1515 '-cp', cp, '-g', '-enableJavadoc', 1516 '-cp', cp, '-g', '-enableJavadoc',
1516 '-d', outputDir] + javacArgs 1517 '-d', outputDir] + javacArgs
1517 jdtProperties = join(p.dir, '.settings', 'org.eclipse.jdt.core.prefs') 1518 jdtProperties = join(p.dir, '.settings', 'org.eclipse.jdt.core.prefs')
1518 rootJdtProperties = join(p.suite.dir, 'mx', 'eclipse-settings', 'org.eclipse.jdt.core.prefs') 1519 rootJdtProperties = join(p.suite.dir, 'mx', 'eclipse-settings', 'org.eclipse.jdt.core.prefs')
1519 if not exists(jdtProperties) or os.path.getmtime(jdtProperties) < os.path.getmtime(rootJdtProperties): 1520 if not exists(jdtProperties) or os.path.getmtime(jdtProperties) < os.path.getmtime(rootJdtProperties):