forked from Together-Java/TJ-Bot
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
92 lines (77 loc) · 2.61 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
plugins {
id 'java'
id "com.diffplug.spotless" version "6.16.0"
id "org.sonarqube" version "4.0.0.2929"
id "name.remal.sonarlint" version "3.0.7"
}
group 'org.togetherjava'
version '1.0-SNAPSHOT'
ext {
jooqVersion = '3.17.2'
jacksonVersion = '2.14.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"
}
// sonarlint configuration, not to be confused with sonarqube/sonarcloud.
sonarLint {
rules {
disable(
'java:S1135' // Disables "Track uses of "TO-DO" tags" rule.
)
}
}
def compileTasks = {
options.encoding = 'UTF-8'
// Nails the Java-Version of every Subproject
sourceCompatibility = JavaVersion.VERSION_19
targetCompatibility = JavaVersion.VERSION_19
}
compileJava(compileTasks)
compileTestJava(compileTasks)
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 Use latest eclipse jdt formatter, issue tracking this: https://github.com/Together-Java/TJ-Bot/issues/605
eclipse('4.19.0').configFile("${rootProject.rootDir}/meta/formatting/google-style-eclipse.xml")
}
}
test {
useJUnitPlatform()
}
}