Adds permutation number to symbol maps. This permutation number is currently used by SOYC to retrieve information about each permutation's properties.
git-svn-id: https://google-web-toolkit.googlecode.com/svn/trunk@5668 8db76d5a-ed1c-0410-87a9-c151d255dfc7
diff --git a/dev/core/src/com/google/gwt/core/ext/linker/CompilationResult.java b/dev/core/src/com/google/gwt/core/ext/linker/CompilationResult.java
index a8ffdd9..ee24177 100644
--- a/dev/core/src/com/google/gwt/core/ext/linker/CompilationResult.java
+++ b/dev/core/src/com/google/gwt/core/ext/linker/CompilationResult.java
@@ -42,6 +42,11 @@
public abstract String[] getJavaScript();
/**
+ * Returns the permutation ID
+ */
+ public abstract int getPermutationId();
+
+ /**
* Provides values for {@link SelectionProperty} instances that are not
* explicitly set during the compilation phase. This method will return
* multiple mappings, one for each permutation that resulted in the
diff --git a/dev/core/src/com/google/gwt/core/ext/linker/impl/StandardCompilationResult.java b/dev/core/src/com/google/gwt/core/ext/linker/impl/StandardCompilationResult.java
index 3b2d540..131eed6 100644
--- a/dev/core/src/com/google/gwt/core/ext/linker/impl/StandardCompilationResult.java
+++ b/dev/core/src/com/google/gwt/core/ext/linker/impl/StandardCompilationResult.java
@@ -71,6 +71,8 @@
private static final DiskCache diskCache = new DiskCache();
private final long jsToken[];
+
+ private final int permutationId;
private final SortedSet<SortedMap<SelectionProperty, String>> propertyValues = new TreeSet<SortedMap<SelectionProperty, String>>(
MAP_COMPARATOR);
@@ -82,7 +84,7 @@
private final long symbolToken;
public StandardCompilationResult(String strongName, byte[][] js,
- byte[] serializedSymbolMap, StatementRanges[] statementRanges) {
+ byte[] serializedSymbolMap, StatementRanges[] statementRanges, int permutationId) {
super(StandardLinkerContext.class);
this.strongName = strongName;
jsToken = new long[js.length];
@@ -91,6 +93,7 @@
}
symbolToken = diskCache.writeByteArray(serializedSymbolMap);
this.statementRanges = statementRanges;
+ this.permutationId = permutationId;
}
/**
@@ -114,6 +117,11 @@
}
@Override
+ public int getPermutationId() {
+ return permutationId;
+ }
+
+ @Override
public SortedSet<SortedMap<SelectionProperty, String>> getPropertyMap() {
return Collections.unmodifiableSortedSet(propertyValues);
}
diff --git a/dev/core/src/com/google/gwt/core/ext/linker/impl/StandardLinkerContext.java b/dev/core/src/com/google/gwt/core/ext/linker/impl/StandardLinkerContext.java
index c93b9d3..259dbb5 100644
--- a/dev/core/src/com/google/gwt/core/ext/linker/impl/StandardLinkerContext.java
+++ b/dev/core/src/com/google/gwt/core/ext/linker/impl/StandardLinkerContext.java
@@ -351,7 +351,7 @@
if (result == null) {
result = new StandardCompilationResult(strongName, js,
permutationResult.getSerializedSymbolMap(),
- permutationResult.getStatementRanges());
+ permutationResult.getStatementRanges(), permutationResult.getPermutationId());
resultsByStrongName.put(result.getStrongName(), result);
artifacts.add(result);
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 9082a2a..3d3ed90 100644
--- a/dev/core/src/com/google/gwt/core/linker/SymbolMapsLinker.java
+++ b/dev/core/src/com/google/gwt/core/linker/SymbolMapsLinker.java
@@ -89,6 +89,9 @@
*/
protected void doWriteSymbolMap(TreeLogger logger, CompilationResult result,
PrintWriter pw) throws UnableToCompleteException {
+
+ pw.println("# { " + result.getPermutationId() + " }");
+
for (SortedMap<SelectionProperty, String> map : result.getPropertyMap()) {
pw.print("# { ");
diff --git a/dev/core/src/com/google/gwt/dev/PermutationResult.java b/dev/core/src/com/google/gwt/dev/PermutationResult.java
index c1cba6d..13ac2e2 100644
--- a/dev/core/src/com/google/gwt/dev/PermutationResult.java
+++ b/dev/core/src/com/google/gwt/dev/PermutationResult.java
@@ -36,6 +36,11 @@
byte[][] getJs();
/**
+ * The ID of the permutation.
+ */
+ int getPermutationId();
+
+ /**
* The symbol map for the permutation.
*/
byte[] getSerializedSymbolMap();
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 4c9282a..0384271 100644
--- a/dev/core/src/com/google/gwt/dev/jjs/JavaToJavaScriptCompiler.java
+++ b/dev/core/src/com/google/gwt/dev/jjs/JavaToJavaScriptCompiler.java
@@ -137,9 +137,10 @@
private final byte[][] js;
private final byte[] serializedSymbolMap;
private final StatementRanges[] statementRanges;
-
+ private final int permutationId;
+
public PermutationResultImpl(String[] js, SymbolData[] symbolMap,
- StatementRanges[] statementRanges) {
+ StatementRanges[] statementRanges, int permutationId) {
byte[][] bytes = new byte[js.length][];
for (int i = 0; i < js.length; ++i) {
bytes[i] = Util.getBytes(js[i]);
@@ -154,6 +155,7 @@
e);
}
this.statementRanges = statementRanges;
+ this.permutationId = permutationId;
}
public ArtifactSet getArtifacts() {
@@ -163,6 +165,10 @@
public byte[][] getJs() {
return js;
}
+
+ public int getPermutationId() {
+ return permutationId;
+ }
public byte[] getSerializedSymbolMap() {
return serializedSymbolMap;
@@ -322,7 +328,7 @@
}
PermutationResult toReturn = new PermutationResultImpl(js,
- makeSymbolMap(symbolTable), ranges);
+ makeSymbolMap(symbolTable), ranges, permutationId);
toReturn.getArtifacts().add(
makeSoycArtifact(logger, permutationId, jprogram, js, sourceInfoMaps));