Skip to content

Commit

Permalink
Added support for enableAddAllCharsets, jniConfigurationFiles, resour…
Browse files Browse the repository at this point in the history
…ceConfigurationFiles (#17)

Co-authored-by: Mike Friesen - FormKiQ <mike@formkiq.com>
  • Loading branch information
mfriesen and formkiqMike authored Sep 15, 2022
1 parent 90322f4 commit 1eecda2
Show file tree
Hide file tree
Showing 5 changed files with 88 additions and 4 deletions.
11 changes: 11 additions & 0 deletions .settings/org.eclipse.buildship.core.prefs
Original file line number Diff line number Diff line change
@@ -1,2 +1,13 @@
arguments=
auto.sync=false
build.scans.enabled=false
connection.gradle.distribution=GRADLE_DISTRIBUTION(WRAPPER)
connection.project.dir=
eclipse.preferences.version=1
gradle.user.home=
java.home=
jvm.arguments=
offline.mode=false
override.workspace.settings=false
show.console.view=false
show.executions.view=false
2 changes: 2 additions & 0 deletions .settings/org.eclipse.core.resources.prefs
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
eclipse.preferences.version=1
encoding/<project>=UTF-8
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ plugins {
}

group 'com.formkiq.gradle'
version '1.3.0'
version '1.3.1'

sourceCompatibility = "11"
targetCompatibility = "11"
Expand Down
66 changes: 63 additions & 3 deletions src/main/java/com/formkiq/gradle/GraalvmNativeExtension.java
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ public class GraalvmNativeExtension {

/** Additional Classpaths comma separated. */
private Property<String> addClasspath;
/** Enable Add All Charsets. */
private Property<Boolean> enableAddAllCharsets;
/** Allow image building with an incomplete class path. */
private Property<Boolean> enableAllowIncompleteClasspath;
/** Add all security service classes to the generated image. */
Expand Down Expand Up @@ -74,12 +76,16 @@ public class GraalvmNativeExtension {
private ListProperty<String> initializeAtRunTime;
/** Java Version. */
private Property<String> javaVersion;
/** JNI Config File. */
private Property<String> jniConfigurationFiles;
/** Class Name with main() method. */
private Property<String> mainClassName;
/** Output File Name. */
private Property<String> outputFileName;
/** Reflection Config File. */
private Property<String> reflectionConfig;
/** Resource Configuration Files. */
private Property<String> resourceConfigurationFiles;
/** Reflection Config File. */
private Property<String> serializationConfig;
/** Java System Properties. */
Expand All @@ -99,8 +105,11 @@ public GraalvmNativeExtension(final ObjectFactory objects) {
this.mainClassName = objects.property(String.class);
this.reflectionConfig = objects.property(String.class);
this.serializationConfig = objects.property(String.class);
this.jniConfigurationFiles = objects.property(String.class);
this.resourceConfigurationFiles = objects.property(String.class);
this.enableHttp = objects.property(Boolean.class);
this.enableHttps = objects.property(Boolean.class);
this.enableAddAllCharsets = objects.property(Boolean.class);
this.enableVerbose = objects.property(Boolean.class);
this.enableAutoFallback = objects.property(Boolean.class);
this.enableForceFallback = objects.property(Boolean.class);
Expand Down Expand Up @@ -190,6 +199,14 @@ public String getJavaVersion() {
return this.javaVersion.getOrElse(DEFAULT_JAVA_VERSION);
}

/**
* Get JNI Configuration Files.
* @return {@link String}
*/
public String getJniConfigurationFiles() {
return this.jniConfigurationFiles.getOrNull();
}

/**
* Get Main Class Name.
*
Expand Down Expand Up @@ -217,6 +234,14 @@ public String getReflectionConfig() {
return this.reflectionConfig.getOrNull();
}

/**
* Get Resource Configuration Files.
* @return {@link String}
*/
public String getResourceConfigurationFiles() {
return this.resourceConfigurationFiles.getOrNull();
}

/**
* Get Serialization Config File.
*
Expand Down Expand Up @@ -253,6 +278,14 @@ public Boolean isAllowIncompleteClasspath() {
return this.enableAllowIncompleteClasspath.getOrElse(Boolean.FALSE);
}

/**
* Enable Add All Charsets.
* @return {@link Boolean}
*/
public Boolean isEnableAddAllCharsets() {
return this.enableAddAllCharsets.getOrElse(Boolean.FALSE);
}

/**
* Is Enable All Security Services.
*
Expand Down Expand Up @@ -315,7 +348,7 @@ public Boolean isEnableForceFallback() {
public Boolean isEnableHttp() {
return this.enableHttp.getOrElse(Boolean.TRUE);
}

/**
* Is Enable Https.
*
Expand Down Expand Up @@ -406,6 +439,15 @@ public void setAddClasspath(final String cp) {
this.addClasspath.set(cp);
}

/**
* Set Enable AddAllCharsets.
*
* @param enabled Boolean
*/
public void setEnableAddAllCharsets(final Boolean enabled) {
this.enableAddAllCharsets.set(enabled);
}

/**
* Set Allow Incomplete Classpath.
*
Expand Down Expand Up @@ -469,7 +511,7 @@ public void setEnableForceFallback(final Boolean enabled) {
public void setEnableHttp(final Boolean enabled) {
this.enableHttp.set(enabled);
}

/**
* Set Enable Https.
*
Expand Down Expand Up @@ -614,6 +656,15 @@ public void setJavaVersion(final String version) {
this.javaVersion.set(version);
}

/**
* Set JNI Config File.
*
* @param configFile {@link String}
*/
public void setJniConfigurationFiles(final String configFile) {
this.jniConfigurationFiles.set(configFile);
}

/**
* Set Main Class Name.
*
Expand Down Expand Up @@ -641,6 +692,15 @@ public void setReflectionConfig(final String configFile) {
this.reflectionConfig.set(configFile);
}

/**
* Set Resource Config File.
*
* @param configFile {@link String}
*/
public void setResourceConfigurationFiles(final String configFile) {
this.resourceConfigurationFiles.set(configFile);
}

/**
* Set Serialization Config File.
*
Expand All @@ -649,7 +709,7 @@ public void setReflectionConfig(final String configFile) {
public void setSerializationConfig(final String configFile) {
this.serializationConfig.set(configFile);
}

/**
* Set System Property.
*
Expand Down
11 changes: 11 additions & 0 deletions src/main/java/com/formkiq/gradle/internal/NativeImageExecutor.java
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ private List<String> getBuildGraalvmImageArguments(final Project project, final
addBooleanArgument(args, this.extension.isEnableShared(), "--shared");
addBooleanArgument(args, this.extension.isEnableStatic(), "--static");

addBooleanArgument(args, this.extension.isEnableAddAllCharsets(), "-H:+AddAllCharsets");
addStringListArgument(args, this.extension.getInitializeAtBuildTime(),
"--initialize-at-build-time");
addStringListArgument(args, this.extension.getInitializeAtRunTime(),
Expand All @@ -100,6 +101,16 @@ private List<String> getBuildGraalvmImageArguments(final Project project, final
"-H:SerializationConfigurationResources=" + serializationConfig);
}

String jniConfig = this.extension.getJniConfigurationFiles();
if (jniConfig != null) {
addStringArgument(args, jniConfig, "-H:JNIConfigurationFiles=" + jniConfig);
}

String resourceConfig = this.extension.getResourceConfigurationFiles();
if (resourceConfig != null) {
addStringArgument(args, resourceConfig, "-H:ResourceConfigurationFiles=" + resourceConfig);
}

addStringArgument(args, this.extension.getFeatures(),
"--features=" + this.extension.getFeatures());

Expand Down

0 comments on commit 1eecda2

Please sign in to comment.