incubator-depot-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nickcha...@apache.org
Subject svn commit: rev 30978 - in incubator/depot/trunk/version/src: java/org/apache/depot/version/ant/stamp java/org/apache/depot/version/generation templates
Date Fri, 30 Jul 2004 08:58:10 GMT
Author: nickchalko
Date: Fri Jul 30 01:58:10 2004
New Revision: 30978

Modified:
   incubator/depot/trunk/version/src/java/org/apache/depot/version/ant/stamp/VersionGeneratorTask.java
   incubator/depot/trunk/version/src/java/org/apache/depot/version/generation/VersionSourceGenerator.java
   incubator/depot/trunk/version/src/templates/Version.java.jet
   incubator/depot/trunk/version/src/templates/version.skeleton
Log:
Added className parameter

Modified: incubator/depot/trunk/version/src/java/org/apache/depot/version/ant/stamp/VersionGeneratorTask.java
==============================================================================
--- incubator/depot/trunk/version/src/java/org/apache/depot/version/ant/stamp/VersionGeneratorTask.java
(original)
+++ incubator/depot/trunk/version/src/java/org/apache/depot/version/ant/stamp/VersionGeneratorTask.java
Fri Jul 30 01:58:10 2004
@@ -64,9 +64,10 @@
 			String packageName = versionMarker.getId() + ".version";
 
 			VersionSourceGenerator vsg = new VersionSourceGenerator();
-			String source = vsg.generate(packageName, versionMarker);
+			String className="Version";
+			String source = vsg.generate(packageName,className="Version", versionMarker);
 
