ViaFabricPlus/build.gradle

167 lines
4.3 KiB
Groovy
Raw Normal View History

2023-02-19 23:17:33 +01:00
plugins {
2024-03-28 21:24:55 +01:00
id "fabric-loom" version "1.6-SNAPSHOT"
2023-06-01 16:13:57 +02:00
id "maven-publish"
2023-02-19 23:17:33 +01:00
}
2023-10-24 03:24:58 +02:00
base {
archivesName = project.archives_base_name
version = project.mod_version
group = project.maven_group
}
2023-02-19 23:17:33 +01:00
2023-02-21 04:24:49 +01:00
configurations {
jij // jar in jar configuration
modJij // jar in jar configuration for mods
include.extendsFrom modJij
modImplementation.extendsFrom modJij
modCompileOnlyApi.extendsFrom modJij
2023-02-21 04:24:49 +01:00
}
2023-10-24 03:24:58 +02:00
repositories {
mavenCentral()
maven {
name = "ViaVersion"
url = "https://repo.viaversion.com"
}
maven {
name = "Lenni0451"
url = "https://maven.lenni0451.net/everything"
}
maven {
name = "OpenCollab Snapshots"
url = "https://repo.opencollab.dev/maven-snapshots/"
2023-02-19 23:17:33 +01:00
}
maven {
name = "TerraformersMC"
url = "https://maven.terraformersmc.com/releases"
}
2023-02-19 23:17:33 +01:00
}
loom {
accessWidenerPath = file("src/main/resources/viafabricplus.accesswidener")
}
2023-02-19 23:17:33 +01:00
dependencies {
// Minecraft/Fabric and mods
2023-02-19 23:17:33 +01:00
minecraft "com.mojang:minecraft:${project.minecraft_version}"
mappings "net.fabricmc:yarn:${project.yarn_mappings}:v2"
modImplementation "net.fabricmc:fabric-loader:${project.loader_version}"
modCompileOnly "com.terraformersmc:modmenu:${project.mod_menu_version}"
// Fabric API
modJij(fabricApi.module("fabric-api-base", project.fabric_api_version))
modJij(fabricApi.module("fabric-resource-loader-v0", project.fabric_api_version))
modJij(fabricApi.module("fabric-networking-api-v1", project.fabric_api_version))
modJij(fabricApi.module("fabric-command-api-v2", project.fabric_api_version))
modJij(fabricApi.module("fabric-lifecycle-events-v1", project.fabric_api_version))
modJij(fabricApi.module("fabric-particles-v1", project.fabric_api_version))
modJij(fabricApi.module("fabric-registry-sync-v0", project.fabric_api_version))
2023-10-24 03:24:58 +02:00
// ViaVersion Libraries
jij "com.viaversion:viaversion-common:${project.viaversion_version}"
jij "com.viaversion:viabackwards-common:${project.viabackwards_version}"
2023-12-27 22:00:04 +01:00
jij "net.raphimc:ViaLegacy:${project.vialegacy_version}"
2024-07-21 15:55:06 +02:00
jij "net.raphimc:viaaprilfools-common:${project.viaaprilfools_version}"
jij ("net.raphimc:ViaBedrock:${project.viabedrock_version}") {
exclude group: "io.jsonwebtoken"
exclude group: "com.mojang", module: "brigadier"
}
jij ("net.raphimc:ViaLoader:${project.vialoader_version}") {
exclude group: "com.google.guava", module: "guava"
exclude group: "org.slf4j", module: "slf4j-api"
}
2023-10-24 03:24:58 +02:00
// RaphiMC Libraries
jij ("net.raphimc:MinecraftAuth:${project.minecraftauth_version}") {
2023-10-24 03:24:58 +02:00
exclude group: "com.google.code.gson", module: "gson"
exclude group: "org.slf4j", module: "slf4j-api"
}
2023-05-09 16:29:11 +02:00
2023-10-24 03:24:58 +02:00
// Lenni0451 Libraries
jij "net.lenni0451:Reflect:${project.reflect_version}"
jij("net.lenni0451:MCPing:${project.mcping_version}") {
exclude group: "com.google.code.gson", module: "gson"
}
2023-03-15 00:47:06 +01:00
2023-10-24 03:24:58 +02:00
// Misc Libraries
jij("org.cloudburstmc.netty:netty-transport-raknet:${project.raknet_transport_version}") {
exclude group: "io.netty"
}
jij "de.florianmichael:Classic4J:${project.classic4j_version}"
// Fabric's jar in jar system doesn't support transitive dependencies, so we have to manually add them
afterEvaluate {
2024-06-10 17:28:52 +02:00
configurations.jij.incoming.resolutionResult.allDependencies.each {
dependencies.include(dependencies.implementation(dependencies.compileOnlyApi(it.requested.toString()) {
transitive = false
}))
}
}
2023-02-19 23:17:33 +01:00
}
processResources {
filesMatching("fabric.mod.json") {
expand(
"version": project.version,
"implVersion": "git-${project.name}-${project.version}:${project.latestCommitHash()}",
)
}
}
String latestCommitHash() {
def stdout = new ByteArrayOutputStream()
exec {
commandLine "git", "rev-parse", "--short", "HEAD"
standardOutput = stdout
2023-02-19 23:17:33 +01:00
}
return stdout.toString().trim()
2023-02-19 23:17:33 +01:00
}
java {
withSourcesJar()
2023-04-11 18:35:23 +02:00
2024-04-17 23:13:28 +02:00
sourceCompatibility = JavaVersion.VERSION_21
targetCompatibility = JavaVersion.VERSION_21
2023-02-19 23:17:33 +01:00
}
jar {
2023-10-24 03:24:58 +02:00
// Rename the project's license file to LICENSE_<project_name> to avoid conflicts
from("LICENSE") {
rename {
"${it}_${project.archivesBaseName}"
}
}
2023-02-19 23:17:33 +01:00
}
2023-06-01 16:13:57 +02:00
publishing {
repositories {
maven {
name = "Via"
url = "https://repo.viaversion.com/"
credentials(PasswordCredentials)
authentication {
basic(BasicAuthentication)
}
}
}
publications {
maven(MavenPublication) {
groupId = project.maven_group
artifactId = project.archives_base_name
version = project.mod_version
from components.java
}
}
2023-06-16 19:14:18 +02:00
}
2023-12-25 20:30:50 +01:00
idea {
module {
["run"].each {
excludeDirs << file("$it")
}
}
}