1
1
import groovy.json.JsonSlurper
2
- import org.apache.groovy.json.internal.LazyMap
3
2
import java.nio.charset.StandardCharsets
4
-
3
+ import net.ltgt.gradle.errorprone.CheckSeverity
5
4
6
5
buildscript {
7
6
repositories{
@@ -11,24 +10,25 @@ buildscript{
11
10
dependencies{
12
11
classpath " org.codehaus.groovy:groovy-json:3.0.8" // <- For JsonSlurper syntax highlighting
13
12
}
13
+
14
+ ext{
15
+ serverDirectoryPath = System . getenv(" MINDUSTRY_SERVER_HOME" )
16
+ metadata = new JsonSlurper (). parseText(file(" $rootDir /plugin.json" ). text)
17
+
18
+ versions = [
19
+ " mindustry" : property(" props.mindustry-version" ),
20
+ " arc" : property(" props.arc-version" ),
21
+ " junit" : " 5.8.2"
22
+ ]
23
+ }
14
24
}
15
25
16
26
plugins {
17
27
id " java"
18
28
id " maven-publish"
19
29
id " com.github.johnrengelman.shadow" version " 7.1.2"
20
- }
21
-
22
-
23
- ext {
24
- serverDirectoryPath = System . getenv(" MINDUSTRY_SERVER_HOME" )
25
- metadata = new JsonSlurper (). parseText(file(" $rootDir /plugin.json" ). text) as LazyMap
26
-
27
- versions = [
28
- " mindustry" : property(" props.mindustry-version" ),
29
- " arc" : property(" props.arc-version" ),
30
- " junit" : " 5.8.2"
31
- ]
30
+ id " net.ltgt.errorprone" version " 2.0.2"
31
+ id " org.checkerframework" version " 0.6.7"
32
32
}
33
33
34
34
group property(" props.project-group" )
@@ -56,10 +56,17 @@ dependencies{
56
56
testImplementation " org.junit.jupiter:junit-jupiter-params:${ versions.junit} "
57
57
testImplementation " org.junit.jupiter:junit-jupiter-api:${ versions.junit} "
58
58
testRuntimeOnly " org.junit.jupiter:junit-jupiter-engine:${ versions.junit} "
59
+
60
+ // Annotations
61
+ compileOnly " org.checkerframework:checker-qual:3.21.1"
62
+ annotationProcessor " com.uber.nullaway:nullaway:0.9.4"
63
+ errorprone " com.google.errorprone:error_prone_core:2.10.0"
64
+ errorproneJavac " com.google.errorprone:javac:9+181-r4173-1"
59
65
}
60
66
61
67
java {
62
68
withSourcesJar()
69
+ withJavadocJar()
63
70
}
64
71
65
72
test {
@@ -70,8 +77,16 @@ tasks.withType(JavaCompile).configureEach {
70
77
sourceCompatibility = JavaVersion . VERSION_16
71
78
targetCompatibility = JavaVersion . VERSION_16
72
79
options. encoding = StandardCharsets . UTF_8
73
- }
74
80
81
+ options. errorprone. with{
82
+ disableWarningsInGeneratedCode = true
83
+ disable " MissingSummary"
84
+ if (! name. containsIgnoreCase(" test" )){
85
+ check(" NullAway" , CheckSeverity . ERROR )
86
+ option(" NullAway:AnnotatedPackages" , " fr.xpdustry.template" )
87
+ }
88
+ }
89
+ }
75
90
76
91
shadowJar {
77
92
from " $rootDir /plugin.json"
@@ -115,9 +130,15 @@ task getArtifactPath{
115
130
doLast{ println shadowJar. archiveFile. get(). toString() }
116
131
}
117
132
133
+ // Avoid publishing shadow artifacts to maven repo
134
+ // > https://github.com/johnrengelman/shadow/issues/651
135
+ components. withType(AdhocComponentWithVariants ). forEach { c ->
136
+ c. withVariantsFromConfiguration(configurations. shadowRuntimeElements) {skip() }
137
+ }
138
+
118
139
publishing {
119
140
publications{
120
- create(" jitpack " , MavenPublication ){
141
+ create(" maven " , MavenPublication ){
121
142
from components. java
122
143
123
144
pom{
0 commit comments