gump-general mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aj...@apache.org
Subject cvs commit: jakarta-gump/python/gump/document xdoc.py forrest.py
Date Tue, 10 Feb 2004 00:25:34 GMT
ajack       2004/02/09 16:25:34

  Modified:    python/gump/model ant.py project.py server.py
               python/gump/document xdoc.py forrest.py
  Log:
  Trying to rationalize 'basedir' handling.
  
  Revision  Changes    Path
  1.15      +27 -13    jakarta-gump/python/gump/model/ant.py
  
  Index: ant.py
  ===================================================================
  RCS file: /home/cvs/jakarta-gump/python/gump/model/ant.py,v
  retrieving revision 1.14
  retrieving revision 1.15
  diff -u -r1.14 -r1.15
  --- ant.py	5 Feb 2004 05:43:56 -0000	1.14
  +++ ant.py	10 Feb 2004 00:25:34 -0000	1.15
  @@ -76,17 +76,17 @@
          
   
   # represents an <ant/> element
  -class AntBuilder(ModelObject, PropertyContainer):
  +class Builder(ModelObject, PropertyContainer):
       """ An Ant command (within a project)"""
       def __init__(self,xml,project):
       	ModelObject.__init__(self,xml,project)
       	PropertyContainer.__init__(self)
  -        	    
  -    	    
  +            
  +        self.basedir=None
  +        
           # Store owning project
           self.project=project
       	
  -    	
       #
       # expand properties - in other words, do everything to complete the
       # entry that does NOT require referencing another project
  @@ -188,6 +188,11 @@
       	
       	# Complete them all
           self.completeProperties(workspace)
  +        
  +        # Set this up...
  +        self.basedir = os.path.abspath(os.path.join(	\
  +                                self.project.getModule().getSourceDirectory() or dir.base,
\
  +                                self.xml.basedir or self.project.getBaseDirectory() or
''))
                   
           self.setComplete(1)
                       
  @@ -201,15 +206,16 @@
           # Dump all properties...
           #
           PropertyContainer.dump(self,indent+1,output)
  - 
  - 
  +
  +    def getBaseDirectory(self):
  +         return self.basedir
          
   
   # represents an <ant/> element
  -class Ant(AntBuilder):
  +class Ant(Builder):
       """ An Ant command (within a project)"""
       def __init__(self,xml,project):
  -    	AntBuilder.__init__(self,xml,project)
  +    	Builder.__init__(self,xml,project)
         
           # Import the target
       	self.target='gump'
  @@ -228,10 +234,10 @@
           return self.buildfile
   
   # represents an <maven/> element
  -class Maven(AntBuilder):
  +class Maven(Builder):
       """ A Maven command (within a project)"""
       def __init__(self,xml,project):
  -    	AntBuilder.__init__(self,xml,project)
  +    	Builder.__init__(self,xml,project)
       	
           # Import the goal
       	self.goal='jar'
  @@ -240,4 +246,12 @@
               	    
       def getGoal(self):
           return self.goal
  +    	
  +
  +# represents an <script/> element
  +class Script(Builder):
  +    """ A script command (within a project)"""
  +    def __init__(self,xml,project):
  +    	Builder.__init__(self,xml,project)
  +    
       	
  
  
  
  1.35      +107 -86   jakarta-gump/python/gump/model/project.py
  
  Index: project.py
  ===================================================================
  RCS file: /home/cvs/jakarta-gump/python/gump/model/project.py,v
  retrieving revision 1.34
  retrieving revision 1.35
  diff -u -r1.34 -r1.35
  --- project.py	9 Feb 2004 22:00:55 -0000	1.34
  +++ project.py	10 Feb 2004 00:25:34 -0000	1.35
  @@ -187,6 +187,9 @@
           self.module=None # Module has to claim ownership
           self.workspace=workspace
       	
  +    	self.home=None
  +    	self.basedir=None
  +    	
       	#############################################################
       	# Dependency Trees
       	#
  @@ -238,7 +241,6 @@
           if hasattr(self,'script') and self.script: return 1
           return 0
       
  -      
       def getAnt(self):
           return self.ant
           
  @@ -417,9 +419,22 @@
           # Import any <maven part [if not packaged]
           if self.xml.maven and not packaged:
               self.maven = Maven(self.xml.maven,self)
  -        
  -        # :TODO: Scripts
  -        
  +            
  +        # Import any <maven part [if not packaged]
  +        if self.xml.maven and not packaged:
  +            self.maven = Maven(self.xml.maven,self)
  +            
  +        # Import any <script part [if not packaged]
  +        if self.xml.script and not packaged:
  +            self.script = Script(self.xml.script,self)
  +        
  +        # Set this up to be the base directory of this project,
  +        # if one is set
  +        if self.xml.basedir:
  +            self.basedir = os.path.abspath(os.path.join(	\
  +                                self.getModule().getSourceDirectory() or dir.base,	\
  +                                self.xml.asedir))
  +         
           # Compute home directory
           if self.isPackaged():
               # Installed below package directory
  @@ -508,7 +523,11 @@
               
           if self.maven: 
               self.maven.complete(self,workspace)
  -            transferAnnotations(self.maven, self)              
  +            transferAnnotations(self.maven, self)    
  +            
  +        if self.script: 
  +            self.script.complete(self,workspace)
  +            transferAnnotations(self.script, self)              
               
           if not packaged:    
               #
  @@ -653,6 +672,13 @@
           for dependee in self.getFullDependees():
               if dependee.getOwnerProject()==project: return 1
               
  +    def hasBaseDirectory(self):
  +        if hasattr(self,'basedir') and self.basedir: return 1
  +        return 0
  +        
  +    def getBaseDirectory(self):
  +         return self.basedir
  +         
       def hasHomeDirectory(self):
           if hasattr(self,'home') and self.home: return 1
           return 0
  @@ -683,10 +709,10 @@
   
       def getBuildCommand(self):
   
  -        # get the ant element (if it exests)
  +        # get the ant element (if it exists)
           ant=self.xml.ant
   
  -        # get the maven element (if it exests)
  +        # get the maven element (if it exists)
           maven=self.xml.maven
   
           # get the script element (if it exists)
  @@ -696,9 +722,9 @@
             #  log.debug('Not building ' + project.name + ' (no <ant/> or <maven/>
