geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jdil...@apache.org
Subject svn commit: r474116 - in /geronimo/genesis/trunk/build-harness: ./ lib/ lib/genesis/ lib/genesis/buildharness/ lib/genesis/buildharness/action/ lib/genesis/buildharness/properties/
Date Mon, 13 Nov 2006 02:54:30 GMT
Author: jdillon
Date: Sun Nov 12 18:54:29 2006
New Revision: 474116

URL: http://svn.apache.org/viewvc?view=rev&rev=474116
Log:
Some support for automated builds, which will help collect the artifacts created by the build
the exact files can be used by dependencies

Added:
    geronimo/genesis/trunk/build-harness/
    geronimo/genesis/trunk/build-harness/harness.groovy   (with props)
    geronimo/genesis/trunk/build-harness/harness.xml   (with props)
    geronimo/genesis/trunk/build-harness/lib/
    geronimo/genesis/trunk/build-harness/lib/genesis/
    geronimo/genesis/trunk/build-harness/lib/genesis/buildharness/
    geronimo/genesis/trunk/build-harness/lib/genesis/buildharness/BuildComponent.groovy  
(with props)
    geronimo/genesis/trunk/build-harness/lib/genesis/buildharness/BuildContext.groovy   (with
props)
    geronimo/genesis/trunk/build-harness/lib/genesis/buildharness/BuildHarness.groovy   (with
props)
    geronimo/genesis/trunk/build-harness/lib/genesis/buildharness/BuildHarnessException.groovy
  (with props)
    geronimo/genesis/trunk/build-harness/lib/genesis/buildharness/action/
    geronimo/genesis/trunk/build-harness/lib/genesis/buildharness/action/ActionSupport.groovy
  (with props)
    geronimo/genesis/trunk/build-harness/lib/genesis/buildharness/action/build.groovy   (with
props)
    geronimo/genesis/trunk/build-harness/lib/genesis/buildharness/action/setup.groovy   (with
props)
    geronimo/genesis/trunk/build-harness/lib/genesis/buildharness/action/verify.groovy   (with
props)
    geronimo/genesis/trunk/build-harness/lib/genesis/buildharness/properties/
    geronimo/genesis/trunk/build-harness/lib/genesis/buildharness/properties/FilePropertyBuilder.groovy
  (with props)
    geronimo/genesis/trunk/build-harness/lib/genesis/buildharness/properties/ListPropertyBuilder.groovy
  (with props)
    geronimo/genesis/trunk/build-harness/lib/genesis/buildharness/properties/PropertyBuilder.groovy
  (with props)

