flan/build.gradle
2021-06-12 00:15:14 +02:00

82 lines
2.0 KiB
Groovy

plugins {
id "architectury-plugin" version "3.1-SNAPSHOT"
id "dev.architectury.loom" version "0.7.2-SNAPSHOT" apply false
}
architectury {
minecraft = rootProject.minecraft_version
}
subprojects {
apply plugin: "dev.architectury.loom"
loom {
silentMojangMappingsLicense()
}
dependencies {
minecraft "com.mojang:minecraft:${rootProject.minecraft_version}"
mappings "net.fabricmc:yarn:${project.yarn_mappings}:v2"
}
}
allprojects {
apply plugin: "java"
apply plugin: "architectury-plugin"
apply plugin: "maven-publish"
archivesBaseName = rootProject.archives_base_name
version = project.minecraft_version + "-" + rootProject.mod_version
group = rootProject.maven_group
tasks.withType(JavaCompile) {
options.encoding = "UTF-8"
def targetVersion = 8
if (JavaVersion.current().isJava9Compatible()) {
options.release = targetVersion
}
}
java {
withSourcesJar()
}
}
def changelog(int versions) {
try {
def changelog = ""
def match = 0
file("Changelog.txt").eachLine {
if (it.matches("${project.project_name} ([0-9].[0-9].[0-9])"))
match++
if (match <= versions) {
changelog += it + "\n"
} else
return
}
return changelog + "\n\n"
} catch (exception) {
return "${project.project_name} ${project.mod_version}\n==========\n"
}
}
//Splits the changelog into multiple parts if they get bigger than discords embed field size (1024)
def discordChangelog() {
def changelog = changelog(1)
def res = new ArrayList()
if (changelog.size() < 1024) {
res.add(changelog)
return res;
}
def temp = ""
changelog.split("\n").each {
it = it + "\n"
if ((temp.size() + it.size()) >= 1024) {
res.add(temp)
temp = it
} else
temp += it
}
res.add(temp)
return res
}