You are viewing a plain text version of this content. The canonical link for it is here.
Posted to scm@geronimo.apache.org by jd...@apache.org on 2006/11/16 02:41:58 UTC

svn commit: r475519 - /geronimo/genesis/trunk/build-harness/installdeps.groovy

Author: jdillon
Date: Wed Nov 15 17:41:58 2006
New Revision: 475519

URL: http://svn.apache.org/viewvc?view=rev&rev=475519
Log:
Need groovy & ants help to install deps and clean out artifact caches

Added:
    geronimo/genesis/trunk/build-harness/installdeps.groovy   (with props)

Added: geronimo/genesis/trunk/build-harness/installdeps.groovy
URL: http://svn.apache.org/viewvc/geronimo/genesis/trunk/build-harness/installdeps.groovy?view=auto&rev=475519
==============================================================================
--- geronimo/genesis/trunk/build-harness/installdeps.groovy (added)
+++ geronimo/genesis/trunk/build-harness/installdeps.groovy Wed Nov 15 17:41:58 2006
@@ -0,0 +1,76 @@
+/*
+ * 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$
+//
+
+class InstallDependencies
+{
+    def homedir = new File(System.getProperty("user.home"))
+    
+    def m2RepoCache = new File(homedir, ".m2/repository")
+    
+    def basedir = new File(".").getCanonicalFile()
+    
+    def depsdir = new File(basedir, "dependencies")
+    
+    def ant = new AntBuilder()
+    
+    def cleanCachedArtifacts(depdir) {
+        println "Cleaning cached artifacts..."
+        def scanner = ant.fileScanner {
+            fileset(dir: depdir) {
+                include(name: "**")
+            }
+        }
+        
+        def l = depdir.path.length() + 1
+        scanner.each { file->
+            def basepath = file.getPath()[l .. -1]
+            def dir = new File(m2RepoCache, basepath).getParentFile()
+            if (dir.exists()) {
+                ant.delete(dir: dir)
+            }
+        }
+    }
+    
+    def installArtifacts(depdir) {
+        println "Installing dependencies from: ${depdir}"
+        
+        cleanCachedArtifacts(depdir)
+        
+        println "Copying new artifacts..."
+        ant.copy(todir: m2RepoCache) {
+            fileset(dir: depdir) {
+                include(name: "**")
+            }
+        }
+    }
+    
+    def main() {
+        println "Installing dependencies..."
+        
+        for (depdir in depsdir.listFiles()) {
+            installArtifacts(depdir)
+        }
+    }
+}
+
+new InstallDependencies().main()
\ No newline at end of file

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

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

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