Added: geronimo/genesis/trunk/build-harness/harness.groovy
URL: http://svn.apache.org/viewvc/geronimo/genesis/trunk/build-harness/harness.groovy?view=auto&rev=474116
==============================================================================
--- geronimo/genesis/trunk/build-harness/harness.groovy (added)
+++ geronimo/genesis/trunk/build-harness/harness.groovy Sun Nov 12 18:54:29 2006
@@ -0,0 +1,34 @@
+/*
+ * 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$
+//
+
+import genesis.buildharness.*
+
+BuildContext.setContext(new BuildContext(this))
+
+try {
+    def harness = new BuildHarness()
+    harness.run()
+}
+finally {
+    BuildContext.unsetContext()
+}

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

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

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

Added: geronimo/genesis/trunk/build-harness/harness.xml
URL: http://svn.apache.org/viewvc/geronimo/genesis/trunk/build-harness/harness.xml?view=auto&rev=474116
==============================================================================
--- geronimo/genesis/trunk/build-harness/harness.xml (added)
+++ geronimo/genesis/trunk/build-harness/harness.xml Sun Nov 12 18:54:29 2006
@@ -0,0 +1,123 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+    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$ -->
+
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+    
+    <modelVersion>4.0.0</modelVersion>
+    
+    <groupId>org.apache.geronimo.genesis.buildharness</groupId>
+    <artifactId>build-harness</artifactId>
+    <name>Genesis :: Build Harness</name>
+    <packaging>pom</packaging>
+    
+    <!--
+    NOTE: We don't really care about the version... leave it as 1.0
+    -->
+    <version>1.0</version>
+    
+    <build>
+        <defaultGoal>install</defaultGoal>
+        
+        <pluginManagement>
+            <plugins>
+                <plugin>
+                    <groupId>org.apache.geronimo.genesis.plugins</groupId>
+                    <artifactId>script-maven-plugin</artifactId>
+                    <version>1.1-SNAPSHOT</version>
+                    <configuration>
+                        <scriptpath>
+                            <element>${pom.basedir}/lib</element>
+                        </scriptpath>
+                    </configuration>
+                </plugin>
+            </plugins>
+        </pluginManagement>
+        
+        <plugins>
+            <plugin>
+                <groupId>org.apache.geronimo.genesis.plugins</groupId>
+                <artifactId>script-maven-plugin</artifactId>
+                <executions>
+                    <execution>
+                        <phase>validate</phase>
+                        <goals>
+                            <goal>groovy</goal>
+                        </goals>
+                        <configuration>
+                            <source>
+                                <file>${pom.basedir}/harness.groovy</file>
+                            </source>
+                            <properties>
+                                <actions>setup,build,verify</actions>
+                            </properties>
+                        </configuration>
+                    </execution>
+                </executions>
+            </plugin>
+        </plugins>
+    </build>
+    
+    <pluginRepositories>
+        <pluginRepository>
+            <id>apache-snapshots</id>
+            <name>Apache Snapshots Repository</name>
+            <url>http://people.apache.org/repo/m2-snapshot-repository</url>
+            <layout>default</layout>
+            <snapshots>
+                <enabled>true</enabled>
+                <updatePolicy>daily</updatePolicy>
+                <checksumPolicy>ignore</checksumPolicy>
+            </snapshots>
+            <releases>
+                <enabled>false</enabled>
+            </releases>
+        </pluginRepository>
+    </pluginRepositories>
+    
+    <!--
+    NOTE: Child projects need to define a profile to enable this distributionManagement,
+          as it is not currently possible to include this in settings.xml or profiles.xml.
+          
+          May eventually hack in some magic to insert this into the projects top pom...
+          or maybe it would be best to generate a pom, which extends from the top pom,
+          then use it to execute so we can insert this easily?!
+          
+          The value of output.dir is set by the build script.
+    -->
+    <distributionManagement>
+        <repository>
+            <id>buildharness-releases</id>
+            <url>file://${output.dir}/release</url>
+        </repository>
+
+        <snapshotRepository>
+            <id>buildharness-snapshots</id>
+            <url>file://${output.dir}/snapshots</url>
+        </snapshotRepository>
+
+        <site>
+            <id>buildharness-website</id>
+            <url>output://${output.dir}/website</url>
+        </site>
+    </distributionManagement>
+    
+</project>
\ No newline at end of file

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

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

Propchange: geronimo/genesis/trunk/build-harness/harness.xml
------------------------------------------------------------------------------
    svn:mime-type = text/xml

Added: geronimo/genesis/trunk/build-harness/lib/genesis/buildharness/BuildComponent.groovy
URL: http://svn.apache.org/viewvc/geronimo/genesis/trunk/build-harness/lib/genesis/buildharness/BuildComponent.groovy?view=auto&rev=474116
==============================================================================
--- geronimo/genesis/trunk/build-harness/lib/genesis/buildharness/BuildComponent.groovy (added)
+++ geronimo/genesis/trunk/build-harness/lib/genesis/buildharness/BuildComponent.groovy Sun
Nov 12 18:54:29 2006
@@ -0,0 +1,32 @@
+/*
+ * 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$
+//
+
+package genesis.buildharness
+
+/**
+ * ???
+ */
+class BuildComponent
+{
+    def log = org.apache.commons.logging.LogFactory.getLog(getClass())
+}

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

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

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

