refreshVersions icon indicating copy to clipboard operation
refreshVersions copied to clipboard

Expected (-*) but found (.*)

Open DanySK opened this issue 5 years ago • 8 comments

I'm trying to write a rule to match these artifacts, excluding instead all the packages whose name is protelis(-*) (namely, just protelis or protelis-something)

I tried with:

org.protelis:protelis.parser(.*)
             ^^^^^^^^^^^^^^^

org.protelis:protelis(-*)
    ^^^^^^^^

But that's invalid syntax: Expected (-*) but found (.*)

How do I match for a (possibly missing) dot? Related: in which order are rules applied? Can I write more specific rules first, generic later, and expect the system to match them in order?

DanySK avatar Jun 24 '20 13:06 DanySK

Did you try that?

org.protelis:*
    ^^^^^^^^

I think it'd suit your use case.

LouisCAD avatar Jun 24 '20 16:06 LouisCAD

Wouldn't that sync the versions of org.protelis:protelis-interpreter and org.protelis: protelis.parser?

They must be different, I need two separate entries in the versions.properties.

On Wed, Jun 24, 2020, 18:34 Louis CAD [email protected] wrote:

Did you try that?

org.protelis:* ^^^^^^^^

I think it'd suit your use case.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/jmfayard/refreshVersions/issues/197#issuecomment-648929715, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAPGH6NOM6VYVGLNHL3UZZ3RYITJLANCNFSM4OGVF3XQ .

DanySK avatar Jun 24 '20 16:06 DanySK

@DanySK About the order, the longest matching rule is considered to be the most specific and is therefore picked.

Can you share the full maven artifact names of these dependencies that need to have different versions?

LouisCAD avatar Jun 25 '20 12:06 LouisCAD

Thanks for the clarification.

All these artifacts should be grouped together. They share the org.protelis:protelis.parser root. Their artifact name match this regex: protelis.parser(\.\w+)*, e.g.:

  • org.protelis:protelis.parser
  • org.protelis:protelis.parser.parent
  • org.protelis:protelis.parser.target

A number of other artifacts that should get grouped together share instead the org.protelis:protelis root, and match regex protelis(-\w+)*, e.g.:

  • org.protelis:protelis
  • org.protelis:protelis-lang
  • org.protelis:protelis-interpreter

I can easily exploit the longest-first priority system I guess, but I need to be able to specify that the artifact name contains an ending optional part using dots . instead of dashes - as separators (hence matching (\.\w+)*). The following should work but I must "sacrifice" a letter (the r in parser)

org.protelis:protelis.parse*
             ^^^^^^^^^^^^^^

org.protelis:protelis(-*)
    ^^^^^^^^

DanySK avatar Jun 25 '20 13:06 DanySK

I see you're the author of the library, @DanySK.

Why did you go for a dot for the parser artifacts, and for a dash for the other artifacts? That seems inconsistent to me.

LouisCAD avatar Jun 25 '20 16:06 LouisCAD

The parser artifacts are Xtext-generated, there's little control over their naming. In any case, I cannot rename packages, it's an innovative programming language in use by several research and industry projects, of which I am the chief architect, but whose ownership is shared. A package renaming would cause a chain of changes. One day there'll be a successor to Protelis, but right now that's the situation we have to deal with.

Besides the library naming, however, there is a generic problem on refreshVersion here, it seems to me: the (-*) matcher assumes a dash, but that's not the only allowed separator. Am I correct? Does a (*) matcher exist? If it does, and optionally matches everything, then:

org.protelis:protelis.parser(*)
             ^^^^^^^^^^^^^^^

org.protelis:protelis(-*)
    ^^^^^^^^

Should work.

DanySK avatar Jun 25 '20 16:06 DanySK

I restricted it to dash because I never saw another symbol used. I think I'll add the dot. I prefer to avoid having (*) because it would allow problems if an artifact starts with another one, but is not the same family, even if it's admittedly unlikely.

LouisCAD avatar Jun 25 '20 19:06 LouisCAD

Please also consider underscores _ as they are used sometimes, e.g. when packaging Scala stuff.

On Thu, Jun 25, 2020 at 9:48 PM Louis CAD [email protected] wrote:

I restricted it to dash because I never saw another symbol used. I think I'll add the dot. I prefer to avoid having (*) because it would allow problems if an artifact starts with another one, but is not the same family, even if it's admittedly unlikely.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/jmfayard/refreshVersions/issues/197#issuecomment-649782241, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAPGH6ISAHRTJQW2SEU25FLRYOSY3ANCNFSM4OGVF3XQ .

-- Ing. Dott. Danilo Pianini, PhD

Site: http://www.danilopianini.org/ Phone: +39 320 41 36 573 Hangouts: [email protected]

DanySK avatar Jun 25 '20 20:06 DanySK