This patch has the compiler run the SOYC dashboard if -soyc is specified.  The
output goes into a directory named "compile-report" along with the rest of the
compiled app.

The dashboard can still be run via the SoycDashboard main class, but
that usage is now deprecated.

Review by: kprobst


git-svn-id: https://google-web-toolkit.googlecode.com/svn/trunk@6264 8db76d5a-ed1c-0410-87a9-c151d255dfc7
diff --git a/dev/common.ant.xml b/dev/common.ant.xml
index 10d9500..a7363aa 100755
--- a/dev/common.ant.xml
+++ b/dev/common.ant.xml
@@ -4,7 +4,6 @@
 
   <property.ensure name="gwt.core.root" location="../core" />
   <property.ensure name="gwt.core.build" location="${project.build}/../core" />
-  <property.ensure name="gwt.tools.soyc" location="${gwt.root}/tools/soyc-vis" />
 
   <target name="compile" description="Compile all java files">
     <mkdir dir="${javac.out}" />
@@ -31,9 +30,6 @@
         <fileset dir="${gwt.core.build}/bin" />
         <fileset file="${gwt.tools.lib}/eclipse/${gwt.dev.swt.jar}" />
         <fileset file="${gwt.core.build}/alldeps.jar" />
-        <fileset dir="${gwt.tools.soyc}/images"/>
-        <fileset file="${gwt.tools.soyc}/classLevel.css"/>
-        <fileset file="${gwt.tools.soyc}/roundedCorners.css"/>
       </sourcefiles>
       <targetfiles>
         <fileset file="${project.lib}"/>
@@ -51,10 +47,6 @@
           <zipfileset src="${gwt.tools.lib}/eclipse/${gwt.dev.swt.jar}" />
           <zipfileset src="${gwt.core.build}/alldeps.jar" />
 
-          <zipfileset dir="${gwt.tools.soyc}/images" prefix="com/google/gwt/soyc/resources/images"/>
-          <zipfileset file="${gwt.tools.soyc}/classLevel.css" prefix="com/google/gwt/soyc/resources/"/>
-          <zipfileset file="${gwt.tools.soyc}/roundedCorners.css" prefix="com/google/gwt/soyc/resources/"/>
-
           <manifest>
             <attribute name="Main-Class" value="com.google.gwt.dev.GWTMain" />
           </manifest>
diff --git a/dev/core/src/com/google/gwt/core/ext/linker/CompilationAnalysis.java b/dev/core/src/com/google/gwt/core/ext/linker/CompilationAnalysis.java
index 615f333..982499a 100644
--- a/dev/core/src/com/google/gwt/core/ext/linker/CompilationAnalysis.java
+++ b/dev/core/src/com/google/gwt/core/ext/linker/CompilationAnalysis.java
@@ -16,6 +16,7 @@
 package com.google.gwt.core.ext.linker;
 
 import com.google.gwt.core.ext.Linker;
+import com.google.gwt.core.ext.linker.impl.StandardCompilationAnalysis.SoycArtifact;
 
 import java.util.ArrayList;
 import java.util.LinkedList;
@@ -41,6 +42,12 @@
   public abstract EmittedArtifact getDetailedStoriesFile();
 
   /**
+   * Files containing the HTML dashboard.
+   */
+
+  public abstract List<SoycArtifact> getReportFiles();
+
+  /**
    * @return a file of size maps
    */
   public abstract EmittedArtifact getSizeMapsFile();
@@ -69,9 +76,12 @@
         allFiles());
     LinkedList<EmittedArtifact> otherFiles = new LinkedList<EmittedArtifact>(
         o.allFiles());
-    assert (myFiles.size() == otherFiles.size());
 
     while (!myFiles.isEmpty()) {
+      if (otherFiles.isEmpty()) {
+        return 1;
+      }
+
       EmittedArtifact myFile = myFiles.removeFirst();
       EmittedArtifact otherFile = otherFiles.removeFirst();
       if (myFile == null && otherFile == null) {
@@ -93,6 +103,10 @@
       }
     }
 
+    if (!otherFiles.isEmpty()) {
+      return -1;
+    }
+
     return 0;
   }
 
@@ -107,6 +121,7 @@
     files.add(getDepFile());
     files.add(getSizeMapsFile());
     files.add(getDetailedStoriesFile());
+    files.addAll(getReportFiles());
     return files;
   }
 }
diff --git a/dev/core/src/com/google/gwt/core/ext/linker/impl/StandardCompilationAnalysis.java b/dev/core/src/com/google/gwt/core/ext/linker/impl/StandardCompilationAnalysis.java
index b9a8969..327c5ba 100644
--- a/dev/core/src/com/google/gwt/core/ext/linker/impl/StandardCompilationAnalysis.java
+++ b/dev/core/src/com/google/gwt/core/ext/linker/impl/StandardCompilationAnalysis.java
@@ -19,6 +19,8 @@
 import com.google.gwt.core.ext.linker.SyntheticArtifact;
 import com.google.gwt.core.linker.SoycReportLinker;
 
+import java.util.List;
+
 /**
  * An implementation of CompilationAnalysis. This class transforms SourceInfos
  * and related data into an API suitable for public consumption via the Linker
@@ -48,9 +50,9 @@
   private SoycArtifact detailedStoriesFile;
 
   /**
-   * File containing split points.
+   * Files containing the HTML dashboard.
    */
-  private SoycArtifact splitPointsFile;
+  private List<SoycArtifact> reportFiles;
 
   /**
    * File containing size maps.
@@ -58,16 +60,22 @@
   private SoycArtifact sizeMapsFile;
 
   /**
+   * File containing split points.
+   */
+  private SoycArtifact splitPointsFile;
+
+  /**
    * Constructed by PermutationCompiler.
    */
   public StandardCompilationAnalysis(SoycArtifact dependencies,
       SoycArtifact sizeMaps, SoycArtifact splitPoints,
-      SoycArtifact detailedStories) {
+      SoycArtifact detailedStories, List<SoycArtifact> reportFiles) {
     super(StandardLinkerContext.class);
     this.depFile = dependencies;
     this.sizeMapsFile = sizeMaps;
     this.splitPointsFile = splitPoints;
     this.detailedStoriesFile = detailedStories;
+    this.reportFiles = reportFiles;
   }
 
   @Override
@@ -81,6 +89,11 @@
   }
 
   @Override
+  public List<SoycArtifact> getReportFiles() {
+    return reportFiles;
+  }
+
+  @Override
   public SoycArtifact getSizeMapsFile() {
     return sizeMapsFile;
   }
diff --git a/dev/core/src/com/google/gwt/core/ext/soyc/impl/DependencyRecorder.java b/dev/core/src/com/google/gwt/core/ext/soyc/impl/DependencyRecorder.java
index e58edce..a8f648e 100644
--- a/dev/core/src/com/google/gwt/core/ext/soyc/impl/DependencyRecorder.java
+++ b/dev/core/src/com/google/gwt/core/ext/soyc/impl/DependencyRecorder.java
@@ -108,7 +108,7 @@
   protected void recordDependenciesImpl(TreeLogger logger, JProgram jprogram) {
 
     logger = logger.branch(TreeLogger.INFO,
-        "Creating Dependencies file for SOYC");
+        "Creating dependencies file for the compile report");
 
     ControlFlowAnalyzer dependencyAnalyzer = new ControlFlowAnalyzer(jprogram);
     dependencyAnalyzer.setDependencyRecorder(this);