Added: geronimo/genesis/trunk/build-harness/lib/genesis/buildharness/BuildContext.groovy
URL: http://svn.apache.org/viewvc/geronimo/genesis/trunk/build-harness/lib/genesis/buildharness/BuildContext.groovy?view=auto&rev=474116
==============================================================================
--- geronimo/genesis/trunk/build-harness/lib/genesis/buildharness/BuildContext.groovy (added)
+++ geronimo/genesis/trunk/build-harness/lib/genesis/buildharness/BuildContext.groovy Sun
Nov 12 18:54:29 2006
@@ -0,0 +1,159 @@
+/*
+ * 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$
+//
+
+package genesis.buildharness
+
+import org.apache.geronimo.genesis.ant.MavenAntLoggerAdapter
+
+/**
+ * ???
+ */
+class BuildContext
+    extends BuildComponent
+{
+    def source
+    def project
+    def ant = new AntBuilder()
+    
+    public BuildContext(source) {
+        assert source != null
+        
+        this.source = source
+        
+        // Extract components from the source script class
+        this.project = source.project
+        
+        // Drop the default listener and replace with a maven log adapter
+        def p = ant.antProject
+        
+        p.getBuildListeners().each {
+            p.removeBuildListener(it)
+        }
+        
+        def adapter = new MavenAntLoggerAdapter(source.log)
+        adapter.setEmacsMode(true)
+        if (source.log.isDebugEnabled()) {
+            adapter.setMessageOutputLevel(p.MSG_VERBOSE);
+        }
+        else {
+            adapter.setMessageOutputLevel(p.MSG_INFO);
+        }
+        p.addBuildListener(adapter)
+    }
+    
+    //
+    // Thread access
+    //
+    
+    private static ThreadLocal ctxHolder = new ThreadLocal()
+    
+    static def setContext(ctx) {
+        assert ctx != null
+        
+        ctxHolder.set(ctx)
+    }
+    
+    static def unsetContext() {
+        ctxHolder.set(null)
+    }
+    
+    static def getContext() {
+        def ctx = ctxHolder.get()
+        assert ctx != null
+        return ctx
+    }
+    
+    //
+    // Project access
+    //
+    
+    // Can't use getProperty() as that messes up the GroovyObject
+    def get(name) {
+        assert name != null
+        
+        def value = project.properties.getProperty(name)
+        
+        log.debug("Get property: ${name}=${value}")
+        
+        return value
+    }
+    
+    def get(name, defaultValue) {
+        def value = get(name)
+        
+        if (value == null) {
+            value = defaultValue
+        }
+        
+        return value
+    }
+    
+    def getBoolean(name, defaultValue) {
+        def value = get(name, defaultValue)
+        return Boolean.valueOf("${value}");
+    }
+    
+    def getInteger(name, defaultValue) {
+        def value = get(name, defaultValue)
+        return Integer.parseInt("${value}");
+    }
+    
+    def require(name) {
+        assert name != null
+        
+        log.debug("Require property: ${name}")
+        
+        //
+        // NOTE: Need to check project and system properties, as when setting -Dprop=foo
+        //       on the command-line m2 will set System properties not project properties.
+        //
+        if (!project.properties.containsKey(name) && !System.properties.containsKey(name))
{
+            throw new Exception("Missing required property: ${name}")
+        }
+        
+        //
+        // NOTE: Use getProperty() so that defaults (system properties) will get applied
+        //       for some reason properties[name] does not resolve defaults :-(
+        //
+        return get(name)
+    }
+    
+    def requireDirectory(name) {
+        def dir = require(name)
+        ensureDirectory(dir)
+        return dir
+    }
+    
+    def ensureDirectory(dirname) {
+        assert dirname != null
+        
+        def dir = new File(dirname)
+        if (!dir.exists()) {
+            throw new Exception("Required directory does not exist: ${dir}")
+        }
+        
+        if (!dir.isDirectory()) {
+            throw new Exception("File exists but directory was expected: ${dir}")
+        }
+    }
+}

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

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

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

Added: geronimo/genesis/trunk/build-harness/lib/genesis/buildharness/BuildHarness.groovy
URL: http://svn.apache.org/viewvc/geronimo/genesis/trunk/build-harness/lib/genesis/buildharness/BuildHarness.groovy?view=auto&rev=474116
==============================================================================
--- geronimo/genesis/trunk/build-harness/lib/genesis/buildharness/BuildHarness.groovy (added)
+++ geronimo/genesis/trunk/build-harness/lib/genesis/buildharness/BuildHarness.groovy Sun
Nov 12 18:54:29 2006
@@ -0,0 +1,91 @@
+/*
+ * 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$
+//
+
+package genesis.buildharness
+
+import genesis.buildharness.properties.*
+
+/**
+ * ???
+ */
+class BuildHarness
+    extends BuildComponent
+{
+    def actions = new ListPropertyBuilder(name: 'actions', required: true).get()
+    
+    def createAction(name) {
+        def action
+        
+        //
+        // HACK: Not sure the best way to do this with Groovy, Class.forName()
+        //       will not work here
+        //
+        
+        name = name.trim()
+        
+        switch (name) {
+            case "setup":
+                action = new genesis.buildharness.action.setup()
+                break
+            
+            case "build":
+                action = new genesis.buildharness.action.build()
+                break
+            
+            case "verify":
+                action = new genesis.buildharness.action.verify()
+                break
+            
+            default:
+                throw new Error("Unknown action: ${name}")
+        }
+        
+        log.info("Using action: ${action}")
+
+        return action
+    }
+    
+    def execute(name) {
+        log.info("Executing action: ${name}")
+        
+        def action = createAction(name)
+        
+        action.execute()
+    }
+    
+    def run() {
+        log.info("Loading actions...")
+        
+        def list = []
+        
+        this.actions.each {
+            list.add(createAction(it))
+        }
+        
+        log.info("Executing actions...")
+        
+        list.each {
+            it.execute()
+        }
+    }
+}

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

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

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

Added: geronimo/genesis/trunk/build-harness/lib/genesis/buildharness/BuildHarnessException.groovy
URL: http://svn.apache.org/viewvc/geronimo/genesis/trunk/build-harness/lib/genesis/buildharness/BuildHarnessException.groovy?view=auto&rev=474116
==============================================================================
--- geronimo/genesis/trunk/build-harness/lib/genesis/buildharness/BuildHarnessException.groovy
(added)
+++ geronimo/genesis/trunk/build-harness/lib/genesis/buildharness/BuildHarnessException.groovy
Sun Nov 12 18:54:29 2006
@@ -0,0 +1,47 @@
+/*
+ * 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$
+//
+
+package genesis.buildharness
+
+/**
+ * ???
+ */
+class BuildHarnessException
+    extends Exception
+{
+    def BuildHarnessException(String msg, Throwable cause) {
+        super(msg, cause)
+    }
+    
+    def BuildHarnessException(String msg) {
+        super(msg)
+    }
+    
+    def BuildHarnessException(Throwable cause) {
+        super(cause)
+    }
+    
+    def BuildHarnessException() {
+        super()
+    }
+}

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

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

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

Added: geronimo/genesis/trunk/build-harness/lib/genesis/buildharness/action/ActionSupport.groovy
URL: http://svn.apache.org/viewvc/geronimo/genesis/trunk/build-harness/lib/genesis/buildharness/action/ActionSupport.groovy?view=auto&rev=474116
==============================================================================
--- geronimo/genesis/trunk/build-harness/lib/genesis/buildharness/action/ActionSupport.groovy
(added)
+++ geronimo/genesis/trunk/build-harness/lib/genesis/buildharness/action/ActionSupport.groovy
Sun Nov 12 18:54:29 2006
@@ -0,0 +1,48 @@
+/*
+ * 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$
+//
+
+package genesis.buildharness.action
+
+import genesis.buildharness.*
+
+/**
+ * ???
+ */
+abstract class ActionSupport
+    extends BuildComponent
+{
+    def ctx = BuildContext.getContext()
+    def ant = ctx.ant
+    def basedir
+    def userHome
+    def localRepo
+    
+    protected ActionSupport() {
+        this.basedir = new File(".").getCanonicalFile()
+        this.userHome = new File(System.getProperty("user.home"))
+        this.localRepo = new File(userHome, ".m2/repository")
+    }
+    
+    abstract def execute();
+}
+

