From 94dc48711897d33761209b2cdaa27d2235a5391e Mon Sep 17 00:00:00 2001 From: Hannes Wellmann Date: Sun, 29 Sep 2024 11:38:03 +0200 Subject: [PATCH] Support specifying the baseline artifact version range This can be used to select the desired baseline artifact if multiple versions of an artifact are available and to compare. --- .../plugins/p2/extras/CompareWithBaselineMojo.java | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/tycho-extras/tycho-p2-extras-plugin/src/main/java/org/eclipse/tycho/plugins/p2/extras/CompareWithBaselineMojo.java b/tycho-extras/tycho-p2-extras-plugin/src/main/java/org/eclipse/tycho/plugins/p2/extras/CompareWithBaselineMojo.java index b228af6e27..0cfce0d30b 100644 --- a/tycho-extras/tycho-p2-extras-plugin/src/main/java/org/eclipse/tycho/plugins/p2/extras/CompareWithBaselineMojo.java +++ b/tycho-extras/tycho-p2-extras-plugin/src/main/java/org/eclipse/tycho/plugins/p2/extras/CompareWithBaselineMojo.java @@ -106,6 +106,17 @@ public static enum ReportBehavior { @Parameter(property = "onIllegalVersion", defaultValue = "fail", alias = "tycho.p2.baseline.onIllegalVersion") private ReportBehavior onIllegalVersion; + /** + * The version range of the reference artifact in the baseline. + *

+ * This can be used to select the desired baseline artifact if multiple versions of an artifact + * are available and to compare. By default a local artifact is compared to the latest version + * in the baseline. + *

+ */ + @Parameter(defaultValue = "0.0.0", alias = "tycho.p2.baseline.versionRange") + private String baselineVersionRange = "0.0.0"; + @Component() P2ResolverFactory resolverFactory; @@ -161,7 +172,7 @@ public void execute() throws MojoExecutionException, MojoFailureException { try { String id = item.getId(); Version version = new Version(item.getVersion().toString()); - P2ResolutionResult res = resolver.resolveInstallableUnit(baselineTP, id, "0.0.0"); + P2ResolutionResult res = resolver.resolveInstallableUnit(baselineTP, id, baselineVersionRange); for (Entry foundInBaseline : res.getArtifacts()) { Version baselineVersion = new Version(foundInBaseline.getVersion());