Skip to content

Commit

Permalink
Use shadowJar instead of includeApi
Browse files Browse the repository at this point in the history
For whatever reason it doesn't work for me, and what it matters most is that it works. If its unsupported or, dare I say "legacy", I don't care.

If it compiles it's good. I'd commit crimes to have cargo on kotlin, I swear to god that gradle may have led people to insanity at best, suicide at worst.

And the worst part is that it's not the worst offender, java build tools can always get worse.
  • Loading branch information
alikindsys committed Nov 29, 2023
1 parent d4a634e commit cdbb632
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 9 deletions.
34 changes: 25 additions & 9 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ plugins {
alias(libs.plugins.kotlin)
alias(libs.plugins.quilt.loom)
alias(libs.plugins.kotlinx.serialization)
alias(libs.plugins.shadow)
}

val archives_base_name: String by project
Expand All @@ -25,11 +26,26 @@ repositories {
// for more information about repositories.
}

fun DependencyHandlerScope.includeApi(dependency: Any) {
api(dependency)
include(dependency)
}
tasks {
remapJar {
dependsOn(shadowJar)
input.set(shadowJar.get().archiveFile)
}

shadowJar {
from("LICENSE")

configurations = listOf(
project.configurations.shadow.get()
)
archiveClassifier.set("dev-all")

exclude("kotlin/**", "kotlinx/**", "javax/**", "META-INF")
exclude("org/intellij/**", "org/jetbrains/annotations/**")
exclude("com/google/gson/**")
exclude("org/slf4j/**")
}
}
// All the dependencies are declared at gradle/libs.version.toml and referenced with "libs.<id>"
// See https://docs.gradle.org/current/userguide/platforms.html for information on how version catalogs work.
dependencies {
Expand Down Expand Up @@ -60,12 +76,12 @@ dependencies {

modImplementation(libs.qkl)

includeApi(libs.kotlinx.serialization)
shadow(libs.kotlinx.serialization)

includeApi(libs.ktor.core)
includeApi(libs.ktor.cio)
includeApi(libs.ktor.contentnegotiation)
includeApi(libs.ktor.json)
shadow(libs.ktor.core)
shadow(libs.ktor.cio)
shadow(libs.ktor.contentnegotiation)
shadow(libs.ktor.json)
}

tasks {
Expand Down
2 changes: 2 additions & 0 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ mappings = "1.20.1+build.23"
loom = "1.+"
ktx-ser = "1.6.0"
ktor = "2.3.6"
shadow = "8.1.1"

[libraries]
minecraft = { module = "com.mojang:minecraft", version.ref = "minecraft" }
Expand All @@ -33,3 +34,4 @@ quilted_fabric_api = ["qfapi", "qfapi_deprecated"]
kotlin = { id = "org.jetbrains.kotlin.jvm", version.ref = "kotlin" }
quilt_loom = { id = "org.quiltmc.loom", version.ref = "loom" }
kotlinx_serialization = { id = "org.jetbrains.kotlin.plugin.serialization", version.ref = "kotlin" }
shadow = { id = "com.github.johnrengelman.shadow", version.ref = "shadow" }

0 comments on commit cdbb632

Please sign in to comment.