-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
87 lines (73 loc) · 2.34 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
84
85
86
87
import com.bmuschko.gradle.docker.tasks.image.*
import com.bmuschko.gradle.docker.tasks.container.*
plugins {
id 'groovy'
id 'application'
// Shadow JAR (packs all dependencies into single JAR)
id 'com.github.johnrengelman.shadow' version '8.1.1'
// Not actually used for spring boot, only for lower-level docker steps
id 'com.bmuschko.docker-spring-boot-application' version '6.1.4'
}
group = 'gg.xp'
version = '1.0-SNAPSHOT'
repositories {
mavenCentral()
}
tasks.withType(GroovyCompile).configureEach {
groovyOptions.configurationScript = file 'groovyConfig.groovy'
}
dependencies {
// Language
implementation 'org.apache.groovy:groovy:4.0.21'
// Discord library
implementation 'com.discord4j:discord4j-core:3.2.6'
// Markdown library
// https://mvnrepository.com/artifact/org.commonmark/commonmark
implementation group: 'org.commonmark', name: 'commonmark', version: '0.22.0'
// utilities
// https://mvnrepository.com/artifact/org.apache.commons/commons-lang3
implementation 'org.apache.commons:commons-lang3:3.14.0'
// @Nullable and @NonNull etc
compileOnly 'org.jetbrains:annotations:24.1.0'
testImplementation platform('org.junit:junit-bom:5.10.2')
testImplementation 'org.junit.jupiter:junit-jupiter'
}
application {
mainClass = 'gg.xp.resbot.Main'
}
def javaVersion = JavaVersion.VERSION_21
java {
sourceCompatibility = javaVersion
targetCompatibility = javaVersion
toolchain {
languageVersion = JavaLanguageVersion.of(21)
}
}
// Runnable JAR
jar {
manifest {
attributes 'Main-Class': application.mainClass.get()
}
}
test {
useJUnitPlatform()
}
// Only creates dockerfile - does not build
tasks.register('createDockerFile', Dockerfile) {
group = 'distribution'
description = 'Create Dockerfile'
from 'openjdk:21'
copyFile layout.projectDirectory.asFile.relativePath(shadowJar.archiveFile.get().asFile), '/app/app.jar'
entryPoint 'java'
workingDir '/app'
defaultCommand '-jar', 'app.jar'
}
// Build docker image
// Broken on local at the moment because this plugin isn't TLS-compatible
tasks.register('buildImage', DockerBuildImage) {
group = 'distribution'
description = 'Build Docker image'
dependsOn createDockerFile, shadowJar
dockerFile = createDockerFile.destFile
images = ["resbot"]
}