-
-
Notifications
You must be signed in to change notification settings - Fork 951
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
handle properties version lookup in grails-bom #13948
Conversation
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.
Since it is groovy, how about?
String versionLookup(String version){
version?.startsWith('${') && version.endsWith('}') ?
versionProperties[version[2..-2]] : version
}
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.
Thank you @jamesfredley! 🚀
You could also update the license header year of GrailsDependencyVersions
.
The Groovy feature of not having a mandatory This would be my version: String versionLookup(String version) {
Boolean isVariable = version?.startsWith('${') && version.endsWith('}')
return isVariable
? versionProperties[version[2..-2]]
: version
} |
I like this, except the capital B on Boolean. Also, there is a null-check on the |
The difference is nano-seconds, and not really relevant in 98% of use cases. I know we are talking religions here, but give a look here: https://stackoverflow.com/questions/6911563/java-performance-true-vs-boolean-true/6911627#6911627 |
Why is |
Writing/Reading code requires mental energy (dopaminergic circuit mainly). Each decision we take requires mental energy. When we run out of it, we start makining mistakes. Mental energy (fuel) and mistakes (crashes) are "costs" from a Business point of view. Always using type wrappers instead of deciding when to use a primitive On a personal note: from a style point of view it is more coherent, we are developing Object Oriented code, not a Procedural "C" like code. |
My mental energy loss is great when I see boxing/unboxing primitive types for no reason. I have to ask myself: why was this done?
We'll have to agree to disagree on this one 😄 |
That's because we haven't agreend on the coding style yet. Having "standards" is another argument to reduce costs and increment quality. Using only Occam with its Occam's Razor would have agreed with me: we would have less variables, or variance in this case, to accompish the same task. |
@codeconsole Thanks, I've updated it to the groovier syntax. @matrei I have updated to license date. |
Updated to groovier syntax
test with .
/gradlew assemble
unzip build/distributions/grails-7.0.0-SNAPSHOT.zip
bin/grails
Handles properties version lookup in grails-bom
https://repo.grails.org/ui/repos/tree/PomView/libs-snapshots-local/org/grails/grails-bom/7.0.0-SNAPSHOT/grails-bom-7.0.0-20241229.020850-191.pom
${profiles-angular.version} was coming from grails-bom and
org.grails.cli.boot.GrailsDependencyVersions
needed to be updated to handle version lookup