-
-
Notifications
You must be signed in to change notification settings - Fork 16
/
build.gradle
193 lines (171 loc) · 5.35 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
187
188
189
190
191
192
193
import groovy.text.SimpleTemplateEngine
import java.util.stream.Collectors
plugins {
alias libs.plugins.spongeConvention
alias libs.plugins.indra
alias libs.plugins.indra.crossdoc
alias libs.plugins.indra.licenser.spotless
alias libs.plugins.indra.sonatype
alias libs.plugins.errorprone
alias libs.plugins.spotless
alias libs.plugins.blossom
alias libs.plugins.ideaExt
id 'jacoco'
}
// -- General setup -- //
group = "org.spongepowered"
version = "2.1.0-SNAPSHOT"
description = "Immutable math library for Java with a focus on games and computer graphics."
// Metadata
spongeConvention {
repository("math") {
ci(true)
publishing(true)
}
mitLicense()
licenseParameters {
organization = project.organization
url = project.url
}
sharedManifest {
attributes "Specification-Title": project.name,
"Specification-Vendor": "SpongePowered - https://spongepowered.org"
}
}
indraSpotlessLicenser.property('name', "Math")
spotless {
java {
// This file has its own custom header
targetExclude 'src/main/java/org/spongepowered/math/HashFunctions.java'
}
}
indraCrossdoc {
baseUrl providers.gradleProperty('javadocPublishRoot')
}
def floatData = file("src/templateData/float.yaml")
def intData = file("src/templateData/integer.yaml")
def licenseText = objects.property(String)
licenseText.set(provider {
def properties = [*: indraSpotlessLicenser.properties().get()]
def template = new SimpleTemplateEngine().createTemplate(file("HEADER.txt")).make(properties)
def text = template.toString()
def lineEnding = System.getProperty("line.separator")
Arrays.stream(text.split("\r?\n"))
.map { if (it.isEmpty()) { " *" } else { " * $it" } }
.collect(Collectors.joining(lineEnding, "/*$lineEnding", "$lineEnding */"))
})
licenseText.finalizeValueOnRead()
sourceSets {
main {
blossom.templateSets {
register("float", net.kyori.blossom.SourceTemplateSet) {
propertyFile(floatData)
variants("float", "double")
}
register("integer", net.kyori.blossom.SourceTemplateSet) {
propertyFile(intData)
variants("int", "long")
}
// no variants
register("floatCommon", net.kyori.blossom.SourceTemplateSet) {
propertyFile(floatData)
}
}
// Add a module-info
multirelease {
alternateVersions(9)
moduleName("org.spongepowered.math")
requireAllPackagesExported()
applyToJavadoc(true)
}
}
test {
blossom.templateSets {
register("float", net.kyori.blossom.SourceTemplateSet) {
propertyFile(floatData)
variants("float", "double")
}
register("integer", net.kyori.blossom.SourceTemplateSet) {
propertyFile(intData)
variants("int", "long")
}
}
}
configureEach {
blossom.templateSets.withType(net.kyori.blossom.SourceTemplateSet).configureEach {
java()
header = licenseText
}
}
}
dependencies {
compileOnlyApi libs.errorprone.annotations
errorprone libs.errorprone
testImplementation platform(libs.junit.bom)
testImplementation libs.junit.api
testRuntimeOnly libs.junit.engine
}
jar {
from(rootProject.file("LICENSE.txt")) {
rename { "LICENSE-spongepowered-math.txt" }
}
}
tasks.withType(JavaCompile.class).configureEach {
options.compilerArgs << "-Xlint:-cast" // skip cast warnings, the generated source is most likely just overly safe.
}
afterEvaluate {
javadoc {
options {
addBooleanOption("-no-module-directories", false)
}
}
}
plugins.withId 'eclipse', {
eclipse {
classpath.file.whenMerged { path ->
path.entries.each {
if (it instanceof org.gradle.plugins.ide.eclipse.model.SourceFolder) {
def extraReads = ['org.junit.jupiter.api']
.collect { mod -> "org.spongepowered.math=$mod" }
.join(':')
it.entryAttributes['add-reads'] = extraReads
}
}
}
}
}
// -- Publishing -- //
indra {
javaVersions {
minimumToolchain 17
testWith(8, 11, 17)
}
configurePublications {
pom {
name = "Math"
inceptionYear = "2013"
developers {
developer {
id = "DDoS"
name = "Aleksi Sapon"
email = "[email protected]"
}
developer {
id = "kitskub"
name = "Jack Huey"
email = "[email protected]"
}
developer {
id = "Wolf480pl"
name = "Wolf480pl"
email = "[email protected]"
}
developer {
id = "lukespragg"
name = "Luke Spragg"
email = "[email protected]"
}
}
}
}
}