geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jdil...@apache.org
Subject svn commit: r502103 - in /geronimo/sandbox/build-support/libraries/system: ./ 1/ 1/bin/ 1/groovy/ 1/groovy/gbuild/ 1/groovy/gbuild/config/ 1/groovy/gbuild/config/projects/ 1/groovy/gbuild/config/projects/Build_Harness_Testing/ 1/groovy/gbuild/config/pr...
Date Thu, 01 Feb 2007 03:36:42 GMT
Author: jdillon
Date: Wed Jan 31 19:36:41 2007
New Revision: 502103

URL: http://svn.apache.org/viewvc?view=rev&rev=502103
Log:
Adding new system library, which includes the harness plus project configuration muck

Added:
    geronimo/sandbox/build-support/libraries/system/
    geronimo/sandbox/build-support/libraries/system/1/
    geronimo/sandbox/build-support/libraries/system/1/bin/
    geronimo/sandbox/build-support/libraries/system/1/bin/clean   (with props)
    geronimo/sandbox/build-support/libraries/system/1/groovy/
    geronimo/sandbox/build-support/libraries/system/1/groovy/gbuild/
    geronimo/sandbox/build-support/libraries/system/1/groovy/gbuild/config/
    geronimo/sandbox/build-support/libraries/system/1/groovy/gbuild/config/projects/
    geronimo/sandbox/build-support/libraries/system/1/groovy/gbuild/config/projects/Build_Harness_Testing/
    geronimo/sandbox/build-support/libraries/system/1/groovy/gbuild/config/projects/Build_Harness_Testing/Controller.groovy
  (with props)
    geronimo/sandbox/build-support/libraries/system/1/groovy/gbuild/config/projects/Geronimo_CTS/
    geronimo/sandbox/build-support/libraries/system/1/groovy/gbuild/config/projects/Geronimo_CTS/Controller.groovy
  (with props)
    geronimo/sandbox/build-support/libraries/system/1/groovy/gbuild/system/
    geronimo/sandbox/build-support/libraries/system/1/groovy/gbuild/system/ActionFailure.groovy
  (with props)
    geronimo/sandbox/build-support/libraries/system/1/groovy/gbuild/system/BuildContext.groovy
  (with props)
    geronimo/sandbox/build-support/libraries/system/1/groovy/gbuild/system/BuildHarness.groovy
  (with props)
    geronimo/sandbox/build-support/libraries/system/1/groovy/gbuild/system/LogSupport.groovy
  (with props)
    geronimo/sandbox/build-support/libraries/system/1/groovy/gbuild/system/Parameters.groovy
  (with props)
    geronimo/sandbox/build-support/libraries/system/1/groovy/gbuild/system/ProjectController.groovy
  (with props)
    geronimo/sandbox/build-support/libraries/system/1/groovy/gbuild/system/commands/
    geronimo/sandbox/build-support/libraries/system/1/groovy/gbuild/system/commands/CommandSupport.groovy
  (with props)
    geronimo/sandbox/build-support/libraries/system/1/groovy/gbuild/system/commands/ExecCommand.groovy
  (with props)
    geronimo/sandbox/build-support/libraries/system/1/groovy/gbuild/system/commands/MavenCommand.groovy
  (with props)
    geronimo/sandbox/build-support/libraries/system/1/groovy/gbuild/system/util/
    geronimo/sandbox/build-support/libraries/system/1/groovy/gbuild/system/util/IterationConfigurator.groovy
  (with props)

Added: geronimo/sandbox/build-support/libraries/system/1/bin/clean
URL: http://svn.apache.org/viewvc/geronimo/sandbox/build-support/libraries/system/1/bin/clean?view=auto&rev=502103
==============================================================================
--- geronimo/sandbox/build-support/libraries/system/1/bin/clean (added)
+++ geronimo/sandbox/build-support/libraries/system/1/bin/clean Wed Jan 31 19:36:41 2007
@@ -0,0 +1,38 @@
+#!/bin/sh
+##
+## 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.
+##
+
+##
+## $Id$
+##
+
+DIRNAME=`dirname $0`
+PROGNAME=`basename $0`
+
+if [ "x$1" = "x" ]; then
+    dir=`pwd`
+else
+    dir=`cd "$1" && pwd`
+fi
+echo "Cleaning $dir..."
+
+find "$dir" -name target | xargs rm -rfv | egrep "^removed directory:"
+
+# egrep will return non-zero if no match
+exit 0

