notify-dpml AT lists.ibiblio.org
Subject: DPML Notify
List archive
svn commit: r1602 - in development/main: central/tutorials/startable magic magic/core magic/core/src/main/net/dpml/magic magic/core/src/main/net/dpml/magic/tasks transit
- From: mcconnell AT netcompartner.com
- To: notify-dpml AT lists.ibiblio.org
- Subject: svn commit: r1602 - in development/main: central/tutorials/startable magic magic/core magic/core/src/main/net/dpml/magic magic/core/src/main/net/dpml/magic/tasks transit
- Date: Sat, 29 Jan 2005 06:15:47 +0100
Author: mcconnell
Date: Sat Jan 29 06:15:47 2005
New Revision: 1602
Added:
development/main/magic/core/src/main/net/dpml/magic/tasks/DistTask.java
Modified:
development/main/central/tutorials/startable/ (props changed)
development/main/magic/core/bootstrap.xml
development/main/magic/core/src/main/net/dpml/magic/plugin.xml
development/main/magic/core/src/main/net/dpml/magic/tasks/ProjectTask.java
development/main/magic/module.xml
development/main/transit/dist.xml
Log:
update bootstrap file in magic/core to copy files to dpml cache, update the
magic anlib to include a dist task, add DiskTask to the core, update
ProjectTask to expose a convinience deleteDirectory() method, correct some
javadoc links in the magic module, update the transit dist build file to use
the dist task.
Modified: development/main/magic/core/bootstrap.xml
==============================================================================
--- development/main/magic/core/bootstrap.xml (original)
+++ development/main/magic/core/bootstrap.xml Sat Jan 29 06:15:47 2005
@@ -74,6 +74,14 @@
<include name="processes/**"/>
</fileset>
</copy>
+ <mkdir dir="${dpml.home}/cache"/>
+ <copy toDir="${dpml.home}/cache/dpml/magic">
+ <fileset dir="target/deliverables">
+ <include name="jars/**"/>
+ <include name="plugins/**"/>
+ <include name="templates/**"/>
+ </fileset>
+ </copy>
</target>
<target name="build-tests" depends="prepare,build">
Modified: development/main/magic/core/src/main/net/dpml/magic/plugin.xml
==============================================================================
--- development/main/magic/core/src/main/net/dpml/magic/plugin.xml
(original)
+++ development/main/magic/core/src/main/net/dpml/magic/plugin.xml Sat
Jan 29 06:15:47 2005
@@ -8,6 +8,7 @@
<taskdef name="bar" classname="net.dpml.magic.tasks.BarTask"/>
<taskdef name="block" classname="net.dpml.magic.tasks.BlockTask"/>
<taskdef name="clean" classname="net.dpml.magic.tasks.CleanTask"/>
+ <taskdef name="dist" classname="net.dpml.magic.tasks.DistTask"/>
<taskdef name="export" classname="net.dpml.magic.tasks.ExportTask"/>
<taskdef name="filter" classname="net.dpml.magic.tasks.FilterTask"/>
<taskdef name="index" classname="net.dpml.magic.tasks.IndexTask"/>
Added: development/main/magic/core/src/main/net/dpml/magic/tasks/DistTask.java
==============================================================================
--- (empty file)
+++ development/main/magic/core/src/main/net/dpml/magic/tasks/DistTask.java
Sat Jan 29 06:15:47 2005
@@ -0,0 +1,129 @@
+/*
+ * 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 net.dpml.magic.tasks;
+
+import java.util.List;
+import java.util.LinkedList;
+import java.util.Iterator;
+
+import net.dpml.magic.model.Definition;
+import net.dpml.magic.project.Context;
+import net.dpml.magic.project.DeliverableHelper;
+
+import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.taskdefs.Zip;
+import org.apache.tools.ant.types.FileSet;
+import org.apache.tools.ant.types.ZipFileSet;
+
+import java.io.File;
+
+/**
+ * A very primite distribution task.
+ *
+ * @author <a href="mailto:dev-dpml AT lists.ibiblio.org";>The Digital Product
Meta Library</a>
+ * @version $Revision: 1.2 $ $Date: 2004/03/17 10:30:09 $
+ */
+public class DistTask extends ProjectTask
+{
+ private static final String ZIP_EXT = "zip";
+ private static final String TAR_EXT = "tar";
+ private static final String DIST_DIRECTORY_NAME = "dist";
+
+ private List m_zipFilesets = new LinkedList();
+
+ private List m_filesets = new LinkedList();
+
+ public void addZipFileset( ZipFileSet set )
+ {
+ m_zipFilesets.add( set );
+ }
+
+ public void addFileset( FileSet set )
+ {
+ m_filesets.add( set );
+ }
+
+ public void execute() throws BuildException
+ {
+ if( !isContentDeclared() )
+ {
+ final String error =
+ "No distribution filesets or xipfileset declared.";
+ throw new BuildException( error );
+ }
+
+ final String zipfilename = getDefinition().getFilename( ZIP_EXT );
+ final File dist = new File( getContext().getTargetDirectory(),
DIST_DIRECTORY_NAME );
+ deleteDir( dist );
+ mkDir( dist );
+ final File distribution = new File( dist, zipfilename );
+ zipIt( distribution );
+ }
+
+ private void zipIt( File distribution )
+ {
+ final Zip zip = (Zip) getProject().createTask( "zip" );
+ zip.setDestFile( distribution );
+
+ long modified = -1;
+ if( distribution.exists() )
+ {
+ modified = distribution.lastModified();
+ }
+
+ Iterator zipIterator = m_zipFilesets.iterator();
+ while( zipIterator.hasNext() )
+ {
+ ZipFileSet set = (ZipFileSet) zipIterator.next();
+ zip.addZipfileset( set );
+ }
+
+ Iterator filesetIterator = m_filesets.iterator();
+ while( filesetIterator.hasNext() )
+ {
+ FileSet set = (FileSet) filesetIterator.next();
+ zip.addFileset( set );
+ }
+
+ zip.init();
+ zip.execute();
+
+ if( distribution.lastModified() > modified )
+ {
+ DeliverableHelper.checksum( this, distribution );
+ String gpg = getIndex().getProperty( Context.GPG_EXE_KEY );
+ DeliverableHelper.asc( this, distribution, gpg );
+ }
+ }
+
+ private boolean isContentDeclared()
+ {
+ if( m_filesets.size() > 0 )
+ {
+ return true;
+ }
+ else if( m_zipFilesets.size() > 0 )
+ {
+ return true;
+ }
+ else
+ {
+ return false;
+ }
+ }
+}
Modified:
development/main/magic/core/src/main/net/dpml/magic/tasks/ProjectTask.java
==============================================================================
---
development/main/magic/core/src/main/net/dpml/magic/tasks/ProjectTask.java
(original)
+++
development/main/magic/core/src/main/net/dpml/magic/tasks/ProjectTask.java
Sat Jan 29 06:15:47 2005
@@ -22,6 +22,7 @@
import net.dpml.magic.model.Definition;
import net.dpml.transit.repository.Repository;
import org.apache.tools.ant.taskdefs.Mkdir;
+import org.apache.tools.ant.taskdefs.Delete;
import java.io.File;
@@ -69,4 +70,13 @@
mkdir.init();
mkdir.execute();
}
+
+ public void deleteDir( final File dir )
+ {
+ final Delete task = (Delete) getProject().createTask( "delete" );
+ task.setTaskName( getTaskName() );
+ task.setDir( dir );
+ task.init();
+ task.execute();
+ }
}
Modified: development/main/magic/module.xml
==============================================================================
--- development/main/magic/module.xml (original)
+++ development/main/magic/module.xml Sat Jan 29 06:15:47 2005
@@ -41,8 +41,8 @@
<target name="docs" depends="install,junit-report,checkstyle">
<x:javadoc>
<link href="http://java.sun.com/j2se/1.4/docs/api"/>
- <link href="http://www.dpml.net/asf/ant/1.6.2/api"/>
- <link href="http://www.dpml.net/checkstyle/api/3.4"/>
+ <link href="http://www.dpml.net/api/ant/1.6.2"/>
+ <link href="http://www.dpml.net/api/checkstyle/3.4"/>
<group title="Magic Bootstrap">
<package name="net.dpml.magic.bootstrap"/>
</group>
Modified: development/main/transit/dist.xml
==============================================================================
--- development/main/transit/dist.xml (original)
+++ development/main/transit/dist.xml Sat Jan 29 06:15:47 2005
@@ -34,23 +34,23 @@
<echo>Adding application properties to ${root}</echo>
<mkdir dir="${root}"/>
<copy todir="${root}">
- <fileset dir="handler/target/setup"/>
+ <fileset dir="${basedir}/handler/target/setup"/>
</copy>
<x:property name="util.version" id="dpml-util" feature="version"/>
<property name="local" value="${work}/local"/>
<echo>Creating local cache content</echo>
<mkdir dir="${local}"/>
<copy todir="${local}">
- <fileset dir="../util/target/temp/${util.version}"/>
- <fileset dir="target/temp/${project.version}"/>
+ <fileset dir="${basedir}/../util/target/temp/${util.version}"/>
+ <fileset dir="${basedir}/target/temp/${project.version}"/>
</copy>
<copy todir="${local}/dpml/util">
- <fileset dir="../util/target/deliverables">
+ <fileset dir="${basedir}/../util/target/deliverables">
<include name="modules/*.*"/>
</fileset>
</copy>
<copy todir="${local}/dpml/transit">
- <fileset dir="target/deliverables">
+ <fileset dir="${basedir}/target/deliverables">
<include name="modules/*.*"/>
</fileset>
</copy>
@@ -58,7 +58,7 @@
<echo>Adding scripts from ${bin}</echo>
<mkdir dir="${bin}"/>
<copy todir="${bin}">
- <fileset dir="plugin/target/bin"/>
+ <fileset dir="${basedir}/plugin/target/bin"/>
</copy>
<echo>${dpml.docs}</echo>
<property name="api" value="${work}/docs/api"/>
@@ -73,10 +73,9 @@
</target>
<target name="package" depends="build">
- <property name="dist" value="${basedir}/target/dist"/>
- <delete dir="${dist}"/>
- <mkdir dir="${dist}"/>
- <zip destfile="${dist}/${project.name}-${project.version}.zip"
basedir="${work}"/>
+ <x:dist>
+ <fileset dir="${work}"/>
+ </x:dist>
</target>
<target name="install" depends="package"/>
- svn commit: r1602 - in development/main: central/tutorials/startable magic magic/core magic/core/src/main/net/dpml/magic magic/core/src/main/net/dpml/magic/tasks transit, mcconnell, 01/29/2005
Archive powered by MHonArc 2.6.24.