ajack       2003/12/02 15:58:47

  Modified:    python/gump engine.py
               python/gump/model object.py
               python/gump/test model.py
  Log:
  More work on publishing reports (especially when build fails)
  
  Revision  Changes    Path
  1.33      +35 -35    jakarta-gump/python/gump/engine.py
  
  Index: engine.py
  ===================================================================
  RCS file: /home/cvs/jakarta-gump/python/gump/engine.py,v
  retrieving revision 1.32
  retrieving revision 1.33
  diff -u -r1.32 -r1.33
  --- engine.py 2 Dec 2003 22:36:46 -0000       1.32
  +++ engine.py 2 Dec 2003 23:58:46 -0000       1.33
  @@ -444,46 +444,46 @@
        
           log.debug(' ------ Performing post-Build Actions (check jars) for : '+ 
project.getName())
   
  -        if project.hasOutputs():
  -            outputsOk=1
  -            for jar in project.getJars():
  -                jarPath=os.path.abspath(jar.getPath())
  -                if not os.path.exists(jarPath):
  -                    project.changeState(STATE_FAILED,REASON_MISSING_OUTPUTS)
  -                    outputsOk=0
  -                    project.addError("Missing Output: " + str(jarPath))
  -                            
  -            if outputsOk: 
  +        if project.okToPerformWork():
  +            if project.hasOutputs():
  +                outputsOk=1
                   for jar in project.getJars():
                       jarPath=os.path.abspath(jar.getPath())
  -                    # Copy to repository
  -                    repository.publish( project.getModule().getName(), jarPath )
  +                    if not os.path.exists(jarPath):
  +                        project.changeState(STATE_FAILED,REASON_MISSING_OUTPUTS)
  +                        outputsOk=0
  +                        project.addError("Missing Output: " + str(jarPath))
  +                            
  +                if outputsOk: 
  +                    for jar in project.getJars():
  +                        jarPath=os.path.abspath(jar.getPath())
  +                        # Copy to repository
  +                        repository.publish( project.getModule().getName(), jarPath )
               
  -                project.changeState(STATE_SUCCESS)
  -                    
  -                # For 'fun' list repository
  -                
listDirectoryAsWork(project,repository.getGroupDir(project.getModule().getName()), \
  -                                    'list_repo_'+project.getName()) 
  +                    project.changeState(STATE_SUCCESS)
                       
  +                    # For 'fun' list repository
  +                    
listDirectoryAsWork(project,repository.getGroupDir(project.getModule().getName()), \
  +                                        'list_repo_'+project.getName())             
        
  +                else:
  +                    #
  +                    # List all directories that should've contained
  +                    # outputs, to see what is there.
  +                    #
  +                    dirs=[]
  +                    dircnt=0
  +                    for jar in project.getJars():
  +                        jarPath=os.path.abspath(jar.getPath())
  +                        dir=os.path.dirname(jarPath)
  +                        if not dir in dirs and os.path.exists(dir):
  +                            dircnt += 1
  +                            listDirectoryAsWork(project,dir,\
  +                                
'list_'+project.getName()+'_dir'+str(dircnt)+'_'+os.path.basename(dir))
  +                            dirs.append(dir)
  +                        else:
  +                            project.addWarning("No such directory (where output is 
expect) : " + dir)
               else:
  -                #
  -                # List all directories that should've contained
  -                # outputs, to see what is there.
  -                #
  -                dirs=[]
  -                dircnt=0
  -                for jar in project.getJars():
  -                    jarPath=os.path.abspath(jar.getPath())
  -                    dir=os.path.dirname(jarPath)
  -                    if not dir in dirs and os.path.exists(dir):
  -                        dircnt += 1
  -                        listDirectoryAsWork(project,dir,\
  -                            
'list_'+project.getName()+'_dir'+str(dircnt)+'_'+os.path.basename(dir))
  -                        dirs.append(dir)
  -                    else:
  -                        project.addWarning("No such directory (where output is 
expect) : " + dir)
  -        else:
  -            project.changeState(STATE_SUCCESS)
  +                project.changeState(STATE_SUCCESS)
            
           #   
           # Display report output...
  
  
  
  1.11      +4 -2      jakarta-gump/python/gump/model/object.py
  
  Index: object.py
  ===================================================================
  RCS file: /home/cvs/jakarta-gump/python/gump/model/object.py,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- object.py 2 Dec 2003 17:36:40 -0000       1.10
  +++ object.py 2 Dec 2003 23:58:47 -0000       1.11
  @@ -294,16 +294,18 @@
       def __init__(self,xml,owner):
           ModelObject.__init__(self,xml,owner)                
           
  -    def getResolvedPath(self,path):  
  +    def getResolvedPath(self):  
           path=None
           if self.xml.nested:
               path=os.path.abspath(    \
                       os.path.join(    self.owner.getModule().getSourceDirectory(),   
 \
  -                                    work.nested))
  +                                    self.xml.nested))
           elif self.xml.parent:
               path=os.path.abspath(    \
                       os.path.join(self.owner.getWorkspace().getBaseDirectory(),      
 \
                                    self.xml.parent))
  +                                 
  +        return path
   
                 
   # represents a <junitreport/> element
  
  
  
  1.9       +7 -0      jakarta-gump/python/gump/test/model.py
  
  Index: model.py
  ===================================================================
  RCS file: /home/cvs/jakarta-gump/python/gump/test/model.py,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- model.py  1 Dec 2003 17:34:08 -0000       1.8
  +++ model.py  2 Dec 2003 23:58:47 -0000       1.9
  @@ -205,4 +205,11 @@
                   
           self.assertTrue('Maven project has a Maven object', self.maven1.hasMaven())
           
  +    def testJunitReport(self):
  +                
  +        self.assertLengthAbove('This has a <junitreport', 
self.project3.getReports(), 0)
  +        
  +        for report in self.project3.getReports():
  +            self.assertNonZero('Need a directory', report.getResolvedPath())
  +        
           
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to