Propchange: geronimo/sandbox/build-support/libraries/system/1/bin/clean
------------------------------------------------------------------------------
    svn:executable = *

Added: geronimo/sandbox/build-support/libraries/system/1/groovy/gbuild/config/projects/Build_Harness_Testing/Controller.groovy
URL: http://svn.apache.org/viewvc/geronimo/sandbox/build-support/libraries/system/1/groovy/gbuild/config/projects/Build_Harness_Testing/Controller.groovy?view=auto&rev=502103
==============================================================================
--- geronimo/sandbox/build-support/libraries/system/1/groovy/gbuild/config/projects/Build_Harness_Testing/Controller.groovy
(added)
+++ geronimo/sandbox/build-support/libraries/system/1/groovy/gbuild/config/projects/Build_Harness_Testing/Controller.groovy
Wed Jan 31 19:36:41 2007
@@ -0,0 +1,58 @@
+/*
+ * 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.
+ */
+
+//
+// $Id$
+//
+
+package gbuild.config.Build_Harness_Testing
+
+import gbuild.system.commands.MavenCommand
+import gbuild.system.commands.ExecCommand
+
+import gbuild.system.util.IterationConfigurator
+
+/**
+ * ???
+ */
+class Controller extends gbuild.system.ProjectController
+{
+    def build = {
+        def maven = new MavenCommand(context)
+        maven.execute(params.args)
+    }
+    
+    def testscript = {
+        def exec = new ExecCommand(context)
+        exec.executable = 'project/testscript'
+        exec.execute(params.args)
+    }
+    
+    def iterate = {
+        params.args = 'foo %'
+        
+        def cfg = new IterationConfigurator(context)
+        cfg.configFile = 'project/iteration.groovy'
+        cfg.iteration = params.iteration
+        cfg.applyTo = [ 'args' ]
+        cfg.apply()
+        
+        testscript()
+    }
+}

Propchange: geronimo/sandbox/build-support/libraries/system/1/groovy/gbuild/config/projects/Build_Harness_Testing/Controller.groovy
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/sandbox/build-support/libraries/system/1/groovy/gbuild/config/projects/Build_Harness_Testing/Controller.groovy
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: geronimo/sandbox/build-support/libraries/system/1/groovy/gbuild/config/projects/Build_Harness_Testing/Controller.groovy
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: geronimo/sandbox/build-support/libraries/system/1/groovy/gbuild/config/projects/Geronimo_CTS/Controller.groovy
URL: http://svn.apache.org/viewvc/geronimo/sandbox/build-support/libraries/system/1/groovy/gbuild/config/projects/Geronimo_CTS/Controller.groovy?view=auto&rev=502103
==============================================================================
--- geronimo/sandbox/build-support/libraries/system/1/groovy/gbuild/config/projects/Geronimo_CTS/Controller.groovy
(added)
+++ geronimo/sandbox/build-support/libraries/system/1/groovy/gbuild/config/projects/Geronimo_CTS/Controller.groovy
Wed Jan 31 19:36:41 2007
@@ -0,0 +1,89 @@
+/*
+ * 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.
+ */
+
+//
+// $Id$
+//
+
+package gbuild.config.Geronimo_CTS
+
+import gbuild.system.commands.MavenCommand
+import gbuild.system.commands.ExecCommand
+
+import gbuild.system.util.IterationConfigurator
+
+/**
+ * ???
+ */
+class Controller extends gbuild.system.ProjectController
+{
+    def build = {
+        def maven = new MavenCommand(context)
+        
+        //
+        // For this project, we need to get the java version from
+        // AH configuration (since 1.2 and 2.0 use differnt versions)
+        //
+        
+        maven.javaVersion = 1.5  // FIXME
+        
+        maven.execute()
+    }
+    
+    def runtests = {
+        def exec = new ExecCommand(context)
+        exec.executable = 'project/tck-testsuite/runtests'
+        
+        def args = []
+        
+        args << '-nc'
+        args << '-Dmaven.repo.local=repository'
+        args << params.args
+        
+        exec.execute(args)
+    }
+    
+    def runtestsIteration = {
+        def cfg = new IterationConfigurator(context)
+        cfg.configFile = 'project/tck-testsuite/iteration.groovy'
+        cfg.iteration = params.iteration
+        cfg.applyTo = [ 'args' ]
+        cfg.apply()
+        
+        runtests()
+    }
+    
+    def primeTestsuite = {
+        params.args = '-w jetty nosection'
+        
+        runtests()
+    }
+    
+    def collectRuntime = {
+        // TODO
+    }
+    
+    def collectResults = {
+        // TODO
+    }
+    
+    def generateReport = {
+        // TODO
+    }
+}

Propchange: geronimo/sandbox/build-support/libraries/system/1/groovy/gbuild/config/projects/Geronimo_CTS/Controller.groovy
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/sandbox/build-support/libraries/system/1/groovy/gbuild/config/projects/Geronimo_CTS/Controller.groovy
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: geronimo/sandbox/build-support/libraries/system/1/groovy/gbuild/config/projects/Geronimo_CTS/Controller.groovy
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: geronimo/sandbox/build-support/libraries/system/1/groovy/gbuild/system/ActionFailure.groovy
URL: http://svn.apache.org/viewvc/geronimo/sandbox/build-support/libraries/system/1/groovy/gbuild/system/ActionFailure.groovy?view=auto&rev=502103
==============================================================================
--- geronimo/sandbox/build-support/libraries/system/1/groovy/gbuild/system/ActionFailure.groovy
(added)
+++ geronimo/sandbox/build-support/libraries/system/1/groovy/gbuild/system/ActionFailure.groovy
Wed Jan 31 19:36:41 2007
@@ -0,0 +1,38 @@
+/*
+ * 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.
+ */
+
+//
+// $Id$
+//
+
+package gbuild.system
+
+/**
+ * ???
+ */
+class ActionFailure extends Error
+{
+    def ActionFailure(msg) {
+        //
+        // WEIRD: For some reason using "$msg" here causes a CCE,
+        //        so the *normal* Java way instead
+        //
+        super(String.valueOf(msg))
+    }
+}

Propchange: geronimo/sandbox/build-support/libraries/system/1/groovy/gbuild/system/ActionFailure.groovy
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/sandbox/build-support/libraries/system/1/groovy/gbuild/system/ActionFailure.groovy
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: geronimo/sandbox/build-support/libraries/system/1/groovy/gbuild/system/ActionFailure.groovy
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: geronimo/sandbox/build-support/libraries/system/1/groovy/gbuild/system/BuildContext.groovy
URL: http://svn.apache.org/viewvc/geronimo/sandbox/build-support/libraries/system/1/groovy/gbuild/system/BuildContext.groovy?view=auto&rev=502103
==============================================================================
--- geronimo/sandbox/build-support/libraries/system/1/groovy/gbuild/system/BuildContext.groovy
(added)
+++ geronimo/sandbox/build-support/libraries/system/1/groovy/gbuild/system/BuildContext.groovy
Wed Jan 31 19:36:41 2007
@@ -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.
+ */
+
+//
+// $Id$
+//
+
+package gbuild.system
+
+/**
+ * ???
+ */
+class BuildContext extends Expando
+{
+    Object script
+    
+    Parameters params
+    
+    AntBuilder ant = new AntBuilder()
+    
+    def BuildContext(BuildHarness harness) {
+        assert harness != null
+        
+        params = new Parameters(harness.script.properties)
+        
+        // Replace the default listener with the enclosing listener from ant via the script
reference
+        // This is to prevent duplicate processing, which results in extra new lines :-(
+        def p = ant.antProject
+        p.removeBuildListener(p.buildListeners[0])
+        p.addBuildListener(harness.script.ant.antProject.buildListeners[0])
+    }
+}

Propchange: geronimo/sandbox/build-support/libraries/system/1/groovy/gbuild/system/BuildContext.groovy
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/sandbox/build-support/libraries/system/1/groovy/gbuild/system/BuildContext.groovy
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: geronimo/sandbox/build-support/libraries/system/1/groovy/gbuild/system/BuildContext.groovy
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: geronimo/sandbox/build-support/libraries/system/1/groovy/gbuild/system/BuildHarness.groovy
URL: http://svn.apache.org/viewvc/geronimo/sandbox/build-support/libraries/system/1/groovy/gbuild/system/BuildHarness.groovy?view=auto&rev=502103
==============================================================================
--- geronimo/sandbox/build-support/libraries/system/1/groovy/gbuild/system/BuildHarness.groovy
(added)
+++ geronimo/sandbox/build-support/libraries/system/1/groovy/gbuild/system/BuildHarness.groovy
Wed Jan 31 19:36:41 2007
@@ -0,0 +1,117 @@
+/*
+ * 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.
+ */
+
+//
+// $Id$
+//
+
+package gbuild.system
+
+/**
+ * ???
+ */
+class BuildHarness extends LogSupport
+{
+    /** The reference to the invoking script from harness.xml. */
+    def script
+    
+    def debug = false
+    
+    def BuildHarness(script) {
+        assert script != null
+        
+        this.script = script
+    }
+    
+    def run() {
+        try {
+            def context = new BuildContext(this)
+            def params = context.params
+            
+            //
+            // TODO: Might want to hack this into LogSupport too... so we can turn on/off
DEBUG
+            //
+            
+            def tmp = params['harness.debug']
+            if (tmp) {
+                debug = true
+            }
+            
+            String projectName = params.require('harness.project').replace(' ', '_')
+            log.info "Project: $projectName"
+            
+            String actionName = params.require('harness.action')
+            log.info "Action: $actionName"
+            
+            def controller = loadController(projectName)
+            log.info "Loaded project controller: $controller"
+            
+            controller.init(context)
+            controller.dispatch(actionName)
+        }
+        catch (AssertionError e) {
+            fail e
+        }
+        catch (ActionFailure e) {
+            fail e
+        }
+        catch (Throwable e) {
+            fail e, true
+        }
+    }
+    
+    def loadController(String name) {
+        assert name
+        
+        def type = getClass().classLoader.loadClass("gbuild.config.projects.${name}.Controller")
+        def controller = type.newInstance()
+        
+        return controller
+    }
+    
+    def fail(Throwable reason, trace=false) {
+        assert reason != null
+        
+        if (debug || trace) {
+            log.error(reason.message, reason)
+        }
+        else {
+            log.error(reason.message)
+        }
+        
+        script.ant.fail(message: reason.message)
+    }
+    
+    //
+    // Bootstrap
+    //
+    
+    static def bootstrap(script) {
+        println ''
+        println '*' * 80
+        println ''
+        
+        try {
+            new BuildHarness(script).run()
+        }
+        finally {
+            println '*' * 80
+        }
+    }
+}

