Ship the build log and trace on the build servers

Test: m -j; m -j dist
Change-Id: I4718e7a0cda6719bbab4243038ea2666c212cf19
diff --git a/ui/build/config.go b/ui/build/config.go
index 35c5213..4853643 100644
--- a/ui/build/config.go
+++ b/ui/build/config.go
@@ -35,6 +35,7 @@
 	parallel  int
 	keepGoing int
 	verbose   bool
+	dist      bool
 
 	// From the product config
 	katiArgs   []string
@@ -90,6 +91,8 @@
 		} else if arg == "showcommands" {
 			ret.verbose = true
 			continue
+		} else if arg == "dist" {
+			ret.dist = true
 		}
 		if arg[0] == '-' {
 			var err error
@@ -183,6 +186,13 @@
 	return "out"
 }
 
+func (c *configImpl) DistDir() string {
+	if distDir, ok := c.environ.Get("DIST_DIR"); ok {
+		return distDir
+	}
+	return filepath.Join(c.OutDir(), "dist")
+}
+
 func (c *configImpl) NinjaArgs() []string {
 	return c.ninjaArgs
 }
@@ -198,6 +208,10 @@
 	panic("SetKatiSuffix has not been called")
 }
 
+func (c *configImpl) Dist() bool {
+	return c.dist
+}
+
 func (c *configImpl) IsVerbose() bool {
 	return c.verbose
 }