-
Notifications
You must be signed in to change notification settings - Fork 2.8k
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
Enable jbang integration in Quarkus #11542
Conversation
@maxandersen try removing the main if you implement |
what would that help/change ? (without it you can't run it from the IDE easily) updated the example as missing arc and not passing class to run. now it works ;) |
Pushed some changes from @stuartwdouglas enabling this level of crazyiness:
This wont (yet) let jbang just run the jar standalone; but what it does do is letting quarkus participate during jbang build without a hard coupling between the two. Allowing you to have speedy startup AND generate native images ... This relies on this jbang PR to work: jbangdev/jbang#261 |
@gastaldi @aloubyansky would like to see this enabled in 1.8 thus a fast review would be great - pretty please! There are a bunch of files changed here but bulk of it is the jbang handler code which shouldnt affect anything as its completely isolated and only engaged when run inside jbang. The others are just gotchas/issues jbang usage found that needed fixing anyway (TCCL classloader and non-default package name assumptions) |
8696209
to
2d66517
Compare
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.
Found some minor issues, but otherwise LGTM
|
||
import java.io.File; | ||
import java.nio.file.Path; | ||
import java.util.*; |
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.
Avoid star imports
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.
yeah, I don't use them but recently the formatter seem to make them happen.
2d66517
to
ad0988d
Compare
Mind squashing before merging this PR? |
ac11203
to
bc97704
Compare
Done by implementing jbang experimental SPI to let Quarkus participate in the build of a jar + passing //Q:CONFIG in as system properties. Initial version supports building jar as well as native image via docker. - various fixes for handling default packages in arc and metrics. - fixes a few places of class.forname not honoring TCCL - slightly open up appmodel to enable this but still reliant on pom.xml being bundled (future versions shouldn't) Co-Authored: Alexey Loubyansky <[email protected]> Co-Authored: Stuart Douglas <[email protected]>
bc97704
to
545eff5
Compare
sure - pushed with co-authors intact. |
Thanks, merged |
Proposal for release blog: Experimental Quarkus Scripting via JBangjbang lets you write and build single source java applications - requiring no maven nor gradle to build and it will even download Java for you. We've added experimental support to let you take the following code, save it as
You can even run This initial version has all the basics working making it possible to write full blown Quarkus applications - some features like devmode is not there yet nor resources (like initial Provide feedback and let us see where it goes. |
Hey, what if we added that snippet in the jbang-catalog? It would be easier to run with |
Maybe we can migrate the quickstarts to that too in the future |
once some version with quarkus in it is released we can do some interesting things in the catalog for sure. Just that in jbangs current form it only allows for single files thus not all quickstarts "fits". I'm about to submit PR with basic docs for the jbang integration and you'll see the slight differences/limits there are when using single file. |
This PR started out as trying to run a jar directly via quarkus; but after talking with @stuartwdouglas
taking another approach where jbang has a SPI to let quarkus (or any other framework) hook into the build process.
With this PR + jbang PR you can take the following file, save in
quarkus.java
and do:jbang quarkus.java
to run itjbang --debug quarkus.java
to debug itjbang --native quarkus.java
to get native image built (currently rely on docker; TBD use graalvm if available)you can also do configuration using
//CONFIG
Things yet to do/being considered:
//CONFIG
should be//QCONFIG
as it is quarkus specific(work around is to do
jbang --debug app.java
and connect with debugger from there.)In addition this PR also try and make it possible to run app directly without having
pom.xml/build.gradle but not yet complete.
for now added .jar to zipfilesystem to avoid FileSystemNotFoundException and
then avoided introspection as if a gradle project.
But then hitting that appmodel is null.