3
0
Mirror von https://github.com/ViaVersion/ViaBackwards.git synchronisiert 2024-11-18 14:00:11 +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." description = "Allow older clients to join newer server versions."
} }
val platforms = setOf( val main = setOf(
projects.viabackwards,
projects.viabackwardsCommon,
projects.viabackwardsBukkit, projects.viabackwardsBukkit,
projects.viabackwardsBungee, projects.viabackwardsBungee,
projects.viabackwardsFabric, projects.viabackwardsFabric,
@ -17,15 +19,9 @@ val platforms = setOf(
projects.viabackwardsVelocity projects.viabackwardsVelocity
).map { it.dependencyProject } ).map { it.dependencyProject }
// Would otherwise contain api/depdency modules if at some point needed
val special = setOf(
projects.viabackwards
).map { it.dependencyProject }
subprojects { subprojects {
when (this) { when (this) {
in platforms -> plugins.apply("vb.platform-conventions") in main -> plugins.apply("vb.shadow-conventions")
in special -> plugins.apply("vb.base-conventions")
else -> plugins.apply("vb.standard-conventions") else -> plugins.apply("vb.standard-conventions")
} }
} }

Datei anzeigen

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

Datei anzeigen

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

Datei anzeigen

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

Datei anzeigen

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

Datei anzeigen

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

Datei anzeigen

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

Datei anzeigen

@ -1,47 +1,25 @@
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
import io.papermc.hangarpublishplugin.model.Platforms import io.papermc.hangarpublishplugin.model.Platforms
plugins { plugins {
id("com.github.johnrengelman.shadow")
id("io.papermc.hangar-publish-plugin") version "0.1.0" id("io.papermc.hangar-publish-plugin") version "0.1.0"
id("com.modrinth.minotaur") version "2.+" id("com.modrinth.minotaur") version "2.+"
} }
val platforms = setOf( dependencies {
projects.viabackwardsBukkit, api(projects.viabackwardsCommon)
projects.viabackwardsBungee, api(projects.viabackwardsBukkit)
projects.viabackwardsFabric, api(projects.viabackwardsBungee)
projects.viabackwardsSponge, api(projects.viabackwardsFabric)
projects.viabackwardsVelocity api(projects.viabackwardsSponge)
).map { it.dependencyProject } api(projects.viabackwardsVelocity)
}
tasks { tasks {
shadowJar { shadowJar {
archiveClassifier.set("")
archiveFileName.set("ViaBackwards-${project.version}.jar") archiveFileName.set("ViaBackwards-${project.version}.jar")
destinationDirectory.set(rootProject.projectDir.resolve("build/libs")) 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 branch = rootProject.branchName()
val baseVersion = project.version as String val baseVersion = project.version as String

Datei anzeigen

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