forked from cominixo/BetterF3
-
-
Notifications
You must be signed in to change notification settings - Fork 21
Expand file tree
/
Copy pathbuild.gradle
More file actions
124 lines (109 loc) · 4 KB
/
Copy pathbuild.gradle
File metadata and controls
124 lines (109 loc) · 4 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
import net.ltgt.gradle.errorprone.CheckSeverity
import java.text.SimpleDateFormat
plugins {
id "architectury-plugin" version "3.5-SNAPSHOT"
id "dev.architectury.loom-no-remap" version "1.14-SNAPSHOT" apply false
id "com.diffplug.spotless" version "7.2.1" apply false
id "net.kyori.indra" version "3.2.0"
id "net.kyori.indra.git" version "3.2.0"
id "net.kyori.indra.checkstyle" version "3.2.0"
id "me.shedaniel.unified-publishing" version "0.1.+" apply false
id "net.ltgt.errorprone" version "5.1.0" apply false
}
architectury {
minecraft = rootProject.minecraft_version
}
subprojects {
apply plugin: "dev.architectury.loom-no-remap"
apply plugin: "net.ltgt.errorprone"
apply plugin: "me.shedaniel.unified-publishing"
loom {
silentMojangMappingsLicense()
}
dependencies {
minecraft "com.mojang:minecraft:${rootProject.minecraft_version}"
compileOnly "org.jspecify:jspecify:1.0.0"
testCompileOnly "org.jspecify:jspecify:1.0.0"
errorprone "com.google.errorprone:error_prone_core:2.49.0"
errorprone "com.uber.nullaway:nullaway:0.13.3"
}
tasks.withType(JavaCompile).tap {
configureEach {
options.errorprone {
disableAllChecks = true
check("NullAway", CheckSeverity.ERROR)
option("NullAway:AnnotatedPackages", "me.cominixo.betterf3,me.treyruffy.betterf3")
option("NullAway:JSpecifyMode", "true")
}
}
}
ext {
releaseChangelog = {
def dateFormat = new SimpleDateFormat("yyyy-MM-dd")
dateFormat.setTimeZone(TimeZone.getTimeZone("UTC"))
def date = dateFormat.format(new Date())
def changelogFormatText = file("../docs/changelogs/format.md").text.trim()
def changelogText = file("../docs/changelogs/${rootProject.version}.md").text.trim()
def lastVersion = changelogText.split("\n")[0].split("=")[1].trim()
def changelog = changelogFormatText
.replace("%date%", date)
.replace("%changelog%", changelogText)
.replace("%version%", rootProject.version.toString())
.replace("%mc_versions%", rootProject.supported_minecraft_versions)
.replace("%last_version%", lastVersion)
StringBuilder changelogBuilder = new StringBuilder()
for (String line : changelog.split("\n")) {
if (!line.startsWith("!"))
changelogBuilder.append(line).append("\n")
}
def buildDir = rootProject.layout.buildDirectory.asFile.get()
if (!buildDir.exists()) buildDir.mkdirs()
new File(buildDir, "CHANGELOG.md").text = changelogBuilder.toString().trim()
return changelogBuilder.toString().trim()
}
}
}
allprojects {
apply plugin: "java"
apply plugin: "architectury-plugin"
apply plugin: "maven-publish"
apply plugin: "net.kyori.indra"
apply plugin: "net.kyori.indra.git"
apply plugin: "net.kyori.indra.checkstyle"
apply plugin: "com.diffplug.spotless"
version = rootProject.mod_version
group = rootProject.maven_group
base.archivesName = rootProject.archives_base_name
indra {
mitLicense()
checkstyle("13.4.0")
javaVersions {
target(25)
testWith(25)
}
}
java {
withSourcesJar()
toolchain {
languageVersion = JavaLanguageVersion.of(25)
}
}
compileJava {
options.compilerArgs += ["-Xlint:-processing", "-Xlint:-classfile", "-Xlint:-this-escape"]
}
tasks.withType(JavaCompile).tap {
configureEach {
options.release = 25
}
}
spotless {
encoding "UTF-8"
java {
target "src/*/java/**/*.java"
palantirJavaFormat("2.90.0")
removeUnusedImports()
trimTrailingWhitespace()
endWithNewline()
}
}
}