forked from Mumfrey/WorldEditCUI
-
Notifications
You must be signed in to change notification settings - Fork 61
/
build.gradle.kts
113 lines (99 loc) · 3.67 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 net.fabricmc.loom.api.LoomGradleExtensionAPI
import net.kyori.indra.licenser.spotless.IndraSpotlessLicenserExtension
plugins {
base
alias(libs.plugins.loom) apply false
alias(libs.plugins.spotless)
alias(libs.plugins.indra.spotlessLicenser) apply false
}
allprojects {
group = "org.enginehub.worldeditcui"
version = "${rootProject.libs.versions.minecraft.get()}+01-SNAPSHOT"
repositories {
// mirrors:
// - https://maven.enginehub.org/repo/
// - https://maven.terraformersmc.com/releases/
// - https://maven.minecraftforge.net/
// - https://maven.neoforged.net/
// - https://maven.parchmentmc.org/
// - https://repo.viaversion.com/
maven(url = "https://repo.stellardrift.ca/repository/stable/") {
name = "stellardriftReleases"
mavenContent {
releasesOnly()
excludeGroup("org.lwjgl") // workaround for lwjgl-freetype
}
}
maven(url = "https://repo.stellardrift.ca/repository/snapshots/") {
name = "stellardriftSnapshots"
mavenContent { snapshotsOnly() }
}
}
}
subprojects {
apply(plugin = "java")
apply(plugin = "com.diffplug.spotless")
apply(plugin = "net.kyori.indra.licenser.spotless")
apply(plugin = "maven-publish")
val targetJavaVersion: String by project
val targetVersion = targetJavaVersion.toInt()
extensions.configure(JavaPluginExtension::class) {
sourceCompatibility = JavaVersion.toVersion(targetVersion)
targetCompatibility = sourceCompatibility
if (JavaVersion.current() < JavaVersion.toVersion(targetVersion)) {
toolchain.languageVersion = JavaLanguageVersion.of(targetVersion)
}
withSourcesJar()
}
tasks.withType(JavaCompile::class).configureEach {
options.release = targetVersion
options.encoding = "UTF-8"
options.compilerArgs.addAll(listOf("-Xlint:all", "-Xlint:-processing"))
}
tasks.named("processResources", ProcessResources::class).configure {
inputs.property("version", project.version)
sequenceOf("fabric.mod.json", "META-INF/neoforge.mods.toml").forEach {
filesMatching(it) {
expand("version" to project.version)
}
}
}
extensions.configure(IndraSpotlessLicenserExtension::class) {
licenseHeaderFile(rootProject.file("HEADER"))
}
plugins.withId("dev.architectury.loom") {
val loom = extensions.getByType(LoomGradleExtensionAPI::class)
loom.run {
decompilerOptions.named("vineflower") {
options.put("win", "0")
}
silentMojangMappingsLicense()
}
// Ugly hack for easy genSourcening
afterEvaluate {
tasks.matching { it.name == "genSources" }.configureEach {
setDependsOn(setOf("genSourcesWithVineflower"))
}
}
dependencies {
"minecraft"(libs.minecraft)
"mappings"(loom.layered {
officialMojangMappings {
nameSyntheticMembers = false
}
parchment(variantOf(libs.parchment) { artifactType("zip") })
})
"vineflowerDecompilerClasspath"(libs.vineflower)
}
configurations.named("modLocalRuntime") {
shouldResolveConsistentlyWith(configurations.getByName("modImplementation"))
}
}
extensions.configure(PublishingExtension::class) {
publications {
register("maven", MavenPublication::class) {
from(components.getByName("java"))
}
}
}
}