Skip to content

Commit

Permalink
Merge pull request #13644 from gsmet/graalvm-20.3
Browse files Browse the repository at this point in the history
Upgrade to GraalVM 20.3
  • Loading branch information
gsmet authored Jan 4, 2021
2 parents 23146f0 + cb7f59b commit cb65f52
Show file tree
Hide file tree
Showing 9 changed files with 63 additions and 16 deletions.
2 changes: 1 addition & 1 deletion bom/application/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@
<maven-plugin-annotations.version>3.6.0</maven-plugin-annotations.version>
<plexus-component-annotations.version>2.1.0</plexus-component-annotations.version>
<!-- What we actually depend on for the annotations, as latest Graal is not available in Maven fast enough: -->
<graal-sdk.version>20.2.0</graal-sdk.version>
<graal-sdk.version>20.3.0</graal-sdk.version>
<gizmo.version>1.0.6.Final</gizmo.version>
<jackson.version>2.11.3</jackson.version>
<commons-logging-jboss-logging.version>1.0.0.Final</commons-logging-jboss-logging.version>
Expand Down
6 changes: 3 additions & 3 deletions build-parent/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@
<!-- These properties are needed in order for them to be resolvable by the documentation -->
<!-- The Graal version we suggest using in documentation - as that's
what we work with by self downloading it: -->
<graal-sdk.version-for-documentation>20.2.0</graal-sdk.version-for-documentation>
<mandrel.version-for-documentation>20.1</mandrel.version-for-documentation>
<graal-sdk.version-for-documentation>20.3.0</graal-sdk.version-for-documentation>
<mandrel.version-for-documentation>20.3</mandrel.version-for-documentation>
<rest-assured.version>4.3.2</rest-assured.version>
<axle-client.version>1.1.0</axle-client.version>
<mutiny-client.version>1.1.0</mutiny-client.version>
Expand Down Expand Up @@ -127,7 +127,7 @@
<revapi.checkdeps>false</revapi.checkdeps>

<!-- platform properties -->
<platform.quarkus.native.builder-image>quay.io/quarkus/ubi-quarkus-native-image:20.2.0-java11</platform.quarkus.native.builder-image>
<platform.quarkus.native.builder-image>quay.io/quarkus/ubi-quarkus-native-image:20.3.0-java11</platform.quarkus.native.builder-image>

<script.extension>sh</script.extension>
<docker-prune.location>${maven.multiModuleProjectDirectory}/.github/docker-prune.${script.extension}</docker-prune.location>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -767,9 +767,10 @@ static final class Version implements Comparable<Version> {

static final Version VERSION_20_1 = new Version("GraalVM 20.1", 20, 1, Distribution.ORACLE);
static final Version VERSION_20_2 = new Version("GraalVM 20.2", 20, 2, Distribution.ORACLE);
static final Version VERSION_20_3 = new Version("GraalVM 20.3", 20, 3, Distribution.ORACLE);

static final Version MINIMUM = VERSION_20_1;
static final Version CURRENT = VERSION_20_2;
static final Version CURRENT = VERSION_20_3;

final String fullVersion;
final int major;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
import io.quarkus.deployment.builditem.nativeimage.NativeImageResourceDirectoryBuildItem;
import io.quarkus.deployment.builditem.nativeimage.RuntimeInitializedClassBuildItem;
import io.quarkus.deployment.builditem.nativeimage.ServiceProviderBuildItem;
import io.quarkus.deployment.pkg.steps.NativeBuild;
import io.quarkus.deployment.util.ServiceUtil;
import io.quarkus.tika.TikaParseException;
import io.quarkus.tika.runtime.TikaConfiguration;
Expand Down Expand Up @@ -68,10 +69,17 @@ FeatureBuildItem feature() {
return new FeatureBuildItem(Feature.TIKA);
}

@BuildStep
public void registerRuntimeInitializedClasses(BuildProducer<RuntimeInitializedClassBuildItem> resource) {
//org.apache.tika.parser.pdf.PDFParser (https://issues.apache.org/jira/browse/PDFBOX-4548)
resource.produce(new RuntimeInitializedClassBuildItem("org.apache.pdfbox.pdmodel.font.PDType1Font"));
@BuildStep(onlyIf = NativeBuild.class)
List<RuntimeInitializedClassBuildItem> runtimeInitImageIOClasses() {
return Arrays.asList(
//org.apache.tika.parser.pdf.PDFParser (https://issues.apache.org/jira/browse/PDFBOX-4548)
new RuntimeInitializedClassBuildItem("org.apache.pdfbox.pdmodel.font.PDType1Font"),
// The following classes hold instances of java.awt.color.ICC_ColorSpace that are not allowed in the
// image heap as this class should be initialized at image runtime
// See https://github.com/quarkusio/quarkus/pull/13644
new RuntimeInitializedClassBuildItem("org.apache.pdfbox.rendering.SoftMask"),
new RuntimeInitializedClassBuildItem(
"org.apache.pdfbox.pdmodel.graphics.color.PDCIEDictionaryBasedColorSpace"));
}

@BuildStep
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package io.quarkus.tika.graalvm;
package io.quarkus.tika.runtime.graal;

@com.oracle.svm.core.annotate.Substitute
@com.oracle.svm.core.annotate.TargetClass(className = "org.apache.poi.poifs.nio.CleanerUtil")
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
package io.quarkus.tika.runtime.graal;

import java.awt.color.ColorSpace;
import java.awt.color.ICC_ColorSpace;

import com.oracle.svm.core.annotate.Alias;
import com.oracle.svm.core.annotate.RecomputeFieldValue;
import com.oracle.svm.core.annotate.Substitute;
import com.oracle.svm.core.annotate.TargetClass;

@TargetClass(className = "org.apache.pdfbox.pdmodel.graphics.color.PDDeviceRGB")
final class Target_org_apache_pdfbox_pdmodel_graphics_color_PDDeviceRGB {
@Substitute
private void init() {
// This method appears to be just a workaround for PDFBOX-2184
}

// awtColorSpace is not actually used in PDDeviceRGB
@Alias
@RecomputeFieldValue(kind = RecomputeFieldValue.Kind.Reset)
private volatile ColorSpace awtColorSpace;
}

@TargetClass(className = "org.apache.pdfbox.pdmodel.graphics.color.PDICCBased")
final class Target_org_apache_pdfbox_pdmodel_graphics_color_PDICCBased {
// This class provides alternative paths for when awtColorSpace is null, so it is safe to reset it
@Alias
@RecomputeFieldValue(kind = RecomputeFieldValue.Kind.Reset)
private volatile ICC_ColorSpace awtColorSpace;
}

// Substitutions to prevent ICC_ColorSpace instances from appearing in the native image when using Apache Tika
// See https://github.com/quarkusio/quarkus/pull/13644
// These substitutions can be removed when moving from GraalVM 20.3 to GraalVM 21.0.
class PDFBoxSubstitutions {

}
2 changes: 1 addition & 1 deletion independent-projects/bootstrap/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
<jboss-logmanager-embedded.version>1.0.5</jboss-logmanager-embedded.version>
<slf4j-jboss-logmanager.version>1.1.0.Final</slf4j-jboss-logmanager.version>
<slf4j-api.version>1.7.30</slf4j-api.version>
<graal-sdk.version>20.2.0</graal-sdk.version>
<graal-sdk.version>20.3.0</graal-sdk.version>
<plexus-classworlds.version>2.6.0</plexus-classworlds.version> <!-- not actually used but ClassRealm class is referenced from the API used in BootstrapWagonConfigurator -->
<version.surefire.plugin>3.0.0-M5</version.surefire.plugin>
<smallrye-common.version>1.5.0</smallrye-common.version>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
package io.quarkus.it.corestuff;

import java.awt.image.BufferedImage;
import java.io.IOException;

import javax.imageio.ImageIO;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
Expand All @@ -14,9 +12,10 @@ public class ImageIOSupport extends HttpServlet {

@Override
protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws IOException {
ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
BufferedImage image = ImageIO.read(classLoader.getResource("META-INF/resources/1px.png"));
resp.getWriter().write(image.getHeight() + "x" + image.getWidth());
// Please uncomment this when we upgrade from GraalVM 20.3 to GraalVM 21
// ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
// BufferedImage image = ImageIO.read(classLoader.getResource("META-INF/resources/1px.png"));
// resp.getWriter().write(image.getHeight() + "x" + image.getWidth());
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import static io.restassured.RestAssured.when;
import static org.hamcrest.Matchers.equalTo;

import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;

import io.quarkus.test.junit.QuarkusTest;
Expand All @@ -11,6 +12,7 @@
public class ImageIOTestCase {

@Test
@Disabled("Please bring this back when we upgrade from GraalVM 20.3 to GraalVM 21")
public void testImageRead() {
when().get("/core/imageio").then().body(equalTo("1x1"));
}
Expand Down

0 comments on commit cb65f52

Please sign in to comment.