Skip to content

Commit 813fdef

Browse files
committed
added nativeImage option to config and readme
1 parent fb4987b commit 813fdef

File tree

2 files changed

+18
-0
lines changed

2 files changed

+18
-0
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,7 @@ By default it will generate next artifacts in `${outputDirectory} ` folder:
173173
| `extra` | :x: | | Map with extra properties to be used in customized Velocity templates, accesible through `$info.extra` variable. |
174174
| `fileAssociations` | :x: | [`FileAssociation[]`](https://github.com/fvarrui/JavaPackager/blob/master/src/main/java/io/github/fvarrui/javapackager/model/FileAssociation.java) | Associate file extensions or MIME types to the app. |
175175
| `forceInstaller` | :x: | `false` | If `true`, skips operating system check when generating installers. |
176+
| `nativeImage` | :x: | `false` | If `true`, generates a native-image. Note that `jdkVendor` must be set to `graalvm` for this to work. |
176177
| `generateInstaller` | :x: | `true` | Generates an installer for the app. |
177178
| `jdkVersion` | :x: | `17` | JDK version to download and use. Available versions for [adoptium](https://api.adoptium.net/v3/info/available_releases). |
178179
| `jdkVendor` | :x: | `adoptium` | JDK vendor to download the JDK from. Currently supported: `adoptium` |

src/main/java/io/github/fvarrui/javapackager/PackageTask.java

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,13 @@ public class PackageTask {
5252
@Input
5353
@Optional
5454
protected Boolean forceInstaller;
55+
/**
56+
* If true generates a native-image. Note that {@link #jdkVendor} must be set to graalvm for this to work.
57+
*/
58+
@Parameter(property = "nativeImage")
59+
@Input
60+
@Optional
61+
protected Boolean nativeImage;
5562
/**
5663
* Full path to your app main class.
5764
*/
@@ -356,6 +363,7 @@ public PackageTask() {
356363
this.manifest = new Manifest();
357364
this.modules = new ArrayList<>();
358365
this.forceInstaller = false;
366+
this.nativeImage = false;
359367
this.mainClass = "${exec.mainClass}"; //TODO gradle?
360368
//this.appName = (isGradle ? gradleProject.getName() : "${project.name}");
361369
//this.appDisplayName = (isGradle ? gradleProject.getName() : "${project.name}");
@@ -451,6 +459,10 @@ public Boolean isForceInstaller() {
451459
return forceInstaller;
452460
}
453461

462+
public Boolean isNativeImage() {
463+
return nativeImage;
464+
}
465+
454466
/**
455467
* Get main class
456468
*
@@ -870,6 +882,11 @@ public PackageTask forceInstaller(Boolean forceInstaller) {
870882
return this;
871883
}
872884

885+
public PackageTask nativeImage(Boolean nativeImage) {
886+
this.nativeImage = nativeImage;
887+
return this;
888+
}
889+
873890
/**
874891
* Set main class
875892
*

0 commit comments

Comments
 (0)