You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ant.apache.org by bo...@locus.apache.org on 2000/06/27 12:36:09 UTC
cvs commit: jakarta-ant/src/main/org/apache/tools/ant version.txt Main.java
bodewig 00/06/27 03:36:05
Modified: . build.xml
docs index.html
src/main/org/apache/tools/ant Main.java
Added: src/main/org/apache/tools/ant version.txt
Log:
Added -version switch.
Suggested by: Peter Donald <do...@mad.scientist.com>
Revision Changes Path
1.24 +9 -0 jakarta-ant/build.xml
Index: build.xml
===================================================================
RCS file: /home/cvs/jakarta-ant/build.xml,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -r1.23 -r1.24
--- build.xml 2000/06/24 02:46:17 1.23
+++ build.xml 2000/06/27 10:35:42 1.24
@@ -48,6 +48,7 @@
<!-- =================================================================== -->
<target name="prepare">
<mkdir dir="${build.dir}"/>
+ <tstamp />
</target>
<!-- =================================================================== -->
@@ -66,11 +67,19 @@
<exclude name="**/NetRexxC.java" unless="netrexx.present" />
<exclude name="**/XslpLiaison.java" unless="xslp.present" />
<exclude name="**/XalanLiaison.java" unless="xalan.present" />
+ <exclude name="**/version.txt" />
</javac>
<copydir src="${src.dir}" dest="${build.classes}">
<include name="**/defaultManifest.mf" />
<include name="**/*.properties" />
+ </copydir>
+
+ <filter token="VERSION" value="${version}" />
+ <filter token="DATE" value="${TODAY}" />
+ <filter token="TIME" value="${TSTAMP}" />
+ <copydir src="${src.dir}" dest="${build.classes}" filtering="on">
+ <include name="**/version.txt" />
</copydir>
</target>
1.30 +1 -1 jakarta-ant/docs/index.html
Index: index.html
===================================================================
RCS file: /home/cvs/jakarta-ant/docs/index.html,v
retrieving revision 1.29
retrieving revision 1.30
diff -u -r1.29 -r1.30
--- index.html 2000/06/26 12:46:51 1.29
+++ index.html 2000/06/27 10:35:51 1.30
@@ -479,10 +479,10 @@
<li><a href="#exec">Exec</a></li>
<li><a href="#expand">Expand</a></li>
<li><a href="#filter">Filter</a></li>
+ <li><a href="#fixcrlf">FixCRLF</a></li>
<li><a href="#get">Get</a></li>
<li><a href="#gunzip">GUnzip</a></li>
<li><a href="#gzip">GZip</a></li>
- <li><a href="#fixcrlf">FixCRLF</a></li>
<li><a href="#jar">Jar</a></li>
<li><a href="#java">Java</a></li>
<li><a href="#javac">Javac</a></li>
1.10 +28 -0 jakarta-ant/src/main/org/apache/tools/ant/Main.java
Index: Main.java
===================================================================
RCS file: /home/cvs/jakarta-ant/src/main/org/apache/tools/ant/Main.java,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- Main.java 2000/06/24 16:01:07 1.9
+++ Main.java 2000/06/27 10:35:59 1.10
@@ -116,6 +116,9 @@
if (arg.equals("-help") || arg.equals("help")) {
printUsage();
return;
+ } else if (arg.equals("-version")) {
+ printVersion();
+ return;
} else if (arg.equals("-quiet") || arg.equals("-q") || arg.equals("q")) {
msgOutputLevel = Project.MSG_WARN;
} else if (arg.equals("-verbose") || arg.equals("-v") || arg.equals("v")) {
@@ -328,6 +331,7 @@
msg.append("ant [options] [target]" + lSep);
msg.append("Options: " + lSep);
msg.append(" -help print this message" + lSep);
+ msg.append(" -version print the version information and exit" + lSep);
msg.append(" -quiet be extra quiet" + lSep);
msg.append(" -verbose be extra verbose" + lSep);
msg.append(" -logfile <file> use given file for log" + lSep);
@@ -335,5 +339,29 @@
msg.append(" -buildfile <file> use given buildfile" + lSep);
msg.append(" -D<property>=<value> use value for given property" + lSep);
System.out.println(msg.toString());
+ }
+
+ private static void printVersion() {
+ try {
+ Properties props = new Properties();
+ InputStream in =
+ Main.class.getResourceAsStream("/org/apache/tools/ant/version.txt");
+ props.load(in);
+ in.close();
+
+ String lSep = System.getProperty("line.separator");
+ StringBuffer msg = new StringBuffer();
+ msg.append("Ant version ");
+ msg.append(props.getProperty("VERSION"));
+ msg.append(" compiled on ");
+ msg.append(props.getProperty("DATE"));
+ msg.append(lSep);
+ System.out.println(msg.toString());
+ } catch (IOException ioe) {
+ System.err.println("Could not load the version information.");
+ System.err.println(ioe.getMessage());
+ } catch (NullPointerException npe) {
+ System.err.println("Could not load the version information.");
+ }
}
}
1.1 jakarta-ant/src/main/org/apache/tools/ant/version.txt
Index: version.txt
===================================================================
VERSION=@VERSION@
DATE=@DATE@
Re: cvs commit: jakarta-ant/src/main/org/apache/tools/ant version.txt Main.java
Posted by Stefan Bodewig <bo...@bost.de>.
This uses <tstamp /> to get the compilation date and the ${version}
property inside the buildfile to determine the Ant version.