gump-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bode...@apache.org
Subject svn commit: r109349 - in gump/trunk/python/gump: actor/document/xdocs core/build core/model core/run
Date Wed, 01 Dec 2004 15:31:44 GMT
Author: bodewig
Date: Wed Dec  1 07:31:42 2004
New Revision: 109349

URL: http://svn.apache.org/viewcvs?view=rev&rev=109349
Log:
<make/> and <configure/> builders
Added:
   gump/trunk/python/gump/core/build/configure.py
   gump/trunk/python/gump/core/build/make.py
Modified:
   gump/trunk/python/gump/actor/document/xdocs/resolver.py
   gump/trunk/python/gump/core/build/__init__.py
   gump/trunk/python/gump/core/build/builder.py
   gump/trunk/python/gump/core/model/builder.py
   gump/trunk/python/gump/core/model/project.py
   gump/trunk/python/gump/core/run/gumpenv.py

Modified: gump/trunk/python/gump/actor/document/xdocs/resolver.py
Url: http://svn.apache.org/viewcvs/gump/trunk/python/gump/actor/document/xdocs/resolver.py?view=diff&rev=109349&p1=gump/trunk/python/gump/actor/document/xdocs/resolver.py&r1=109348&p2=gump/trunk/python/gump/actor/document/xdocs/resolver.py&r2=109349
==============================================================================
--- gump/trunk/python/gump/actor/document/xdocs/resolver.py	(original)
+++ gump/trunk/python/gump/actor/document/xdocs/resolver.py	Wed Dec  1 07:31:42 2004
@@ -42,7 +42,7 @@
 from gump.core.model.workspace import Workspace
 from gump.core.model.module import Module
 from gump.core.model.project import Project
-from gump.core.model.builder import Ant,NAnt,Maven,Script
+from gump.core.model.builder import Ant,NAnt,Maven,Script,Configure,Make
 from gump.core.model.object import *
 from gump.core.model.state import *
 
@@ -183,6 +183,8 @@
     elif isinstance(object, Ant) or \
         isinstance(object, NAnt) or \
         isinstance(object, Maven) or \
+        isinstance(object, Configure) or \
+        isinstance(object, Make) or \
         isinstance(object, Script) :
         index='Build'
     else:

Modified: gump/trunk/python/gump/core/build/__init__.py
Url: http://svn.apache.org/viewcvs/gump/trunk/python/gump/core/build/__init__.py?view=diff&rev=109349&p1=gump/trunk/python/gump/core/build/__init__.py&r1=109348&p2=gump/trunk/python/gump/core/build/__init__.py&r2=109349
==============================================================================
--- gump/trunk/python/gump/core/build/__init__.py	(original)
+++ gump/trunk/python/gump/core/build/__init__.py	Wed Dec  1 07:31:42 2004
@@ -22,6 +22,6 @@
 
 
 # tell Python what modules make up the gump.test package
-__all__ = ["builder", "ant","script","maven", "java"]
+__all__ = ["builder", "ant","script","maven", "java","nant","configure","make"]
 
     

Modified: gump/trunk/python/gump/core/build/builder.py
Url: http://svn.apache.org/viewcvs/gump/trunk/python/gump/core/build/builder.py?view=diff&rev=109349&p1=gump/trunk/python/gump/core/build/builder.py&r1=109348&p2=gump/trunk/python/gump/core/build/builder.py&r2=109349
==============================================================================
--- gump/trunk/python/gump/core/build/builder.py	(original)
+++ gump/trunk/python/gump/core/build/builder.py	Wed Dec  1 07:31:42 2004
@@ -49,6 +49,8 @@
 from gump.core.build.ant import AntBuilder
 from gump.core.build.nant import NAntBuilder
 from gump.core.build.maven import MavenBuilder
+from gump.core.build.configure import ConfigureBuilder
+from gump.core.build.make import MakeBuilder
 
 from gump.util import dump, display, getIndent, logResourceUtilization, \
                             invokeGarbageCollection
@@ -81,6 +83,8 @@
         self.nant=NAntBuilder(run)
         self.maven=MavenBuilder(run)
         self.script=ScriptBuilder(run)
+        self.configure = ConfigureBuilder(run)
+        self.make = MakeBuilder(run);
 
         # Place repository in repodir
         self.repository=self.run.getOutputsRepository()        
@@ -137,6 +141,10 @@
                     self.nant.buildProject(project, languageHelper, stats)
                 elif project.hasMaven():
                     self.maven.buildProject(project, languageHelper, stats)
