gump-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bode...@apache.org
Subject svn commit: r1679387 - in /gump/live/python/gump/core/build: __init__.py msbuild.py
Date Thu, 14 May 2015 14:46:25 GMT
Author: bodewig
Date: Thu May 14 14:46:25 2015
New Revision: 1679387

URL: http://svn.apache.org/r1679387
Log:
builder for msbuild/xbuild

Added:
    gump/live/python/gump/core/build/msbuild.py
      - copied, changed from r1679367, gump/live/python/gump/core/build/nant.py
Modified:
    gump/live/python/gump/core/build/__init__.py

Modified: gump/live/python/gump/core/build/__init__.py
URL: http://svn.apache.org/viewvc/gump/live/python/gump/core/build/__init__.py?rev=1679387&r1=1679386&r2=1679387&view=diff
==============================================================================
--- gump/live/python/gump/core/build/__init__.py (original)
+++ gump/live/python/gump/core/build/__init__.py Thu May 14 14:46:25 2015
@@ -23,6 +23,7 @@ __license__   = "http://www.apache.org/l
 
 
 # tell Python what modules make up the gump.test package
-__all__ = ["builder", "ant","script","maven", "java","nant","configure","make","gradle"]
+__all__ = ["builder", "ant","script","maven", "java","nant","configure","make",
+           "gradle", "msbuild"]
 
     

Copied: gump/live/python/gump/core/build/msbuild.py (from r1679367, gump/live/python/gump/core/build/nant.py)
URL: http://svn.apache.org/viewvc/gump/live/python/gump/core/build/msbuild.py?p2=gump/live/python/gump/core/build/msbuild.py&p1=gump/live/python/gump/core/build/nant.py&r1=1679367&r2=1679387&rev=1679387&view=diff
==============================================================================
--- gump/live/python/gump/core/build/nant.py (original)
+++ gump/live/python/gump/core/build/msbuild.py Thu May 14 14:46:25 2015
@@ -6,11 +6,11 @@
 # The ASF licenses this file to You under the Apache License, Version 2.0
 # (the "License"); you may not use this file except in compliance with
 # the License.  You may obtain a copy of the License at
-# 
+#
 #     http://www.apache.org/licenses/LICENSE-2.0
-# 
+#
 # Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS, 
+# distributed under the License is distributed on an "AS IS" BASIS,
 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 # See the License for the specific language governing permissions and
 # limitations under the License.
@@ -26,38 +26,30 @@ from gump.util.work import CommandWorkIt
 from gump.core.model.state import REASON_BUILD_FAILED, REASON_BUILD_TIMEDOUT, \
     REASON_PREBUILD_FAILED, STATE_FAILED, STATE_SUCCESS
 
-def getNAntProperties(project):
+def getMSBuildProperties(project):
     """ Get properties for a project """
-    return collect_properties(project.getWorkspace().getProperties() + \
-                                  project.getNAnt().getProperties())
-
-def getNAntSysProperties(project):
-    """ Get sysproperties for a project """
-    return collect_properties(project.getWorkspace().getSysProperties() + \
-                                  project.getNAnt().getSysProperties())
-
-def collect_properties(props):
-    """ collect named properties for a project """
     properties = Parameters()
+    props = project.getWorkspace().getProperties() + \
+            project.getMSBuild().getProperties()
     for prop in props:
-        properties.addPrefixedNamedParameter('-D:', prop.name, prop.value, '=')
+        properties.addPrefixedNamedParameter('/p:', prop.name, prop.value, '=')
     return properties
 
-class NAntBuilder(RunSpecific):
+class MSBuildBuilder(RunSpecific):
     """
-        A NAnt builder (uses nant to build projects)
+        A MSBuild builder (uses MSBuild or Mono's xbuild to build projects)
     """
 
 
     def __init__(self, run):
         """
-                The NAnt Builder is a .NET Builder
-        """ 
+                The MSBuild Builder is a .NET Builder
+        """
         RunSpecific.__init__(self, run)
 
     def buildProject(self, project, _language, _stats):
         """
-                Build a project using NAnt, based off the <nant metadata.
+                Build a project using MSBuild, based off the <msbuild metadata.
 
                 Note: switch on -verbose|-debug based of the stats for this
                 project, i.e. how long in a state of failure.
@@ -65,11 +57,11 @@ class NAntBuilder(RunSpecific):
 
         workspace = self.run.getWorkspace()
 
