// changed, then we need to recompile the target
if (outputFileRef.getLastModified() < sourceFileRef.getLastModified()
|| manager.sourceChanged(task)) {
task.execute(alertSink, alertPolicy);
} else {
alertSink.add(new ProgressAlert(sourcePosition, "Skipped (source unchanged)"));
sourceNotChanged.add(task);
}
} else {
alertSink.add(new ProgressAlert(sourcePosition, "Skipped (output supressed)"));
}
}
}
// For each task we didn't execute, check to see if any of the interfaces
// it depends on have changed (which could happen as a result of
// recompiling one of the things it depends on).
// TODO(laurence): see whether it's possible to combine these two loops by
// having usedInterfacesChanged not change its value.
for (CompilationTask task : sourceNotChanged) {
if (manager.usedInterfacesChanged(task)) {
FileRef sourceFileRef = task.getCompilationUnit().getSourceFileRef();
SourcePosition sourcePosition = new SourcePosition(sourceFileRef);
alertSink.add(new ProgressAlert(sourcePosition, "Reconsidered; callees have changed"));
task.execute(alertSink, alertPolicy);
}
}
// Optionally write out a java properties file that contains
// strings extracted from <gxp:msg>s
if (propertiesFile != null && !extractMessagesFrom.isEmpty()) {
SourcePosition outputPosition = new SourcePosition(propertiesFile);
alertSink.add(new ProgressAlert(outputPosition, "Generating"));
List<ExtractedMessage> messages = Lists.newArrayList();
for (CompilationUnit cUnit : extractMessagesFrom) {
messages.addAll(cUnit.getMessageExtractedTree().getMessages());
}
MessageBundle messageBundle = Util.bundleMessages(alertSink, messages);
PropertiesBundleWriter pbw = new PropertiesBundleWriter(messageBundle);
try {
Writer writer = propertiesFile.openWriter(Charsets.US_ASCII);
try {
pbw.write(writer);
} finally {
writer.close();
}
} catch (UnmappableCharacterException uce) {
// These are caused by coding errors, not user error.
throw new AssertionError(uce);
} catch (IOException iox) {
alertSink.add(new IOError(propertiesFile, iox));
}
alertSink.add(new ProgressAlert(outputPosition, "Generate finished"));
}
}