+                elif project.hasConfigure():
+                    self.configure.buildProject(project, languageHelper, stats)
+                elif project.hasMake():
+                    self.make.buildProject(project, languageHelper, stats)
               
             # Do this even if not ok
             self.performPostBuild( project, languageHelper, stats )

Added: gump/trunk/python/gump/core/build/configure.py
Url: http://svn.apache.org/viewcvs/gump/trunk/python/gump/core/build/configure.py?view=auto&rev=109349
==============================================================================
--- (empty file)
+++ gump/trunk/python/gump/core/build/configure.py	Wed Dec  1 07:31:42 2004
@@ -0,0 +1,116 @@
+#!/usr/bin/python
+
+# Copyright 2004 The Apache Software Foundation
+#
+# Licensed 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
+
+from gump import log
+from gump.core.run.gumprun import *
+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 *
+
+
+###############################################################################
+# Classes
+###############################################################################
+
+class ConfigureBuilder(gump.core.run.gumprun.RunSpecific):
+    
+    def __init__(self,run):
+        """
+        A configure 'builder'
+        """
+        gump.core.run.gumprun.RunSpecific.__init__(self,run)
+
+    def buildProject(self,project,languageHelper,stats):
+        """
+        Run a project's configure script (doesn't support Windows, yet)
+        """
+        
+        workspace=self.run.getWorkspace()
+                 
+        log.info('Run Project\'s configure script: #[' + `project.getPosition()` + '] : '
+ project.getName())
+                
+        #
+        # Get the appropriate build command...
+        #
+        cmd=self.getConfigureCommand(project)
+
+        if cmd:
+            # Execute the command ....
+            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:                         
+                # 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
+           
+        # Where to run this:
+        basedir = configure.getBaseDirectory() or project.getBaseDirectory()
+
+        # The script
+        scriptfile=os.path.abspath(os.path.join(basedir, 'configure'))
+        
+        cmd=Cmd(scriptfile,'buildscript_'+project.getModule().getName()+'_'+project.getName(),\
+            basedir)    
+        
+        return cmd
+        
+        
+    def preview(self,project,languageHelper,stats):        
+        """
+        Preview what this would do
+        """
+        command=self.getConfigureCommand(project) 
+        command.dump()

