-
-
Notifications
You must be signed in to change notification settings - Fork 16
Expand file tree
/
Copy pathbuild.gradle
More file actions
145 lines (120 loc) · 4.11 KB
/
build.gradle
File metadata and controls
145 lines (120 loc) · 4.11 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
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
import org.apache.tools.ant.taskdefs.condition.Os
plugins {
alias(libs.plugins.shadow)
id 'application'
id 'java'
id 'jacoco'
}
repositories {
mavenCentral()
}
dependencies {
implementation libs.batik
implementation libs.gson
implementation libs.imageio.batik
implementation libs.imageio.psd
implementation libs.jave
implementation libs.logback.classic
implementation libs.logback.core
implementation libs.scrimage.core
implementation libs.scrimage.formats.extra
implementation libs.scrimage.webp
implementation libs.slf4j.api
implementation libs.telegram.bot.api
implementation libs.tika
testRuntimeOnly libs.junit.platform
testImplementation libs.hamcrest
testImplementation libs.junit
testImplementation libs.mockwebserver
constraints {
implementation(libs.okio) {
because 'CVE-2023-3635: Okio Signed to Unsigned Conversion Error vulnerability'
}
}
}
group = 'com.github.stickerifier'
version = '1.0'
description = 'Telegram bot to convert medias in the format required to be used as Telegram stickers'
java {
toolchain {
languageVersion = JavaLanguageVersion.of(24)
vendor = JvmVendorSpec.AZUL
}
}
tasks.withType(JavaCompile).configureEach {
options.encoding = 'UTF-8'
}
def jreOutputDir = layout.buildDirectory.dir('jre')
tasks.register('jre') {
inputs.property('options', ['--strip-debug', '--no-header-files', '--no-man-pages'])
inputs.property('modules', ['java.desktop', 'java.instrument', 'java.naming', 'java.sql', 'jdk.crypto.ec', 'jdk.unsupported'])
outputs.dir(jreOutputDir)
doFirst {
delete(jreOutputDir)
}
def javaLauncher = javaToolchains.launcherFor(java.toolchain)
doLast {
def installationPath = javaLauncher.get().metadata.installationPath
def jlink = installationPath.file(Os.isFamily(Os.FAMILY_WINDOWS) ? 'bin\\jlink.exe' : 'bin/jlink')
def jmods = installationPath.dir('jmods')
def output = providers.exec {
ignoreExitValue = true
commandLine = [
jlink.toString(), '-v',
*(inputs.properties['options'] as List),
'--module-path', jmods.toString(),
'--add-modules', (inputs.properties['modules'] as List).join(','),
'--output', jreOutputDir.get().toString()
]
}
def result = output.result.get()
if (result.exitValue == 0) {
logger.info(output.standardOutput.asText.get())
} else {
logger.log(LogLevel.ERROR, output.standardError.asText.get())
}
result.assertNormalExitValue()
result.rethrowFailure()
}
}
test {
dependsOn tasks.named('jre')
inputs.dir(jreOutputDir)
executable = jreOutputDir.get().file(Os.isFamily(Os.FAMILY_WINDOWS) ? 'bin\\java.exe' : 'bin/java')
useJUnitPlatform()
finalizedBy jacocoTestReport
}
jacocoTestReport {
reports {
html.required = false
xml.required = true
xml.outputLocation = file('.qodana/code-coverage/report.xml')
}
afterEvaluate {
classDirectories = files(classDirectories.files.collect {
fileTree(dir: it, exclude: ['**/MediaConstraints.class',
'**/stickerify/exception/**',
'**/stickerify/process/**',
'**/stickerify/runner**',
'**/stickerify/telegram/**'])
})
}
}
application {
mainClass = 'com.github.stickerifier.stickerify.runner.Main'
}
shadowJar {
duplicatesStrategy = DuplicatesStrategy.INCLUDE
mergeServiceFiles()
failOnDuplicateEntries = true
exclude('dist_webp_binaries/',
'META-INF/LICENSE',
'META-INF/LICENSE.txt',
'META-INF/NOTICE',
'META-INF/NOTICE.txt',
'license/LICENSE',
'license/LICENSE.dom-documentation.txt',
'license/LICENSE.dom-software.txt',
'license/NOTICE',
'license/README.dom.txt')
}