dion 02/05/26 22:24:25
Modified: src/templates/build/plugins/core build.xml
. project.properties
Added: src/java/org/apache/maven/ant FileSetFromPath.java
Log:
no message
Revision Changes Path
1.3 +99 -88 jakarta-turbine-maven/src/templates/build/plugins/core/build.xml
Index: build.xml
===================================================================
RCS file:
/home/cvs/jakarta-turbine-maven/src/templates/build/plugins/core/build.xml,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- build.xml 24 May 2002 15:41:28 -0000 1.2
+++ build.xml 27 May 2002 05:24:25 -0000 1.3
@@ -25,7 +25,7 @@
<!-- E N V I R O N M E N T -->
<!-- ================================================================== -->
- <target
+ <target
name="env"
depends="local-init,#callback("pre-env"),do-env,#callback("post-env")"/>
@@ -37,10 +37,10 @@
java.home = ${java.home}
user.home = ${user.home}
lib.repo = ${lib.repo}
-
+
Classpath:
${maven.dependency.classpath}
- </echo>
+ </echo>
</target>
<!-- ================================================================== -->
@@ -104,17 +104,17 @@
-->
<property file="${maven.home}/plugins/core/default.properties" />
- <taskdef
+ <taskdef
name="maven-update-check"
className="org.apache.maven.UpdateMavenCheck">
<classpath refid="maven-classpath"/>
</taskdef>
<maven-update-check/>
-
+
<echo>
maven.mavenUpdateRequired = ${maven.mavenUpdateRequired}
- </echo>
+ </echo>
</target>
@@ -125,22 +125,22 @@
<target
name="do-maven-update"
if="maven.mavenUpdateRequired">
-
+
<!-- We need to update the Maven installation so we need to
-
+
1. Pull down the new distribution JAR (hopefully we can
make this more efficient than having to replace the
whole JAR but it will do for now).
-
+
2. Move the old directory out of the way.
-
+
3. Unpack the new distribution.
-->
-
+
<property name="mavenUpdateZip" value="maven-${maven.mavenVersion}.zip"/>
<!-- Grab the update zip file -->
- <get
+ <get
src="${maven.updateSite}/${mavenUpdateZip}"
dest="${lib.repo}/${mavenUpdateZip}"
verbose="true"
@@ -157,7 +157,7 @@
<!-- Make a the new one -->
<mkdir dir="${maven.home}"/>
-
+
<!-- Unpack the new installation -->
<unzip
src="${lib.repo}/${mavenUpdateZip}"
@@ -178,50 +178,50 @@
<target
name="do-validate-pom">
-
- <taskdef
+
+ <taskdef
name="validate-pom" classname="org.apache.maven.XmlPomValidator">
<classpath>
<path refid="maven-classpath"/>
</classpath>
</taskdef>
-
+
<validate-pom
projectDescriptor="project.xml"
xmlSchema="${maven.home}/project.xsd"
/>
-
+
</target>
-
+
<!-- ================================================================== -->
<!-- U S A G E -->
<!-- ================================================================== -->
- <target
+ <target
name="usage">
-
+
<echo message="use -projecthelp to see the available targets"/>
</target>
<!-- ================================================================== -->
<!-- P R E P A R E S O U R C E S -->
<!-- ================================================================== -->
-
+
<target
name="prepare-sources"
if="maven.prepareSourceDirectory">
-
+
<echo>
maven.prepareSourceDirectory = ${maven.prepareSourceDirectory}
</echo>
-
+
<mkdir dir="${maven.prepareSourceDirectory}"/>
-
+
<!-- We need to do this here but we need to make a
fileset reference to make this easier.
-->
-
+
<!--
<copy todir="${build.dir}">
<fileset dir=".">
@@ -229,8 +229,8 @@
</fileset>
</copy>
-->
-
- <ant
+
+ <ant
antfile="${maven.delegatorBuildFile}"
target="${maven.prepareSourceTarget}"
/>
@@ -297,13 +297,13 @@
name="ajc"
classname="org.aspectj.tools.ant.taskdefs.Ajc"/>
- <ajc
+ <ajc
destdir="${maven.build.dest}"
excludes="**/package.html"
debug="${maven.compile.debug}"
deprecation="${maven.compile.deprecation}"
optimize="${maven.compile.optimize}">
-
+
<src>
<path refid="maven.compile.src.set"/>
<path refid="maven.src.aspect.set"/>
@@ -320,7 +320,7 @@
does include Ant's runtime libraries when compiling, so to
mimic this behavior, we need to manually include the jars
from the ant.home/lib directory.
- -->
+ -->
<fileset dir="${ant.home}/lib">
<include name="**/*.jar"/>
</fileset>
@@ -328,7 +328,7 @@
</ajc>
</target>
-
+
<!-- ================================================================== -->
<!-- C H E C K S O U R C E -->
<!-- ================================================================== -->
@@ -336,10 +336,10 @@
name="check-source"
depends="local-init, env, #callback("pre-check-source"), do-check-source,
#callback("post-check-source")"
description="o Check the source code for style violations"/>
-
+
<target name="do-check-source" if="maven.sourcesPresent">
- <taskdef
+ <taskdef
name="checkstyle"
classname="com.puppycrawl.tools.checkstyle.CheckStyleTask">
<classpath refid="maven-classpath"/>
@@ -350,7 +350,19 @@
<path refid="maven-classpath"/>
</classpath>
</taskdef>
+
+ <taskdef name="filesetfrompath"
+ classname="org.apache.maven.ant.FileSetFromPath">
+ <classpath>
+ <path refid="maven-classpath"/>
+ </classpath>
+ </taskdef>
+ <filesetfrompath pathid="maven.src.set"
+ filesetid="maven.sourceDirectories.fileset"
+ includes="${maven.checkstyle.includes}"
+ excludes="${maven.checkstyle.excludes}"/>
+
<checkstyle
lcurlyType="${maven.checkstyle.lcurly.type}"
lcurlyMethod="${maven.checkstyle.lcurly.method}"
@@ -389,12 +401,12 @@
ignorePublicInInterface="${maven.checkstyle.ignore.public.in.interface}"
failOnViolation="${maven.checkstyle.fail.on.violation}"
cacheFile="${maven.checkstyle.cache.file}" >
- <fileset
- dir="${maven.src.dir}"
+ <fileset refid="maven.sourceDirectories.fileset" />
+<!-- dir="${maven.src.dir}"
includes="${maven.checkstyle.includes}"
- excludes="${maven.checkstyle.excludes}"/>
- <formatter type="xml" toFile="${maven.build.dir}/checkstyle-raw-report.xml"/>
- <formatter type="plain"
toFile="${maven.build.dir}/checkstyle-raw-report.txt"/>
+ excludes="${maven.checkstyle.excludes}"/>-->
+ <formatter type="xml" toFile="${maven.build.dir}/checkstyle-raw-report.xml"/>
+ <formatter type="plain"
toFile="${maven.build.dir}/checkstyle-raw-report.txt"/>
</checkstyle>
<dvsl
@@ -407,15 +419,14 @@
<classpath>
<path refid="maven-classpath"/>
</classpath>
- <tool name="toolbox.string.srcDir" value="${maven.src.dir}"/>
</dvsl>
</target>
-
+
<!-- ================================================================== -->
<!-- J A R R E S O U R C E S -->
<!-- ================================================================== -->
-
+
<target
name="jar-resources"
depends="local-init,env"
@@ -424,18 +435,18 @@
<!-- Copy any resources that must be present in the deployed
JAR file.
-->
-
+
<echo>
Copy resources into destination directory for deployment
in the JAR.
</echo>
-
+
<copy todir="${maven.build.dest}">
<fileset dir="${maven.jarResources.basedir}">
<patternset refid="maven.jar.resources.set"/>
</fileset>
</copy>
- </target>
+ </target>
<!-- ================================================================== -->
<!-- J A R -->
@@ -449,7 +460,7 @@
<target name="do-jar" depends="jar-resources">
<ant antfile="${maven.home}/plugins/test/build.xml" target="test"/>
-
+
<jar
jarfile="${maven.build.dir}/${maven.final.name}.jar"
basedir="${maven.build.dest}"
@@ -488,35 +499,35 @@
<!-- -->
<!-- You would use a command like the following to build a distribution -->
<!-- for your project: -->
- <!-- -->
- <!-- ant maven:dist -Dmaven.tag=MAVEN_B4 -->
+ <!-- -->
+ <!-- ant maven:dist -Dmaven.tag=MAVEN_B4 -->
<!-- ================================================================== -->
<target name="dist"
depends="dist-check-tag,#callback("pre-dist"),do-dist,#callback("post-dist")"/>
<target name="do-dist" if="maven.tag">
-
+
<antcall target="dist-checkout-sources"/>
-
+
</target>
<target
name="dist-checkout-sources"
depends="local-init">
-
- <!--
-
+
+ <!--
+
Make sure the dist directory is remove so that we know
we are starting with a clean slate. We will also place a
file in ${maven.distBuildDirectory} which indicates that
it is ok to build a distribution within that directory.
-
+
-->
-
+
<delete dir="${maven.distBuildDirectory}"/>
<mkdir dir="${maven.distBuildDirectory}/${maven.cvsModule}"/>
<touch
file="${maven.distBuildDirectory}/${maven.cvsModule}/${maven.distBuildIndicator}"/>
-
+
<cvs
cvsRoot="${maven.cvsRoot}"
package="${maven.cvsModule}"
@@ -525,29 +536,29 @@
/>
<!--
-
+
Now that we have our freshly checked out sources we can use
those sources to create our distribution.
-
+
-->
-
- <ant
+
+ <ant
dir="${maven.distBuildDirectory}/${maven.cvsModule}"
target="maven:dist-build"
inheritAll="false"
/>
-
+
<!--
-
+
The distributions have been created with fresh sources so
lets move the distributions into a visible location and
remove everything used to create the distributions so that
no mistakes can be made unintentionally.
-
+
-->
-
+
<mkdir dir="${maven.distDirectory}"/>
-
+
<copy todir="${maven.distDirectory}">
<fileset dir="${maven.distBuildDirectory}/${maven.cvsModule}/target">
<include name="**/*.tar.gz"/>
@@ -612,11 +623,11 @@
</tarfileset>
</tar>
- <gzip
- zipfile="${maven.build.dir}/${maven.final.name}.tar.gz"
+ <gzip
+ zipfile="${maven.build.dir}/${maven.final.name}.tar.gz"
src="${maven.build.dir}/${maven.final.name}.tar"
/>
-
+
<delete file="${maven.build.dir}/${maven.final.name}.tar"/>
<!-- Create a zip file -->
@@ -658,11 +669,11 @@
</tarfileset>
</tar>
- <gzip
- zipfile="${maven.build.dir}/${maven.final.name}-src.tar.gz"
+ <gzip
+ zipfile="${maven.build.dir}/${maven.final.name}-src.tar.gz"
src="${maven.build.dir}/${maven.final.name}-src.tar"
/>
-
+
<delete file="${maven.build.dir}/${maven.final.name}-src.tar"/>
<!-- Create a zip file -->
@@ -687,8 +698,8 @@
<!-- I N S T A L L J A R -->
<!-- ================================================================== -->
- <target
- name="install-jar"
+ <target
+ name="install-jar"
depends="jar,#callback("pre-install-jar"),do-install-jar,#callback("post-install-jar")"
description="o Installs JAR file in local ${lib.repo}"/>
@@ -715,7 +726,7 @@
<target name="do-gump-descriptor">
- <taskdef
+ <taskdef
name="dvsl" classname="org.apache.tools.dvsl.DVSLTask">
<classpath>
<path refid="maven-classpath"/>
@@ -730,13 +741,13 @@
in="project.xml"
out="gump.xml"
/>
-
+
<taskdef
name="gump-build"
classname="org.apache.maven.BaseProjectTask">
<classpath refid="maven-classpath"/>
</taskdef>
-
+
<gump-build
controlTemplate="build-gump.xml"
outputDirectory="${basedir}"
@@ -744,14 +755,14 @@
outputFile="build-gump.xml"
projectDescriptor="project.xml"
/>
-
+
</target>
<!-- ================================================================== -->
<!-- C L E A N -->
<!-- ================================================================== -->
- <target
+ <target
name="clean"
depends="local-init,#callback("pre-clean"),do-clean,#callback("post-clean")"
description="o Cleans up the build directory"/>
@@ -801,30 +812,30 @@
<target
name="do-announce">
-
+
<!-- Need to make sure all these values are set before trying
to send an announcement so that we're not spamming
people needlessly.
-->
-
+
<property
file="${maven.src.dir}/announcements/${maven.announcement}.properties"/>
-
+
<echo>
- from="${maven.announcementFrom}"
- tolist="${maven.announcementRecipients}"
+ from="${maven.announcementFrom}"
+ tolist="${maven.announcementRecipients}"
subject="${maven.announcementSubject}"
files="${maven.announcementFile}"
mailHost="${maven.mailHost}"
- </echo>
-
- <mail
- from="${maven.announcementFrom}"
- tolist="${maven.announcementRecipients}"
+ </echo>
+
+ <mail
+ from="${maven.announcementFrom}"
+ tolist="${maven.announcementRecipients}"
subject="${maven.announcementSubject}"
files="${maven.announcementFile}"
mailHost="${maven.mailHost}"
/>
-
+
</target>
</project>
1.1
jakarta-turbine-maven/src/java/org/apache/maven/ant/FileSetFromPath.java
Index: FileSetFromPath.java
===================================================================
package org.apache.maven.ant;
/* ====================================================================
* The Apache Software License, Version 1.1
*
* Copyright (c) 2002 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution,
* if any, must include the following acknowledgment:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowledgment may appear in the software itself,
* if and wherever such third-party acknowledgments normally appear.
*
* 4. The names "Apache" and "Apache Software Foundation" and
* "Apache Maven" must not be used to endorse or promote products
* derived from this software without prior written permission. For
* written permission, please contact [EMAIL PROTECTED]
*
* 5. Products derived from this software may not be called "Apache",
* "Apache Maven", nor may "Apache" appear in their name, without
* prior written permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*/
import java.io.File;
import org.apache.commons.lang.Strings;
import org.apache.tools.ant.BuildException;
import org.apache.tools.ant.Project;
import org.apache.tools.ant.Task;
import org.apache.tools.ant.types.FileSet;
import org.apache.tools.ant.types.Path;
/**
* An ant fileset that gets it's includes/excludes from a path. The path
* must be made up of directories relative to the project ${basedir}
*
* @author dion
*/
public class FileSetFromPath extends Task
{
/** This is a refid to a project reference that contains a {@link Path}*/
private String pathid;
/** This is the name of the reference to store the fileset under */
private String filesetid;
/** comma separated patterns of files to be included */
private String includes;
/** comma separated patterns of files to be excluded */
private String excludes;
/** Creates a new instance of FileSetFromPath */
public FileSetFromPath()
{
}
/** set the provided <code>scanner</code> up with the directory, includes
* excludes etc provided by this FileSet for the provided <code>
* project</code>
* @param scanner a {@link FileScanner} to set up
* @param project the project the fileset is being used in
*/
public void execute() throws BuildException
{
if (getPathid() == null)
{
throw new BuildException("pathid attribute must be provided");
}
if (getFilesetid() == null)
{
throw new BuildException("filesetid attribute must be provided");
}
if (getIncludes() == null && getExcludes() == null)
{
throw new BuildException("one of the includes or excludes " +
"attributes must be set");
}
if (getBasedir() == null)
{
throw new NullPointerException("basedir project property missing");
}
// perform processing to set up the directories in path object
// as a directory + includes/excludes suffixes.
Path path = (Path) getProject().getReferences().get(getPathid());
if (path == null)
{
throw new BuildException("referenced path '" + getPathid() + "'" +
" not found in this project");
}
FileSet files = new FileSet();
files.setDir(new File(getBasedir()));
String[] elements = path.list();
for (int index = 0; index < elements.length; index++)
{
addPathElement(files, elements[index]);
}
getProject().addReference(getFilesetid(), files);
}
/** add the provided <code>pathElement</code> to the given
* <code>fileset</code>, by adding the includes/excludes to the end of the
* pathElement
* @param fileset a fileset to add includes/excludes to
* @param pathElement a directory relative to the project <code>basedir
* </code>
*/
private void addPathElement(FileSet fileset, String pathElement)
{
log("processing path element=" + pathElement, Project.MSG_DEBUG);
String basedir = getBasedir();
if (pathElement.startsWith(basedir))
{
// strip basedir and add it as includes/excludes where specified
String directory = pathElement.substring(basedir.length());
if (!isFileSeparator(directory.charAt(directory.length()-1)))
{
directory += File.separator;
}
if (isFileSeparator(directory.charAt(0)))
{
directory = directory.substring(1);
}
if (getIncludes() != null) {
String[] list = Strings.split(getIncludes());
for (int index = 0; index < list.length; index++)
{
fileset.createInclude().setName(directory + list[index]);
}
}
if (getExcludes() != null) {
String[] list = Strings.split(getExcludes());
for (int index = 0; index < list.length; index++)
{
fileset.createExclude().setName(directory + list[index]);
}
}
}
else
{
throw new BuildException("Path '" + pathElement + "' is" +
"not within the project basedir '" + basedir + "'");
}
}
/**
* test if the <code>char</code> passed is a file separator.
* @param c the character to test
* @return true if the char is {@link File#separatorChar the file separator}
* or '/' or '\\'
*/
private boolean isFileSeparator(char c)
{
return (c == File.separatorChar) || (c == '/') || (c == '\\');
}
/** Retrieve the path id this fileset is built from
* @return Value of property pathid.
*/
public String getPathid()
{
return pathid;
}
/** Set the path id this fileset is built from
* @param pathid New value of property pathid.
*/
public void setPathid(String pathid)
{
this.pathid = pathid;
}
/** Getter for property filesetid.
* @return Value of property filesetid.
*/
public String getFilesetid()
{
return filesetid;
}
/** Setter for property filesetid.
* @param filesetid New value of property filesetid.
*/
public void setFilesetid(String filesetid)
{
this.filesetid = filesetid;
}
/** retrieve the comma separated list of patterns to exclude.
* @return Value of property excludes.
*/
public String getExcludes()
{
return excludes;
}
/** set the comma separated list of patterns to exclude.
* @param excludes New value of property excludes.
*/
public void setExcludes(String excludes)
{
this.excludes = excludes;
}
/** retrieve the comma separated list of patterns to include.
* @return Value of property includes.
*/
public String getIncludes()
{
return includes;
}
/** Set the comma separated list of patterns to include.
* @param includes New value of property includes.
*/
public void setIncludes(String includes)
{
this.includes = includes;
}
/** retrieve the <code>basedir</code> property for the project
* @return the value of the <code>basedir</code> property for this project
*/
private String getBasedir()
{
return getProject().getProperty("basedir");
}
}
1.13 +1 -1 jakarta-turbine-maven/project.properties
Index: project.properties
===================================================================
RCS file: /home/cvs/jakarta-turbine-maven/project.properties,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -r1.12 -r1.13
--- project.properties 24 May 2002 15:41:28 -0000 1.12
+++ project.properties 27 May 2002 05:24:25 -0000 1.13
@@ -19,4 +19,4 @@
maven.announcement = beta2
-maven.checkstyle.excludes = java/org/apache/maven/java/parser/**
+maven.checkstyle.excludes = org/apache/maven/java/parser/**
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>