Skip to content
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

Modify versions.properties to avoid/simplify need for rules files #575

Closed
2 of 3 tasks
toddobryan opened this issue Aug 17, 2022 · 3 comments
Closed
2 of 3 tasks

Comments

@toddobryan
Copy link

⚠️ Is your feature request related to a problem? Please describe

Writing rules files is a little annoying. If you make a mistake, the carets get misaligned and you can't search for the name you've given your dependency set, because it may not exist as a string in the file. Plus you have to switch back and forth between versions.properties and version-rules.txt.

💡 Describe the solution you'd like

What if the properties in versions.properties could be of two forms. As now,

plugin.foo=x.x.x
version.otherFoo=y.y.y

but could also be a list of globs/artifacts with a name, like:

foo=com.foo:foo1,com.foo:foo2,com.otherthing:versionedWithFoo
otherFoo=com.otherfoo:*,com.thing2:artId

Each "bare" assignment key (i.e., without plugin. or version.) would be expected to appear after plugin. or version. to specify the version of the artifacts it matches. So you'd end up with something like (I know JUnit5 has a better way):

junit5=org.junit.jupiter:junit-jupiter-engine,org.junit.jupiter:junit-jupiter-params,org.junit.jupiter:junit-jupiter-api
version.junit5=5.9.0

On the other hand, looking at this, maybe a regex would be better, so you could do org.junit.jupiter:junit-jupiter-(engine|params|api). Whatever. The point is name on the left, list on the right, both things in the same file.

One cool thing that migrate could do is look for common versions and group them together. It might be too eager, but users could easily separate out things that got combined coincidentally.

Thoughts?

🤚 Do you want to develop this feature yourself?

  • Yes
  • No

Happy to give it a try. It shouldn't be too bad, I don't think. It would just involve processing the properties file in such a way that you get the same data you would have gotten from the versions.properties and any rules files separately.

@jmfayard
Copy link
Member

jmfayard commented Sep 3, 2022

@toddobryan I understand the issue, I don't feel confident to write rules myself.

I have another solution underway here -> https://github.com/jmfayard/refreshVersions/compare/refactor-rules?expand=1

The things with rules is some of them do complex things but most of the time they are just a prefix and an implicit name of the version. So the simple version for simple things would be:

refreshVersions {
   additionalRules(
       PrefixRule(versionName = "junit5", mavenGroup = "org.junit.jupiter", prefix = "junit"),
   )
}

However don't hold your breathe, we are already struggling to find time and energy for the current realease

@jmfayard
Copy link
Member

jmfayard commented Sep 5, 2022

Hello hopefully this will be adressed via #580

@jmfayard jmfayard closed this as completed Sep 5, 2022
@toddobryan
Copy link
Author

Very cool! Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants