forked from Team-EnderIO/EnderIO
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle.kts
113 lines (93 loc) · 2.94 KB
/
build.gradle.kts
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
import com.github.spotbugs.snom.Effort
import com.github.spotbugs.snom.SpotBugsTask
import java.net.URI
plugins {
id("maven-publish")
id("net.neoforged.moddev") version "1.0.19" apply false
id("com.diffplug.spotless") version "6.25.0"
id("idea")
id("com.github.spotbugs") version "6.0.22"
}
println("Release type: ${getReleaseType()}")
idea {
module {
isDownloadJavadoc = true
isDownloadSources = true
}
}
allprojects {
gradle.projectsEvaluated {
tasks.withType<JavaCompile> {
options.compilerArgs.addAll(arrayOf("-Xmaxerrs", "400"))
}
}
}
// Normally we'd do this in the shared buildSrc file
// However, we need this context before loading subprojects or stuff explodes.
subprojects {
if (project.name != "ensure_plugin") {
apply(plugin = "maven-publish")
apply(plugin = "net.neoforged.moddev")
apply(plugin = "com.diffplug.spotless")
apply(plugin = "com.github.spotbugs")
spotless {
if (project.name != "endercore") {
ratchetFrom = "origin/dev/1.21.1"
}
encoding("UTF-8")
java {
cleanthat()
eclipse().configFile("$rootDir/config/codeformat/codeformat.xml")
// Revert to spaces, thank you eclipse
indentWithSpaces(4)
importOrder()
removeUnusedImports()
trimTrailingWhitespace()
endWithNewline()
}
}
spotbugs {
reportsDir = project.layout.buildDirectory.dir("reports/spotbugs/")
effort = Effort.MAX
ignoreFailures = true
}
tasks.withType<SpotBugsTask> {
reports {
create("html") {
required = true
outputLocation = project.layout.buildDirectory.file("reports/spotbugs/spotbugs.html")
}
}
}
publishing {
repositories {
if (System.getenv("RVR_MAVEN_USER") != null) {
maven {
name = "Rover656"
url = URI("https://maven.rover656.dev/releases")
credentials {
username = System.getenv("RVR_MAVEN_USER")
password = System.getenv("RVR_MAVEN_PASSWORD")
}
}
}
}
}
}
}
// ============
// Utilities
// ============
fun getReleaseType(): String? {
// If we"re doing a proper build
if (System.getenv("BUILD_VERSION") != null) {
val version_string = System.getenv("BUILD_VERSION")
if (version_string.lowercase().contains("alpha")) {
return "alpha"
} else if (version_string.lowercase().contains("beta")) {
return "beta"
}
return "release"
}
return "dev"
}