Revision: 7108 Author: kpro...@google.com Date: Mon Nov 23 07:38:58 2009 Log: Merges trunk revision 7104 into this branch: Makes compile report handle collapsed permutations (rather than swallowing them).
svn merge --ignore-ancestry -c 7104 https://google-web-toolkit.googlecode.com/svn/trunk . Review by: spoon http://code.google.com/p/google-web-toolkit/source/detail?r=7108 Modified: /releases/2.0/dev/core/src/com/google/gwt/core/linker/SoycReportLinker.java /releases/2.0/dev/core/src/com/google/gwt/soyc/MakeTopLevelHtmlForPerm.java /releases/2.0/dev/core/src/com/google/gwt/soyc/SoycDashboard.java ======================================= --- /releases/2.0/dev/core/src/com/google/gwt/core/linker/SoycReportLinker.java Mon Nov 2 12:44:54 2009 +++ /releases/2.0/dev/core/src/com/google/gwt/core/linker/SoycReportLinker.java Mon Nov 23 07:38:58 2009 @@ -29,7 +29,11 @@ import com.google.gwt.soyc.io.ArtifactsOutputDirectory; import java.io.IOException; +import java.util.ArrayList; +import java.util.List; import java.util.Map; +import java.util.SortedMap; +import java.util.SortedSet; import java.util.TreeMap; /** @@ -81,21 +85,21 @@ return results; } - private Map<String, String> extractPermutationDescriptions( + private Map<String, List<String>> extractPermutationDescriptions( ArtifactSet artifacts) { - Map<String, String> permDescriptions = new TreeMap<String, String>(); + Map<String, List<String>> permutationDescriptions = new TreeMap<String, List<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); + List<String> permDescList = new ArrayList<String>(); + SortedSet<SortedMap<SelectionProperty, String>> allPropertiesMap = res.getPropertyMap(); + for (SortedMap<SelectionProperty, String> propertyMap : allPropertiesMap) { + String permDesc = SymbolMapsLinker.propertyMapToString(propertyMap); + permDescList.add(permDesc); + } + permutationDescriptions.put(permId, permDescList); } - return permDescriptions; + return permutationDescriptions; } } ======================================= --- /releases/2.0/dev/core/src/com/google/gwt/soyc/MakeTopLevelHtmlForPerm.java Mon Nov 9 06:28:57 2009 +++ /releases/2.0/dev/core/src/com/google/gwt/soyc/MakeTopLevelHtmlForPerm.java Mon Nov 23 07:38:58 2009 @@ -113,18 +113,21 @@ } public static void makeTopLevelHtmlForAllPerms( - Map<String, String> allPermsInfo, OutputDirectory outDir) + Map<String, List<String>> allPermsInfo, OutputDirectory outDir) throws IOException { PrintWriter outFile = new PrintWriter(outDir.getOutputStream("index.html")); addStandardHtmlProlog(outFile, "Compile report", "Compile report", "Overview of permutations"); outFile.println("<ul>"); for (String permutationId : allPermsInfo.keySet()) { - String permutationInfo = allPermsInfo.get(permutationId); + List<String> permutationInfoList = allPermsInfo.get(permutationId); outFile.print("<li><a href=\"SoycDashboard" + "-" + permutationId - + "-index.html\">Permutation " + permutationId); - if (permutationInfo.length() > 0) { - outFile.println(" (" + permutationInfo + ")" + "</a></li>"); + + "-index.html\">Permutation " + permutationId); + if (permutationInfoList.size() > 0) { + for (String desc : permutationInfoList) { + outFile.println(" (" + desc + ")" ); + } + outFile.println("</a></li>"); } else { outFile.println("</a>"); } ======================================= --- /releases/2.0/dev/core/src/com/google/gwt/soyc/SoycDashboard.java Mon Nov 2 12:44:54 2009 +++ /releases/2.0/dev/core/src/com/google/gwt/soyc/SoycDashboard.java Mon Nov 23 07:38:58 2009 @@ -87,7 +87,7 @@ settings.out.get())); try { - Map<String, String> permInfo = readPermutationInfo(settings); + Map<String, List<String>> permInfo = readPermutationInfo(settings); SoycDashboard dashboard = new SoycDashboard(outDir); for (String permutationId : permInfo.keySet()) { dashboard.startNewPermutation(permutationId); @@ -227,14 +227,13 @@ return handler; } - private static Map<String, String> readPermutationInfo(Settings settings) + private static Map<String, List<String>> readPermutationInfo(Settings settings) throws FileNotFoundException { - Map<String, String> allPermsInfo = new TreeMap<String, String>(); + Map<String, List<String>> allPermsInfo = new TreeMap<String, List<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(); @@ -246,25 +245,31 @@ String permutationId = ""; String permutationInfo = ""; - int lineCount = 0; - while ((sc.hasNextLine()) && (lineCount < 2)) { - - String curLine = sc.nextLine(); - curLine = curLine.trim(); - - if (curLine.startsWith("# {")) { + List<String> permutationInfoList = new ArrayList<String>(); + boolean firstLine = true; + String curLine = sc.nextLine(); + curLine = curLine.trim(); + while (curLine.startsWith("# {")) { + curLine = curLine.replace("# {", ""); curLine = curLine.replace("}", ""); curLine = curLine.trim(); - if (lineCount == 0) { + if (firstLine) { permutationId = curLine; + firstLine = false; } else { - permutationInfo = curLine; - } - lineCount++; - } - } - allPermsInfo.put(permutationId, permutationInfo); + if (permutationInfo.length() > 0) { + permutationInfo += "<br>"; + } + permutationInfo += curLine; + permutationInfoList.add(curLine); + } + if (sc.hasNextLine()) { + curLine = sc.nextLine(); + curLine = curLine.trim(); + } + } + allPermsInfo.put(permutationId, permutationInfoList); } } return allPermsInfo; @@ -295,7 +300,7 @@ this.outDir = outDir; } - public void generateCrossPermutationFiles(Map<String, String> permInfo) + public void generateCrossPermutationFiles(Map<String, List<String>> permInfo) throws IOException { StaticResources.emit(outDir); MakeTopLevelHtmlForPerm.makeTopLevelHtmlForAllPerms(permInfo, outDir); -- http://groups.google.com/group/Google-Web-Toolkit-Contributors