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.
+1 -1
Submodule core updated: 4bcb6c0acd...ca81ed1efe
-28
View File
@@ -113,36 +113,8 @@ runClient {
finalizedBy(deleteResources)
}
// Put stuff from gradle.properties into the mod info stuff
def resourceTargets = ["fabric.mod.json"]
def intoTargets = ["$buildDir/resources/main/"]
def replaceProperties = [
version: mod_version,
mod_name: mod_name,
authors: mod_authors,
description: mod_description
]
processResources {
dependsOn(copyAccessWidener)
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
}
}
}
}
shadowJar {
+1 -1
View File
@@ -8,7 +8,7 @@
"authors": ["${authors}"],
"contact": {
"homepage": "https://www.curseforge.com/minecraft/mc-mods/lod-level-of-detail",
"homepage": "${homepage}",
"sources": "https://gitlab.com/jeseibel/minecraft-lod-mod/",
"issues": "https://gitlab.com/jeseibel/minecraft-lod-mod/-/issues"
},
-28
View File
@@ -57,37 +57,9 @@ task copyCommonResources(type: Copy) {
into file("build/resources/main")
}
// Put stuff from gradle.properties into the mod info stuff
def resourceTargets = ["META-INF/mods.toml"]
def intoTargets = ["$buildDir/resources/main/"]
def replaceProperties = [
version: mod_version,
mod_name: mod_name,
authors: mod_authors,
description: mod_description
]
processResources {
dependsOn(copyCoreResources)
dependsOn(copyCommonResources)
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
}
}
}
}
shadowJar {
+3 -4
View File
@@ -9,14 +9,13 @@ issueTrackerURL="https://gitlab.com/jeseibel/minecraft-lod-mod/-/issues"
modId="lod" #//mandatory
version= "${version}" #//mandatory, gets the version number from jar populated by the build.gradle script
displayName="${mod_name}" #//mandatory
authors="${authors}"
#//updateJSONURL="https://change.me.example.invalid/updates.json" # A URL to query for updates for this mod. See the JSON update specification https://mcforge.readthedocs.io/en/latest/gettingstarted/autoupdate/
displayURL="https://www.curseforge.com/minecraft/mc-mods/lod-level-of-detail"
displayURL="${homepage}"
description= "${description}" #//mandatory. The description text for the mod
logoFile="logo.png"
catalogueImageIcon="icon.png"
credits="Massive thanks to: Leonardo, Cola, Ran, and CoolGi. For their hard work to bring Distant Horizons to where it is today. - James"
authors="${authors}"
#//mandatory. The description text for the mod
description= ''' ${description} '''
#// if not set defaults to "false"
clientSideOnly="true"
#// if not set defaults to "BOTH"
+1
View File
@@ -11,6 +11,7 @@ toml_version=3.6.4
mod_name=Distant Horizons
mod_description=This mod generates and renders simplified terrain beyond the normal view distance at a low performance cost. Allowing you to see much farther without turning your game into a slideshow.
mod_authors=James Seibel, Leonardo Amato, Cola, coolGi2007, Ran, LeeTom
mod_homepage=https://www.curseforge.com/minecraft/mc-mods/lod-level-of-detail
# Fabric loader
fabric_loader_version=0.12.12