comparison mxtool/mx.py @ 12511:8c64f10f86b7

append output of mx command to (re)build graal.jar to a per-project log file
author Doug Simon <doug.simon@oracle.com>
date Tue, 22 Oct 2013 11:31:16 +0200
parents bb665959fb12
children ef0de9485627
comparison
equal deleted inserted replaced
12510:bb665959fb12 12511:8c64f10f86b7
2982 out.element('name', data=buildCommand) 2982 out.element('name', data=buildCommand)
2983 out.element('arguments', data='') 2983 out.element('arguments', data='')
2984 out.close('buildCommand') 2984 out.close('buildCommand')
2985 2985
2986 if _isAnnotationProcessorDependency(p): 2986 if _isAnnotationProcessorDependency(p):
2987 _genEclipseBuilder(out, p, 'Jar.launch', 'archive ' + p.name, refresh=False, async=False, xmlIndent='', xmlStandalone='no') 2987 _genEclipseBuilder(out, p, 'Jar', 'archive ' + p.name, refresh=False, async=False, xmlIndent='', xmlStandalone='no')
2988 _genEclipseBuilder(out, p, 'Refresh.launch', '', refresh=True, async=True) 2988 _genEclipseBuilder(out, p, 'Refresh', '', refresh=True, async=True)
2989 2989
2990 if projToDist.has_key(p.name): 2990 if projToDist.has_key(p.name):
2991 dist, distDeps = projToDist[p.name] 2991 dist, distDeps = projToDist[p.name]
2992 _genEclipseBuilder(out, p, 'Create' + dist.name + 'Dist.launch', 'archive @' + dist.name, refresh=False, async=True) 2992 _genEclipseBuilder(out, p, 'Create' + dist.name + 'Dist', 'archive @' + dist.name, logToFile=True, refresh=False, async=True)
2993 2993
2994 out.close('buildSpec') 2994 out.close('buildSpec')
2995 out.open('natures') 2995 out.open('natures')
2996 out.element('nature', data='org.eclipse.jdt.core.javanature') 2996 out.element('nature', data='org.eclipse.jdt.core.javanature')
2997 if exists(csConfig): 2997 if exists(csConfig):
3049 """ 3049 """
3050 Determines if a given project is part of an annotation processor. 3050 Determines if a given project is part of an annotation processor.
3051 """ 3051 """
3052 return p in sorted_deps(annotation_processors()) 3052 return p in sorted_deps(annotation_processors())
3053 3053
3054 def _genEclipseBuilder(dotProjectDoc, p, name, mxCommand, refresh=True, async=False, logToConsole=False, xmlIndent='\t', xmlStandalone=None): 3054 def _genEclipseBuilder(dotProjectDoc, p, name, mxCommand, refresh=True, async=False, logToConsole=False, logToFile=False, appendToLogFile=True, xmlIndent='\t', xmlStandalone=None):
3055 externalToolDir = join(p.dir, '.externalToolBuilders')
3055 launchOut = XMLDoc() 3056 launchOut = XMLDoc()
3056 consoleOn = 'true' if logToConsole else 'false' 3057 consoleOn = 'true' if logToConsole else 'false'
3057 launchOut.open('launchConfiguration', {'type' : 'org.eclipse.ui.externaltools.ProgramBuilderLaunchConfigurationType'}) 3058 launchOut.open('launchConfiguration', {'type' : 'org.eclipse.ui.externaltools.ProgramBuilderLaunchConfigurationType'})
3058 launchOut.element('booleanAttribute', {'key' : 'org.eclipse.debug.core.capture_output', 'value': consoleOn}) 3059 launchOut.element('booleanAttribute', {'key' : 'org.eclipse.debug.core.capture_output', 'value': consoleOn})
3059 launchOut.open('mapAttribute', {'key' : 'org.eclipse.debug.core.environmentVariables'}) 3060 launchOut.open('mapAttribute', {'key' : 'org.eclipse.debug.core.environmentVariables'})
3062 3063
3063 if refresh: 3064 if refresh:
3064 launchOut.element('stringAttribute', {'key' : 'org.eclipse.debug.core.ATTR_REFRESH_SCOPE', 'value': '${project}'}) 3065 launchOut.element('stringAttribute', {'key' : 'org.eclipse.debug.core.ATTR_REFRESH_SCOPE', 'value': '${project}'})
3065 launchOut.element('booleanAttribute', {'key' : 'org.eclipse.debug.ui.ATTR_CONSOLE_OUTPUT_ON', 'value': consoleOn}) 3066 launchOut.element('booleanAttribute', {'key' : 'org.eclipse.debug.ui.ATTR_CONSOLE_OUTPUT_ON', 'value': consoleOn})
3066 launchOut.element('booleanAttribute', {'key' : 'org.eclipse.debug.ui.ATTR_LAUNCH_IN_BACKGROUND', 'value': 'true' if async else 'false'}) 3067 launchOut.element('booleanAttribute', {'key' : 'org.eclipse.debug.ui.ATTR_LAUNCH_IN_BACKGROUND', 'value': 'true' if async else 'false'})
3068 if logToFile:
3069 logFile = join(externalToolDir, name + '.log')
3070 launchOut.element('booleanAttribute', {'key' : 'org.eclipse.debug.ui.ATTR_CAPTURE_IN_FILE', 'value': logFile})
3071 launchOut.element('booleanAttribute', {'key' : 'org.eclipse.debug.ui.ATTR_APPEND_TO_FILE', 'value': 'true' if appendToLogFile else 'false'})
3067 3072
3068 # expect to find the OS command to invoke mx in the same directory 3073 # expect to find the OS command to invoke mx in the same directory
3069 baseDir = dirname(os.path.abspath(__file__)) 3074 baseDir = dirname(os.path.abspath(__file__))
3070 3075
3071 cmd = 'mx.sh' 3076 cmd = 'mx.sh'
3085 launchOut.element('stringAttribute', {'key' : 'org.eclipse.ui.externaltools.ATTR_WORKING_DIRECTORY', 'value': p.suite.dir}) 3090 launchOut.element('stringAttribute', {'key' : 'org.eclipse.ui.externaltools.ATTR_WORKING_DIRECTORY', 'value': p.suite.dir})
3086 3091
3087 3092
3088 launchOut.close('launchConfiguration') 3093 launchOut.close('launchConfiguration')
3089 3094
3090 externalToolDir = join(p.dir, '.externalToolBuilders')
3091
3092 if not exists(externalToolDir): 3095 if not exists(externalToolDir):
3093 os.makedirs(externalToolDir) 3096 os.makedirs(externalToolDir)
3094 update_file(join(externalToolDir, name), launchOut.xml(indent=xmlIndent, standalone=xmlStandalone, newl='\n')) 3097 update_file(join(externalToolDir, name + '.launch'), launchOut.xml(indent=xmlIndent, standalone=xmlStandalone, newl='\n'))
3095 3098
3096 dotProjectDoc.open('buildCommand') 3099 dotProjectDoc.open('buildCommand')
3097 dotProjectDoc.element('name', data='org.eclipse.ui.externaltools.ExternalToolBuilder') 3100 dotProjectDoc.element('name', data='org.eclipse.ui.externaltools.ExternalToolBuilder')
3098 dotProjectDoc.element('triggers', data='auto,full,incremental,') 3101 dotProjectDoc.element('triggers', data='auto,full,incremental,')
3099 dotProjectDoc.open('arguments') 3102 dotProjectDoc.open('arguments')
3100 dotProjectDoc.open('dictionary') 3103 dotProjectDoc.open('dictionary')
3101 dotProjectDoc.element('key', data='LaunchConfigHandle') 3104 dotProjectDoc.element('key', data='LaunchConfigHandle')
3102 dotProjectDoc.element('value', data='<project>/.externalToolBuilders/' + name) 3105 dotProjectDoc.element('value', data='<project>/.externalToolBuilders/' + name + '.launch')
3103 dotProjectDoc.close('dictionary') 3106 dotProjectDoc.close('dictionary')
3104 dotProjectDoc.open('dictionary') 3107 dotProjectDoc.open('dictionary')
3105 dotProjectDoc.element('key', data='incclean') 3108 dotProjectDoc.element('key', data='incclean')
3106 dotProjectDoc.element('value', data='true') 3109 dotProjectDoc.element('value', data='true')
3107 dotProjectDoc.close('dictionary') 3110 dotProjectDoc.close('dictionary')