use of org.eclipse.tycho.artifactcomparator.ArtifactDelta in project tycho by eclipse.
the class ManifestComparator method getDelta.
@Override
public ArtifactDelta getDelta(InputStream baseline, InputStream reactor, MojoExecution mojo) throws IOException {
TreeMap<String, ArtifactDelta> result = new TreeMap<>();
Manifest manifest = new Manifest(baseline);
Manifest manifest2 = new Manifest(reactor);
Attributes attributes = manifest.getMainAttributes();
Attributes attributes2 = manifest2.getMainAttributes();
Set<Name> names = new LinkedHashSet<>();
names.addAll(getNames(attributes));
names.addAll(getNames(attributes2));
for (Name key : names) {
String value = attributes.getValue(key);
if (value == null) {
addDelta(result, key, "not present in baseline version");
continue;
}
String value2 = attributes2.getValue(key);
if (value2 == null) {
addDelta(result, key, "present in baseline version only");
continue;
}
if (!value.equals(value2)) {
addDelta(result, key, "baseline='" + value + "' != reactor='" + value2 + "'");
}
}
return !result.isEmpty() ? new CompoundArtifactDelta("different", result) : null;
}
Aggregations