forked from Together-Java/TJ-Bot
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
98 lines (82 loc) · 2.63 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
88
89
90
91
92
93
94
95
96
97
98
plugins {
id 'java'
id "com.diffplug.spotless" version "6.25.0"
id "org.sonarqube" version "5.1.0.4882"
id "name.remal.sonarlint" version "4.2.2"
}
group 'org.togetherjava'
version '1.0-SNAPSHOT'
ext {
jooqVersion = '3.19.1'
jacksonVersion = '2.17.0'
chatGPTVersion = '0.18.0'
}
// Skips sonarlint during the build, useful for testing purposes.
Boolean skipSonarlint = false
// Sonarqube task should be ran last, so it can collect all the useful data during the build.
project.tasks["sonarqube"].dependsOn "build"
sonarqube {
properties {
property "sonar.projectKey", "Together-Java_TJ-Bot"
property "sonar.organization", "togetherjava"
property "sonar.host.url", "https://sonarcloud.io"
}
}
// Install git hooks
task installLocalGitHook(type: Copy) {
from new File(rootProject.rootDir, 'scripts/pre-commit')
into new File(rootProject.rootDir, '.git/hooks')
fileMode 0775
}
build.dependsOn installLocalGitHook
subprojects {
apply plugin: "java"
apply plugin: "com.diffplug.spotless"
apply plugin: "org.sonarqube"
// All subprojects inherit root project group and version, to avoid duplication.
group = rootProject.group
version = rootProject.version
repositories {
mavenCentral()
}
if (!skipSonarlint) {
apply plugin: "name.remal.sonarlint"
}
java {
toolchain {
// Nails the Java-Version of every Subproject
languageVersion = JavaLanguageVersion.of(21)
}
}
// sonarlint configuration, not to be confused with sonarqube/sonarcloud.
sonarLint {
rules {
disable(
'java:S1135' // Disables "Track uses of "TO-DO" tags" rule.
)
}
}
spotless {
java {
// Excludes build folder since it contains generated java classes.
targetExclude("build/**")
endWithNewline()
removeUnusedImports()
// empty string '' covers all imports that aren't explicitly specified,
// we use it as catch-all for external dependencies like JDA
// '\\#` is prefix for static imports
importOrder('','org.togetherjava', 'javax', 'java', '\\#')
// TODO: pinning version because of spotless error https://github.com/diffplug/spotless/issues/1992
eclipse("4.31").configFile("${rootProject.rootDir}/meta/formatting/google-style-eclipse.xml")
}
}
test {
useJUnitPlatform()
}
compileJava {
options.encoding = "UTF-8"
}
compileTestJava {
options.encoding = "UTF-8"
}
}