[jbosstools-dev] Querying a p2 repo from a Mojo

Mickael Istria mistria at redhat.com
Tue Oct 1 10:29:35 EDT 2013


Hi all,

I would like to write a Mojo for the "verify" goal which takes as input 
a baseline, and compare output of the module build with a baseline to 
tell whether the version of current module should be bumped. So far the 
only criterion would simply be that for bundle x.y.z, if baseline 
already contains x.y.z2 with z2 >= z, then build would fail or warn to 
remind the developer to bump the version.

[  You'll notice there that this is not the process used by Eclipse 
platform, as it implies that versions should be bumped systematically 
whereas Platform build tends to re-use artifacts as much as possible. So 
the use-case mentioned about is not a baseline replacement, but more a 
version conformance taking baseline as reference  ]

This "ValidateVersionAgainstBaselineMojo" would simply need to execute a 
query against the baseline repositories. However, it's not very trivial 
to implement such p2 related task with Tycho as such actions have to be 
turned into services. So far, I've found that the service which seems 
the closest from the ability to make queries against a p2 repo is the 
BaselineService. However, it is too limited as it only checks bundles 
that match exactly (x.y.z.qualifier equal), whereas I'd like basically 
to put some version range. Is there currently a way to ask for a bundle 
of given version range from a Mojo or should I propose a patch that adds 
such a method to the BaselineService? The method would look like

public Collection<IP2Artifact> getBundles(Collection<MavenRepositoryLocation> baselineLocations, String bundleId, VersionRange range);

Does this use-case make sense to you? Is there any chance that if I 
write such a method, it gets integrated in Tycho so I can go ahead and 
write a Mojo?
When I'm done with this very simple Mojo, I'd like to go a step forward 
and implement another Mojo that gives hints about semantic versioning, 
as BND does 
http://blog.osgi.org/2013/09/baselining-semantic-versioning-made-easy.html 
, reusing recent BND improvements and API.

Cheers,
-- 
Mickael Istria
Eclipse developer at JBoss, by Red Hat <http://www.jboss.org/tools>
My blog <http://mickaelistria.wordpress.com> - My Tweets 
<http://twitter.com/mickaelistria>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/jbosstools-dev/attachments/20131001/32ca3172/attachment.html 


More information about the jbosstools-dev mailing list