or <script/> specified)')
             return None
   
  -        if script and script.name:
  +        if self.hasScript():
               return self.getScriptCommand()
  -        elif maven :
  +        elif self.hasMaven() :
               return self.getMavenCommand()
           else:
               return self.getAntCommand()
  @@ -707,27 +733,24 @@
       # Build an ANT command for this project
       #        
       def getAntCommand(self):
  -        ant=self.xml.ant
  +        
  +        ant=self.ant
  +        antxml=self.xml.ant
       
           # The ant target (or none == ant default target)
  -        target= ant.target or ''
  +        target= antxml.target or ''
       
           # The ant build file (or none == build.xml)
  -        buildfile = ant.buildfile or ''
  +        buildfile = antxml.buildfile or ''
       
           # Optional 'verbose' or 'debug'
  -        verbose=ant.verbose
  -        debug=ant.debug
  +        verbose=antxml.verbose
  +        debug=antxml.debug
       
           #
           # Where to run this:
           #
  -        #	The module src directory (if exists) or Gump base
  -        #	plus:
  -        #	The specifier for ANT, or nothing.
  -        #
  -        basedir = os.path.normpath(os.path.join(self.getModule().getSourceDirectory() or
dir.base,	\
  -                                                    ant.basedir or ''))
  +        basedir = ant.getBaseDirectory() or self.getBaseDirectory()
       
           #
           # Build a classpath (based upon dependencies)
  @@ -799,24 +822,20 @@
       # Build an ANT command for this project
       #        
       def getMavenCommand(self):
  -        maven=self.xml.maven
  +        maven=self.maven
  +        mavenxml=self.xml.maven
       
           # The ant goal (or none == ant default goal)
  -        goal=self.maven.getGoal()
  +        goal=maven.getGoal()
       
           # Optional 'verbose' or 'debug'
  -        verbose=maven.verbose
  -        debug=maven.debug
  +        verbose=mavenxml.verbose
  +        debug=mavenxml.debug
       
           #
           # Where to run this:
           #
  -        #	The module src directory (if exists) or Gump base
  -        #	plus:
  -        #	The specifier for Maven, or nothing.
  -        #
  -        basedir = os.path.abspath(os.path.join(self.getModule().getSourceDirectory() or
dir.base,	\
  -                                                    maven.basedir or ''))
  +        basedir = maven.getBaseDirectory() or self.getBaseDirectory()
       
           #
           # Build a classpath (based upon dependencies)
  @@ -829,7 +848,7 @@
           #jvmargs=self.getJVMArgs()
      
           #
  -        # Run java on apache Ant...
  +        # Run Maven...
           #
           cmd=Cmd('maven','build_'+self.getModule().getName()+'_'+self.getName(),\
               basedir,{'CLASSPATH':classpath})
  @@ -867,13 +886,62 @@
           #cmd.addPrefixedParameter('-D','build.sysclasspath','only','=')
       
           # End with the goal...
  -        if goal: 
  -            cmd.addParameter(goal)
  -        else:
  -            cmd.addParameter('jar')
  +        cmd.addParameter(goal)
       
           return cmd
  +  
  +    def getScriptCommand(self):
  +        """ Return the command object for a <script entry """
  +        script=self.script
  +        scriptxml=self.xml.script 
  +           
  +        #
  +        # Where to run this:
  +        #
  +        basedir = script.getBaseDirectory() or self.getBaseDirectory()
   
  +        # Add .sh  or .bat as appropriate to platform
  +        scriptfullname=script.getName()
  +        if not os.name == 'dos' and not os.name == 'nt':
  +            scriptfullname += '.sh'
  +        else:
  +            scriptfullname += '.bat'
  +      
  +        # Optional 'verbose' or 'debug'
  +        verbose=scriptxml.verbose
  +        debug=scriptxml.debug
  +       
  +        scriptfile=os.path.abspath(os.path.join(basedir, scriptfullname))
  +        
  +        # Not sure this is relevent...
  +        (classpath,bootclasspath)=self.getClasspaths()
  +
  +        cmd=Cmd(scriptfile,'buildscript_'+self.getModule().getName()+'_'+self.getName(),\
  +            basedir,{'CLASSPATH':classpath})    
  +            
  +        # Set this as a system property. Setting it here helps JDK1.4+
  +        # AWT implementations cope w/o an X11 server running (e.g. on
  +        # Linux)
  +        #    
  +        cmd.addPrefixedParameter('-D','java.awt.headless','true','=')
  +    
  +        #
  +        # Add BOOTCLASSPATH
  +        #
  +        if bootclasspath:
  +            cmd.addPrefixedParameter('-X','bootclasspath/p',bootclasspath,':')
  +                    
  +        #
  +        # Allow ant-level debugging...
  +        #
  +        if self.getWorkspace().isDebug() or debug:
  +            cmd.addParameter('-debug')  
  +        if self.getWorkspace().isVerbose() or verbose:
  +            cmd.addParameter('-verbose')  
  +        
  +        return cmd
  +    
  +                
   
       def getJVMArgs(self):
           """Get JVM arguments for a project"""
  @@ -926,7 +994,7 @@
           # Output classpath properties
           #
           props.write("""
  -        # ------------------------------------------------------------------------
  +# ------------------------------------------------------------------------
   # M A V E N  J A R  O V E R R I D E
   # ------------------------------------------------------------------------
   maven.jar.override = on
  @@ -946,54 +1014,7 @@
                   props.write(('maven.jar.%s=%s\n') % (id,path))
   
           return propertiesFile
  -        
  -    def getScriptCommand(self):
  -        """ Return the command object for a <script entry """
  -        script=self.xml.script 
  -           
  -        basedir=os.path.abspath(os.path.join(self.getModule().getSourceDirectory() or dir.base,\
  -                        script.basedir or ''))
  -
  -        # Add .sh  or .bat as appropriate to platform
  -        scriptfullname=script.name
  -        if not os.name == 'dos' and not os.name == 'nt':
  -            scriptfullname += '.sh'
  -        else:
  -            scriptfullname += '.bat'
         
  -        # Optional 'verbose' or 'debug'
  -        verbose=script.verbose
  -        debug=script.debug
  -       
  -        scriptfile=os.path.abspath(os.path.join(basedir, scriptfullname))
  -        (classpath,bootclasspath)=self.getClasspaths()
  -
  -        cmd=Cmd(scriptfile,'buildscript_'+self.getModule().getName()+'_'+self.getName(),\
  -            basedir,{'CLASSPATH':classpath})    
  -            
  -        # Set this as a system property. Setting it here helps JDK1.4+
  -        # AWT implementations cope w/o an X11 server running (e.g. on
  -        # Linux)
  -        #    
  -        cmd.addPrefixedParameter('-D','java.awt.headless','true','=')
  -    
  -        #
  -        # Add BOOTCLASSPATH
  -        #
  -        if bootclasspath:
  -            cmd.addPrefixedParameter('-X','bootclasspath/p',bootclasspath,':')
  -                    
  -        #
  -        # Allow ant-level debugging...
  -        #
  -        if self.getWorkspace().isDebug() or debug:
  -            cmd.addParameter('-debug')  
  -        if self.getWorkspace().isVerbose() or verbose:
  -            cmd.addParameter('-verbose')  
  -        
  -        return cmd
  -    
  -                
       def dump(self, indent=0, output=sys.stdout):
           """ Display the contents of this object """
           output.write(getIndent(indent)+'Project: ' + self.getName() + '\n')
  
  
  
  1.4       +12 -0     jakarta-gump/python/gump/model/server.py
  
  Index: server.py
  ===================================================================
  RCS file: /home/cvs/jakarta-gump/python/gump/model/server.py,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- server.py	9 Feb 2004 19:30:12 -0000	1.3
  +++ server.py	10 Feb 2004 00:25:34 -0000	1.4
  @@ -87,6 +87,18 @@
       def getType(self):
           return str(self.xml.type)
           
  +    def hasSite(self):
  +        return hasattr(self.xml,'site') and self.xml.site
  +           
  +    def getSite(self):
  +        return str(self.xml.site)
  +        
  +    def hasUrl(self):
  +        return hasattr(self.xml,'url') and self.xml.url
  +           
  +    def getUrl(self):
  +        return str(self.xml.url)
  +        
       def hasTitle(self): 
           return hasattr(self.xml,'title') and self.xml.title
           
  
  
  
  1.10      +10 -4     jakarta-gump/python/gump/document/xdoc.py
  
  Index: xdoc.py
  ===================================================================
  RCS file: /home/cvs/jakarta-gump/python/gump/document/xdoc.py,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- xdoc.py	30 Jan 2004 17:22:58 -0000	1.9
  +++ xdoc.py	10 Feb 2004 00:25:34 -0000	1.10
  @@ -514,7 +514,13 @@
   
       def createStrong(self,text=None,transient=0):
           return self.storePiece(XDocStrong(self.createSubContext(transient),text))
  -
  +        
  +    def createLink(self,href,text=None):
  +        return self.storePiece(XDocLink(self.createSubContext(),href,text))           
  
  +        
  +    def createFork(self,href,text=None):
  +        return self.storePiece(XDocFork(self.createSubContext(),href,text))
  +        
   class XDocWarning(XDocPiece):
       def __init__(self,context,text):
           XDocPiece.__init__(self,context)
  
  
  
  1.66      +14 -5     jakarta-gump/python/gump/document/forrest.py
  
  Index: forrest.py
  ===================================================================
  RCS file: /home/cvs/jakarta-gump/python/gump/document/forrest.py,v
  retrieving revision 1.65
  retrieving revision 1.66
  diff -u -r1.65 -r1.66
  --- forrest.py	9 Feb 2004 19:09:36 -0000	1.65
  +++ forrest.py	10 Feb 2004 00:25:34 -0000	1.66
  @@ -802,6 +802,13 @@
           if server.hasTitle():
               detailList.createEntry('Title: ', server.getTitle())
       
  +        if server.hasUrl():
  +            detailList.createEntry('URL: ').createFork(repo.getUrl())
  +    
  +            # Parent 'site' (owner reference)
  +            if server.hasSite() and not server.getSite() == server.getUrl():
  +                detailList.createEntry('Site: ').createFork(repo.getSite())
  +            
           self.documentXML(document,server)
           
           self.documentWorkList(document,server,'Server-level Work')
  @@ -1018,11 +1025,13 @@
           
           detailsList=detailsSection.createList()
               
  -        self.insertLink(project.getModule(),project,detailsList.createEntry('Module: '))
  -        
  +        self.insertLink(project.getModule(),project,detailsList.createEntry('Containing
Module: '))        
           
           if project.hasHomeDirectory():
               detailsList.createEntry('Home Directory: ', project.getHomeDirectory())
  +            
  +        if project.hasBaseDirectory():
  +            detailsList.createEntry('Base Directory: ', project.getBaseDirectory())
               
           if project.hasCause() and not project==project.getCause():
               self.insertTypedLink(project.getCause(),project,detailsList.createEntry('Root
Cause: '))
  
  
  

Mime
View raw message