-        log.info('Run NAnt on Project: #[' + `project.getPosition()` + \
+        log.info('Run MSBuild on Project: #[' + `project.getPosition()` + \
                      '] : ' + project.getName())
 
         # Get the appropriate build command...
-        cmd = self.getNAntCommand(project)
+        cmd = self.getMSBuildCommand(project)
 
         if cmd:
             # Execute the command ....
@@ -90,14 +82,14 @@ class NAntBuilder(RunSpecific):
                 # For now, things are going good...
                 project.changeState(STATE_SUCCESS)
 
-    def getNAntCommand(self, project):
+    def getMSBuildCommand(self, project):
         """
-        Build an NANT command for this project, based on the <nant metadata
+        Build an MSBuild command for this project, based on the <msbuild 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"
+        if not self.run.env.get_msbuild_command():
+            message = "Can't run MSBuild builds since MSBuild hasn't been found"
             log.error(message)
             project.addError(message)
             project.setBuilt(True)
@@ -105,75 +97,54 @@ class NAntBuilder(RunSpecific):
             return None
 
         # The original model information...
-        nant = project.nant
-        # The nant target (or none == nant default target)
-        target = nant.getTarget()
+        msbuild = project.msbuild
+        # The msbuild target (or none == msbuild default target)
+        target = msbuild.getTarget()
 
-        # The nant build file (or none == build.xml)
-        buildfile = nant.getBuildFile()
+        # The msbuild build file (or none == Solution/Project in current folder)
+        buildfile = msbuild.getBuildFile()
 
         # Optional 'verbose' or 'debug'
-        verbose = nant.isVerbose()
-        debug = nant.isDebug()
+        verbose = msbuild.isVerbose()
+        debug = msbuild.isDebug()
 
         # Where to run this:
-        basedir = nant.getBaseDirectory() or project.getBaseDirectory()
+        basedir = msbuild.getBaseDirectory() or project.getBaseDirectory()
 
         # Get properties
-        properties = getNAntProperties(project)
+        properties = getMSBuildProperties(project)
 
-        # Get system properties
-        sysproperties = getNAntSysProperties(project)
-
-        # Run NAnt...
-        cmd = Cmd(self.run.env.get_nant_command(),
+        # Run MSBuild...
+        cmd = Cmd(self.run.env.get_msbuild_command(),
                   'build_' + project.getModule().getName() + '_' + \
                     project.getName(), 
                   basedir)
 
-        # Launch with specified framework (e.g. mono-1.0.1) if
-        # required.
-        workspace = self.run.getWorkspace()
-        if workspace.hasDotNetInformation():
-            dotnetInfo = workspace.getDotNetInformation()
-            if dotnetInfo.hasFramework():
-                cmd.addParameter('-t:', dotnetInfo.getFramework(), '')
-
-        # These are workspace + project system properties
-        cmd.addNamedParameters(sysproperties)
-
-        # Allow NAnt-level debugging...
+        # Allow MSBuild-level debugging...
         if project.getWorkspace().isDebug() or project.isDebug() or debug: 
-            cmd.addParameter('-debug')
+            cmd.addParameter('/verbosity:diagnostic')
         if project.getWorkspace().isVerbose() or project.isVerbose() \
                 or verbose: 
-            cmd.addParameter('-verbose')
+            cmd.addParameter('/verbosity:detailed')
 
-        # Some builds might wish for this information
-        # :TODO: Grant greater access to Gump variables from
-        # within.
-        mergeFile = project.getWorkspace().getMergeFile()
-        if mergeFile:
-            cmd.addPrefixedParameter('-D:', 'gump.merge', str(mergeFile), '=')
         # These are from the project and/or workspace
         # These are 'normal' properties.
         cmd.addNamedParameters(properties)
 
+        # target (or targets)...
+        if target: 
+            cmd.addParameter('/target:' + target)
+
         # Pass the buildfile
         if buildfile:
-            cmd.addParameter('-buildfile', buildfile, ':')
-
-        # End with the target (or targets)...
-        if target: 
-            for targetParam in target.split(', '):
-                cmd.addParameter(targetParam)
+            cmd.addParameter(buildfile)
 
         return cmd
 
     def preview(self, project, _language, _stats):
         """
-                Preview what an NAnt build would look like.
+                Preview what an MSBuild build would look like.
         """
-        cmd = self.getNAntCommand(project) 
+        cmd = self.getMSBuildCommand(project) 
         cmd.dump()
  



Mime
View raw message