gump-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bode...@apache.org
Subject svn commit: r958453 - in /gump/trunk/python/gump: actor/mvnrepoproxy/proxycontrol.py core/model/__init__.py core/model/misc.py core/model/output.py core/model/project.py
Date Mon, 28 Jun 2010 04:28:47 GMT
Author: bodewig
Date: Mon Jun 28 04:28:47 2010
New Revision: 958453

URL: http://svn.apache.org/viewvc?rev=958453&view=rev
Log:
make output fully generic, only publish poms and jars to repo proxy

Added:
    gump/trunk/python/gump/core/model/output.py   (with props)
Modified:
    gump/trunk/python/gump/actor/mvnrepoproxy/proxycontrol.py
    gump/trunk/python/gump/core/model/__init__.py
    gump/trunk/python/gump/core/model/misc.py
    gump/trunk/python/gump/core/model/project.py

Modified: gump/trunk/python/gump/actor/mvnrepoproxy/proxycontrol.py
URL: http://svn.apache.org/viewvc/gump/trunk/python/gump/actor/mvnrepoproxy/proxycontrol.py?rev=958453&r1=958452&r2=958453&view=diff
==============================================================================
--- gump/trunk/python/gump/actor/mvnrepoproxy/proxycontrol.py (original)
+++ gump/trunk/python/gump/actor/mvnrepoproxy/proxycontrol.py Mon Jun 28 04:28:47 2010
@@ -21,6 +21,7 @@ import time
 import urllib
 
 from gump import log
+from gump.core.model.output import OUTPUT_JAR, OUTPUT_POM
 from gump.core.run.actor import AbstractRunActor, FinalizeRunEvent, \
     InitializeRunEvent
 
