-
-
Notifications
You must be signed in to change notification settings - Fork 184
feat: initial support for alias versioning #2373
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: main
Are you sure you want to change the base?
Conversation
This aligns well with JBANG_APP_JAVA_OPTIONS
This reverts commit 3d4ea2f.
| } | ||
|
|
||
| private ResourceRef resolveChecked(ResourceResolver resolver, String resource) { | ||
| public String extractJBangAppVersion(String _resource) { |
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.
this method does not feel right.
it is not actually extracting the version - it is detecting and putting it into a global system property and then returns it self.
we shouldn't rely on global state for this - its very local for the exact resolution of versions for alias ref.
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.
even if we had to use global state this method should be possible to test in isolation which we can't if reliant on global system property state.
| } | ||
| String scriptRef = scriptMixin.scriptOrFile; | ||
| ProjectBuilder pb = createProjectBuilder(); | ||
| String scriptRef = pb.extractJBangAppVersion(scriptMixin.scriptOrFile); |
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.
it shouldn't have to extract a version here always should it ? normally should only be needed if alias actually have a version to set, right?
| } | ||
|
|
||
| private static void installScripts(String name, String scriptRef, List<String> runOpts, List<String> runArgs) | ||
| private static void installScripts(String name, String _scriptRef, List<String> runOpts, List<String> runArgs) |
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.
why need to put _ in the signature parameter?
| binDir.toFile().mkdirs(); | ||
| String version = System.getProperty("jbang.app.version"); | ||
| String scriptRef = _scriptRef; | ||
| if (version != null) { |
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.
this logic seems in reverse of what I would expect.
I would assume if and only if a version is specified in the alias will we pass down version info to be resolved. No need to do this otherwise.
|
This implementaton is largely a proof-of-concept. Looking at the code again, I think one should rather enhance the ResourceRef class to support resource versioning. The current implementation removes the version information from the resource ref up-front and then adds it back where needed during back-end processing in order not to break current functionality. But it does not fit really well into the JBang processing model. |
Initial support for #1979
CamelJBang.java