Propchange: geronimo/genesis/trunk/build-harness/lib/genesis/buildharness/action/ActionSupport.groovy
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/genesis/trunk/build-harness/lib/genesis/buildharness/action/ActionSupport.groovy
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: geronimo/genesis/trunk/build-harness/lib/genesis/buildharness/action/ActionSupport.groovy
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: geronimo/genesis/trunk/build-harness/lib/genesis/buildharness/action/build.groovy
URL: http://svn.apache.org/viewvc/geronimo/genesis/trunk/build-harness/lib/genesis/buildharness/action/build.groovy?view=auto&rev=474116
==============================================================================
--- geronimo/genesis/trunk/build-harness/lib/genesis/buildharness/action/build.groovy (added)
+++ geronimo/genesis/trunk/build-harness/lib/genesis/buildharness/action/build.groovy Sun
Nov 12 18:54:29 2006
@@ -0,0 +1,128 @@
+/*
+ * 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$
+//
+
+package genesis.buildharness.action
+
+import org.apache.commons.lang.SystemUtils
+
+import genesis.buildharness.*
+import genesis.buildharness.properties.*
+
+/**
+ * ???
+ */
+class build
+    extends ActionSupport
+{
+    def pomGlob = new PropertyBuilder(name: 'pomglob', required: true).get()
+    
+    def outputDir = new FilePropertyBuilder(name: 'output.dir', required: true).get()
+    
+    def mvn = getMavenExecutable()
+    
+    def execute() {
+        log.info("Pom Glob: ${pomGlob}")
+        
+        // Find all of the poms to execute
+        def scanner = ant.fileScanner {
+            fileset(dir: basedir) {
+                include(name: pomGlob)
+            }
+        }
+        
+        def poms = []
+        
+        scanner.each {
+            log.info("Found pom: ${it}")
+            poms.add(it)
+        }
+        
+        if (poms.size() == 0) {
+            throw new BuildHarnessException("No poms matched glob: ${pomGlob}")
+        }
+        
+        // Build each pom
+        poms.each {
+            maven(it)
+        }
+    }
+    
+    def maven(pom) {
+        log.info("Building: ${pom}...")
+        
+        // Make this configurable?! only append build-harness
+        def profiles = [ 'build-harness' ]
+        
+        try {
+            ant.exec(executable: mvn, failonerror: true) {
+                arg(value: "--file")
+                arg(value: pom)
+                
+                // Make this configurable?!
+                arg(value: "deploy")
+                
+                // Always show stack traces
+                arg(value: "-e")
+                
+                // Enable debug maybe
+                if (log.isDebugEnabled()) {
+                    arg(value: "-X")
+                }
+                
+                // Append profiles
+                arg(value: "-P" + profiles.join(","))
+                
+                // Need to propagate a few configuration properties
+                arg(value: "-Doutput.dir=${outputDir}")
+            }
+        }
+        catch (Exception e) {
+            throw new BuildHarnessException("Maven execution failed", e)
+        }
+    }
+    
+    def getMavenExecutable() {
+        def path = System.getProperty("maven.home");
+        if (path == null) {
+            // This should really never happen
+            throw new BuildHarnessException("Missing required system property: maven.home");
+        }
+
+        def home = new File(path);
+        def cmd;
+        
+        if (SystemUtils.IS_OS_WINDOWS) {
+            cmd = new File(home, "bin/mvn.bat");
+        }
+        else {
+            cmd = new File(home, "bin/mvn");
+        }
+
+        cmd = cmd.getCanonicalFile();
+        if (!cmd.exists()) {
+            throw new BuildHarnessException("Maven executable not found at: ${cmd}");
+        }
+
+        return cmd;
+    }
+}

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

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

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

