geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jdil...@apache.org
Subject svn commit: r506878 - /geronimo/sandbox/build-support/libraries/system/1/groovy/gbuild/system/library/LibraryManager.groovy
Date Tue, 13 Feb 2007 06:07:55 GMT
Author: jdillon
Date: Mon Feb 12 22:07:54 2007
New Revision: 506878

URL: http://svn.apache.org/viewvc?view=rev&rev=506878
Log:
Basic impl of LM 

Modified:
    geronimo/sandbox/build-support/libraries/system/1/groovy/gbuild/system/library/LibraryManager.groovy

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=506878&r1=506877&r2=506878
==============================================================================
--- 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 22:07:54 2007
@@ -25,11 +25,58 @@
 
 import gbuild.system.LogSupport
 
+import org.apache.commons.lang.time.StopWatch
+
 /**
  * Access to libraries.
  */
 class LibraryManager extends LogSupport
 {
-
+    private static log = LogSupport.getLog(this)
+    
+    //
+    // HACK: Need to pull this up from configuration
+    //
+    private static File baseDir = new File("${System.properties['user.home']}/gbuild/libraries")
+    
+    static Library getLibrary(String baseURL, String name, version) {
+        assert baseURL
+        assert name
+        assert version != null
+        
+        def watch = new StopWatch()
+        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)
+        
+        if (lib.exists()) {
+            log.info "Library exists locally, checking for updates"
+            
+            if (!lib.isLatest()) {
+                lib.unlock()
+                lib.update()
+                lib.lock()
+            }
+            else {
+                log.info "Local library copy is up to date"
+            }
+        }
+        else {
+            lib.checkout()
+            lib.lock()
+        }
+        
+        log.info "Fetched library in $watch"
+        
+        return lib
+    }
 }
 



Mime
View raw message