Skip to content

Commit e0ebff4

Browse files
committed
gradle: add native-image plugin
1 parent 1678d19 commit e0ebff4

2 files changed

Lines changed: 29 additions & 1 deletion

File tree

build.gradle

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
1+
// sudo apt install libfreetype-dev
12
plugins {
2-
id 'application'
3+
id 'application'
4+
id 'org.graalvm.buildtools.native' version '0.9.26'
35
}
46

57
group = 'org.contikios.cooja'
@@ -70,6 +72,26 @@ application {
7072
'--enable-preview', '--enable-native-access', 'ALL-UNNAMED']
7173
}
7274

75+
graalvmNative {
76+
binaries {
77+
main {
78+
javaLauncher = javaToolchains.launcherFor {
79+
languageVersion = JavaLanguageVersion.of(javaVersion)
80+
vendor = JvmVendorSpec.matching("Oracle Corporation")
81+
}
82+
fallback = true
83+
useFatJar = true
84+
buildArgs.add('--enable-preview')
85+
buildArgs.add('--report-unsupported-elements-at-runtime')
86+
}
87+
}
88+
}
89+
90+
tasks.named("nativeCompile") {
91+
dependsOn fullJar
92+
classpathJar = layout.buildDirectory.file("libs/cooja-full.jar")
93+
}
94+
7395
tasks.withType(JavaCompile).configureEach {
7496
options.compilerArgs += ['--enable-preview',
7597
"-Aproject=${project.group}/${project.name}"]

settings.gradle

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
pluginManagement {
2+
repositories {
3+
mavenCentral()
4+
gradlePluginPortal()
5+
}
6+
}
17
plugins {
28
id 'org.gradle.toolchains.foojay-resolver-convention' version '0.7.0'
39
}

0 commit comments

Comments
 (0)