You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@gump.apache.org by bo...@apache.org on 2010/06/13 07:37:40 UTC
svn commit: r954169 - in /gump/trunk/python/gump/core: build/nant.py
run/gumpenv.py
Author: bodewig
Date: Sun Jun 13 05:37:40 2010
New Revision: 954169
URL: http://svn.apache.org/viewvc?rev=954169&view=rev
Log:
try different variants of NAnt - recent Ubuntu packages come with a wrapper script named 'nant'
Modified:
gump/trunk/python/gump/core/build/nant.py
gump/trunk/python/gump/core/run/gumpenv.py
Modified: gump/trunk/python/gump/core/build/nant.py
URL: http://svn.apache.org/viewvc/gump/trunk/python/gump/core/build/nant.py?rev=954169&r1=954168&r2=954169&view=diff
==============================================================================
--- gump/trunk/python/gump/core/build/nant.py (original)
+++ gump/trunk/python/gump/core/build/nant.py Sun Jun 13 05:37:40 2010
@@ -24,7 +24,7 @@ from gump.util.process.launcher import e
from gump.util.work import CommandWorkItem, WORK_TYPE_BUILD
from gump.core.model.state import REASON_BUILD_FAILED, REASON_BUILD_TIMEDOUT, \
- STATE_FAILED, STATE_SUCCESS
+ REASON_PREBUILD_FAILED, STATE_FAILED, STATE_SUCCESS
class NAntBuilder(RunSpecific):
"""
@@ -75,10 +75,18 @@ class NAntBuilder(RunSpecific):
def getNAntCommand(self, project, languageHelper):
"""
- Build an ANT command for this project, based on the <nant metadata
+ Build an NANT command for this project, based on the <nant metadata
select targets and build files as appropriate.
"""
+ if not self.run.env.get_nant_command():
+ message = "Can't run NAnt builds since NAnt hasn't been found"
+ log.error(message)
+ project.addError(message)
+ project.setBuilt(True)
+ project.changeState(STATE_FAILED, REASON_PREBUILD_FAILED)
+ return None
+
# The original model information...
nant = project.nant
# The nant target (or none == nant default target)
@@ -106,10 +114,11 @@ class NAntBuilder(RunSpecific):
# Library Path
libpath = languageHelper.getAssemblyPath(project)
- # Run java on apache NAnt...
- cmd = Cmd('NAnt.exe', 'build_' + project.getModule().getName() + '_' + \
+ # Run NAnt...
+ cmd = Cmd(self.run.env.get_nant_command(),
+ 'build_' + project.getModule().getName() + '_' + \
project.getName(),
- basedir, {'DEVPATH' : libpath})
+ basedir, {'DEVPATH' : libpath})
# Launch with specified framework (e.g. mono-1.0.1) if
# required.
@@ -122,12 +131,7 @@ class NAntBuilder(RunSpecific):
# These are workspace + project system properties
cmd.addNamedParameters(sysproperties)
- # Get/set JVM properties
- #jvmargs = language.getJVMArgs(project)
- #if jvmargs:
- # cmd.addParameters(jvmargs)
-
- # Allow ant-level debugging...
+ # Allow NAnt-level debugging...
if project.getWorkspace().isDebug() or project.isDebug() or debug:
cmd.addParameter('-debug')
if project.getWorkspace().isVerbose() or project.isVerbose() \
@@ -139,7 +143,7 @@ class NAntBuilder(RunSpecific):
# within.
mergeFile = project.getWorkspace().getMergeFile()
if mergeFile:
- cmd.addPrefixedParameter('-D:', 'gump.merge', str(mergeFile), ' = ')
+ cmd.addPrefixedParameter('-D:', 'gump.merge', str(mergeFile), '=')
# These are from the project and/or workspace
# These are 'normal' properties.
cmd.addNamedParameters(properties)
@@ -161,7 +165,7 @@ class NAntBuilder(RunSpecific):
for prop in project.getWorkspace().getProperties() + \
project.getNAnt().getProperties():
properties.addPrefixedNamedParameter('-D:', prop.name,
- prop.value, ' = ')
+ prop.value, '=')
return properties
def getNAntSysProperties(self, project):
@@ -170,7 +174,7 @@ class NAntBuilder(RunSpecific):
for prop in project.getWorkspace().getSysProperties() + \
project.getNAnt().getSysProperties():
properties.addPrefixedNamedParameter('-D:', prop.name,
- prop.value, ' = ')
+ prop.value, '=')
return properties
def preview(self, project, language, _stats):
Modified: gump/trunk/python/gump/core/run/gumpenv.py
URL: http://svn.apache.org/viewvc/gump/trunk/python/gump/core/run/gumpenv.py?rev=954169&r1=954168&r2=954169&view=diff
==============================================================================
--- gump/trunk/python/gump/core/run/gumpenv.py (original)
+++ gump/trunk/python/gump/core/run/gumpenv.py Sun Jun 13 05:37:40 2010
@@ -74,6 +74,7 @@ class GumpEnvironment(Annotatable, Worka
self.noMono = False
self.noNAnt = False
+ self.nant_command = None
self.noMaven = False
self.noMaven2 = False
self.noSvn = False
@@ -196,8 +197,7 @@ class GumpEnvironment(Annotatable, Worka
self.noMaven2 = not self.noMaven2 and not \
self._checkWithDashVersion('mvn', "no Maven 2.x builds")
- self.noNAnt = self._checkWithDashVersion('NAnt', "no NAnt builds")
-
+ self._check_nant()
self.noMono = self._checkWithDashVersion('mono', "no Mono runtime")
self.noMake = self._checkWithDashVersion('make', "no make builds")
@@ -389,6 +389,26 @@ class GumpEnvironment(Annotatable, Worka
def getTimezoneOffset(self):
return self.timezoneOffset
+ def _check_nant(self):
+ if not self.checked:
+ if not self._checkWithDashVersion('NAnt', "no NAnt builds"):
+ if not self._checkWithDashVersion('NAnt.exe', "no NAnt builds"):
+ self.noNAnt = self._checkWithDashVersion('nant',
+ "no NAnt builds",
+ '-help')
+ if self.noNAnt:
+ self.nant_command = 'nant'
+ else:
+ self.nant_command = 'NAnt.exe'
+ else:
+ self.nant_command = 'NAnt'
+
+ def get_nant_command(self):
+ self._check_nant()
+ if not self.noNAnt:
+ return None
+ return self.nant_command
+
if __name__ == '__main__':
env = GumpEnvironment()
env.checkEnvironment()