diff --git a/dev/core/src/com/google/gwt/core/ext/soyc/impl/SplitPointRecorder.java b/dev/core/src/com/google/gwt/core/ext/soyc/impl/SplitPointRecorder.java
index 597ad33..044de32 100644
--- a/dev/core/src/com/google/gwt/core/ext/soyc/impl/SplitPointRecorder.java
+++ b/dev/core/src/com/google/gwt/core/ext/soyc/impl/SplitPointRecorder.java
@@ -40,7 +40,7 @@
       TreeLogger logger) {
 
     logger = logger.branch(TreeLogger.TRACE,
-        "Creating Split Point Map file for SOYC");
+        "Creating split point map file for the compile report");
 
     try {
       OutputStreamWriter writer = new OutputStreamWriter(new GZIPOutputStream(
diff --git a/dev/core/src/com/google/gwt/core/ext/soyc/impl/StoryRecorder.java b/dev/core/src/com/google/gwt/core/ext/soyc/impl/StoryRecorder.java
index f1708d2..9ad7601 100644
--- a/dev/core/src/com/google/gwt/core/ext/soyc/impl/StoryRecorder.java
+++ b/dev/core/src/com/google/gwt/core/ext/soyc/impl/StoryRecorder.java
@@ -108,7 +108,7 @@
   protected void recordStoriesImpl(TreeLogger logger, OutputStream out,
       List<Map<Range, SourceInfo>> sourceInfoMaps, String[] js) {
 
-    logger = logger.branch(TreeLogger.INFO, "Creating Stories file for SOYC");
+    logger = logger.branch(TreeLogger.INFO, "Creating Stories file for the compile report");
 
     this.js = js;
 
diff --git a/dev/core/src/com/google/gwt/core/linker/SoycReportLinker.java b/dev/core/src/com/google/gwt/core/linker/SoycReportLinker.java
index bb32174..2f63ff1 100644
--- a/dev/core/src/com/google/gwt/core/linker/SoycReportLinker.java
+++ b/dev/core/src/com/google/gwt/core/linker/SoycReportLinker.java
@@ -20,9 +20,17 @@
 import com.google.gwt.core.ext.TreeLogger;

 import com.google.gwt.core.ext.UnableToCompleteException;

 import com.google.gwt.core.ext.linker.ArtifactSet;

+import com.google.gwt.core.ext.linker.CompilationResult;

 import com.google.gwt.core.ext.linker.LinkerOrder;

+import com.google.gwt.core.ext.linker.SelectionProperty;

 import com.google.gwt.core.ext.linker.LinkerOrder.Order;

 import com.google.gwt.core.ext.linker.impl.StandardCompilationAnalysis;

+import com.google.gwt.soyc.SoycDashboard;

+import com.google.gwt.soyc.io.ArtifactsOutputDirectory;

+

+import java.io.IOException;

+import java.util.Map;

+import java.util.TreeMap;

 

 /**

  * Converts SOYC report files into emitted private artifacts.

@@ -32,13 +40,15 @@
 

   @Override

   public String getDescription() {

-    return "Emit SOYC artifacts";

+    return "Emit compile report artifacts";

   }

 

   @Override

   public ArtifactSet link(TreeLogger logger, LinkerContext context,

       ArtifactSet artifacts) throws UnableToCompleteException {

     ArtifactSet results = new ArtifactSet(artifacts);

+    boolean foundReports = false;

+

     for (StandardCompilationAnalysis soycFiles : artifacts.find(StandardCompilationAnalysis.class)) {

       if (soycFiles.getDepFile() != null) {

         results.add(soycFiles.getDepFile());

@@ -50,8 +60,42 @@
         results.add(soycFiles.getDetailedStoriesFile());

       }

       results.add(soycFiles.getSplitPointsFile());

+      if (!soycFiles.getReportFiles().isEmpty()) {

+        results.addAll(soycFiles.getReportFiles());

+        foundReports = true;

+      }

+    }

+

+    if (foundReports) {

+      // run the final step of the dashboard to generate top-level files

+      ArtifactsOutputDirectory out = new ArtifactsOutputDirectory();

+      try {

+        new SoycDashboard(out).generateCrossPermutationFiles(extractPermutationDescriptions(artifacts));

+      } catch (IOException e) {

+        logger.log(TreeLogger.ERROR,

+            "Error while generating a Story of Your Compile", e);

+        e.printStackTrace();

+      }

+      results.addAll(out.getArtifacts());

     }

     return results;

   }

 

+  private Map<String, String> extractPermutationDescriptions(

+      ArtifactSet artifacts) {

+    Map<String, String> permDescriptions = new TreeMap<String, String>();

+

+    for (CompilationResult res : artifacts.find(CompilationResult.class)) {

+      String permId = Integer.toString(res.getPermutationId());

+      /*

+       * TODO(kprobst,spoon) support permutations that collapsed to the same

+       * compilation result

+       */

+      Map<SelectionProperty, String> propertyMap = res.getPropertyMap().iterator().next();

+      String permDesc = SymbolMapsLinker.propertyMapToString(propertyMap);

+      permDescriptions.put(permId, permDesc);

+    }

+

+    return permDescriptions;

+  }

 }

diff --git a/dev/core/src/com/google/gwt/core/linker/SymbolMapsLinker.java b/dev/core/src/com/google/gwt/core/linker/SymbolMapsLinker.java
index 3d3ed90..a3dcad3 100644
--- a/dev/core/src/com/google/gwt/core/linker/SymbolMapsLinker.java
+++ b/dev/core/src/com/google/gwt/core/linker/SymbolMapsLinker.java
@@ -29,6 +29,7 @@
 
 import java.io.ByteArrayOutputStream;
 import java.io.PrintWriter;
+import java.io.StringWriter;
 import java.util.Map;
 import java.util.SortedMap;
 
@@ -47,6 +48,33 @@
    */
   public static final String STRONG_NAME_SUFFIX = ".symbolMap";
 
+  public static String propertyMapToString(
+      Map<SelectionProperty, String> propertyMap) {
+    StringWriter writer = new StringWriter();
+    PrintWriter pw = new PrintWriter(writer);
+    printPropertyMap(pw, propertyMap);
+    pw.flush();
+    return writer.toString();
+  }
+
+  private static void printPropertyMap(PrintWriter pw,
+      Map<SelectionProperty, String> map) {
+    boolean needsComma = false;
+    for (Map.Entry<SelectionProperty, String> entry : map.entrySet()) {
+      if (needsComma) {
+        pw.print(" , ");
+      } else {
+        needsComma = true;
+      }
+
+      pw.print("'");
+      pw.print(entry.getKey().getName());
+      pw.print("' : '");
+      pw.print(entry.getValue());
+      pw.print("'");
+    }
+  }
+
   @Override
   public String getDescription() {
     return "Export CompilationResult symbol maps";
@@ -89,26 +117,11 @@
    */
   protected void doWriteSymbolMap(TreeLogger logger, CompilationResult result,
       PrintWriter pw) throws UnableToCompleteException {
-    
     pw.println("# { " + result.getPermutationId() + " }");
-    
+
     for (SortedMap<SelectionProperty, String> map : result.getPropertyMap()) {
       pw.print("# { ");
-
-      boolean needsComma = false;
-      for (Map.Entry<SelectionProperty, String> entry : map.entrySet()) {
-        if (needsComma) {
-          pw.print(" , ");
-        } else {
-          needsComma = true;
-        }
-
-        pw.print("'");
-        pw.print(entry.getKey().getName());
-        pw.print("' : '");
-        pw.print(entry.getValue());
-        pw.print("'");
-      }
+      printPropertyMap(pw, map);
       pw.println(" }");
     }
 
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 8d987d6..fb22d2a 100644
--- a/dev/core/src/com/google/gwt/dev/jjs/JavaToJavaScriptCompiler.java
+++ b/dev/core/src/com/google/gwt/dev/jjs/JavaToJavaScriptCompiler.java
@@ -20,6 +20,7 @@
 import com.google.gwt.core.ext.TreeLogger;
 import com.google.gwt.core.ext.UnableToCompleteException;
 import com.google.gwt.core.ext.linker.ArtifactSet;
+import com.google.gwt.core.ext.linker.EmittedArtifact;
 import com.google.gwt.core.ext.linker.StatementRanges;
 import com.google.gwt.core.ext.linker.SymbolData;
 import com.google.gwt.core.ext.linker.impl.StandardCompilationAnalysis;
@@ -57,7 +58,6 @@
 import com.google.gwt.dev.jjs.impl.CastNormalizer;
 import com.google.gwt.dev.jjs.impl.CatchBlockNormalizer;
 import com.google.gwt.dev.jjs.impl.CodeSplitter;
-import com.google.gwt.dev.jjs.impl.CodeSplitter.MultipleDependencyGraphRecorder;
 import com.google.gwt.dev.jjs.impl.ControlFlowAnalyzer;
 import com.google.gwt.dev.jjs.impl.DeadCodeElimination;
 import com.google.gwt.dev.jjs.impl.EqualityNormalizer;
@@ -85,6 +85,7 @@
 import com.google.gwt.dev.jjs.impl.SourceGenerationVisitor;
 import com.google.gwt.dev.jjs.impl.TypeMap;
 import com.google.gwt.dev.jjs.impl.TypeTightener;
+import com.google.gwt.dev.jjs.impl.CodeSplitter.MultipleDependencyGraphRecorder;
 import com.google.gwt.dev.js.EvalFunctionsAtTopScope;
 import com.google.gwt.dev.js.JsBreakUpLargeVarStatements;
 import com.google.gwt.dev.js.JsIEBlockSizeVisitor;
@@ -110,12 +111,16 @@
 import com.google.gwt.dev.util.PerfLogger;
 import com.google.gwt.dev.util.TextOutput;
 import com.google.gwt.dev.util.Util;
+import com.google.gwt.dev.util.collect.Lists;
 import com.google.gwt.dev.util.collect.Maps;
+import com.google.gwt.soyc.SoycDashboard;
+import com.google.gwt.soyc.io.ArtifactsOutputDirectory;
 
 import org.eclipse.jdt.core.compiler.IProblem;
 import org.eclipse.jdt.internal.compiler.CompilationResult;
 import org.eclipse.jdt.internal.compiler.ast.CompilationUnitDeclaration;
 import org.eclipse.jdt.internal.compiler.ast.TypeDeclaration;
+import org.xml.sax.SAXException;
 
 import java.io.ByteArrayOutputStream;
 import java.io.FileOutputStream;
@@ -130,13 +135,15 @@
 import java.util.Set;
 import java.util.TreeMap;
 import java.util.TreeSet;
+import java.util.zip.GZIPInputStream;
+
+import javax.xml.parsers.ParserConfigurationException;
 
 /**
  * Compiles the Java <code>JProgram</code> representation into its corresponding
  * JavaScript source.
  */
 public class JavaToJavaScriptCompiler {
-
   private static class PermutationResultImpl implements PermutationResult {
     private final ArtifactSet artifacts = new ArtifactSet();
     private final byte[][] js;
@@ -318,7 +325,7 @@
       // Work around an IE7 bug,
       // http://code.google.com/p/google-web-toolkit/issues/detail?id=1440
       // note, JsIEBlockTextTransformer now handles restructuring top level
-      // blocks, this class now handles non-top level blocks only. 
+      // blocks, this class now handles non-top level blocks only.
       SelectionProperty userAgentProperty = null;
       for (PropertyOracle oracle : propertyOracles) {
         userAgentProperty = oracle.getSelectionProperty(logger, "user.agent");
@@ -327,9 +334,8 @@
         }
       }
       // if user agent is known or ie6, split overly large blocks
-      boolean splitBlocks = userAgentProperty == null || (
-          userAgentProperty != null &&
-              "ie6".equals(userAgentProperty.getCurrentValue()));
+      boolean splitBlocks = userAgentProperty == null
+          || (userAgentProperty != null && "ie6".equals(userAgentProperty.getCurrentValue()));
 
       if (splitBlocks) {
         JsIEBlockSizeVisitor.exec(jsProgram);
@@ -853,7 +859,7 @@
         v = new JsSourceGenerationVisitorWithSizeBreakdown(out, jjsMap);
       }
       v.accept(jsProgram.getFragmentBlock(i));
-      
+
       /**
        * Reorder function decls to improve compression ratios. Also restructures
        * the top level blocks into sub-blocks if they exceed 32767 statements.
@@ -929,10 +935,10 @@
       SizeBreakdown[] sizeBreakdowns,
       List<Map<Range, SourceInfo>> sourceInfoMaps, SoycArtifact dependencies,
       JavaToJavaScriptMap jjsmap, Map<JsName, String> obfuscateMap)
-      throws IOException {
+      throws IOException, UnableToCompleteException {
     ByteArrayOutputStream baos = new ByteArrayOutputStream();
 
-    PerfLogger.start("Recording SOYC output");
+    PerfLogger.start("Recording compile report output");
 
     PerfLogger.start("Record split points");
     SplitPointRecorder.recordSplitPoints(jprogram, baos, logger);
@@ -964,8 +970,34 @@
 
     PerfLogger.end();
 
+    List<SoycArtifact> reportArtifacts = Lists.create();
+    if (sizeBreakdowns != null) {
+      PerfLogger.start("Generating compile report");
+      ArtifactsOutputDirectory outDir = new ArtifactsOutputDirectory();
+      SoycDashboard dashboard = new SoycDashboard(outDir);
+      dashboard.startNewPermutation(Integer.toString(permutationId));
+      try {
+        dashboard.readSplitPoints(openWithGunzip(splitPoints));
+        if (sizeMaps != null) {
+          dashboard.readSizeMaps(openWithGunzip(sizeMaps));
+        }
+        if (dependencies != null) {
+          dashboard.readDependencies(openWithGunzip(dependencies));
+        }
+      } catch (ParserConfigurationException e) {
+        throw new InternalCompilerException(
+            "Error reading compile report information that was just generated", e);
+      } catch (SAXException e) {
+        throw new InternalCompilerException(
+            "Error reading compile report information that was just generated", e);
+      }
+      dashboard.generateForOnePermutation();
+      reportArtifacts = outDir.getArtifacts();
+      PerfLogger.end();
+    }
+
     return new StandardCompilationAnalysis(dependencies, sizeMaps, splitPoints,
-        detailedStories);
+        detailedStories, reportArtifacts);
   }
 
   /**
@@ -1032,6 +1064,14 @@
   }
 
   /**
+   * Open an emitted artifact and gunzip its contents.
+   */
+  private static GZIPInputStream openWithGunzip(EmittedArtifact artifact)
+      throws IOException, UnableToCompleteException {
+    return new GZIPInputStream(artifact.getContents(TreeLogger.NULL));
+  }
+
+  /**
    * Dependency information is normally recorded during code splitting, and it
    * results in multiple dependency graphs. If the code splitter doesn't run,
    * then this method can be used instead to record a single dependency graph
diff --git a/dev/core/src/com/google/gwt/dev/util/arg/ArgHandlerSoycDetailed.java b/dev/core/src/com/google/gwt/dev/util/arg/ArgHandlerSoycDetailed.java
index d8b78c9..c278399 100644
--- a/dev/core/src/com/google/gwt/dev/util/arg/ArgHandlerSoycDetailed.java
+++ b/dev/core/src/com/google/gwt/dev/util/arg/ArgHandlerSoycDetailed.java
@@ -29,7 +29,7 @@
 
   @Override
   public String getPurpose() {
-    return "Emit extra, detailed SOYC information at the expense of compile time";
+    return "Emit extra, detailed compile-report information at the expense of compile time";
   }
 
   @Override
diff --git a/dev/core/src/com/google/gwt/soyc/GlobalInformation.java b/dev/core/src/com/google/gwt/soyc/GlobalInformation.java
index aaf9edf..34262db 100644
--- a/dev/core/src/com/google/gwt/soyc/GlobalInformation.java
+++ b/dev/core/src/com/google/gwt/soyc/GlobalInformation.java
@@ -25,10 +25,11 @@
 import java.util.TreeSet;
 
 /**
- * Information global to the entire SOYC report generator.
+ * SOYC information about a compiled module.
  */
 public class GlobalInformation {
   private static final SizeBreakdown[] EMPTY_SIZE_BREAKDOWN = new SizeBreakdown[0];
+  public Map<String, Map<String, String>> dependencies = null;
   private HashMap<String, String> classToPackage = new HashMap<String, String>();
   private HashMap<String, HashSet<String>> classToWhatItDependsOn = new HashMap<String, HashSet<String>>();
   private Map<Integer, SizeBreakdown> exclusiveCodeBreakdowns = new HashMap<Integer, SizeBreakdown>();
@@ -38,11 +39,16 @@
       "Leftovers code, code not in any other category", "leftovers");
   private int numSplitPoints = 0;
   private Map<String, TreeSet<String>> packageToClasses = new TreeMap<String, TreeSet<String>>();
+  private final String permutationId;
   private ArrayList<Integer> splitPointInitialLoadSequence = new ArrayList<Integer>();
   private HashMap<Integer, String> splitPointToLocation = new HashMap<Integer, String>();
   private SizeBreakdown totalCodeBreakdown = new SizeBreakdown("Total program",
       "total");
 
+  public GlobalInformation(String permutationId) {
+    this.permutationId = permutationId;
+  }
+
   public SizeBreakdown[] allSizeBreakdowns() {
     List<SizeBreakdown> breakdowns = new ArrayList<SizeBreakdown>();
     breakdowns.add(totalCodeBreakdown);
@@ -128,6 +134,10 @@
     return packageToClasses;
   }
 
+  public String getPermutationId() {
+    return permutationId;
+  }
+
   /**
    * Gets the initial load sequence.
    * 
diff --git a/dev/core/src/com/google/gwt/soyc/MakeTopLevelHtmlForPerm.java b/dev/core/src/com/google/gwt/soyc/MakeTopLevelHtmlForPerm.java
index d58e825..79d9258 100644
--- a/dev/core/src/com/google/gwt/soyc/MakeTopLevelHtmlForPerm.java
+++ b/dev/core/src/com/google/gwt/soyc/MakeTopLevelHtmlForPerm.java
@@ -17,13 +17,9 @@
 package com.google.gwt.soyc;
 
 import com.google.gwt.dev.util.Util;
+import com.google.gwt.soyc.io.OutputDirectory;
 
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileNotFoundException;
-import java.io.FileOutputStream;
 import java.io.IOException;
-import java.io.InputStream;
 import java.io.OutputStream;
 import java.io.PrintWriter;
 import java.io.UnsupportedEncodingException;
@@ -33,9 +29,6 @@
 import java.util.List;
 import java.util.Map;
 import java.util.TreeMap;
-import java.util.jar.JarEntry;
-import java.util.jar.JarFile;
-import java.util.jar.JarInputStream;
 import java.util.regex.Matcher;
 import java.util.regex.Pattern;
 
@@ -44,24 +37,14 @@
  */
 public class MakeTopLevelHtmlForPerm {
   /**
-   * A dependency linker for exclusive fragments. It links to nothing.
-   */
-  public class DependencyLinkerForExclusiveFragment implements DependencyLinker {
-    public String dependencyLinkForClass(String className, String permutationId) {
-      return null;
-    }
-  }
-
-  /**
    * A dependency linker for the initial code download. It links to the
    * dependencies for the initial download.
    */
   public class DependencyLinkerForInitialCode implements DependencyLinker {
-    public String dependencyLinkForClass(String className, String permutationId) {
+    public String dependencyLinkForClass(String className) {
       String packageName = globalInformation.getClassToPackage().get(className);
       assert packageName != null;
-      return dependenciesFileName("initial", packageName, permutationId) + "#"
-          + className;
+      return dependenciesFileName("initial", packageName) + "#" + className;
     }
   }
 
@@ -70,8 +53,8 @@
    * status pages.
    */
   public class DependencyLinkerForLeftoversFragment implements DependencyLinker {
-    public String dependencyLinkForClass(String className, String permutationId) {
-      return leftoversStatusFileName(className, permutationId);
+    public String dependencyLinkForClass(String className) {
+      return leftoversStatusFileName(className);
     }
   }
 
@@ -81,13 +64,22 @@
    * 
    */
   public class DependencyLinkerForTotalBreakdown implements DependencyLinker {
-    public String dependencyLinkForClass(String className, String permutationId) {
-      return splitStatusFileName(className, permutationId);
+    public String dependencyLinkForClass(String className) {
+      return splitStatusFileName(className);
+    }
+  }
+
+  /**
+   * A dependency linker that never links to anything.
+   */
+  public static class NullDependencyLinker implements DependencyLinker {
+    public String dependencyLinkForClass(String className) {
+      return null;
     }
   }
 
   interface DependencyLinker {
-    String dependencyLinkForClass(String className, String permutationId);
+    String dependencyLinkForClass(String className);
   }
 
   /**
@@ -110,10 +102,6 @@
    */
   private static final Pattern PATTERN_SP_INT = Pattern.compile("sp([0-9]+)");
 
-  private static String RESOURCES_PATH = MakeTopLevelHtmlForPerm.class.getPackage().getName().replace(
-      '.', '/')
-      + "/resources/";
-
   public static String escapeXml(String unescaped) {
     String escaped = unescaped.replaceAll("\\&", "&amp;");
     escaped = escaped.replaceAll("\\<", "&lt;");
@@ -123,6 +111,46 @@
     return escaped;
   }
 
+  public static void makeTopLevelHtmlForAllPerms(
+      Map<String, String> allPermsInfo, OutputDirectory outDir)
+      throws IOException {
+    PrintWriter outFile = new PrintWriter(outDir.getOutputStream("index.html"));
+
+    outFile.println("<!DOCTYPE HTML PUBLIC \"-//IETF//DTD HTML//EN\">");
+    outFile.println("<html>");
+    outFile.println("<head>");
+    outFile.println("  <title>Story of Your Compile - Top Level Dashboard for all Permutations</title>");
+    outFile.println("<style type=\"text/css\">");
+    outFile.println("body {background-color: #728FCE}");
+    outFile.println("h2 {background-color: transparent}");
+    outFile.println("</style>");
+    outFile.println("</head>");
+
+    outFile.println("<body>");
+    outFile.println("<center>");
+    outFile.println("<h1>Story of Your Compile</h1>");
+    outFile.println("<hr>");
+    outFile.println("<h3>Story of Your Compile - Overview of Permutations</h3>");
+    outFile.println("<hr>");
+
+    outFile.println("<div style='overflow:auto; background-color:white'>");
+    outFile.println("<center>");
+    for (String permutationId : allPermsInfo.keySet()) {
+      String permutationInfo = allPermsInfo.get(permutationId);
+      outFile.print("<p><a href=\"SoycDashboard" + "-" + permutationId
+          + "-index.html\">Permutation " + permutationId);
+      if (permutationInfo.length() > 0) {
+        outFile.println(" (" + permutationInfo + ")" + "</a>");
+      } else {
+        outFile.println("</a>");
+      }
+    }
+    outFile.println("</center>");
+    outFile.println("</div>");
+    addStandardHtmlEnding(outFile);
+    outFile.close();
+  }
+
   private static void addCenteredHeader(final PrintWriter outFile, String header) {
     outFile.println("<hr>");
     outFile.println("<b>" + header + "</b>");
@@ -137,6 +165,37 @@
     addCenteredHeader(outFile, headerLineForBreakdown(breakdown));
   }
 
+  private static void addStandardHtmlEnding(final PrintWriter out) {
+    out.println("</div>");
+    out.println("</body>");
+    out.println("</html>");
+  }
+
+  private static void addStandardHtmlProlog(final PrintWriter out,
+      String title, String header) {
+    out.println("<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01//EN\"");
+    out.println("\"http://www.w3.org/TR/html4/strict.dtd\">");
+    out.println("<html>");
+    out.println("<head>");
+    out.println("<meta http-equiv=\"content-type\" content=\"text/html;charset=ISO-8859-1\">");
+    out.println("<title>" + title + "</title>");
+    out.println("</head>");
+
+    out.println("<style type=\"text/css\">");
+    out.println("body {background-color: #728FCE}");
+    out.println("h2 {background-color: transparent}");
+    out.println("p {background-color: fuchsia}");
+    out.println("</style>");
+
+    out.println("<body>");
+    out.println("<center>");
+    out.println("<h2>" + title + "</h2>");
+    if (header != null) {
+      addCenteredHeader(out, header);
+    }
+    out.println("</center>");
+  }
+
   private static String classesInPackageFileName(SizeBreakdown breakdown,
       String packageName, String permutationId) {
     return breakdown.getId() + "_" + packageName + "-" + permutationId
@@ -167,155 +226,22 @@
   /**
    * Global information for this permutation.
    */
-  private GlobalInformation globalInformation = new GlobalInformation();
+  private final GlobalInformation globalInformation;
 
-  /**
-   * Settings for this permutation.
-   */
-  private Settings settings = new Settings();
+  private final OutputDirectory outDir;
 
-  /**
-   * Default constructor. Will be used for all permutations.
-   */
-  MakeTopLevelHtmlForPerm() {
-    this.globalInformation = new GlobalInformation();
-    this.settings = new Settings();
-  }
-
-  /**
-   * Constructor for a specific permutation.
-   * 
-   * @param globalInformation All the information about this permutation
-   */
-  MakeTopLevelHtmlForPerm(final GlobalInformation globalInformation) {
+  MakeTopLevelHtmlForPerm(GlobalInformation globalInformation,
+      OutputDirectory outDir) {
     this.globalInformation = globalInformation;
+    this.outDir = outDir;
   }
 
-  public void copyFileOrDirectory(File srcPath, File dstPath, String classPath,
-      String inputFileName, boolean isDirectory) throws IOException {
-    if (srcPath.isDirectory()) {
-      if (!dstPath.exists()) {
-        dstPath.mkdir();
-      }
-      String files[] = srcPath.list();
-      for (int i = 0; i < files.length; i++) {
-        copyFileOrDirectory(new File(srcPath, files[i]), new File(dstPath,
-            files[i]), classPath, inputFileName, isDirectory);
-      }
-    } else {
-      if (!srcPath.exists()) {
-        copyFileOrDirectoryFromJar(classPath, inputFileName, dstPath,
-            isDirectory);
-      } else {
-        InputStream in = new FileInputStream(srcPath);
-        OutputStream out = new FileOutputStream(dstPath);
-        // Transfer bytes from in to out
-        byte[] buf = new byte[1024];
-        int len;
-        while ((len = in.read(buf)) > 0) {
-          out.write(buf, 0, len);
-        }
-        in.close();
-        out.close();
-      }
-    }
-  }
-
-  public void copyFileOrDirectoryFromJar(String jarFileName,
-      String inputFileName, File dstPath, boolean isDirectory)
-      throws IOException {
-
-    JarFile jarFile = new JarFile(jarFileName);
-    if (isDirectory) {
-      dstPath.mkdir();
-
-      JarInputStream jarFileIS = new JarInputStream(new FileInputStream(
-          jarFileName));
-      JarEntry jarEntry = jarFileIS.getNextJarEntry();
-      while (jarEntry != null) {
-        if (!inputFileName.endsWith("/")) {
-          inputFileName += "/";
-        }
-        if ((jarEntry.getName().compareTo(inputFileName) != 0)
-            && (jarEntry.getName().startsWith(inputFileName))) {
-          File newDstPath = getOutFile(jarEntry.getName());
-          copyFileOrDirectoryFromJar(jarFileName, jarEntry.getName(),
-              newDstPath, false);
-        }
-        jarEntry = jarFileIS.getNextJarEntry();
-      }
-      jarFileIS.close();
-    } else {
-      InputStream in = jarFile.getInputStream(jarFile.getEntry(inputFileName));
-      OutputStream out = new FileOutputStream(dstPath);
-
-      int c;
-      while ((c = in.read()) != -1) {
-        out.write(c);
-      }
-      in.close();
-      out.close();
-      jarFile.close();
-    }
-  }
-
-  public GlobalInformation getGlobalInformation() {
-    return globalInformation;
-  }
-
-  public void makeBreakdownShell(SizeBreakdown breakdown, String permutationId)
-      throws IOException {
-    // this will contain the place holder iframes where the actual information
-    // is going to go.
-
+  public void makeBreakdownShell(SizeBreakdown breakdown) throws IOException {
     Map<String, CodeCollection> nameToCodeColl = breakdown.nameToCodeColl;
     Map<String, LiteralsCollection> nameToLitColl = breakdown.nameToLitColl;
 
-    // copy from the bin directory to the current directory
-    String classPath = settings.resources.get();
-    if (classPath == null) {
-      classPath = System.getProperty("java.class.path");
-    }
-    if (!classPath.endsWith("/")) {
-      classPath += "/";
-    }
-    String inputFileName = "roundedCorners.css";
-    File inputFile = new File(classPath + RESOURCES_PATH + inputFileName);
-    if (!inputFile.exists()) {
-      inputFile = new File(classPath + inputFileName);
-    }
-    File outputFile = getOutFile("roundedCorners.css");
-    copyFileOrDirectory(inputFile, outputFile, classPath, RESOURCES_PATH
-        + inputFileName, false);
-
-    inputFileName = "classLevel.css";
-    File inputFile2 = new File(classPath + RESOURCES_PATH + inputFileName);
-    if (!inputFile2.exists()) {
-      inputFile2 = new File(classPath + inputFileName);
-    }
-    File outputFile2 = getOutFile("classLevel.css");
-    copyFileOrDirectory(inputFile2, outputFile2, classPath, RESOURCES_PATH
-        + inputFileName, false);
-
-    inputFileName = "common.css";
-    File inputFile3 = new File(classPath + RESOURCES_PATH + inputFileName);
-    if (!inputFile3.exists()) {
-      inputFile3 = new File(classPath + inputFileName);
-    }
-    File outputFile3 = getOutFile("common.css");
-    copyFileOrDirectory(inputFile3, outputFile3, classPath, RESOURCES_PATH
-        + inputFileName, false);
-
-    inputFileName = "images";
-    File inputDir = new File(classPath + RESOURCES_PATH + "images");
-    if (!inputDir.exists()) {
-      inputDir = new File(classPath + "images");
-    }
-    File outputDir = getOutFile("images");
-    copyFileOrDirectory(inputDir, outputDir, classPath, inputFileName, true);
-
-    final PrintWriter outFile = new PrintWriter(getOutFile(shellFileName(
-        breakdown, permutationId)));
+    PrintWriter outFile = new PrintWriter(getOutFile(shellFileName(breakdown,
+        getPermutationId())));
 
     outFile.println("<!DOCTYPE HTML PUBLIC \"-//IETF//DTD HTML//EN\">");
     outFile.println("<html>");
@@ -389,7 +315,7 @@
 
     outFile.println("<div class='abs header'>Package breakdown</div>");
     outFile.println("<div class='abs innerContent'>");
-    String packageBreakdownFileName = makePackageHtml(breakdown, permutationId);
+    String packageBreakdownFileName = makePackageHtml(breakdown);
     outFile.println(" <iframe class='frame' src=\"" + packageBreakdownFileName
         + "\" scrolling=auto></iframe>");
     outFile.println("</div>");
@@ -400,7 +326,7 @@
 
     outFile.println("<div class='abs innerContent'>");
     String codeTypeBreakdownFileName = makeCodeTypeHtml(breakdown,
-        nameToCodeColl, nameToLitColl, permutationId);
+        nameToCodeColl, nameToLitColl);
     outFile.println("<iframe class='frame' src=\"" + codeTypeBreakdownFileName
         + "\" scrolling=auto></iframe>");
     outFile.println("</div>");
@@ -411,15 +337,15 @@
     outFile.close();
   }
 
-  public void makeCodeTypeClassesHtmls(SizeBreakdown breakdown,
-      String permutationId) throws IOException {
+  public void makeCodeTypeClassesHtmls(SizeBreakdown breakdown)
+      throws IOException {
     HashMap<String, CodeCollection> nameToCodeColl = breakdown.nameToCodeColl;
 
     for (String codeType : nameToCodeColl.keySet()) {
 
       // construct file name
       String outFileName = breakdown.getId() + "_" + codeType + "-"
-          + permutationId + "Classes.html";
+          + getPermutationId() + "Classes.html";
 
       float maxSize = 0f;
       TreeMap<Float, String> sortedClasses = new TreeMap<Float, String>(
@@ -540,28 +466,26 @@
     }
   }
 
-  public void makeDependenciesHtml(
-      Map<String, Map<String, String>> allDependencies, String permutationId)
-      throws IOException {
-    for (String depGraphName : allDependencies.keySet()) {
-      makeDependenciesHtml(depGraphName, allDependencies.get(depGraphName),
-          permutationId);
+  public void makeDependenciesHtml() throws IOException {
+    for (String depGraphName : globalInformation.dependencies.keySet()) {
+      makeDependenciesHtml(depGraphName,
+          globalInformation.dependencies.get(depGraphName));
     }
   }
 
-  public void makeLeftoverStatusPages(String permutationId) throws IOException {
+  public void makeLeftoverStatusPages() throws IOException {
     for (String className : globalInformation.getClassToPackage().keySet()) {
-      makeLeftoversStatusPage(className, permutationId);
+      makeLeftoversStatusPage(className);
     }
   }
 
-  public void makeLiteralsClassesTableHtmls(SizeBreakdown breakdown,
-      String permutationId) throws IOException {
+  public void makeLiteralsClassesTableHtmls(SizeBreakdown breakdown)
+      throws IOException {
     Map<String, LiteralsCollection> nameToLitColl = breakdown.nameToLitColl;
 
     for (String literalType : nameToLitColl.keySet()) {
 
-      String outFileName = literalType + "-" + permutationId + "Lits.html";
+      String outFileName = literalType + "-" + getPermutationId() + "Lits.html";
       final PrintWriter outFile = new PrintWriter(getOutFile(breakdown.getId()
           + "_" + outFileName));
 
@@ -625,9 +549,8 @@
    * Make size breakdowns for each package for one code collection.
    */
   public void makePackageClassesHtmls(SizeBreakdown breakdown,
-      DependencyLinker depLinker, String permutationId) throws IOException {
+      DependencyLinker depLinker) throws IOException {
     for (String packageName : globalInformation.getPackageToClasses().keySet()) {
-
       TreeMap<Float, String> sortedClasses = new TreeMap<Float, String>(
           Collections.reverseOrder());
       float maxSize = 0f;
@@ -642,7 +565,6 @@
         }
 
         if (curSize != 0f) {
-
           sumSize += curSize;
           sortedClasses.put(curSize, className);
           if (curSize > maxSize) {
@@ -653,7 +575,7 @@
 
       PrintWriter outFile = new PrintWriter(
           getOutFile(classesInPackageFileName(breakdown, packageName,
-              permutationId)));
+              getPermutationId())));
 
       outFile.println("<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01//EN\"");
       outFile.println("\"http://www.w3.org/TR/html4/strict.dtd\">");
@@ -726,9 +648,8 @@
       outFile.println("<th class='barlabel'></th>");
       outFile.println("<th style='width:100%' class='barlabel'></th>");
       outFile.println("</thead>");
-//
-      for (Float size : sortedClasses.keySet()) {
 
+      for (Float size : sortedClasses.keySet()) {
         String className = sortedClasses.get(size);
         float ratio = (size / maxSize) * 85;
         if (ratio < 5) {
@@ -736,12 +657,11 @@
         }
         float perc = (size / sumSize) * 100;
 
-        String dependencyLink = depLinker.dependencyLinkForClass(className,
-            permutationId);
+        String dependencyLink = depLinker.dependencyLinkForClass(className);
         outFile.println("<tr>");
         outFile.println("<td class=\"barlabel\">" + size + "</td>");
         outFile.println("<td class=\"barlabel\">" + perc + "%</td>");
-        if ((settings.displayDependencies) && (dependencyLink != null)) {
+        if (dependencyLink != null) {
           outFile.println("<td class=\"barlabel\"><a href=\"" + dependencyLink
               + "\" target=\"_top\">" + className + "</a></td>");
         } else {
@@ -761,54 +681,15 @@
     }
   }
 
-  public void makeSplitStatusPages(String permutationId) throws IOException {
+  public void makeSplitStatusPages() throws IOException {
     for (String className : globalInformation.getClassToPackage().keySet()) {
-      makeSplitStatusPage(className, permutationId);
+      makeSplitStatusPage(className);
     }
   }
 
-  public void makeTopLevelHtmlForAllPerms() throws FileNotFoundException {
-
-    PrintWriter outFile = new PrintWriter(getOutFile("index.html"));
-
-    outFile.println("<!DOCTYPE HTML PUBLIC \"-//IETF//DTD HTML//EN\">");
-    outFile.println("<html>");
-    outFile.println("<head>");
-    outFile.println("  <title>Story of Your Compile - Top Level Dashboard for all Permutations</title>");
-    outFile.println("<style type=\"text/css\">");
-    outFile.println("body {background-color: #728FCE}");
-    outFile.println("h2 {background-color: transparent}");
-    outFile.println("</style>");
-    outFile.println("</head>");
-
-    outFile.println("<body>");
-    outFile.println("<center>");
-    outFile.println("<h1>Story of Your Compile</h1>");
-    outFile.println("<hr>");
-    outFile.println("<h3>Story of Your Compile - Overview of Permutations</h3>");
-    outFile.println("<hr>");
-
-    outFile.println("<div style='overflow:auto; background-color:white'>");
-    outFile.println("<center>");
-    for (String permutationId : settings.allPermsInfo.keySet()) {
-      String permutationInfo = settings.allPermsInfo.get(permutationId);
-      outFile.print("<p><a href=\"SoycDashboard" + "-" + permutationId
-          + "-index.html\">Permutation " + permutationId);
-      if (permutationInfo.length() > 0) {
-        outFile.println(" (" + permutationInfo + ")" + "</a>");
-      } else {
-        outFile.println("</a>");
-      }
-    }
-    outFile.println("</center>");
-    outFile.println("</div>");
-    addStandardHtmlEnding(outFile);
-    outFile.close();
-  }
-
-  public void makeTopLevelShell(String permutationId) throws IOException {
+  public void makeTopLevelShell() throws IOException {
     PrintWriter outFile = new PrintWriter(getOutFile("SoycDashboard" + "-"
-        + permutationId + "-index.html"));
+        + getPermutationId() + "-index.html"));
 
     outFile.println("<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01//EN\"");
     outFile.println("\"http://www.w3.org/TR/html4/strict.dtd\">");
@@ -868,8 +749,10 @@
     outFile.println("<body>");
     outFile.println("<div class='abs mainHeader'>");
     outFile.println("<h2>Story of Your Compile Dashboard</h2>");
-    String permutationInfo = settings.allPermsInfo.get(permutationId);
-    outFile.print("<h3>Permutation " + permutationId);
+    // String permutationInfo = settings.allPermsInfo.get(getPermutationId());
+    String permutationInfo = ""; // TODO(spoon) pass in permutation information
+    // here
+    outFile.print("<h3>Permutation " + getPermutationId());
     if (permutationInfo.length() > 0) {
       outFile.println(" (" + permutationInfo + ")");
     }
@@ -928,7 +811,7 @@
         breakdown = globalInformation.splitPointCodeBreakdown(i);
       }
 
-      String drillDownFileName = shellFileName(breakdown, permutationId);
+      String drillDownFileName = shellFileName(breakdown, getPermutationId());
       String splitPointDescription = breakdown.getDescription();
 
       int size = breakdown.sizeAllCode;
@@ -962,14 +845,6 @@
     outFile.close();
   }
 
-  public void setGlobalInformation(GlobalInformation globalInformation) {
-    this.globalInformation = globalInformation;
-  }
-
-  public void setSettings(Settings settings) {
-    this.settings = settings;
-  }
-
   private void addDependenciesHtmlProlog(final PrintWriter out, String title,
       String header) {
     out.println("<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01//EN\"");
@@ -1023,65 +898,39 @@
   }
 
   private void addLefttoversStatus(String className, String packageName,
-      PrintWriter out, String permutationId) {
-    if (settings.displayDependencies) {
+      PrintWriter out) {
+    if (globalInformation.dependencies != null) {
       out.println("<tr><td>&nbsp;&nbsp;&nbsp;&nbsp;<a href=\""
-          + dependenciesFileName("total", packageName, permutationId) + "#"
-          + className + "\">See why it's live</a></td></tr>");
+          + dependenciesFileName("total", packageName) + "#" + className
+          + "\">See why it's live</a></td></tr>");
       for (int sp = 1; sp <= globalInformation.getNumSplitPoints(); sp++) {
         out.println("<tr><td>&nbsp;&nbsp;&nbsp;&nbsp;<a href=\""
-            + dependenciesFileName("sp" + sp, packageName, permutationId) + "#"
-            + className + "\">See why it's not exclusive to s.p. #" + sp + " ("
+            + dependenciesFileName("sp" + sp, packageName) + "#" + className
+            + "\">See why it's not exclusive to s.p. #" + sp + " ("
             + globalInformation.getSplitPointToLocation().get(sp)
             + ")</a></td></tr>");
       }
     }
   }
 
-  private void addStandardHtmlEnding(final PrintWriter out) {
-    out.println("</div>");
-    out.println("</body>");
-    out.println("</html>");
-  }
-
-  private void addStandardHtmlProlog(final PrintWriter out, String title,
-      String header) {
-    out.println("<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01//EN\"");
-    out.println("\"http://www.w3.org/TR/html4/strict.dtd\">");
-    out.println("<html>");
-    out.println("<head>");
-    out.println("<meta http-equiv=\"content-type\" content=\"text/html;charset=ISO-8859-1\">");
-    out.println("<title>" + title + "</title>");
-    out.println("</head>");
-
-    out.println("<style type=\"text/css\">");
-    out.println("body {background-color: #728FCE}");
-    out.println("h2 {background-color: transparent}");
-    out.println("p {background-color: fuchsia}");
-    out.println("</style>");
-
-    out.println("<body>");
-    out.println("<center>");
-    out.println("<h2>" + title + "</h2>");
-    if (header != null) {
-      addCenteredHeader(out, header);
-    }
-    out.println("</center>");
-  }
-
-  private String dependenciesFileName(String depGraphName, String packageName,
-      String permutationId) {
+  private String dependenciesFileName(String depGraphName, String packageName) {
     return "methodDependencies-" + depGraphName + "-" + filename(packageName)
-        + "-" + permutationId + ".html";
+        + "-" + getPermutationId() + ".html";
   }
 
   /**
    * Return a {@link File} object for a file to be emitted into the output
    * directory.
    */
-  private File getOutFile(String localFileName) {
-    File outDir = new File(settings.out.get());
-    return new File(outDir, localFileName);
+  private OutputStream getOutFile(String localFileName) throws IOException {
+    return outDir.getOutputStream(localFileName);
+  }
+
+  /**
+   * @return
+   */
+  private String getPermutationId() {
+    return globalInformation.getPermutationId();
   }
 
   /**
@@ -1115,16 +964,15 @@
         splitPoint);
   }
 
-  private String leftoversStatusFileName(String className, String permutationId) {
-    return "leftoverStatus-" + filename(className) + "-" + permutationId
+  private String leftoversStatusFileName(String className) {
+    return "leftoverStatus-" + filename(className) + "-" + getPermutationId()
         + ".html";
   }
 
   private String makeCodeTypeHtml(SizeBreakdown breakdown,
       Map<String, CodeCollection> nameToCodeColl,
-      Map<String, LiteralsCollection> nameToLitColl, String permutationId)
-      throws IOException {
-    String outFileName = breakdown.getId() + "-" + permutationId
+      Map<String, LiteralsCollection> nameToLitColl) throws IOException {
+    String outFileName = breakdown.getId() + "-" + getPermutationId()
         + "_codeTypeBreakdown.html";
     float maxSize = 0f;
     float sumSize = 0f;
@@ -1167,7 +1015,7 @@
 
       String codeType = sortedCodeTypes.get(size);
       String drillDownFileName = breakdown.getId() + "_" + codeType + "-"
-          + permutationId + "Classes.html";
+          + getPermutationId() + "Classes.html";
 
       float ratio = (size / maxSize) * 79;
       float perc = (size / sumSize) * 100;
@@ -1210,7 +1058,7 @@
     for (Float size : sortedLitTypes.keySet()) {
       String literal = sortedLitTypes.get(size);
       String drillDownFileName = breakdown.getId() + "_" + literal + "-"
-          + permutationId + "Lits.html";
+          + getPermutationId() + "Lits.html";
 
       float ratio = (size / maxSize) * 79;
       float perc = (size / sumSize) * 100;
@@ -1241,8 +1089,7 @@
   }
 
   private void makeDependenciesHtml(String depGraphName,
-      Map<String, String> dependencies, String permutationId)
-      throws FileNotFoundException {
+      Map<String, String> dependencies) throws IOException {
     String depGraphDescription = inferDepGraphDescription(depGraphName);
     PrintWriter outFile = null;
     String curPackageName = "";
@@ -1268,8 +1115,7 @@
           outFile.close();
         }
 
-        String outFileName = dependenciesFileName(depGraphName, curPackageName,
-            permutationId);
+        String outFileName = dependenciesFileName(depGraphName, curPackageName);
         outFile = new PrintWriter(getOutFile(outFileName));
 
         String packageDescription = packageName.length() == 0
@@ -1305,11 +1151,10 @@
     outFile.close();
   }
 
-  private void makeLeftoversStatusPage(String className, String permutationId)
-      throws IOException {
+  private void makeLeftoversStatusPage(String className) throws IOException {
     String packageName = globalInformation.getClassToPackage().get(className);
-    PrintWriter out = new PrintWriter(getOutFile(leftoversStatusFileName(
-        className, permutationId)));
+    PrintWriter out = new PrintWriter(
+        getOutFile(leftoversStatusFileName(className)));
 
     addStandardHtmlProlog(out, "Leftovers page for " + className, null);
 
@@ -1317,7 +1162,7 @@
     out.println("<table border=\"1\" width=\"80%\" style=\"font-size: 11pt;\" bgcolor=\"white\">");
 
     out.println("<tr><td>This class has some leftover code, neither initial nor exclusive to any split point:</td></tr>");
-    addLefttoversStatus(className, packageName, out, permutationId);
+    addLefttoversStatus(className, packageName, out);
     out.println("</table>");
 
     addStandardHtmlEnding(out);
@@ -1325,9 +1170,8 @@
     out.close();
   }
 
-  private String makePackageHtml(SizeBreakdown breakdown, String permutationId)
-      throws FileNotFoundException {
-    String outFileName = breakdown.getId() + "-" + permutationId + "_"
+  private String makePackageHtml(SizeBreakdown breakdown) throws IOException {
+    String outFileName = breakdown.getId() + "-" + getPermutationId() + "_"
         + "packageBreakdown.html";
     Map<String, Integer> packageToPartialSize = breakdown.packageToSize;
     TreeMap<Integer, String> sortedPackages = new TreeMap<Integer, String>(
@@ -1364,7 +1208,7 @@
     for (int size : sortedPackages.keySet()) {
       String packageName = sortedPackages.get(size);
       String drillDownFileName = classesInPackageFileName(breakdown,
-          packageName, permutationId);
+          packageName, getPermutationId());
 
       float ratio = (size / maxSize) * 79;
       if (ratio < 5) {
@@ -1393,11 +1237,10 @@
     return outFileName;
   }
 
-  private void makeSplitStatusPage(String className, String permutationId)
-      throws IOException {
+  private void makeSplitStatusPage(String className) throws IOException {
     String packageName = globalInformation.getClassToPackage().get(className);
-    PrintWriter out = new PrintWriter(getOutFile(splitStatusFileName(className,
-        permutationId)));
+    PrintWriter out = new PrintWriter(
+        getOutFile(splitStatusFileName(className)));
 
     addStandardHtmlProlog(out, "Split point status for " + className, null);
 
@@ -1405,12 +1248,11 @@
     out.println("<table border=\"1\" width=\"80%\" style=\"font-size: 11pt;\" bgcolor=\"white\">");
 
     if (globalInformation.getInitialCodeBreakdown().classToSize.containsKey(className)) {
-      if (settings.displayDependencies) {
+      if (globalInformation.dependencies != null) {
         out.println("<tr><td>Some code is initial (<a href=\""
-            + dependenciesFileName("initial", packageName, permutationId) + "#"
-            + className + "\">see why</a>)</td></tr>");
-      }
-      else {
+            + dependenciesFileName("initial", packageName) + "#" + className
+            + "\">see why</a>)</td></tr>");
+      } else {
         out.println("<tr><td>Some code is initial</td></tr>");
       }
     }
@@ -1420,7 +1262,7 @@
     }
     if (globalInformation.getLeftoversBreakdown().classToSize.containsKey(className)) {
       out.println("<tr><td>Some code is left over:</td></tr>");
-      addLefttoversStatus(className, packageName, out, permutationId);
+      addLefttoversStatus(className, packageName, out);
     }
     out.println("</table>");
 
@@ -1443,7 +1285,8 @@
     return sps;
   }
 
-  private String splitStatusFileName(String className, String permutationId) {
-    return "splitStatus-" + filename(className) + "-" + permutationId + ".html";
+  private String splitStatusFileName(String className) {
+    return "splitStatus-" + filename(className) + "-" + getPermutationId()
+        + ".html";
   }
 }
diff --git a/dev/core/src/com/google/gwt/soyc/Settings.java b/dev/core/src/com/google/gwt/soyc/Settings.java
index 7f5b9bb..01bd6e8 100644
--- a/dev/core/src/com/google/gwt/soyc/Settings.java
+++ b/dev/core/src/com/google/gwt/soyc/Settings.java
@@ -16,15 +16,10 @@
 package com.google.gwt.soyc;
 
 import java.io.File;
-import java.io.FileNotFoundException;
-import java.io.FileReader;
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.LinkedList;
 import java.util.List;
-import java.util.Map;
-import java.util.Scanner;
-import java.util.TreeMap;
 
 /**
  * Command-line settings for SOYC.
@@ -123,10 +118,6 @@
       break; // No setting wanted the remaining arguments
     }
 
-    if (settings.resources.get() == null) {
-      throw new ArgumentListException("The -resources option is required");
-    }
-
     if ((settings.soycDir.get() == null)
         && (settings.symbolMapsDir.get() == null)) {
 
@@ -184,17 +175,16 @@
     return help.toString();
   }
 
-  public Map<String, String> allPermsInfo = new TreeMap<String, String>();
   public String depFileName;
-  public Boolean displayDependencies = false;
-  public Boolean displaySplitPoints = false;
 
   public final Setting<String> out = addSetting(new StringSetting("-out",
       "dir", ".", "output directory"));
 
   public final Setting<String> resources = addSetting(new StringSetting(
-      "-resources", "jarfile", null,
-      " directory or jar file with CSS, etc., resources"));
+      "-resources",
+      "dir",
+      null,
+      "present only for backwards compatibility; directory or jar file with CSS, etc., resources"));
 
   public final Setting<String> soycDir = addSetting(new StringSetting(
       "-soycDir", "dir", null, " directory for soyc files"));
@@ -207,47 +197,6 @@
       "-symbolMapsDir", "dir", null, " directory or symbol maps files"));
 
   private List<Setting<?>> allSettings;
-  public void readPermutationInfo() throws FileNotFoundException {
-
-    if (symbolMapsDir.get() == null) {
-      // get the permutation id from settings
-      String permutationId = storiesFileName;
-      permutationId = permutationId.replaceAll(".*/stories", "");
-      permutationId = permutationId.replaceAll("\\.xml(\\.gz)?", "");
-      allPermsInfo.put(permutationId, "");
-    } else {
-      File dir = new File(symbolMapsDir.get());
-      String files[] = dir.list();
-      for (Integer i = 0; i < files.length; i++) {
-        String permFileName = symbolMapsDir.get() + "/" + files[i];
-        FileReader fir = new FileReader(permFileName);
-
-        Scanner sc = new Scanner(fir);
-
-        String permutationId = "";
-        String permutationInfo = "";
-        int lineCount = 0;
-        while ((sc.hasNextLine()) && (lineCount < 2)) {
-
-          String curLine = sc.nextLine();
-          curLine = curLine.trim();
-
-          if (curLine.startsWith("# {")) {
-            curLine = curLine.replace("# {", "");
-            curLine = curLine.replace("}", "");
-            curLine = curLine.trim();
-            if (lineCount == 0) {
-              permutationId = curLine;
-            } else {
-              permutationInfo = curLine;
-            }
-            lineCount++;
-          }
-        }
-        allPermsInfo.put(permutationId, permutationInfo);
-      }
-    }
-  }
 
   private <T> Setting<T> addSetting(Setting<T> setting) {
     if (allSettings == null) {
diff --git a/dev/core/src/com/google/gwt/soyc/SoycDashboard.java b/dev/core/src/com/google/gwt/soyc/SoycDashboard.java
index 25aeffd..190256f 100644
--- a/dev/core/src/com/google/gwt/soyc/SoycDashboard.java
+++ b/dev/core/src/com/google/gwt/soyc/SoycDashboard.java
@@ -17,6 +17,9 @@
 package com.google.gwt.soyc;
 
 import com.google.gwt.soyc.MakeTopLevelHtmlForPerm.DependencyLinker;
+import com.google.gwt.soyc.MakeTopLevelHtmlForPerm.NullDependencyLinker;
+import com.google.gwt.soyc.io.FileSystemOutputDirectory;
+import com.google.gwt.soyc.io.OutputDirectory;
 
 import org.xml.sax.Attributes;
 import org.xml.sax.SAXException;
@@ -26,6 +29,7 @@
 import java.io.File;
 import java.io.FileInputStream;
 import java.io.FileNotFoundException;
+import java.io.FileReader;
 import java.io.IOException;
 import java.io.InputStream;
 import java.util.ArrayList;
@@ -33,6 +37,7 @@
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
+import java.util.Scanner;
 import java.util.TreeMap;
 import java.util.TreeSet;
 import java.util.Map.Entry;
@@ -43,10 +48,9 @@
 import javax.xml.parsers.SAXParserFactory;
 
 /**
- * The command-line entry point for creating a SOYC report.
+ * The command-line entry point for creating a compile report.
  */
 public class SoycDashboard {
-
   private static class FormatException extends RuntimeException {
     public FormatException() {
       super();
@@ -62,136 +66,47 @@
   }
 
   public static void main(final String[] args) {
+    Settings settings;
     try {
-      System.out.println("Generating the Story of Your Compile...");
-      Settings settings = Settings.fromArgumentList(args);
+      settings = Settings.fromArgumentList(args);
+    } catch (Settings.ArgumentListException e) {
+      System.err.println(e.getMessage());
+      System.err.println("Usage: "
+          + "java com.google.gwt.soyc.SoycDashboard -resources dir -soycDir dir -symbolMaps dir [-out dir]");
+      System.err.println("(Legacy usage: "
+          + "java com.google.gwt.soyc.SoycDashboard options stories0.xml[.gz] [dependencies0.xml[.gz]] [splitpoints0.xml[.gz]])");
+      System.err.println("Options:");
+      System.err.println(Settings.settingsHelp());
+      System.exit(1);
+      return; // not reached
+    }
 
-      MakeTopLevelHtmlForPerm makeTopLevelHtml = new MakeTopLevelHtmlForPerm();
-      makeTopLevelHtml.setSettings(settings);
+    System.out.println("Generating the Story of Your Compile...");
 
-      // read in all the symbol maps
-      settings.readPermutationInfo();
-      makeTopLevelHtml.makeTopLevelHtmlForAllPerms();
-      for (String permutationId : settings.allPermsInfo.keySet()) {
-        GlobalInformation globalInformation = new GlobalInformation();
-        MakeTopLevelHtmlForPerm makeTopLevelHtmlForPerm = new MakeTopLevelHtmlForPerm(
-            globalInformation);
-        makeTopLevelHtmlForPerm.setSettings(settings);
+    OutputDirectory outDir = new FileSystemOutputDirectory(new File(
+        settings.out.get()));
 
-        String storiesFileName = settings.storiesFileName;
-
-        String depFileName = settings.depFileName;
-        if (depFileName == null) {
-          depFileName = "";
+    try {
+      Map<String, String> permInfo = readPermutationInfo(settings);
+      SoycDashboard dashboard = new SoycDashboard(outDir);
+      for (String permutationId : permInfo.keySet()) {
+        dashboard.startNewPermutation(permutationId);
+        if (settings.symbolMapsDir.get() == null) {
+          dashboard.readFromFilesNamed(settings.storiesFileName,
+              settings.depFileName, settings.splitPointsFileName);
+        } else {
+          String soycDir = settings.soycDir.get();
+          dashboard.readFromFilesNamed(soycInputFile(soycDir, "stories",
+              permutationId), soycInputFile(soycDir, "dependencies",
+              permutationId), soycInputFile(soycDir, "splitPoints",
+              permutationId));
         }
-        String splitPointsFileName = settings.splitPointsFileName;
-        if (splitPointsFileName == null) {
-          splitPointsFileName = "";
-        }
-
-        if (settings.symbolMapsDir.get() != null) {
-          storiesFileName = settings.soycDir.get() + "/stories" + permutationId
-              + ".xml.gz";
-
-          if (!(new File(storiesFileName).exists())) {
-            storiesFileName = settings.soycDir.get() + "/stories"
-                + permutationId + ".xml";
-          }
-          depFileName = settings.soycDir.get() + "/dependencies"
-              + permutationId + ".xml.gz";
-          if (!(new File(depFileName).exists())) {
-            depFileName = settings.soycDir.get() + "/dependencies"
-                + permutationId + ".xml";
-          }
-          splitPointsFileName = settings.soycDir.get() + "/splitPoints"
-              + permutationId + ".xml.gz";
-          if (!(new File(splitPointsFileName).exists())) {
-            splitPointsFileName = settings.soycDir.get() + "/splitPoints"
-                + permutationId + ".xml";
-          }
-        }
-
-        settings.displayDependencies = (new File(depFileName)).exists();
-        settings.displaySplitPoints = (new File(splitPointsFileName)).exists();
-
-        new File(settings.out.get()).mkdir();
-        if (settings.displayDependencies) {
-          /**
-           * handle dependencies
-           */
-          Map<String, Map<String, String>> dependencies = new TreeMap<String, Map<String, String>>();
-          DefaultHandler depHandler = parseXMLDocumentDependencies(dependencies);
-          SAXParserFactory depFactoryMain = SAXParserFactory.newInstance();
-          depFactoryMain.setNamespaceAware(true);
-          SAXParser saxParser = depFactoryMain.newSAXParser();
-          InputStream in = new FileInputStream(depFileName);
-          if (depFileName.endsWith(".gz")) {
-            in = new GZIPInputStream(in);
-          }
-          in = new BufferedInputStream(in);
-          saxParser.parse(in, depHandler);
-
-          makeTopLevelHtmlForPerm.makeDependenciesHtml(dependencies,
-              permutationId);
-        }
-
-        if (settings.displaySplitPoints) {
-          /**
-           * handle runAsync split points
-           */
-
-          DefaultHandler splitPointHandler = parseXMLDocumentSplitPoints(globalInformation);
-          SAXParserFactory splitPointsFactoryMain = SAXParserFactory.newInstance();
-          splitPointsFactoryMain.setNamespaceAware(true);
-
-          SAXParser saxParser = splitPointsFactoryMain.newSAXParser();
-          InputStream in = new FileInputStream(splitPointsFileName);
-          if (depFileName.endsWith(".gz")) {
-            in = new GZIPInputStream(in);
-          }
-          in = new BufferedInputStream(in);
-          saxParser.parse(in, splitPointHandler);
-        }
-
-        /**
-         * handle everything else
-         */
-
-        DefaultHandler handler = parseXMLDocumentSizeMap(globalInformation);
-        SAXParserFactory factoryMain = SAXParserFactory.newInstance();
-        factoryMain.setNamespaceAware(true);
-        SAXParser saxParser = factoryMain.newSAXParser();
-        InputStream in = new FileInputStream(storiesFileName);
-        if (storiesFileName.endsWith(".gz")) {
-          in = new GZIPInputStream(in);
-        }
-        in = new BufferedInputStream(in);
-        saxParser.parse(in, handler);
-
-        // add to "All Other Code" if none of the special categories apply
-        for (SizeBreakdown breakdown : globalInformation.allSizeBreakdowns()) {
-          updateAllOtherCodeType(breakdown.nameToCodeColl, globalInformation);
-        }
-        globalInformation.computePackageSizes();
-
-        // clean up the RPC categories
-        for (SizeBreakdown breakdown : globalInformation.allSizeBreakdowns()) {
-          foldInRPCHeuristic(breakdown.nameToCodeColl);
-        }
-
-        // generate all the html files
-        makeTopLevelHtmlForPerm.makeSplitStatusPages(permutationId);
-        makeTopLevelHtmlForPerm.makeLeftoverStatusPages(permutationId);
-        for (SizeBreakdown breakdown : globalInformation.allSizeBreakdowns()) {
-          DependencyLinker linker = chooseDependencyLinker(
-              makeTopLevelHtmlForPerm, breakdown);
-          makeHTMLFiles(makeTopLevelHtmlForPerm, breakdown, linker,
-              permutationId);
-        }
+        dashboard.generateForOnePermutation();
         System.out.println("Finished creating reports for permutation.");
       }
-      System.out.println("Finished creating reports. To see the dashboard, open index.html in your browser.");
 
+      dashboard.generateCrossPermutationFiles(permInfo);
+      System.out.println("Finished creating reports. To see the dashboard, open index.html in your browser.");
     } catch (ParserConfigurationException e) {
       System.err.println("Could not parse document. " + e.getMessage());
       System.exit(1);
@@ -204,45 +119,21 @@
     } catch (IOException e) {
       System.err.println("Error creating html file. " + e.getMessage());
       System.exit(1);
-    } catch (Settings.ArgumentListException e) {
-      System.err.println(e.getMessage());
-      System.err.println("Usage: "
-          + "java com.google.gwt.soyc.SoycDashboard -resources dir -soycDir dir -symbolMaps dir [-out dir]");
-      System.err.println("(Legacy usage: "
-          + "java com.google.gwt.soyc.SoycDashboard options stories0.xml[.gz] [dependencies0.xml[.gz]] [splitpoints0.xml[.gz]])");
-      System.err.println("Options:");
-      System.err.println(Settings.settingsHelp());
-      System.exit(1);
     }
   }
 
-  private static Collection<SizeBreakdown> breakdownsForFragment(
-      Integer fragment, GlobalInformation globalInformation) {
-    List<SizeBreakdown> breakdowns = new ArrayList<SizeBreakdown>();
-    breakdowns.add(globalInformation.getTotalCodeBreakdown());
-    if (fragment == 0) {
-      breakdowns.add(globalInformation.getInitialCodeBreakdown());
+  /**
+   * Open a file for reading. If the filename ends in .gz, then wrap the stream
+   * with a {@link GZIPInputStream}.
+   */
+  public static InputStream openPossiblyGzippedFile(String filename)
+      throws IOException {
+    InputStream in = new FileInputStream(filename);
+    if (filename.endsWith(".gz")) {
+      in = new GZIPInputStream(in);
     }
-    if (fragment == (globalInformation.getNumSplitPoints() + 1)) {
-      breakdowns.add(globalInformation.getLeftoversBreakdown());
-    }
-    if (fragment >= 1 && fragment <= globalInformation.getNumSplitPoints()) {
-      breakdowns.add(globalInformation.splitPointCodeBreakdown(fragment));
-    }
-    return breakdowns;
-  }
-
-  private static DependencyLinker chooseDependencyLinker(
-      MakeTopLevelHtmlForPerm makeTopLevelHtmlForPerm, SizeBreakdown breakdown) {
-    if (breakdown == makeTopLevelHtmlForPerm.getGlobalInformation().getTotalCodeBreakdown()) {
-      return makeTopLevelHtmlForPerm.new DependencyLinkerForTotalBreakdown();
-    } else if (breakdown == makeTopLevelHtmlForPerm.getGlobalInformation().getInitialCodeBreakdown()) {
-      return makeTopLevelHtmlForPerm.new DependencyLinkerForInitialCode();
-    } else if (breakdown == makeTopLevelHtmlForPerm.getGlobalInformation().getLeftoversBreakdown()) {
-      return makeTopLevelHtmlForPerm.new DependencyLinkerForLeftoversFragment();
-    } else {
-      return makeTopLevelHtmlForPerm.new DependencyLinkerForExclusiveFragment();
-    }
+    in = new BufferedInputStream(in);
+    return in;
   }
 
   /*
@@ -279,27 +170,6 @@
     }
   }
 
-  /**
-   * Generates all the HTML files for one size breakdown.
-   * 
-   * @param makeTopLevelHtmlForPerm
-   * @param breakdown
-   * @param depLinker
-   * @param permutationId
-   * @throws IOException
-   */
-  private static void makeHTMLFiles(
-      MakeTopLevelHtmlForPerm makeTopLevelHtmlForPerm, SizeBreakdown breakdown,
-      DependencyLinker depLinker, String permutationId) throws IOException {
-    makeTopLevelHtmlForPerm.makePackageClassesHtmls(breakdown, depLinker,
-        permutationId);
-    makeTopLevelHtmlForPerm.makeCodeTypeClassesHtmls(breakdown, permutationId);
-    makeTopLevelHtmlForPerm.makeLiteralsClassesTableHtmls(breakdown,
-        permutationId);
-    makeTopLevelHtmlForPerm.makeBreakdownShell(breakdown, permutationId);
-    makeTopLevelHtmlForPerm.makeTopLevelShell(permutationId);
-  }
-
   private static DefaultHandler parseXMLDocumentDependencies(
       final Map<String, Map<String, String>> allDependencies) {
     DefaultHandler handler = new DefaultHandler() {
@@ -357,7 +227,193 @@
     return handler;
   }
 
-  private static DefaultHandler parseXMLDocumentSizeMap(
+  private static Map<String, String> readPermutationInfo(Settings settings)
+      throws FileNotFoundException {
+    Map<String, String> allPermsInfo = new TreeMap<String, String>();
+    if (settings.symbolMapsDir.get() == null) {
+      String permutationId = settings.storiesFileName;
+      permutationId = permutationId.replaceAll(".*/stories", "");
+      permutationId = permutationId.replaceAll("\\.xml(\\.gz)?", "");
+      allPermsInfo.put(permutationId, "");
+    } else {
+      File dir = new File(settings.symbolMapsDir.get());
+      String files[] = dir.list();
+      for (Integer i = 0; i < files.length; i++) {
+        String permFileName = settings.symbolMapsDir.get() + "/" + files[i];
+        FileReader fir = new FileReader(permFileName);
+
+        Scanner sc = new Scanner(fir);
+
+        String permutationId = "";
+        String permutationInfo = "";
+        int lineCount = 0;
+        while ((sc.hasNextLine()) && (lineCount < 2)) {
+
+          String curLine = sc.nextLine();
+          curLine = curLine.trim();
+
+          if (curLine.startsWith("# {")) {
+            curLine = curLine.replace("# {", "");
+            curLine = curLine.replace("}", "");
+            curLine = curLine.trim();
+            if (lineCount == 0) {
+              permutationId = curLine;
+            } else {
+              permutationInfo = curLine;
+            }
+            lineCount++;
+          }
+        }
+        allPermsInfo.put(permutationId, permutationInfo);
+      }
+    }
+    return allPermsInfo;
+  }
+
+  private static String soycInputFile(String soycDir, String baseName,
+      String permutationId) {
+    String name = soycDir + "/" + baseName + permutationId + ".xml.gz";
+    if (new File(name).exists()) {
+      return name;
+    }
+    return soycDir + "/" + baseName + permutationId + ".xml";
+  }
+
+  /**
+   * Global information for the current permutation being emitted.
+   */
+  private GlobalInformation globalInformation;
+
+  /**
+   * HTML emitter for the current permutation being emitted.
+   */
+  private MakeTopLevelHtmlForPerm makeTopLevelHtmlForPerm;
+
+  private final OutputDirectory outDir;
+
+  public SoycDashboard(OutputDirectory outDir) {
+    this.outDir = outDir;
+  }
+
+  public void generateCrossPermutationFiles(Map<String, String> permInfo)
+      throws IOException {
+    StaticResources.emit(outDir);
+    MakeTopLevelHtmlForPerm.makeTopLevelHtmlForAllPerms(permInfo, outDir);
+  }
+
+  public void generateForOnePermutation() throws IOException {
+    if (globalInformation.dependencies != null) {
+      makeTopLevelHtmlForPerm.makeDependenciesHtml();
+    }
+
+    if (globalInformation.getNumSplitPoints() > 0) {
+      makeTopLevelHtmlForPerm.makeSplitStatusPages();
+      makeTopLevelHtmlForPerm.makeLeftoverStatusPages();
+    }
+    for (SizeBreakdown breakdown : globalInformation.allSizeBreakdowns()) {
+      DependencyLinker linker = chooseDependencyLinker(breakdown);
+      makeHTMLFiles(makeTopLevelHtmlForPerm, breakdown, linker);
+    }
+  }
+
+  public void readDependencies(InputStream stream)
+      throws ParserConfigurationException, SAXException, IOException {
+    globalInformation.dependencies = new TreeMap<String, Map<String, String>>();
+    DefaultHandler depHandler = parseXMLDocumentDependencies(globalInformation.dependencies);
+    SAXParserFactory depFactoryMain = SAXParserFactory.newInstance();
+    depFactoryMain.setNamespaceAware(true);
+    SAXParser saxParser = depFactoryMain.newSAXParser();
+    saxParser.parse(stream, depHandler);
+  }
+
+  public void readSizeMaps(InputStream stream)
+      throws ParserConfigurationException, SAXException, IOException {
+    DefaultHandler handler = parseXMLDocumentSizeMap(globalInformation);
+    SAXParserFactory factoryMain = SAXParserFactory.newInstance();
+    factoryMain.setNamespaceAware(true);
+    SAXParser saxParser = factoryMain.newSAXParser();
+    saxParser.parse(stream, handler);
+
+    // Now clean up the information that has been read in various ways
+    globalInformation.computePackageSizes();
+
+    // add to "All Other Code" if none of the special categories apply
+    for (SizeBreakdown breakdown : globalInformation.allSizeBreakdowns()) {
+      updateAllOtherCodeType(breakdown.nameToCodeColl);
+    }
+
+    // clean up the RPC categories
+    for (SizeBreakdown breakdown : globalInformation.allSizeBreakdowns()) {
+      foldInRPCHeuristic(breakdown.nameToCodeColl);
+    }
+  }
+
+  public void readSplitPoints(InputStream stream)
+      throws ParserConfigurationException, SAXException, IOException {
+    DefaultHandler splitPointHandler = parseXMLDocumentSplitPoints();
+    SAXParserFactory splitPointsFactoryMain = SAXParserFactory.newInstance();
+    splitPointsFactoryMain.setNamespaceAware(true);
+
+    SAXParser saxParser = splitPointsFactoryMain.newSAXParser();
+    saxParser.parse(stream, splitPointHandler);
+  }
+
+  public void startNewPermutation(String permutationId) {
+    globalInformation = new GlobalInformation(permutationId);
+    makeTopLevelHtmlForPerm = new MakeTopLevelHtmlForPerm(globalInformation,
+        outDir);
+  }
+
+  private Collection<SizeBreakdown> breakdownsForFragment(Integer fragment) {
+    List<SizeBreakdown> breakdowns = new ArrayList<SizeBreakdown>();
+    breakdowns.add(globalInformation.getTotalCodeBreakdown());
+    if (fragment == 0) {
+      breakdowns.add(globalInformation.getInitialCodeBreakdown());
+    }
+    if (fragment == (globalInformation.getNumSplitPoints() + 1)) {
+      breakdowns.add(globalInformation.getLeftoversBreakdown());
+    }
+    if (fragment >= 1 && fragment <= globalInformation.getNumSplitPoints()) {
+      breakdowns.add(globalInformation.splitPointCodeBreakdown(fragment));
+    }
+    return breakdowns;
+  }
+
+  private DependencyLinker chooseDependencyLinker(SizeBreakdown breakdown) {
+    if (globalInformation.dependencies == null) {
+      // no dependencies are available
+      return new NullDependencyLinker();
+    }
+
+    if (breakdown == globalInformation.getTotalCodeBreakdown()) {
+      if (globalInformation.getNumSplitPoints() > 0) {
+        return makeTopLevelHtmlForPerm.new DependencyLinkerForTotalBreakdown();
+      } else {
+        return makeTopLevelHtmlForPerm.new DependencyLinkerForInitialCode();
+      }
+    } else if (breakdown == globalInformation.getInitialCodeBreakdown()) {
+      return makeTopLevelHtmlForPerm.new DependencyLinkerForInitialCode();
+    } else if (breakdown == globalInformation.getLeftoversBreakdown()) {
+      assert globalInformation.getNumSplitPoints() > 0;
+      return makeTopLevelHtmlForPerm.new DependencyLinkerForLeftoversFragment();
+    } else {
+      return new NullDependencyLinker();
+    }
+  }
+
+  /**
+   * Generates all the HTML files for one size breakdown.
+   */
+  private void makeHTMLFiles(MakeTopLevelHtmlForPerm makeTopLevelHtmlForPerm,
+      SizeBreakdown breakdown, DependencyLinker depLinker) throws IOException {
+    makeTopLevelHtmlForPerm.makePackageClassesHtmls(breakdown, depLinker);
+    makeTopLevelHtmlForPerm.makeCodeTypeClassesHtmls(breakdown);
+    makeTopLevelHtmlForPerm.makeLiteralsClassesTableHtmls(breakdown);
+    makeTopLevelHtmlForPerm.makeBreakdownShell(breakdown);
+    makeTopLevelHtmlForPerm.makeTopLevelShell();
+  }
+
+  private DefaultHandler parseXMLDocumentSizeMap(
       final GlobalInformation globalInformation) {
     return new DefaultHandler() {
       int fragment = -1;
@@ -393,8 +449,7 @@
           } catch (NumberFormatException e) {
             throw new FormatException(e);
           }
-          for (SizeBreakdown breakdown : breakdownsForFragment(fragment,
-              globalInformation)) {
+          for (SizeBreakdown breakdown : breakdownsForFragment(fragment)) {
             breakdown.sizeAllCode += size;
           }
         } else if (localName.compareTo("size") == 0) {
@@ -491,17 +546,14 @@
 
       private void recordSize(String refType, String ref, int size,
           GlobalInformation globalInformation) {
-        for (SizeBreakdown breakdown : breakdownsForFragment(fragment,
-            globalInformation)) {
+        for (SizeBreakdown breakdown : breakdownsForFragment(fragment)) {
           accountForSize(breakdown, refType, ref, size, globalInformation);
         }
       }
     };
   }
 
-  private static DefaultHandler parseXMLDocumentSplitPoints(
-      final GlobalInformation globalInformation) {
-
+  private DefaultHandler parseXMLDocumentSplitPoints() {
     DefaultHandler handler = new DefaultHandler() {
 
       private boolean inInitialLoadSequence = false;
@@ -558,12 +610,25 @@
     return handler;
   }
 
+  private void readFromFilesNamed(String storiesFileName,
+      String dependenciesFileName, String splitPointsFileName)
+      throws ParserConfigurationException, SAXException, IOException {
+    if (dependenciesFileName != null && new File(dependenciesFileName).exists()) {
+      readDependencies(openPossiblyGzippedFile(dependenciesFileName));
+    }
+
+    if (splitPointsFileName != null && new File(splitPointsFileName).exists()) {
+      readSplitPoints(openPossiblyGzippedFile(splitPointsFileName));
+    }
+
+    readSizeMaps(openPossiblyGzippedFile(storiesFileName));
+  }
+
   /*
    * assigns code to "all other code" if none of the special categories apply
    */
-  private static void updateAllOtherCodeType(
-      final HashMap<String, CodeCollection> nameToCodeColl,
-      GlobalInformation globalInformation) {
+  private void updateAllOtherCodeType(
+      final HashMap<String, CodeCollection> nameToCodeColl) {
     // all classes not in any of the other categories
     for (String className : globalInformation.getClassToPackage().keySet()) {
       if ((!nameToCodeColl.get("widget").classes.contains(className))
@@ -576,5 +641,4 @@
       }
     }
   }
-
 }
diff --git a/dev/core/src/com/google/gwt/soyc/StaticResources.java b/dev/core/src/com/google/gwt/soyc/StaticResources.java
new file mode 100644
index 0000000..5e63e6c
--- /dev/null
+++ b/dev/core/src/com/google/gwt/soyc/StaticResources.java
@@ -0,0 +1,61 @@
+/*
+ * 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.soyc;
+
+import com.google.gwt.soyc.io.OutputDirectory;
+import com.google.gwt.util.tools.Utility;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+
+/**
+ * This class handles static resources such as CSS and GIF files that support
+ * the generated HTML. The resources are expected to be available via this
+ * class's class loader.
+ */
+public class StaticResources {
+  /**
+   * A list of all static resources. Storing it this way allows the resources to
+   * be loaded via a Java class loader, which is often convenient. Class loaders
+   * cannot be iterated over.
+   */
+  private static String[] resourceNames = new String[] {
+      "classLevel.css", "common.css", "roundedCorners.css", "images/1bl.gif",
+      "images/1br.gif", "images/1tl.gif", "images/1tr.gif", "images/bb.gif",
+      "images/blc.gif", "images/brc.gif", "images/l.gif", "images/r.gif",
+      "images/roundedbox_lo.gif", "images/roundedbox_lu.gif",
+      "images/roundedbox_ro.gif", "images/roundedbox_ru.gif", "images/tb.gif",
+      "images/tlc.gif", "images/trc.gif",};
+
+  public static void emit(OutputDirectory outDir) throws IOException {
+    String prefix = StaticResources.class.getPackage().getName().replace('.',
+        '/')
+        + "/resources/";
+    ClassLoader loader = StaticResources.class.getClassLoader();
+    for (String resourceName : resourceNames) {
+      InputStream in = loader.getResourceAsStream(prefix + resourceName);
+      if (in == null) {
+        throw new Error("Could not find resource via my class loader: "
+            + resourceName);
+      }
+      OutputStream out = outDir.getOutputStream(resourceName);
+      Utility.streamOut(in, out, 10240);
+      in.close();
+      out.close();
+    }
+  }
+}
diff --git a/dev/core/src/com/google/gwt/soyc/io/ArtifactsOutputDirectory.java b/dev/core/src/com/google/gwt/soyc/io/ArtifactsOutputDirectory.java
new file mode 100644
index 0000000..fb774b7
--- /dev/null
+++ b/dev/core/src/com/google/gwt/soyc/io/ArtifactsOutputDirectory.java
@@ -0,0 +1,87 @@
+/*
+ * 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.soyc.io;
+
+import com.google.gwt.core.ext.linker.impl.StandardCompilationAnalysis.SoycArtifact;
+
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.OutputStream;
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * An {@link OutputDirectory} that writes its output as a list of GWT compiler
+ * artifacts.
+ */
+public class ArtifactsOutputDirectory implements OutputDirectory {
+  /**
+   * An in-memory output stream. When it is closed, its contents are saved to an
+   * artifact.
+   */
+  private class OutputStreamForArtifact extends OutputStream {
+    private static final String OUTPUT_DIRECTORY_NAME = "compile-report";
+
+    private ByteArrayOutputStream baos = new ByteArrayOutputStream();
+    private boolean closed = false;
+    private final String path;
+
+    public OutputStreamForArtifact(String path) {
+      this.path = path;
+    }
+
+    @Override
+    public void close() {
+      if (!closed) {
+        closed = true;
+        SoycArtifact newArtifact = new SoycArtifact(OUTPUT_DIRECTORY_NAME + "/"
+            + path, baos.toByteArray());
+        newArtifact.setPrivate(false);
+        artifacts.add(newArtifact);
+        baos = null;
+      }
+    }
+
+    @Override
+    public void write(byte b[]) throws IOException {
+      baos.write(b);
+    }
+
+    @Override
+    public void write(byte b[], int off, int len) throws IOException {
+      baos.write(b, off, len);
+    }
+
+    @Override
+    public void write(int b) throws IOException {
+      baos.write(b);
+    }
+  }
+
+  private List<SoycArtifact> artifacts = new ArrayList<SoycArtifact>();
+
+  /**
+   * Return the list of artifacts that have been written so far.
+   */
+  public List<SoycArtifact> getArtifacts() {
+    return artifacts;
+  }
+
+  public OutputStream getOutputStream(String path) throws IOException {
+    return new OutputStreamForArtifact(path);
+  }
+
+}
diff --git a/dev/core/src/com/google/gwt/soyc/io/FileSystemOutputDirectory.java b/dev/core/src/com/google/gwt/soyc/io/FileSystemOutputDirectory.java
new file mode 100644
index 0000000..6914c00
--- /dev/null
+++ b/dev/core/src/com/google/gwt/soyc/io/FileSystemOutputDirectory.java
@@ -0,0 +1,38 @@
+/*
+ * 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.soyc.io;
+
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.OutputStream;
+
+/**
+ * An {@link OutputDirectory} that writes directly to the file system.
+ */
+public class FileSystemOutputDirectory implements OutputDirectory {
+  private final File outDir;
+
+  public FileSystemOutputDirectory(File outDir) {
+    this.outDir = outDir;
+  }
+
+  public OutputStream getOutputStream(String path) throws IOException {
+    File outFile = new File(outDir, path);
+    outFile.getParentFile().mkdirs();
+    return new FileOutputStream(outFile);
+  }
+}
diff --git a/dev/core/src/com/google/gwt/soyc/io/OutputDirectory.java b/dev/core/src/com/google/gwt/soyc/io/OutputDirectory.java
new file mode 100644
index 0000000..e80777d
--- /dev/null
+++ b/dev/core/src/com/google/gwt/soyc/io/OutputDirectory.java
@@ -0,0 +1,28 @@
+/*
+ * 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.soyc.io;
+
+import java.io.IOException;
+import java.io.OutputStream;
+
+/**
+ * An abstraction over output directories. The SOYC dashboard writes to this
+ * interface so that it can, depending on how it is invoked, both write to the
+ * filesystem and generate GWT compiler artifacts.
+ */
+public interface OutputDirectory {
+  OutputStream getOutputStream(String path) throws IOException;
+}
diff --git a/tools/soyc-vis/classLevel.css b/dev/core/src/com/google/gwt/soyc/resources/classLevel.css
similarity index 100%
rename from tools/soyc-vis/classLevel.css
rename to dev/core/src/com/google/gwt/soyc/resources/classLevel.css
diff --git a/tools/soyc-vis/common.css b/dev/core/src/com/google/gwt/soyc/resources/common.css
similarity index 100%
rename from tools/soyc-vis/common.css
rename to dev/core/src/com/google/gwt/soyc/resources/common.css
diff --git a/tools/soyc-vis/images/1bl.gif b/dev/core/src/com/google/gwt/soyc/resources/images/1bl.gif
similarity index 100%
rename from tools/soyc-vis/images/1bl.gif
rename to dev/core/src/com/google/gwt/soyc/resources/images/1bl.gif
Binary files differ
diff --git a/tools/soyc-vis/images/1br.gif b/dev/core/src/com/google/gwt/soyc/resources/images/1br.gif
similarity index 100%
rename from tools/soyc-vis/images/1br.gif
rename to dev/core/src/com/google/gwt/soyc/resources/images/1br.gif
Binary files differ
diff --git a/tools/soyc-vis/images/1tl.gif b/dev/core/src/com/google/gwt/soyc/resources/images/1tl.gif
similarity index 100%
rename from tools/soyc-vis/images/1tl.gif
rename to dev/core/src/com/google/gwt/soyc/resources/images/1tl.gif
Binary files differ
diff --git a/tools/soyc-vis/images/1tr.gif b/dev/core/src/com/google/gwt/soyc/resources/images/1tr.gif
similarity index 100%
rename from tools/soyc-vis/images/1tr.gif
rename to dev/core/src/com/google/gwt/soyc/resources/images/1tr.gif
Binary files differ
diff --git a/tools/soyc-vis/images/bb.gif b/dev/core/src/com/google/gwt/soyc/resources/images/bb.gif
similarity index 100%
rename from tools/soyc-vis/images/bb.gif
rename to dev/core/src/com/google/gwt/soyc/resources/images/bb.gif
Binary files differ
diff --git a/tools/soyc-vis/images/blc.gif b/dev/core/src/com/google/gwt/soyc/resources/images/blc.gif
similarity index 100%
rename from tools/soyc-vis/images/blc.gif
rename to dev/core/src/com/google/gwt/soyc/resources/images/blc.gif
Binary files differ
diff --git a/tools/soyc-vis/images/brc.gif b/dev/core/src/com/google/gwt/soyc/resources/images/brc.gif
similarity index 100%
rename from tools/soyc-vis/images/brc.gif
rename to dev/core/src/com/google/gwt/soyc/resources/images/brc.gif
Binary files differ
diff --git a/tools/soyc-vis/images/l.gif b/dev/core/src/com/google/gwt/soyc/resources/images/l.gif
similarity index 100%
rename from tools/soyc-vis/images/l.gif
rename to dev/core/src/com/google/gwt/soyc/resources/images/l.gif
Binary files differ
diff --git a/tools/soyc-vis/images/r.gif b/dev/core/src/com/google/gwt/soyc/resources/images/r.gif
similarity index 100%
rename from tools/soyc-vis/images/r.gif
rename to dev/core/src/com/google/gwt/soyc/resources/images/r.gif
Binary files differ
diff --git a/tools/soyc-vis/images/roundedbox_lo.gif b/dev/core/src/com/google/gwt/soyc/resources/images/roundedbox_lo.gif
similarity index 100%
rename from tools/soyc-vis/images/roundedbox_lo.gif
rename to dev/core/src/com/google/gwt/soyc/resources/images/roundedbox_lo.gif
Binary files differ
diff --git a/tools/soyc-vis/images/roundedbox_lu.gif b/dev/core/src/com/google/gwt/soyc/resources/images/roundedbox_lu.gif
similarity index 100%
rename from tools/soyc-vis/images/roundedbox_lu.gif
rename to dev/core/src/com/google/gwt/soyc/resources/images/roundedbox_lu.gif
Binary files differ
diff --git a/tools/soyc-vis/images/roundedbox_ro.gif b/dev/core/src/com/google/gwt/soyc/resources/images/roundedbox_ro.gif
similarity index 100%
rename from tools/soyc-vis/images/roundedbox_ro.gif
rename to dev/core/src/com/google/gwt/soyc/resources/images/roundedbox_ro.gif
Binary files differ
diff --git a/tools/soyc-vis/images/roundedbox_ru.gif b/dev/core/src/com/google/gwt/soyc/resources/images/roundedbox_ru.gif
similarity index 100%
rename from tools/soyc-vis/images/roundedbox_ru.gif
rename to dev/core/src/com/google/gwt/soyc/resources/images/roundedbox_ru.gif
Binary files differ
diff --git a/tools/soyc-vis/images/tb.gif b/dev/core/src/com/google/gwt/soyc/resources/images/tb.gif
similarity index 100%
rename from tools/soyc-vis/images/tb.gif
rename to dev/core/src/com/google/gwt/soyc/resources/images/tb.gif
Binary files differ
diff --git a/tools/soyc-vis/images/tlc.gif b/dev/core/src/com/google/gwt/soyc/resources/images/tlc.gif
similarity index 100%
rename from tools/soyc-vis/images/tlc.gif
rename to dev/core/src/com/google/gwt/soyc/resources/images/tlc.gif
Binary files differ
diff --git a/tools/soyc-vis/images/trc.gif b/dev/core/src/com/google/gwt/soyc/resources/images/trc.gif
similarity index 100%
rename from tools/soyc-vis/images/trc.gif
rename to dev/core/src/com/google/gwt/soyc/resources/images/trc.gif
Binary files differ
diff --git a/tools/soyc-vis/roundedCorners.css b/dev/core/src/com/google/gwt/soyc/resources/roundedCorners.css
similarity index 100%
rename from tools/soyc-vis/roundedCorners.css
rename to dev/core/src/com/google/gwt/soyc/resources/roundedCorners.css
diff --git a/tools/soyc-vis/build.xml b/tools/soyc-vis/build.xml
index d6d4caa..8e9e24a 100644
--- a/tools/soyc-vis/build.xml
+++ b/tools/soyc-vis/build.xml
@@ -14,13 +14,9 @@
   </target>
 
   <target name="compile">
-    <mkdir dir="${javac.out}/com/google/gwt/soyc/resources/images"/>
-    <copy todir="${javac.out}/com/google/gwt/soyc/resources/images">
-      <fileset dir="images"/>
+    <copy todir="${javac.out}/com/google/gwt/soyc/resources">
+        <fileset dir="${gwt.root}/dev/core/src/com/google/gwt/soyc/resources"/>
     </copy>
-    <copy file="classLevel.css" tofile="${javac.out}/com/google/gwt/soyc/resources/classLevel.css"/>
-    <copy file="roundedCorners.css" tofile="${javac.out}/com/google/gwt/soyc/resources/roundedCorners.css"/>
-    <copy file="common.css" tofile="${javac.out}/com/google/gwt/soyc/resources/common.css"/>
   </target>
 
   <target name="build" depends="compile">