-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathbuild.gradle
186 lines (152 loc) · 4.58 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
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
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
plugins {
id "java-library"
id "maven-publish"
id "com.github.johnrengelman.shadow" version "8.1.1"
id "io.freefair.lombok" version "8.6"
// id "checkstyle"
}
group = "xyz.upperlevel.uppercore"
version = "2.0.3"
description = "Global API for Spigot plugins"
java {
sourceCompatibility = JavaVersion.VERSION_16
targetCompatibility = JavaVersion.VERSION_16
}
project.ext {
mcVersion = "1.20.4-R0.1-SNAPSHOT"
}
test {
testLogging {
exceptionFormat = "full"
}
}
sourceSets {
integrationTest {
java {
compileClasspath += main.output
runtimeClasspath += main.output
srcDir file('src/integration-test/java')
}
resources {
srcDir file('src/integration-test/resources')
}
}
}
repositories {
mavenLocal()
mavenCentral()
maven {
url "https://oss.sonatype.org/content/repositories/snapshots/" // maven snapshots
}
maven {
url "https://hub.spigotmc.org/nexus/content/repositories/snapshots/" // bukkit
}
maven {
url 'https://jitpack.io' // vault
}
maven {
url "https://repo.codemc.org/repository/maven-public" // bstats
}
maven {
url "https://maven.elmakers.com/repository/" // EffectLib
}
maven {
url "https://repo.extendedclip.com/content/repositories/placeholderapi/" // PlaceholderAPI
}
}
dependencies {
/* JUnit */
testImplementation 'org.junit.jupiter:junit-jupiter:5.9.2'
testRuntimeOnly 'org.junit.platform:junit-platform-launcher'
/* Mockito */
testImplementation "org.mockito:mockito-core:3.+"
/* Apache commons */
api 'org.apache.commons:commons-lang3:3.14.0'
/* Spigot API */
compileOnly "org.spigotmc:spigot-api:" + mcVersion
testImplementation "org.spigotmc:spigot-api:" + mcVersion
integrationTestCompileOnly "org.spigotmc:spigot-api:" + mcVersion
/* Bukkit */
/*compileOnly "org.bukkit:bukkit:" + mcVersion
testImplementation "org.bukkit:bukkit:" + mcVersion
integrationTestCompileOnly "org.bukkit:bukkit:" + mcVersion
*/
api "xyz.upperlevel.spigot.anvilgui:spigot-anvil-gui:1.3" // anvil-gui
compileOnly "me.clip:placeholderapi:2.10.9" // placeholder-api
integrationTestCompileOnly "me.clip:placeholderapi:2.11.5" // placeholder-api
compileOnly "com.github.MilkBowl:VaultAPI:1.7" // vault
api "org.bstats:bstats-bukkit:1.7" // metrics
/* Db */
compileOnly "org.mongodb:mongo-java-driver:3.12.4"
compileOnly "com.rethinkdb:rethinkdb-driver:2.3.3"
compileOnly "org.dizitart:nitrite:3.4.1"
}
test {
// Enable JUnit 5 (Gradle 4.6+).
useJUnitPlatform()
// Always run tests, even when nothing changed.
dependsOn 'cleanTest'
// Show test results.
testLogging {
events "passed", "skipped", "failed"
}
}
shadowJar {
archiveBaseName = null
relocate "org.bstats", "${project.group}.libs.metrics"
relocate "org.apache.commons", "${project.group}.libs.acommons"
}
task testJar(type: ShadowJar) {
archiveBaseName = "test"
dependsOn tasks.shadowJar
from zipTree(shadowJar.outputs.files.singleFile)
from sourceSets.integrationTest.output
}
publishing {
publications {
shadow(MavenPublication) { publication ->
project.shadow.component(publication)
}
}
/*repositories {
maven {
url "http://repo.myorg.com"
}
}*/
}
tasks.withType(JavaCompile) {
options.compilerArgs << "-Xlint:unchecked" << "-Xlint:deprecation"
}
/*
checkstyle {
configFile = rootProject.file('config/checkstyle/checkstyle.xml')
configProperties = [
'configDir': rootProject.file('config/checkstyle'),
'baseDir': rootDir,
]
toolVersion = '7.3'
ignoreFailures = true
}
*/
// This part of the config is needed to filter the class UppercoreInfo.java, replacing the needed properties
task generateUppercoreInfo(type: Copy) {
println(buildDir)
from ("${projectDir}/src/main/java/xyz/upperlevel/uppercore") {
include "UppercoreInfo.java"
filter { line -> line.replaceAll('@project.version@', (String)project.property("version")) }
}
into "$buildDir/generated/sources/custom"
}
sourceSets {
main {
java {
srcDirs ("${projectDir}/src/main/java", "${buildDir}/generated/sources/custom")
exclude("xyz/upperlevel/uppercore/UppercoreInfo.java")
}
}
}
compileJava {
options.compilerArgs += ['-parameters']
dependsOn generateUppercoreInfo
}