-
-
Notifications
You must be signed in to change notification settings - Fork 36
Expand file tree
/
Copy pathbuild.gradle
More file actions
128 lines (106 loc) · 3.53 KB
/
build.gradle
File metadata and controls
128 lines (106 loc) · 3.53 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
import net.ltgt.gradle.errorprone.ErrorProneOptions
import net.ltgt.gradle.nullaway.NullAwayOptions
plugins {
id 'java-library'
id 'maven-publish'
alias libs.plugins.modules
alias libs.plugins.gradleutils
alias libs.plugins.gitversion
alias libs.plugins.changelog
alias libs.plugins.licenser
// Enforce jSpecify annotations at compile-time
alias libs.plugins.errorprone
alias libs.plugins.nullaway
}
final projectDisplayName = 'EventBus'
final projectVendor = 'Forge Development LLC'
description = 'High performance Event Bus library'
group = 'net.minecraftforge'
version = gitversion.tagOffset
print "Version: $version"
java {
toolchain.languageVersion = JavaLanguageVersion.of(21)
modularity.inferModulePath = true
withSourcesJar()
}
dependencies {
api libs.jspecify.annotations
errorprone libs.errorprone.core
errorprone libs.nullaway
}
extraJavaModuleInfo {
failOnMissingModuleInfo = false
}
changelog {
from '1.0.0'
}
tasks.withType(JavaCompile).configureEach {
// Set up compile-time enforcement of the jSpecify spec via ErrorProne and NullAway
options.errorprone { ErrorProneOptions errorProne ->
errorProne.disableAllChecks = true // Opt-into only the checks we care about
// Enforce the jSpecify spec
errorProne.nullaway { NullAwayOptions nullAway ->
nullAway.jspecifyMode = true
nullaway.onlyNullMarked = true // Only enforce nullability checks on @NullMarked classes and packages
nullAway.error() // Throw a compile error on jSpecify spec violations
}
// Enforce the ErrorProne checks we care about
errorProne.error 'FieldCanBeFinal', 'MethodCanBeStatic', 'LambdaFunctionalInterface'
}
// Needed for Java 21, not needed on Java 22+. This flag requires javac 21.0.8+ to work.
// See https://github.com/uber/NullAway/wiki/JSpecify-Support#supported-jdk-versions
options.compilerArgs += '-XDaddTypeAnnotationsToSymbol=true'
}
tasks.named('jar', Jar) {
manifest {
attributes([
'Specification-Title' : projectDisplayName,
'Specification-Version' : gitversion.info.tag,
'Specification-Vendor' : projectVendor,
'Implementation-Title' : projectDisplayName,
'Implementation-Version': project.version,
'Implementation-Vendor' : projectVendor
])
}
}
license {
header = file('LICENSE-header.txt')
newLine = false
}
publishing {
publications.register('mavenJava', MavenPublication) {
changelog.publish(it)
gradleutils.promote(it)
from components.java
artifactId = 'eventbus'
pom {
name = projectDisplayName
description = project.description
gradleutils.pom.addRemoteDetails(pom)
licenses {
license gradleutils.pom.licenses.LGPLv2_1
}
developers {
developer gradleutils.pom.developers.Paint_Ninja
}
}
}
repositories {
maven gradleutils.publishingForgeMaven
}
}
allprojects {
// Tests are expensive to run all variants, so only run if asked to
if (!project.hasProperty('bulk_tests'))
ext.VALID_VMS = ['Adoptium': [21]]
else
ext.VALID_VMS = [
'Adoptium': [21],
'Amazon': [21],
'Azul': [21],
'BellSoft': [21],
'Graal_VM': [21],
'Microsoft': [21],
'Oracle': [21],
]
}