Put some stuff that was duplicated in gradle to the main gradle

This commit is contained in:
coolGi2007
2022-02-02 22:40:41 +00:00
parent 308f809d5d
commit 165a3799f3
7 changed files with 39 additions and 62 deletions
+33
View File
@@ -95,6 +95,39 @@ allprojects { p ->
}
}
// Put stuff from gradle.properties into the mod info
processResources {
def resourceTargets = ["fabric.mod.json", "META-INF/mods.toml"] // Location of where to put
def intoTargets = ["$buildDir/resources/main/"] // Location of the built resources folder
def replaceProperties = [
version: mod_version,
mod_name: mod_name,
authors: mod_authors,
description: mod_description,
homepage: mod_homepage
] // The left side is what gets replaced in the mod info and the right side is where to get it from in the gradle.properties
inputs.properties replaceProperties
replaceProperties.put 'project', project
filesMatching(resourceTargets) {
expand replaceProperties
}
intoTargets.each { target ->
if (file(target).exists()) {
copy {
from(sourceSets.main.resources) {
include resourceTargets
expand replaceProperties
}
into target
}
}
}
}
tasks.withType(JavaCompile) {
if (p != project(":core")) {
// Minecraft 1.18 (1.18-pre2) upwards uses Java 17.