-
-
Notifications
You must be signed in to change notification settings - Fork 304
allow excluding repositories from Project -buildpath via tags #6612
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
allow excluding repositories from Project -buildpath via tags #6612
Conversation
| .filter(repo -> { | ||
| Tags tags = repo.getTags(); | ||
|
|
||
| if (tags == null || tags.includesAny(Constants.REPOTAGS_RESOLVE)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should it not be NO_RESOLVE ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it is correct as it is. My thinking was to use the same logic which is used for Resolving.
The logic in bnd 7.1.0 there is:
Resolving considers only repos with either no tags (for backwards compatibility) or the tag "resolve".
2688cb5#diff-096900d1f971d5ff7606d028e316560c8e89c25031bb473a493b776642f7f347R34 called by
In other words: The repositories a Project should "care" about are the same repositories which are considered for resolving by BndrunResolveContext.java
I think it would be more useful to allow adding repositories to individual (bndrun) files, the whole problem seem to stem from the fact that repositories need to be added on the workspace level. |
Maybe that would solve a different problem. The change I added is on the Project and the project gets a list of Repositories to do its work for So the current discrepancy (in my opinion) is that:
My idea is to have both use the same logic using Repo Tags. |
|
The classpath is controlled completely by the user and nothing is resolved (as far as I know) it actually look up the bundles, therefore only using resolve repositories might be confusing. So I would argue that if you don't want a higher version then simply adjust the version range in your classpath instead of try to "ignore" a source of bundles. Bndruns are working differently there is a resolve phase (either explicitly or implicitly) where only the metadata of respositories is used to collect all transitive required things. These are then used in the execution phase where the actual bundles are fetched (from the repositories). |
What does "controlled by the user" mean? How can I control it? Let me try again: The effect I saw after adding the additional Repository was that:
Because the new repo made a higher version available which was chosen by the -buildpath because of the I debugged a bit and saw that the ProjectBuilder.java is calling Also BndContainerInitializer (the Eclipse part) does it.
And The current behavior is absolutly correct ( am not saying that it is wrong). And you are right, I could solve it by not using "latest" and use a stricter version range. BUT: I would like to "control" it in a way, that I can exclude a Repository from Basically the same way I can control it in .bndrun files.
If the confusion is about the tag name "resolve" although I am talking about |
|
I think when we worked on the tags it was implied that we would also apply them to the buildpath. I think a special tag for this would be much better than reusing the resolve tag. I.e. the resolve tag is about runtime dependencies and the buildpath should be about API compile time dependencies. |
|
Thanks @pkriens , and welcome back :)
I just realized that recently when I re-read the forum post in the context of this PR here. I completely forgot about it when we worked on tags. I was so focused on .bndrun at that time.
Ok makes sense and basically supports my last sentence above ("we could also think about introducing a "buildpath" repo-tag which is only used in the context to control it for buildpath.") Ok, I will add a new tag. |
|
@pkriens Example:
Now if we filter for the existence of tag with
then the repo which already has a tag, but definitely does NOT have the new 'compile' tag. I wonder how the filter condition should look like? Maybe this is what @laeubi was thinking with his comment:
So maybe we should re-think the tagging a bit. I have the feeling our current filtering made sense back then, when we were just had one tag ( |
|
I added back the positive tag check "compile" (in addition to negative "nocompile" precedence ) in e467b0b
|
|
I have many discussions about compile time and runtime dependencies with my colleaques and would appreciate having an more explicit way of making it visible on a repository base. |
So with this PR here it would be possible to specify:
Meaning: the backwards-compatibility default. repo is considered for all phases (resolve and compile)
Meaning: repo is only considered for
Meaning (actual) repo is only considered for resolution, but not -buildpath
Meaning: repo is only considered for both resolution and -buildpath Yesterday I added also no+[tag] negative tags.
Meaning (actual) repo is only considered for resolution, but not -buildpath. I tried adding that also in the tests 977955e Let's discuss |
|
Discussed this in the call. about the 7.1.0 Backwards Compatibility problemintroduce a tags.active list and basically do something like this (pseudocode) also change the signatore to
and Repo TagsBasically discussed to have the following repo-tags:
.bnd .bndrun TODO ->
|
e.g. only consider "resolve" repos for Project. getRepositories() This fixes a cornerish-case problem with compilation errors when you temporarily add a new Repository to your workspace which is purely for lookup/research/browsing purposes and should neither be considered for resolution nor to the buildpath or Eclipse Classpath. It should just "be there" but do nothing. It fixes a problem I had when I temporarily added an Eclipse Repo for the research purpose above and suddenly got compile errors because the new repo contained a 2.x version of slf4j.simple while the code expected to get an 1.7.x via -buildpath: slf4j.simple;version=latest But maybe this is a practical feature, not only for this corner case. Signed-off-by: Christoph Rueger <[email protected]>
Signed-off-by: Christoph Rueger <[email protected]>
Signed-off-by: Christoph Rueger <[email protected]>
Signed-off-by: Christoph Rueger <[email protected]>
- the negative "nocompile" tag might not be a good idea, because it can get pretty complex over time. the positive check is easier to understand. - add a temporary migration/transition path so that querying for "compile" repos also match repos which already got the "resolve" repo. We do this only for 7.2.0 and remove this temporary transition in 7.3.0. We need to mention this in the Release notes as a breaking change in 7.3.. This means in 7.3.0 repos having only "resolve" tag, need to have "resolve,compile" in order to continue working and to avoid broken builds Signed-off-by: Christoph Rueger <[email protected]>
Signed-off-by: Christoph Rueger <[email protected]>
- this to also allows to exclude a repo from 'compile' while still keeping it in 'resolve' in the 7.2.0 TRANSITION. - you could give the repo 'resolve,nocompile' Signed-off-by: Christoph Rueger <[email protected]>
Signed-off-by: Christoph Rueger <[email protected]>
Signed-off-by: Christoph Rueger <[email protected]>
977955e to
736ab82
Compare
this allows us to build backwards compatible filtering of tags e.g. repotags. Signed-off-by: Christoph Rueger <[email protected]>
de9cd95 to
ab35199
Compare


It is related to a forum post some time ago which was the base for Repo-Tagging:
e.g. only consider "resolve" repos for Project. getRepositories()
This fixes a cornerish-case problem with compilation errors when you temporarily add a new Repository to your workspace which is purely for lookup/research/browsing purposes and should neither be considered for resolution nor to the buildpath or Eclipse Classpath. It should just "be there" but do nothing.
It fixes a problem I had when I temporarily added an Eclipse Repo for the research purpose above and suddenly got compile errors because the new repo contained a 2.x version of slf4j.simple while the code expected to get an 1.7.x via
-buildpath: slf4j.simple;version=latestBut maybe this is a practical feature, not only for this corner case.
Example
Let's say I temporarily want to add this repo for research & lookup purposes.
adding
allows me to exclude this repository from any
-buildpath.This has two positive effects:
TODO
This is experimental and only for discussion.
What are drawbacks of this approach? Is it useful? Or should I just not do this or use a narrower version-range instead of 'latest' (
-buildpath: slf4j.simple;version=latest)