bnd icon indicating copy to clipboard operation
bnd copied to clipboard

Add support for repository tags

Open chrisrueger opened this issue 9 months ago • 3 comments

Closes #5966

Based on brainstorming here https://bnd.discourse.group/t/baseline-repo-exclude-from-the-build-path/391/6

In this PR

  • allow to add a property tags="baseline,release, foo" to a Repository in build.bnd
  • default tag in all repositories without a tag is an empty set of tags for backwards compatibility
  • in a .bndrun if you remove the -runrepos you get all repositories which have either no tags set or the 'resolve' tag
  • To exclude a repo from resolution in the example, you would not add the resolve (but instead any other tag e.g. <<EMPTY>> and remove the -runrepos from the .bndrun.
  • If you have specified -runrepos then today's behavior is still in place that the given repo names are used

e.g. a .bndrun file without -runrepos would include the following repos in the resolution:

aQute.bnd.repository.maven.provider.MavenBndRepository;\
        tags = "resolve"; \
        name="Maven Central A";\
        releaseUrl="${mavencentral}";\
        snapshotUrl="${ossrh}";\
        index="${.}/central.mvn";\
        readOnly=true,\

because it has the resolve tag

and

aQute.bnd.repository.maven.provider.MavenBndRepository;\
        name="Maven Central B";\
        releaseUrl="${mavencentral}";\
        snapshotUrl="${ossrh}";\
        index="${.}/central.mvn";\
        readOnly=true,\

because there is no tags

but not

aQute.bnd.repository.maven.provider.MavenBndRepository;\
        tags = "someothertag"; \
        name="Maven Central";\
        releaseUrl="${mavencentral}";\
        snapshotUrl="${ossrh}";\
        index="${.}/central.mvn";\
        readOnly=true,\

because it has a no resolve tag.

To exclude the baseline repo in the example, you would not add the resolve tag to the baseline-repo, and then it won't be considered for Resolving. I have not used baselining yet, so I am not familiar with the topic and what areas are not covered by this.

The current state of the PR just lay the foundation for tagging. More features could be added like allowing for NOT or more sophisticated filter expressions.

chrisrueger avatar May 08 '24 22:05 chrisrueger

Summary from the bnd zoom call today:

  • revert the Respositories Panel support for tags (e.g. @resolve) in -runrepos... just keep it a list of workspace names and a way to be specific
  • start a step back with an assumed empty -runrepos list or no -runrepos at
    • in this case the repostories should be fetched via something like repos = getPlugins(..., "resolve") - the second param should be the tag resolve which should be one a handful of fixed core-tags
    • every Repository should automatically have this tag resolve tag

That's it so far. I will post an update once I have this implemented and from there we can discuss the next step.

Thanks @pkriens for the input.

chrisrueger avatar May 10 '24 16:05 chrisrueger

  • revert the Respositories Panel support for tags (e.g. @resolve) in -runrepos... just keep it a list of workspace names and a way to be specific

  • start a step back with an assumed empty -runrepos list or no -runrepos at

    • in this case the repostories should be fetched via something like repos = getPlugins(..., "resolve") - the second param should be the tag resolve which should be one a handful of fixed core-tags
    • every Repository should automatically have this tag resolve tag

@pkriens I have implemented the above.

  • if -runrepos is empty (or not in the .bndrun file) the UI shows all repos having the 'resolve' tag
    • if you don't touch any checkbox, then it stays that way
    • if you touch a checkbox then the repo-names are written to .bndrun and basically override the 'resolve' tag behavior.
    • I guess to make use of the new tagging the recommendation would be to remove -runrepos from .bndrun to make use of the tags

Example: this is my Repositories list with no -runrepos specified

image

It is basically all repos with the resolve tag (repos have not tags specified, so the default 'resolve' is used)

Resolution:

  • basically uses a similar behavior
  • if -runrepos is empty (or not in the .bndrun file) resolution uses all repos having the 'resolve' tag. Otherwise the -runrepos are used

Quoting commit b9a574f

  • repos now get the 'resolve' tag by default if not specified
  • .bndrun: empty -runrepos will be populated with all repos having the 'resolve' tag
  • .bndrun: resolution consider all repos having the 'resolve' tag. that means you can exclude a repo from resolution by manually assigning it a different tag (e.g. to exclude the baseline repo from resolution, you should give the baseline-repo e.g. the tag 'baseline' and make sure it does NOT have the 'resolve' tag

Let's discuss

chrisrueger avatar May 10 '24 20:05 chrisrueger

@pkriens I have pushed the changes from our call today. In the UI I have implemented a simple Combobox mechanism where you can provide the options using a comma-separated string.

see 7f04909

image

chrisrueger avatar May 21 '24 15:05 chrisrueger