From ec70b777654c86b2bf166f01aa5ff87ee1ba4d78 Mon Sep 17 00:00:00 2001 From: Oleg Sukhodolsky Date: Mon, 17 Nov 2003 05:20:19 +0000 Subject: [PATCH] Applying patch 835896(classpathref support for Ant task) --- docs/anttask.html | 7 +++++++ docs/releasenotes.html | 3 +++ .../tools/checkstyle/CheckStyleTask.java | 17 ++++++++++++++++- 3 files changed, 26 insertions(+), 1 deletion(-) diff --git a/docs/anttask.html b/docs/anttask.html index 05e204221..5af743564 100644 --- a/docs/anttask.html +++ b/docs/anttask.html @@ -106,6 +106,13 @@ then you will need the following taskdef declaration:

No + + classpathref + The classpath to use when looking up classes, given as a reference + to a path defined elsewhere. + No + + diff --git a/docs/releasenotes.html b/docs/releasenotes.html index 7cd4556bd..dcf7032c3 100644 --- a/docs/releasenotes.html +++ b/docs/releasenotes.html @@ -71,6 +71,9 @@
  • Added caseSensitive property to ImportOrder check (bug 842604).
  • +
  • Added classpathref property to ant task + (patch 835896, from Ville Skytta (scop)).
  • +

    diff --git a/src/checkstyle/com/puppycrawl/tools/checkstyle/CheckStyleTask.java b/src/checkstyle/com/puppycrawl/tools/checkstyle/CheckStyleTask.java index 0d7ae3667..78fcc3124 100644 --- a/src/checkstyle/com/puppycrawl/tools/checkstyle/CheckStyleTask.java +++ b/src/checkstyle/com/puppycrawl/tools/checkstyle/CheckStyleTask.java @@ -43,6 +43,7 @@ import org.apache.tools.ant.taskdefs.LogOutputStream; import org.apache.tools.ant.types.EnumeratedAttribute; import org.apache.tools.ant.types.FileSet; import org.apache.tools.ant.types.Path; +import org.apache.tools.ant.types.Reference; /** * An implementation of a ANT task for calling checkstyle. See the documentation @@ -141,7 +142,21 @@ public class CheckStyleTask */ public void setClasspath(Path aClasspath) { - mClasspath = aClasspath; + if (mClasspath == null) { + mClasspath = aClasspath; + } + else { + mClasspath.append(aClasspath); + } + } + + /** + * Set the class path from a reference defined elsewhere. + * @param aClasspathRef the reference to an instance defining the classpath + */ + public void setClasspathRef(Reference aClasspathRef) + { + createClasspath().setRefid(aClasspathRef); } /** @return a created path for locating classes */