Propchange: geronimo/sandbox/build-support/libraries/system/1/groovy/gbuild/system/BuildHarness.groovy
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/sandbox/build-support/libraries/system/1/groovy/gbuild/system/BuildHarness.groovy
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: geronimo/sandbox/build-support/libraries/system/1/groovy/gbuild/system/BuildHarness.groovy
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: geronimo/sandbox/build-support/libraries/system/1/groovy/gbuild/system/LogSupport.groovy
URL: http://svn.apache.org/viewvc/geronimo/sandbox/build-support/libraries/system/1/groovy/gbuild/system/LogSupport.groovy?view=auto&rev=502103
==============================================================================
--- geronimo/sandbox/build-support/libraries/system/1/groovy/gbuild/system/LogSupport.groovy
(added)
+++ geronimo/sandbox/build-support/libraries/system/1/groovy/gbuild/system/LogSupport.groovy
Wed Jan 31 19:36:41 2007
@@ -0,0 +1,39 @@
+/*
+ * 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.
+ */
+
+//
+// $Id$
+//
+
+package gbuild.system
+
+import org.apache.commons.logging.Log
+import org.apache.commons.logging.LogFactory
+
+/**
+ * ???
+ */
+abstract class LogSupport
+{
+    static {
+        LogFactory.getFactory().setAttribute('org.apache.commons.logging.Log', 'org.apache.commons.logging.impl.SimpleLog')
+    }
+    
+    Log log = LogFactory.getLog(this.class)
+}

Propchange: geronimo/sandbox/build-support/libraries/system/1/groovy/gbuild/system/LogSupport.groovy
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/sandbox/build-support/libraries/system/1/groovy/gbuild/system/LogSupport.groovy
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: geronimo/sandbox/build-support/libraries/system/1/groovy/gbuild/system/LogSupport.groovy
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: geronimo/sandbox/build-support/libraries/system/1/groovy/gbuild/system/Parameters.groovy
URL: http://svn.apache.org/viewvc/geronimo/sandbox/build-support/libraries/system/1/groovy/gbuild/system/Parameters.groovy?view=auto&rev=502103
==============================================================================
--- geronimo/sandbox/build-support/libraries/system/1/groovy/gbuild/system/Parameters.groovy
(added)
+++ geronimo/sandbox/build-support/libraries/system/1/groovy/gbuild/system/Parameters.groovy
Wed Jan 31 19:36:41 2007
@@ -0,0 +1,81 @@
+/*
+ * 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.
+ */
+
+//
+// $Id$
+//
+
+package gbuild.system
+
+/**
+ * ???
+ */
+class Parameters
+{
+    private Map props = [:]
+    
+    def Parameters(Map props) {
+        assert props != null
+        
+        // Copy the contents, since the given map is from Ant and has non-standard behavior
+        this.props.putAll(props)
+    }
+    
+    def get(String name, defaultValue=null) {
+        assert name != null
+        
+        def value = props[name]
+        
+        if (value == null) {
+            return defaultValue
+        }
+        
+        return value
+    }
+    
+    void set(name, value) {
+        assert name != null
+        
+        props[name] = String.valueOf(value)
+    }
+    
+    def require(String name) {
+        def value = get(name)
+        
+        assert value : "Missing required parameter: $name"
+        
+        return value
+    }
+    
+    //
+    // Allow params['foo'] and params['bar'] = 'baz' to work
+    //
+    
+    def getProperty(String name) {
+        return get(name)
+    }
+    
+    void setProperty(String name, Object value) {
+        set(name, value)
+    }
+    
+    //
+    // TODO: Add leftShift() to allow params.foo << 'appended value'
+    //
+}

Propchange: geronimo/sandbox/build-support/libraries/system/1/groovy/gbuild/system/Parameters.groovy
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/sandbox/build-support/libraries/system/1/groovy/gbuild/system/Parameters.groovy
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: geronimo/sandbox/build-support/libraries/system/1/groovy/gbuild/system/Parameters.groovy
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: geronimo/sandbox/build-support/libraries/system/1/groovy/gbuild/system/ProjectController.groovy
URL: http://svn.apache.org/viewvc/geronimo/sandbox/build-support/libraries/system/1/groovy/gbuild/system/ProjectController.groovy?view=auto&rev=502103
==============================================================================
--- geronimo/sandbox/build-support/libraries/system/1/groovy/gbuild/system/ProjectController.groovy
(added)
+++ geronimo/sandbox/build-support/libraries/system/1/groovy/gbuild/system/ProjectController.groovy
Wed Jan 31 19:36:41 2007
@@ -0,0 +1,60 @@
+/*
+ * 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.
+ */
+
+//
+// $Id$
+//
+
+package gbuild.system
+
+/**
+ * ???
+ */
+class ProjectController extends LogSupport
+{
+    BuildContext context
+    
+    Parameters params
+    
+    AntBuilder ant
+    
+    def init(BuildContext context) {
+        assert context != null
+        
+        this.context = context
+        
+        // For convenience
+        params = context.params
+        ant = context.ant
+    }
+    
+    def dispatch(String name) {
+        assert name
+        
+        def action = this[name]
+        
+        log.info("Dispatching action '${name}' to: ${action}")
+        
+        action()
+    }
+    
+    def fail(reason) {
+        throw new ActionFailure(reason)
+    }
+}

