gump-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bode...@apache.org
Subject svn commit: r962764 - in /gump/live: ./ python/gump/core/build/maven.py python/gump/core/build/mvn.py python/gump/core/language/java.py python/gump/core/update/bzr.py python/gump/core/update/darcs.py python/gump/core/update/hg.py python/gump/test/maven.py
Date Sat, 10 Jul 2010 05:44:10 GMT
Author: bodewig
Date: Sat Jul 10 05:44:09 2010
New Revision: 962764

URL: http://svn.apache.org/viewvc?rev=962764&view=rev
Log:
merge CLASSPATH fixes: only add jars; mvn and maven don't use it anyway

Modified:
    gump/live/   (props changed)
    gump/live/python/gump/core/build/maven.py
    gump/live/python/gump/core/build/mvn.py
    gump/live/python/gump/core/language/java.py   (contents, props changed)
    gump/live/python/gump/core/update/bzr.py   (props changed)
    gump/live/python/gump/core/update/darcs.py   (props changed)
    gump/live/python/gump/core/update/hg.py   (props changed)
    gump/live/python/gump/test/maven.py

Propchange: gump/live/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Sat Jul 10 05:44:09 2010
@@ -1 +1 @@
-/gump/trunk:746160,746727,746892,747270,747272-747273,747656,748010,748018,748028,748661,748967,760784-761159,815848,953630-954169,955387,955837,956771,957107,957408,958453,958915,959344,959847,960260,960295,960297,960300,960303,961244,961577
+/gump/trunk:746160,746727,746892,747270,747272-747273,747656,748010,748018,748028,748661,748967,760784-761159,815848,953630-954169,955387,955837,956771,957107,957408,958453,958915,959344,959847,960260,960295,960297,960300,960303,961244,961577,961843,961859,961870,962401

Modified: gump/live/python/gump/core/build/maven.py
URL: http://svn.apache.org/viewvc/gump/live/python/gump/core/build/maven.py?rev=962764&r1=962763&r2=962764&view=diff
==============================================================================
--- gump/live/python/gump/core/build/maven.py (original)
+++ gump/live/python/gump/core/build/maven.py Sat Jul 10 05:44:09 2010
@@ -11,7 +11,7 @@
 #     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.
@@ -22,262 +22,239 @@ __copyright__ = "Copyright (c) 1999-2004
 __license__   = "http://www.apache.org/licenses/LICENSE-2.0"
 
 
-"""
-
-"""
-
+import gump
 import os.path
-import sys
+import time
 
 from gump import log
-from gump.core.run.gumprun import *
-from gump.core.config import dir, default, basicConfig
+from gump.core.model.workspace import CommandWorkItem, \
+    REASON_BUILD_FAILED, REASON_BUILD_TIMEDOUT, REASON_PREBUILD_FAILED, \
+    STATE_FAILED, STATE_SUCCESS,  WORK_TYPE_BUILD
+from gump.core.run.gumprun import RunSpecific
+
+from gump.util.file import FILE_TYPE_CONFIG
+from gump.util.process.command import Cmd, CMD_STATE_SUCCESS, \
+    CMD_STATE_TIMED_OUT
+from gump.util.process.launcher import execute
+from gump.util.tools import catFileToFileHolder
+
+#
+# Build an Maven command for this project
+#
+def getMavenCommand(project):
+    maven = project.maven
+
+    # The maven goal (or none == maven default goal)
+    goal = maven.getGoal()
+
+    # Optional 'verbose' or 'debug'
+    verbose = maven.isVerbose()
+    debug = maven.isDebug()
+
+    #
+    # Where to run this:
+    #
+    basedir = maven.getBaseDirectory() or project.getBaseDirectory()
+
+    # Run Maven...
+    cmd = Cmd('maven', 'build_' + project.getModule().getName() + '_' + \
+                  project.getName(), basedir)
+
+    #
+    # Allow maven-level debugging...
+    #
+    if project.getWorkspace().isDebug() or project.isDebug() or debug: 
+        cmd.addParameter('--debug')
+    if project.getWorkspace().isVerbose()  or project.isVerbose() \
+            or verbose: 
+        cmd.addParameter('--exception') 
+
+    #
+    # Suppress downloads
+    #
+    cmd.addParameter('--offline')
+
+    # End with the goal...
+    if goal: 
+        for goalParam in goal.split(', '):
+            cmd.addParameter(goalParam)
+
+    return cmd
+
+# The propertiesFile parameter is primarily for testing.
+def generateMavenProperties(project, languageHelper, propertiesFile = None):
+    """Set properties/overrides for a Maven project"""
+
+    #:TODO: Does Maven have the idea of system properties?
+
+    #
+    # Where to put this:
+    #
+    basedir = project.maven.getBaseDirectory() or project.getBaseDirectory()
+    if not propertiesFile: 
+        propertiesFile = os.path.abspath(os.path.join(basedir,
+                                                      'build.properties'))
+
+    # Ensure containing directory exists, or make it.
+    propsdir = os.path.dirname(propertiesFile)
+    if not os.path.exists(propsdir):
+        project.addInfo('Making directory for Maven properties: [' + \
+                            propsdir + ']')
+        os.makedirs(propsdir)
+
+    if os.path.exists(propertiesFile):
+        project.addWarning('Overriding Maven properties: [' + \
+                               propertiesFile + ']')
 
-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 *
 
+    props = open(propertiesFile, 'w')
+
+    props.write(("""# ------------------------------------------------------------------------
+# DO NOT EDIT  DO NOT EDIT  DO NOT EDIT  DO NOT EDIT  DO NOT EDIT  DO NOT EDIT  DO NOT EDIT

+#
+# File Automatically Generated by Gump, see http://gump.apache.org/
+#
+# Generated For : %s
+# Generated At  : %s
+#
+#
+# DO NOT EDIT  DO NOT EDIT  DO NOT EDIT  DO NOT EDIT  DO NOT EDIT  DO NOT EDIT  DO NOT EDIT
+# ------------------------------------------------------------------------
+""")    %       (project.getName(), time.strftime('%Y-%m-%d %H:%M:%S')) )
+
+    #
+    # Output basic properties
+    #
+    for property in project.getWorkspace().getProperties() + \
+            project.getMaven().getProperties():
+        # build.sysclasspath makes Maven sick.
+        if not 'build.sysclasspath' == property.name:
+            props.write(('%s = %s\n') % \
+                            (property.name,
+                             property.value.replace('\\', '/'))
+                        )
+
+    #
+    # 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
+
+# ------------------------------------------------------------------------
+# Jars set explicity by path.
+# ------------------------------------------------------------------------
+""")
+
+    (classpath, bootclasspath) = languageHelper.getClasspathObjects(project)
+
+    # :TODO: write...
+    for annotatedPath in classpath.getPathParts() + \
+            bootclasspath.getPathParts():
+        if isinstance(annotatedPath, gump.core.language.path.AnnotatedPath):
+            props.write(('# Contributor: %s\nmaven.jar.%s = %s\n') % \
+                (   annotatedPath.getContributor(), 
+                    annotatedPath.getId(), 
+                    annotatedPath.getPath().replace('\\', '/')))
+
+    return propertiesFile
+
+def locateMavenProjectPropertiesFile(project):
+    """Return Maven project properties file location""" 
+    basedir = project.maven.getBaseDirectory() or project.getBaseDirectory()
+    return os.path.abspath(os.path.join(basedir, 'project.properties'))
+
+def locateMavenProjectFile(project):
+    """Return Maven project file location"""
+    basedir = project.maven.getBaseDirectory() or project.getBaseDirectory()
+    return os.path.abspath(os.path.join(basedir, 'project.xml'))
 
 ###############################################################################
 # Classes
 ###############################################################################
 
-class MavenBuilder(gump.core.run.gumprun.RunSpecific):
-    
-    def __init__(self,run):
-        gump.core.run.gumprun.RunSpecific.__init__(self,run)
+class MavenBuilder(RunSpecific):
+
+    def __init__(self, run):
+        RunSpecific.__init__(self, run)
 
-    def buildProject(self,project,languageHelper,stats):
+    def buildProject(self, project, languageHelper, stats):
         """
         Build a Maven project
         """
-        
-        workspace=self.run.getWorkspace()
-                
-        log.debug('Run Maven on Project: #[' + `project.getPosition()` + '] ' + project.getName())
-        
+
+        workspace = self.run.getWorkspace()
+
+        log.debug('Run Maven on Project: #[' + `project.getPosition()` + \
+                      '] ' + project.getName())
+
         self.performPreBuild(project, languageHelper, stats)
-          
+
         if project.okToPerformWork():
 
             #
             # Get the appropriate build command...
             #
-            cmd=self.getMavenCommand(project,languageHelper)
+            cmd = getMavenCommand(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)
-                    
+
         if project.wasBuilt():
-            pomFile=self.locateMavenProjectFile(project) 
-            if os.path.exists(pomFile):                               
+            pomFile = locateMavenProjectFile(project) 
+            if os.path.exists(pomFile):
                 project.addDebug('Maven POM in: ' + pomFile) 
                 catFileToFileHolder(project, pomFile, FILE_TYPE_CONFIG) 
-                    
-            projpFile=self.locateMavenProjectPropertiesFile(project) 
-            if os.path.exists(projpFile):                                               

-                project.addDebug('Maven project properties in: ' + projpFile)           
    
-                catFileToFileHolder(project, projpFile, FILE_TYPE_CONFIG)               
           
-  
-    #
-    # Build an Maven command for this project
-    #        
-    def getMavenCommand(self,project,languageHelper):
-        maven=project.maven
-    
-        # The maven goal (or none == maven default goal)
-        goal=maven.getGoal()
-    
-        # Optional 'verbose' or 'debug'
-        verbose=maven.isVerbose()
-        debug=maven.isDebug()
-    
-        #
-        # Where to run this:
-        #
-        basedir = maven.getBaseDirectory() or project.getBaseDirectory()
-    
-        #
-        # Build a classpath (based upon dependencies)
-        #
-        (classpath,bootclasspath)=languageHelper.getClasspaths(project)
-    
-        # Run Maven...
-        cmd=Cmd('maven','build_'+project.getModule().getName()+'_'+project.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,':')
-            
-        #if jvmargs:
-        #    cmd.addParameters(jvmargs)
-            
-        # cmd.addParameter('org.apache.maven.cli.App')  
-    
-        #
-        # Allow maven-level debugging...
-        #
-        if project.getWorkspace().isDebug() or project.isDebug() or debug: 
-            cmd.addParameter('--debug')  
-        if project.getWorkspace().isVerbose()  or project.isVerbose() or verbose: 
-            cmd.addParameter('--exception') 
-        
-        #
-        # Suppress downloads
-        #          
-        cmd.addParameter('--offline')  
-        
-        #
-        #	This sets the *defaults*, a workspace could override them.
-        #
-        #cmd.addPrefixedParameter('-D','build.sysclasspath','only','=')
-    
-        # End with the goal...
-        if goal: 
-            for goalParam in goal.split(','):
-                cmd.addParameter(goalParam)
-    
-        return cmd
-  
+
+            projpFile = locateMavenProjectPropertiesFile(project) 
+            if os.path.exists(projpFile):
+                project.addDebug('Maven project properties in: ' + projpFile)
+                catFileToFileHolder(project, projpFile, FILE_TYPE_CONFIG)
+
         # Do this even if not ok
-    def performPreBuild(self, project, languageHelper, stats):
-                   
+    def performPreBuild(self, project, languageHelper, _stats):
+
         # Maven requires a build.properties to be generated...
         if project.okToPerformWork():
             try:
-                propertiesFile=self.generateMavenProperties(project,languageHelper)     
                          
-                project.addDebug('(Gump generated) Maven Properties in: ' + propertiesFile)
-                
+                propertiesFile = generateMavenProperties(project,
+                                                         languageHelper)
+                project.addDebug('(Gump generated) Maven Properties in: ' + \
+                                     propertiesFile)
+
                 try:
-                    catFileToFileHolder(project,propertiesFile,
-                        FILE_TYPE_CONFIG,
+                    catFileToFileHolder(project, propertiesFile, 
+                        FILE_TYPE_CONFIG, 
                         os.path.basename(propertiesFile))
                 except:
-                    log.error('Display Properties [ ' + propertiesFile + '] Failed', exc_info=1)
  
-               
+                    log.error('Display Properties [ ' + propertiesFile + \
+                                  '] Failed', exc_info = 1)
+
             except Exception, details:
-                message='Generate Maven Properties Failed:' + str(details)
-                log.error(message, exc_info=1)
-                project.addError(message)    
-                project.changeState(STATE_FAILED,REASON_PREBUILD_FAILED)
+                message = 'Generate Maven Properties Failed:' + str(details)
+                log.error(message, exc_info = 1)
+                project.addError(message)
+                project.changeState(STATE_FAILED, REASON_PREBUILD_FAILED)
  
-    # The propertiesFile parameter is primarily for testing.
-    def generateMavenProperties(self,project,languageHelper,propertiesFile=None):
-        """Set properties/overrides for a Maven project"""
-        
-        #:TODO: Does Maven have the idea of system properties?
-        
-        #
-        # Where to put this:
-        #
-        basedir = project.maven.getBaseDirectory() or project.getBaseDirectory()
-        if not propertiesFile: 
-            propertiesFile=os.path.abspath(os.path.join(basedir,'build.properties'))
-            
-        # Ensure containing directory exists, or make it.
-        propsdir=os.path.dirname(propertiesFile)
-        if not os.path.exists(propsdir):
-            project.addInfo('Making directory for Maven properties: ['+propsdir+']')
-            os.makedirs(propsdir)
-        
-        if os.path.exists(propertiesFile):
-            project.addWarning('Overriding Maven properties: ['+propertiesFile+']')
-    
-        
-        props=open(propertiesFile,'w')
-        
-        props.write(("""# ------------------------------------------------------------------------
-# DO NOT EDIT  DO NOT EDIT  DO NOT EDIT  DO NOT EDIT  DO NOT EDIT  DO NOT EDIT  DO NOT EDIT

