jbang
jbang copied to clipboard
jbang edit --sandbox does not respect //JAVA version tag
Describe the bug
My Java file intro has a //JAVA 21 version tag, when running jbang edit --sandbox MyFile.java the resulting gradle project does not specify/configure this version.
To Reproduce Steps to reproduce the behavior:
- Create a Java File
MyFile.javato run in jbang having the java version tag//JAVA 21 - Launch
jbang edit --sandbox MyFile.java - In the resulting project, open
build.gradle - See that there is a configuration block for the jdk version missing.
Expected behavior I would expect the build.gradle file to contain a block to specify java language version:
java {
toolchain {
languageVersion = JavaLanguageVersion.of(21)
}
}
JBang version
[jbang] [0:175] jbang version 0.126.0
Cache: /Users/simschla/.jbang/cache
Config: /Users/simschla/.jbang
Repository: /Users/simschla/.m2/repository
Java: /Library/Java/JavaVirtualMachines/zulu-11.jdk/Contents/Home [11.0.27]
OS: mac
Arch: aarch64
Shell: bash
0.126.0
Additional context
It looks to me, that src/main/resources/export-build.qute.gradle would handle this correctly, but src/main/resources/build.qute.gradle does not.
@maxandersen perhaps now that we have an official export gradle command we should use that for the edit feature? Wdyt?
@quintesse maybe but export gradle aren't compatible with "sandbox" afaik....i.e. you need files symbolic linked rather than "exported" ?
Ah yes, I forgot about that. Then the only other thing I could imagine is that the gradle build file generation would be made static and public so the edit could re-use it. Not sure if it's worth it, but having only a single piece of code that generates gradle build file is probably a good idea :-)