private static final Logger logger = Logger.getLogger(BuildContributorsController.class.getName());
@Override
public void onCompleted(AbstractBuild build, TaskListener listener) {
logger.entering(BuildContributorsController.class.getName(), "onCompleted({0})", build);
MetadataBuildAction action = build.getAction(MetadataBuildAction.class);
if (action == null) {
action = new MetadataBuildAction();
build.addAction(action);
}
listener.getLogger().println(Messages.BuildContributorsController_LogMessage_Collecting());
logger.finest("Starting collection.");
ExtensionList<BuildMetadataContributor> contributors = BuildMetadataContributor.all();
for (BuildMetadataContributor contributor : contributors) {
List<MetadataValue> values = contributor.getMetaDataFor(build);
Collection<MetadataValue> leftovers = action.addChildren(values);
if (leftovers != null && !leftovers.isEmpty()) {
String pretty = "\n" + TreeStructureUtil.prettyPrint(leftovers, "\t");
listener.getLogger().println(
Messages.BuildContributorsController_LogMessage_LeftOvers(pretty));
logger.warning("Some metadata failed to be merged for build " + build + pretty);