2024-02-23 17:58:39 +01:00
|
|
|
@file:Suppress("UnstableApiUsage")
|
|
|
|
|
2023-06-13 03:40:12 +02:00
|
|
|
import net.fabricmc.loom.task.RemapJarTask
|
2024-02-23 17:58:39 +01:00
|
|
|
import org.gradle.kotlin.dsl.dependencies
|
|
|
|
import org.gradle.kotlin.dsl.maven
|
2023-06-13 03:40:12 +02:00
|
|
|
|
2022-10-03 22:11:07 +02:00
|
|
|
plugins {
|
2024-02-23 17:58:39 +01:00
|
|
|
id("geyser.publish-conventions")
|
|
|
|
id("architectury-plugin")
|
|
|
|
id("dev.architectury.loom")
|
2022-10-03 22:11:07 +02:00
|
|
|
}
|
|
|
|
|
2024-03-19 23:05:30 +01:00
|
|
|
// These are provided by Minecraft/modded platforms already, no need to include them
|
|
|
|
provided("com.google.code.gson", "gson")
|
|
|
|
provided("com.google.guava", ".*")
|
|
|
|
provided("org.slf4j", "slf4j-api")
|
|
|
|
provided("com.nukkitx.fastutil", ".*")
|
|
|
|
provided("org.cloudburstmc.fastutil.maps", ".*")
|
|
|
|
provided("org.cloudburstmc.fastutil.sets", ".*")
|
|
|
|
provided("org.cloudburstmc.fastutil.commons", ".*")
|
|
|
|
provided("org.cloudburstmc.fastutil", ".*")
|
|
|
|
provided("org.checkerframework", "checker-qual")
|
|
|
|
provided("io.netty", "netty-transport-classes-epoll")
|
|
|
|
provided("io.netty", "netty-transport-native-epoll")
|
|
|
|
provided("io.netty", "netty-transport-native-unix-common")
|
|
|
|
provided("io.netty", "netty-transport-classes-kqueue")
|
|
|
|
provided("io.netty", "netty-transport-native-kqueue")
|
2024-04-19 11:50:40 +02:00
|
|
|
provided("io.netty.incubator", "netty-incubator-transport-native-io_uring")
|
|
|
|
provided("io.netty.incubator", "netty-incubator-transport-classes-io_uring")
|
2024-03-19 23:05:30 +01:00
|
|
|
provided("io.netty", "netty-handler")
|
|
|
|
provided("io.netty", "netty-common")
|
|
|
|
provided("io.netty", "netty-buffer")
|
|
|
|
provided("io.netty", "netty-resolver")
|
|
|
|
provided("io.netty", "netty-transport")
|
|
|
|
provided("io.netty", "netty-codec")
|
|
|
|
provided("io.netty", "netty-resolver-dns")
|
|
|
|
provided("io.netty", "netty-resolver-dns-native-macos")
|
|
|
|
provided("org.ow2.asm", "asm")
|
|
|
|
|
2024-02-23 17:58:39 +01:00
|
|
|
architectury {
|
2024-06-17 21:31:54 +02:00
|
|
|
minecraft = libs.minecraft.get().version as String
|
2022-10-03 22:11:07 +02:00
|
|
|
}
|
|
|
|
|
2023-07-07 20:55:28 +02:00
|
|
|
loom {
|
2024-02-23 17:58:39 +01:00
|
|
|
silentMojangMappingsLicense()
|
2022-10-17 04:47:26 +02:00
|
|
|
}
|
|
|
|
|
2024-04-22 23:36:48 +02:00
|
|
|
indra {
|
|
|
|
javaVersions {
|
|
|
|
target(21)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2024-03-19 23:05:30 +01:00
|
|
|
configurations {
|
|
|
|
create("includeTransitive").isTransitive = true
|
|
|
|
}
|
|
|
|
|
2022-10-03 22:11:07 +02:00
|
|
|
tasks {
|
|
|
|
// Loom will automatically attach sourcesJar to a RemapSourcesJar task and to the "build" task
|
|
|
|
// if it is present.
|
|
|
|
// If you remove this task, sources will not be generated.
|
|
|
|
sourcesJar {
|
|
|
|
archiveClassifier.set("sources")
|
|
|
|
from(sourceSets.main.get().allSource)
|
|
|
|
}
|
|
|
|
|
|
|
|
shadowJar {
|
2022-10-17 04:47:26 +02:00
|
|
|
// Mirrors the example fabric project, otherwise tons of dependencies are shaded that shouldn't be
|
|
|
|
configurations = listOf(project.configurations.shadow.get())
|
2024-02-23 17:58:39 +01:00
|
|
|
// The remapped shadowJar is the final desired mod jar
|
2022-10-17 04:47:26 +02:00
|
|
|
archiveVersion.set(project.version.toString())
|
|
|
|
archiveClassifier.set("shaded")
|
2022-10-03 22:11:07 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
remapJar {
|
|
|
|
dependsOn(shadowJar)
|
2022-10-05 00:18:53 +02:00
|
|
|
inputFile.set(shadowJar.get().archiveFile)
|
2023-06-13 03:40:12 +02:00
|
|
|
archiveClassifier.set("")
|
2024-02-23 17:58:39 +01:00
|
|
|
archiveVersion.set("")
|
2023-06-13 03:40:12 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
register("remapModrinthJar", RemapJarTask::class) {
|
|
|
|
dependsOn(shadowJar)
|
|
|
|
inputFile.set(shadowJar.get().archiveFile)
|
2024-06-17 21:31:54 +02:00
|
|
|
archiveVersion.set(project.version.toString() + "+build." + System.getenv("BUILD_NUMBER"))
|
2023-06-13 03:40:12 +02:00
|
|
|
archiveClassifier.set("")
|
2022-10-03 22:11:07 +02:00
|
|
|
}
|
2023-03-20 18:04:53 +01:00
|
|
|
}
|
|
|
|
|
2024-03-19 23:05:30 +01:00
|
|
|
afterEvaluate {
|
|
|
|
val providedDependencies = getProvidedDependenciesForProject(project.name)
|
|
|
|
|
|
|
|
// These are shaded, no need to JiJ them
|
|
|
|
configurations["shadow"].dependencies.forEach {shadowed ->
|
2024-06-17 21:31:54 +02:00
|
|
|
//println("Not including shadowed dependency: ${shadowed.group}:${shadowed.name}")
|
2024-03-19 23:05:30 +01:00
|
|
|
providedDependencies.add("${shadowed.group}:${shadowed.name}")
|
|
|
|
}
|
|
|
|
|
|
|
|
// Now: Include all transitive dependencies that aren't excluded
|
|
|
|
configurations["includeTransitive"].resolvedConfiguration.resolvedArtifacts.forEach { dep ->
|
|
|
|
if (!providedDependencies.contains("${dep.moduleVersion.id.group}:${dep.moduleVersion.id.name}")
|
|
|
|
and !providedDependencies.contains("${dep.moduleVersion.id.group}:.*")) {
|
2024-06-17 21:31:54 +02:00
|
|
|
//println("Including dependency via JiJ: ${dep.id}")
|
2024-03-19 23:05:30 +01:00
|
|
|
dependencies.add("include", dep.moduleVersion.id.toString())
|
|
|
|
} else {
|
2024-06-17 21:31:54 +02:00
|
|
|
//println("Not including ${dep.id} for ${project.name}!")
|
2024-03-19 23:05:30 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2024-02-23 17:58:39 +01:00
|
|
|
dependencies {
|
2024-06-17 21:31:54 +02:00
|
|
|
minecraft(libs.minecraft)
|
2024-02-23 17:58:39 +01:00
|
|
|
mappings(loom.officialMojangMappings())
|
|
|
|
}
|
|
|
|
|
|
|
|
repositories {
|
2024-04-17 05:52:46 +02:00
|
|
|
// mavenLocal()
|
2024-06-13 00:14:10 +02:00
|
|
|
maven("https://repo.opencollab.dev/main")
|
2024-02-23 17:58:39 +01:00
|
|
|
maven("https://jitpack.io")
|
|
|
|
maven("https://oss.sonatype.org/content/repositories/snapshots/")
|
|
|
|
maven("https://s01.oss.sonatype.org/content/repositories/snapshots/")
|
|
|
|
maven("https://maven.neoforged.net/releases")
|
|
|
|
}
|