3
0
Mirror von https://github.com/ViaVersion/ViaBackwards.git synchronisiert 2024-12-25 15:50:12 +01:00

Improve Gradle setup

Don't build full platform jars to reduce build time
Dieser Commit ist enthalten in:
Nassim Jahnke 2023-11-06 14:45:30 +10:00
Ursprung c13a89a29c
Commit 8eca6bf0b2
10 geänderte Dateien mit 20 neuen und 58 gelöschten Zeilen

Datei anzeigen

@ -1,12 +0,0 @@
import java.util.*
plugins {
id("vb.shadow-conventions")
}
tasks {
shadowJar {
archiveFileName.set("ViaBackwards-${project.name.substringAfter("viabackwards-").replaceFirstChar { if (it.isLowerCase()) it.titlecase(Locale.getDefault()) else it.toString() }}-${project.version}.jar")
destinationDirectory.set(rootProject.layout.buildDirectory.dir("libs"))
}
}

Datei anzeigen

@ -9,7 +9,9 @@ allprojects {
description = "Allow older clients to join newer server versions."
}
val platforms = setOf(
val main = setOf(
projects.viabackwards,
projects.viabackwardsCommon,
projects.viabackwardsBukkit,
projects.viabackwardsBungee,
projects.viabackwardsFabric,
@ -17,15 +19,9 @@ val platforms = setOf(
projects.viabackwardsVelocity
).map { it.dependencyProject }
// Would otherwise contain api/depdency modules if at some point needed
val special = setOf(
projects.viabackwards
).map { it.dependencyProject }
subprojects {
when (this) {
in platforms -> plugins.apply("vb.platform-conventions")
in special -> plugins.apply("vb.base-conventions")
in main -> plugins.apply("vb.shadow-conventions")
else -> plugins.apply("vb.standard-conventions")
}
}

Datei anzeigen

@ -1,5 +1,5 @@
dependencies {
implementation(projects.viabackwardsCommon)
compileOnlyApi(projects.viabackwardsCommon)
compileOnly(libs.paper) {
exclude("com.google.code.gson", "gson")
exclude("javax.persistence", "persistence-api")

Datei anzeigen

@ -1,4 +1,4 @@
dependencies {
implementation(projects.viabackwardsCommon)
compileOnlyApi(projects.viabackwardsCommon)
compileOnly(libs.bungee)
}

Datei anzeigen

@ -1,5 +1,5 @@
dependencies {
implementation(projects.viabackwardsCommon)
compileOnlyApi(projects.viabackwardsCommon)
compileOnly(libs.fabricLoader)
compileOnly(libs.log4j)
}

Datei anzeigen

@ -3,14 +3,14 @@ metadata.format.version = "1.1"
[versions]
# ViaVersion
viaver = "4.9.0-23w43a-SNAPSHOT"
viaver = "4.9.0-23w44a-SNAPSHOT"
# Common provided
netty = "4.0.20.Final"
guava = "17.0"
log4j = "2.8.1"
checkerQual = "3.29.0"
checkerQual = "3.39.0"
# Platforms
paper = "1.16.5-R0.1-SNAPSHOT"

Datei anzeigen

@ -1,4 +1,4 @@
dependencies {
implementation(projects.viabackwardsCommon)
compileOnlyApi(projects.viabackwardsCommon)
compileOnly(libs.sponge)
}

Datei anzeigen

@ -1,3 +1,3 @@
dependencies {
implementation(projects.viabackwardsCommon)
compileOnlyApi(projects.viabackwardsCommon)
}

Datei anzeigen

@ -1,48 +1,26 @@
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
import io.papermc.hangarpublishplugin.model.Platforms
plugins {
id("com.github.johnrengelman.shadow")
id("io.papermc.hangar-publish-plugin") version "0.1.0"
id("com.modrinth.minotaur") version "2.+"
}
val platforms = setOf(
projects.viabackwardsBukkit,
projects.viabackwardsBungee,
projects.viabackwardsFabric,
projects.viabackwardsSponge,
projects.viabackwardsVelocity
).map { it.dependencyProject }
dependencies {
api(projects.viabackwardsCommon)
api(projects.viabackwardsBukkit)
api(projects.viabackwardsBungee)
api(projects.viabackwardsFabric)
api(projects.viabackwardsSponge)
api(projects.viabackwardsVelocity)
}
tasks {
shadowJar {
archiveClassifier.set("")
archiveFileName.set("ViaBackwards-${project.version}.jar")
destinationDirectory.set(rootProject.projectDir.resolve("build/libs"))
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
platforms.forEach { platform ->
val shadowJarTask = platform.tasks.getByName("shadowJar", ShadowJar::class)
dependsOn(shadowJarTask)
dependsOn(platform.tasks.withType<Jar>())
from(zipTree(shadowJarTask.archiveFile))
}
}
build {
dependsOn(shadowJar)
}
sourcesJar {
rootProject.subprojects.forEach { subproject ->
if (subproject == project) return@forEach
val platformSourcesJarTask = subproject.tasks.findByName("sourcesJar") as? Jar ?: return@forEach
dependsOn(platformSourcesJarTask)
from(zipTree(platformSourcesJarTask.archiveFile))
}
}
}
publishShadowJar()
val branch = rootProject.branchName()
val baseVersion = project.version as String
val isRelease = !baseVersion.contains('-')

Datei anzeigen

@ -1,5 +1,5 @@
dependencies {
implementation(projects.viabackwardsCommon)
compileOnlyApi(projects.viabackwardsCommon)
compileOnly(libs.velocity) {
// Requires Java 11
exclude("com.velocitypowered", "velocity-brigadier")