plugins { id "fabric-loom" version "1.7-SNAPSHOT" id "maven-publish" } base { group = project.maven_group archivesName = project.maven_name version = project.maven_version description = project.maven_description } 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 = "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/" } maven { name = "TerraformersMC" url = "https://maven.terraformersmc.com/releases" } maven { name = "Jitpack" url = "https://jitpack.io" content { includeGroup "com.github.Oryxel" } } } loom { accessWidenerPath = file("src/main/resources/viafabricplus.accesswidener") } dependencies { minecraft "com.mojang:minecraft:${project.minecraft_version}" mappings "net.fabricmc:yarn:${project.yarn_version}:v2" modImplementation "net.fabricmc:fabric-loader:${project.loader_version}" 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)) modCompileOnly "com.terraformersmc:modmenu:11.0.3" jij "com.viaversion:viaversion-common:5.1.1-20241029.135713-16" jij "com.viaversion:viabackwards-common:5.1.1-20241029.140148-8" jij "net.raphimc:viaaprilfools-common:3.0.4-20241029.140018-3" jij "net.raphimc:ViaLegacy:3.0.5-20241028.223112-3" jij ("net.raphimc:ViaBedrock:0.0.13-20241029.113655-3") { exclude group: "io.jsonwebtoken" exclude group: "com.mojang", module: "brigadier" } jij ("net.raphimc:ViaLoader:3.0.5-20241025.171921-1") { exclude group: "com.google.guava", module: "guava" exclude group: "org.slf4j", module: "slf4j-api" } jij ("net.raphimc:MinecraftAuth:4.1.1") { exclude group: "com.google.code.gson", module: "gson" exclude group: "org.slf4j", module: "slf4j-api" } jij "net.lenni0451:Reflect:1.3.4" jij("net.lenni0451:MCPing:1.4.2") { exclude group: "com.google.code.gson", module: "gson" } jij("org.cloudburstmc.netty:netty-transport-raknet:1.0.0.CR3-SNAPSHOT") { exclude group: "io.netty" } jij "de.florianmichael:Classic4J:2.1.1-SNAPSHOT" // Fabric's jar in jar system doesn't support transitive dependencies, so we have to manually add them afterEvaluate { configurations.jij.incoming.resolutionResult.allDependencies.each { dependencies.include(dependencies.implementation(dependencies.compileOnlyApi(it.requested.toString()) { transitive = false })) } } } processResources { filesMatching("fabric.mod.json") { expand( "version": project.version, "description": project.description, "implVersion": "git-${project.name}-${project.version}:${latestCommitHash()}", "mcVersion": mcVersion() ) } } String mcVersion() { if (project.supported_versions.isEmpty()) { return project.minecraft_version } else { return project.supported_versions } } String latestCommitHash() { def stdout = new ByteArrayOutputStream() exec { commandLine "git", "rev-parse", "--short", "HEAD" standardOutput = stdout } return stdout.toString().trim() } java { withSourcesJar() sourceCompatibility = JavaVersion.VERSION_21 targetCompatibility = JavaVersion.VERSION_21 } jar { // Rename the project's license file to LICENSE_ 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.maven_name version = project.maven_version from components.java pom { name = artifactId description = project.description url = "https://github.com/ViaVersion/ViaFabricPlus" licenses { license { name = "GPL-3.0 License" url = "https://github.com/ViaVersion/ViaFabricPlus/blob/main/LICENSE" } } developers { developer { id = "FlorianMichael" name = "EnZaXD" email = "florian.michael07@gmail.com" } developer { id = "RK_01" } } scm { connection = "scm:git:git://github.com/ViaVersion/ViaFabricPlus.git" developerConnection = "scm:git:ssh://github.com/ViaVersion/ViaFabricPlus.git" url = "github.com/ViaVersion/ViaFabricPlus" } } } } } idea { module { ["run"].each { excludeDirs << file("$it") } } }