summaryrefslogtreecommitdiff
path: root/build.gradle
diff options
context:
space:
mode:
authorLuke Bemish <lukebemish@lukebemish.dev>2024-04-28 00:48:11 -0500
committerGitHub <noreply@github.com>2024-04-28 01:48:11 -0400
commita780f5831b35b386cd59d958641bec98107fdfd9 (patch)
treebb5492327949618205c369149283452fe732056f /build.gradle
parent6074a78fba8aea8453e10017244da6c385c78109 (diff)
Stop recommending that mods depend on an optional dependency via runtimeOnly (#48)
* Stop recommending that mods depend on an optional dependency via runtimeOnly * Switch forge in dep to neoforge * Make comment more intuitive
Diffstat (limited to 'build.gradle')
-rw-r--r--build.gradle14
1 files changed, 11 insertions, 3 deletions
diff --git a/build.gradle b/build.gradle
index a9e5a45..8bd9e19 100644
--- a/build.gradle
+++ b/build.gradle
@@ -72,6 +72,13 @@ runs {
// Include resources generated by data generators.
sourceSets.main.resources { srcDir 'src/generated/resources' }
+// Sets up a dependency configuration called 'localRuntime'.
+// This configuration should be used instead of 'runtimeOnly' to declare
+// a dependency that will be present for runtime testing but that is
+// "optional", meaning it will not be pulled by dependents of this mod.
+configurations {
+ runtimeClasspath.extendsFrom localRuntime
+}
dependencies {
// Specify the version of Minecraft to use.
@@ -82,11 +89,12 @@ dependencies {
// For all intends and purposes: You can treat this dependency as if it is a normal library you would use.
implementation "net.neoforged:neoforge:${neo_version}"
- // Example mod dependency with JEI
+ // Example optional mod dependency with JEI
// The JEI API is declared for compile time use, while the full JEI artifact is used at runtime
// compileOnly "mezz.jei:jei-${mc_version}-common-api:${jei_version}"
- // compileOnly "mezz.jei:jei-${mc_version}-forge-api:${jei_version}"
- // runtimeOnly "mezz.jei:jei-${mc_version}-forge:${jei_version}"
+ // compileOnly "mezz.jei:jei-${mc_version}-neoforge-api:${jei_version}"
+ // We add the full version to localRuntime, not runtimeOnly, so that we do not publish a dependency on it
+ // localRuntime "mezz.jei:jei-${mc_version}-neoforge:${jei_version}"
// Example mod dependency using a mod jar from ./libs with a flat dir repository
// This maps to ./libs/coolmod-${mc_version}-${coolmod_version}.jar