-#
-# File Automatically Generated by Gump, see http://gump.apache.org/
-#
-# Generated For : %s
-# Generated At  : %s
-#
-#
-# DO NOT EDIT  DO NOT EDIT  DO NOT EDIT  DO NOT EDIT  DO NOT EDIT  DO NOT EDIT  DO NOT EDIT
-# ------------------------------------------------------------------------
-""")	%	(project.getName(), time.strftime('%Y-%m-%d %H:%M:%S')) )
-        
-        #
-        # Output basic properties
-        #
-        for property in project.getWorkspace().getProperties()+project.getMaven().getProperties():
-            # build.sysclasspath makes Maven sick.
-            if not 'build.sysclasspath' == property.name:
-                props.write(('%s=%s\n') % (property.name,property.value.replace('\\','/')))
           
-        
-        #
-        # 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
+    def preview(self, project, _languageHelper, _stats):
+        cmd = getMavenCommand(project) 
+        cmd.dump()
 
-# ------------------------------------------------------------------------
-# Jars set explicity by path.
-# ------------------------------------------------------------------------
-""")
-        
-        (classpath,bootclasspath)=languageHelper.getClasspathObjects(project)
-        
-        # :TODO: write...
-        for annotatedPath in classpath.getPathParts()+bootclasspath.getPathParts():
-            if isinstance(annotatedPath,gump.core.language.path.AnnotatedPath):
-                props.write(('# Contributor: %s\nmaven.jar.%s=%s\n') % \
-                    (	annotatedPath.getContributor(),	
-                        annotatedPath.getId(),	
-                        annotatedPath.getPath().replace('\\','/')))
-
-        return propertiesFile
-      
-    def locateMavenProjectPropertiesFile(self,project):
-        """Return Maven project properties file location""" 
-        basedir = project.maven.getBaseDirectory() or project.getBaseDirectory()
-        return os.path.abspath(os.path.join(basedir,'project.properties'))
-        
-    def locateMavenProjectFile(self,project):
-        """Return Maven project file location"""      
-        basedir = project.maven.getBaseDirectory() or project.getBaseDirectory()
-        return os.path.abspath(os.path.join(basedir,'project.xml'))  
-        
-    def preview(self,project,languageHelper,stats):        
-        command=self.getMavenCommand(project,languageHelper) 
-        command.dump()
-            