Propchange: geronimo/sandbox/build-support/libraries/system/1/groovy/gbuild/system/ProjectController.groovy
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/sandbox/build-support/libraries/system/1/groovy/gbuild/system/ProjectController.groovy
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: geronimo/sandbox/build-support/libraries/system/1/groovy/gbuild/system/ProjectController.groovy
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: geronimo/sandbox/build-support/libraries/system/1/groovy/gbuild/system/commands/CommandSupport.groovy
URL: http://svn.apache.org/viewvc/geronimo/sandbox/build-support/libraries/system/1/groovy/gbuild/system/commands/CommandSupport.groovy?view=auto&rev=502103
==============================================================================
--- geronimo/sandbox/build-support/libraries/system/1/groovy/gbuild/system/commands/CommandSupport.groovy
(added)
+++ geronimo/sandbox/build-support/libraries/system/1/groovy/gbuild/system/commands/CommandSupport.groovy
Wed Jan 31 19:36:41 2007
@@ -0,0 +1,65 @@
+/*
+ * 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.
+ */
+
+//
+// $Id$
+//
+
+package gbuild.system.commands
+
+import gbuild.system.LogSupport
+import gbuild.system.BuildContext
+import gbuild.system.Parameters
+import gbuild.system.ActionFailure
+
+//
+// TODO: Replace all harness commands with a custom builder?
+//
+
+/**
+ * ???
+ */
+abstract class CommandSupport extends LogSupport
+{
+    BuildContext context
+    
+    Parameters params
+    
+    AntBuilder ant
+    
+    def CommandSupport(context) {
+        assert context
+        
+        this.context = context
+        
+        // For convenience
+        params = context.params
+        ant = context.ant
+    }
+    
+    def separator() {
+        println ''
+        println '=' * 80
+        println ''
+    }
+    
+    def fail(reason) {
+        throw new ActionFailure(reason)
+    }
+}

Propchange: geronimo/sandbox/build-support/libraries/system/1/groovy/gbuild/system/commands/CommandSupport.groovy
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/sandbox/build-support/libraries/system/1/groovy/gbuild/system/commands/CommandSupport.groovy
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: geronimo/sandbox/build-support/libraries/system/1/groovy/gbuild/system/commands/CommandSupport.groovy
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: geronimo/sandbox/build-support/libraries/system/1/groovy/gbuild/system/commands/ExecCommand.groovy
URL: http://svn.apache.org/viewvc/geronimo/sandbox/build-support/libraries/system/1/groovy/gbuild/system/commands/ExecCommand.groovy?view=auto&rev=502103
==============================================================================
--- geronimo/sandbox/build-support/libraries/system/1/groovy/gbuild/system/commands/ExecCommand.groovy
(added)
+++ geronimo/sandbox/build-support/libraries/system/1/groovy/gbuild/system/commands/ExecCommand.groovy
Wed Jan 31 19:36:41 2007
@@ -0,0 +1,66 @@
+/*
+ * 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.
+ */
+
+//
+// $Id$
+//
+
+package gbuild.system.commands
+
+/**
+ * ???
+ */
+class ExecCommand extends CommandSupport
+{
+    def executable
+    
+    def ExecCommand(context) {
+        super(context)
+    }
+    
+    def execute(args=null) {
+        if (args) {
+            if (!(args instanceof List)) {
+                args = [ "$args" ]
+            }
+        }
+        
+        log.info "Executable: $executable"
+        log.info "Args: $args"
+        
+        ant.chmod(perm: 'u+x', file: executable)
+        
+        separator()
+        
+        try {
+            ant.exec(executable: executable, failonerror: true) {
+                args.each {
+                    arg(line: "$it")
+                }
+            }
+        }
+        catch (Exception e) {
+            // Do not propagate ant's stack trace
+            fail("Command execution failed: $e")
+        }
+        finally {
+            separator()
+        }
+    }
+}

