Skip to content

Commit

Permalink
Update native image generation settings
Browse files Browse the repository at this point in the history
  • Loading branch information
jaguililla committed Mar 31, 2023
1 parent a9a1c58 commit a65d728
Show file tree
Hide file tree
Showing 10 changed files with 65 additions and 31 deletions.
5 changes: 5 additions & 0 deletions .github/workflows/site.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,11 @@ jobs:
~/.local/bin
~/.local/lib/python*/site-packages
- name: Install ImageMagick
run: |
sudo apt-get install fuse
sudo apt-get install librsvg2-bin
- name: Check Out
uses: actions/checkout@v3
with:
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Args= \
-H:IncludeResources=hexagon\\.properties \
--enable-url-protocols=http,https,classpath \
--initialize-at-run-time=com.hexagonkt.core.NetworkKt \
--initialize-at-build-time=com.hexagonkt.core.ClasspathHandler
6 changes: 3 additions & 3 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ mockkVersion=1.13.4
junitVersion=5.9.2
gatlingVersion=3.9.2
jmhVersion=1.36
mkdocsMaterialVersion=9.1.3
mkdocsMaterialVersion=9.1.5
mermaidDokkaVersion=0.4.4
nativeToolsVersion=0.9.20

Expand All @@ -51,8 +51,8 @@ jettyVersion=11.0.14
nettyVersion=4.1.90.Final

# logging
slf4jVersion=2.0.6
logbackVersion=1.4.5
slf4jVersion=2.0.7
logbackVersion=1.4.6

# serialization
jacksonVersion=2.14.2
Expand Down
13 changes: 7 additions & 6 deletions gradle/application.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ classes.dependsOn("buildInfo")

application {
mainClass = findProperty("applicationClass")
final String options = findProperty("options")
if (options != null)
applicationDefaultJvmArgs = options.split(" ").toList()
}

task("buildInfo") {
Expand Down Expand Up @@ -97,14 +100,13 @@ tasks.register("jpackage") {
}
}

tasks.register("tarJpackage", Tar) {
tasks.register("zipJpackage", Zip) {
group = "distribution"
description = "Compress Jpackage distribution in a single file."
dependsOn("jpackage")

from(buildDir.toPath().resolve(project.name).toFile())
compression = Compression.BZIP2
archiveFileName.set("${project.name}-${project.version}-jpackage.tbz2")
archiveFileName.set("${project.name}-${project.version}-jpackage.zip")
destinationDirectory.set(buildDir.toPath().resolve("distributions").toFile())
}

Expand Down Expand Up @@ -149,13 +151,12 @@ tasks.register("jlink", Exec) {
}
}

tasks.register("tarJlink", Tar) {
tasks.register("zipJlink", Zip) {
group = "distribution"
description = "Compress JRE distribution in a single file."
dependsOn("jlink")

from(buildDir.toPath().resolve(project.name).toFile())
compression = Compression.BZIP2
archiveFileName.set("${project.name}-${project.version}-jlink.tbz2")
archiveFileName.set("${project.name}-${project.version}-jlink.zip")
destinationDirectory.set(buildDir.toPath().resolve("distributions").toFile())
}
10 changes: 0 additions & 10 deletions gradle/kotlin.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -75,16 +75,6 @@ processResources {
}
}

jar {
manifest {
attributes("Automatic-Module-Name": "${project.group}.${project.name.replace('_', '.')}")
}
}

tasks.compileJava.doFirst {
options.compilerArgs = [ "--module-path", classpath.asPath ]
}

tasks.withType(JavaCompile) {
options.encoding = "UTF-8"
}
Expand Down
15 changes: 3 additions & 12 deletions gradle/native.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,13 @@ apply(plugin: "org.graalvm.buildtools.native")

graalvmNative {
agent {
final String codeFilterFile = findProperty("codeFilterFile")
defaultMode = codeFilterFile == null? "standard" : "conditional"
defaultMode = "standard"

metadataCopy {
inputTaskNames.add("test")
final String buildPath = project.buildDir.absolutePath
outputDirectories.add("$buildPath/resources/main/META-INF/native-image")
}

modes {
conditional {
if (codeFilterFile != null)
userCodeFilterPath.set(rootProject.file(codeFilterFile).absolutePath)
}
}
}

metadataRepository {
Expand All @@ -42,7 +34,7 @@ tasks.register("upx", Exec) {
}
}

tasks.register("tarNative", Tar) {
tasks.register("zipNative", Zip) {
group = "distribution"
description = "Compress native executable in a ZIP file."
dependsOn("nativeCompile")
Expand All @@ -51,8 +43,7 @@ tasks.register("tarNative", Tar) {
final String arch = System.getProperty("os.arch").toLowerCase()
final String source = os.contains("windows")? "${project.name}.exe" : project.name
from("$buildDir/native/nativeCompile")
compression = Compression.BZIP2
include(source)
archiveFileName.set("${project.name}-${project.version}-${os}-${arch}.tbz2")
archiveFileName.set("${project.name}-${project.version}-${os}-${arch}.zip")
destinationDirectory.set(buildDir.toPath().resolve("distributions").toFile())
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
[
{
"name": "kotlin.internal.jdk8.JDK8PlatformImplementations",
"allPublicMethods": true,
"allDeclaredFields": true,
"allDeclaredMethods": true,
"allDeclaredConstructors": true
}
]
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Args=--enable-preview
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
[
{
"name": "org.eclipse.jetty.http.pathmap.PathSpecSet",
"allPublicMethods": true,
"allDeclaredFields": true,
"allDeclaredMethods": true,
"allDeclaredConstructors": true
},
{
"name": "org.eclipse.jetty.util.AsciiLowerCaseSet",
"allPublicMethods": true,
"allDeclaredFields": true,
"allDeclaredMethods": true,
"allDeclaredConstructors": true
}
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
[
{
"name": "java.util.HashSet",
"allPublicMethods": true,
"allDeclaredFields": true,
"allDeclaredMethods": true,
"allDeclaredConstructors": true
},
{
"name": "java.lang.Enum$EnumDesc",
"allPublicMethods": true,
"allDeclaredFields": true,
"allDeclaredMethods": true,
"allDeclaredConstructors": true
}
]

0 comments on commit a65d728

Please sign in to comment.