Modified: gump/live/python/gump/core/build/mvn.py
URL: http://svn.apache.org/viewvc/gump/live/python/gump/core/build/mvn.py?rev=962764&r1=962763&r2=962764&view=diff
==============================================================================
--- gump/live/python/gump/core/build/mvn.py (original)
+++ gump/live/python/gump/core/build/mvn.py Sat Jul 10 05:44:09 2010
@@ -65,7 +65,7 @@ def getMavenProperties(project):
                                                  property.value, '=')
     return properties
 
-def getMavenCommand(project, languageHelper):
+def getMavenCommand(project):
     """ Build an Maven command for this project """
     maven = project.mvn
 
@@ -81,14 +81,9 @@ def getMavenCommand(project, languageHel
     #
     basedir = maven.getBaseDirectory() or project.getBaseDirectory()
 
-    #
-    # Build a classpath (based upon dependencies)
-    #
-    (classpath, _bootclasspath) = languageHelper.getClasspaths(project)
-
     # Run Maven...
     cmd = Cmd('mvn', 'build_' + project.getModule().getName() + '_' + \
-                project.getName(), basedir, {'CLASSPATH':classpath})
+                project.getName(), basedir)
 
     cmd.addParameter('--batch-mode')
 
@@ -153,7 +148,7 @@ class Maven2Builder(RunSpecific):
             #
             # Get the appropriate build command...
             #
-            cmd = getMavenCommand(project, languageHelper)
+            cmd = getMavenCommand(project)
 
             if cmd:
                 # Execute the command ....
@@ -205,8 +200,8 @@ class Maven2Builder(RunSpecific):
                 project.addError(message)
                 project.changeState(STATE_FAILED, REASON_PREBUILD_FAILED)
 
-    def preview(self, project, languageHelper, _stats):
-        command = getMavenCommand(project, languageHelper) 
+    def preview(self, project, _languageHelper, _stats):
+        command = getMavenCommand(project) 
         command.dump()
 
     def generateMvnSettings(self, project, _languageHelper):