Added: geronimo/genesis/trunk/build-harness/lib/genesis/buildharness/action/setup.groovy
URL: http://svn.apache.org/viewvc/geronimo/genesis/trunk/build-harness/lib/genesis/buildharness/action/setup.groovy?view=auto&rev=474116
==============================================================================
--- geronimo/genesis/trunk/build-harness/lib/genesis/buildharness/action/setup.groovy (added)
+++ geronimo/genesis/trunk/build-harness/lib/genesis/buildharness/action/setup.groovy Sun
Nov 12 18:54:29 2006
@@ -0,0 +1,61 @@
+/*
+ * 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$
+//
+
+package genesis.buildharness.action
+
+import genesis.buildharness.*
+import genesis.buildharness.properties.*
+
+/**
+ * ???
+ */
+class setup
+    extends ActionSupport
+{
+    def outputDir = new FilePropertyBuilder(name: 'output.dir', required: true).get()
+    
+    def execute() {
+        // Install dependency artifacts into the local m2 repo
+        def repos = new File(basedir, "repositories")
+        
+        if (repos.exists()) {
+            log.info("Installing dependency artifacts from: ${repos}")
+            
+            for (f in repos.listFiles()) {
+                log.info("Installing artifacts from: ${f}")
+                
+                ant.copy(todir: localRepo) {
+                    fileset(dir: f) {
+                        include(name: "**")
+                    }
+                }
+            }
+        }
+        else {
+            log.info("No dependency artifacts to be installed")
+        }
+        
+        // Make sure the output dir is empty first
+        ant.delete(dir: outputDir)
+    }
+}

Propchange: geronimo/genesis/trunk/build-harness/lib/genesis/buildharness/action/setup.groovy
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/genesis/trunk/build-harness/lib/genesis/buildharness/action/setup.groovy
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: geronimo/genesis/trunk/build-harness/lib/genesis/buildharness/action/setup.groovy
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: geronimo/genesis/trunk/build-harness/lib/genesis/buildharness/action/verify.groovy
URL: http://svn.apache.org/viewvc/geronimo/genesis/trunk/build-harness/lib/genesis/buildharness/action/verify.groovy?view=auto&rev=474116
==============================================================================
--- geronimo/genesis/trunk/build-harness/lib/genesis/buildharness/action/verify.groovy (added)
+++ geronimo/genesis/trunk/build-harness/lib/genesis/buildharness/action/verify.groovy Sun
Nov 12 18:54:29 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$
+//
+
+package genesis.buildharness.action
+
+import genesis.buildharness.*
+import genesis.buildharness.properties.*
+
+/**
+ * ???
+ */
+class verify
+    extends ActionSupport
+{
+    def outputDir = new FilePropertyBuilder(name: 'output.dir', required: true).get()
+    
+    def execute() {
+        log.info("Checking for output files in: ${outputDir}")
+        
+        def scanner = ant.fileScanner {
+            fileset(dir: outputDir) {
+                include(name: "**")
+            }
+        }
+        
+        def files = []
+        scanner.each {
+            files.add(it)
+        }
+        
+        if (files.size() == 0) {
+            throw new BuildHarnessException("Build produced no output files")
+        }
+        
+        log.info("Discovered output files:")
+        files.each {
+            log.info("    ${it}")
+        }
+        
+        assert found
+    }
+}

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

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

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

Added: geronimo/genesis/trunk/build-harness/lib/genesis/buildharness/properties/FilePropertyBuilder.groovy
URL: http://svn.apache.org/viewvc/geronimo/genesis/trunk/build-harness/lib/genesis/buildharness/properties/FilePropertyBuilder.groovy?view=auto&rev=474116
==============================================================================
--- geronimo/genesis/trunk/build-harness/lib/genesis/buildharness/properties/FilePropertyBuilder.groovy
(added)
+++ geronimo/genesis/trunk/build-harness/lib/genesis/buildharness/properties/FilePropertyBuilder.groovy
Sun Nov 12 18:54:29 2006
@@ -0,0 +1,46 @@
+/*
+ * 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$
+//
+
+package genesis.buildharness.properties
+
+/**
+ * ???
+ */
+class FilePropertyBuilder
+    extends PropertyBuilder
+{
+    def get() {
+        def value = super.get()
+        if (value == null) {
+            return null
+        }
+        
+        def file = new File(value)
+        
+        //
+        // TODO: Add relative support
+        //
+        
+        return file.getCanonicalFile()
+    }
+}

