#Help with shading library

11 messages · Page 1 of 1 (latest)

elder pebble
#

build.gradle.kts

plugins {
    id("fabric-loom")
    id("com.gradleup.shadow") version "9.0.0-beta12"
}

group = "com.nikoverflow.overflowclient"
version = project.property("client_version")!!

dependencies {
    minecraft("com.mojang:minecraft:${project.property("minecraft_version")}")
    mappings("net.fabricmc:yarn:${project.property("yarn_mappings")}")

    modImplementation("net.fabricmc:fabric-loader:${project.property("loader_version")}")

    shadow(implementation(project(":OverflowClient-API"))!!)
}

tasks.processResources {
    inputs.property("version", project.version)
    filesMatching("fabric.mod.json") {
        expand("version" to inputs.properties["version"])
    }
}

tasks.shadowJar {
    from(sourceSets["main"].output)
    configurations = listOf(project.configurations.getByName("shadow"))
    minimize()
}

tasks.remapJar {
    dependsOn(tasks.shadowJar)
    mustRunAfter(tasks.shadowJar)
    inputFile.set(project.file(tasks.shadowJar.get().archiveFile.get().asFile))
}

The whole net.fabricmc, ui.icon and other things is also shaded into the jar file that doesn't seem right.. What would be the intended way to fix it? Someone told me that i should create a thread and not write it in mod-dev-...

wide pulsar
#

Oh, if you're just trying to include something that doesn't have deps of its own, you can use include

#

Like implementation(include(stuff))

elder pebble
elder pebble
# wide pulsar Like `implementation(include(stuff))`

Nope it sadly doesn't work. The api is not shadedd in the jar.

Here is the build.gradle.kts from the Client:

plugins {
    id("fabric-loom")
}

group = "com.nikoverflow.overflowclient"
version = project.property("client_version")!!

dependencies {
    minecraft("com.mojang:minecraft:${project.property("minecraft_version")}")
    mappings("net.fabricmc:yarn:${project.property("yarn_mappings")}")

    modImplementation("net.fabricmc:fabric-loader:${project.property("loader_version")}")

    implementation(include(project(":OverflowClient-API"))!!)
}

tasks.processResources {
    inputs.property("version", project.version)
    filesMatching("fabric.mod.json") {
        expand("version" to inputs.properties["version"])
    }
}

Maybe it hels i have here the build.gradle.kts from the api:

plugins {
    id("java")
    id("fabric-loom")
}

group = "com.nikoverflow"
version = project.property("api_version")!!

dependencies {
    minecraft("com.mojang:minecraft:${project.property("minecraft_version")}")
    mappings("net.fabricmc:yarn:${project.property("yarn_mappings")}")

    modImplementation("net.fabricmc:fabric-loader:${project.property("loader_version")}")
}

I need stuff from Minecraft that's why i need fabric-loom here too.

elder pebble
#

or is it also possible that build.gradle.kts has an issue with fabric loom? but idk

elder pebble
# wide pulsar Like `implementation(include(stuff))`

ok i looked wrong it is as jar in. It works thank you. Do you know a better way for the api build.gradle.kts? I want to disable the runClient thing from the api. It shouldn't be visible in intellij if possible.

#

This is the new build.gradle.kts from the api:

plugins {
    id("java")
    id("fabric-loom")
}

group = "com.nikoverflow"
version = project.property("api_version")!!

dependencies {
    minecraft("com.mojang:minecraft:${project.property("minecraft_version")}")
    mappings("net.fabricmc:yarn:${project.property("yarn_mappings")}")
}
wide pulsar
#

I know the loom block is where it's generated, so overriding that might get rid of it.

willow trail
elder pebble