From ff3015527b89a29df0918b7f9ff76f4c983ca7d2 Mon Sep 17 00:00:00 2001
From: James Moger <james.moger@gitblit.com>
Date: Mon, 12 Sep 2011 15:51:39 -0400
Subject: [PATCH] Adjustments to build script for missing build.properties (issue 18)

---
 src/com/gitblit/build/Build.java |   58 +++++++++++++++++++++++++++++++++++++++++++++++++---------
 1 files changed, 49 insertions(+), 9 deletions(-)

diff --git a/src/com/gitblit/build/Build.java b/src/com/gitblit/build/Build.java
index 641b7aa..2d1db6d 100644
--- a/src/com/gitblit/build/Build.java
+++ b/src/com/gitblit/build/Build.java
@@ -35,8 +35,25 @@
 import com.gitblit.Constants;
 import com.gitblit.utils.StringUtils;
 
+/**
+ * The Build class downloads runtime and compile-time jar files from the Apache
+ * or Eclipse Maven repositories.
+ * 
+ * It also generates the Keys class from the gitblit.properties file.
+ * 
+ * Its important that this class have minimal compile dependencies since its
+ * called very early in the build script.
+ * 
+ * @author James Moger
+ * 
+ */
 public class Build {
 
+	/**
+	 * BuildType enumeration representing compile-time or runtime. This is used
+	 * to download dependencies either for Gitblit GO runtime or for setting up
+	 * a development environment.
+	 */
 	public static enum BuildType {
 		RUNTIME, COMPILETIME;
 	}
@@ -64,6 +81,8 @@
 		downloadFromApache(MavenObject.JSCH, BuildType.RUNTIME);
 		downloadFromApache(MavenObject.ROME, BuildType.RUNTIME);
 		downloadFromApache(MavenObject.JDOM, BuildType.RUNTIME);
+		downloadFromApache(MavenObject.GSON, BuildType.RUNTIME);
+		downloadFromApache(MavenObject.MAIL, BuildType.RUNTIME);
 
 		downloadFromEclipse(MavenObject.JGIT, BuildType.RUNTIME);
 		downloadFromEclipse(MavenObject.JGIT_HTTP, BuildType.RUNTIME);
@@ -87,6 +106,8 @@
 		downloadFromApache(MavenObject.JSCH, BuildType.COMPILETIME);
 		downloadFromApache(MavenObject.ROME, BuildType.COMPILETIME);
 		downloadFromApache(MavenObject.JDOM, BuildType.COMPILETIME);
+		downloadFromApache(MavenObject.GSON, BuildType.COMPILETIME);
+		downloadFromApache(MavenObject.MAIL, BuildType.COMPILETIME);
 
 		downloadFromEclipse(MavenObject.JGIT, BuildType.COMPILETIME);
 		downloadFromEclipse(MavenObject.JGIT_HTTP, BuildType.COMPILETIME);
@@ -95,6 +116,10 @@
 		downloadFromApache(MavenObject.COMMONSNET, BuildType.RUNTIME);
 	}
 
+	/**
+	 * Builds the Keys class based on the gitblit.properties file and inserts
+	 * the class source into the project source folder.
+	 */
 	public static void buildSettingKeys() {
 		// Load all keys
 		Properties properties = new Properties();
@@ -297,13 +322,18 @@
 		String anim = "==========";
 		int width = Math.round(anim.length() * progress);
 		System.out.print("\r[");
-		System.out.print(anim.substring(0, width));
+		System.out.print(anim.substring(0, Math.min(width, anim.length())));
 		for (int i = 0; i < anim.length() - width; i++) {
 			System.out.print(' ');
 		}
 		System.out.print("] " + url);
 	}
 
+	/**
+	 * MavenObject represents a complete maven artifact (binary, sources, and
+	 * javadoc). MavenObjects can be downloaded and checksummed to confirm
+	 * authenticity.
+	 */
 	private static class MavenObject {
 
 		public static final MavenObject JCOMMANDER = new MavenObject("jCommander", "com/beust",
@@ -313,10 +343,10 @@
 				"c7adc475ca40c288c93054e0f4fe58f3a98c0cb5");
 
 		public static final MavenObject JETTY = new MavenObject("Jetty",
-				"org/eclipse/jetty/aggregate", "jetty-webapp", "7.4.2.v20110526", 1000000, 680000,
-				2720000, "56331143afa22d24d9faba96e86e6371b0686c7c",
-				"9f38230fd589e29c8be0fc3c80fb51c5093c2e1e",
-				"0d48212889c25252c5c14bef62703e28215d80cc");
+				"org/eclipse/jetty/aggregate", "jetty-webapp", "7.4.3.v20110701", 1000000, 680000,
+				2720000, "bde072b178f9650e2308f0babe58a4baaa469e3c",
+				"bc75f05dd4f7fa848720ac669b8b438ee4a6b146",
+				"dcd42f672e734521d1a6ccc0c2f9ecded1a1a281");
 
 		public static final MavenObject SERVLET = new MavenObject("Servlet 2.5", "javax/servlet",
 				"servlet-api", "2.5", 105000, 158000, 0,
@@ -368,10 +398,10 @@
 				237000, 0, 0, "c94f54227b08100974c36170dcb53329435fe5ad", "", "");
 
 		public static final MavenObject MARKDOWNPAPERS = new MavenObject("MarkdownPapers",
-				"org/tautua/markdownpapers", "markdownpapers-core", "1.0.0", 87000, 58000, 278000,
-				"feda63bd149f3315da210e397d45d02277038ad5",
-				"a9a6c4d163af81e265a15138fcaeafa9829c6054",
-				"f932656266a7f9593488d3f89e815d0af44d0853");
+				"org/tautua/markdownpapers", "markdownpapers-core", "1.1.1", 87000, 58000, 278000,
+				"07046e6d8f33866398dfc3955698925df9ff7719",
+				"178b49c34dbab6301ce848b67e7957bcf9b94d6a",
+				"160d370f6cb119a1b46a00f37cc28d23fd27daed");
 
 		public static final MavenObject BOUNCYCASTLE = new MavenObject("BouncyCastle",
 				"org/bouncycastle", "bcprov-jdk16", "1.46", 1900000, 1400000, 4670000,
@@ -416,6 +446,16 @@
 				"a7ed425c4c46605b8f2bf2ee118c1609682f4f2c",
 				"f3df91edccba2f07a0fced70887c2f7b7836cb75");
 
+		public static final MavenObject GSON = new MavenObject("gson", "com/google/code/gson",
+				"gson", "1.7.1", 174000, 142000, 247000,
+				"0697e3a1fa094a983cd12f7f6f61abf9c6ea52e2",
+				"51f6f78aec2d30d0c2bfb4a5f00d456a6f7a5e7e",
+				"f0872fe17d484815328538b89909d5e46d85db74");
+
+		public static final MavenObject MAIL = new MavenObject("javax.mail", "javax/mail", "mail",
+				"1.4.3", 462000, 642000, 0, "8154bf8d666e6db154c548dc31a8d512c273f5ee",
+				"5875e2729de83a4e46391f8f979ec8bd03810c10", null);
+
 		public final String name;
 		public final String group;
 		public final String artifact;

--
Gitblit v1.9.1