comparison mxtool/mx.py @ 7698:5172356ea7c3

Merge.
author Christian Haeubl <haeubl@ssw.jku.at>
date Mon, 04 Feb 2013 17:48:20 +0100
parents f81be78f15a5
children 6b540bb82312
comparison
equal deleted inserted replaced
7697:e7a85c94502e 7698:5172356ea7c3
2094 out.element('name', data=buildCommand) 2094 out.element('name', data=buildCommand)
2095 out.element('arguments', data='') 2095 out.element('arguments', data='')
2096 out.close('buildCommand') 2096 out.close('buildCommand')
2097 2097
2098 if (_needsEclipseJarBuild(p)): 2098 if (_needsEclipseJarBuild(p)):
2099 out.open('buildCommand') 2099 targetValues = _genEclipseJarBuild(p);
2100 out.element('name', data='org.eclipse.ui.externaltools.ExternalToolBuilder') 2100 for value in targetValues:
2101 out.element('triggers', data='auto,full,incremental,') 2101 out.open('buildCommand')
2102 out.open('arguments') 2102 out.element('name', data='org.eclipse.ui.externaltools.ExternalToolBuilder')
2103 out.open('dictionary') 2103 out.element('triggers', data='auto,full,incremental,')
2104 out.element('key', data = 'LaunchConfigHandle') 2104 out.open('arguments')
2105 out.element('value', data = _genEclipseJarBuild(p)) 2105 out.open('dictionary')
2106 out.close('dictionary') 2106 out.element('key', data = 'LaunchConfigHandle')
2107 out.open('dictionary') 2107 out.element('value', data = value)
2108 out.element('key', data = 'incclean') 2108 out.close('dictionary')
2109 out.element('value', data = 'true') 2109 out.open('dictionary')
2110 out.close('dictionary') 2110 out.element('key', data = 'incclean')
2111 out.close('arguments') 2111 out.element('value', data = 'true')
2112 out.close('buildCommand') 2112 out.close('dictionary')
2113 2113 out.close('arguments')
2114 out.close('buildCommand')
2115
2114 out.close('buildSpec') 2116 out.close('buildSpec')
2115 out.open('natures') 2117 out.open('natures')
2116 out.element('nature', data='org.eclipse.jdt.core.javanature') 2118 out.element('nature', data='org.eclipse.jdt.core.javanature')
2117 if exists(csConfig): 2119 if exists(csConfig):
2118 out.element('nature', data='net.sf.eclipsecs.core.CheckstyleNature') 2120 out.element('nature', data='net.sf.eclipsecs.core.CheckstyleNature')
2182 return True 2184 return True
2183 2185
2184 return False 2186 return False
2185 2187
2186 def _genEclipseJarBuild(p): 2188 def _genEclipseJarBuild(p):
2189 builders = []
2190 builders.append(_genEclipseLaunch(p, 'Jar.launch', ''.join(['jar ', p.name]), refresh = False, async = False))
2191 builders.append(_genEclipseLaunch(p, 'Refresh.launch', '', refresh = True, async = True))
2192 return builders
2193
2194 def _genEclipseLaunch(p, name, mxCommand, refresh=True, async=False):
2187 launchOut = XMLDoc(); 2195 launchOut = XMLDoc();
2188 launchOut.open('launchConfiguration', {'type' : 'org.eclipse.ui.externaltools.ProgramBuilderLaunchConfigurationType'}) 2196 launchOut.open('launchConfiguration', {'type' : 'org.eclipse.ui.externaltools.ProgramBuilderLaunchConfigurationType'})
2189 launchOut.element('stringAttribute', {'key' : 'org.eclipse.debug.core.ATTR_REFRESH_SCOPE', 'value': '${project}'}) 2197 if refresh:
2198 launchOut.element('stringAttribute', {'key' : 'org.eclipse.debug.core.ATTR_REFRESH_SCOPE', 'value': '${project}'})
2190 launchOut.element('booleanAttribute', {'key' : 'org.eclipse.debug.core.capture_output', 'value': 'false'}) 2199 launchOut.element('booleanAttribute', {'key' : 'org.eclipse.debug.core.capture_output', 'value': 'false'})
2191 launchOut.element('booleanAttribute', {'key' : 'org.eclipse.debug.ui.ATTR_CONSOLE_OUTPUT_ON', 'value': 'false'}) 2200 launchOut.element('booleanAttribute', {'key' : 'org.eclipse.debug.ui.ATTR_CONSOLE_OUTPUT_ON', 'value': 'false'})
2192 launchOut.element('booleanAttribute', {'key' : 'org.eclipse.debug.ui.ATTR_LAUNCH_IN_BACKGROUND', 'value': 'true'}) 2201 if async:
2202 launchOut.element('booleanAttribute', {'key' : 'org.eclipse.debug.ui.ATTR_LAUNCH_IN_BACKGROUND', 'value': 'true'})
2193 2203
2194 baseDir = dirname(dirname(os.path.abspath(__file__))) 2204 baseDir = dirname(dirname(os.path.abspath(__file__)))
2195 2205
2196 cmd = 'mx.sh' 2206 cmd = 'mx.sh'
2197 if get_os() == 'windows': 2207 if get_os() == 'windows':
2198 cmd = 'mx.cmd' 2208 cmd = 'mx.cmd'
2199 launchOut.element('stringAttribute', {'key' : 'org.eclipse.ui.externaltools.ATTR_LOCATION', 'value': join(baseDir, cmd) }) 2209 launchOut.element('stringAttribute', {'key' : 'org.eclipse.ui.externaltools.ATTR_LOCATION', 'value': join(baseDir, cmd) })
2200 launchOut.element('stringAttribute', {'key' : 'org.eclipse.ui.externaltools.ATTR_RUN_BUILD_KINDS', 'value': 'auto,full,incremental'}) 2210 launchOut.element('stringAttribute', {'key' : 'org.eclipse.ui.externaltools.ATTR_RUN_BUILD_KINDS', 'value': 'auto,full,incremental'})
2201 launchOut.element('stringAttribute', {'key' : 'org.eclipse.ui.externaltools.ATTR_TOOL_ARGUMENTS', 'value': ''.join(['jar', ' ', p.name])}) 2211 launchOut.element('stringAttribute', {'key' : 'org.eclipse.ui.externaltools.ATTR_TOOL_ARGUMENTS', 'value': mxCommand})
2202 launchOut.element('booleanAttribute', {'key' : 'org.eclipse.ui.externaltools.ATTR_TRIGGERS_CONFIGURED','value': 'true'}) 2212 launchOut.element('booleanAttribute', {'key' : 'org.eclipse.ui.externaltools.ATTR_TRIGGERS_CONFIGURED','value': 'true'})
2203 launchOut.element('stringAttribute', {'key' : 'org.eclipse.ui.externaltools.ATTR_WORKING_DIRECTORY', 'value': baseDir}) 2213 launchOut.element('stringAttribute', {'key' : 'org.eclipse.ui.externaltools.ATTR_WORKING_DIRECTORY', 'value': baseDir})
2204 2214
2205 2215
2206 launchOut.close('launchConfiguration') 2216 launchOut.close('launchConfiguration')
2207 2217
2208 externalToolDir = join(p.dir, '.externalToolBuilders') 2218 externalToolDir = join(p.dir, '.externalToolBuilders')
2209 2219
2210 if not exists(externalToolDir): 2220 if not exists(externalToolDir):
2211 os.makedirs(externalToolDir) 2221 os.makedirs(externalToolDir)
2212 update_file(join(externalToolDir, 'Jar.launch'), launchOut.xml(indent='\t', newl='\n')) 2222 update_file(join(externalToolDir, name), launchOut.xml(indent='\t', newl='\n'))
2213 2223
2214 return "<project>/.externalToolBuilders/Jar.launch" 2224 return ''.join(["<project>/.externalToolBuilders/", name])
2215
2216
2217 2225
2218 2226
2219 def netbeansinit(args, suite=None): 2227 def netbeansinit(args, suite=None):
2220 """(re)generate NetBeans project configurations""" 2228 """(re)generate NetBeans project configurations"""
2221 2229