-
-
Notifications
You must be signed in to change notification settings - Fork 108
Expand file tree
/
Copy pathbuild.gradle
More file actions
103 lines (88 loc) · 2.72 KB
/
build.gradle
File metadata and controls
103 lines (88 loc) · 2.72 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
plugins {
id 'java'
id "com.diffplug.spotless" version "8.3.0"
id "org.sonarqube" version "7.2.0.6526"
id "name.remal.sonarlint" version "7.0.0"
}
repositories {
mavenCentral()
}
group 'org.togetherjava'
version '1.0-SNAPSHOT'
ext {
jooqVersion = '3.20.5'
jacksonVersion = '2.19.1'
chatGPTVersion = '4.26.0'
junitVersion = '6.0.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
tasks.register('installLocalGitHook', Copy) {
from new File(rootProject.rootDir, 'scripts/pre-commit')
into new File(rootProject.rootDir, '.git/hooks')
filePermissions {
unix("rwxrwxr-x")
}
}
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(25)
}
}
// 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"
}
}