-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbuild.gradle
129 lines (105 loc) · 3.51 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
//file:noinspection GroovyAssignabilityCheck
plugins() {
id("java-library")
id("checkstyle")
id("com.github.spotbugs").version("5.0.14")
id("org.cadixdev.licenser").version("0.6.1")
id("maven-publish")
}
this.group = "net.elytrium"
this.version = "1.0.13"
compileJava() {
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
options.getRelease().set(11)
options.setEncoding("UTF-8")
}
repositories() {
mavenCentral()
maven() {
setName("elytrium-repo")
setUrl("https://maven.elytrium.net/repo/")
}
maven() {
setName("papermc-repo")
setUrl("https://repo.papermc.io/repository/maven-public/")
}
}
dependencies() {
annotationProcessor("net.java.dev.jna:jna-platform:5.13.0")
annotationProcessor("com.github.bsideup.jabel:jabel-javac-plugin:1.0.0")
api("net.elytrium.commons:utils:$elytriumCommonsVersion")
compileOnly("com.velocitypowered:velocity-api:$velocityVersion")
compileOnly("com.velocitypowered:velocity-proxy:$velocityVersion")
compileOnly("com.velocitypowered:velocity-native:$velocityVersion")
compileOnly("com.github.spotbugs:spotbugs-annotations:$spotbugsVersion")
// Needs for some velocity methods.
compileOnly("io.netty:netty-codec:$nettyVersion")
compileOnly("io.netty:netty-handler:$nettyVersion")
compileOnly("io.netty:netty-transport-native-epoll:$nettyVersion")
compileOnly("it.unimi.dsi:fastutil-core:$fastutilVersion")
}
license() {
header = file("HEADER.txt")
}
checkstyle() {
toolVersion = "10.12.1"
configFile = file("$rootDir/config/checkstyle/checkstyle.xml")
configProperties = ["configDirectory": "$rootDir/config/checkstyle"]
maxErrors = 0
maxWarnings = 0
}
spotbugsMain() {
excludeFilter = file("${this.getRootDir()}/config/spotbugs/suppressions.xml")
reports.register("html") {
required = true
outputLocation.value(layout.buildDirectory.file("reports/spotbugs/main/spotbugs.html"))
stylesheet = "fancy-hist.xsl"
}
}
tasks.register("sourcesJar", Jar) {
archiveClassifier = "sources"
from(sourceSets.main.getAllSource())
}
tasks.register("javadocJar", Jar) {
archiveClassifier = "javadoc"
from(javadoc)
}
publishing() {
repositories() {
maven() {
credentials() {
username = System.getenv("ELYTRIUM_MAVEN_USERNAME")
password = System.getenv("ELYTRIUM_MAVEN_PASSWORD")
}
name = "elytrium-repo"
url = "https://maven.elytrium.net/repo/"
}
}
publications.create("publication", MavenPublication) {
from(components.java)
artifact(javadocJar)
artifact(sourcesJar)
}
}
javadoc() {
options.setEncoding("UTF-8")
options.setSource("17")
options.links("https://docs.oracle.com/en/java/javase/17/docs/api/")
options.addStringOption("Xdoclint:none", "-quiet")
if (JavaVersion.current() >= JavaVersion.VERSION_1_9 && JavaVersion.current() < JavaVersion.VERSION_12) {
options.addBooleanOption("-no-module-directories", true)
}
}
artifacts() {
archives(sourcesJar)
archives(javadocJar)
}
sourceSets.main.java.srcDir(getTasks().register("generateTemplates", Copy) { task ->
task.getInputs().properties("version": getVersion())
task.from(file("src/main/templates"))
.into(getLayout().getBuildDirectory().dir("generated/sources/templates"))
.expand("version": getVersion())
}.map {
it.getOutputs()
})