-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
Support AWT image resize via new AWT extension #20239
Conversation
@galderz can you rebase with the latest |
Also it would be great if you could also squash your commits |
Yeah yeah, on it already... |
2b5d57d
to
55fb9f8
Compare
@gastaldi Done. Let's see what CI says |
extensions/awt/runtime/src/main/resources/META-INF/quarkus-extension.yaml
Outdated
Show resolved
Hide resolved
integration-tests/awt/src/test/java/io/quarkus/awt/it/AwtImageResizeTest.java
Outdated
Show resolved
Hide resolved
This workflow status is outdated as a new workflow run has been triggered. Failing Jobs - Building 55fb9f8
Failures⚙️ Initial JDK 11 Build #- Failing: integration-tests/awt
📦 integration-tests/awt✖ |
import com.oracle.svm.core.annotate.AutomaticFeature; | ||
|
||
@AutomaticFeature | ||
public class AwtFeature implements Feature { |
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.
👍
55fb9f8
to
5189327
Compare
I have a general question.. how do you expect users to know they need to add this extension? Should we consider it a "technical extension" and have other extensions such as those doing image manipulations depend on it? Or perhaps it belongs in all applications, and we should pull it in automatically for all users? I'm inclined to think it shoud be pulled in for every user automatically, provided there is no overhead. I'd normally expect this to not have any overhead, but you seem to have registered some classes for reflective access so that might force some code inclusion which would otherwise be identified as dead code. Why the reflective registrations? |
The test also needs to be added to the native test configuration. I don't remember exactly where it is (and I'm on a phone right now), but @gastaldi can give you the exact location |
It's in https://github.com/quarkusio/quarkus/blob/main/.github/native-tests.json |
5189327
to
5f2db3b
Compare
Is there such big proportion of Quarkus apps doing image manipulations? Unless there is, I'd keep this as something that people bring in when they need it. Or are you seeing this as something that should work out of the box?
The reflection registration for I would expect the JNI registrations to have some cost too, and there are more of them compared to reflection registrations. My gut feeling is that you'll need even more JNI registrations for other AWT use cases. |
Actually @Sanne, I think might have a point: The hibernate-orm-panache native image build didn't complete, see extract maven logs:
What's happening is that as a result of removing
To solve the problem above, we'd need an extension that is applied to all that takes care of the runtime initialization of all those packages. This could also be done directly in core, by moving You could still have an optional extension for those who really want to use awt with reflection+jni registrations (or any optimised versions of those). Thoughts? |
4eb55df
to
a638a0f
Compare
Pushed a couple of commits to fix the tests that also failed in previous PR. They've fixed in different way this time:
The only thing remaining then would be documentation. Where would it go? |
This workflow status is outdated as a new workflow run has been triggered. Failing Jobs - Building 1848da0
Failures⚙️ Initial JDK 11 Build #- Failing: extensions/tika/runtime integration-tests/awt
! Skipped: devtools/bom-descriptor-json docs extensions/tika/deployment and 3 more 📦 extensions/tika/runtime✖ 📦 integration-tests/awt✖ |
When everything is done, please squash the formatting commits |
I like the shape this is taking - no idea where to put docs though, I suppose that can be deferred as a separate issue as really there isn't much to document, we just need figure out how to make sure people know about this extension when hitting problems with awt. |
Hopefully discoverability via the tooling would be enough |
Yeah sure. Just waiting for a final CI run to make sure I've not forgotten anything. |
This workflow status is outdated as a new workflow run has been triggered. Failing Jobs - Building 012d2a8
Full information is available in the Build summary check run. Failures⚙️ MicroProfile TCKs Tests #- Failing: tcks/resteasy-reactive
📦 tcks/resteasy-reactive✖ 📦 tcks/resteasy-reactive/target/testsuite/tests✖
|
* Even though reflection and JNI registrations happen in the AWT extenssion, runtime initialization packages are defined in core. * This is done to avoid sun.java2d, and related classes, to be build time initialized, which causes issues with other modules. * Move ImageIO test from main to awt. * Make Apache Tika depend on AWT extension * Mark Tika packages that need runtime initialization for AWT. This definition can happen directly at the Tika extension level. Fix formatting
Squashed and pushed. This is ready to go in now. |
012d2a8
to
b6038fc
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.
Thanks!
Failing Jobs - Building b6038fc
Full information is available in the Build summary check run. Failures⚙️ Gradle Tests - JDK 11 Windows #- Failing: integration-tests/gradle
📦 integration-tests/gradle✖
|
@Sanne I'll leave the final decision up to you since you've been following this closely |
damn :) thanks all! merged it |
One more question: Should we backport this into |
@geoand Yeah, the impact on existing code is minimal (just add awt/imageio/java2d packages for runtime init). For the rest of the code to kick in, an extension has to depend on |
I am removing the backport label as a concequence of #11563 |
@geoand Can someone create an issue for #11563 and assign it to me? I've been digging into graalvm/mandrel#292 |
Done: #20491 |
This PR replaces #20148.
It enables AWT use cases, such as image resizing, using a dedicated AWT extension.
Note: the extension was generated with the
create-extension
command of the quarkus maven plugin.