Added -XdisableSoycHtml command line flag for disabling HTML compile report generation. This will not affect SOYC XML output.

Review at http://gwt-code-reviews.appspot.com/1450807

Review by: zundel@google.com

git-svn-id: https://google-web-toolkit.googlecode.com/svn/trunk@10246 8db76d5a-ed1c-0410-87a9-c151d255dfc7
diff --git a/dev/core/src/com/google/gwt/dev/PrecompileTaskArgProcessor.java b/dev/core/src/com/google/gwt/dev/PrecompileTaskArgProcessor.java
index 6482bba..04be766 100644
--- a/dev/core/src/com/google/gwt/dev/PrecompileTaskArgProcessor.java
+++ b/dev/core/src/com/google/gwt/dev/PrecompileTaskArgProcessor.java
@@ -23,6 +23,7 @@
 import com.google.gwt.dev.util.arg.ArgHandlerDisableClassMetadata;
 import com.google.gwt.dev.util.arg.ArgHandlerDisableGeneratingOnShards;
 import com.google.gwt.dev.util.arg.ArgHandlerDisableRunAsync;
+import com.google.gwt.dev.util.arg.ArgHandlerDisableSoycHtml;
 import com.google.gwt.dev.util.arg.ArgHandlerDisableUpdateCheck;
 import com.google.gwt.dev.util.arg.ArgHandlerDraftCompile;
 import com.google.gwt.dev.util.arg.ArgHandlerDumpSignatures;
@@ -58,6 +59,7 @@
     registerHandler(new ArgHandlerSoycDetailed(options));
     registerHandler(new ArgHandlerStrict(options));
     registerHandler(new ArgHandlerCompilerMetrics(options));
+    registerHandler(new ArgHandlerDisableSoycHtml(options));
   }
 
   @Override
diff --git a/dev/core/src/com/google/gwt/dev/PrecompileTaskOptionsImpl.java b/dev/core/src/com/google/gwt/dev/PrecompileTaskOptionsImpl.java
index 8061393..cf99d31 100644
--- a/dev/core/src/com/google/gwt/dev/PrecompileTaskOptionsImpl.java
+++ b/dev/core/src/com/google/gwt/dev/PrecompileTaskOptionsImpl.java
@@ -128,6 +128,11 @@
   }
 
   @Override
+  public boolean isSoycHtmlDisabled() {
+    return jjsOptions.isSoycHtmlDisabled();
+  }
+
+  @Override
   public boolean isStrict() {
     return jjsOptions.isStrict();
   }
@@ -223,6 +228,11 @@
   }
 
   @Override
+  public void setSoycHtmlDisabled(boolean disabled) {
+    jjsOptions.setSoycHtmlDisabled(disabled);
+  }
+
+  @Override
   public void setStrict(boolean strict) {
     jjsOptions.setStrict(strict);
   }
diff --git a/dev/core/src/com/google/gwt/dev/jjs/JJSOptions.java b/dev/core/src/com/google/gwt/dev/jjs/JJSOptions.java
index 74182e8..886a312 100644
--- a/dev/core/src/com/google/gwt/dev/jjs/JJSOptions.java
+++ b/dev/core/src/com/google/gwt/dev/jjs/JJSOptions.java
@@ -26,6 +26,7 @@
 import com.google.gwt.dev.util.arg.OptionScriptStyle;
 import com.google.gwt.dev.util.arg.OptionSoycDetailed;
 import com.google.gwt.dev.util.arg.OptionSoycEnabled;
