Replace occurrences of perFileCompile with incrementalCompile Change-Id: I2d01f47c10b66597821e7e1bc0da1861304a89fa
diff --git a/dev/codeserver/java/com/google/gwt/dev/codeserver/CompilerOptionsImpl.java b/dev/codeserver/java/com/google/gwt/dev/codeserver/CompilerOptionsImpl.java index bcc8aa2..c8c1bf7 100644 --- a/dev/codeserver/java/com/google/gwt/dev/codeserver/CompilerOptionsImpl.java +++ b/dev/codeserver/java/com/google/gwt/dev/codeserver/CompilerOptionsImpl.java
@@ -35,7 +35,7 @@ */ class CompilerOptionsImpl extends UnmodifiableCompilerOptions { private final CompileDir compileDir; - private final boolean compilePerFile; + private final boolean incremental; private final boolean failOnError; private final TreeLogger.Type logLevel; private final List<String> moduleNames; @@ -46,7 +46,7 @@ CompilerOptionsImpl(CompileDir compileDir, String moduleName, Options options) { this.compileDir = compileDir; - this.compilePerFile = options.shouldCompilePerFile(); + this.incremental = options.isIncrementalCompileEnabled(); this.moduleNames = Lists.newArrayList(moduleName); this.sourceLevel = options.getSourceLevel(); this.failOnError = options.isFailOnError(); @@ -272,8 +272,8 @@ } @Override - public boolean shouldCompilePerFile() { - return compilePerFile; + public boolean isIncrementalCompileEnabled() { + return incremental; } @Override @@ -283,7 +283,7 @@ @Override public boolean shouldJDTInlineCompileTimeConstants() { - return !shouldCompilePerFile(); + return !isIncrementalCompileEnabled(); } @Override
diff --git a/dev/codeserver/java/com/google/gwt/dev/codeserver/JsonExporter.java b/dev/codeserver/java/com/google/gwt/dev/codeserver/JsonExporter.java index d61ca7f..7a376da 100644 --- a/dev/codeserver/java/com/google/gwt/dev/codeserver/JsonExporter.java +++ b/dev/codeserver/java/com/google/gwt/dev/codeserver/JsonExporter.java
@@ -152,9 +152,7 @@ private JsonArray exportWarnings() { JsonArray out = new JsonArray(); - if (options.shouldCompilePerFile()) { - out.add("-XcompilePerFile is not done yet. Generators might not be run when needed."); - } + // Add warnings if any return out; }
diff --git a/dev/codeserver/java/com/google/gwt/dev/codeserver/Options.java b/dev/codeserver/java/com/google/gwt/dev/codeserver/Options.java index 4e4409d..dc03310 100644 --- a/dev/codeserver/java/com/google/gwt/dev/codeserver/Options.java +++ b/dev/codeserver/java/com/google/gwt/dev/codeserver/Options.java
@@ -105,12 +105,12 @@ } if (incremental && !noPrecompile) { - System.out.println("Turning off precompile in compilePerFile mode."); + System.out.println("Turning off precompile in incremental mode."); noPrecompile = true; } // Set some tags automatically for migration tracking. - if (shouldCompilePerFile()) { + if (isIncrementalCompileEnabled()) { addTags("incremental_on"); } else { addTags("incremental_off"); @@ -206,7 +206,7 @@ * Compiles faster by creating a JavaScript file per class. Can't be turned on at the same time as * shouldCompileIncremental(). */ - boolean shouldCompilePerFile() { + boolean isIncrementalCompileEnabled() { return incremental; } @@ -302,12 +302,12 @@ registerHandler(new WorkDirFlag()); registerHandler(new ArgHandlerIncrementalCompile(new OptionIncrementalCompile() { @Override - public boolean shouldCompilePerFile() { + public boolean isIncrementalCompileEnabled() { return incremental; } @Override - public void setCompilePerFile(boolean enabled) { + public void setIncrementalCompileEnabled(boolean enabled) { incremental = enabled; } }));
diff --git a/dev/codeserver/java/com/google/gwt/dev/codeserver/Recompiler.java b/dev/codeserver/java/com/google/gwt/dev/codeserver/Recompiler.java index 2086185..565abed 100644 --- a/dev/codeserver/java/com/google/gwt/dev/codeserver/Recompiler.java +++ b/dev/codeserver/java/com/google/gwt/dev/codeserver/Recompiler.java
@@ -353,7 +353,7 @@ private MinimalRebuildCache getOrCreateMinimalRebuildCache( Map<String, String> bindingProperties) { - if (!options.shouldCompilePerFile()) { + if (!options.isIncrementalCompileEnabled()) { return new NullRebuildCache(); } @@ -440,7 +440,7 @@ maybeOverrideConfig(moduleDef, "propertiesJs", "com/google/gwt/core/ext/linker/impl/properties.js"); - if (options.shouldCompilePerFile()) { + if (options.isIncrementalCompileEnabled()) { // CSSResourceGenerator needs to produce stable, unique naming for its input. // Currently on default settings CssResourceGenerator's obfuscation depends on // whole world knowledge and thus will produce collision in obfuscated mode, since in
diff --git a/dev/codeserver/java/com/google/gwt/dev/codeserver/UnmodifiableCompilerOptions.java b/dev/codeserver/java/com/google/gwt/dev/codeserver/UnmodifiableCompilerOptions.java index 50af9bf..7820658 100644 --- a/dev/codeserver/java/com/google/gwt/dev/codeserver/UnmodifiableCompilerOptions.java +++ b/dev/codeserver/java/com/google/gwt/dev/codeserver/UnmodifiableCompilerOptions.java
@@ -71,7 +71,7 @@ } @Override - public void setCompilePerFile(boolean enabled) { + public void setIncrementalCompileEnabled(boolean enabled) { throw new UnsupportedOperationException(); }
diff --git a/dev/core/src/com/google/gwt/dev/CompilePerms.java b/dev/core/src/com/google/gwt/dev/CompilePerms.java index 9b94836..7a27b99 100644 --- a/dev/core/src/com/google/gwt/dev/CompilePerms.java +++ b/dev/core/src/com/google/gwt/dev/CompilePerms.java
@@ -244,7 +244,7 @@ File compilerWorkDir, Permutation[] perms, PrecompileTaskOptions options) { List<PersistenceBackedObject<PermutationResult>> toReturn = Lists.newArrayList(); for (int i = 0; i < perms.length; ++i) { - if (options.shouldCompilePerFile()) { + if (options.isIncrementalCompileEnabled()) { toReturn.add(new MemoryBackedObject<PermutationResult>(PermutationResult.class)); } else { File f = makePermFilename(compilerWorkDir, perms[i].getId());
diff --git a/dev/core/src/com/google/gwt/dev/Compiler.java b/dev/core/src/com/google/gwt/dev/Compiler.java index 235b4b0..11e59a1 100644 --- a/dev/core/src/com/google/gwt/dev/Compiler.java +++ b/dev/core/src/com/google/gwt/dev/Compiler.java
@@ -136,7 +136,7 @@ private final CompilerOptionsImpl options; public Compiler(CompilerOptions compilerOptions) { - this(compilerOptions, compilerOptions.shouldCompilePerFile() ? new MinimalRebuildCache() + this(compilerOptions, compilerOptions.isIncrementalCompileEnabled() ? new MinimalRebuildCache() : new NullRebuildCache()); } @@ -168,7 +168,7 @@ options.getExtraDir() == null) { options.setExtraDir(new File("extras")); } - if (options.shouldCompilePerFile()) { + if (options.isIncrementalCompileEnabled()) { // Disable options that disrupt contiguous output JS source per class. options.setClusterSimilarFunctions(false); options.setOptimizationLevel(OptionOptimize.OPTIMIZE_LEVEL_DRAFT);
diff --git a/dev/core/src/com/google/gwt/dev/DevMode.java b/dev/core/src/com/google/gwt/dev/DevMode.java index fabcce2..d8189a3 100644 --- a/dev/core/src/com/google/gwt/dev/DevMode.java +++ b/dev/core/src/com/google/gwt/dev/DevMode.java
@@ -111,7 +111,7 @@ options.setSuperDevMode(value); // Superdev uses incremental by default if (options.isSuperDevMode()) { - options.setCompilePerFile(true); + options.setIncrementalCompileEnabled(true); } return true; }
diff --git a/dev/core/src/com/google/gwt/dev/Precompile.java b/dev/core/src/com/google/gwt/dev/Precompile.java index 88fa711..aeceddb 100644 --- a/dev/core/src/com/google/gwt/dev/Precompile.java +++ b/dev/core/src/com/google/gwt/dev/Precompile.java
@@ -136,7 +136,7 @@ PropertyPermutations allPermutations = new PropertyPermutations( compilerContext.getModule().getProperties(), compilerContext.getModule().getActiveLinkerNames()); - if (compilerContext.getOptions().shouldCompilePerFile() && allPermutations.size() > 1) { + if (compilerContext.getOptions().isIncrementalCompileEnabled() && allPermutations.size() > 1) { logger.log(TreeLogger.ERROR, "Current binding properties are expanding to more than one permutation " + "but per-file compilation requires that each compile operate on only one permutation."); @@ -248,7 +248,7 @@ try { ModuleDef module = compilerContext.getModule(); PrecompileTaskOptions jjsOptions = compilerContext.getOptions(); - if (jjsOptions.shouldCompilePerFile()) { + if (jjsOptions.isIncrementalCompileEnabled()) { compilerContext.getMinimalRebuildCache().recordDiskSourceResources(module); compilerContext.getMinimalRebuildCache().recordBuildResources(module); }
diff --git a/dev/core/src/com/google/gwt/dev/PrecompileTaskOptionsImpl.java b/dev/core/src/com/google/gwt/dev/PrecompileTaskOptionsImpl.java index c6ac113..68f6105 100644 --- a/dev/core/src/com/google/gwt/dev/PrecompileTaskOptionsImpl.java +++ b/dev/core/src/com/google/gwt/dev/PrecompileTaskOptionsImpl.java
@@ -256,8 +256,8 @@ } @Override - public void setCompilePerFile(boolean enabled) { - jjsOptions.setCompilePerFile(enabled); + public void setIncrementalCompileEnabled(boolean enabled) { + jjsOptions.setIncrementalCompileEnabled(enabled); } @Override @@ -431,8 +431,8 @@ } @Override - public boolean shouldCompilePerFile() { - return jjsOptions.shouldCompilePerFile(); + public boolean isIncrementalCompileEnabled() { + return jjsOptions.isIncrementalCompileEnabled(); } @Override
diff --git a/dev/core/src/com/google/gwt/dev/javac/CompilationStateBuilder.java b/dev/core/src/com/google/gwt/dev/javac/CompilationStateBuilder.java index 3129c333..c74dfbd 100644 --- a/dev/core/src/com/google/gwt/dev/javac/CompilationStateBuilder.java +++ b/dev/core/src/com/google/gwt/dev/javac/CompilationStateBuilder.java
@@ -641,7 +641,7 @@ compilerContext.getMinimalRebuildCache().addSourceCompilationUnitName( builder.getTypeName()); } - if (compilerContext.getOptions().shouldCompilePerFile()) { + if (compilerContext.getOptions().isIncrementalCompileEnabled()) { compilerContext.getMinimalRebuildCache().recordGeneratedUnits(generatedUnits); } compilationState.incrementGeneratedSourceCount(builders.size() + cachedUnits.size());
diff --git a/dev/core/src/com/google/gwt/dev/jjs/JJSOptionsImpl.java b/dev/core/src/com/google/gwt/dev/jjs/JJSOptionsImpl.java index 8f7d63f..a0a9ebd 100644 --- a/dev/core/src/com/google/gwt/dev/jjs/JJSOptionsImpl.java +++ b/dev/core/src/com/google/gwt/dev/jjs/JJSOptionsImpl.java
@@ -31,7 +31,7 @@ private boolean aggressivelyOptimize = true; private boolean closureCompilerEnabled; private boolean clusterSimilarFunctions = true; - private boolean compilePerFile = false; + private boolean incrementalCompile = false; private boolean compilerMetricsEnabled = false; private boolean disableCastChecking = false; private boolean disableClassMetadata = false; @@ -72,7 +72,7 @@ setClassMetadataDisabled(other.isClassMetadataDisabled()); setClosureCompilerEnabled(other.isClosureCompilerEnabled()); setClusterSimilarFunctions(other.shouldClusterSimilarFunctions()); - setCompilePerFile(other.shouldCompilePerFile()); + setIncrementalCompileEnabled(other.isIncrementalCompileEnabled()); setCompilerMetricsEnabled(other.isCompilerMetricsEnabled()); setEnableAssertions(other.isEnableAssertions()); setFragmentCount(other.getFragmentCount()); @@ -239,8 +239,8 @@ } @Override - public void setCompilePerFile(boolean enabled) { - compilePerFile = enabled; + public void setIncrementalCompileEnabled(boolean enabled) { + incrementalCompile = enabled; } @Override @@ -364,8 +364,8 @@ } @Override - public boolean shouldCompilePerFile() { - return compilePerFile; + public boolean isIncrementalCompileEnabled() { + return incrementalCompile; } @Override @@ -375,7 +375,7 @@ @Override public boolean shouldJDTInlineCompileTimeConstants() { - return !shouldCompilePerFile(); + return !isIncrementalCompileEnabled(); } @Override
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 1213f51..6b51c57 100644 --- a/dev/core/src/com/google/gwt/dev/jjs/JavaToJavaScriptCompiler.java +++ b/dev/core/src/com/google/gwt/dev/jjs/JavaToJavaScriptCompiler.java
@@ -372,7 +372,7 @@ } private void maybeRecordTypeReferences(boolean onlyUpdate) { - if (options.shouldCompilePerFile()) { + if (options.isIncrementalCompileEnabled()) { // Per file compilation needs the type reference graph to construct the set of reachable // types when linking. TypeReferencesRecorder.exec(jprogram, getMinimalRebuildCache(),onlyUpdate); @@ -455,7 +455,7 @@ * compile. */ private void maybeAddGeneratedArtifacts(PermutationResult permutationResult) { - if (options.shouldCompilePerFile()) { + if (options.isIncrementalCompileEnabled()) { permutationResult.addArtifacts( compilerContext.getMinimalRebuildCache().getGeneratedArtifacts()); } @@ -543,7 +543,7 @@ * Cut generated JS up on class boundaries and re-link the source (possibly making use of * source from previous compiles, thus making it possible to perform partial recompiles). */ - if (options.shouldCompilePerFile()) { + if (options.isIncrementalCompileEnabled()) { transformer = new JsTypeLinker(logger, transformer, v.getClassRanges(), v.getProgramClassRange(), getMinimalRebuildCache(), jprogram.typeOracle); transformer.exec(); @@ -864,7 +864,7 @@ } private Map<JsName, JsLiteral> runPrettyNamer(ConfigProps config) throws IllegalNameException { - if (compilerContext.getOptions().shouldCompilePerFile()) { + if (compilerContext.getOptions().isIncrementalCompileEnabled()) { JsPersistentPrettyNamer.exec(jsProgram, config, compilerContext.getMinimalRebuildCache().getPersistentPrettyNamerState()); return null; @@ -1053,7 +1053,7 @@ // Free up memory. rpo.clear(); - Set<String> deletedTypeNames = options.shouldCompilePerFile() + Set<String> deletedTypeNames = options.isIncrementalCompileEnabled() ? getMinimalRebuildCache().computeDeletedTypeNames() : Sets.<String> newHashSet(); jprogram.typeOracle.computeBeforeAST(StandardTypes.createFrom(jprogram), jprogram.getDeclaredTypes(), jprogram.getModuleDeclaredTypes(), deletedTypeNames); @@ -1192,7 +1192,7 @@ } private void recordJsoTypes(TypeOracle typeOracle) { - if (!options.shouldCompilePerFile()) { + if (!options.isIncrementalCompileEnabled()) { return; }
diff --git a/dev/core/src/com/google/gwt/dev/jjs/MonolithicJavaToJavaScriptCompiler.java b/dev/core/src/com/google/gwt/dev/jjs/MonolithicJavaToJavaScriptCompiler.java index 1e8fcec..cecea27 100644 --- a/dev/core/src/com/google/gwt/dev/jjs/MonolithicJavaToJavaScriptCompiler.java +++ b/dev/core/src/com/google/gwt/dev/jjs/MonolithicJavaToJavaScriptCompiler.java
@@ -99,7 +99,7 @@ LongEmulationNormalizer.exec(jprogram); TypeCoercionNormalizer.exec(jprogram); - if (options.shouldCompilePerFile()) { + if (options.isIncrementalCompileEnabled()) { // Per file compilation reuses type JS even as references (like casts) in other files // change, which means all legal casts need to be allowed now before they are actually // used later. @@ -120,8 +120,8 @@ return ResolveRuntimeTypeReferences.IntoStringLiterals.exec(jprogram); } else { TypeOrder typeIdOrder = - options.shouldCompilePerFile() ? TypeOrder.ALPHABETICAL : TypeOrder.FREQUENCY; - IntTypeIdGenerator typeIdGenerator = options.shouldCompilePerFile() + options.isIncrementalCompileEnabled() ? TypeOrder.ALPHABETICAL : TypeOrder.FREQUENCY; + IntTypeIdGenerator typeIdGenerator = options.isIncrementalCompileEnabled() ? compilerContext.getMinimalRebuildCache().getIntTypeIdGenerator() : new IntTypeIdGenerator(); return ResolveRuntimeTypeReferences.IntoIntLiterals.exec(jprogram, typeIdOrder,
diff --git a/dev/core/src/com/google/gwt/dev/jjs/impl/GenerateJavaScriptAST.java b/dev/core/src/com/google/gwt/dev/jjs/impl/GenerateJavaScriptAST.java index 10ef6d3..acc97c0 100644 --- a/dev/core/src/com/google/gwt/dev/jjs/impl/GenerateJavaScriptAST.java +++ b/dev/core/src/com/google/gwt/dev/jjs/impl/GenerateJavaScriptAST.java
@@ -3400,8 +3400,8 @@ this.optimize = compilerContext.getOptions().getOptimizationLevel() > OptionOptimize.OPTIMIZE_LEVEL_DRAFT; this.hasWholeWorldKnowledge = compilerContext.shouldCompileMonolithic() - && !compilerContext.getOptions().shouldCompilePerFile(); - this.compilePerFile = compilerContext.getOptions().shouldCompilePerFile(); + && !compilerContext.getOptions().isIncrementalCompileEnabled(); + this.compilePerFile = compilerContext.getOptions().isIncrementalCompileEnabled(); this.modularCompile = !compilerContext.shouldCompileMonolithic(); this.symbolTable = symbolTable; this.typeIdsByType = typeIdsByType;
diff --git a/dev/core/src/com/google/gwt/dev/jjs/impl/UnifyAst.java b/dev/core/src/com/google/gwt/dev/jjs/impl/UnifyAst.java index 2c5adb1..e5c4410 100644 --- a/dev/core/src/com/google/gwt/dev/jjs/impl/UnifyAst.java +++ b/dev/core/src/com/google/gwt/dev/jjs/impl/UnifyAst.java
@@ -464,7 +464,7 @@ // could occur between the two stages and leave the cache in an invalid state. Switch to a // transactionally safe update pattern like always updating a copy and swapping out the // original for the copy at the end of a successful compile. - if (compilePerFile) { + if (incrementalCompile) { // If this is the first time we've rebound this type during this compile. if (reboundTypeNames.add(reboundTypeName)) { // The rebinding of this type will accumulate rebound type to input resource associations, @@ -480,13 +480,13 @@ List<String> answers; try { answers = Lists.create(rpo.getAllPossibleRebindAnswers(logger, reqType)); - if (compilePerFile) { + if (incrementalCompile) { // Accumulate generated artifacts so that they can be output on recompiles even if no // generators are run. minimalRebuildCache.addGeneratedArtifacts(rpo.getGeneratorContext().getArtifacts()); } rpo.getGeneratorContext().finish(logger); - if (compilePerFile) { + if (incrementalCompile) { // There may be more types known to be modified after Generator execution, which would // mean the previous stale types calculation was too small. Redo it. staleTypeNames = @@ -699,12 +699,12 @@ private NameBasedTypeLocator internalNameBasedTypeLocator; private MinimalRebuildCache minimalRebuildCache; - private boolean compilePerFile; + private boolean incrementalCompile; private boolean isLibraryCompile; public UnifyAst(TreeLogger logger, CompilerContext compilerContext, JProgram program, JsProgram jsProgram, RebindPermutationOracle rpo) { - this.compilePerFile = compilerContext.getOptions().shouldCompilePerFile(); + this.incrementalCompile = compilerContext.getOptions().isIncrementalCompileEnabled(); this.isLibraryCompile = !compilerContext.shouldCompileMonolithic(); this.logger = logger; @@ -717,7 +717,7 @@ this.compiledClassesBySourceName = compilationState.getClassFileMapBySource(); initializeNameBasedLocators(); this.minimalRebuildCache = compilerContext.getMinimalRebuildCache(); - if (compilePerFile) { + if (incrementalCompile) { this.staleTypeNames = minimalRebuildCache.computeAndClearStaleTypesCache(logger, program.typeOracle); checkPreambleTypesStillFresh(logger); @@ -803,7 +803,7 @@ } } - if (compilePerFile) { + if (incrementalCompile) { fullFlowIntoRemainingStaleTypes(); } else if (isLibraryCompile) { // Trace execution from all types supplied as source and resolve references. @@ -866,7 +866,7 @@ mainLoop(); - if (compilePerFile) { + if (incrementalCompile) { logger.log(TreeLogger.INFO, "Unification traversed " + liveFieldsAndMethods.size() + " fields and methods and " + program.getDeclaredTypes().size() + " types. " + program.getModuleDeclaredTypes().size() @@ -987,7 +987,7 @@ } // Staleness calculations need to be able to trace from CompilationUnit name to the names of // immediately nested types. So record those associations now. - if (compilePerFile) { + if (incrementalCompile) { compilerContext.getMinimalRebuildCache().recordNestedTypeNamesPerType(unit); } // TODO(zundel): ask for a recompile if deserialization fails? @@ -996,7 +996,7 @@ for (JDeclaredType t : types) { program.addType(t); // If we're compiling per file and we already have currently valid output for this type. - if (compilePerFile && !needsNewJs(t)) { + if (incrementalCompile && !needsNewJs(t)) { // Then make sure we don't output new Js for this type. program.addReferenceOnlyType(t); } @@ -1005,7 +1005,7 @@ resolveType(t); } // When compiling per file. - if (compilePerFile) { + if (incrementalCompile) { // It's possible that a users' edits have made a type referenceable that was not previously // referenceable. for (JDeclaredType type : types) {
diff --git a/dev/core/src/com/google/gwt/dev/shell/SuperDevListener.java b/dev/core/src/com/google/gwt/dev/shell/SuperDevListener.java index 7c47f89..177c5dc 100644 --- a/dev/core/src/com/google/gwt/dev/shell/SuperDevListener.java +++ b/dev/core/src/com/google/gwt/dev/shell/SuperDevListener.java
@@ -93,7 +93,7 @@ args.add("-XjsInteropMode"); args.add(options.getJsInteropMode().toString()); } - if (!options.shouldCompilePerFile()) { + if (!options.isIncrementalCompileEnabled()) { args.add("-noincremental"); } for (String mod : options.getModuleNames()) {
diff --git a/dev/core/src/com/google/gwt/dev/util/arg/ArgHandlerIncrementalCompile.java b/dev/core/src/com/google/gwt/dev/util/arg/ArgHandlerIncrementalCompile.java index 924efc0..1f822ac 100644 --- a/dev/core/src/com/google/gwt/dev/util/arg/ArgHandlerIncrementalCompile.java +++ b/dev/core/src/com/google/gwt/dev/util/arg/ArgHandlerIncrementalCompile.java
@@ -42,12 +42,12 @@ @Override public boolean setFlag(boolean value) { - option.setCompilePerFile(value); + option.setIncrementalCompileEnabled(value); return true; } @Override public boolean getDefaultValue() { - return option.shouldCompilePerFile(); + return option.isIncrementalCompileEnabled(); } }
diff --git a/dev/core/src/com/google/gwt/dev/util/arg/OptionIncrementalCompile.java b/dev/core/src/com/google/gwt/dev/util/arg/OptionIncrementalCompile.java index da8d3b1..759d4e6 100644 --- a/dev/core/src/com/google/gwt/dev/util/arg/OptionIncrementalCompile.java +++ b/dev/core/src/com/google/gwt/dev/util/arg/OptionIncrementalCompile.java
@@ -25,10 +25,10 @@ * Whether monolithic recompiles should process only changed files and construct JS output by * linking old and new JS on a per class basis. */ - boolean shouldCompilePerFile(); + boolean isIncrementalCompileEnabled(); /** * Sets whether or not monolithic recompiles should process only changed files. */ - void setCompilePerFile(boolean enabled); + void setIncrementalCompileEnabled(boolean enabled); }
diff --git a/dev/core/test/com/google/gwt/dev/CompilerTest.java b/dev/core/test/com/google/gwt/dev/CompilerTest.java index 44621a3..4328139 100644 --- a/dev/core/test/com/google/gwt/dev/CompilerTest.java +++ b/dev/core/test/com/google/gwt/dev/CompilerTest.java
@@ -568,7 +568,7 @@ public void testAllValidArgs() { assertProcessSuccess(argProcessor, new String[] {"-logLevel", "DEBUG", "-style", "PRETTY", "-ea", "-XdisableAggressiveOptimization", "-gen", "myGen", - "-war", "myWar", "-workDir", "myWork", "-extra", "myExtra", "-XcompilePerFile", + "-war", "myWar", "-workDir", "myWork", "-extra", "myExtra", "-incremental", "-localWorkers", "2", "-sourceLevel", "1.7", "c.g.g.h.H", "my.Module"}); assertEquals(new File("myGen").getAbsoluteFile(), @@ -587,7 +587,7 @@ assertFalse(options.shouldOptimizeDataflow()); assertFalse(options.shouldOrdinalizeEnums()); assertFalse(options.shouldRemoveDuplicateFunctions()); - assertTrue(options.shouldCompilePerFile()); + assertTrue(options.isIncrementalCompileEnabled()); assertEquals(SourceLevel.JAVA7, options.getSourceLevel()); @@ -613,7 +613,7 @@ assertTrue(options.shouldOptimizeDataflow()); assertTrue(options.shouldOrdinalizeEnums()); assertTrue(options.shouldRemoveDuplicateFunctions()); - assertFalse(options.shouldCompilePerFile()); + assertFalse(options.isIncrementalCompileEnabled()); assertEquals(1, options.getLocalWorkers()); @@ -679,120 +679,124 @@ // TODO(stalcup): add recompile tests for file deletion. - public void testPerFileRecompile_noop() throws UnableToCompleteException, IOException, + public void testIncrementalRecompile_noop() throws UnableToCompleteException, IOException, InterruptedException { - checkPerFileRecompile_noop(JsOutputOption.PRETTY); - checkPerFileRecompile_noop(JsOutputOption.DETAILED); + checkIncrementalRecompile_noop(JsOutputOption.PRETTY); + checkIncrementalRecompile_noop(JsOutputOption.DETAILED); } - public void testPerFileRecompile_dateStampChange() throws UnableToCompleteException, IOException, + public void testIncrementalRecompile_dateStampChange() throws UnableToCompleteException, + IOException, InterruptedException { - checkPerFileRecompile_dateStampChange(JsOutputOption.PRETTY); - checkPerFileRecompile_dateStampChange(JsOutputOption.DETAILED); + checkIncrementalRecompile_dateStampChange(JsOutputOption.PRETTY); + checkIncrementalRecompile_dateStampChange(JsOutputOption.DETAILED); } - public void testPerFileRecompile_superClassOrder() throws UnableToCompleteException, IOException, + public void testIncrementalRecompile_superClassOrder() throws UnableToCompleteException, + IOException, InterruptedException { // Linked output is sorted alphabetically except that super-classes come before sub-classes. If // on recompile a sub-class -> super-class relationship is lost then a sub-class with an // alphabetically earlier name might start linking out before the super-class. - checkPerFileRecompile_superClassOrder(JsOutputOption.PRETTY); - checkPerFileRecompile_superClassOrder(JsOutputOption.DETAILED); + checkIncrementalRecompile_superClassOrder(JsOutputOption.PRETTY); + checkIncrementalRecompile_superClassOrder(JsOutputOption.DETAILED); } - public void testPerFileRecompile_deterministicUiBinder() throws UnableToCompleteException, + public void testIncrementalRecompile_deterministicUiBinder() throws UnableToCompleteException, IOException, InterruptedException { - checkPerFileRecompile_deterministicUiBinder(JsOutputOption.PRETTY); - checkPerFileRecompile_deterministicUiBinder(JsOutputOption.DETAILED); + checkIncrementalRecompile_deterministicUiBinder(JsOutputOption.PRETTY); + checkIncrementalRecompile_deterministicUiBinder(JsOutputOption.DETAILED); } - public void testPerFileRecompile_uiBinderCssChange() throws UnableToCompleteException, + public void testIncrementalRecompile_uiBinderCssChange() throws UnableToCompleteException, IOException, InterruptedException { - checkPerFileRecompile_uiBinderCssChange(JsOutputOption.PRETTY); - checkPerFileRecompile_uiBinderCssChange(JsOutputOption.DETAILED); + checkIncrementalRecompile_uiBinderCssChange(JsOutputOption.PRETTY); + checkIncrementalRecompile_uiBinderCssChange(JsOutputOption.DETAILED); } - public void testPerFileRecompile_unstableGeneratorReferencesModifiedType() + public void testIncrementalRecompile_unstableGeneratorReferencesModifiedType() throws UnableToCompleteException, IOException, InterruptedException { - checkPerFileRecompile_unstableGeneratorReferencesModifiedType(JsOutputOption.PRETTY); - checkPerFileRecompile_unstableGeneratorReferencesModifiedType(JsOutputOption.DETAILED); + checkIncrementalRecompile_unstableGeneratorReferencesModifiedType(JsOutputOption.PRETTY); + checkIncrementalRecompile_unstableGeneratorReferencesModifiedType(JsOutputOption.DETAILED); } - public void testPerFileRecompile_functionSignatureChange() throws UnableToCompleteException, + public void testIncrementalRecompile_functionSignatureChange() throws UnableToCompleteException, IOException, InterruptedException { // Not testing recompile equality with Pretty output since the Pretty namer's behavior is order // dependent, and while still correct, will come out different in a recompile with this change // versus a from scratch compile with this change. - checkPerFileRecompile_functionSignatureChange(JsOutputOption.DETAILED); + checkIncrementalRecompile_functionSignatureChange(JsOutputOption.DETAILED); } - public void testPerFileRecompile_compileTimeConstantChange() throws UnableToCompleteException, + public void testIncrementalRecompile_compileTimeConstantChange() throws UnableToCompleteException, IOException, InterruptedException { - checkPerFileRecompile_compileTimeConstantChange(JsOutputOption.DETAILED); - checkPerFileRecompile_compileTimeConstantChange(JsOutputOption.PRETTY); + checkIncrementalRecompile_compileTimeConstantChange(JsOutputOption.DETAILED); + checkIncrementalRecompile_compileTimeConstantChange(JsOutputOption.PRETTY); } - public void testPerFileRecompile_packagePrivateDispatch() throws UnableToCompleteException, + public void testIncrementalRecompile_packagePrivateDispatch() throws UnableToCompleteException, IOException, InterruptedException { - checkPerFileRecompile_packagePrivateOverride(JsOutputOption.PRETTY); - checkPerFileRecompile_packagePrivateOverride(JsOutputOption.DETAILED); + checkIncrementalRecompile_packagePrivateOverride(JsOutputOption.PRETTY); + checkIncrementalRecompile_packagePrivateOverride(JsOutputOption.DETAILED); } - public void testPerFileRecompile_regularClassMadeIntoJsoClass() throws UnableToCompleteException, + public void testIncrementalRecompile_regularClassMadeIntoJsoClass() + throws UnableToCompleteException, IOException, InterruptedException { // Not testing recompile equality with Pretty output since the Pretty namer's behavior is order // dependent, and while still correct, will come out different in a recompile with this change // versus a from scratch compile with this change. - checkPerFileRecompile_regularClassMadeIntoJsoClass(JsOutputOption.DETAILED); + checkIncrementalRecompile_regularClassMadeIntoJsoClass(JsOutputOption.DETAILED); } - public void testPerFileRecompile_typeHierarchyChange() throws UnableToCompleteException, + public void testIncrementalRecompile_typeHierarchyChange() throws UnableToCompleteException, IOException, InterruptedException { - checkPerFileRecompile_typeHierarchyChange(JsOutputOption.PRETTY); - checkPerFileRecompile_typeHierarchyChange(JsOutputOption.DETAILED); + checkIncrementalRecompile_typeHierarchyChange(JsOutputOption.PRETTY); + checkIncrementalRecompile_typeHierarchyChange(JsOutputOption.DETAILED); } - public void testPerFileRecompile_devirtualizeUnchangedJso() throws UnableToCompleteException, + public void testIncrementalRecompile_devirtualizeUnchangedJso() throws UnableToCompleteException, IOException, InterruptedException { // Tests that a JSO calls through interfaces are correctly devirtualized when compiling per file // and the JSOs nor their single impl interfaces are not stale. - checkPerFileRecompile_devirtualizeUnchangedJso(JsOutputOption.PRETTY); - checkPerFileRecompile_devirtualizeUnchangedJso(JsOutputOption.DETAILED); + checkIncrementalRecompile_devirtualizeUnchangedJso(JsOutputOption.PRETTY); + checkIncrementalRecompile_devirtualizeUnchangedJso(JsOutputOption.DETAILED); } - public void testPerFileRecompile_multipleClassGenerator() throws UnableToCompleteException, + public void testIncrementalRecompile_multipleClassGenerator() throws UnableToCompleteException, IOException, InterruptedException { // Tests that a Generated type that is not directly referenced from the rebound GWT.create() // call is still marked stale, regenerated, retraversed and output as JS. - checkPerFileRecompile_multipleClassGenerator(JsOutputOption.PRETTY); - checkPerFileRecompile_multipleClassGenerator(JsOutputOption.DETAILED); + checkIncrementalRecompile_multipleClassGenerator(JsOutputOption.PRETTY); + checkIncrementalRecompile_multipleClassGenerator(JsOutputOption.DETAILED); } - public void testPerFileRecompile_singleJsoIntfDispatchChange() throws UnableToCompleteException, + public void testIncrementalRecompile_singleJsoIntfDispatchChange() + throws UnableToCompleteException, IOException, InterruptedException { // Not testing recompile equality with Pretty output since the Pretty namer's behavior is order // dependent, and while still correct, will come out different in a recompile with this change // versus a from scratch compile with this change. - checkPerFileRecompile_singleJsoIntfDispatchChange(JsOutputOption.DETAILED); + checkIncrementalRecompile_singleJsoIntfDispatchChange(JsOutputOption.DETAILED); } - public void testPerFileRecompile_dualJsoIntfDispatchChange() throws UnableToCompleteException, + public void testIncrementalRecompile_dualJsoIntfDispatchChange() throws UnableToCompleteException, IOException, InterruptedException { // Not testing recompile equality with Pretty output since the Pretty namer's behavior is order // dependent, and while still correct, will come out different in a recompile with this change // versus a from scratch compile with this change. - checkPerFileRecompile_dualJsoIntfDispatchChange(JsOutputOption.DETAILED); + checkIncrementalRecompile_dualJsoIntfDispatchChange(JsOutputOption.DETAILED); } - public void testPerFileRecompile_generatorInputResourceChange() throws IOException, + public void testIncrementalRecompile_generatorInputResourceChange() throws IOException, UnableToCompleteException, InterruptedException { // Not testing recompile equality with Pretty output since the Pretty namer's behavior is order // dependent, and while still correct, will come out different in a recompile with this change // versus a from scratch compile with this change. - checkPerFileRecompile_generatorInputResourceChange(JsOutputOption.DETAILED); + checkIncrementalRecompile_generatorInputResourceChange(JsOutputOption.DETAILED); } - public void testPerFileRecompile_invalidatedGeneratorOutputRerunsGenerator() + public void testIncrementalRecompile_invalidatedGeneratorOutputRerunsGenerator() throws UnableToCompleteException, IOException, InterruptedException { // BarReferencesFoo Generator hasn't run yet. assertEquals(0, BarReferencesFooGenerator.runCount); @@ -831,7 +835,7 @@ assertEquals(2, BarReferencesFooGenerator.runCount); } - public void testPerFileRecompile_invalidatedGeneratorOutputRerunsCascadedGenerators() + public void testIncrementalRecompile_invalidatedGeneratorOutputRerunsCascadedGenerators() throws UnableToCompleteException, IOException, InterruptedException { // Generators haven't run yet. assertEquals(0, CauseStringRebindGenerator.runCount); @@ -880,7 +884,8 @@ assertEquals(2, FooResourceGenerator.runCount); } - public void testPerFileRecompile_carriesOverGeneratorArtifacts() throws UnableToCompleteException, + public void testIncrementalRecompile_carriesOverGeneratorArtifacts() + throws UnableToCompleteException, IOException, InterruptedException { // Foo Generator hasn't run yet. assertEquals(0, FooResourceGenerator.runCount); @@ -919,7 +924,7 @@ assertTrue(barFile.exists()); } - private void checkPerFileRecompile_noop(JsOutputOption output) throws UnableToCompleteException, + private void checkIncrementalRecompile_noop(JsOutputOption output) throws UnableToCompleteException, IOException, InterruptedException { MinimalRebuildCache relinkMinimalRebuildCache = new MinimalRebuildCache(); File relinkApplicationDir = Files.createTempDir(); @@ -936,7 +941,7 @@ assertTrue(originalJs.equals(relinkedJs)); } - private void checkPerFileRecompile_dateStampChange(JsOutputOption output) + private void checkIncrementalRecompile_dateStampChange(JsOutputOption output) throws UnableToCompleteException, IOException, InterruptedException { MinimalRebuildCache relinkMinimalRebuildCache = new MinimalRebuildCache(); File relinkApplicationDir = Files.createTempDir(); @@ -955,7 +960,7 @@ assertTrue(originalJs.equals(relinkedJs)); } - private void checkPerFileRecompile_superClassOrder(JsOutputOption output) + private void checkIncrementalRecompile_superClassOrder(JsOutputOption output) throws UnableToCompleteException, IOException, InterruptedException { // Mark ReferencedBySuperClassResource modified, so that SuperClass becomes stale. This will // result in SuperClass's indexing being rebuilt but NOT ASubClasses's. If there is a bug in the @@ -966,7 +971,7 @@ stringSet("com.foo.SuperClass", "com.foo.ReferencedBySuperClass"), output); } - private void checkPerFileRecompile_deterministicUiBinder(JsOutputOption output) + private void checkIncrementalRecompile_deterministicUiBinder(JsOutputOption output) throws UnableToCompleteException, IOException, InterruptedException { CompilerOptions compilerOptions = new CompilerOptionsImpl(); @@ -976,7 +981,7 @@ "com.foo.MyWidget_BinderImpl", "com.foo.MyWidget_BinderImpl$Widgets"), output); } - private void checkPerFileRecompile_uiBinderCssChange(JsOutputOption output) + private void checkIncrementalRecompile_uiBinderCssChange(JsOutputOption output) throws UnableToCompleteException, IOException, InterruptedException { // Switches from a white styled widget to a grey styled widget in the CSS in the style tag // nested in the .ui.xml template file. @@ -992,7 +997,7 @@ "com.foo.MyWidget_BinderImpl", "com.foo.MyWidget_BinderImpl$Widgets"), output); } - private void checkPerFileRecompile_packagePrivateOverride(JsOutputOption output) + private void checkIncrementalRecompile_packagePrivateOverride(JsOutputOption output) throws UnableToCompleteException, IOException, InterruptedException { CompilerOptions compilerOptions = new CompilerOptionsImpl(); compilerOptions.setUseDetailedTypeIds(true); @@ -1004,7 +1009,7 @@ stringSet("com.foo.PackagePrivateChild", "com.foo.TestEntryPoint"), output); } - private void checkPerFileRecompile_regularClassMadeIntoJsoClass(JsOutputOption output) + private void checkIncrementalRecompile_regularClassMadeIntoJsoClass(JsOutputOption output) throws UnableToCompleteException, IOException, InterruptedException { CompilerOptions compilerOptions = new CompilerOptionsImpl(); compilerOptions.setUseDetailedTypeIds(true); @@ -1015,7 +1020,8 @@ stringSet("com.foo.JsoTwo", "com.foo.SomeClassReferringToJsoTwoArrays"), output); } - private void checkPerFileRecompile_unstableGeneratorReferencesModifiedType(JsOutputOption output) + private void checkIncrementalRecompile_unstableGeneratorReferencesModifiedType( + JsOutputOption output) throws UnableToCompleteException, IOException, InterruptedException { // Make sure that the recompile with changes and the full compile with changes have the same // output from the unstable generator, so that it is safe to make byte for byte output @@ -1035,7 +1041,7 @@ "com.foo.TestEntryPoint", "com.foo.NestedAnonymousClasses$1$1", "com.foo.Foo"), output); } - private void checkPerFileRecompile_functionSignatureChange(JsOutputOption output) + private void checkIncrementalRecompile_functionSignatureChange(JsOutputOption output) throws UnableToCompleteException, IOException, InterruptedException { checkRecompiledModifiedApp("com.foo.SimpleModule", Lists.newArrayList(simpleModuleResource, simpleModelEntryPointResource, @@ -1044,7 +1050,7 @@ stringSet("com.foo.TestEntryPoint", "com.foo.SimpleModel"), output); } - private void checkPerFileRecompile_compileTimeConstantChange(JsOutputOption output) + private void checkIncrementalRecompile_compileTimeConstantChange(JsOutputOption output) throws UnableToCompleteException, IOException, InterruptedException { checkRecompiledModifiedApp("com.foo.SimpleModule", Lists.newArrayList(simpleModuleResource, simpleModelEntryPointResource, @@ -1052,7 +1058,8 @@ constantsModelResource, modifiedConstantsModelResource, stringSet("com.foo.SimpleModel", "com.foo.Constants"), output); } - private void checkPerFileRecompile_typeHierarchyChange(JsOutputOption output) + + private void checkIncrementalRecompile_typeHierarchyChange(JsOutputOption output) throws UnableToCompleteException, IOException, InterruptedException { checkRecompiledModifiedApp("com.foo.SimpleModule", Lists.newArrayList(simpleModuleResource, modifiedSuperEntryPointResource, modelAResource, modelBResource, modelDResource), @@ -1060,7 +1067,7 @@ stringSet("com.foo.TestEntryPoint", "com.foo.ModelC", "com.foo.ModelD"), output); } - private void checkPerFileRecompile_singleJsoIntfDispatchChange(JsOutputOption output) + private void checkIncrementalRecompile_singleJsoIntfDispatchChange(JsOutputOption output) throws UnableToCompleteException, IOException, InterruptedException { CompilerOptions compilerOptions = new CompilerOptionsImpl(); compilerOptions.setUseDetailedTypeIds(true); @@ -1071,7 +1078,7 @@ stringSet("com.foo.TestEntryPoint", "com.foo.Foo", "com.foo.Caller"), output); } - private void checkPerFileRecompile_devirtualizeUnchangedJso(JsOutputOption output) + private void checkIncrementalRecompile_devirtualizeUnchangedJso(JsOutputOption output) throws UnableToCompleteException, IOException, InterruptedException { CompilerOptions compilerOptions = new CompilerOptionsImpl(); compilerOptions.setUseDetailedTypeIds(true); @@ -1082,7 +1089,7 @@ "com.google.gwt.lang.com_00046foo_00046SimpleModule__EntryMethodHolder"), output); } - private void checkPerFileRecompile_multipleClassGenerator(JsOutputOption output) + private void checkIncrementalRecompile_multipleClassGenerator(JsOutputOption output) throws UnableToCompleteException, IOException, InterruptedException { CompilerOptions compilerOptions = new CompilerOptionsImpl(); compilerOptions.setUseDetailedTypeIds(true); @@ -1093,7 +1100,7 @@ stringSet("com.foo.Baz", "com.foo.TestEntryPoint", "com.foo.Bar"), output); } - private void checkPerFileRecompile_dualJsoIntfDispatchChange(JsOutputOption output) + private void checkIncrementalRecompile_dualJsoIntfDispatchChange(JsOutputOption output) throws UnableToCompleteException, IOException, InterruptedException { CompilerOptions compilerOptions = new CompilerOptionsImpl(); compilerOptions.setUseDetailedTypeIds(true); @@ -1104,7 +1111,7 @@ stringSet("com.foo.TestEntryPoint", "com.foo.Foo", "com.foo.Caller"), output); } - private void checkPerFileRecompile_generatorInputResourceChange(JsOutputOption outputOption) + private void checkIncrementalRecompile_generatorInputResourceChange(JsOutputOption outputOption) throws IOException, UnableToCompleteException, InterruptedException { CompilerOptions compilerOptions = new CompilerOptionsImpl(); compilerOptions.setUseDetailedTypeIds(true); @@ -1236,7 +1243,7 @@ // Setup options to perform a per-file compile, output to this new application directory and // compile the given module. - compilerOptions.setCompilePerFile(true); + compilerOptions.setIncrementalCompileEnabled(true); compilerOptions.setWarDir(applicationDir); compilerOptions.setModuleNames(ImmutableList.of(moduleName)); compilerOptions.setOutput(output);
diff --git a/dev/core/test/com/google/gwt/dev/javac/CompilationStateTest.java b/dev/core/test/com/google/gwt/dev/javac/CompilationStateTest.java index 481c8c3..9d21aa9 100644 --- a/dev/core/test/com/google/gwt/dev/javac/CompilationStateTest.java +++ b/dev/core/test/com/google/gwt/dev/javac/CompilationStateTest.java
@@ -85,7 +85,7 @@ return text.toString(); } - public void testAddGeneratedCompilationUnit_compilePerFile() { + public void testAddGeneratedCompilationUnit_incremental() { checkAddGeneratedCompilationUnit(true); } @@ -93,8 +93,8 @@ checkAddGeneratedCompilationUnit(false); } - private void checkAddGeneratedCompilationUnit(boolean compilePerFile) { - compilerContext.getOptions().setCompilePerFile(compilePerFile); + private void checkAddGeneratedCompilationUnit(boolean incremental) { + compilerContext.getOptions().setIncrementalCompileEnabled(incremental); MinimalRebuildCache minimalRebuildCache = compilerContext.getMinimalRebuildCache(); @@ -105,7 +105,7 @@ // Add a generated unit and ensure it shows up as a new modified unit. addGeneratedUnits(JavaResourceBase.FOO); validateCompilationState(Shared.getTypeName(JavaResourceBase.FOO)); - assertEquals(compilePerFile, + assertEquals(incremental, minimalRebuildCache.getModifiedCompilationUnitNames().contains("test.Foo")); rebuildCompilationState();