-
Notifications
You must be signed in to change notification settings - Fork 79
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
Add support for using wildcards in the IUBundleContainer #1061
base: master
Are you sure you want to change the base?
Conversation
Currently one has to specify an exact id for an IU to be used in a target but sometimes it is a bit cumbersome to do so. Also it can become quite annoying if items are added/removed to update the target. This adds a new way of specify the id with wildcards that is enabled whenever the id contains an '*' (any number characters) or '?' (a single character), the container constructs a pattern and includes everything that matches this pattern to be considered.
ec6a8ad
to
a13f7b8
Compare
@merks @HannesWell this is a bit of experimental at the moment but already works quite well! Some things that might need consideration
Alternative syntax would then be:enable by attribute / element
or we simply use a new element:
using generic (match) expression
Of course one could even think about using a different name and omit the unit all together:
|
Test Results 271 files - 6 271 suites - 6 47m 27s ⏱️ - 16m 24s For more details on these failures, see this check. Results for commit a13f7b8. ± Comparison against base commit 76e5d1f. |
I think |
In general I really like the idea, this can significantly simplify including a group of units.
That is in my opinion the best way as it ensures that existing targets continue to work as they are, even if they use unusual symbols like Alternatively we could use a new unit attribute like
That's right, but since those matchers can be quite complex (what even the P2 doc mentions), I don't think we should make the full power available in targets, but spend the complexity budget of a user wisely, only when it brings enough benefit for the added complexity. Otherwise users will just continue using only the existing exact ids.
For version ranges we could just re-use the existing But regarding versions, if a id-pattern is specified having an exact version is in most cases not useful (unless all units matched by the pattern are available with the same version), so either a no version (respectively
A text field in the UI to enter the pattern that shows all matches sound good and useful to me. |
I agree that the matcher syntax not pretty to author, but would allow to express requirements on packages... Given the units being resolved here are primarily plugins and features, those have these constraints:
Also ?* are not valid characters in a group or artifact ID. So probably it's safe to just use these. Using/allowing Java regular expressions would be much more powerful than glob-style patterns. I think using a version (range or otherwise), in combination with an ID pattern is almost never all that sensible... |
Yes glob pattern is rather limited and I just choose that for simplicity to test if it could work also the version is then quite questionable. If we choose
I think one should simply assume id/version is always empty/ignored. On the other hand, we already have code that can handle category/site.xml syntax so maybe one should simply allow all elements like here: https://tycho.eclipseprojects.io/doc/main/Category.html and instead of This would allow to use the defined categories to display to the user and one could even reuse the category.xml editor for that purpose (even though it does not yet support the enhanced |
Thanks for the hint about permitted characters. With that in mind, I think the current suggestion to keep all elements as they are and use
Yes. To distinguish the type of pattern, we could also use the approach used in Tycho when filtering automatically added repo-references (which is actually just derived from Apache Common's Path-Matcher class):
That's right, but I have never felt the need for it yet at the TP level (but maybe that may come if it is possible).
Yep. Also given that in most cases (except Guava or the javax/jakarta bundles) there is only one version of a bundle in the TP personally I usually just use the latest/
That code is only in P2 or Tycho, isn't it? At least I can't see support for the more complex cases in PDE's standard category editor?
I'm not sure I understand that? Do you want to add units by category or just display them? Because the visual Target-Editor already shows the categories (just like for updates). |
I don't think we should support regex / different styles that just adds to much complications confusion. If one needs extra control then the traditional way of defining a feature is the way to go, this is/was really meant to support things like "include all jetty http bundles".
The category editor does not support the IU element and its syntax, but any glob/regex/whatever pattern will not be supported either. In fact it would be more valuable to extend the category editor as this will immediately allow to edit category.xml as well.
Display them by category, because you can't see the matched items otherwise. |
@mickaelistria @akurtakov any thoughts on this? |
If regex patterns are too complicated, we should really think twice about the (IMHO) even more complex units-filter approach.
That's right, but the IU-filter syntax is much more complex than just displaying multiple items matched by a pattern. I even think it will be quite difficult to represent it in a visual editor, maybe hardly possible (but maybe someone has good ideas). |
regex patterns itself are not that complicated of course but supporting different syntax with modifiers and of course the error handling while with a glob you can't do anything "wrong" (maybe just not matching what you want)
The main difficulty is that we need to transform all items to IUs but there are already functions for this so it is possible but I think a simple text box would be suitable as a first step. |
@HannesWell @merks I lost a bit track of this PR, should we proceed here or do we thing its not worth to change PDE in this regards? |
I think it is definitively worth to have that. But I think we should keep this simple in the first step and just support wild-cards in IDs only with GLOB syntax. Having a good UI for that will probably be enough work already. If we then think that's still not flexible enough, we can still add support for the full general IU syntax that P2 offers. But just a simple text block without any assistance and syntax checks is really hard to use if one just make the smallest mistake. I have made that experience already by myself for example with M2Es BND-instructions editor in the past. Btw. I have also pushed a preliminary draft of my mentioned work to support of Version ranges in targets with: Both PRs together will already give users many more opportunities without much more syntax to learn and new attributes or elements. |
Currently one has to specify an exact id for an IU to be used in a target but sometimes it is a bit cumbersome to do so. Also it can become quite annoying if items are added/removed to update the target.
This adds a new way of specify the id with wildcards that is enabled whenever the id contains an '*' (any number characters) or '?' (a single character), the container constructs a pattern and includes everything that matches this pattern to be considered.
Example: Selects all ius that start with jakarta. prefix
Example: Selects all features in a repository