gump-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bode...@apache.org
Subject svn commit: r965728 - in /gump/trunk/python/gump/core/model: builder.py project.py
Date Tue, 20 Jul 2010 06:09:38 GMT
Author: bodewig
Date: Tue Jul 20 06:09:38 2010
New Revision: 965728

URL: http://svn.apache.org/viewvc?rev=965728&view=rev
Log:
Simplify local installation of POMs with a special 'builder' - will need to learn parsing
POMs for versions to become really useful

Modified:
    gump/trunk/python/gump/core/model/builder.py
    gump/trunk/python/gump/core/model/project.py

Modified: gump/trunk/python/gump/core/model/builder.py
URL: http://svn.apache.org/viewvc/gump/trunk/python/gump/core/model/builder.py?rev=965728&r1=965727&r2=965728&view=diff
==============================================================================
--- gump/trunk/python/gump/core/model/builder.py (original)
+++ gump/trunk/python/gump/core/model/builder.py Tue Jul 20 06:09:38 2010
@@ -328,6 +328,38 @@ class Maven2(Builder):
             return None
         return self.local_repo
 
+class Mvn2Install(Maven2):
+    """ Installs a single file into the local mvn repository """
+
+    def __init__(self, dom, project):
+        Maven2.__init__(self, dom, project)
+        self.goal = 'install:install-file'
+        self.packaging = self.getDomAttributeValue('packaging', 'pom')
+        self.file = self.getDomAttributeValue('file', 'pom.xml')
+        self.version = self.getDomAttributeValue('version')
+        self.artifactId = self.getDomAttributeValue('artifactId')
+
+    def expand(self, project, workspace):
+        """ Turns the builder's attributes into properties """
+        Builder.expand(self, project, workspace)
+
+        impl = getDOMImplementation()
+        if (self.artifactId):
+            self.add_property(impl, 'artifactId', self.artifactId)
+        else:
+            self.add_property(impl, 'artifactId', project.getName())
+        self.add_property(impl, 'groupId', project.getArtifactGroup())
+        self.add_property(impl, 'packaging', self.packaging)
+        self.add_property(impl, 'file', self.file)
+        self.add_property(impl, 'version', self.version)
+
+    def add_property(self, impl, name, value):
+        """ Adds a named property """
+        doc = impl.createDocument(None, 'property', None)
+        prop = doc.documentElement
+        prop.setAttribute('name', name)
+        prop.setAttribute('value', value)
+        self.importProperty(prop)
 
 # represents an <configure/> element
 class Configure(Builder):

Modified: gump/trunk/python/gump/core/model/project.py
URL: http://svn.apache.org/viewvc/gump/trunk/python/gump/core/model/project.py?rev=965728&r1=965727&r2=965728&view=diff
==============================================================================
--- gump/trunk/python/gump/core/model/project.py (original)
+++ gump/trunk/python/gump/core/model/project.py Tue Jul 20 06:09:38 2010
@@ -28,8 +28,8 @@ import gump.util.process.command
 
 from gump import log
 from gump.core.config import default
-from gump.core.model.builder import Ant, NAnt, Maven, Maven2, Script, \
-    Configure, Make
+from gump.core.model.builder import Ant, NAnt, Maven, Maven2, Mvn2Install, \
+    Script, Configure, Make
 from gump.core.model.depend import Dependable, importDomDependency
 from gump.core.model.misc import AddressPair, \
     Resultable, Positioned, Mkdir, Delete, JunitReport, Work
@@ -461,6 +461,14 @@ class Project(NamedModelObject, Statable
             # Copy over any XML errors/warnings
             # :TODO:#1: transferAnnotations(self.xml.maven, self)
 
+        # Import any <mvn2install part [if not packaged]
+        if self.hasDomChild('mvn2install') and not packaged:
+            self.mvn = Mvn2Install(self.getDomChild('mvn2install'), self)
+            self.builder.append(self.mvn)
+
+            # Copy over any XML errors/warnings
+            # :TODO:#1: transferAnnotations(self.xml.maven, self)
+
         # Import any <script part [if not packaged]
         if self.hasDomChild('script') and not packaged:
             self.script = Script(self.getDomChild('script'), self)
@@ -649,7 +657,10 @@ class Project(NamedModelObject, Statable
             self.addJVMArgs(self.getDomChild("maven"))
 
         if self.mvn:
-            self.addJVMArgs(self.getDomChild("mvn"))
+            if self.hasDomChild('mvn'):
+                self.addJVMArgs(self.getDomChild("mvn"))
+            if self.hasDomChild('mvn2install'):
+                self.addJVMArgs(self.getDomChild("mvn2install"))
 
         #
         # complete properties



Mime
View raw message