geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jdil...@apache.org
Subject svn commit: r506893 - in /geronimo/sandbox/build-support/libraries/system/1/groovy/gbuild: config/libraries/ config/projects/Geronimo_CTS/ system/library/ system/library/svn/
Date Tue, 13 Feb 2007 07:39:47 GMT
Author: jdillon
Date: Mon Feb 12 23:39:46 2007
New Revision: 506893

URL: http://svn.apache.org/viewvc?view=rev&rev=506893
Log:
Refactored to use a library repo to handle some details of repo configuration

Added:
    geronimo/sandbox/build-support/libraries/system/1/groovy/gbuild/config/libraries/
    geronimo/sandbox/build-support/libraries/system/1/groovy/gbuild/config/libraries/GBuildRepository.groovy
  (with props)
    geronimo/sandbox/build-support/libraries/system/1/groovy/gbuild/system/library/LibraryRepository.groovy
  (with props)
    geronimo/sandbox/build-support/libraries/system/1/groovy/gbuild/system/library/svn/
    geronimo/sandbox/build-support/libraries/system/1/groovy/gbuild/system/library/svn/LibraryImpl.groovy
  (with props)
    geronimo/sandbox/build-support/libraries/system/1/groovy/gbuild/system/library/svn/LibraryRepositoryImpl.groovy
  (with props)
Modified:
    geronimo/sandbox/build-support/libraries/system/1/groovy/gbuild/config/projects/Geronimo_CTS/Controller.groovy
    geronimo/sandbox/build-support/libraries/system/1/groovy/gbuild/system/library/Library.groovy
    geronimo/sandbox/build-support/libraries/system/1/groovy/gbuild/system/library/LibraryManager.groovy

Added: geronimo/sandbox/build-support/libraries/system/1/groovy/gbuild/config/libraries/GBuildRepository.groovy
URL: http://svn.apache.org/viewvc/geronimo/sandbox/build-support/libraries/system/1/groovy/gbuild/config/libraries/GBuildRepository.groovy?view=auto&rev=506893
==============================================================================
--- geronimo/sandbox/build-support/libraries/system/1/groovy/gbuild/config/libraries/GBuildRepository.groovy
(added)
+++ geronimo/sandbox/build-support/libraries/system/1/groovy/gbuild/config/libraries/GBuildRepository.groovy
Mon Feb 12 23:39:46 2007
@@ -0,0 +1,37 @@
+/*
+ * 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.libraries
+
+import gbuild.system.library.svn.LibraryRepositoryImpl
+
+/**
+ * Configuration for the GBuild library repository.
+ */
+class GBuildRepository extends LibraryRepositoryImpl
+{
+    def GBuildRepository() {
+        super('https://gbuild.org/repos/libraries')
+    }
+}
+

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

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

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

Modified: 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=diff&rev=506893&r1=506892&r2=506893
==============================================================================
--- geronimo/sandbox/build-support/libraries/system/1/groovy/gbuild/config/projects/Geronimo_CTS/Controller.groovy
(original)
+++ geronimo/sandbox/build-support/libraries/system/1/groovy/gbuild/config/projects/Geronimo_CTS/Controller.groovy
Mon Feb 12 23:39:46 2007
@@ -201,10 +201,10 @@
         //
         
         // Fetch the required libraries and make copies (prevent unwanted side-effects)
-        def baseURL = 'https://gbuild.org/repos/libraries'
+        def repo = new gbuild.config.libraries.GBuildRepository()
         
-        LibraryManager.getLibrary(baseURL, 'j2ee14-tck', '1.4.1b').copy('target/tck')
-        LibraryManager.getLibrary(baseURL, 'j2ee14-ri', '1.4.1-b05').copy('target/ri')
+        LibraryManager.getLibrary(repo, 'j2ee14-tck', '1.4.1b').copy('target/tck')
+        LibraryManager.getLibrary(repo, 'j2ee14-ri', '1.4.1-b05').copy('target/ri')
         
         //
         // TODO: Need to update Maven's settings.xml to pick up these locations, or perhaps

