almostunified/Forge/build.gradle.kts

66 lines
2.6 KiB
Text
Raw Normal View History

2022-05-31 10:50:46 -04:00
val minecraftVersion: String by project
val forgeVersion: String by project
2023-02-01 14:43:30 -05:00
val junitVersion: String by project
val modId: String by project
val forgeRecipeViewer: String by project
val reiVersion: String by project
val jeiVersion: String by project
2022-05-31 10:50:46 -04:00
plugins {
2023-06-14 05:48:49 -04:00
id("com.github.johnrengelman.shadow") version ("8.1.1")
}
2022-05-31 10:50:46 -04:00
2023-02-01 14:43:30 -05:00
architectury {
platformSetupLoomIde()
forge()
2022-05-31 10:50:46 -04:00
}
loom {
2023-02-01 14:43:30 -05:00
if (project.findProperty("enableAccessWidener") == "true") { // Optional property for `gradle.properties` to enable access wideners.
accessWidenerPath.set(project(":Common").loom.accessWidenerPath)
forge {
convertAccessWideners.set(true)
extraAccessWideners.add(loom.accessWidenerPath.get().asFile.name)
2022-05-31 10:50:46 -04:00
}
2023-02-01 14:43:30 -05:00
println("Access widener enabled for project ${project.name}. Access widener path: ${loom.accessWidenerPath.get()}")
2022-05-31 10:50:46 -04:00
}
forge {
2023-02-01 14:43:30 -05:00
mixinConfigs("$modId-common.mixins.json" /*, "$modId-forge.mixins.json"*/)
}
}
2022-06-23 12:47:03 -04:00
2023-02-01 14:43:30 -05:00
val common by configurations
val shadowCommon by configurations
val commonTests: SourceSetOutput = project(":Common").sourceSets["test"].output
2022-05-31 10:50:46 -04:00
dependencies {
2023-06-14 05:48:49 -04:00
// loader
forge("net.minecraftforge:forge:$minecraftVersion-$forgeVersion")
2023-06-14 05:48:49 -04:00
// common module
2023-02-01 14:43:30 -05:00
common(project(":Common", "namedElements")) { isTransitive = false }
shadowCommon(project(":Common", "transformProductionForge")) { isTransitive = false }
2022-10-17 14:57:09 -04:00
2023-06-14 05:48:49 -04:00
// compile time mods
2023-02-01 14:43:30 -05:00
modCompileOnly("me.shedaniel:RoughlyEnoughItems-forge:$reiVersion") // required for common rei plugin | api does not work here
compileOnly("me.shedaniel:REIPluginCompatibilities-forge-annotations:9.+") // required to disable rei compat layer on jei plugin
testCompileOnly("me.shedaniel:REIPluginCompatibilities-forge-annotations:9.+") // don't question this, it's required for compiling
2023-06-14 05:48:49 -04:00
modCompileOnly("mezz.jei:jei-$minecraftVersion-forge-api:$jeiVersion") { // required for common jei plugin and mixin
isTransitive = false // prevents breaking the forge runtime
}
// runtime mods
when (forgeRecipeViewer) {
"rei" -> modLocalRuntime("me.shedaniel:RoughlyEnoughItems-forge:$reiVersion")
2022-10-17 14:57:09 -04:00
"jei" -> modLocalRuntime("mezz.jei:jei-$minecraftVersion-forge:$jeiVersion") { isTransitive = false }
else -> throw GradleException("Invalid forgeRecipeViewer value: $forgeRecipeViewer")
}
2022-05-31 10:50:46 -04:00
2023-06-14 05:48:49 -04:00
// tests
2022-06-23 12:47:03 -04:00
testImplementation(project(":Common"))
testImplementation(commonTests)
testImplementation("org.junit.jupiter:junit-jupiter-api:$junitVersion")
testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine:$junitVersion")
2022-05-31 10:50:46 -04:00
}