3
0
Mirror von https://github.com/GeyserMC/Geyser.git synchronisiert 2024-09-27 22:00:17 +02:00

Gradle: avoid cross-configuration and enable configuration-on-demand (#5012)

Dieser Commit ist enthalten in:
Konicai 2024-09-03 00:54:50 -04:00 committet von GitHub
Ursprung 65cb15400a
Commit f8884568ee
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: B5690EEEBB952194
20 geänderte Dateien mit 123 neuen und 123 gelöschten Zeilen

Datei anzeigen

@ -0,0 +1,3 @@
plugins {
id("geyser.base-conventions")
}

Datei anzeigen

@ -1,3 +1,8 @@
plugins {
id("geyser.platform-conventions")
id("geyser.modrinth-uploading-conventions")
}
dependencies {
api(projects.core)

Datei anzeigen

@ -1,3 +1,7 @@
plugins {
id("geyser.modded-conventions")
}
architectury {
common("neoforge", "fabric")
}

Datei anzeigen

@ -1,3 +1,8 @@
plugins {
id("geyser.modded-conventions")
id("geyser.modrinth-uploading-conventions")
}
architectury {
platformSetupLoomIde()
fabric()

Datei anzeigen

@ -1,13 +1,18 @@
// This is provided by "org.cloudburstmc.math.mutable" too, so yeet.
// NeoForge's class loader is *really* annoying.
provided("org.cloudburstmc.math", "api")
provided("com.google.errorprone", "error_prone_annotations")
plugins {
id("geyser.modded-conventions")
id("geyser.modrinth-uploading-conventions")
}
architectury {
platformSetupLoomIde()
neoForge()
}
// This is provided by "org.cloudburstmc.math.mutable" too, so yeet.
// NeoForge's class loader is *really* annoying.
provided("org.cloudburstmc.math", "api")
provided("com.google.errorprone", "error_prone_annotations")
val includeTransitive: Configuration = configurations.getByName("includeTransitive")
dependencies {

Datei anzeigen

@ -1,3 +1,8 @@
plugins {
id("geyser.platform-conventions")
id("geyser.modrinth-uploading-conventions")
}
dependencies {
api(projects.core)
api(libs.erosion.bukkit.common) {

Datei anzeigen

@ -2,6 +2,7 @@ import com.github.jengelman.gradle.plugins.shadow.transformers.Log4j2PluginsCach
plugins {
application
id("geyser.platform-conventions")
}
val terminalConsoleVersion = "1.2.0"

Datei anzeigen

@ -1,3 +1,8 @@
plugins {
id("geyser.platform-conventions")
id("geyser.modrinth-uploading-conventions")
}
dependencies {
annotationProcessor(libs.velocity.api)
api(projects.core)

Datei anzeigen

@ -1,3 +1,7 @@
plugins {
id("geyser.platform-conventions")
}
dependencies {
api(projects.core)

Datei anzeigen

@ -12,9 +12,14 @@ repositories {
}
dependencies {
// This is for the LibsAccessor.kt hack
// this is OK as long as the same version catalog is used in the main build and build-logic
// see https://github.com/gradle/gradle/issues/15383#issuecomment-779893192
implementation(files(libs.javaClass.superclass.protectionDomain.codeSource.location))
// This is for applying plugins, and using the version from the libs.versions.toml
// Unfortunately they still need to be applied by their string name in the convention scripts.
implementation(libs.lombok)
implementation(libs.indra)
implementation(libs.shadow)
implementation(libs.architectury.plugin)

Datei anzeigen

@ -8,4 +8,4 @@ dependencyResolutionManagement {
}
}
rootProject.name = "build-logic"
rootProject.name = "build-logic"

Datei anzeigen

@ -3,9 +3,10 @@ plugins {
id("net.kyori.indra")
}
dependencies {
compileOnly("org.checkerframework", "checker-qual", "3.19.0")
}
val rootProperties: Map<String, *> = project.rootProject.properties
group = rootProperties["group"] as String + "." + rootProperties["id"] as String
version = rootProperties["version"] as String
description = rootProperties["description"] as String
indra {
github("GeyserMC", "Geyser") {
@ -20,18 +21,52 @@ indra {
}
}
tasks {
processResources {
// Spigot, BungeeCord, Velocity, Fabric, ViaProxy, NeoForge
filesMatching(listOf("plugin.yml", "bungee.yml", "velocity-plugin.json", "fabric.mod.json", "viaproxy.yml", "META-INF/neoforge.mods.toml")) {
expand(
"id" to "geyser",
"name" to "Geyser",
"version" to project.version,
"description" to project.description,
"url" to "https://geysermc.org",
"author" to "GeyserMC"
)
}
dependencies {
compileOnly("org.checkerframework", "checker-qual", libs.checker.qual.get().version)
}
repositories {
// mavenLocal()
mavenCentral()
// Floodgate, Cumulus etc.
maven("https://repo.opencollab.dev/main")
// Paper, Velocity
maven("https://repo.papermc.io/repository/maven-public")
// Spigot
maven("https://hub.spigotmc.org/nexus/content/repositories/snapshots") {
mavenContent { snapshotsOnly() }
}
}
// BungeeCord
maven("https://oss.sonatype.org/content/repositories/snapshots") {
mavenContent { snapshotsOnly() }
}
// NeoForge
maven("https://maven.neoforged.net/releases") {
mavenContent { releasesOnly() }
}
// Minecraft
maven("https://libraries.minecraft.net") {
name = "minecraft"
mavenContent { releasesOnly() }
}
// ViaVersion
maven("https://repo.viaversion.com") {
name = "viaversion"
}
// Jitpack for e.g. MCPL
maven("https://jitpack.io") {
content { includeGroupByRegex("com\\.github\\..*") }
}
// For Adventure snapshots
maven("https://s01.oss.sonatype.org/content/repositories/snapshots/")
}

Datei anzeigen

@ -1,45 +0,0 @@
repositories {
// mavenLocal()
mavenCentral()
// Floodgate, Cumulus etc.
maven("https://repo.opencollab.dev/main")
// Paper, Velocity
maven("https://repo.papermc.io/repository/maven-public")
// Spigot
maven("https://hub.spigotmc.org/nexus/content/repositories/snapshots") {
mavenContent { snapshotsOnly() }
}
// BungeeCord
maven("https://oss.sonatype.org/content/repositories/snapshots") {
mavenContent { snapshotsOnly() }
}
// NeoForge
maven("https://maven.neoforged.net/releases") {
mavenContent { releasesOnly() }
}
// Minecraft
maven("https://libraries.minecraft.net") {
name = "minecraft"
mavenContent { releasesOnly() }
}
// ViaVersion
maven("https://repo.viaversion.com") {
name = "viaversion"
}
// Jitpack for e.g. MCPL
maven("https://jitpack.io") {
content { includeGroupByRegex("com\\.github\\..*") }
}
// For Adventure snapshots
maven("https://s01.oss.sonatype.org/content/repositories/snapshots/")
}

Datei anzeigen

@ -2,11 +2,9 @@
import net.fabricmc.loom.task.RemapJarTask
import org.gradle.kotlin.dsl.dependencies
import org.gradle.kotlin.dsl.maven
plugins {
id("geyser.build-logic")
id("geyser.publish-conventions")
id("geyser.platform-conventions")
id("architectury-plugin")
id("dev.architectury.loom")
}

Datei anzeigen

@ -1,3 +1,20 @@
plugins {
id("geyser.publish-conventions")
}
id("io.freefair.lombok")
}
tasks {
processResources {
// Spigot, BungeeCord, Velocity, Fabric, ViaProxy, NeoForge
filesMatching(listOf("plugin.yml", "bungee.yml", "velocity-plugin.json", "fabric.mod.json", "viaproxy.yml", "META-INF/neoforge.mods.toml")) {
expand(
"id" to "geyser",
"name" to "Geyser",
"version" to project.version,
"description" to project.description,
"url" to "https://geysermc.org",
"author" to "GeyserMC"
)
}
}
}

Datei anzeigen

@ -1,55 +1,5 @@
plugins {
`java-library`
// Ensure AP works in eclipse (no effect on other IDEs)
eclipse
id("geyser.build-logic")
alias(libs.plugins.lombok) apply false
id("geyser.base-conventions")
}
allprojects {
group = properties["group"] as String + "." + properties["id"] as String
version = properties["version"] as String
description = properties["description"] as String
}
val basePlatforms = setOf(
projects.bungeecord,
projects.spigot,
projects.standalone,
projects.velocity,
projects.viaproxy
).map { it.dependencyProject }
val moddedPlatforms = setOf(
projects.fabric,
projects.neoforge,
projects.mod
).map { it.dependencyProject }
val modrinthPlatforms = setOf(
projects.bungeecord,
projects.fabric,
projects.neoforge,
projects.spigot,
projects.velocity
).map { it.dependencyProject }
subprojects {
apply {
plugin("java-library")
plugin("io.freefair.lombok")
plugin("geyser.build-logic")
}
when (this) {
in basePlatforms -> plugins.apply("geyser.platform-conventions")
in moddedPlatforms -> plugins.apply("geyser.modded-conventions")
else -> plugins.apply("geyser.base-conventions")
}
// Not combined with platform-conventions as that also contains
// platforms which we cant publish to modrinth
if (modrinthPlatforms.contains(this)) {
plugins.apply("geyser.modrinth-uploading-conventions")
}
}

Datei anzeigen

@ -1,5 +1,6 @@
plugins {
id("geyser.publish-conventions")
id("io.freefair.lombok")
}
dependencies {

Datei anzeigen

@ -3,6 +3,7 @@ plugins {
idea
alias(libs.plugins.blossom)
id("geyser.publish-conventions")
id("io.freefair.lombok")
}
dependencies {

Datei anzeigen

@ -1,6 +1,7 @@
# Gradle settings
org.gradle.jvmargs=-Xmx4G
org.gradle.daemon=false
org.gradle.configureondemand=true
org.gradle.parallel=true
org.gradle.caching=true
org.gradle.vfs.watch=false

Datei anzeigen

@ -134,6 +134,7 @@ protocol-connection = { group = "org.cloudburstmc.protocol", name = "bedrock-con
math = { group = "org.cloudburstmc.math", name = "immutable", version = "2.0" }
# plugins
lombok = { group = "io.freefair.gradle", name = "lombok-plugin", version.ref = "lombok" }
indra = { group = "net.kyori", name = "indra-common", version.ref = "indra" }
shadow = { group = "com.github.johnrengelman", name = "shadow", version.ref = "shadow" }
architectury-plugin = { group = "architectury-plugin", name = "architectury-plugin.gradle.plugin", version.ref = "architectury-plugin" }
@ -141,7 +142,6 @@ architectury-loom = { group = "dev.architectury.loom", name = "dev.architectury.
minotaur = { group = "com.modrinth.minotaur", name = "Minotaur", version.ref = "minotaur" }
[plugins]
lombok = { id = "io.freefair.lombok", version.ref = "lombok" }
indra = { id = "net.kyori.indra", version.ref = "indra" }
blossom = { id = "net.kyori.blossom", version.ref = "blossom" }