Modified: geronimo/sandbox/build-support/libraries/system/1/groovy/gbuild/system/library/Library.groovy
URL: http://svn.apache.org/viewvc/geronimo/sandbox/build-support/libraries/system/1/groovy/gbuild/system/library/Library.groovy?view=diff&rev=506893&r1=506892&r2=506893
==============================================================================
--- geronimo/sandbox/build-support/libraries/system/1/groovy/gbuild/system/library/Library.groovy
(original)
+++ geronimo/sandbox/build-support/libraries/system/1/groovy/gbuild/system/library/Library.groovy
Mon Feb 12 23:39:46 2007
@@ -28,27 +28,23 @@
 import org.apache.commons.lang.time.StopWatch
 
 /**
- * Access to a library
+ * Support for library implementations
  */
-class Library extends LogSupport
+abstract class Library extends LogSupport
 {
-    private static AntBuilder ant = new gbuild.system.util.AntBuilder()
-    
-    URL sourceURL
+    protected static AntBuilder ant = new gbuild.system.util.AntBuilder()
     
     File baseDir
     
     boolean isCopy = false
     
-    def Library(URL sourceURL, File baseDir) {
-        assert sourceURL
+    def Library(File baseDir) {
         assert baseDir
         
-        this.sourceURL = sourceURL
         this.baseDir = baseDir
     }
     
-    private void exec(String command, List args) {
+    protected void exec(String command, List args) {
         assert command
         assert args
         
@@ -64,7 +60,7 @@
         log.info "Exec operation ($command) completed in: $watch"
     }
     
-    private chmod(File dir, String perm) {
+    protected chmod(File dir, String perm) {
         assert dir
         assert perm
         
@@ -77,47 +73,6 @@
         exec('chmod', [ '-R', perm, dir ])
     }
     
-    private void svn(String command, List args) {
-        assert command
-        assert args
-        
-        def watch = new StopWatch()
-        watch.start()
-        
-        ant.exec(executable: 'svn', dir: baseDir, failonerror: true) {
-            arg(value: command)
-            arg(value: '--non-interactive')
-            args.each {
-                arg(value: "$it")
-            }
-        }
-        
-        log.info "SVN operation ($command) completed in: $watch"
-    }
-    
-    private String svnGet(String command, List args) {
-        assert command
-        assert args
-        
-        def watch = new StopWatch()
-        watch.start()
-        
-        // Any does not like to replace props, so make a unique one each time
-        def propname = 'svnoutput.' + UUID.randomUUID()
-        
-        ant.exec(executable: 'svn', dir: baseDir, failonerror: true, outputproperty: propname)
{
-            arg(value: command)
-            arg(value: '--non-interactive')
-            args.each {
-                arg(value: "$it")
-            }
-        }
-        
-        log.info "SVN operation ($command) completed in: $watch"
-        
-        return ant.antProject.properties[propname]
-    }
-    
     boolean exists() {
         return baseDir.exists()
     }
@@ -131,68 +86,6 @@
     }
     
     /**
-     * Check out the library.
-     */
-    def checkout() {
-        log.info "Checking out library from: $sourceURL"
-        
-        assert !exists()
-        
-        ant.mkdir(dir: baseDir)
-        
-        //
-        // TODO: May want to use --quiet for checkout operations
-        //
-        
-        svn('checkout', [ sourceURL, baseDir ])
-    }
-    
-    /**
-     * Commit changes to the library.
-     */
-    def commit(String message) {
-        assert message
-        
-        log.info "Commiting changes; message: $message"
-        
-        assert exists()
-        
-        svn('commit', [ '--message', message, baseDir ])
-    }
-    
-    /**
-     * Check if the library is the latest revision
-     */
-    boolean isLatest() {
-        log.info "Checking for changes in: $baseDir"
-        
-        assert exists()
-        
-        def lastCommit = { target ->
-            def xml = svnGet('info', [ '--xml', target ])
-            def info = new XmlParser().parseText(xml)
-            return info.entry[0].commit[0]
-        }
-        
-        def rcommit = lastCommit(sourceURL)
-        def lcommit = lastCommit(baseDir)
-        
-        return rcommit.'@revision' == lcommit.'@revision'
-    }
-    
-    /**
-     * Update the library.
-     */
-    def update() {
-        log.info "Updating library in: $baseDir"
-        
-        assert exists()
-        
-        // Update the local copy
-        svn('update', [ baseDir ])
-    }
-    
-    /**
      * Remove the library (local workspace)
      */
     def remove() {
@@ -214,7 +107,7 @@
     Library copy(targetPath, String perms) {
         assert targetPath
         
-        def targetDir = new File(targetPath).canonicalFile
+        def targetDir = new File("$targetPath").canonicalFile
         
         log.info "Copying library to: $targetDir; w/perms: $perms"
         
@@ -238,17 +131,27 @@
         }
         
         // Return new library instance, which is rooted to new dir
-        def lib = new Library(sourceURL, targetDir)
+        def lib = createCloneForDir(targetDir)
         lib.isCopy = true
         
         return lib
     }
     
+    protected abstract Library createCloneForDir(File targetDir)
+    
     /**
      * Make a read-write copy of the library somewhere.
      */
     Library copy(targetPath) {
         return copy(targetPath, 'u+rw')
     }
+    
+    abstract void checkout()
+    
+    abstract void commit(String message)
+    
+    abstract boolean isLatest()
+    
+    abstract void update()
 }
 

Modified: geronimo/sandbox/build-support/libraries/system/1/groovy/gbuild/system/library/LibraryManager.groovy
URL: http://svn.apache.org/viewvc/geronimo/sandbox/build-support/libraries/system/1/groovy/gbuild/system/library/LibraryManager.groovy?view=diff&rev=506893&r1=506892&r2=506893
==============================================================================
--- geronimo/sandbox/build-support/libraries/system/1/groovy/gbuild/system/library/LibraryManager.groovy
(original)
+++ geronimo/sandbox/build-support/libraries/system/1/groovy/gbuild/system/library/LibraryManager.groovy
Mon Feb 12 23:39:46 2007
@@ -39,8 +39,8 @@
     //
     private static File baseDir = new File("${System.properties['user.home']}/gbuild/libraries")
     
-    static Library getLibrary(String baseURL, String name, version) {
-        assert baseURL
+    static Library getLibrary(LibraryRepository repo, String name, version) {
+        assert repo
         assert name
         assert version != null
         
@@ -48,14 +48,7 @@
         watch.start()
         
         log.info "Fetching library $name version $version"
-        
-        URL libURL = new URL("$baseURL/$name/$version")
-        log.info "Library URL: $libURL"
-        
-        File libDir = new File("$baseDir/$name/$version")
-        log.info "Library dir: $libDir"
-        
-        def lib = new Library(libURL, libDir)
+        def lib = repo.createLibrary(baseDir, name, "$version")
         
         if (lib.exists()) {
             log.info "Library exists locally, checking for updates"

Added: geronimo/sandbox/build-support/libraries/system/1/groovy/gbuild/system/library/LibraryRepository.groovy
URL: http://svn.apache.org/viewvc/geronimo/sandbox/build-support/libraries/system/1/groovy/gbuild/system/library/LibraryRepository.groovy?view=auto&rev=506893
==============================================================================
--- geronimo/sandbox/build-support/libraries/system/1/groovy/gbuild/system/library/LibraryRepository.groovy
(added)
+++ geronimo/sandbox/build-support/libraries/system/1/groovy/gbuild/system/library/LibraryRepository.groovy
Mon Feb 12 23:39:46 2007
@@ -0,0 +1,37 @@
+/*
+ * 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.library
+
+import gbuild.system.LogSupport
+
+import org.apache.commons.lang.time.StopWatch
+
+/**
+ * Abstraction of the repostory which holds libraries.
+ */
+abstract class LibraryRepository extends LogSupport
+{
+    abstract Library createLibrary(File baseDir, String name, String version)
+}
+

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

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

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

Added: geronimo/sandbox/build-support/libraries/system/1/groovy/gbuild/system/library/svn/LibraryImpl.groovy
URL: http://svn.apache.org/viewvc/geronimo/sandbox/build-support/libraries/system/1/groovy/gbuild/system/library/svn/LibraryImpl.groovy?view=auto&rev=506893
==============================================================================
--- geronimo/sandbox/build-support/libraries/system/1/groovy/gbuild/system/library/svn/LibraryImpl.groovy
(added)
+++ geronimo/sandbox/build-support/libraries/system/1/groovy/gbuild/system/library/svn/LibraryImpl.groovy
Mon Feb 12 23:39:46 2007
@@ -0,0 +1,153 @@
+/*
+ * 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.library.svn
+
+import gbuild.system.library.Library
+
+import org.apache.commons.lang.time.StopWatch
+
+/**
+ * Abstraction of a library backed by Subversion
+ */
+class LibraryImpl extends Library
+{
+    URL sourceURL
+    
+    def LibraryImpl(URL sourceURL, File baseDir) {
+        super(baseDir)
+        assert sourceURL
+        
+        this.sourceURL = sourceURL
+    }
+    
+    protected Library createCloneForDir(File targetDir) {
+        assert targetDir
+        
+        return new LibraryImpl(sourceURL, targetDir)
+    }
+    
+    private void svn(String command, List args) {
+        assert command
+        assert args
+        
+        def watch = new StopWatch()
+        watch.start()
+        
+        ant.exec(executable: 'svn', dir: baseDir, failonerror: true) {
+            arg(value: command)
+            arg(value: '--non-interactive')
+            args.each {
+                arg(value: "$it")
+            }
+        }
+        
+        log.info "SVN operation ($command) completed in: $watch"
+    }
+    
+    private String svnGet(String command, List args) {
+        assert command
+        assert args
+        
+        def watch = new StopWatch()
+        watch.start()
+        
+        // Any does not like to replace props, so make a unique one each time
+        def propname = 'svnoutput.' + UUID.randomUUID()
+        
+        ant.exec(executable: 'svn', dir: baseDir, failonerror: true, outputproperty: propname)
{
+            arg(value: command)
+            arg(value: '--non-interactive')
+            args.each {
+                arg(value: "$it")
+            }
+        }
+        
+        log.info "SVN operation ($command) completed in: $watch"
+        
+        return ant.antProject.properties[propname]
+    }
+    
+    /**
+     * Check out the library.
+     */
+    void checkout() {
+        log.info "Checking out library from: $sourceURL"
+        
+        assert !exists()
+        
+        ant.mkdir(dir: baseDir)
+        
+        //
+        // TODO: May want to use --quiet for checkout operations
+        //
+        
+        svn('checkout', [ sourceURL, baseDir ])
+    }
+    
+    /**
+     * Commit changes to the library.
+     */
+    void commit(String message) {
+        assert message
+        
+        log.info "Commiting changes; message: $message"
+        
+        assert exists()
+        
+        svn('commit', [ '--message', message, baseDir ])
+    }
+    
+    /**
+     * Check if the library is the latest revision
+     */
+    boolean isLatest() {
+        log.info "Checking for changes in: $baseDir"
+        
+        assert exists()
+        
+        def lastCommit = { target ->
+            def xml = svnGet('info', [ '--xml', target ])
+            def info = new XmlParser().parseText(xml)
+            return info.entry[0].commit[0]
+        }
+        
+        def rcommit = lastCommit(sourceURL)
+        def lcommit = lastCommit(baseDir)
+        
+        return rcommit.'@revision' == lcommit.'@revision'
+    }
+    
+    /**
+     * Update the library.
+     */
+    void update() {
+        log.info "Updating library in: $baseDir"
+        
+        assert exists()
+        
+        // Update the local copy
+        svn('update', [ baseDir ])
+    }
+}
+

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

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

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

Added: geronimo/sandbox/build-support/libraries/system/1/groovy/gbuild/system/library/svn/LibraryRepositoryImpl.groovy
URL: http://svn.apache.org/viewvc/geronimo/sandbox/build-support/libraries/system/1/groovy/gbuild/system/library/svn/LibraryRepositoryImpl.groovy?view=auto&rev=506893
==============================================================================
--- geronimo/sandbox/build-support/libraries/system/1/groovy/gbuild/system/library/svn/LibraryRepositoryImpl.groovy
(added)
+++ geronimo/sandbox/build-support/libraries/system/1/groovy/gbuild/system/library/svn/LibraryRepositoryImpl.groovy
Mon Feb 12 23:39:46 2007
@@ -0,0 +1,53 @@
+/*
+ * 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.library.svn
+
+import gbuild.system.library.Library
+import gbuild.system.library.LibraryRepository
+
+/**
+ * Support for libraries backed by Subversion
+ */
+class LibraryRepositoryImpl extends LibraryRepository
+{
+    URL baseURL
+    
+    def LibraryRepositoryImpl(baseURL) {
+        assert baseURL
+        
+        this.baseURL = new URL("$baseURL")
+    }
+    
+    Library createLibrary(File baseDir, String name, String version) {
+        assert baseDir
+        assert name
+        assert version
+        
+        URL sourceURL = new URL("$baseURL/$name/$version")
+        File targetDir = new File("$baseDir/$name/$version")
+        
+        return new LibraryImpl(sourceURL, targetDir)
+    }
+}
+

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

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

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



Mime
View raw message