@@ -44,13 +45,16 @@ class MvnRepositoryProxyController(Abstr
         if project.okToPerformWork() and project.hasOutputs():
             groupId = project.getArtifactGroup()
             for output in project.getOutputs():
-                fileName = os.path.abspath(output.getPath())
-                try:
-                    log.info('Publishing \'%s\' to proxy' % (fileName))
-                    self.publish(groupId, output.getId(), fileName)
-                except:
-                    log.error('Failed to publish \'%s\' to proxy' % (fileName),
-                              exc_info=1)
+                if output.getType() == OUTPUT_JAR \
+                        or output.getType() == OUTPUT_POM:
+                    fileName = os.path.abspath(output.getPath())
+                    try:
+                        log.info('Publishing \'%s\' output \'%s\' to proxy'
+                                 % (output.getType(), fileName))
+                        self.publish(groupId, output.getId(), fileName)
+                    except:
+                        log.error('Failed to publish \'%s\' to proxy' %
+                                  (fileName), exc_info = 1)
 
     def processOtherEvent(self, event):
         if isinstance(event, InitializeRunEvent):

Modified: gump/trunk/python/gump/core/model/__init__.py
URL: http://svn.apache.org/viewvc/gump/trunk/python/gump/core/model/__init__.py?rev=958453&r1=958452&r2=958453&view=diff
==============================================================================
--- gump/trunk/python/gump/core/model/__init__.py (original)
+++ gump/trunk/python/gump/core/model/__init__.py Mon Jun 28 04:28:47 2010
@@ -41,7 +41,7 @@
 ###############################################################################
 
 # tell Python what modules make up the gump.core.model package
-__all__ = ["misc","state", \
+__all__ = ["misc","state", "output", \
     "object","project","module","workspace","repository", \
     "builder","profile",]
 

Modified: gump/trunk/python/gump/core/model/misc.py
URL: http://svn.apache.org/viewvc/gump/trunk/python/gump/core/model/misc.py?rev=958453&r1=958452&r2=958453&view=diff
==============================================================================
--- gump/trunk/python/gump/core/model/misc.py (original)
+++ gump/trunk/python/gump/core/model/misc.py Mon Jun 28 04:28:47 2010
@@ -83,43 +83,6 @@ class Resultable:
                     + self.getName()
         return self.results
 
-# represents an <output/> element
-class BaseOutput(NamedModelObject):
-    def __init__(self, name, dom, owner):
-        NamedModelObject.__init__(self, name, dom, owner)
-        self.id = ''
-        self.type = ''
-        self.path = None
-
-    def setPath(self, path):
-        self.path = path
-
-    def getPath(self):
-        return self.path
-
-    def hasId(self):
-        if self.id:
-            return True
-        return False
-
-    def setId(self, id):
-        self.id = id
-
-    def getId(self):
-        return self.id
-
-    def getType(self):
-        return self.type
-
-# represents a <jar/> element
-class Jar(BaseOutput): 
-    """ Represents a <jar/> element."""
-    pass
-
-class Assembly(BaseOutput): 
-    """ Represents an <assembly/> element."""
-    pass
-
 class Resolvable(ModelObject):
     """
     A ModelObject that can be resolved relative to it's owning model

Added: gump/trunk/python/gump/core/model/output.py
URL: http://svn.apache.org/viewvc/gump/trunk/python/gump/core/model/output.py?rev=958453&view=auto
==============================================================================
--- gump/trunk/python/gump/core/model/output.py (added)
+++ gump/trunk/python/gump/core/model/output.py Mon Jun 28 04:28:47 2010
@@ -0,0 +1,68 @@
+#!/usr/bin/env python
+
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You 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.
+
+"""
+   Model for outputs of a Gump project
+"""
+
+from gump.core.model.object import NamedModelObject
+
+OUTPUT_ASSEMBLY = 'assembly'
+OUTPUT_HOMEDIR = 'home'
+OUTPUT_JAR = 'jar'
+OUTPUT_LICENSE = 'license'
+OUTPUT_POM = 'pom'
+
+# represents an <output/> element
+class Output(NamedModelObject):
+    """ Generic output element """
+
+    def __init__(self, name, dom, owner):
+        NamedModelObject.__init__(self, name, dom, owner)
+        self.id = ''
+        self.type = ''
+        self.path = None
+
+    def setPath(self, path):
+        """ home-dir relative paths of output """
+        self.path = path
+
+    def getPath(self):
+        """ home-dir relative paths of output """
+        return self.path
+
+    def hasId(self):
+        """ optional id of output """
+        if self.id:
+            return True
+        return False
+
+    def setId(self, id):
+        """ optional id of output """
+        self.id = id
+
+    def getId(self):
+        """ optional id of output """
+        return self.id
+
+    def getType(self):
+        """ optional type of output """
+        return self.type
+
+    def setType(self, t):
+        """ optional type of output """
+        self.type = t

Propchange: gump/trunk/python/gump/core/model/output.py
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: gump/trunk/python/gump/core/model/project.py
URL: http://svn.apache.org/viewvc/gump/trunk/python/gump/core/model/project.py?rev=958453&r1=958452&r2=958453&view=diff
==============================================================================
--- gump/trunk/python/gump/core/model/project.py (original)
+++ gump/trunk/python/gump/core/model/project.py Mon Jun 28 04:28:47 2010
@@ -31,10 +31,10 @@ from gump.core.config import default
 from gump.core.model.builder import Ant, NAnt, Maven, Maven2, Script, \
     Configure, Make
 from gump.core.model.depend import Dependable, importDomDependency
-from gump.core.model.misc import Jar, Assembly, BaseOutput, \
-    Resultable, Positioned, Mkdir, Delete, JunitReport, Work, \
-    AddressPair
+from gump.core.model.misc import AddressPair, \
+    Resultable, Positioned, Mkdir, Delete, JunitReport, Work
 from gump.core.model.object import NamedModelObject
+from gump.core.model.output import Output
 from gump.core.model.state import REASON_CONFIG_FAILED, STATE_FAILED, \
     STATE_PREREQ_FAILED, REASON_MISSING_OUTPUTS
 from gump.core.model.stats import Statable, Statistics
@@ -105,7 +105,7 @@ class Project(NamedModelObject, Statable
         self.packageNames = None
 
         #############################################################
-        # Outputs (Jars, Assemblies)
+        # Outputs (like jars, assemblies, poms ...)
         #
         self.outputs = {}
         self.outputs_expanded = False
@@ -556,28 +556,30 @@ class Project(NamedModelObject, Statable
                 self.addError('Missing \'name\' on <license')
 
         #
-        # Resolve jars/assemblies/outputs
+        # Resolve outputs
         #
-        outputTypes = {'jar' : Jar,
-                       'assembly' : Assembly,
-                       'output' : BaseOutput}
+        outputTypes = ['jar',
+                       'assembly',
+                       'output',
+                       'pom']
 
-        for (tag, clazz) in outputTypes.iteritems():
+        for tag in outputTypes:
             for tdom in self.getDomChildIterator(tag):
-                name = self.expandVariables(
-                        getDomAttributeValue(tdom, 'name'))
+                name = self.expandVariables(getDomAttributeValue(tdom, 'name'))
 
                 if self.home and name:
-                    output = clazz(name, tdom, self)
+                    output = Output(name, tdom, self)
                     output.complete()
                     output.setPath(os.path.abspath(os.path.join(self.home,
                                                                 name)))
+                    if not output.getType() and tag != 'output':
+                        output.setType(tag)
                     self.addOutput(output)
                 else:
                     self.addError('Missing \'name\' on <' + tag)
 
 
-        # Fix 'ids' on all Jars/Assemblies/Outputs which don't have them
+        # Fix 'ids' on all outputs which don't have them
         if self.hasOutputs():
             if 1 == self.getOutputCount():
                 output = self.getOutputAt(0)



Mime
View raw message