comparison mxtool/mx.py @ 12680:3affe68ddb50

Merge
author Christos Kotselidis <christos.kotselidis@oracle.com>
date Tue, 05 Nov 2013 19:00:51 +0100
parents c6cc96cc6a1f
children ec224fef3012
comparison
equal deleted inserted replaced
12679:944e31d1b427 12680:3affe68ddb50
23 # or visit www.oracle.com if you need additional information or have any 23 # or visit www.oracle.com if you need additional information or have any
24 # questions. 24 # questions.
25 # 25 #
26 # ---------------------------------------------------------------------------------------------------- 26 # ----------------------------------------------------------------------------------------------------
27 # 27 #
28
29 r""" 28 r"""
30 mx is a command line tool for managing the development of Java code organized as suites of projects. 29 mx is a command line tool for managing the development of Java code organized as suites of projects.
31 30
32 Full documentation can be found at https://wiki.openjdk.java.net/display/Graal/The+mx+Tool 31 Full documentation can be found at https://wiki.openjdk.java.net/display/Graal/The+mx+Tool
33 """ 32 """
2979 out.open('buildCommand') 2978 out.open('buildCommand')
2980 out.element('name', data=buildCommand) 2979 out.element('name', data=buildCommand)
2981 out.element('arguments', data='') 2980 out.element('arguments', data='')
2982 out.close('buildCommand') 2981 out.close('buildCommand')
2983 2982
2983 # The path should always be p.name/dir. independent of where the workspace actually is.
2984 # So we use the parent folder of the project, whatever that is, to generate such a relative path.
2985 logicalWorkspaceRoot = os.path.dirname(p.dir)
2986 binFolder = os.path.relpath(p.output_dir(), logicalWorkspaceRoot)
2987
2984 if _isAnnotationProcessorDependency(p): 2988 if _isAnnotationProcessorDependency(p):
2985 _genEclipseBuilder(out, p, 'Jar', 'archive ' + p.name, refresh=False, async=False, xmlIndent='', xmlStandalone='no') 2989 refreshFile = os.path.relpath(join(p.dir, p.name + '.jar'), logicalWorkspaceRoot)
2986 _genEclipseBuilder(out, p, 'Refresh', '', refresh=True, async=True) 2990 _genEclipseBuilder(out, p, 'Jar', 'archive ' + p.name, refresh=True, refreshFile=refreshFile, relevantResources=[binFolder], async=True, xmlIndent='', xmlStandalone='no')
2987 2991
2988 if projToDist.has_key(p.name): 2992 if projToDist.has_key(p.name):
2989 dist, distDeps = projToDist[p.name] 2993 dist, distDeps = projToDist[p.name]
2990 _genEclipseBuilder(out, p, 'Create' + dist.name + 'Dist', 'archive @' + dist.name, logToFile=True, refresh=False, async=True) 2994 _genEclipseBuilder(out, p, 'Create' + dist.name + 'Dist', 'archive @' + dist.name, relevantResources=[binFolder], logToFile=True, refresh=False, async=True)
2991 2995
2992 out.close('buildSpec') 2996 out.close('buildSpec')
2993 out.open('natures') 2997 out.open('natures')
2994 out.element('nature', data='org.eclipse.jdt.core.javanature') 2998 out.element('nature', data='org.eclipse.jdt.core.javanature')
2995 if exists(csConfig): 2999 if exists(csConfig):
3047 """ 3051 """
3048 Determines if a given project is part of an annotation processor. 3052 Determines if a given project is part of an annotation processor.
3049 """ 3053 """
3050 return p in sorted_deps(annotation_processors()) 3054 return p in sorted_deps(annotation_processors())
3051 3055
3052 def _genEclipseBuilder(dotProjectDoc, p, name, mxCommand, refresh=True, async=False, logToConsole=False, logToFile=False, appendToLogFile=True, xmlIndent='\t', xmlStandalone=None): 3056 def _genEclipseBuilder(dotProjectDoc, p, name, mxCommand, refresh=True, refreshFile=None, relevantResources=None, async=False, logToConsole=False, logToFile=False, appendToLogFile=True, xmlIndent='\t', xmlStandalone=None):
3053 externalToolDir = join(p.dir, '.externalToolBuilders') 3057 externalToolDir = join(p.dir, '.externalToolBuilders')
3054 launchOut = XMLDoc() 3058 launchOut = XMLDoc()
3055 consoleOn = 'true' if logToConsole else 'false' 3059 consoleOn = 'true' if logToConsole else 'false'
3056 launchOut.open('launchConfiguration', {'type' : 'org.eclipse.ui.externaltools.ProgramBuilderLaunchConfigurationType'}) 3060 launchOut.open('launchConfiguration', {'type' : 'org.eclipse.ui.externaltools.ProgramBuilderLaunchConfigurationType'})
3057 launchOut.element('booleanAttribute', {'key' : 'org.eclipse.debug.core.capture_output', 'value': consoleOn}) 3061 launchOut.element('booleanAttribute', {'key' : 'org.eclipse.debug.core.capture_output', 'value': consoleOn})
3058 launchOut.open('mapAttribute', {'key' : 'org.eclipse.debug.core.environmentVariables'}) 3062 launchOut.open('mapAttribute', {'key' : 'org.eclipse.debug.core.environmentVariables'})
3059 launchOut.element('mapEntry', {'key' : 'JAVA_HOME', 'value' : java().jdk}) 3063 launchOut.element('mapEntry', {'key' : 'JAVA_HOME', 'value' : java().jdk})
3060 launchOut.close('mapAttribute') 3064 launchOut.close('mapAttribute')
3061 3065
3062 if refresh: 3066 if refresh:
3063 launchOut.element('stringAttribute', {'key' : 'org.eclipse.debug.core.ATTR_REFRESH_SCOPE', 'value': '${project}'}) 3067 if refreshFile is None:
3068 refreshScope = '${project}'
3069 else:
3070 refreshScope = '${working_set:<?xml version="1.0" encoding="UTF-8"?><resources><item path="' + refreshFile + '" type="1"/></resources>}'
3071
3072 launchOut.element('booleanAttribute', {'key' : 'org.eclipse.debug.core.ATTR_REFRESH_RECURSIVE', 'value': 'false'})
3073 launchOut.element('stringAttribute', {'key' : 'org.eclipse.debug.core.ATTR_REFRESH_SCOPE', 'value': refreshScope})
3074
3075 if relevantResources is not None:
3076 resources = '${working_set:<?xml version="1.0" encoding="UTF-8"?><resources>'
3077 for relevantResource in relevantResources:
3078 resources += '<item path="' + relevantResource +'" type="2" />'
3079 resources += '</resources>}'
3080 launchOut.element('stringAttribute', {'key' : 'org.eclipse.ui.externaltools.ATTR_BUILD_SCOPE', 'value': resources})
3081
3082
3064 launchOut.element('booleanAttribute', {'key' : 'org.eclipse.debug.ui.ATTR_CONSOLE_OUTPUT_ON', 'value': consoleOn}) 3083 launchOut.element('booleanAttribute', {'key' : 'org.eclipse.debug.ui.ATTR_CONSOLE_OUTPUT_ON', 'value': consoleOn})
3065 launchOut.element('booleanAttribute', {'key' : 'org.eclipse.debug.ui.ATTR_LAUNCH_IN_BACKGROUND', 'value': 'true' if async else 'false'}) 3084 launchOut.element('booleanAttribute', {'key' : 'org.eclipse.debug.ui.ATTR_LAUNCH_IN_BACKGROUND', 'value': 'true' if async else 'false'})
3066 if logToFile: 3085 if logToFile:
3067 logFile = join(externalToolDir, name + '.log') 3086 logFile = join(externalToolDir, name + '.log')
3068 launchOut.element('stringAttribute', {'key' : 'org.eclipse.debug.ui.ATTR_CAPTURE_IN_FILE', 'value': logFile}) 3087 launchOut.element('stringAttribute', {'key' : 'org.eclipse.debug.ui.ATTR_CAPTURE_IN_FILE', 'value': logFile})
3080 cmdPath = join(dirname(baseDir), cmd) 3099 cmdPath = join(dirname(baseDir), cmd)
3081 if not os.path.exists(cmdPath): 3100 if not os.path.exists(cmdPath):
3082 abort('cannot locate ' + cmd) 3101 abort('cannot locate ' + cmd)
3083 3102
3084 launchOut.element('stringAttribute', {'key' : 'org.eclipse.ui.externaltools.ATTR_LOCATION', 'value': cmdPath}) 3103 launchOut.element('stringAttribute', {'key' : 'org.eclipse.ui.externaltools.ATTR_LOCATION', 'value': cmdPath})
3085 launchOut.element('stringAttribute', {'key' : 'org.eclipse.ui.externaltools.ATTR_RUN_BUILD_KINDS', 'value': 'auto,full,incremental'}) 3104 launchOut.element('stringAttribute', {'key' : 'org.eclipse.ui.externaltools.ATTR_RUN_BUILD_KINDS', 'value': 'full,incremental,auto,'})
3086 launchOut.element('stringAttribute', {'key' : 'org.eclipse.ui.externaltools.ATTR_TOOL_ARGUMENTS', 'value': mxCommand}) 3105 launchOut.element('stringAttribute', {'key' : 'org.eclipse.ui.externaltools.ATTR_TOOL_ARGUMENTS', 'value': mxCommand})
3087 launchOut.element('booleanAttribute', {'key' : 'org.eclipse.ui.externaltools.ATTR_TRIGGERS_CONFIGURED', 'value': 'true'}) 3106 launchOut.element('booleanAttribute', {'key' : 'org.eclipse.ui.externaltools.ATTR_TRIGGERS_CONFIGURED', 'value': 'true'})
3088 launchOut.element('stringAttribute', {'key' : 'org.eclipse.ui.externaltools.ATTR_WORKING_DIRECTORY', 'value': p.suite.dir}) 3107 launchOut.element('stringAttribute', {'key' : 'org.eclipse.ui.externaltools.ATTR_WORKING_DIRECTORY', 'value': p.suite.dir})
3089 3108
3090 3109