flan/build.gradle

82 lines
2.0 KiB
Groovy
Raw Normal View History

2020-08-23 08:52:36 -04:00
plugins {
2021-06-11 14:33:10 -04:00
id "architectury-plugin" version "3.1-SNAPSHOT"
id "dev.architectury.loom" version "0.7.2-SNAPSHOT" apply false
2020-08-23 08:52:36 -04:00
}
2021-06-11 14:33:10 -04:00
architectury {
minecraft = rootProject.minecraft_version
2020-08-23 08:52:36 -04:00
}
2021-06-11 14:33:10 -04:00
subprojects {
apply plugin: "dev.architectury.loom"
2020-08-23 08:52:36 -04:00
2021-06-11 14:33:10 -04:00
loom {
silentMojangMappingsLicense()
}
2020-08-23 08:52:36 -04:00
2021-06-11 14:33:10 -04:00
dependencies {
minecraft "com.mojang:minecraft:${rootProject.minecraft_version}"
mappings "net.fabricmc:yarn:${project.yarn_mappings}:v2"
}
2020-08-23 08:52:36 -04:00
}
2021-06-11 14:33:10 -04:00
allprojects {
apply plugin: "java"
apply plugin: "architectury-plugin"
apply plugin: "maven-publish"
2020-08-23 08:52:36 -04:00
2021-06-11 14:33:10 -04:00
archivesBaseName = rootProject.archives_base_name
2021-06-11 18:15:14 -04:00
version = project.minecraft_version + "-" + rootProject.mod_version
2021-06-11 14:33:10 -04:00
group = rootProject.maven_group
2020-08-23 08:52:36 -04:00
2021-06-11 14:33:10 -04:00
tasks.withType(JavaCompile) {
options.encoding = "UTF-8"
def targetVersion = 8
if (JavaVersion.current().isJava9Compatible()) {
options.release = targetVersion
}
}
2021-06-11 14:33:10 -04:00
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
2021-06-11 14:33:10 -04:00
}