+import com.google.gwt.dev.util.arg.OptionSoycHtmlDisabled;
 import com.google.gwt.dev.util.arg.OptionStrict;
 
 /**
@@ -34,5 +35,7 @@
 public interface JJSOptions extends OptionOptimize, OptionAggressivelyOptimize,
     OptionDisableClassMetadata, OptionDisableCastChecking, OptionEnableAssertions,
     OptionEnableGeneratorResultCaching, OptionRunAsyncEnabled, OptionScriptStyle,
-    OptionSoycEnabled, OptionSoycDetailed, OptionOptimizePrecompile, OptionStrict {
+    OptionSoycEnabled, OptionSoycDetailed, OptionOptimizePrecompile, OptionStrict,
+    OptionSoycHtmlDisabled {
+
 }
diff --git a/dev/core/src/com/google/gwt/dev/jjs/JJSOptionsImpl.java b/dev/core/src/com/google/gwt/dev/jjs/JJSOptionsImpl.java
index b34cd1c..417f6fa 100644
--- a/dev/core/src/com/google/gwt/dev/jjs/JJSOptionsImpl.java
+++ b/dev/core/src/com/google/gwt/dev/jjs/JJSOptionsImpl.java
@@ -36,6 +36,7 @@
   private boolean runAsyncEnabled = true;
   private boolean soycEnabled = false;
   private boolean soycExtra = false;
+  private boolean soycHtmlDisabled = false;
   private boolean strict = false;
 
   public JJSOptionsImpl() {
@@ -57,6 +58,7 @@
     setRunAsyncEnabled(other.isRunAsyncEnabled());
     setSoycEnabled(other.isSoycEnabled());
     setSoycExtra(other.isSoycExtra());
+    setSoycHtmlDisabled(other.isSoycHtmlDisabled());
     setStrict(other.isStrict());
   }
 
@@ -111,6 +113,10 @@
   public boolean isSoycExtra() {
     return soycExtra;
   }
+  
+  public boolean isSoycHtmlDisabled() {
+    return soycHtmlDisabled;
+  }
 
   public boolean isStrict() {
     return strict;
@@ -163,6 +169,10 @@
   public void setSoycExtra(boolean enabled) {
     soycExtra = enabled;
   }
+  
+  public void setSoycHtmlDisabled(boolean disabled) {
+    soycHtmlDisabled = disabled;
+  }
 
   public void setStrict(boolean strict) {
     this.strict = strict;
diff --git a/dev/core/src/com/google/gwt/dev/jjs/JavaToJavaScriptCompiler.java b/dev/core/src/com/google/gwt/dev/jjs/JavaToJavaScriptCompiler.java
index 97faeb8..3f64b4e 100644
--- a/dev/core/src/com/google/gwt/dev/jjs/JavaToJavaScriptCompiler.java
+++ b/dev/core/src/com/google/gwt/dev/jjs/JavaToJavaScriptCompiler.java
@@ -451,7 +451,8 @@
       }
       toReturn.addArtifacts(makeSoycArtifacts(logger, permutationId, jprogram, js, sizeBreakdowns,
           sourceInfoMaps, dependencies, jjsmap, obfuscateMap, unifiedAst.getModuleMetrics(),
-          unifiedAst.getPrecompilationMetrics(), compilationMetrics));
+          unifiedAst.getPrecompilationMetrics(), compilationMetrics, 
+          options.isSoycHtmlDisabled()));
 
       logTrackingStats(logger);
       if (logger.isLoggable(TreeLogger.TRACE)) {
@@ -1163,7 +1164,8 @@
       JavaToJavaScriptMap jjsmap, Map<JsName, String> obfuscateMap,
       ModuleMetricsArtifact moduleMetricsArtifact,
       PrecompilationMetricsArtifact precompilationMetricsArtifact,
-      CompilationMetricsArtifact compilationMetrics) throws IOException, UnableToCompleteException {
+      CompilationMetricsArtifact compilationMetrics, boolean htmlReportsDisabled) 
+      throws IOException, UnableToCompleteException {
     Memory.maybeDumpMemory("makeSoycArtifactsStart");
     List<SyntheticArtifact> soycArtifacts = new ArrayList<SyntheticArtifact>();
 
@@ -1213,7 +1215,7 @@
       soycArtifact.setVisibility(Visibility.Private);
     }
 
-    if (sizeBreakdowns != null) {
+    if (!htmlReportsDisabled && sizeBreakdowns != null) {
       Event generateCompileReport =
           SpeedTracerLogger.start(CompilerEventType.MAKE_SOYC_ARTIFACTS, "phase",
               "generateCompileReport");
@@ -1245,7 +1247,7 @@
       soycArtifacts.addAll(outDir.getArtifacts());
       generateCompileReport.end();
     }
-
+    
     soycEvent.end();
 
     return soycArtifacts;
diff --git a/dev/core/src/com/google/gwt/dev/util/arg/ArgHandlerDisableSoycHtml.java b/dev/core/src/com/google/gwt/dev/util/arg/ArgHandlerDisableSoycHtml.java
new file mode 100644
index 0000000..911a5b8
--- /dev/null
+++ b/dev/core/src/com/google/gwt/dev/util/arg/ArgHandlerDisableSoycHtml.java
@@ -0,0 +1,53 @@
+/*
+ * Copyright 2009 Google Inc.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package com.google.gwt.dev.util.arg;
+
+import com.google.gwt.util.tools.ArgHandlerFlag;
+
+/**
+ * An ArgHandler that enables detailed Story Of Your Compile data collection,
+ * but disables HTML report generation, leaving only XML output.
+ *
+ */
+public class ArgHandlerDisableSoycHtml extends ArgHandlerFlag {
+  private final OptionSoycHtmlDisabled options;
+
+  public ArgHandlerDisableSoycHtml(OptionSoycHtmlDisabled options) {
+    this.options = options;
+  }
+
+  @Override
+  public String getPurpose() {
+    return "Enable SOYC reporting without HTML report generation.";
+  }
+
+  @Override
+  public String getTag() {
+    return "-XdisableSoycHtml";
+  }
+
+  @Override
+  public boolean isUndocumented() {
+    return true;
+  }
+
+  @Override
+  public boolean setFlag() {
+    options.setSoycHtmlDisabled(true);
+    options.setSoycEnabled(true);
+    return true;
+  }
+}
diff --git a/dev/core/src/com/google/gwt/dev/util/arg/OptionSoycHtmlDisabled.java b/dev/core/src/com/google/gwt/dev/util/arg/OptionSoycHtmlDisabled.java
new file mode 100644
index 0000000..e7e6343
--- /dev/null
+++ b/dev/core/src/com/google/gwt/dev/util/arg/OptionSoycHtmlDisabled.java
@@ -0,0 +1,42 @@
+/*
+ * Copyright 2009 Google Inc.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package com.google.gwt.dev.util.arg;
+
+/**
+ * Option for disabling SOYC HTML report generation
+ */
+public interface OptionSoycHtmlDisabled extends OptionCompilerMetricsEnabled {
+
+  
+  /**
+   * Returns false if the compiler should produce HTML SOYC compile reports in
+   * addition to XML reports.
+   */
+  boolean isSoycHtmlDisabled();
+
+  /**
+   * Sets whether or not the compiler should record and emit Compile Report
+   * information and build the dashboard.
+   */
+  void setSoycEnabled(boolean enabled);
+
+  /**
+   * Sets whether or not the compiler should produce HTML compile reports in
+   * addition to SOYC XML output.
+   */
+  void setSoycHtmlDisabled(boolean disabled);
+
+}