geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jdil...@apache.org
Subject svn commit: r509050 - /geronimo/sandbox/build-support/libraries/system/1/groovy/gbuild/system/library/Library.groovy
Date Mon, 19 Feb 2007 01:32:20 GMT
Author: jdillon
Date: Sun Feb 18 17:32:19 2007
New Revision: 509050

URL: http://svn.apache.org/viewvc?view=rev&rev=509050
Log:
Using 'rsync' instead of 'cp' to perform lib copies, allows us to exclude, as well as provide
normalized behavior for trailing '/'

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

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=509050&r1=509049&r2=509050
==============================================================================
--- 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
Sun Feb 18 17:32:19 2007
@@ -102,9 +102,9 @@
     }
     
     /**
-     * Make a copy of the library somewhere.
+     * Make a copy of the library somewhere using an excludes list
      */
-    Library copy(targetPath, String perms) {
+    Library copy(targetPath, String perms, List excludes) {
         assert targetPath
         
         def targetDir = new File("$targetPath").canonicalFile
@@ -120,10 +120,26 @@
         targetDir.parentFile.mkdirs()
         
         //
-        // NOTE: Use native 'cp' for speed, since some libraries can be large
-        //       and Ant's mechanism can take forever (or kill the heap)
+        // NOTE: Using 'rsync' so that we can add excludes, and also have
+        //       predictable behavior with trailing / on source dir
         //
-        exec('cp', [ '-r', baseDir, targetDir ])
+        
+        if (excludes) {
+            def excludesFile = File.createTempFile('rsync-excludes', '.txt')
+            excludesFile.deleteOnExit()
+            excludesFile.withPrintWriter { writer ->
+                excludes.each {
+                    writer.println(it)
+                }
+            }
+            
+            exec('rsync', [ '-tr', "--exclude-from=$excludesFile", "${baseDir}/", targetDir
])
+            
+            excludesFile.delete()
+        }
+        else {
+            exec('rsync', [ '-tr', "${baseDir}/", targetDir ])
+        }
         
         // If we have some perms, then set them
         if (perms) {
@@ -138,6 +154,13 @@
     }
     
     protected abstract Library createCloneForDir(File targetDir)
+    
+    /**
+     * Make a read-write copy of the library somewhere w/no excludes
+     */
+    Library copy(targetPath, String perms) {
+        return copy(targetPath, perms, null)
+    }
     
     /**
      * Make a read-write copy of the library somewhere.



Mime
View raw message