From: Dean H. <dea...@us...> - 2004-07-15 13:04:03
|
Update of /cvsroot/ant-contrib/ant-contrib/src/net/sf/antcontrib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28717/src/net/sf/antcontrib Added Files: AntContribVersion.java Log Message: build changes to put version info in manifest and to pull version info from manifest when java -jar ant-contrib is run. --- NEW FILE: AntContribVersion.java --- /* * Created on Jul 15, 2004 * * To change the template for this generated file go to * Window - Preferences - Java - Code Generation - Code and Comments */ package net.sf.antcontrib; /** * @author Dean Hiller * * To change the template for this generated type comment go to * Window - Preferences - Java - Code Generation - Code and Comments */ public class AntContribVersion { private Package thePackage; /** * The main program for MockVersion that prints the version info from * the manifest file. * * @param args Ignores all arguments. */ public static void main(String[] args) { AntContribVersion version = new AntContribVersion(AntContribVersion.class); System.out.println(""+version); } /** * Constructor that takes a class to get the version information * from out of the manifest. Uses the class's package to retrieve * the manifest version info. * @param c The Class on whose package to use to get version info. */ public AntContribVersion(Class c) { String name = c.getName(); int index = name.lastIndexOf("."); if(index < 0) throw new RuntimeException("This class is the default package and can't be to use this feature"); String packageName = name.substring(0, index); thePackage = Package.getPackage(packageName); } /** * Prints the version info the MockVersion represents. * * @see java.lang.Object#toString() */ public String toString() { String version = "\nVersion of Ant Contrib..."; version += "\ntitle="+thePackage.getImplementationTitle(); version += "\nwebsite="+thePackage.getImplementationVendor(); version += "\nversion="+thePackage.getImplementationVersion()+"\n"; return version; } } |