From 38a779311c9235e381545abf63a0858f15885638 Mon Sep 17 00:00:00 2001 From: miozune Date: Tue, 9 May 2023 02:36:26 +0900 Subject: Use compileOnlyApi where appropriate (#1965) * Use compileOnlyApi where appropriate * Maybe Chisel doesn't need to be published --- dependencies.gradle | 31 ++++++++++++++++++++----------- 1 file changed, 20 insertions(+), 11 deletions(-) diff --git a/dependencies.gradle b/dependencies.gradle index 23c4396fc2..e56c630e10 100644 --- a/dependencies.gradle +++ b/dependencies.gradle @@ -6,6 +6,12 @@ * Available at runtime but not compiletime for mods depending on this mod * - compileOnly("g:n:v:c"): if the mod you're building doesn't need this dependency during runtime at all, e.g. for optional mods * Not available at all for mods depending on this mod, only visible at compiletime for this mod + * - compileOnlyApi("g:n:v:c"): like compileOnly, but also visible at compiletime for mods depending on this mod + * Available at compiletime but not runtime for mods depending on this mod + * - runtimeOnlyNonPublishable("g:n:v:c"): if you want to include a mod in this mod's runClient/runServer runs, but not publish it as a dependency + * Not available at all for mods depending on this mod, only visible at runtime for this mod + * - devOnlyNonPublishable("g:n:v:c"): a combination of runtimeOnlyNonPublishable and compileOnly for dependencies present at both compiletime and runtime, + * but not published as Maven dependencies - useful for RFG-deobfuscated dependencies or local testing * - runtimeOnly("g:n:v:c"): if you don't need this at compile time, but want it to be present at runtime * Available at runtime for mods depending on this mod * - annotationProcessor("g:n:v:c"): mostly for java compiler plugins, if you know you need this, use it, otherwise don't worry @@ -19,11 +25,17 @@ * You can exclude transitive dependencies (dependencies of the chosen dependency) by appending { transitive = false } if needed, * but use this sparingly as it can break using your mod as another mod's dependency if you're not careful. * - * For more details, see https://docs.gradle.org/7.6/userguide/java_library_plugin.html#sec:java_library_configurations_graph + * To depend on obfuscated jars you can use `devOnlyNonPublishable(rfg.deobf("dep:spec:1.2.3"))` to fetch an obfuscated jar from maven, + * or `devOnlyNonPublishable(rfg.deobf(project.files("libs/my-mod-jar.jar")))` to use a file. + * + * Gradle names for some of the configuration can be misleading, compileOnlyApi and runtimeOnly both get published as dependencies in Maven, but compileOnly does not. + * The buildscript adds runtimeOnlyNonPublishable to also have a runtime dependency that's not published. + * + * For more details, see https://docs.gradle.org/8.0.1/userguide/java_library_plugin.html#sec:java_library_configurations_graph */ dependencies { api("com.github.GTNewHorizons:StructureLib:1.2.6:dev") - + api("net.industrial-craft:industrialcraft-2:2.2.828-experimental:dev") api("com.github.GTNewHorizons:NotEnoughItems:2.3.46-GTNH:dev") api("com.github.GTNewHorizons:GTNHLib:0.0.13:dev") api("com.github.GTNewHorizons:ModularUI:1.1.7:dev") @@ -31,24 +43,21 @@ dependencies { api("com.github.GTNewHorizons:Applied-Energistics-2-Unofficial:rv3-beta-197-GTNH:dev") implementation("com.github.GTNewHorizons:Eternal-Singularity:1.1.0:dev") - api("net.industrial-craft:industrialcraft-2:2.2.828-experimental:dev") + compileOnlyApi("com.github.GTNewHorizons:AppleCore:3.2.10:dev") { transitive = false } + compileOnlyApi("com.github.GTNewHorizons:BuildCraft:7.1.28:dev") { transitive = false } + compileOnlyApi("com.github.GTNewHorizons:EnderIO:2.4.10:dev") { transitive = false } + compileOnlyApi("com.github.GTNewHorizons:ForestryMC:4.6.3:dev") { transitive = false } + compileOnlyApi("com.github.GTNewHorizons:ProjectRed:4.7.9-GTNH:dev") { transitive = false } + compileOnlyApi("com.github.GTNewHorizons:Railcraft:9.13.18:dev") { transitive = false } compileOnly("com.github.GTNewHorizons:EnderCore:0.2.12:dev") { transitive = false } - compileOnly("com.github.GTNewHorizons:ForestryMC:4.6.3:dev") { transitive = false } - compileOnly("com.github.GTNewHorizons:gendustry:1.6.5.5-GTNH:dev") { transitive = false } - compileOnly("com.github.GTNewHorizons:Railcraft:9.13.18:dev") { transitive = false } compileOnly("com.github.GTNewHorizons:Galacticraft:3.0.65-GTNH:dev") { transitive = false } - compileOnly("com.github.GTNewHorizons:AppleCore:3.2.10:dev") { transitive = false } compileOnly("com.github.GTNewHorizons:TinkersConstruct:1.9.23-GTNH:dev") { transitive = false } compileOnly("com.github.GTNewHorizons:Chisel:2.10.17-GTNH:dev") { transitive = false } - compileOnly("com.github.GTNewHorizons:EnderIO:2.4.10:dev") { transitive = false } - compileOnly("com.github.GTNewHorizons:BuildCraft:7.1.28:dev") { transitive = false } compileOnly("com.github.GTNewHorizons:Translocators:1.1.2.21:dev") { transitive = false } compileOnly("curse.maven:cofh-core-69162:2388751") { transitive = false } compileOnly("com.github.GTNewHorizons:Nuclear-Control:2.4.16:dev") { transitive = false } compileOnly("thaumcraft:Thaumcraft:1.7.10-4.2.3.5:dev") { transitive = false } - compileOnly("com.github.GTNewHorizons:Avaritia:1.31:dev") { transitive = false } - compileOnly("com.github.GTNewHorizons:ProjectRed:4.7.9-GTNH:dev") { transitive = false } compileOnly("com.github.GTNewHorizons:Hodgepodge:2.2.8:dev") { transitive = false } compileOnly("com.google.auto.value:auto-value-annotations:1.10.1") { transitive = false } -- cgit