"com.google.gwt.dev.testdata.incrementalbuildsystem.SimpleBottom"), null);
loggerBuilder.expectInfo(BuildTarget.formatCompilingModuleMessage(
"com.google.gwt.dev.testdata.incrementalbuildsystem.SimpleMid"), null);
loggerBuilder.expectInfo(BuildTarget.formatCompilingModuleMessage(
"com.google.gwt.dev.testdata.incrementalbuildsystem.SimpleTop"), null);
UnitTestTreeLogger testLogger = loggerBuilder.createLogger();
// Prepare the compiler.
ResourceLoader resourceLoader = createGwtClassPathResourceLoaderWithMocks(
"com/google/gwt/dev/testdata/incrementalbuildsystem/Foo.java");
IncrementalBuilder incrementalBuilder = createIncrementalBuilder(
"com.google.gwt.dev.testdata.incrementalbuildsystem.SimpleTop", resourceLoader);
incrementalBuilder.clean();
// Compile.
boolean actualBuildSuccess = incrementalBuilder.build(testLogger).isSuccess();
// Assert compile succeeded and was a full compile with no caching.
assertEquals(true, actualBuildSuccess);
testLogger.assertLogEntriesContainExpected();
// Setup logging expectations for a fully cached compile.
loggerBuilder = new UnitTestTreeLogger.Builder();
loggerBuilder.setLowestLogLevel(TreeLogger.INFO);
loggerBuilder.expectInfo(IncrementalBuilder.NO_FILES_HAVE_CHANGED, null);
testLogger = loggerBuilder.createLogger();
// Recompile without changes.
actualBuildSuccess = incrementalBuilder.rebuild(testLogger).isSuccess();
// Assert compile succeeded and was fully cached.
assertEquals(true, actualBuildSuccess);
testLogger.assertLogEntriesContainExpected();
// Change modification date of the Foo.java seen by SimpleMid.gwt.xml
File fooFile = new File(resourceLoader.getResource(
"com/google/gwt/dev/testdata/incrementalbuildsystem/Foo.java").getPath());
fooFile.setLastModified(System.currentTimeMillis() + 60 * 1000);
// Setup logging expectations for partially cached recompile.
loggerBuilder = new UnitTestTreeLogger.Builder();
loggerBuilder.setLowestLogLevel(TreeLogger.SPAM);
loggerBuilder.expectSpam(
BuildTarget.formatReusingCachedLibraryMessage("com.google.gwt.core.Core"), null);
loggerBuilder.expectSpam(BuildTarget.formatReusingCachedLibraryMessage(
"com.google.gwt.dev.testdata.incrementalbuildsystem.SimpleBottom"), null);
loggerBuilder.expectInfo(BuildTarget.formatCompilingModuleMessage(
"com.google.gwt.dev.testdata.incrementalbuildsystem.SimpleMid"), null);
loggerBuilder.expectInfo(BuildTarget.formatCompilingModuleMessage(
"com.google.gwt.dev.testdata.incrementalbuildsystem.SimpleTop"), null);
testLogger = loggerBuilder.createLogger();
// Recompile with changes.
actualBuildSuccess = incrementalBuilder.rebuild(testLogger).isSuccess();
// Assert compile succeeded and was partially cached.
assertEquals(true, actualBuildSuccess);
testLogger.assertLogEntriesContainExpected();
}