Repository navigation
Expand file tree
/
Copy pathbuild.gradle.kts
More file actions
128 lines (104 loc) · 4.13 KB
/
Copy pathbuild.gradle.kts
File metadata and controls
128 lines (104 loc) · 4.13 KB
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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
import com.github.stickerifier.stickerify.DownloadOpenTelemetryAgentTask
import com.github.stickerifier.stickerify.JlinkJavaLauncher
import com.github.stickerifier.stickerify.JlinkTask
import com.github.stickerifier.stickerify.JunitSeedArgumentProvider
import io.spring.gradle.nullability.NullabilityOptions
import org.gradle.internal.buildconfiguration.DaemonJvmPropertiesConfigurator
plugins {
java
application
alias(libs.plugins.spring.nullability)
}
repositories {
mavenCentral()
}
dependencies {
implementation(libs.gson)
implementation(libs.jspecify)
implementation(libs.logback.classic)
implementation(libs.logstash.logback.encoder)
implementation(libs.opentelemetry.instrumentation.annotations)
implementation(libs.telegram.bot.api)
implementation(libs.tika)
constraints {
add("implementation", libs.jackson.core)
}
testImplementation(libs.hamcrest)
testImplementation(libs.junit.jupiter)
testImplementation(libs.mockwebserver)
testRuntimeOnly(libs.junit.platform)
}
group = "com.github.stickerifier"
version = "2.0"
description = "Telegram bot to convert medias into the format required to be used as Telegram stickers"
java.toolchain {
languageVersion = JavaLanguageVersion.of(27)
vendor = JvmVendorSpec.ADOPTIUM
}
tasks.named<UpdateDaemonJvm>(DaemonJvmPropertiesConfigurator.TASK_NAME) {
languageVersion = JavaLanguageVersion.of(27)
vendor = JvmVendorSpec.ADOPTIUM
}
val jlink = tasks.register<JlinkTask>(JlinkTask.DEFAULT_TASK_NAME) {
description = "Generates a minimal JRE for the project with compact object headers archive."
options = listOf("--strip-debug", "--no-header-files", "--no-man-pages", "--ignore-modified-runtime", "--generate-cds-archive")
modules = listOf(
"java.instrument", // for JUnit
"java.management", // for OpenTelemetry
"java.naming", // for Logback
"java.sql", // for Tika
"jdk.unsupported" // for Gson
)
includeModulePath = false
javaCompiler = javaToolchains.compilerFor(java.toolchain)
}
nullability {
jspecify {
experimental = true
}
}
val CompileOptions.nullability: NullabilityOptions
get() = (this as ExtensionAware).extensions.getByName("nullability") as NullabilityOptions
tasks.named<JavaCompile>(JavaPlugin.COMPILE_TEST_JAVA_TASK_NAME) {
options.nullability.checking = "tests"
options.nullability.jspecify {
experimental = true
}
}
tasks.test {
inputs.dir(jlink.map { it.outputDirectory.get().asFile })
javaLauncher = providers.provider { JlinkJavaLauncher(jlink.get()) }
useJUnitPlatform()
jvmArgs("--enable-final-field-mutation=ALL-UNNAMED")
testLogging {
events("started", "passed", "failed", "skipped")
}
val seedProvider = JunitSeedArgumentProvider(providers.gradleProperty("junitSeed"))
jvmArgumentProviders.add(seedProvider)
doFirst {
println("Test seed: ${seedProvider.resolveSeed()}")
}
}
application {
mainClass = "com.github.stickerifier.stickerify.runner.Main"
applicationDefaultJvmArgs = listOf("--enable-final-field-mutation=ALL-UNNAMED")
}
val openTelemetryAgent = tasks.register<DownloadOpenTelemetryAgentTask>(DownloadOpenTelemetryAgentTask.DEFAULT_TASK_NAME) {
description = "Downloads the OpenTelemetry agent for the distribution package."
version = libs.versions.opentelemetry.get()
destinationFile = layout.buildDirectory.file("openTelemetryAgent/opentelemetry-javaagent.jar")
}
tasks.named<CreateStartScripts>(ApplicationPlugin.TASK_START_SCRIPTS_NAME) {
val agentJarName = openTelemetryAgent.get().destinationFile.get().asFile.name
defaultJvmOpts = (defaultJvmOpts ?: emptyList()) + "-javaagent:$agentJarName"
(unixStartScriptGenerator as TemplateBasedScriptGenerator).template = resources.text.fromFile("src/main/resources/customUnixStartScript.txt")
(windowsStartScriptGenerator as TemplateBasedScriptGenerator).template = resources.text.fromFile("src/main/resources/customWindowsStartScript.txt")
}
distributions {
main {
contents {
from(jlink)
from(openTelemetryAgent)
}
}
}