Fix native-image a bit

This commit is contained in:
JeremyStar™ 2024-07-11 16:15:47 +02:00
parent d02e854d95
commit 005ebfbfae
Signed by: JeremyStarTM
GPG key ID: E366BAEF67E4704D

View file

@ -17,6 +17,8 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
import org.mikeneck.graalvm.BuildTypeSelector
// Plugins // Plugins
plugins { plugins {
id("java") id("java")
@ -87,26 +89,40 @@ application {
// GraalVM native-image plugin configuration // GraalVM native-image plugin configuration
nativeImage { nativeImage {
outputs.upToDateWhen { true }
graalVmHome = project.hasProperty("graalHome") ? project.property("graalHome") as String : System.getProperty("java.home") graalVmHome = project.hasProperty("graalHome") ? project.property("graalHome") as String : System.getProperty("java.home")
mainClass = "de.staropensource.sosengine.testapp.Main"
executableName = "sosengine-testapp" executableName = "sosengine-testapp"
outputDirectory = file("build/bin") outputDirectory = file("build/bin")
setClasspath(shadowJar)
buildType { BuildTypeSelector build ->
build.executable {
main = 'de.staropensource.sosengine.testapp.Main'
}
}
arguments { arguments {
"--color=always" add "-H:+UnlockExperimentalVMOptions"
"-march native" add "--color=always"
"-O3" add "-march=native"
"--gc=g1" add "-O3"
"--no-fallback" add "--no-fallback"
"--enable-all-security-services" add "--report-unsupported-elements-at-runtime"
"--report-unsupported-elements-at-runtime" add "--enable-http"
//"-H:IncludeResources=.*properties\$" add "--enable-https"
add "-H:IncludeResources=.*properties\$"
} }
} }
// Register task for executing the generated binary // Register task for executing the generated binary
tasks.register('runNativeimage', Exec) { tasks.register('runNativeImage', Exec) {
outputs.upToDateWhen { false }
dependsOn(nativeImage) dependsOn(nativeImage)
args(
"-Dsosengine.base.loggerLevel=diagnostic",
"-Dsosengine.base.loggerForceStandardOutput=true",
"-Djansi.mode=force"
)
executable("build/bin/sosengine-testapp") executable("build/bin/sosengine-testapp")
args = application.applicationDefaultJvmArgs
} }