The attached patch, relative to 1.6 r4353, renumbers the permutation IDs at
the end of the precompile phase to be consecutive and in order.  This is
important because in CompilePerms, the arguments to -perms are indices into
this array, while the output of the compiles are permutation-ID.js files.
Build tools that handle splitting compiles across compile farms may need to
be able to correlate the files produced with the arguments to -perms.

-- 
John A. Tamplin
Software Engineer (GWT), Google

--~--~---------~--~----~------------~-------~--~----~
http://groups.google.com/group/Google-Web-Toolkit-Contributors
-~----------~----~----~----~------~----~------~--~---

Index: dev/core/src/com/google/gwt/dev/Permutation.java
===================================================================
--- dev/core/src/com/google/gwt/dev/Permutation.java	(revision 4353)
+++ dev/core/src/com/google/gwt/dev/Permutation.java	(working copy)
@@ -28,7 +28,7 @@
  * Represents the state of a single permutation for compile.
  */
 public final class Permutation implements Serializable {
-  private final int id;
+  private int id;
   private final List<StaticPropertyOracle> propertyOracles = new ArrayList<StaticPropertyOracle>();
   private final SortedMap<String, String> rebindAnswers = new TreeMap<String, String>();
 
@@ -37,10 +37,26 @@
     this.propertyOracles.add(propertyOracle);
   }
 
+  /**
+   * Return the unique id for this permutation.  Note that permutation IDs
+   * are renumbered at the end of the Precompile phase so the IDs are
+   * consecutive.
+   * 
+   * @return unique ID
+   */
   public int getId() {
     return id;
   }
 
+  /**
+   * Renumber the id at the end of the Precompile phase.
+   * 
+   * @param id new permutation ID
+   */
+  public void renumberId(int id) {
+    this.id = id;
+  }
+
   public StaticPropertyOracle[] getPropertyOracles() {
     return propertyOracles.toArray(new StaticPropertyOracle[propertyOracles.size()]);
   }
Index: dev/core/src/com/google/gwt/dev/Precompile.java
===================================================================
--- dev/core/src/com/google/gwt/dev/Precompile.java	(revision 4353)
+++ dev/core/src/com/google/gwt/dev/Precompile.java	(working copy)
@@ -291,6 +291,13 @@
         }
       }
       permutations = merged.values().toArray(new Permutation[merged.size()]);
+      /*
+       * Renumber permutations so their IDs are consecutive and also
+       * correspond to the indices in the permutations array.
+       */
+      for (int i = 0; i < permutations.length; ++i) {
+        permutations[i].renumberId(i);
+      }
       return new Precompilation(unifiedAst, permutations, generatedArtifacts);
     } catch (UnableToCompleteException e) {
       // We intentionally don't pass in the exception here since the real

Reply via email to