Skip to content

Instantly share code, notes, and snippets.

@Chocohead
Last active May 8, 2020 01:30
Show Gist options
  • Save Chocohead/96ee849ed9662b71a36331e936652ec0 to your computer and use it in GitHub Desktop.
Save Chocohead/96ee849ed9662b71a36331e936652ec0 to your computer and use it in GitHub Desktop.
Fat JiJing with Loom
archivesBaseName = "Module A"
version = "2.1"
plugins {
id 'fabric-loom' version 'b61d0c8' apply false
}
ext {//Just some common constants between the projects
mcVersion = "1.2.5"
yarnVersion = new File("yarn-1.2.5-3.jar")
}
archivesBaseName = "Big Old Mod"
version = "1.0"
allprojects {
apply plugin: 'fabric-loom'
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
minecraft {
}
dependencies {
minecraft "com.mojang:minecraft:${rootProject.mcVersion}"
mappings files(rootProject.yarnVersion)
modCompile "net.fabricmc:fabric-loader:0.7.8+build.189"
}
processResources {
inputs.property "version", project.version
from(sourceSets.main.resources.srcDirs) {
include "fabric.mod.json"
expand "version": project.version
}
from(sourceSets.main.resources.srcDirs) {
exclude "fabric.mod.json"
}
}
tasks.withType(JavaCompile) {
options.encoding = "UTF-8"
}
task sourcesJar(type: Jar, dependsOn: classes) {
classifier = "sources"
from sourceSets.main.allSource
}
}
subprojects {
import net.fabricmc.loom.task.RemapJarTask;
//Probably need this in an afterEvaluate because Fabric leaves it late to set this default
afterEvaluate {
remapJar {
//Don't JiJ for the remapJar task
addNestedDependencies = false
}
}
//If you want the individual modules too use this
task fullJar(type: RemapJarTask, dependsOn: jar) {
addNestedDependencies = true
classifier = 'full'
}
build.dependsOn fullJar
}
dependencies {
//Include all of the subprojects and whatever they need
subprojects.each {
include it
include it.configurations.include
}
}
@Chocohead
Copy link
Author

Purely conceptual (ie not tested), but should allow each module to have a full jar which includes its own JiJ'd dependencies and a normal remapped jar which didn't. The root project's jar would include all of the subproject modules and their dependencies fat jar style, with no extra.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment