Skip to content

Commit

Permalink
Fix version after which org.graalvm.nativeimage needs to be exported
Browse files Browse the repository at this point in the history
  • Loading branch information
zakkak committed Sep 21, 2023
1 parent 268dda7 commit 2fdf6d5
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,22 +12,30 @@
public final class JPMSExportBuildItem extends MultiBuildItem {
private final String moduleName;
private final String packageName;
private final GraalVM.Version exportAfter;
private final GraalVM.Version exportSince;
private final GraalVM.Version exportBefore;

public JPMSExportBuildItem(String moduleName, String packageName) {
this(moduleName, packageName, null, null);
}

public JPMSExportBuildItem(String moduleName, String packageName, GraalVM.Version exportAfter) {
this(moduleName, packageName, exportAfter, null);
public JPMSExportBuildItem(String moduleName, String packageName, GraalVM.Version exportSince) {
this(moduleName, packageName, exportSince, null);
}

public JPMSExportBuildItem(String moduleName, String packageName, GraalVM.Version exportAfter,
/**
* Creates a build item that indicates that a Java package should be exported for a specific GraalVM version range.
*
* @param moduleName the module name
* @param packageName the package name
* @param exportSince the version of GraalVM since which the package should be exported (inclusive)
* @param exportBefore the version of GraalVM before which the package should be exported (exclusive)
*/
public JPMSExportBuildItem(String moduleName, String packageName, GraalVM.Version exportSince,
GraalVM.Version exportBefore) {
this.moduleName = moduleName;
this.packageName = packageName;
this.exportAfter = exportAfter;
this.exportSince = exportSince;
this.exportBefore = exportBefore;
}

Expand Down Expand Up @@ -56,16 +64,16 @@ public int hashCode() {
return Objects.hash(moduleName, packageName);
}

public GraalVM.Version getExportAfter() {
return exportAfter;
public GraalVM.Version getExportSince() {
return exportSince;
}

public GraalVM.Version getExportBefore() {
return exportBefore;
}

public boolean isRequired(GraalVM.Version current) {
return (exportAfter == null || current.compareTo(exportAfter) > 0) &&
return (exportSince == null || current.compareTo(exportSince) >= 0) &&
(exportBefore == null || current.compareTo(exportBefore) < 0);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ void addExportsToNativeImage(BuildProducer<JPMSExportBuildItem> features) {
features.produce(new JPMSExportBuildItem("org.graalvm.sdk", "org.graalvm.nativeimage.impl", null,
GraalVM.Version.VERSION_23_1_0));
features.produce(new JPMSExportBuildItem("org.graalvm.nativeimage", "org.graalvm.nativeimage.impl",
GraalVM.Version.VERSION_23_0_0));
GraalVM.Version.VERSION_23_1_0));
}

@BuildStep
Expand Down

0 comments on commit 2fdf6d5

Please sign in to comment.