Modified: gump/live/python/gump/core/language/java.py
URL: http://svn.apache.org/viewvc/gump/live/python/gump/core/language/java.py?rev=962764&r1=962763&r2=962764&view=diff
==============================================================================
--- gump/live/python/gump/core/language/java.py (original)
+++ gump/live/python/gump/core/language/java.py Sat Jul 10 05:44:09 2010
@@ -11,14 +11,14 @@
 #     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.
 
 """
 
-	Generates Classpaths for projects w/ dependencies
+        Generates Classpaths for projects w/ dependencies
 
 """
 
@@ -32,68 +32,69 @@ import gump.util.process.command
 
 import gump.core.model.depend
 
-import gump.core.language.path
+from gump.core.language.path import AnnotatedPath, Classpath
+from gump.core.model.output import OUTPUT_BOOTCLASSPATH_JAR
 
 ###############################################################################
 # Classes
 ###############################################################################
 
 class JavaHelper(gump.core.run.gumprun.RunSpecific):
-    
-    def __init__(self,run):
-        gump.core.run.gumprun.RunSpecific.__init__(self,run)
-        
+
+    def __init__(self, run):
+        gump.core.run.gumprun.RunSpecific.__init__(self, run)
+
         # Caches for classpaths
-        self.classpaths={}
-        self.bootclasspaths={}       
-        
-    def getJVMArgs(self,project):
-        
+        self.classpaths = {}
+        self.bootclasspaths = {}
+
+    def getJVMArgs(self, project):
+
         """ 
-        
+
         Get JVM arguments for a project 
-        
+
         """
         args = project.jvmargs
         if os.environ.has_key('GUMP_JAVA_ARGS'):
             args = gump.util.process.command.Parameters()
             for p in os.environ['GUMP_JAVA_ARGS'].split(' '):
-                args.addParameter(p);
+                args.addParameter(p)
             for p in project.jvmargs.items() :
-                args.addParameterObject(p);
+                args.addParameterObject(p)
         return args
-       
-    def getClasspaths(self,project,debug=False):
+
+    def getClasspaths(self, project, debug = False):
         """
         Get boot and regular classpaths for a project.
-        
+
         Return a (classpath, bootclaspath) tuple for this project
         """
         # Calculate classpath and bootclasspath
-        (classpath, bootclasspath) = self.getClasspathObjects(project,debug)
-        
+        (classpath, bootclasspath) = self.getClasspathObjects(project, debug)
+
         # Return them simple/flattened
         return ( classpath.getFlattened(), bootclasspath.getFlattened() )
-   
+
     def getBaseClasspath(self):
         """
-        
+
         The basic classpath needs to include a compiler...
-        
+
         Return a system classpath (to include $JAVA_HOME/lib/tools.jar'
         for a compiler).
         """
-        sysClasspath=gump.core.language.path.Classpath('System Classpath')
-        javaHome=self.run.getEnvironment().getJavaHome()
-        syscp=os.path.join(os.path.join(javaHome,'lib'),'tools.jar')
+        sysClasspath = Classpath('System Classpath')
+        javaHome = self.run.getEnvironment().getJavaHome()
+        syscp = os.path.join(os.path.join(javaHome, 'lib'), 'tools.jar')
         if os.path.exists(syscp):
-            sysClasspath.importFlattenedParts(syscp)        
+            sysClasspath.importFlattenedParts(syscp)
         return sysClasspath
 
-    def getClasspathObjects(self,project,debug=False):
+    def getClasspathObjects(self, project, debug = False):
         """
         Get a TOTAL classpath for a project (including its dependencies)
-        
+
         A tuple of (CLASSPATH, BOOTCLASSPATH) for a project
         """
 
