class AbstractCommandLineRunner {
/**
* Prints a set of modules to the manifest file.
*/
@VisibleForTesting
void printModuleGraphManifestTo(
JSModuleGraph graph, Appendable out) throws IOException {
Joiner commas = Joiner.on(",");
boolean requiresNewline = false;
for (JSModule module : graph.getAllModulesInDependencyOrder()) {
if (requiresNewline) {
out.append("\n");
}
// See CommandLineRunnerTest to see what the format of this
// manifest looks like.
String dependencies = commas.join(module.getSortedDependencyNames());
out.append(
String.format("{%s%s}\n",
module.getName(),
dependencies.isEmpty() ? "" : ":" + dependencies));
printManifestTo(module.getInputs(), out);
requiresNewline = true;
}
}
}