gump-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aj...@apache.org
Subject svn commit: r170825 - in /gump/branches/Gump3: metadata/tsws1.xml pygump/python/gump/plugins/builder.py pygump/python/gump/plugins/java/builder.py tsws1-settings.sh
Date Wed, 18 May 2005 20:43:01 GMT
Author: ajack
Date: Wed May 18 13:43:01 2005
New Revision: 170825

URL: http://svn.apache.org/viewcvs?rev=170825&view=rev
Log:
1) Added to the tsws1.xml workspace:
1.1) Moved test (bogus) projects onto module gump-test.
1.2) Created gump-test (partly to insert an 'env' call, to debug bootstrap-ant problems).
1.3) Preparing for adding 'bash gump test'.


2) Worked on the AntBuilder. Seems closer to providing the needs of the Ant commandline. Still
need to add <work> items to the Gump3 model complete the CLASSPATH. 

Note: Having 'class not found' issues, but since I'm on Win2K w/ Cygwin I've no clue how the
CLASSPATH ought look (and it sure looks ugly.) I'd like to test this on Linux.
Note: Ran unit tests. Same 1 fails as before I did my work.

Added:
    gump/branches/Gump3/metadata/tsws1.xml
    gump/branches/Gump3/tsws1-settings.sh
Modified:
    gump/branches/Gump3/pygump/python/gump/plugins/builder.py
    gump/branches/Gump3/pygump/python/gump/plugins/java/builder.py

Added: gump/branches/Gump3/metadata/tsws1.xml
URL: http://svn.apache.org/viewcvs/gump/branches/Gump3/metadata/tsws1.xml?rev=170825&view=auto
==============================================================================
--- gump/branches/Gump3/metadata/tsws1.xml (added)
+++ gump/branches/Gump3/metadata/tsws1.xml Wed May 18 13:43:01 2005
@@ -0,0 +1,137 @@
+<?xml version="1.0"?>
+<!--+
+    | Copyright 2003-2005 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.
+    +-->
+<workspace 
+    version="1.0" 
+    name="gump3-test"
+    basedir="work" 
+    pkgdir="work/packages"
+    jardir="work/jars"
+    logdir="work/log">
+
+  <repositories>
+    <repository name="ant" type="cvs">
+      <title>Ant</title>
+      <home-page>http://ant.apache.org/</home-page>
+      <cvsweb>http://cvs.apache.org/viewcvs/</cvsweb>
+      <redistributable/>
+  
+      <hostname>cvs.apache.org</hostname>
+      <method>pserver</method>
+      <path>/home/cvspublic</path>
+      <user>anoncvs</user>
+      <password>anoncvs</password>
+    </repository>
+
+    <repository name="gump" type="svn">
+      <title>Gump</title>
+      <home-page>http://gump.apache.org/</home-page>
+      <web>http://cvs.apache.org/viewcvs.cgi/gump/?root=Apache-SVN</web>
+      <url>http://svn.apache.org/repos/asf/gump/branches/Gump3</url>
+      <redistributable/>
+    </repository>
+  </repositories>
+  
+  <modules>
+    <module name="ant">
+      <repository name="ant"/>
+      
+      <url>http://ant.apache.org/index.html</url>
+      <description>Java based build tool</description>
+    </module>
+
+    <module name="gump-test" path="test">
+      <repository name="gump"/>
+
+      <url>http://gump.apache.org/index.html</url>
+      <description>Gump Testing</description>
+    </module>
+
+    <module name="gump">
+      <repository name="gump"/>
+
+      <url>http://gump.apache.org/index.html</url>
+      <description>Python based integration tool</description>
+    </module>
+  </modules>
+  
+  
+  <projects>
+    <project name="gump-test1">
+	<module name="gump-test"/>
+	<script name="gump-test1"/>	
+    </project>
+
+    <project name="bogus">
+      <module name="gump-test"/>
+      
+      <!-- test failure...<script name="doesnotexist"/>-->
+    </project>
+    
+    <project name="bogus2">
+      <module name="gump-test"/>
+      
+      <depend project="bogus"/>
+    </project>
+
+    <project name="bogus3">
+      <module name="gump-test"/>
+      
+      <depend project="bogus2"/>
+    </project>
+
+    <project name="bogus4">
+      <module name="gump-test"/>
+      
+      <depend project="bogus3"/>
+    </project>
+
+    <!-- project name="bogus5">
+      <module name="doesnotexist"/>
+      
+      <depend project="bogus3"/>
+    </project -->
+
+    <project name="test-attempt-dir-management">
+      <module name="gump-test"/>
+      
+      <!-- commands -->
+      <rmdir dir="some"/>
+      <mkdir dir="some/directory"/>
+    </project>
+   
+    <project name="bootstrap-ant">
+      <module name="ant"/>
+      
+      <!-- commands -->
+      <script name="bootstrap"/>
+
+      <!-- outputs -->
+      <home nested="bootstrap"/>
+      <jar name="lib/ant.jar"/>
+      <jar name="lib/ant-launcher.jar" id="ant-launcher"/>
+
+      <!-- dependencies -->
+      <depend project="bogus4"/>
+    </project>
+
+    <project name="dist-ant">
+      <module name="ant"/>
+      <ant/>
+      <!-- dependencies -->
+      <depend project="bootstrap-ant"/>
+    </project>
+  </projects>
+</workspace>