-			out = getFileWriter(packageName);
+			out = getFileWriter(packageName,className);
 			out.write(source);
 
 		} catch (BuildException e) {
@@ -89,14 +90,15 @@
 	 * @return @throws
 	 *         IOException
 	 */
-	private FileWriter getFileWriter(String packageName) throws IOException {
+	private FileWriter getFileWriter(String packageName, String className) throws IOException
{
 		File fullPath = new File(getDest() ,packageName.replace('.', '/'));
 		if (!fullPath.exists()) {
 			if (!fullPath.mkdirs()) {
 				throw new BuildException("Unable to create dir " + fullPath);
 			}
 		}
-		File file = new File(fullPath, "Version.java");
+		
+		File file = new File(fullPath, className+".java");
 		FileWriter fw = new FileWriter(file);
 
 		return fw;

Modified: incubator/depot/trunk/version/src/java/org/apache/depot/version/generation/VersionSourceGenerator.java
==============================================================================
--- incubator/depot/trunk/version/src/java/org/apache/depot/version/generation/VersionSourceGenerator.java
(original)
+++ incubator/depot/trunk/version/src/java/org/apache/depot/version/generation/VersionSourceGenerator.java
Fri Jul 30 01:58:10 2004
@@ -22,28 +22,32 @@
 {
                      
   protected final String NL = System.getProperties().getProperty("line.separator");
-  protected final String TEXT_1 = "/*" + NL + " * DO NOT CHECK IN." + NL + " *.This is a
autogenerated file.  " + NL + " */" + NL + "package ";
+  protected final String TEXT_1 = "/*" + NL + " * DO NOT CHECK IN." + NL + " * This is a
autogenerated file.  " + NL + " */" + NL + "package ";
   protected final String TEXT_2 = "; " + NL + "" + NL + "import java.util.Date;" + NL + ""
+ NL + "/**" + NL + " * ";
   protected final String TEXT_3 = " version ";
   protected final String TEXT_4 = " ." + NL + " * Generated at ";
   protected final String TEXT_5 = " " + NL + " * at  HOST" + NL + " * by USER " + NL + "
* @author <a href=\"http://incubator.apache.org/depot\">Depot Version</a> " +
NL + " *         from the <a href=\"http://incubator.apache.org/\">Apache Incubator</a>,
" + NL + "           version ";
   protected final String TEXT_6 = NL + " * @version ";
-  protected final String TEXT_7 = NL + " */" + NL + "public class Version {" + NL + "\tpublic
final static Version INSTANCE = new Version();" + NL + "\t" + NL + "\tprivate Version()  {}"
+ NL + "\t" + NL + "\t/**" + NL + "\t * The user that built ";
-  protected final String TEXT_8 = " was ";
-  protected final String TEXT_9 = "." + NL + "\t * @return the String \"";
-  protected final String TEXT_10 = "\"" + NL + "\t */" + NL + "\tpublic String getUser()
{return \"";
-  protected final String TEXT_11 = "\"; }" + NL + "\t" + NL + "\t\t" + NL + "\t/**" + NL
+ "\t * ";
-  protected final String TEXT_12 = " was built on ";
+  protected final String TEXT_7 = NL + " */" + NL + "public class ";
+  protected final String TEXT_8 = " {" + NL + "\tpublic final static  ";
+  protected final String TEXT_9 = " INSTANCE = new  ";
+  protected final String TEXT_10 = "();" + NL + "\t" + NL + "\tprivate  ";
+  protected final String TEXT_11 = "()  {}" + NL + "\t" + NL + "\t/**" + NL + "\t * The user
that built ";
+  protected final String TEXT_12 = " was ";
   protected final String TEXT_13 = "." + NL + "\t * @return the String \"";
-  protected final String TEXT_14 = "\"" + NL + "\t */" + NL + "\tpublic String getHost()
{return \"";
+  protected final String TEXT_14 = "\"" + NL + "\t */" + NL + "\tpublic String getUser()
{return \"";
   protected final String TEXT_15 = "\"; }" + NL + "\t" + NL + "\t\t" + NL + "\t/**" + NL
+ "\t * ";
-  protected final String TEXT_16 = " was built at ";
-  protected final String TEXT_17 = "." + NL + "\t * @return the Date \"";
-  protected final String TEXT_18 = "\"" + NL + "\t */" + NL + "\tpublic Date getDate() {return
";
-  protected final String TEXT_19 = "; }" + NL + "\t" + NL + "\t" + NL + "\tpublic String
toString() {return \"";
-  protected final String TEXT_20 = "\";}" + NL + "}    ";
+  protected final String TEXT_16 = " was built on ";
+  protected final String TEXT_17 = "." + NL + "\t * @return the String \"";
+  protected final String TEXT_18 = "\"" + NL + "\t */" + NL + "\tpublic String getHost()
{return \"";
+  protected final String TEXT_19 = "\"; }" + NL + "\t" + NL + "\t\t" + NL + "\t/**" + NL
+ "\t * ";
+  protected final String TEXT_20 = " was built at ";
+  protected final String TEXT_21 = "." + NL + "\t * @return the Date \"";
+  protected final String TEXT_22 = "\"" + NL + "\t */" + NL + "\tpublic Date getDate() {return
";
+  protected final String TEXT_23 = "; }" + NL + "\t" + NL + "\t" + NL + "\tpublic String
toString() {return \"";
+  protected final String TEXT_24 = "\";}" + NL + "}    ";
 
-    public String generate(String packageName,   VersionMarker marker)
+    public String generate(String packageName,  String className, VersionMarker marker)
   {
     StringBuffer stringBuffer = new StringBuffer();
     stringBuffer.append(TEXT_1);
@@ -59,32 +63,40 @@
     stringBuffer.append(TEXT_6);
     stringBuffer.append(marker.getLongVersion());
     stringBuffer.append(TEXT_7);
-    stringBuffer.append(marker.getId());
+    stringBuffer.append(className);
     stringBuffer.append(TEXT_8);
-    stringBuffer.append(getUser());
+    stringBuffer.append(className);
     stringBuffer.append(TEXT_9);
-    stringBuffer.append(getUser());
+    stringBuffer.append(className);
     stringBuffer.append(TEXT_10);
-    stringBuffer.append(getUser());
+    stringBuffer.append(className);
     stringBuffer.append(TEXT_11);
     stringBuffer.append(marker.getId());
     stringBuffer.append(TEXT_12);
-    stringBuffer.append(getHost());
+    stringBuffer.append(getUser());
     stringBuffer.append(TEXT_13);
-    stringBuffer.append(getHost());
+    stringBuffer.append(getUser());
     stringBuffer.append(TEXT_14);
-    stringBuffer.append(getHost());
+    stringBuffer.append(getUser());
     stringBuffer.append(TEXT_15);
     stringBuffer.append(marker.getId());
     stringBuffer.append(TEXT_16);
-    stringBuffer.append(getDate());
+    stringBuffer.append(getHost());
     stringBuffer.append(TEXT_17);
-    stringBuffer.append(getDate());
+    stringBuffer.append(getHost());
     stringBuffer.append(TEXT_18);
-    stringBuffer.append(getDate());
+    stringBuffer.append(getHost());
     stringBuffer.append(TEXT_19);
-    stringBuffer.append(marker.getLongVersion());
+    stringBuffer.append(marker.getId());
     stringBuffer.append(TEXT_20);
+    stringBuffer.append(getDate());
+    stringBuffer.append(TEXT_21);
+    stringBuffer.append(getDate());
+    stringBuffer.append(TEXT_22);
+    stringBuffer.append(getDate());
+    stringBuffer.append(TEXT_23);
+    stringBuffer.append(marker.getLongVersion());
+    stringBuffer.append(TEXT_24);
     return stringBuffer.toString();
   }
 }

Modified: incubator/depot/trunk/version/src/templates/Version.java.jet
==============================================================================
--- incubator/depot/trunk/version/src/templates/Version.java.jet	(original)
+++ incubator/depot/trunk/version/src/templates/Version.java.jet	Fri Jul 30 01:58:10 2004
@@ -22,10 +22,10 @@
            version <%=depotVersion.getLongVersion() %>
  * @version <%=marker.getLongVersion()%>
  */
-public class Version {
-	public final static Version INSTANCE = new Version();
+public class <%=className%> {
+	public final static  <%=className%> INSTANCE = new  <%=className%>();
 	
-	private Version()  {}
+	private  <%=className%>()  {}
 	
 	/**
 	 * The user that built <%=marker.getId()%> was <%=getUser()%>.

Modified: incubator/depot/trunk/version/src/templates/version.skeleton
==============================================================================
--- incubator/depot/trunk/version/src/templates/version.skeleton	(original)
+++ incubator/depot/trunk/version/src/templates/version.skeleton	Fri Jul 30 01:58:10 2004
@@ -17,7 +17,7 @@
 public final class CLASS extends org.apache.depot.version.generation.Skeleton
 {
                      
-    public String generate(String packageName,   VersionMarker marker)
+    public String generate(String packageName,  String className, VersionMarker marker)
     {
         return "";
     }   

Mime
View raw message