geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jdil...@apache.org
Subject svn commit: r475540 - in /geronimo/genesis/trunk/build-harness: installdeps.groovy maven.groovy verify.groovy
Date Thu, 16 Nov 2006 02:39:49 GMT
Author: jdillon
Date: Wed Nov 15 18:39:48 2006
New Revision: 475540

URL: http://svn.apache.org/viewvc?view=rev&rev=475540
Log:
More groovy muck to handle build automation, shell was too limiting

Added:
    geronimo/genesis/trunk/build-harness/maven.groovy   (with props)
    geronimo/genesis/trunk/build-harness/verify.groovy   (with props)
Modified:
    geronimo/genesis/trunk/build-harness/installdeps.groovy

Modified: geronimo/genesis/trunk/build-harness/installdeps.groovy
URL: http://svn.apache.org/viewvc/geronimo/genesis/trunk/build-harness/installdeps.groovy?view=diff&rev=475540&r1=475539&r2=475540
==============================================================================
--- geronimo/genesis/trunk/build-harness/installdeps.groovy (original)
+++ geronimo/genesis/trunk/build-harness/installdeps.groovy Wed Nov 15 18:39:48 2006
@@ -67,7 +67,7 @@
         }
     }
     
-    def main() {
+    def main(args) {
         println "Installing dependencies..."
         
         for (depdir in depsdir.listFiles()) {
@@ -76,4 +76,4 @@
     }
 }
 
-new InstallDependencies().main()
\ No newline at end of file
+new InstallDependencies().main(args)
\ No newline at end of file

Added: geronimo/genesis/trunk/build-harness/maven.groovy
URL: http://svn.apache.org/viewvc/geronimo/genesis/trunk/build-harness/maven.groovy?view=auto&rev=475540
==============================================================================
--- geronimo/genesis/trunk/build-harness/maven.groovy (added)
+++ geronimo/genesis/trunk/build-harness/maven.groovy Wed Nov 15 18:39:48 2006
@@ -0,0 +1,104 @@
+/*
+ * 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.
+ */
+
+//
+// $Rev$ $Date$
+//
+
+class MavenBuilder
+{
+    def basedir = new File(".").getCanonicalFile()
+    
+    def outdir = new File(basedir, "output")
+    
+    def ant = new AntBuilder()
+    
+    def javaHome = System.getenv("JAVA_HOME")
+    
+    def MavenBuilder() {
+        // Enable emacs mode to disable [task] prefix on output
+        def p = ant.getAntProject()
+        p.getBuildListeners()[0].setEmacsMode(true)
+    }
+    
+    def setJava(ver) {
+        def tmp = ver.replace(".", "_")
+        def dir = System.getenv("JAVA_HOME_${tmp}")
+        if (dir == null) {
+            throw new Exception("Unable to use Java ${ver}; missing JAVA_HOME_${tmp}")
+        }
+        
+        this.javaHome = dir
+    }
+    
+    def maven(pom, args) {
+        ant.exec(executable: "mvn", failonerror: true) {
+            arg(value: "--file")
+            arg(file: "${pom}")
+            arg(value: "-Doutput.dir=${outdir}")
+            
+            args.each {
+                arg(value: "${it}")
+            }
+            
+            env(key: "JAVA_HOME", file: javaHome)
+        }
+    }
+    
+    def main(args) {
+        def iter = args.toList().iterator()
+        args = []
+        def pom
+        
+        while (iter.hasNext()) {
+            def arg = iter.next()
+            
+            println arg
+            
+            switch (arg) {
+                case '--java':
+                    setJava(iter.next())
+                    break
+                
+                case '---':
+                    while (iter.hasNext()) {
+                        args.add(iter.next())
+                    }
+                    break
+                
+                case ~"-.*":
+                    args.add(arg)
+                    break
+                
+                default:
+                    if (pom != null) {
+                        throw new Exception("Unexpected argument: ${arg}")
+                    }
+                    pom = new File(arg)
+            }
+        }
+        
+        println "Pom: ${pom}"
+        println "Args: ${args}"
+        
+        // maven(pom, args)
+    }
+}
+
+new MavenBuilder().main(args)

Propchange: geronimo/genesis/trunk/build-harness/maven.groovy
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/genesis/trunk/build-harness/maven.groovy
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: geronimo/genesis/trunk/build-harness/maven.groovy
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: geronimo/genesis/trunk/build-harness/verify.groovy
URL: http://svn.apache.org/viewvc/geronimo/genesis/trunk/build-harness/verify.groovy?view=auto&rev=475540
==============================================================================
--- geronimo/genesis/trunk/build-harness/verify.groovy (added)
+++ geronimo/genesis/trunk/build-harness/verify.groovy Wed Nov 15 18:39:48 2006
@@ -0,0 +1,62 @@
+/*
+ * 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.
+ */
+
+//
+// $Rev$ $Date$
+//
+
+class VerifyOutputs
+{
+    def basedir = new File(".").getCanonicalFile()
+    
+    def outdir = new File(basedir, "output")
+    
+    def ant = new AntBuilder()
+    
+    def verifyOutput(dir) {
+        println "Verifying output from: ${dir}"
+        
+        def scanner = ant.fileScanner {
+            fileset(dir: dir) {
+                include(name: "**")
+            }
+        }
+        
+        def l = dir.path.length() + 1
+        scanner.each { file ->
+            def path = file.getPath()[l .. -1]
+            println "   ${path}"
+        }
+    }
+    
+    def main(args) {
+        println "Verifying outputs..."
+        
+        if (outdir.exists()) {
+            for (dir in outdir.listFiles()) {
+                verifyOutput(dir)
+            }
+        }
+        else {
+            println "No output artifacts found"
+        }
+    }
+}
+
+new VerifyOutputs().main(args)

Propchange: geronimo/genesis/trunk/build-harness/verify.groovy
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/genesis/trunk/build-harness/verify.groovy
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: geronimo/genesis/trunk/build-harness/verify.groovy
------------------------------------------------------------------------------
    svn:mime-type = text/plain



Mime
View raw message