Added: gump/trunk/python/gump/core/build/make.py
Url: http://svn.apache.org/viewcvs/gump/trunk/python/gump/core/build/make.py?view=auto&rev=109349
==============================================================================
--- (empty file)
+++ gump/trunk/python/gump/core/build/make.py	Wed Dec  1 07:31:42 2004
@@ -0,0 +1,127 @@
+#!/usr/bin/python
+
+# Copyright 2004 The Apache Software Foundation
+#
+# Licensed 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 make builder (uses make to build projects)
+"""
+
+import os.path
+import sys
+
+from gump import log
+from gump.core.run.gumprun import *
+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 *
+
+
+###############################################################################
+# Classes
+###############################################################################
+
+class MakeBuilder(gump.core.run.gumprun.RunSpecific):
+    
+    def __init__(self,run):
+        """
+        A make 'builder'
+        """
+        gump.core.run.gumprun.RunSpecific.__init__(self,run)
+
+    def buildProject(self,project,languageHelper,stats):
+        """
+        Run a project's make file
+        """
+        
+        workspace=self.run.getWorkspace()
+                 
+        log.info('Run make on project: #[' + `project.getPosition()` + '] : ' + project.getName())
+                
+        #
+        # Get the appropriate build command...
+        #
+        cmd=self.getMakeCommand(project)
+
+        if cmd:
+            # Execute the command ....
+            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:                         
+                # For now, things are going good...
+                project.changeState(STATE_SUCCESS)
+   
+    def getMakeCommand(self,project):
+        """ Return the command object for a <make entry """
+        make=project.make
+           
+        # Where to run this:
+        basedir = make.getBaseDirectory() or project.getBaseDirectory()
+
+        # The make target (or none == ALL)
+        target= make.getTarget()
+
+        # The make file (or none == Makefile)
+        buildfile = make.getBuildFile()
+
+        cmd=Cmd('make','build_'+project.getModule().getName()+'_'+project.getName(),
+            basedir)
+        
+        # Pass the buildfile
+        if buildfile: cmd.addParameter('-f', buildfile)
+    
+        # End with the target (or targets)...
+        if target: 
+            for targetParam in target.split():
+                cmd.addParameter(targetParam)
+
+        return cmd
+        
+        
+    def preview(self,project,languageHelper,stats):        
+        """
+        Preview what this would do
+        """
+        command=self.getMakeCommand(project) 
+        command.dump()

Modified: gump/trunk/python/gump/core/model/builder.py
Url: http://svn.apache.org/viewcvs/gump/trunk/python/gump/core/model/builder.py?view=diff&rev=109349&p1=gump/trunk/python/gump/core/model/builder.py&r1=109348&p2=gump/trunk/python/gump/core/model/builder.py&r2=109349
==============================================================================
--- gump/trunk/python/gump/core/model/builder.py	(original)
+++ gump/trunk/python/gump/core/model/builder.py	Wed Dec  1 07:31:42 2004
@@ -255,6 +255,12 @@
     """ A NAnt command (within a project) """
     pass
     
+# represents a <make/> element
+# will probably need to extend Builder directly later
+class Make(BaseAnt):
+    """ A make command (within a project) """
+    pass
+
 # represents an <maven/> element
 class Maven(Builder):
     """ A Maven command (within a project)"""
@@ -284,5 +290,10 @@
     	
     def getName(self):
         return self.name
-    
+
+# represents an <configure/> element
+class Configure(Builder):
+    """ A configure command (within a project)"""
+    pass
+
     	

Modified: gump/trunk/python/gump/core/model/project.py
Url: http://svn.apache.org/viewcvs/gump/trunk/python/gump/core/model/project.py?view=diff&rev=109349&p1=gump/trunk/python/gump/core/model/project.py&r1=109348&p2=gump/trunk/python/gump/core/model/project.py&r2=109349
==============================================================================
--- gump/trunk/python/gump/core/model/project.py	(original)
+++ gump/trunk/python/gump/core/model/project.py	Wed Dec  1 07:31:42 2004
@@ -30,7 +30,7 @@
                             AddressPair
 from gump.core.model.stats import Statable, Statistics
 from gump.core.model.property import Property
-from gump.core.model.builder import Ant,NAnt,Maven,Script
+from gump.core.model.builder import Ant,NAnt,Maven,Script,Configure,Make
 from gump.util import getIndent
 from gump.util.file import *
 from gump.core.model.depend import *
@@ -80,6 +80,8 @@
         self.nant=None
     	self.maven=None
     	self.script=None
+        self.configure = None
+        self.make = None
 
     	self.works=[]
     	self.mkdirs=[]
@@ -159,6 +161,14 @@
         if self.script: return True
         return False
     
+    def hasConfigure(self):
+        if self.configure: return True
+        return False
+        
+    def hasMake(self):
+        if self.make: return True
+        return False
+        
     def getAnt(self):
         return self.ant
         
@@ -171,6 +181,12 @@
     def getScript(self):
         return self.script
     
+    def getConfigure(self):
+        return self.configure
+        
+    def getMake(self):
+        return self.make
+
     def hasUrl(self):
         if self.url or self.getModule().hasUrl(): return True
         return False
@@ -372,6 +388,20 @@
             
             # Copy over any XML errors/warnings
             # :TODO:#1: transferAnnotations(self.xml.script, self)
+        
+        # Import any <nant part [if not packaged]
+        if self.hasDomChild('make') and not packaged:
+            self.make = Make(self.getDomChild('make'),self)
+            
+            # Copy over any XML errors/warnings
+            # :TODO:#1: transferAnnotations(self.xml.make, self)
+        
+        # Import any <nant part [if not packaged]
+        if self.hasDomChild('configure') and not packaged:
+            self.configure = Configure(self.getDomChild('configure'),self)
+            
+            # Copy over any XML errors/warnings
+            # :TODO:#1: transferAnnotations(self.xml.configure, self)
         
         # Set this up to be the base directory of this project,
         # if one is set

Modified: gump/trunk/python/gump/core/run/gumpenv.py
Url: http://svn.apache.org/viewcvs/gump/trunk/python/gump/core/run/gumpenv.py?view=diff&rev=109349&p1=gump/trunk/python/gump/core/run/gumpenv.py&r1=109348&p2=gump/trunk/python/gump/core/run/gumpenv.py&r2=109349
==============================================================================
--- gump/trunk/python/gump/core/run/gumpenv.py	(original)
+++ gump/trunk/python/gump/core/run/gumpenv.py	Wed Dec  1 07:31:42 2004
@@ -72,6 +72,7 @@
         self.noP4 = False   
         self.noJava = False
         self.noJavac = False
+        self.noMake = False    
         
         self.javaProperties = None
     
@@ -173,6 +174,11 @@
             not self._checkExecutable('mono','--help',False,False,'check_mono'): 
             self.noMono=True
             self.addWarning('"Mono" command not found, no Mono runtime')
+       
+        if not self.noMake and \
+            not self._checkExecutable('make','--help',False,False,'check_Make'): 
+            self.noMake=True
+            self.addWarning('"make" command not found, no make builds')
        
         self.checked = True
         

Mime
View raw message