-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathbuild.gradle
129 lines (104 loc) · 3.43 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("maven-publish")
id("checkstyle")
id("com.github.spotbugs").version("5.0.6")
id("org.cadixdev.licenser").version("0.6.1")
}
allprojects {
apply(plugin: "java-library")
apply(plugin: "maven-publish")
apply(plugin: "checkstyle")
apply(plugin: "com.github.spotbugs")
apply(plugin: "org.cadixdev.licenser")
setGroup("net.elytrium.commons")
setVersion("1.2.5")
compileJava {
getOptions().setEncoding("UTF-8")
}
java {
setSourceCompatibility(JavaVersion.VERSION_1_8)
setTargetCompatibility(JavaVersion.VERSION_1_8)
}
repositories {
mavenCentral()
maven {
setName("elytrium-repo")
setUrl("https://maven.elytrium.net/repo/")
}
}
dependencies {
compileOnly("com.github.spotbugs:spotbugs-annotations:$spotbugsVersion")
testImplementation("org.junit.jupiter:junit-jupiter-api:$junitVersion")
testImplementation("org.junit.jupiter:junit-jupiter-engine:$junitVersion")
}
test {
useJUnitPlatform()
}
license {
setHeader(file("${this.getRootDir()}/HEADER.txt"))
exclude("**/*.yml")
}
checkstyle {
setToolVersion("9.3")
setConfigFile(file("${this.getRootDir()}/.config/checkstyle/checkstyle.xml"))
setConfigProperties("configDirectory": "${this.getRootDir()}/.config/checkstyle")
// The build should immediately fail if we have errors.
setMaxErrors(0)
setMaxWarnings(0)
}
spotbugsMain {
reports {
html {
getRequired().set(true)
getOutputLocation().set(file("${this.getBuildDir()}/reports/spotbugs/main/spotbugs.html"))
setStylesheet("fancy-hist.xsl")
}
}
}
task javadocJar(type: Jar) {
getArchiveClassifier().set("javadoc")
from(javadoc)
}
task sourcesJar(type: Jar) {
getArchiveClassifier().set("sources")
from(sourceSets.main.getAllSource())
}
publishing {
repositories {
maven {
credentials {
setUsername(System.getenv("PUBLISH_USERNAME"))
setPassword(System.getenv("PUBLISH_PASSWORD"))
}
setName("elytrium-repo")
setUrl("https://maven.elytrium.net/repo/")
}
}
publications {
maven(MavenPublication) {
from(getComponents().java)
artifact(javadocJar)
artifact(sourcesJar)
}
}
}
javadoc {
getOptions().setEncoding("UTF-8")
getOptions().setCharSet("UTF-8")
// Mark sources as Java 8 source compatible.
getOptions().setSource("8")
getOptions().links("https://docs.oracle.com/javase/8/docs/api/")
// Disable the crazy super-strict DocLint tool in Java 8.
getOptions().addStringOption("Xdoclint:none", "-quiet")
// Remove "undefined" from search paths when generating javadoc for a non-modular project. (JDK-8215291)
if (JavaVersion.current() >= JavaVersion.VERSION_1_9 && JavaVersion.current() < JavaVersion.VERSION_12) {
getOptions().addBooleanOption("-no-module-directories", true)
}
}
artifacts {
archives(javadocJar)
archives(sourcesJar)
}
}