gump-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bode...@apache.org
Subject svn commit: r1679395 - in /gump/live/python/gump/core/build: __init__.py nuget.py
Date Thu, 14 May 2015 15:50:09 GMT
Author: bodewig
Date: Thu May 14 15:50:09 2015
New Revision: 1679395

URL: http://svn.apache.org/r1679395
Log:
add NuGet builder

Added:
    gump/live/python/gump/core/build/nuget.py
      - copied, changed from r1679367, gump/live/python/gump/core/build/configure.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=1679395&r1=1679394&r2=1679395&view=diff
==============================================================================
--- gump/live/python/gump/core/build/__init__.py (original)
+++ gump/live/python/gump/core/build/__init__.py Thu May 14 15:50:09 2015
@@ -24,6 +24,6 @@ __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", "msbuild"]
+           "gradle", "msbuild", "nuget"]
 
     

Copied: gump/live/python/gump/core/build/nuget.py (from r1679367, gump/live/python/gump/core/build/configure.py)
URL: http://svn.apache.org/viewvc/gump/live/python/gump/core/build/nuget.py?p2=gump/live/python/gump/core/build/nuget.py&p1=gump/live/python/gump/core/build/configure.py&r1=1679367&r2=1679395&rev=1679395&view=diff
==============================================================================
--- gump/live/python/gump/core/build/configure.py (original)
+++ gump/live/python/gump/core/build/nuget.py Thu May 14 15:50:09 2015
@@ -6,113 +6,99 @@
 # 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,
 # 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.
 
-__revision__  = "$Rev: 36667 $"
-__date__      = "$Date: 2004-08-20 08:55:45 -0600 (Fri, 20 Aug 2004) $"
-__copyright__ = "Copyright (c) 1999-2004 Apache Software Foundation"
-__license__   = "http://www.apache.org/licenses/LICENSE-2.0"
-
-
-"""
-	An configure builder (uses ./configure to build projects)
-"""
-
-import os.path
-import sys
+__copyright__ = "Copyright (c) 1999-2015 Apache Software Foundation"
+__license__ = "http://www.apache.org/licenses/LICENSE-2.0"
 
 from gump import log
-from gump.core.run.gumprun import *
 from gump.core.build.script import getArgs
-from gump.core.config import dir, default, basicConfig
-
-from gump.util import dump, display, getIndent, logResourceUtilization, \
-                            invokeGarbageCollection
-from gump.util.note import Annotatable
-from gump.util.work import *
-
-from gump.util.tools import *
-
-from gump.core.model.workspace import *
-from gump.core.model.module import Module
-from gump.core.model.project import Project
-from gump.core.model.depend import  ProjectDependency
-from gump.core.model.stats import *
-from gump.core.model.state import *
-
+from gump.core.model.state import REASON_BUILD_FAILED, REASON_BUILD_TIMEDOUT, \
+    STATE_FAILED, STATE_SUCCESS
+from gump.core.run.gumprun import RunSpecific
+
+from gump.util.process.command import CMD_STATE_SUCCESS, CMD_STATE_TIMED_OUT, \
+    Cmd
+from gump.util.process.launcher import execute
+from gump.util.work import CommandWorkItem, WORK_TYPE_BUILD
 
 ###############################################################################
 # Classes
 ###############################################################################
 
-class ConfigureBuilder(gump.core.run.gumprun.RunSpecific):
-    
-    def __init__(self,run):
+class NuGetBuilder(RunSpecific):
+    """
+    A NuGet builder http://www.nuget.org/
+    """
+
+    def __init__(self, run):
         """
-        A configure 'builder'
+        A NuGet 'builder'
         """
-        gump.core.run.gumprun.RunSpecific.__init__(self,run)
+        RunSpecific.__init__(self, run)
 
-    def buildProject(self,project,languageHelper,stats):
+    def buildProject(self, project, _languageHelper, _stats):
         """
-        Run a project's configure script (doesn't support Windows, yet)
+        Run a NuGet command
         """
-        
-        workspace=self.run.getWorkspace()
-                 
-        log.info('Run Project\'s configure script: #[' + `project.getPosition()` + '] : '
+ project.getName())
-                
+
+        workspace = self.run.getWorkspace()
+
+        log.info('Run NuGet on: #[' + `project.getPosition()` + '] : ' + \
+                 project.getName())
+
         #
         # Get the appropriate build command...
         #
-        cmd=self.getConfigureCommand(project)
+        cmd = self.getNuGetCommand(project)
 
         if cmd:
             # Execute the command ....
-            cmdResult=execute(cmd,workspace.tmpdir)
-    
-            # Update Context    
-            work=CommandWorkItem(WORK_TYPE_BUILD,cmd,cmdResult)
+            cmdResult = execute(cmd, workspace.tmpdir)
+
+            # Update Context
+            work = CommandWorkItem(WORK_TYPE_BUILD, cmd, cmdResult)
             project.performedWork(work)
             project.setBuilt(True)
-                    
-            # Update Context w/ Results  
-            if not cmdResult.state==CMD_STATE_SUCCESS:
-                reason=REASON_BUILD_FAILED
-                if cmdResult.state==CMD_STATE_TIMED_OUT:
-                    reason=REASON_BUILD_TIMEDOUT
-                project.changeState(STATE_FAILED,reason)
-                        
-            else:                         
+
+            # Update Context w/ Results
+            if not cmdResult.state == CMD_STATE_SUCCESS:
+                reason = REASON_BUILD_FAILED
+                if cmdResult.state == CMD_STATE_TIMED_OUT:
+                    reason = REASON_BUILD_TIMEDOUT
+                project.changeState(STATE_FAILED, reason)
+
+            else:
                 # For now, things are going good...
                 project.changeState(STATE_SUCCESS)
-   
-    def getConfigureCommand(self,project):
-        """ Return the command object for a <configure entry """
-        configure=project.configure
-           
+
+    def getNuGetCommand(self, project):
+        """ Return the command object for a <nuget entry """
+        nuget = project.nuget
+
         # Where to run this:
-        basedir = configure.getBaseDirectory() or project.getBaseDirectory()
+        basedir = nuget.getBaseDirectory() or project.getBaseDirectory()
+
+        cmd = Cmd(self.run.env.get_msbuild_command(),
+                  'buildscript_' + project.getModule().getName() + '_' + \
+                  project.getName(), basedir)
+        cmd.addParameter(nuget.getCommand())
+        cmd.addParameters(getArgs(nuget))
+        if nuget.hasSolution():
+            cmd.addParameter(nuget.getSolution())
 
-        # The script
-        scriptfile=os.path.abspath(os.path.join(basedir, 'configure'))
-        
-        cmd=Cmd(scriptfile,'buildscript_'+project.getModule().getName()+'_'+project.getName(),\
-            basedir)    
-        cmd.addParameters(getArgs(configure))
-        
         return cmd
-        
-    def preview(self,project,languageHelper,stats):        
+
+    def preview(self, project, _languageHelper, _stats):
         """
         Preview what this would do
         """
-        command=self.getConfigureCommand(project) 
+        command = self.getNuGetCommand(project)
         command.dump()



Mime
View raw message