When sharded precompiles are on, force the option "retain compilation state" to be on except for the last precompile shard. Otherwise, state is discarded that is actually needed for the next shard. Review by: scottb git-svn-id: https://google-web-toolkit.googlecode.com/svn/trunk@5207 8db76d5a-ed1c-0410-87a9-c151d255dfc7
diff --git a/dev/core/src/com/google/gwt/dev/Precompile.java b/dev/core/src/com/google/gwt/dev/Precompile.java index c03ce45..faf32c4 100644 --- a/dev/core/src/com/google/gwt/dev/Precompile.java +++ b/dev/core/src/com/google/gwt/dev/Precompile.java
@@ -497,6 +497,8 @@ } public boolean run(TreeLogger logger) throws UnableToCompleteException { + boolean originalCompilationStateRetained = options.isCompilationStateRetained(); + for (String moduleName : options.getModuleNames()) { File compilerWorkDir = options.getCompilerWorkDir(moduleName); Util.recursiveDelete(compilerWorkDir, true); @@ -555,6 +557,18 @@ module.getCompilationState(branch).refresh(branch); } + if (potentialFirstPerm + numPermsToPrecompile < potentialPermutations) { + /* + * On all iterations but the last, force retainCompilationState to + * be true. Otherwise, state will be discarded that is needed on + * later iterations. + */ + options.setCompilationStateRetained(true); + } else { + // On the last iteration, use whatever the original setting was + options.setCompilationStateRetained(originalCompilationStateRetained); + } + Precompilation precompilation = precompile(branch, options, module, actualPermutations, potentialFirstPerm, numPermsToPrecompile, options.getGenDir(), compilerWorkDir,