Suggested by: Peter Donald <donaldp@mad.scientist.com> git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@267704 13f79535-47bb-0310-9956-ffa450edef68master
| @@ -48,6 +48,7 @@ | |||||
| <!-- =================================================================== --> | <!-- =================================================================== --> | ||||
| <target name="prepare"> | <target name="prepare"> | ||||
| <mkdir dir="${build.dir}"/> | <mkdir dir="${build.dir}"/> | ||||
| <tstamp /> | |||||
| </target> | </target> | ||||
| <!-- =================================================================== --> | <!-- =================================================================== --> | ||||
| @@ -66,12 +67,20 @@ | |||||
| <exclude name="**/NetRexxC.java" unless="netrexx.present" /> | <exclude name="**/NetRexxC.java" unless="netrexx.present" /> | ||||
| <exclude name="**/XslpLiaison.java" unless="xslp.present" /> | <exclude name="**/XslpLiaison.java" unless="xslp.present" /> | ||||
| <exclude name="**/XalanLiaison.java" unless="xalan.present" /> | <exclude name="**/XalanLiaison.java" unless="xalan.present" /> | ||||
| <exclude name="**/version.txt" /> | |||||
| </javac> | </javac> | ||||
| <copydir src="${src.dir}" dest="${build.classes}"> | <copydir src="${src.dir}" dest="${build.classes}"> | ||||
| <include name="**/defaultManifest.mf" /> | <include name="**/defaultManifest.mf" /> | ||||
| <include name="**/*.properties" /> | <include name="**/*.properties" /> | ||||
| </copydir> | </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> | </target> | ||||
| <!-- =================================================================== --> | <!-- =================================================================== --> | ||||
| @@ -479,10 +479,10 @@ If you do not want these default excludes applied, you may disable them with the | |||||
| <li><a href="#exec">Exec</a></li> | <li><a href="#exec">Exec</a></li> | ||||
| <li><a href="#expand">Expand</a></li> | <li><a href="#expand">Expand</a></li> | ||||
| <li><a href="#filter">Filter</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="#get">Get</a></li> | ||||
| <li><a href="#gunzip">GUnzip</a></li> | <li><a href="#gunzip">GUnzip</a></li> | ||||
| <li><a href="#gzip">GZip</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="#jar">Jar</a></li> | ||||
| <li><a href="#java">Java</a></li> | <li><a href="#java">Java</a></li> | ||||
| <li><a href="#javac">Javac</a></li> | <li><a href="#javac">Javac</a></li> | ||||
| @@ -116,6 +116,9 @@ public class Main { | |||||
| if (arg.equals("-help") || arg.equals("help")) { | if (arg.equals("-help") || arg.equals("help")) { | ||||
| printUsage(); | printUsage(); | ||||
| return; | return; | ||||
| } else if (arg.equals("-version")) { | |||||
| printVersion(); | |||||
| return; | |||||
| } else if (arg.equals("-quiet") || arg.equals("-q") || arg.equals("q")) { | } else if (arg.equals("-quiet") || arg.equals("-q") || arg.equals("q")) { | ||||
| msgOutputLevel = Project.MSG_WARN; | msgOutputLevel = Project.MSG_WARN; | ||||
| } else if (arg.equals("-verbose") || arg.equals("-v") || arg.equals("v")) { | } else if (arg.equals("-verbose") || arg.equals("-v") || arg.equals("v")) { | ||||
| @@ -328,6 +331,7 @@ public class Main { | |||||
| msg.append("ant [options] [target]" + lSep); | msg.append("ant [options] [target]" + lSep); | ||||
| msg.append("Options: " + lSep); | msg.append("Options: " + lSep); | ||||
| msg.append(" -help print this message" + 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(" -quiet be extra quiet" + lSep); | ||||
| msg.append(" -verbose be extra verbose" + lSep); | msg.append(" -verbose be extra verbose" + lSep); | ||||
| msg.append(" -logfile <file> use given file for log" + lSep); | msg.append(" -logfile <file> use given file for log" + lSep); | ||||
| @@ -336,4 +340,28 @@ public class Main { | |||||
| msg.append(" -D<property>=<value> use value for given property" + lSep); | msg.append(" -D<property>=<value> use value for given property" + lSep); | ||||
| System.out.println(msg.toString()); | 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."); | |||||
| } | |||||
| } | |||||
| } | } | ||||
| @@ -0,0 +1,2 @@ | |||||
| VERSION=@VERSION@ | |||||
| DATE=@DATE@ | |||||