Skip to content

Commit

Permalink
Include annotation processor names in JavaCompileAction progress mess…
Browse files Browse the repository at this point in the history
…ages

PiperOrigin-RevId: 163701792
  • Loading branch information
cushon authored and dslomov committed Jul 31, 2017
1 parent 5ede79a commit 941d6aa
Showing 1 changed file with 19 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -765,9 +765,28 @@ private String buildProgressMessage() {
first = appendCount(sb, first, sourceFiles.size(), "source file");
first = appendCount(sb, first, sourceJars.size(), "source jar");
sb.append(")");
addProcessorNames(sb);
return sb.toString();
}

private void addProcessorNames(StringBuilder sb) {
if (processorNames.isEmpty()) {
return;
}
List<String> shortNames = new ArrayList<>();
for (String name : processorNames) {
// Annotation processor names are qualified class names. Omit the package part for the
// progress message, e.g. `com.google.Foo` -> `Foo`.
int idx = name.lastIndexOf('.');
String shortName = idx != -1 ? name.substring(idx + 1) : name;
shortNames.add(shortName);
}
sb.append(" and running annotation processors (");
Joiner.on(", ").appendTo(sb, shortNames);
sb.append(")");
return;
}

/**
* Append an input count to the progress message, e.g. "2 source jars". If an input count has
* already been appended, prefix with ", ".
Expand Down

0 comments on commit 941d6aa

Please sign in to comment.