mirror of
https://github.com/ViaVersion/ViaFabric.git
synced 2025-02-22 02:21:25 +01:00
172 lines
4.8 KiB
Plaintext
172 lines
4.8 KiB
Plaintext
plugins {
|
|
id("java")
|
|
id("maven-publish")
|
|
id("org.ajoberstar.grgit") version "5.3.0"
|
|
id("fabric-loom") version "1.9-SNAPSHOT"
|
|
id("legacy-looming") version "1.9-SNAPSHOT" apply false // Version = fabric-loom
|
|
id("com.github.ben-manes.versions") version "0.51.0"
|
|
id("xyz.wagyourtail.jvmdowngrader") version "0.7.1"
|
|
id("me.modmuss50.mod-publish-plugin") version "0.8.4"
|
|
}
|
|
|
|
private val env = System.getenv()
|
|
group = "com.viaversion.fabric"
|
|
description = "Client-side and server-side ViaVersion implementation for Fabric"
|
|
version = "0.4.17+" + env["GITHUB_RUN_NUMBER"] + "-" + getBranch()
|
|
|
|
fun getBranch(): String {
|
|
val branch = env["GITHUB_REF"] ?: grgit.branch.current().name ?: "unknown"
|
|
return branch.substringAfterLast("/")
|
|
}
|
|
|
|
allprojects {
|
|
apply(plugin = "java")
|
|
apply(plugin = "maven-publish")
|
|
apply(plugin = "fabric-loom")
|
|
apply(plugin = "legacy-looming")
|
|
|
|
java {
|
|
toolchain {
|
|
// lwjgl2 works with Adoptium
|
|
languageVersion.set(JavaLanguageVersion.of(21))
|
|
vendor.set(JvmVendorSpec.ADOPTIUM)
|
|
}
|
|
withSourcesJar()
|
|
}
|
|
|
|
tasks.withType<JavaCompile>().configureEach {
|
|
options.release.set(8)
|
|
}
|
|
tasks.withType<JavaExec>().configureEach {
|
|
javaLauncher.set(javaToolchains.launcherFor(java.toolchain))
|
|
}
|
|
|
|
version = rootProject.version
|
|
group = rootProject.group
|
|
|
|
repositories {
|
|
mavenCentral()
|
|
maven("https://repo.viaversion.com/")
|
|
maven("https://maven.fabricmc.net/")
|
|
maven("https://maven.legacyfabric.net/")
|
|
maven("https://maven.terraformersmc.com/releases/")
|
|
maven("https://maven.nucleoid.xyz/")
|
|
}
|
|
|
|
dependencies {
|
|
implementation("com.viaversion:viaversion:${rootProject.extra["viaver_version"]}") {
|
|
// transitive = false because Guava is conflicting on runClient
|
|
isTransitive = false
|
|
}
|
|
modImplementation("net.fabricmc:fabric-loader:${rootProject.extra["loader_version"]}")
|
|
}
|
|
|
|
tasks.processResources {
|
|
filesMatching("fabric.mod.json") {
|
|
expand(rootProject.properties)
|
|
}
|
|
}
|
|
}
|
|
|
|
subprojects {
|
|
loom {
|
|
runs {
|
|
named("client") {
|
|
client()
|
|
ideConfigGenerated(true)
|
|
runDir("run")
|
|
}
|
|
named("server") {
|
|
server()
|
|
ideConfigGenerated(true)
|
|
runDir("run")
|
|
}
|
|
}
|
|
}
|
|
|
|
dependencies {
|
|
implementation(project(":")) {
|
|
exclude(group = "net.fabricmc", module = "fabric-loader") // prevent duplicate fabric-loader on run
|
|
}
|
|
}
|
|
|
|
publishing {
|
|
publications {
|
|
create<MavenPublication>("mavenJava") {
|
|
from(components["java"])
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
publishing {
|
|
publications {
|
|
create<MavenPublication>("mavenJava") {
|
|
from(components["java"])
|
|
}
|
|
}
|
|
}
|
|
|
|
subprojects.forEach {
|
|
rootProject.tasks.named("remapJar").configure {
|
|
dependsOn("${it.path}:remapJar")
|
|
}
|
|
}
|
|
|
|
val includeJ8 = configurations.create("includeJ8")
|
|
|
|
jvmdg.dg(includeJ8)
|
|
|
|
dependencies {
|
|
// dummy version
|
|
minecraft("com.mojang:minecraft:1.13.2")
|
|
mappings("net.legacyfabric:yarn:1.13.2+build.541:v2")
|
|
|
|
includeJ8("com.viaversion:viaversion:${rootProject.extra["viaver_version"]}")
|
|
includeJ8("com.viaversion:viabackwards:${rootProject.extra["viaback_version"]}")
|
|
includeJ8("com.viaversion:viarewind:${rootProject.extra["viarewind_version"]}")
|
|
}
|
|
|
|
tasks.remapJar.configure {
|
|
nestedJars.from(includeJ8)
|
|
subprojects.forEach { subproject ->
|
|
subproject.tasks.matching { it.name == "remapJar" }.configureEach {
|
|
nestedJars.from(this)
|
|
}
|
|
}
|
|
}
|
|
|
|
val mcReleases = rootProject.extra["publish_mc_versions"].toString().split(",")
|
|
.map { it.trim() }
|
|
|
|
publishMods {
|
|
file = tasks.remapJar.get().archiveFile
|
|
changelog = "A changelog can be found at https://github.com/ViaVersion/ViaFabric/commits"
|
|
version = rootProject.version.toString()
|
|
displayName = "[${getBranch()}] ViaFabric $version"
|
|
modLoaders.add("fabric")
|
|
dryRun = providers.environmentVariable("CURSEFORGE_TOKEN").getOrNull() == null
|
|
|
|
curseforge {
|
|
accessToken = providers.environmentVariable("CURSEFORGE_TOKEN").orNull
|
|
projectId = "391298"
|
|
type = BETA // alpha is hidden by default
|
|
|
|
javaVersions.addAll(
|
|
(8..22).map { JavaVersion.toVersion(it) }
|
|
)
|
|
minecraftVersions.addAll(mcReleases)
|
|
optional("legacy-fabric-api")
|
|
}
|
|
modrinth {
|
|
accessToken = providers.environmentVariable("MODRINTH_TOKEN").orNull
|
|
projectId = "YlKdE5VK"
|
|
type = ALPHA
|
|
minecraftVersions.addAll(mcReleases)
|
|
optional("legacy-fabric-api")
|
|
embeds("viaversion")
|
|
}
|
|
}
|
|
|
|
defaultTasks("clean", "build")
|