Propchange: geronimo/genesis/trunk/build-harness/lib/genesis/buildharness/properties/FilePropertyBuilder.groovy
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/genesis/trunk/build-harness/lib/genesis/buildharness/properties/FilePropertyBuilder.groovy
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: geronimo/genesis/trunk/build-harness/lib/genesis/buildharness/properties/FilePropertyBuilder.groovy
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: geronimo/genesis/trunk/build-harness/lib/genesis/buildharness/properties/ListPropertyBuilder.groovy
URL: http://svn.apache.org/viewvc/geronimo/genesis/trunk/build-harness/lib/genesis/buildharness/properties/ListPropertyBuilder.groovy?view=auto&rev=474116
==============================================================================
--- geronimo/genesis/trunk/build-harness/lib/genesis/buildharness/properties/ListPropertyBuilder.groovy
(added)
+++ geronimo/genesis/trunk/build-harness/lib/genesis/buildharness/properties/ListPropertyBuilder.groovy
Sun Nov 12 18:54:29 2006
@@ -0,0 +1,41 @@
+/*
+ * 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$
+//
+
+package genesis.buildharness.properties
+
+/**
+ * ???
+ */
+class ListPropertyBuilder
+    extends PropertyBuilder
+{
+    def get() {
+        def value = super.get()
+        
+        if (value == null) {
+            return []
+        }
+        
+        return value.split(",")
+    }
+}

Propchange: geronimo/genesis/trunk/build-harness/lib/genesis/buildharness/properties/ListPropertyBuilder.groovy
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/genesis/trunk/build-harness/lib/genesis/buildharness/properties/ListPropertyBuilder.groovy
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: geronimo/genesis/trunk/build-harness/lib/genesis/buildharness/properties/ListPropertyBuilder.groovy
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: geronimo/genesis/trunk/build-harness/lib/genesis/buildharness/properties/PropertyBuilder.groovy
URL: http://svn.apache.org/viewvc/geronimo/genesis/trunk/build-harness/lib/genesis/buildharness/properties/PropertyBuilder.groovy?view=auto&rev=474116
==============================================================================
--- geronimo/genesis/trunk/build-harness/lib/genesis/buildharness/properties/PropertyBuilder.groovy
(added)
+++ geronimo/genesis/trunk/build-harness/lib/genesis/buildharness/properties/PropertyBuilder.groovy
Sun Nov 12 18:54:29 2006
@@ -0,0 +1,63 @@
+/*
+ * 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$
+//
+
+package genesis.buildharness.properties
+
+import genesis.buildharness.*
+
+/**
+ * ???
+ */
+class PropertyBuilder
+    extends BuildComponent
+{
+    def name
+    def required = false
+    def defaultValue
+    
+    def get() {
+        def value = BuildContext.getContext().get(name)
+        
+        if (required) {
+            if (defaultValue != null) {
+                value = defaultValue
+            }
+            else if (value == null) {
+                throw new RequiredPropertyException(name)
+            }
+        }
+        
+        return value
+    }
+}
+
+/**
+ * ???
+ */
+class RequiredPropertyException
+    extends BuildHarnessException
+{
+    def RequiredPropertyException(name) {
+        super("Missing required property: ${name}")
+    }
+}

Propchange: geronimo/genesis/trunk/build-harness/lib/genesis/buildharness/properties/PropertyBuilder.groovy
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/genesis/trunk/build-harness/lib/genesis/buildharness/properties/PropertyBuilder.groovy
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: geronimo/genesis/trunk/build-harness/lib/genesis/buildharness/properties/PropertyBuilder.groovy
------------------------------------------------------------------------------
    svn:mime-type = text/plain



Mime
View raw message