Propchange: geronimo/sandbox/build-support/libraries/system/1/groovy/gbuild/system/commands/ExecCommand.groovy
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/sandbox/build-support/libraries/system/1/groovy/gbuild/system/commands/ExecCommand.groovy
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: geronimo/sandbox/build-support/libraries/system/1/groovy/gbuild/system/commands/ExecCommand.groovy
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: geronimo/sandbox/build-support/libraries/system/1/groovy/gbuild/system/commands/MavenCommand.groovy
URL: http://svn.apache.org/viewvc/geronimo/sandbox/build-support/libraries/system/1/groovy/gbuild/system/commands/MavenCommand.groovy?view=auto&rev=502103
==============================================================================
--- geronimo/sandbox/build-support/libraries/system/1/groovy/gbuild/system/commands/MavenCommand.groovy
(added)
+++ geronimo/sandbox/build-support/libraries/system/1/groovy/gbuild/system/commands/MavenCommand.groovy
Wed Jan 31 19:36:41 2007
@@ -0,0 +1,111 @@
+/*
+ * 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.
+ */
+
+//
+// $Id$
+//
+
+package gbuild.system.commands
+
+/**
+ * ???
+ */
+class MavenCommand extends CommandSupport
+{
+    def javaHome = System.getenv('JAVA_HOME')
+    
+    def mavenHome = 'tools/maven'
+    
+    def mavenOpts = null
+    
+    def repoDir = 'repository'
+    
+    def pom = 'project/pom.xml'
+    
+    def MavenCommand(context) {
+        super(context)
+    }
+    
+    def setJavaVersion(ver) {
+        assert ver
+        
+        def tmp = "$ver".replace('.', '_')
+        def varname = "JAVA_HOME_$tmp"
+        
+        def dir = System.getenv(varname)
+        assert dir : "Unable to use Java version: $ver; missing $varname"
+        
+        this.javaHome = dir
+    }
+    
+    def execute(args=null) {
+        if (args) {
+            if (!(args instanceof List)) {
+                args = [ "$args" ]
+            }
+        }
+        
+        log.info "POM: $pom"
+        log.info "Args: $args"
+        
+        def mvn = "$mavenHome/bin/mvn"
+        
+        ant.chmod(perm: 'u+x', file: mvn)
+        
+        separator()
+        
+        try {
+            ant.exec(executable: mvn, failonerror: true) {
+                log.info "Maven Home: $mavenHome"
+                
+                // Make sure to not pickup existing vars from environment
+                env(key: 'MAVEN_HOME', value: mavenHome)
+                env(key: 'M2_HOME', value: mavenHome)
+                
+                if (javaHome != null) {
+                    log.info "Java Home: $javaHome"
+                    env(key: 'JAVA_HOME', file: javaHome)
+                }
+                
+                if (mavenOpts != null) {
+                    env(key: 'MAVEN_OPTS', value: mavenOpts)
+                }
+                
+                arg(value: '--batch-mode')
+                arg(value: '--errors')
+                
+                arg(value: '--file')
+                arg(file: pom)
+                
+                arg(value: "-Dmaven.repo.local=$repoDir")
+                
+                args.each {
+                    arg(line: "$it")
+                }
+            }
+        }
+        catch (Exception e) {
+            // Do not propagate ant's stack trace
+            fail("Maven execution failed: $e")
+        }
+        finally {
+            separator()
+        }
+    }
+}

