-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle
83 lines (70 loc) · 2.64 KB
/
build.gradle
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
plugins {
id 'java'
id 'org.jetbrains.kotlin.jvm' version '1.5.0'
id "org.jetbrains.kotlin.kapt" version "1.5.0"
id 'com.github.johnrengelman.shadow' version '7.0.0'
id "org.mikeneck.graalvm-native-image" version "1.3.0"
}
repositories {
mavenLocal()
mavenCentral()
}
dependencies {
implementation platform('org.jetbrains.kotlin:kotlin-bom')
implementation 'org.jetbrains.kotlin:kotlin-stdlib-jdk8'
implementation 'org.junit.jupiter:junit-jupiter:5.7.0'
testImplementation 'org.jetbrains.kotlin:kotlin-test'
implementation 'org.apache.logging.log4j:log4j-core:2.14.1'
implementation 'org.apache.logging.log4j:log4j-api-kotlin:1.0.0'
implementation 'com.squareup.okhttp3:okhttp:4.9.1'
implementation 'com.fasterxml.jackson.module:jackson-module-kotlin:2.12.+'
implementation 'info.picocli:picocli:4.6.1'
kapt 'info.picocli:picocli-codegen:4.6.1'
}
group = 'cc.insulin'
version = '1.2.0'
description = 'GetProfile'
kapt {
arguments {
arg("project", "${project.group}/${project.name}")
}
}
sourceSets {
main.kotlin.srcDirs += 'src/main/java'
test.kotlin.srcDirs += 'src/main/java'
}
nativeImage {
graalVmHome = "/usr/lib/jvm/default/"
mainClass = 'cc.insulin.getprofile.Main'
executableName = 'getprofile'
outputDirectory = file("$buildDir/bin")
arguments {
add '-H:JNIConfigurationFiles=graalvm-native-config/jni-config.json'
add '-H:ReflectionConfigurationFiles=graalvm-native-config/reflect-config.json'
add '-H:ResourceConfigurationFiles=graalvm-native-config/resource-config.json'
add '--no-fallback'
add '--allow-incomplete-classpath'
add '--report-unsupported-elements-at-runtime'
}
}
generateNativeImageConfig {
enabled = true
byRunningApplicationWithoutArguments()
// (I know this isn't elegant. I'll come up with a solution later)
// If the native image configuration needs to be re-generated:
// - make a duplicate of the commented `byRunningApplication` block below, then uncomment the duplicate you just made
// - fill your Nightscout details into your uncommented duplicate
// - run the task `:generateNativeImageConfig`
// - move the files in `/build/native-image-config/` to `/graalvm-native-config/`
// - delete the duplicated block you made
// byRunningApplication {
// arguments('convert', '-u=https://your-nightscout/', '-t', 'token or api secret', '-f', 'profile.json')
// }
}
shadowJar {
archiveBaseName.set('GetProfile')
archiveClassifier.set('full')
manifest {
attributes 'Main-Class': 'cc.insulin.getprofile.Main'
}
}