Modified: gump/branches/Gump3/pygump/python/gump/plugins/builder.py
URL: http://svn.apache.org/viewcvs/gump/branches/Gump3/pygump/python/gump/plugins/builder.py?rev=170825&r1=170824&r2=170825&view=diff
==============================================================================
--- gump/branches/Gump3/pygump/python/gump/plugins/builder.py (original)
+++ gump/branches/Gump3/pygump/python/gump/plugins/builder.py Wed May 18 13:43:01 2005
@@ -39,9 +39,16 @@
         assert isinstance(project, Project)
         self.log.debug("Visit %s looking for %s" % (project,self.cmd_clazz))
         for command in [command for command in project.commands if isinstance(command,self.cmd_clazz)]:
-            self.log.debug("Perform %s on %s" % (command, project))
-            self.method(project, command)
-
+            try:        
+                self.log.debug("Perform %s on %s" % (command, project))
+                self.method(project, command)
+            except Exception:
+                self.log.exception("Command %s Failed..." % (command))
+                #TODO Ought we create a BuilderErrorHandler for this?
+                # Annotate failure
+                # command.build_log = ':TODO: Serialize Exception trace into here?';
+                command.build_exit_status=1
+            
 class ScriptBuilderPlugin(BuilderPlugin):
     """Execute all "script" commands for all projects."""
     def __init__(self, workdir, log):

Modified: gump/branches/Gump3/pygump/python/gump/plugins/java/builder.py
URL: http://svn.apache.org/viewcvs/gump/branches/Gump3/pygump/python/gump/plugins/java/builder.py?rev=170825&r1=170824&r2=170825&view=diff
==============================================================================
--- gump/branches/Gump3/pygump/python/gump/plugins/java/builder.py (original)
+++ gump/branches/Gump3/pygump/python/gump/plugins/java/builder.py Wed May 18 13:43:01 2005
@@ -24,26 +24,9 @@
 from gump.model import Script, Error, Project, Ant, Dependency, Homedir, Jar
 from gump.model.util import get_project_directory
 from gump.plugins import AbstractPlugin
+from gump.plugins.builder import BuilderPlugin
 from gump.util.executor import Popen, PIPE, STDOUT
 
-class BuilderPlugin(AbstractPlugin):
-    """Execute all commands for all projects."""
-    def __init__(self, workdir, log, cmd_clazz, method):
-        self.workdir = workdir
-        self.log = log
-        self.cmd_clazz = cmd_clazz
-        self.method = method             
-
-    def visit_project(self, project):
-        """ Dispatch for each matching command (matching by class type) """        
-        assert isinstance(project, Project)
-        self.log.debug("Visit %s looking for %s" % (project,self.cmd_clazz))
-        for command in [command for command in project.commands if isinstance(command,self.cmd_clazz)]:
-            try:        
-                self.log.debug("Perform %s on %s" % (command, project))
-                self.method(project, command)
-            except Exception:
-                self.log.exception("Failed...")
 
 
 class ArtifactPath(object):
@@ -76,6 +59,13 @@
         self.parts = []
         self.state='unknown'
     
+    def __nonzero__(self) :
+        if self.parts: return True
+        return False
+    
+    def __len__(self):
+        return len(self.parts)
+    
     def __add__(self,other):
         if not isinstance(other,ArtifactPath):
              other=ArtifactPath("Unknown",other,"Unspecified")
@@ -84,8 +74,11 @@
         return self
     
     def __str__(self):
+        return self.join(os.pathsep)
+    
+    def join(self,sep):
         import string
-        return string.join([ part.path for part in self.parts ], os.pathsep)
+        return string.join([ part.path for part in self.parts ], sep)
     
 class ClasspathPlugin(BuilderPlugin):
     """Generate build attributes (e.g. CLASSAPATH) for a builder."""
@@ -95,8 +88,8 @@
     def _forge_classpaths(self, project, ant):               
 
         # Stub them out...
-        ant.classpath=Classpath("Standard")
-        ant.boot_classpath=Classpath("Boot")
+        ant.classpath=Classpath('Standard')
+        ant.boot_classpath=Classpath('Boot')
         
         # Flesh them out...
         self._calculateClasspaths(project,ant)
@@ -162,7 +155,8 @@
                         path = os.path.join(projectpath,output.name)
                     else:
                         raise Error, "Unknown Output Type for %s: %s" % (self.__class__.__name__,
output.__class__.__name__)
-                    
+
+                    self.log.debug('Contribution : %s' % path)
                     artifact_path=ArtifactPath(output.id,path,depend_str) 
               
                     # Add to CLASSPATH (or BOOTCLASSPATH)
@@ -224,6 +218,9 @@
     def __init__(self, workdir, log, debug=False):
         BuilderPlugin.__init__(self, workdir, log, Ant, self._do_ant)
         self.debug = debug
+
+        # Clone the environment, so we can squirt CLASSPATH into it.
+        self.tmp_env = dict(os.environ)
         
     def _do_ant(self, project, ant):                
         projectpath = get_project_directory(self.workdir,project)
@@ -231,13 +228,37 @@
         # TODO get proper classpath
         self.log.debug('CLASSPATH %s' % ant.classpath)
         self.log.debug('BOOTCLASSPATH %s' % ant.boot_classpath)
+        
+        # Create an Environment
+        self.tmp_env['CLASSPATH'] = str(ant.classpath)
+        
         # TODO test this
         # TODO sysclasspath only
         # TODO more options
-        args = ["ant","-buildfile",ant.buildfile,ant.target]
-        if self.debug:
-            args += "-debug"
-        cmd = Popen(args,shell=False,cwd=projectpath,stdout=PIPE,stderr=STDOUT)
+        
+        # Build the command line.
+        args = ["java"]
+        
+        # Allow bootclasspath
+        if ant.boot_classpath:
+            args += ['-X','bootclasspath/p',ant.boot_classpath.join(':')]
+
+        # Ant's entry point, and main options.
+        args += ["org.apache.tools.ant.Main"]
+                 
+        # Specify a build file.
+        if ant.buildfile: args += ["-buildfile",ant.buildfile]
+
+        # Override the default target
+        if ant.target: args += [ant.target]
+        
+        # Allow debugging
+        if self.debug: args += ["-debug"]
+        
+        self.log.debug("Command : %s " % (args))
+        self.log.debug("        : %s " % ant.classpath)
+        #self.log.debug("        : %s " % self.tmp_env)
+        cmd = Popen(args,shell=False,cwd=projectpath,stdout=PIPE,stderr=STDOUT,env=self.tmp_env)
 
         ant.build_log = cmd.communicate()[0]
         ant.build_exit_status = cmd.wait()

Added: gump/branches/Gump3/tsws1-settings.sh
URL: http://svn.apache.org/viewcvs/gump/branches/Gump3/tsws1-settings.sh?rev=170825&view=auto
==============================================================================
--- gump/branches/Gump3/tsws1-settings.sh (added)
+++ gump/branches/Gump3/tsws1-settings.sh Wed May 18 13:43:01 2005
@@ -0,0 +1,11 @@
+
+case "`uname`" in
+  CYGWIN*) cygwin=true ;;
+esac
+
+if $cygwin; then
+  export JAVA_HOME=/cygdrive/f/apps/javasoft/j2sdk1.4.2/
+else
+  export JAVA_HOME=/usr/lib/j2se/1.4
+fi
+



Mime
View raw message