rfe #528196, task should output version info

This commit is contained in:
Lars Kühne 2003-03-29 13:39:22 +00:00
parent 80da4bb9ba
commit ba1663fc94
3 changed files with 21 additions and 0 deletions

View File

@ -123,6 +123,12 @@
destdir="target/checkstyle"
deprecation="on" debug="on"
classpathref="build.classpath" />
<propertyfile file="target/checkstyle/checkstylecompilation.properties">
<entry key="checkstyle.compile.version" value="${version}"/>
<entry key="checkstyle.compile.timestamp" type="date" value="now" pattern="E MMMM dd yyyy, HH:mm z"/>
</propertyfile>
<copy todir="target/checkstyle">
<fileset dir="src/checkstyle" includes="**/*.properties"/>
<fileset dir="src/checkstyle" includes="**/*.xml"/>
@ -139,6 +145,7 @@
<fileset dir="src/checkstyle" includes="**/messages.properties"/>
<mapper type="glob" from="*messages.properties" to="*messages_en.properties"/>
</copy>
</target>
<target name="compile.testinputs" description="Compile test inputs">

View File

@ -90,6 +90,9 @@
<li class="body">Patch from Simon Kitching to allow more
configuration control over the JavadocMethodCheck.</li>
<li class="body">Checkstyle ant task outputs version info
in verbose and debug mode (request 550483).</li>
</ul>
<p class="body">

View File

@ -29,6 +29,7 @@ import java.util.Iterator;
import java.util.List;
import java.util.Properties;
import java.util.Hashtable;
import java.util.ResourceBundle;
import java.net.URL;
import com.puppycrawl.tools.checkstyle.api.Configuration;
@ -215,6 +216,16 @@ public class CheckStyleTask
public void execute()
throws BuildException
{
// output version info in debug mode
final ResourceBundle compilationProperties =
ResourceBundle.getBundle("checkstylecompilation");
final String version =
compilationProperties.getString("checkstyle.compile.version");
final String compileTimestamp =
compilationProperties.getString("checkstyle.compile.timestamp");
log("checkstyle version " + version, Project.MSG_VERBOSE);
log("compiled on " + compileTimestamp, Project.MSG_VERBOSE);
// Check for no arguments
if ((mFileName == null) && (mFileSets.size() == 0)) {
throw new BuildException(