-
-
Notifications
You must be signed in to change notification settings - Fork 33
/
build.gradle
85 lines (74 loc) · 3.76 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
import java.text.SimpleDateFormat
plugins {
id "architectury-plugin" version "3.4-SNAPSHOT" // Uses Architectury plugin https://github.com/architectury/architectury-plugin
id "dev.architectury.loom" version "0.12.0-SNAPSHOT" apply false // Uses Architectury Loom
// (fork of Fabric Loom) https://github.com/architectury/architectury-loom - does not apply to root project
id "net.kyori.indra" version "2.1.1" // Uses Indra plugin
id "net.kyori.indra.git" version "2.1.1" // Uses Indra Git plugin
id "net.kyori.indra.checkstyle" version "2.1.1" // Uses Indra Checkstyle plugin
id "me.shedaniel.unified-publishing" version "0.1.+" apply false // Uses Unified Publishing plugin
}
architectury {
minecraft = rootProject.minecraft_version // Sets Minecraft version from gradle.properties
}
subprojects {
apply plugin: "dev.architectury.loom" // Applies Architectury Loom to subprojects
apply plugin: "me.shedaniel.unified-publishing" // Applies Unified Publishing to subprojects
loom {
silentMojangMappingsLicense() // Silences the annoying as hell Mojang License text
}
dependencies {
minecraft "com.mojang:minecraft:${rootProject.minecraft_version}" // Minecraft dependency
//mappings loom.officialMojangMappings() // Maps Minecraft so we can tell what classes are what - official mappings
mappings "net.fabricmc:yarn:${rootProject.yarn_version}:v2" // Alternative, open, mappings from Fabric
}
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)
.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")
}
if (!rootProject.buildDir.exists()) rootProject.buildDir.mkdirs()
new File(rootProject.buildDir, "CHANGELOG.md").text = changelogBuilder.toString().trim()
return changelogBuilder.toString().trim()
}
}
}
allprojects {
apply plugin: "java"
apply plugin: "architectury-plugin" // Applies architectury plugin to all projects
apply plugin: "maven-publish"
apply plugin: "net.kyori.indra" // Applies Indra to all projects
apply plugin: "net.kyori.indra.git" // Applies Indra Git to all projects
apply plugin: "net.kyori.indra.checkstyle" // Applies Indra Checkstyle to all projects
archivesBaseName = rootProject.archives_base_name // sets the archive name from gradle.properties
version = rootProject.mod_version // sets the version from gradle.properties
group = rootProject.maven_group // sets the maven group from gradle.properties
indra {
mitLicense()
checkstyle("9.3")
javaVersions {
target(17) // 1.18 now uses Java 17
testWith(17)
}
}
java {
withSourcesJar()
}
compileJava {
options.compilerArgs += "-Xlint:-processing" // Fixes "no processor claimed any of these annotations" warning
}
}