-
-
Notifications
You must be signed in to change notification settings - Fork 16
Expand file tree
/
Copy pathbuild.gradle.kts
More file actions
161 lines (131 loc) · 4.44 KB
/
build.gradle.kts
File metadata and controls
161 lines (131 loc) · 4.44 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
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
plugins {
id("com.gradleup.shadow") version("9.0.1")
id("com.adarshr.test-logger") version("4.0.0")
id("java")
id("org.sonarqube") version "6.2.0.5505"
}
sonar {
properties {
property("sonar.projectKey", "beanbeanjuice_SimpleProxyChat_bfdced85-f7af-4c3b-b826-007a5e968233")
property("sonar.projectName", "SimpleProxyChat")
}
}
allprojects {
group = "com.beanbeanjuice"
val mockitoAgent by configurations.creating
apply(plugin = "com.adarshr.test-logger")
apply(plugin = "java")
repositories {
mavenCentral()
maven {
name = "sonatype"
url = uri("https://oss.sonatype.org/content/groups/public/")
}
maven {
name = "jitpack"
url = uri("https://jitpack.io")
}
maven {
name = "papermc-repo"
url = uri("https://repo.papermc.io/repository/maven-public/")
}
maven {
name = "networkmanager-repo"
url = uri("https://repo.networkmanager.xyz/repository/maven-public/")
}
maven {
name = "spicord-repo"
url = uri("https://repo.spicord.org/")
}
maven {
name = "advanced-ban requirement"
url = uri("https://maven.elmakers.com/repository/")
}
maven {
name = "spigotmc-repo"
url = uri("https://hub.spigotmc.org/nexus/content/repositories/snapshots/")
}
maven {
name = "placeholder-api-repo"
url = uri("https://repo.extendedclip.com/content/repositories/placeholderapi/")
}
}
dependencies {
// Lombok
compileOnly("org.projectlombok", "lombok", "1.18.38")
annotationProcessor("org.projectlombok", "lombok", "1.18.38")
// Unit Testing
testImplementation("org.junit.jupiter", "junit-jupiter-api", "5.13.4") // https://mvnrepository.com/artifact/org.junit.jupiter/junit-jupiter-api
testImplementation("org.junit.jupiter", "junit-jupiter", "5.13.4") // https://mvnrepository.com/artifact/org.junit.jupiter/junit-jupiter-api
testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine:5.13.4")
testRuntimeOnly("org.junit.platform:junit-platform-launcher")
// Mockito
testImplementation("org.mockito", "mockito-core", "5.19.0") // https://mvnrepository.com/artifact/org.mockito/mockito-core
testImplementation("org.mockito", "mockito-inline", "+") // https://mvnrepository.com/artifact/org.mockito/mockito-core
mockitoAgent("org.mockito:mockito-core:5.19.0") {
isTransitive = false
}
}
tasks.withType<Test> {
// Always re-run tests.
outputs.upToDateWhen { false }
outputs.cacheIf { false }
useJUnitPlatform()
// Add the mockito agent as a javaagent JVM argument
jvmArgs("-javaagent:${mockitoAgent.singleFile.absolutePath}")
}
}
subprojects {
apply(plugin = "com.gradleup.shadow")
tasks.withType<ShadowJar> {
minimize()
archiveClassifier.set("")
archiveBaseName.set(project.name)
destinationDirectory.set(File(rootProject.projectDir, "libs"))
doLast {
archiveVersion.set(project.version as String)
println("Compiling: " + project.name + "-" + project.version + ".jar")
}
}
tasks.withType<JavaCompile> {
options.encoding = "UTF-8"
}
tasks.withType<Test> {
// Run tests on shadowJar
dependsOn(tasks.shadowJar)
classpath = files(tasks.shadowJar.get().archiveFile) + sourceSets.test.get().runtimeClasspath
}
}
// DELETING FILES AFTER BUILD
tasks.clean {
doLast {
file("libs").deleteRecursively()
}
}
tasks.register("cleanProxyJars") {
doLast {
val filesToDelete = fileTree("libs") {
include(
"proxy*.jar",
"server*.jar",
"shared*.jar",
"projects.jar",
"common.jar"
)
}.files
if (filesToDelete.isEmpty()) {
println("No proxy jars found to delete.")
} else {
filesToDelete.forEach {
println("Deleting ${it.name}")
it.delete()
}
}
}
}
subprojects {
tasks.named("shadowJar") {
finalizedBy(rootProject.tasks.named("cleanProxyJars"))
}
}