avalon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mcconn...@apache.org
Subject svn commit: rev 22618 - in avalon/trunk/tools/magic: . src/main/org/apache/avalon/tools src/main/org/apache/avalon/tools/tasks
Date Tue, 06 Jul 2004 10:09:27 GMT
Author: mcconnell
Date: Tue Jul  6 03:09:26 2004
New Revision: 22618

Added:
   avalon/trunk/tools/magic/src/main/org/apache/avalon/tools/tasks/UnbarTask.java
Modified:
   avalon/trunk/tools/magic/build.xml
   avalon/trunk/tools/magic/setup.xml
   avalon/trunk/tools/magic/src/main/org/apache/avalon/tools/antlib.xml
Log:
Inital steps on an unbar task.

Modified: avalon/trunk/tools/magic/build.xml
==============================================================================
--- avalon/trunk/tools/magic/build.xml	(original)
+++ avalon/trunk/tools/magic/build.xml	Tue Jul  6 03:09:26 2004
@@ -19,7 +19,7 @@
   </target>
 
   <target name="package" depends="standard.package">
-    <x:bar name="avalon-tools.bar"/>
+    <x:bar/>
   </target>
 
   <target name="install" depends="standard.install">
@@ -59,6 +59,10 @@
       <x:svn href="https://svn.apache.org/repos/asf/avalon/trunk/tools/magic"/>
       <x:license file="../../central/system/license/LICENSE.TXT"/>
     </x:gump>
+  </target>
+
+  <target name="unbar">
+    <x:unbar bar="target/deliverables/bars/${project.short-filename}.bar"/>
   </target>
 
 </project>

Modified: avalon/trunk/tools/magic/setup.xml
==============================================================================
--- avalon/trunk/tools/magic/setup.xml	(original)
+++ avalon/trunk/tools/magic/setup.xml	Tue Jul  6 03:09:26 2004
@@ -5,7 +5,7 @@
   <property file="install.properties"/>
 
   <property name="magic.install.host" value="http://www.dpml.net"/>
-  <property name="magic.bar" value="avalon-tools.bar"/>
+  <property name="magic.bar" value="avalon-tools-magic.bar"/>
   <property name="magic.group" value="avalon/tools"/>
   <property name="magic.bar.dir" value="${magic.group}/bars"/>
   <property name="magic.bar.path" value="${magic.bar.dir}/${magic.bar}"/>

Modified: avalon/trunk/tools/magic/src/main/org/apache/avalon/tools/antlib.xml
==============================================================================
--- avalon/trunk/tools/magic/src/main/org/apache/avalon/tools/antlib.xml	(original)
+++ avalon/trunk/tools/magic/src/main/org/apache/avalon/tools/antlib.xml	Tue Jul  6 03:09:26
2004
@@ -17,6 +17,7 @@
   <taskdef name="info" classname="org.apache.avalon.tools.tasks.AnnounceTask"/> 
   <taskdef name="artifact" classname="org.apache.avalon.tools.tasks.ArtifactTask"/>

   <taskdef name="bar" classname="org.apache.avalon.tools.tasks.BarTask"/> 
+  <taskdef name="unbar" classname="org.apache.avalon.tools.tasks.UnbarTask"/> 
   <taskdef name="javadoc" classname="org.apache.avalon.tools.tasks.JavadocTask"/> 
   <taskdef name="publish" classname="org.apache.avalon.tools.tasks.PublishTask"/> 
   <taskdef name="property" classname="org.apache.avalon.tools.tasks.PropertyTask"/>


Added: avalon/trunk/tools/magic/src/main/org/apache/avalon/tools/tasks/UnbarTask.java
==============================================================================
--- (empty file)
+++ avalon/trunk/tools/magic/src/main/org/apache/avalon/tools/tasks/UnbarTask.java	Tue Jul
 6 03:09:26 2004
@@ -0,0 +1,107 @@
+/* 
+ * Copyright 2004 Apache Software Foundation
+ * Licensed  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.
+ */
+
+package org.apache.avalon.tools.tasks;
+
+import org.apache.avalon.tools.model.Definition;
+import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.Task;
+import org.apache.tools.ant.taskdefs.Jar;
+import org.apache.tools.ant.taskdefs.Manifest;
+import org.apache.tools.ant.taskdefs.ManifestException;
+import org.apache.tools.ant.types.FileSet;
+
+import java.io.File;
+import java.io.IOException;
+
+/**
+ * Unpack a bar file into a repository. 
+ *
+ * @author <a href="mailto:dev@avalon.apache.org">Avalon Development Team</a>
+ * @version $Revision: 1.2 $ $Date: 2004/03/17 10:30:09 $
+ */
+public class UnbarTask extends Task
+{
+    public static final String BAR_EXT = "bar";
+
+    private File m_cache;
+    private File m_bar;
+
+    public void setRepository( final File cache )
+    {
+        m_cache = cache;
+    }
+    
+    public void setBar( final File bar )
+    {
+        if( bar.exists() )
+        {
+            m_bar = bar;
+        }
+        else
+        {
+            final String error = 
+              "Bar file not found: " + bar;
+            throw new BuildException( error );
+        }
+    }
+    
+    private File getRepository()
+    {
+        if( null == m_cache )
+        {
+            return getDefaultRepository();
+        }
+        else
+        {
+            return m_cache;
+        }
+    }
+
+    private File getBar()
+    {
+        if( null == m_bar )
+        {
+            final String error = 
+              "You must declare the 'bar' filename.";
+            throw new BuildException( error );
+        }
+        else
+        {
+            return m_bar;
+        }
+    }
+
+    private File getDefaultRepository()
+    {
+        String cache = getProject().getProperty( "magic.cache" );
+        if( null != cache )
+        {
+            return new File( cache );
+        }
+        else
+        {
+            return getProject().getBaseDir();
+        }
+    }
+
+    public void execute() throws BuildException 
+    {
+        log( "bar: " + getBar() );
+        log( "cache: " + getRepository() );
+    }
+}

---------------------------------------------------------------------
To unsubscribe, e-mail: cvs-unsubscribe@avalon.apache.org
For additional commands, e-mail: cvs-help@avalon.apache.org


Mime
View raw message