@@ -101,161 +102,193 @@ class JavaHelper(gump.core.run.gumprun.R
         # Do this once only... storing it on the context. Not as nice as 
         # doing it OO (each project context stores its own, but a step..)
         #
-        if self.classpaths.has_key(project) and self.bootclasspaths.has_key(project) :
-          if debug: print "Classpath/Bootclasspath previously resolved..."
-          return ( self.classpaths[project], self.bootclasspaths[project] )
-  
+        if self.classpaths.has_key(project) and \
+                self.bootclasspaths.has_key(project) :
+            if debug:
+                print "Classpath/Bootclasspath previously resolved..."
+            return (self.classpaths[project], self.bootclasspaths[project])
+
         # Start with the system classpath (later remove this)
-        classpath=self.getBaseClasspath()
-        bootclasspath=gump.core.language.path.Classpath('Boot Classpath')
+        classpath = self.getBaseClasspath()
+        bootclasspath = Classpath('Boot Classpath')
 
         # Add this project's work directories (these go into
         # CLASSPATH, never BOOTCLASSPATH)
-        workdir=project.getModule().getWorkingDirectory()          
         for work in project.getWorks():
-            path=work.getResolvedPath()
+            path = work.getResolvedPath()
             if path:
-                classpath.addPathPart(gump.core.language.path.AnnotatedPath('',path,project,None,'Work
Entity'))   
+                classpath.addPathPart(AnnotatedPath('', path, project, None,
+                                                    'Work Entity'))
             else:
-                log.error("<work element with neither 'nested' nor 'parent' attribute
on " \
-                        + project.getName() + " in " + project.getModule().getName()) 
-              
+                log.error("<work element with neither 'nested' nor 'parent'" \
+                              + " attribute on " \
+                              + project.getName() + " in " \
+                              + project.getModule().getName()) 
+
         # Append dependent projects (including optional)
-        visited=[]
-  
+        visited = []
+
         # Does it have any depends? Process all of them...
         for dependency in project.getDirectDependencies():
-            (subcp, subbcp) = self._getDependOutputList(project,dependency,visited,1,debug)
-            self._importClasspaths(classpath,bootclasspath,subcp,subbcp)
-    
+            (subcp, subbcp) = self._getDependOutputList(project, dependency,
+                                                        visited, 1, debug)
+            _importClasspaths(classpath, bootclasspath, subcp, subbcp)
+
         # Store so we don't do this twice.
         self.classpaths[project] = classpath
         self.bootclasspaths[project] = bootclasspath
-        
+
         return ( classpath, bootclasspath )
 
-    def _getDependOutputList(self,project,dependency,visited,depth=0,debug=0):      
+    def _getDependOutputList(self, project, dependency, visited, depth = 0,
+                             debug = 0):
         """
-        
+
                Perform this 'dependency' (mandatory or optional)
-               
+
             1) Bring in the JARs (or those specified by id in depend ids)
             2) Do NOT bring in the working entities (directories/jars)
-            3) Bring in the sub-depends (or optional) if inherit='all' or 'hard'
-            4) Bring in the runtime sub-depends if inherit='runtime'
+            3) Bring in the sub-depends (or optional) if inherit = 'all' or 'hard'
+            4) Bring in the runtime sub-depends if inherit = 'runtime'
             5) Also: *** Bring in any depenencies that the dependency inherits ***
-            
-           """            
-   
+
+           """
+
         # Skip ones that aren't here to affect the classpath
-        if dependency.isNoClasspath():  
-            return (None,None)
-            
+        if dependency.isNoClasspath():
+            return (None, None)
+
         # Don't loop
         if (dependency in visited):
-            # beneficiary.addInfo("Duplicated dependency [" + str(depend) + "]")        
 
+            # beneficiary.addInfo("Duplicated dependency [" + str(depend) + "]")
             if debug:
                 print str(depth) + ") Already Visited : " + str(dependency)
                 print str(depth) + ") Previously Visits  : "
                 for v in visited:
                     print str(depth) + ")  - " + str(v)
-            return (None,None)
-            
+            return (None, None)
+
         visited.append(dependency)
-        
+
         if debug:
             print str(depth) + ") Perform : " + `dependency`
-                  
+
         # 
-        classpath=gump.core.language.path.Classpath('Classpath for ' + `dependency`)
-        bootclasspath=gump.core.language.path.Classpath('Bootclasspath for ' + `dependency`)
+        classpath = Classpath('Classpath for ' + `dependency`)
+        bootclasspath = Classpath('Bootclasspath for ' + `dependency`)
 
         # Context for this dependecy project...
-        project=dependency.getProject()
-  
+        project = dependency.getProject()
+
         # The dependency drivers...
         #
         # runtime (i.e. this is a runtime dependency)
         # inherit (i.e. inherit stuff from a dependency)
         #
-        runtime=dependency.runtime
-        inherit=dependency.inherit
+        runtime = dependency.runtime
+        inherit = dependency.inherit
         if dependency.ids:
-            ids=dependency.ids.split()
+            ids = dependency.ids.split()
         else:
-            ids=None
-  
+            ids = None
+
         # Explain..
-        dependStr=''
+        dependStr = ''
         if inherit: 
-            if dependStr: dependStr += ', '
-            dependStr += 'Inherit:'+dependency.getInheritenceDescription()
+            if dependStr:
+                dependStr += ', '
+            dependStr += 'Inherit:' + dependency.getInheritenceDescription()
         if runtime: 
-            if dependStr: dependStr += ', '
+            if dependStr:
+                dependStr += ', '
             dependStr += 'Runtime'
-  
+
         # Append JARS for this project
         #    (respect ids --- none means 'all)
         ####################################################
         # Note, if they don't come from the project outputs
         # (e.g. 'cos the project failed) attempt to get them
-        # from the repository. [This has been done already,
+        # from the repository. [This has been done already, 
         # so is transparent here.]
-        projectIds=[]
-        for jar in project.getOutputs():
+        projectIds = []
+        for jar in [o for o in project.getOutputs() if o.is_jar()]:
             # Store for double checking
-            if jar.getId(): projectIds.append(jar.getId())
-            
+            if jar.getId():
+                projectIds.append(jar.getId())
+
             # If 'all' or in ids list:
-            if (not ids) or (jar.getId() in ids):   
-                if ids: dependStr += ' Id = ' + jar.getId()
-                path=gump.core.language.path.AnnotatedPath(jar.getId(),jar.path,project,dependency.getOwnerProject(),dependStr)

-          
+            if (not ids) or (jar.getId() in ids):
+                if ids:
+                    dependStr += ' Id = ' + jar.getId()
+                path = AnnotatedPath(jar.getId(), jar.path, project,
+                                     dependency.getOwnerProject(), dependStr) 
+
                 # Add to CLASSPATH
-                if not jar.getType() == 'boot':
-                    if debug:   print str(depth) + ') Append JAR : ' + str(path)
+                if not jar.getType() == OUTPUT_BOOTCLASSPATH_JAR:
+                    if debug:
+                        print str(depth) + ') Append JAR : ' + str(path)
                     classpath.addPathPart(path)
                 else:
                     # Add to BOOTCLASSPATH
-                    if debug:   print str(depth) + ') Append *BOOTCLASSPATH* JAR : ' + str(path)
-                    bootclasspath.addPathPart(path)    
+                    if debug:
+                        print str(depth) + ') Append *BOOTCLASSPATH* JAR : ' \
+                            + str(path)
+                    bootclasspath.addPathPart(path)
 
         # Double check IDs (to reduce stale ids in metadata)
         if ids:
             for id in ids:
                 if not id in projectIds:
-                    dependency.getOwnerProject().addWarning("Invalid ID [" + id \
-                          + "] for dependency on [" + project.getName() + "]")
+                    dependency.getOwnerProject()\
+                        .addWarning("Invalid ID [" + id \
+                                        + "] for dependency on [" \
+                                        + project.getName() + "]")
 
         # Append sub-projects outputs, if inherited
-        for subdependency in project.getDirectDependencies():        
-        	#
-        	# 	For the main project we working on, we care about it's request for inheritence
-        	#	but we don't recursively inherit. (i.e. we only do this at recursion depth 1).
-        	#
-            #   If the dependency is set to 'all' (or 'hard') we inherit all dependencies.
-            # 	If the dependency is set to 'runtime' we inherit all runtime dependencies.
+        for subdependency in project.getDirectDependencies():
             #
-            #	INHERIT_OUTPUTS (aka INHERIT_JARS) is more sticky, and we track that down (and
down, ...).
+            #   For the main project we working on, we care about it's
+            #   request for inheritence but we don't recursively
+            #   inherit. (i.e. we only do this at recursion depth 1).
             #
-            if   (  ( ( 1 == depth ) and \
-                 	(inherit in [ gump.core.model.depend.INHERIT_ALL, gump.core.model.depend.INHERIT_HARD
]) \
-                    	or \
-                    (inherit == gump.core.model.depend.INHERIT_RUNTIME and subdependency.isRuntime())
) \
-                   or \
-                   	( inherit in [ gump.core.model.depend.INHERIT_OUTPUTS ] ) ) :      
-                (subcp, subbcp) = self._getDependOutputList(project,subdependency,visited,depth+1,debug)
-                self._importClasspaths(classpath,bootclasspath,subcp,subbcp)   
+
+            #   If the dependency is set to 'all' (or 'hard') we
+            #   inherit all dependencies.
+            #   If the dependency is set to 'runtime' we inherit all
+            #   runtime dependencies.
+            #
+            #   INHERIT_OUTPUTS (aka INHERIT_JARS) is more sticky, and
+            #   we track that down (and down, ...).
+            #
+            if (
+                ( ( 1 == depth ) and \
+                       (inherit in [ gump.core.model.depend.INHERIT_ALL,
+                                     gump.core.model.depend.INHERIT_HARD ]) \
+                       or \
+                       (inherit == gump.core.model.depend.INHERIT_RUNTIME \
+                            and subdependency.isRuntime())
+                  ) \
+                    or \
+                    (inherit in [ gump.core.model.depend.INHERIT_OUTPUTS ])
+                ) :
+                (subcp, subbcp) = self._getDependOutputList(project,
+                                                            subdependency,
+                                                            visited, depth + 1,
+                                                            debug)
+                _importClasspaths(classpath, bootclasspath, subcp, subbcp)
             elif debug:
-                print str(depth) + ') Skip : ' + str(subdependency) + ' in ' + project.name
+                print str(depth) + ') Skip : ' + str(subdependency) \
+                    + ' in ' + project.name
 
         return (classpath, bootclasspath)
-    
-    def _importClasspaths(self,classpath,bootclasspath,cp,bcp):
-        """    
-        Import cp and bcp into classpath and bootclasspath,
-        but do not accept duplicates. Report duplicates.
-        """
-        if cp:  classpath.importPath(cp)                
-        if bcp: bootclasspath.importPath(bcp)                      
-        
+
+def _importClasspaths(classpath, bootclasspath, cp, bcp):
+    """
+    Import cp and bcp into classpath and bootclasspath, 
+    but do not accept duplicates. Report duplicates.
+    """
+    if cp:
+        classpath.importPath(cp)
+    if bcp:
+        bootclasspath.importPath(bcp)
+

Propchange: gump/live/python/gump/core/language/java.py
------------------------------------------------------------------------------
--- svn:mergeinfo (added)
+++ svn:mergeinfo Sat Jul 10 05:44:09 2010
@@ -0,0 +1 @@
+/gump/trunk/python/gump/core/language/java.py:746160,746727,746892,747270,747272-747273,747656,748010,748018,748028,748661,748967,760784-761159,815848,953630-954169,955387,955837,956771,957107,957408,958453,958915,959344,959847,960260,960295,960297,960300,960303,961244,962395,962401

Propchange: gump/live/python/gump/core/update/bzr.py
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Sat Jul 10 05:44:09 2010
@@ -1 +1 @@
-/gump/trunk/python/gump/core/update/bzr.py:815848,953630-954169,955387,955837,956771,957107,957408,958453,958915,959344,959847,960260,960295,960297,960300,960303,961244,961577
+/gump/trunk/python/gump/core/update/bzr.py:815848,953630-954169,955387,955837,956771,957107,957408,958453,958915,959344,959847,960260,960295,960297,960300,960303,961244,961577,961843,961859,961870,962401

Propchange: gump/live/python/gump/core/update/darcs.py
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Sat Jul 10 05:44:09 2010
@@ -1 +1 @@
-/gump/trunk/python/gump/core/update/darcs.py:815848,953630-954169,955387,955837,956771,957107,957408,958453,958915,959344,959847,960260,960295,960297,960300,960303,961244,961577
+/gump/trunk/python/gump/core/update/darcs.py:815848,953630-954169,955387,955837,956771,957107,957408,958453,958915,959344,959847,960260,960295,960297,960300,960303,961244,961577,961843,961859,961870,962401

Propchange: gump/live/python/gump/core/update/hg.py
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Sat Jul 10 05:44:09 2010
@@ -1 +1 @@
-/gump/trunk/python/gump/core/update/hg.py:815848,953630-954169,955387,955837,956771,957107,957408,958453,958915,959344,959847,960260,960295,960297,960300,960303,961244,961577
+/gump/trunk/python/gump/core/update/hg.py:815848,953630-954169,955387,955837,956771,957107,957408,958453,958915,959344,959847,960260,960295,960297,960300,960303,961244,961577,961843,961859,961870,962401

Modified: gump/live/python/gump/test/maven.py
URL: http://svn.apache.org/viewvc/gump/live/python/gump/test/maven.py?rev=962764&r1=962763&r2=962764&view=diff
==============================================================================
--- gump/live/python/gump/test/maven.py (original)
+++ gump/live/python/gump/test/maven.py Sat Jul 10 05:44:09 2010
@@ -27,7 +27,7 @@ import types, StringIO
 from gump import log
 import gump.core.config
 from gump.core.model.state import *
-from gump.core.build.maven import MavenBuilder
+from gump.core.build.maven import generateMavenProperties, getMavenCommand
 
 import gump.core.language.java
 
@@ -57,18 +57,17 @@ class MavenTestSuite(UnitTestSuite):
         self.maven1=self.workspace.getProject('maven1')            
         self.assertNotNone('Needed a maven project', self.maven1)
         
-        self.mavenBuilder=MavenBuilder(self.run)
         self.javaHelper=gump.core.language.java.JavaHelper(self.run)
         
     def testMavenProperties(self):
                 
         self.assertTrue('Maven project has a Maven object', self.maven1.hasMaven())     
  
-        self.mavenBuilder.generateMavenProperties(self.maven1, self.javaHelper, 'test/unit-testing-maven.properties')
+        generateMavenProperties(self.maven1, self.javaHelper, 'test/unit-testing-maven.properties')
         
     def testMavenCommand(self):                
         self.assertTrue('Maven project has a Maven object', self.maven1.hasMaven())     
  
   
-        cmd=self.mavenBuilder.getMavenCommand(self.maven1,self.javaHelper)
+        cmd = getMavenCommand(self.maven1)
         
         # cmd.dump()
         



Mime
View raw message