ViaFabricPlus/build.gradle

158 lines
4.3 KiB
Groovy

plugins {
id "fabric-loom" version "1.4-SNAPSHOT"
id "maven-publish"
}
base {
archivesName = project.archives_base_name
version = project.mod_version
group = project.maven_group
}
configurations {
jij // jar in jar configuration
modJij // jar in jar configuration for mods
include.extendsFrom modJij
modImplementation.extendsFrom modJij
modCompileOnlyApi.extendsFrom modJij
}
repositories {
mavenCentral()
maven {
name = "Jitpack"
url = "https://jitpack.io"
}
maven {
name = "ViaVersion"
url = "https://repo.viaversion.com"
}
maven {
name = "Lenni0451"
url = "https://maven.lenni0451.net/everything"
}
maven {
name = "TerraformersMC"
url = "https://maven.terraformersmc.com/releases"
}
maven {
name = "OpenCollab Snapshots"
url = "https://repo.opencollab.dev/maven-snapshots/"
}
}
loom {
accessWidenerPath = file("src/main/resources/viafabricplus.accesswidener")
}
dependencies {
// Minecraft/Fabric and mods
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))
// ViaVersion Libraries
jij "com.viaversion:viaversion-common:${project.viaversion_version}"
jij ("com.viaversion:viabackwards-common:${project.viabackwards_version}") {
exclude group: "com.viaversion", module: "viaversion"
exclude group: "io.netty", module: "netty-all"
exclude group: "com.google.guava", module: "guava"
}
jij ("net.raphimc:ViaLegacy:${project.vialegacy_version}") {
exclude group: "com.google.code.gson", module: "gson"
}
jij "net.raphimc:ViaAprilFools:${project.viaaprilfools_version}"
jij ("net.raphimc:ViaBedrock:${project.viabedrock_version}") {
exclude group: "io.netty"
exclude group: "io.jsonwebtoken"
exclude group: "net.lenni0451.mcstructs", module: "text"
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"
}
// RaphiMC Libraries
jij ("net.raphimc:MinecraftAuth:${project.minecraftauth_version}") {
exclude group: "org.apache.httpcomponents", module: "httpclient"
exclude group: "com.google.code.gson", module: "gson"
exclude group: "org.slf4j", module: "slf4j-api"
}
// Lenni0451 Libraries
jij "net.lenni0451:Reflect:${project.reflect_version}"
jij("net.lenni0451:MCPing:${project.mcping_version}") {
exclude group: "com.google.code.gson", module: "gson"
}
// 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 {
configurations.jij.incoming.resolutionResult.allDependencies {
dependencies.include(dependencies.implementation(dependencies.compileOnlyApi(requested.toString())))
}
}
}
processResources {
inputs.property "version", project.version
filesMatching("fabric.mod.json") {
expand "version": project.version
}
}
java {
withSourcesJar()
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
}
jar {
// Rename the project's license file to LICENSE_<project_name> to avoid conflicts
from("LICENSE") {
rename {
"${it}_${project.archivesBaseName}"
}
}
}
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
}
}
}