gradle cleanup

This commit is contained in:
Relentless 2022-09-06 18:00:29 +02:00
parent a8be40ee3f
commit 6676b429bb
No known key found for this signature in database
GPG key ID: 759D97B8C6F25265
4 changed files with 63 additions and 70 deletions

View file

@ -5,9 +5,6 @@ plugins {
}
val minecraftVersion: String by project
val commonRunsEnabled: String by project
val commonClientRunName: String? by project
val commonServerRunName: String? by project
val modName: String by project
val modId: String by project
val fabricLoaderVersion: String by project
@ -54,12 +51,25 @@ dependencies {
testRuntimeOnly ("org.junit.jupiter:junit-jupiter-engine:5.8.1")
}
tasks.processResources {
val buildProps = project.properties
filesMatching("pack.mcmeta") {
expand(buildProps)
tasks {
withType<Test> {
useJUnitPlatform()
}
processResources {
val buildProps = project.properties
filesMatching("pack.mcmeta") {
expand(buildProps)
}
}
}
buildConfig {
buildConfigField("String", "MOD_ID", "\"${modId}\"")
buildConfigField("String", "MOD_VERSION", "\"${project.version}\"")
buildConfigField("String", "MOD_NAME", "\"${modName}\"")
packageName(project.group as String)
}
publishing {
@ -74,15 +84,3 @@ publishing {
maven("file://${System.getenv("local_maven")}")
}
}
buildConfig {
buildConfigField("String", "MOD_ID", "\"${modId}\"")
buildConfigField("String", "MOD_VERSION", "\"${project.version}\"")
buildConfigField("String", "MOD_NAME", "\"${modName}\"")
packageName(project.group as String)
}
tasks.withType<Test> {
useJUnitPlatform()
}

View file

@ -74,22 +74,22 @@ loom {
}
}
tasks.processResources {
from(project(":Common").sourceSets.main.get().resources)
inputs.property("version", project.version)
filesMatching("fabric.mod.json") {
expand("version" to project.version)
tasks {
jar {
from("LICENSE") {
rename { "${it}_${modName}" }
}
}
}
withType<JavaCompile> {
source(project(":Common").sourceSets.main.get().allSource)
}
processResources {
from(project(":Common").sourceSets.main.get().resources)
inputs.property("version", project.version)
tasks.withType<JavaCompile> {
source(project(":Common").sourceSets.main.get().allSource)
}
tasks.jar {
from("LICENSE") {
rename { "${it}_${modName}" }
filesMatching("fabric.mod.json") {
expand("version" to project.version)
}
}
}

View file

@ -102,22 +102,19 @@ mixin {
config("${modId}-common.mixins.json")
}
tasks.withType<JavaCompile> {
source(project(":Common").sourceSets.main.get().allSource)
}
tasks.processResources {
from(project(":Common").sourceSets.main.get().resources)
}
tasks {
jar {
finalizedBy("reobfJar")
}
}
tasks.withType<Test> {
useJUnitPlatform()
withType<JavaCompile> {
source(project(":Common").sourceSets.main.get().allSource)
}
withType<Test> {
useJUnitPlatform()
}
processResources {
from(project(":Common").sourceSets.main.get().resources)
}
}
publishing {

View file

@ -67,32 +67,30 @@ subprojects {
)
}
}
}
withType<JavaCompile> {
options.encoding = "UTF-8"
options.release.set(17)
}
processResources {
val resourceTargets = listOf("META-INF/mods.toml", "pack.mcmeta", "fabric.mod.json")
tasks.withType<JavaCompile> {
options.encoding = "UTF-8"
options.release.set(17)
}
val replaceProperties = mapOf(
"version" to project.version as String,
"license" to license,
"modId" to modId,
"modName" to modName,
"minecraftVersion" to minecraftVersion,
"modAuthor" to modAuthor,
"modDescription" to modDescription,
"forgeMinVersion" to forgeMinVersion,
"githubUser" to githubUser,
"githubRepo" to githubRepo
)
tasks.processResources {
val resourceTargets = listOf("META-INF/mods.toml", "pack.mcmeta", "fabric.mod.json")
val replaceProperties = mapOf(
"version" to project.version as String,
"license" to license,
"modId" to modId,
"modName" to modName,
"minecraftVersion" to minecraftVersion,
"modAuthor" to modAuthor,
"modDescription" to modDescription,
"forgeMinVersion" to forgeMinVersion,
"githubUser" to githubUser,
"githubRepo" to githubRepo
)
inputs.properties(replaceProperties)
filesMatching(resourceTargets) {
expand(replaceProperties)
inputs.properties(replaceProperties)
filesMatching(resourceTargets) {
expand(replaceProperties)
}
}
}
}