forked from quarkusio/quarkus
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add image resize support via AWT extension quarkusio#19789
- Loading branch information
Showing
13 changed files
with
370 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
20 changes: 0 additions & 20 deletions
20
core/runtime/src/main/java/io/quarkus/runtime/graal/Java2DSubstitutions.java
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> | ||
<modelVersion>4.0.0</modelVersion> | ||
<parent> | ||
<groupId>io.quarkus</groupId> | ||
<artifactId>quarkus-awt-parent</artifactId> | ||
<version>999-SNAPSHOT</version> | ||
</parent> | ||
<artifactId>quarkus-awt-deployment</artifactId> | ||
<name>Quarkus - Awt - Deployment</name> | ||
<dependencies> | ||
<dependency> | ||
<groupId>io.quarkus</groupId> | ||
<artifactId>quarkus-arc-deployment</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>io.quarkus</groupId> | ||
<artifactId>quarkus-awt</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>io.quarkus</groupId> | ||
<artifactId>quarkus-junit5-internal</artifactId> | ||
<scope>test</scope> | ||
</dependency> | ||
</dependencies> | ||
<build> | ||
<plugins> | ||
<plugin> | ||
<artifactId>maven-compiler-plugin</artifactId> | ||
<configuration> | ||
<annotationProcessorPaths> | ||
<path> | ||
<groupId>io.quarkus</groupId> | ||
<artifactId>quarkus-extension-processor</artifactId> | ||
<version>${project.version}</version> | ||
</path> | ||
</annotationProcessorPaths> | ||
</configuration> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
</project> |
75 changes: 75 additions & 0 deletions
75
extensions/awt/deployment/src/main/java/io/quarkus/awt/deployment/AwtProcessor.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
package io.quarkus.awt.deployment; | ||
|
||
import io.quarkus.deployment.annotations.BuildStep; | ||
import io.quarkus.deployment.builditem.FeatureBuildItem; | ||
import io.quarkus.deployment.builditem.nativeimage.JniRuntimeAccessBuildItem; | ||
import io.quarkus.deployment.builditem.nativeimage.ReflectiveClassBuildItem; | ||
|
||
class AwtProcessor { | ||
private static final String FEATURE = "awt"; | ||
|
||
@BuildStep | ||
ReflectiveClassBuildItem setupReflectionClasses() { | ||
return new ReflectiveClassBuildItem(false, false, | ||
"sun.awt.X11GraphicsEnvironment", | ||
"sun.awt.X11.XToolkit"); | ||
} | ||
|
||
@BuildStep | ||
JniRuntimeAccessBuildItem setupJava2DClasses() { | ||
return new JniRuntimeAccessBuildItem(true, true, true, | ||
"java.awt.AlphaComposite", | ||
"java.awt.Color", | ||
"java.awt.geom.AffineTransform", | ||
"java.awt.geom.Path2D", | ||
"java.awt.geom.Path2D$Float", | ||
"java.awt.image.BufferedImage", | ||
"java.awt.image.ColorModel", | ||
"java.awt.image.IndexColorModel", | ||
"java.awt.image.Raster", | ||
"java.awt.image.SampleModel", | ||
"java.awt.image.SinglePixelPackedSampleModel", | ||
"sun.awt.SunHints", | ||
"sun.awt.image.BufImgSurfaceData$ICMColorData", | ||
"sun.awt.image.ByteComponentRaster", | ||
"sun.awt.image.BytePackedRaster", | ||
"sun.awt.image.ImageRepresentation", | ||
"sun.awt.image.IntegerComponentRaster", | ||
"sun.java2d.Disposer", | ||
"sun.java2d.InvalidPipeException", | ||
"sun.java2d.NullSurfaceData", | ||
"sun.java2d.SunGraphics2D", | ||
"sun.java2d.SurfaceData", | ||
"sun.java2d.loops.Blit", | ||
"sun.java2d.loops.BlitBg", | ||
"sun.java2d.loops.CompositeType", | ||
"sun.java2d.loops.DrawGlyphList", | ||
"sun.java2d.loops.DrawGlyphListAA", | ||
"sun.java2d.loops.DrawGlyphListLCD", | ||
"sun.java2d.loops.DrawLine", | ||
"sun.java2d.loops.DrawParallelogram", | ||
"sun.java2d.loops.DrawPath", | ||
"sun.java2d.loops.DrawPolygons", | ||
"sun.java2d.loops.DrawRect", | ||
"sun.java2d.loops.FillParallelogram", | ||
"sun.java2d.loops.FillPath", | ||
"sun.java2d.loops.FillRect", | ||
"sun.java2d.loops.FillSpans", | ||
"sun.java2d.loops.GraphicsPrimitive", | ||
"sun.java2d.loops.GraphicsPrimitiveMgr", | ||
"sun.java2d.loops.GraphicsPrimitive[]", | ||
"sun.java2d.loops.MaskBlit", | ||
"sun.java2d.loops.MaskFill", | ||
"sun.java2d.loops.ScaledBlit", | ||
"sun.java2d.loops.SurfaceType", | ||
"sun.java2d.loops.TransformHelper", | ||
"sun.java2d.loops.XORComposite", | ||
"sun.java2d.pipe.Region", | ||
"sun.java2d.pipe.RegionIterator"); | ||
} | ||
|
||
@BuildStep | ||
FeatureBuildItem feature() { | ||
return new FeatureBuildItem(FEATURE); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> | ||
<modelVersion>4.0.0</modelVersion> | ||
<parent> | ||
<groupId>io.quarkus</groupId> | ||
<artifactId>quarkus-extensions-parent</artifactId> | ||
<version>999-SNAPSHOT</version> | ||
</parent> | ||
<artifactId>quarkus-awt-parent</artifactId> | ||
<packaging>pom</packaging> | ||
<name>Quarkus - Awt - Parent</name> | ||
<modules> | ||
<module>deployment</module> | ||
<module>runtime</module> | ||
</modules> | ||
</project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> | ||
<modelVersion>4.0.0</modelVersion> | ||
<parent> | ||
<groupId>io.quarkus</groupId> | ||
<artifactId>quarkus-awt-parent</artifactId> | ||
<version>999-SNAPSHOT</version> | ||
</parent> | ||
<artifactId>quarkus-awt</artifactId> | ||
<name>Quarkus - Awt - Runtime</name> | ||
<dependencies> | ||
<dependency> | ||
<groupId>io.quarkus</groupId> | ||
<artifactId>quarkus-arc</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.graalvm.nativeimage</groupId> | ||
<artifactId>svm</artifactId> | ||
<scope>provided</scope> | ||
</dependency> | ||
</dependencies> | ||
<build> | ||
<plugins> | ||
<plugin> | ||
<groupId>io.quarkus</groupId> | ||
<artifactId>quarkus-bootstrap-maven-plugin</artifactId> | ||
</plugin> | ||
<plugin> | ||
<artifactId>maven-compiler-plugin</artifactId> | ||
<configuration> | ||
<annotationProcessorPaths> | ||
<path> | ||
<groupId>io.quarkus</groupId> | ||
<artifactId>quarkus-extension-processor</artifactId> | ||
<version>${project.version}</version> | ||
</path> | ||
</annotationProcessorPaths> | ||
</configuration> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
</project> |
22 changes: 22 additions & 0 deletions
22
extensions/awt/runtime/src/main/java/io/quarkus/awt/runtime/graal/AwtFeature.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
package io.quarkus.awt.runtime.graal; | ||
|
||
import org.graalvm.nativeimage.ImageSingletons; | ||
import org.graalvm.nativeimage.hosted.Feature; | ||
import org.graalvm.nativeimage.impl.RuntimeClassInitializationSupport; | ||
|
||
import com.oracle.svm.core.annotate.AutomaticFeature; | ||
|
||
@AutomaticFeature | ||
public class AwtFeature implements Feature { | ||
@Override | ||
public void afterRegistration(AfterRegistrationAccess access) { | ||
final RuntimeClassInitializationSupport runtimeInit = ImageSingletons.lookup(RuntimeClassInitializationSupport.class); | ||
final String reason = "Quarkus run time init for AWT"; | ||
runtimeInit.initializeAtRunTime("com.sun.imageio", reason); | ||
runtimeInit.initializeAtRunTime("java.awt", reason); | ||
runtimeInit.initializeAtRunTime("javax.imageio", reason); | ||
runtimeInit.initializeAtRunTime("sun.awt", reason); | ||
runtimeInit.initializeAtRunTime("sun.font", reason); | ||
runtimeInit.initializeAtRunTime("sun.java2d", reason); | ||
} | ||
} |
9 changes: 9 additions & 0 deletions
9
extensions/awt/runtime/src/main/resources/META-INF/quarkus-extension.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
name: Awt | ||
#description: Awt ... | ||
metadata: | ||
# keywords: | ||
# - awt | ||
# guide: ... | ||
# categories: | ||
# - "miscellaneous" | ||
# status: "preview" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -201,6 +201,8 @@ | |
|
||
<!-- Relocations --> | ||
<module>vertx-web</module> | ||
|
||
<module>awt</module> | ||
</modules> | ||
|
||
<build> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,93 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> | ||
<modelVersion>4.0.0</modelVersion> | ||
<parent> | ||
<groupId>io.quarkus</groupId> | ||
<artifactId>quarkus-integration-tests-parent</artifactId> | ||
<version>999-SNAPSHOT</version> | ||
</parent> | ||
<artifactId>quarkus-awt-integration-tests</artifactId> | ||
<name>Quarkus - Awt - Integration Tests</name> | ||
<dependencies> | ||
<!-- Minimal test dependencies to *-deployment artifacts for consistent build order --> | ||
<dependency> | ||
<groupId>io.quarkus</groupId> | ||
<artifactId>quarkus-awt-deployment</artifactId> | ||
<version>${project.version}</version> | ||
<type>pom</type> | ||
<scope>test</scope> | ||
<exclusions> | ||
<exclusion> | ||
<groupId>*</groupId> | ||
<artifactId>*</artifactId> | ||
</exclusion> | ||
</exclusions> | ||
</dependency> | ||
<dependency> | ||
<groupId>io.quarkus</groupId> | ||
<artifactId>quarkus-awt</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>io.quarkus</groupId> | ||
<artifactId>quarkus-junit5</artifactId> | ||
<scope>test</scope> | ||
</dependency> | ||
</dependencies> | ||
<build> | ||
<plugins> | ||
<plugin> | ||
<groupId>io.quarkus</groupId> | ||
<artifactId>quarkus-maven-plugin</artifactId> | ||
<executions> | ||
<execution> | ||
<goals> | ||
<goal>build</goal> | ||
</goals> | ||
</execution> | ||
</executions> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
<profiles> | ||
<profile> | ||
<id>native-image</id> | ||
<activation> | ||
<property> | ||
<name>native</name> | ||
</property> | ||
</activation> | ||
<build> | ||
<plugins> | ||
<plugin> | ||
<artifactId>maven-surefire-plugin</artifactId> | ||
<configuration> | ||
<skipTests>${native.surefire.skip}</skipTests> | ||
</configuration> | ||
</plugin> | ||
<plugin> | ||
<artifactId>maven-failsafe-plugin</artifactId> | ||
<executions> | ||
<execution> | ||
<goals> | ||
<goal>integration-test</goal> | ||
<goal>verify</goal> | ||
</goals> | ||
<configuration> | ||
<systemPropertyVariables> | ||
<native.image.path>${project.build.directory}/${project.build.finalName}-runner</native.image.path> | ||
<java.util.logging.manager>org.jboss.logmanager.LogManager</java.util.logging.manager> | ||
<maven.home>${maven.home}</maven.home> | ||
</systemPropertyVariables> | ||
</configuration> | ||
</execution> | ||
</executions> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
<properties> | ||
<quarkus.package.type>native</quarkus.package.type> | ||
</properties> | ||
</profile> | ||
</profiles> | ||
</project> |
7 changes: 7 additions & 0 deletions
7
integration-tests/awt/src/test/java/io/quarkus/awt/it/AwtImageResizeIT.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
package io.quarkus.awt.it; | ||
|
||
import io.quarkus.test.junit.main.QuarkusMainIntegrationTest; | ||
|
||
@QuarkusMainIntegrationTest | ||
public class AwtImageResizeIT extends AwtImageResizeTest { | ||
} |
Oops, something went wrong.