Propchange: geronimo/sandbox/build-support/libraries/system/1/groovy/gbuild/system/commands/MavenCommand.groovy
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/sandbox/build-support/libraries/system/1/groovy/gbuild/system/commands/MavenCommand.groovy
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: geronimo/sandbox/build-support/libraries/system/1/groovy/gbuild/system/commands/MavenCommand.groovy
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: geronimo/sandbox/build-support/libraries/system/1/groovy/gbuild/system/util/IterationConfigurator.groovy
URL: http://svn.apache.org/viewvc/geronimo/sandbox/build-support/libraries/system/1/groovy/gbuild/system/util/IterationConfigurator.groovy?view=auto&rev=502103
==============================================================================
--- geronimo/sandbox/build-support/libraries/system/1/groovy/gbuild/system/util/IterationConfigurator.groovy
(added)
+++ geronimo/sandbox/build-support/libraries/system/1/groovy/gbuild/system/util/IterationConfigurator.groovy
Wed Jan 31 19:36:41 2007
@@ -0,0 +1,123 @@
+/*
+ * 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.
+ */
+
+//
+// $Id$
+//
+
+package gbuild.system.util
+
+import gbuild.system.LogSupport
+import gbuild.system.BuildContext
+import gbuild.system.Parameters
+
+/**
+ * ???
+ */
+class IterationConfigurator extends LogSupport
+{
+    private GroovyShell shell = new GroovyShell()
+    
+    private Parameters params
+    
+    private File configFile
+    
+    private int iteration
+    
+    private List applyTo
+    
+    String replacementToken = '%'
+    
+    def IterationConfigurator(BuildContext context) {
+        assert context
+        
+        params = context.params
+    }
+    
+    def setConfigFile(filename) {
+        assert filename
+        
+        configFile = new File("$filename")
+    }
+    
+    def setIteration(n) {
+        assert n
+        
+        iteration = Integer.parseInt("$n")
+        assert iteration > 0
+    }
+    
+    def setApplyTo(list) {
+        assert list
+        
+        if (list instanceof List) {
+            applyTo = list
+        }
+        else {
+            applyTo = [ "$list" ]
+        }
+    }
+    
+    def apply() {
+        log.info "Loading configuration from: ${configFile}"
+        
+        def config = shell.evaluate(configFile)
+        
+        assert config instanceof List
+        assert config.size() > 0
+        
+        log.info "Configuration (${config.size()})"
+        for (i in 1 .. config.size()) {
+            log.info "    $i=${config[i - 1]}"
+        }
+        
+        assert iteration <= config.size() : "Iteration index is out of range"
+        
+        log.info "Applying iteration $iteration configuration to $applyTo"
+        
+        def replace = config[iteration - 1]
+        if (replace instanceof List) {
+            replace = replace.join(' ')
+        }
+        else {
+            replace = "$replace"
+        }
+        log.info "Replacment value: ${replace}"
+        
+        applyTo.each { name ->
+            def value = params.get(name)
+            
+            if (!value) {
+                log.warn "Skipping replacment on: $name; value is not set"
+            }
+            else {
+                log.info "Applying replacement to: $name, current value: $value"
+                
+                def buff = []
+                value.tokenize().each { part ->
+                    buff << part.replaceAll(replacementToken, { replace })
+                }
+                value = buff.join(' ')
+                
+                log.info "New value: $value"
+                params.set(name, value)
+            }
+        }
+    }
+}

Propchange: geronimo/sandbox/build-support/libraries/system/1/groovy/gbuild/system/util/IterationConfigurator.groovy
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/sandbox/build-support/libraries/system/1/groovy/gbuild/system/util/IterationConfigurator.groovy
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: geronimo/sandbox/build-support/libraries/system/1/groovy/gbuild/system/util/IterationConfigurator.groovy
------------------------------------------------------------------------------
    svn:mime-type = text/plain



Mime
View raw message