From 6321ecc1669d12680d71633f10c7f234404f5992 Mon Sep 17 00:00:00 2001 From: RednedEpic Date: Sun, 27 Feb 2022 16:38:55 -0600 Subject: [PATCH] Initial move to gradle --- Jenkinsfile | 6 +- ap/build.gradle.kts | 0 .../geysermc/processor/ClassProcessor.java | 1 + .../javax.annotation.processing.Processor | 0 api/base/build.gradle.kts | 1 + api/base/pom.xml | 27 -- api/geyser/build.gradle.kts | 3 + api/geyser/pom.xml | 48 --- .../org/geysermc/geyser/api/GeyserApi.java | 4 +- api/pom.xml | 25 -- bootstrap/bungeecord/build.gradle.kts | 35 ++ bootstrap/bungeecord/pom.xml | 103 ----- .../bungeecord/GeyserBungeePlugin.java | 2 +- .../bungeecord/src/main/resources/bungee.yml | 8 +- bootstrap/pom.xml | 49 --- bootstrap/spigot/build.gradle.kts | 46 +++ bootstrap/spigot/pom.xml | 127 ------ .../spigot/src/main/resources/plugin.yml | 8 +- bootstrap/sponge/build.gradle.kts | 36 ++ bootstrap/sponge/pom.xml | 101 ----- bootstrap/standalone/build.gradle.kts | 33 ++ bootstrap/standalone/pom.xml | 140 ------- .../standalone/GeyserStandaloneBootstrap.java | 2 + .../standalone/GeyserStandaloneLogger.java | 8 +- .../standalone/src/main/resources/log4j2.xml | 2 +- bootstrap/velocity/build.gradle.kts | 68 ++++ bootstrap/velocity/pom.xml | 106 ----- build-logic/build.gradle.kts | 21 + build-logic/src/main/kotlin/Versions.kt | 44 +++ build-logic/src/main/kotlin/extensions.kt | 79 ++++ .../kotlin/geyser.api-conventions.gradle.kts | 9 + .../kotlin/geyser.base-conventions.gradle.kts | 41 ++ .../main/kotlin/geyser.build-logic.gradle.kts | 0 .../geyser.platform-conventions.gradle.kts | 4 + .../geyser.shadow-conventions.gradle.kts | 55 +++ build.gradle.kts | 43 ++ common/build.gradle.kts | 3 + common/pom.xml | 31 -- core/build.gradle.kts | 86 ++++ core/pom.xml | 374 ------------------ .../geysermc/connector/GeyserConnector.java | 2 +- .../java/org/geysermc/geyser/GeyserImpl.java | 33 +- .../command/defaults/VersionCommand.java | 13 +- core/src/main/resources/languages | 2 +- gradle.properties | 6 + gradle/wrapper/gradle-wrapper.properties | 5 + gradlew | 234 +++++++++++ gradlew.bat | 89 +++++ pom.xml | 95 ----- settings.gradle.kts | 73 ++++ 50 files changed, 1052 insertions(+), 1279 deletions(-) create mode 100644 ap/build.gradle.kts rename {core => ap}/src/main/resources/META-INF/services/javax.annotation.processing.Processor (100%) create mode 100644 api/base/build.gradle.kts delete mode 100644 api/base/pom.xml create mode 100644 api/geyser/build.gradle.kts delete mode 100644 api/geyser/pom.xml delete mode 100644 api/pom.xml create mode 100644 bootstrap/bungeecord/build.gradle.kts delete mode 100644 bootstrap/bungeecord/pom.xml delete mode 100644 bootstrap/pom.xml create mode 100644 bootstrap/spigot/build.gradle.kts delete mode 100644 bootstrap/spigot/pom.xml create mode 100644 bootstrap/sponge/build.gradle.kts delete mode 100644 bootstrap/sponge/pom.xml create mode 100644 bootstrap/standalone/build.gradle.kts delete mode 100644 bootstrap/standalone/pom.xml create mode 100644 bootstrap/velocity/build.gradle.kts delete mode 100644 bootstrap/velocity/pom.xml create mode 100644 build-logic/build.gradle.kts create mode 100644 build-logic/src/main/kotlin/Versions.kt create mode 100644 build-logic/src/main/kotlin/extensions.kt create mode 100644 build-logic/src/main/kotlin/geyser.api-conventions.gradle.kts create mode 100644 build-logic/src/main/kotlin/geyser.base-conventions.gradle.kts create mode 100644 build-logic/src/main/kotlin/geyser.build-logic.gradle.kts create mode 100644 build-logic/src/main/kotlin/geyser.platform-conventions.gradle.kts create mode 100644 build-logic/src/main/kotlin/geyser.shadow-conventions.gradle.kts create mode 100644 build.gradle.kts create mode 100644 common/build.gradle.kts delete mode 100644 common/pom.xml create mode 100644 core/build.gradle.kts delete mode 100644 core/pom.xml create mode 100644 gradle.properties create mode 100644 gradle/wrapper/gradle-wrapper.properties create mode 100644 gradlew create mode 100644 gradlew.bat delete mode 100644 pom.xml create mode 100644 settings.gradle.kts diff --git a/Jenkinsfile b/Jenkinsfile index 481c02310..b8566b2f7 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -1,7 +1,7 @@ pipeline { agent any tools { - maven 'Maven 3' + gradle 'Gradle 7' jdk 'Java 16' } options { @@ -11,11 +11,11 @@ pipeline { stage ('Build') { steps { sh 'git submodule update --init --recursive' - sh 'mvn clean package' + sh './gradlew shadowJar' } post { success { - archiveArtifacts artifacts: 'bootstrap/**/target/*.jar', excludes: 'bootstrap/**/target/original-*.jar', fingerprint: true + archiveArtifacts artifacts: 'bootstrap/**/build/libs/*.jar', excludes: 'bootstrap/**/build/libs/original-*.jar', fingerprint: true } } } diff --git a/ap/build.gradle.kts b/ap/build.gradle.kts new file mode 100644 index 000000000..e69de29bb diff --git a/ap/src/main/java/org/geysermc/processor/ClassProcessor.java b/ap/src/main/java/org/geysermc/processor/ClassProcessor.java index a6259a853..0f730aaba 100644 --- a/ap/src/main/java/org/geysermc/processor/ClassProcessor.java +++ b/ap/src/main/java/org/geysermc/processor/ClassProcessor.java @@ -163,6 +163,7 @@ public class ClassProcessor extends AbstractProcessor { this.processingEnv.getMessager().printMessage(Diagnostic.Kind.NOTE, "Reading existing " + this.annotationClassName + " list from " + this.outputPath); return Files.newBufferedReader(this.outputPath); } + FileObject obj = this.processingEnv.getFiler().getResource(StandardLocation.CLASS_OUTPUT, "", this.annotationClassName); if (obj != null) { this.processingEnv.getMessager().printMessage(Diagnostic.Kind.NOTE, "Reading existing " + this.annotationClassName + " list from " + obj.toUri()); diff --git a/core/src/main/resources/META-INF/services/javax.annotation.processing.Processor b/ap/src/main/resources/META-INF/services/javax.annotation.processing.Processor similarity index 100% rename from core/src/main/resources/META-INF/services/javax.annotation.processing.Processor rename to ap/src/main/resources/META-INF/services/javax.annotation.processing.Processor diff --git a/api/base/build.gradle.kts b/api/base/build.gradle.kts new file mode 100644 index 000000000..d7500fdaa --- /dev/null +++ b/api/base/build.gradle.kts @@ -0,0 +1 @@ +provided("net.kyori", "event-api", Versions.eventVersion) \ No newline at end of file diff --git a/api/base/pom.xml b/api/base/pom.xml deleted file mode 100644 index 17edb1a85..000000000 --- a/api/base/pom.xml +++ /dev/null @@ -1,27 +0,0 @@ - - - - org.geysermc - api-parent - 2.0.1-SNAPSHOT - - 4.0.0 - - base-api - - - 16 - 16 - - - - - org.checkerframework - checker-qual - 3.19.0 - provided - - - \ No newline at end of file diff --git a/api/geyser/build.gradle.kts b/api/geyser/build.gradle.kts new file mode 100644 index 000000000..f9f8e66a8 --- /dev/null +++ b/api/geyser/build.gradle.kts @@ -0,0 +1,3 @@ +dependencies { + api(projects.api) +} \ No newline at end of file diff --git a/api/geyser/pom.xml b/api/geyser/pom.xml deleted file mode 100644 index de9c63e83..000000000 --- a/api/geyser/pom.xml +++ /dev/null @@ -1,48 +0,0 @@ - - - - org.geysermc - api-parent - 2.0.1-SNAPSHOT - ../pom.xml - - 4.0.0 - - geyser-api - - - 16 - 16 - - 4.9.3 - - - - - org.checkerframework - checker-qual - 3.19.0 - provided - - - net.kyori - event-api - 3.0.0 - provided - - - org.geysermc - base-api - 2.0.1-SNAPSHOT - compile - - - org.yaml - snakeyaml - 1.27 - compile - - - \ No newline at end of file diff --git a/api/geyser/src/main/java/org/geysermc/geyser/api/GeyserApi.java b/api/geyser/src/main/java/org/geysermc/geyser/api/GeyserApi.java index 2bddc9ef5..b5a0c7897 100644 --- a/api/geyser/src/main/java/org/geysermc/geyser/api/GeyserApi.java +++ b/api/geyser/src/main/java/org/geysermc/geyser/api/GeyserApi.java @@ -55,9 +55,9 @@ public interface GeyserApi extends GeyserApiBase { * Gets if this Geyser instance is running in an IDE. This only needs to be used in cases where files * expected to be in a jarfile are not present. * - * @return true if the version number is not 'DEV'. + * @return if we are in a production environment */ - boolean productionEnvironment(); + boolean isProductionEnvironment(); /** * {@inheritDoc} diff --git a/api/pom.xml b/api/pom.xml deleted file mode 100644 index b6d865cb4..000000000 --- a/api/pom.xml +++ /dev/null @@ -1,25 +0,0 @@ - - - 4.0.0 - - org.geysermc - geyser-parent - 2.0.1-SNAPSHOT - ../pom.xml - - - api-parent - pom - - - 16 - 16 - - - - base - geyser - - \ No newline at end of file diff --git a/bootstrap/bungeecord/build.gradle.kts b/bootstrap/bungeecord/build.gradle.kts new file mode 100644 index 000000000..873df692a --- /dev/null +++ b/bootstrap/bungeecord/build.gradle.kts @@ -0,0 +1,35 @@ +val bungeeVersion = "a7c6ede"; + +dependencies { + api(projects.core) +} + +platformRelocate("net.md_5.bungee.jni") +platformRelocate("com.fasterxml.jackson") +platformRelocate("io.netty.channel.kqueue") // This is not used because relocating breaks natives, but we must include it or else we get ClassDefNotFound +platformRelocate("net.kyori") + +// These dependencies are already present on the platform +provided("com.github.SpigotMC.BungeeCord", "bungeecord-proxy", bungeeVersion) + +application { + mainClass.set("org.geysermc.geyser.platform.bungeecord.GeyserBungeeMain") +} + +tasks.withType { + archiveBaseName.set("Geyser-BungeeCord") + + dependencies { + exclude(dependency("com.google.*:.*")) + exclude(dependency("org.yaml:.*")) + exclude(dependency("io.netty:netty-transport-native-epoll:.*")) + exclude(dependency("io.netty:netty-transport-native-unix-common:.*")) + exclude(dependency("io.netty:netty-handler:.*")) + exclude(dependency("io.netty:netty-common:.*")) + exclude(dependency("io.netty:netty-buffer:.*")) + exclude(dependency("io.netty:netty-resolver:.*")) + exclude(dependency("io.netty:netty-transport:.*")) + exclude(dependency("io.netty:netty-codec:.*")) + exclude(dependency("io.netty:netty-resolver-dns:.*")) + } +} \ No newline at end of file diff --git a/bootstrap/bungeecord/pom.xml b/bootstrap/bungeecord/pom.xml deleted file mode 100644 index 45a08c7db..000000000 --- a/bootstrap/bungeecord/pom.xml +++ /dev/null @@ -1,103 +0,0 @@ - - - 4.0.0 - - org.geysermc - bootstrap-parent - 2.0.1-SNAPSHOT - - bootstrap-bungeecord - - - - org.geysermc - core - 2.0.1-SNAPSHOT - compile - - - - com.github.SpigotMC.BungeeCord - bungeecord-proxy - a7c6ede - provided - - - - ${outputName}-BungeeCord - - - src/main/resources/ - true - - - - - org.apache.maven.plugins - maven-jar-plugin - 3.2.0 - - - - org.geysermc.geyser.platform.bungeecord.GeyserBungeeMain - - - - - - org.apache.maven.plugins - maven-shade-plugin - 3.3.0-SNAPSHOT - - - package - - shade - - - - - net.md_5.bungee.jni - org.geysermc.geyser.platform.bungeecord.shaded.jni - - - com.fasterxml.jackson - org.geysermc.geyser.platform.bungeecord.shaded.jackson - - - - io.netty.channel.kqueue - org.geysermc.geyser.platform.bungeecord.shaded.io.netty.channel.kqueue - - - net.kyori - org.geysermc.geyser.platform.bungeecord.shaded.kyori - - - - - - - - - com.google.*:* - org.yaml:* - io.netty:netty-transport-native-epoll:* - io.netty:netty-transport-native-unix-common:* - io.netty:netty-handler:* - io.netty:netty-common:* - io.netty:netty-buffer:* - io.netty:netty-resolver:* - io.netty:netty-transport:* - io.netty:netty-codec:* - io.netty:netty-resolver-dns:* - - - - - - - diff --git a/bootstrap/bungeecord/src/main/java/org/geysermc/geyser/platform/bungeecord/GeyserBungeePlugin.java b/bootstrap/bungeecord/src/main/java/org/geysermc/geyser/platform/bungeecord/GeyserBungeePlugin.java index bb90e5000..0aa82d9cd 100644 --- a/bootstrap/bungeecord/src/main/java/org/geysermc/geyser/platform/bungeecord/GeyserBungeePlugin.java +++ b/bootstrap/bungeecord/src/main/java/org/geysermc/geyser/platform/bungeecord/GeyserBungeePlugin.java @@ -27,6 +27,7 @@ package org.geysermc.geyser.platform.bungeecord; import net.md_5.bungee.api.config.ListenerInfo; import net.md_5.bungee.api.plugin.Plugin; +import org.checkerframework.checker.nullness.qual.Nullable; import org.geysermc.common.PlatformType; import org.geysermc.geyser.GeyserImpl; import org.geysermc.geyser.GeyserBootstrap; @@ -40,7 +41,6 @@ import org.geysermc.geyser.util.FileUtils; import org.geysermc.geyser.text.GeyserLocale; import org.geysermc.geyser.platform.bungeecord.command.GeyserBungeeCommandExecutor; import org.geysermc.geyser.platform.bungeecord.command.GeyserBungeeCommandManager; -import org.jetbrains.annotations.Nullable; import java.io.File; import java.io.IOException; diff --git a/bootstrap/bungeecord/src/main/resources/bungee.yml b/bootstrap/bungeecord/src/main/resources/bungee.yml index 7390a4623..1e18b8da4 100644 --- a/bootstrap/bungeecord/src/main/resources/bungee.yml +++ b/bootstrap/bungeecord/src/main/resources/bungee.yml @@ -1,5 +1,5 @@ main: org.geysermc.geyser.platform.bungeecord.GeyserBungeePlugin -name: ${outputName}-BungeeCord -author: ${project.organization.name} -website: ${project.organization.url} -version: ${project.version} \ No newline at end of file +name: ${name}-BungeeCord +author: ${author} +website: ${url} +version: ${version} \ No newline at end of file diff --git a/bootstrap/pom.xml b/bootstrap/pom.xml deleted file mode 100644 index 58c651455..000000000 --- a/bootstrap/pom.xml +++ /dev/null @@ -1,49 +0,0 @@ - - - 4.0.0 - - org.geysermc - geyser-parent - 2.0.1-SNAPSHOT - - bootstrap-parent - pom - - - - spigot-public - https://hub.spigotmc.org/nexus/content/repositories/public/ - - - sponge-repo - https://repo.spongepowered.org/repository/maven-public/ - - - bungeecord-repo - https://oss.sonatype.org/content/repositories/snapshots - - - velocity-repo - https://repo.velocitypowered.com/snapshots/ - - - - - - org.geysermc - ap - 2.0.1-SNAPSHOT - provided - - - - - bungeecord - spigot - sponge - standalone - velocity - - \ No newline at end of file diff --git a/bootstrap/spigot/build.gradle.kts b/bootstrap/spigot/build.gradle.kts new file mode 100644 index 000000000..affb243b3 --- /dev/null +++ b/bootstrap/spigot/build.gradle.kts @@ -0,0 +1,46 @@ +val paperVersion = "1.17.1-R0.1-SNAPSHOT" // Needed because we do not support Java 17 yet +val viaVersion = "4.0.0" +val adaptersVersion = "1.3-SNAPSHOT" + +dependencies { + api(projects.core) + + implementation("org.geysermc.geyser.adapters", "spigot-all", adaptersVersion) +} + +platformRelocate("it.unimi.dsi.fastutil") +platformRelocate("com.fasterxml.jackson") +platformRelocate("net.kyori") +platformRelocate("org.objectweb.asm") + +// These dependencies are already present on the platform +provided("io.papermc.paper", "paper-api", paperVersion) +provided("com.viaversion", "viaversion", viaVersion) + +application { + mainClass.set("org.geysermc.geyser.platform.spigot.GeyserSpigotMain") +} + +tasks.withType { + archiveBaseName.set("Geyser-Spigot") + + dependencies { + exclude(dependency("com.google.*:.*")) + exclude(dependency("org.yaml:.*")) + + // We cannot shade Netty, or else native libraries will not load + // Needed because older Spigot builds do not provide the haproxy module + exclude(dependency("io.netty:netty-transport-native-epoll:.*")) + exclude(dependency("io.netty:netty-transport-native-unix-common:.*")) + exclude(dependency("io.netty:netty-transport-native-kqueue:.*")) + exclude(dependency("io.netty:netty-handler:.*")) + exclude(dependency("io.netty:netty-common:.*")) + exclude(dependency("io.netty:netty-buffer:.*")) + exclude(dependency("io.netty:netty-resolver:.*")) + exclude(dependency("io.netty:netty-transport:.*")) + exclude(dependency("io.netty:netty-codec:.*")) + exclude(dependency("io.netty:netty-codec-dns:.*")) + exclude(dependency("io.netty:netty-resolver-dns:.*")) + exclude(dependency("io.netty:netty-resolver-dns-native-macos:.*")) + } +} \ No newline at end of file diff --git a/bootstrap/spigot/pom.xml b/bootstrap/spigot/pom.xml deleted file mode 100644 index 6eda527f3..000000000 --- a/bootstrap/spigot/pom.xml +++ /dev/null @@ -1,127 +0,0 @@ - - - 4.0.0 - - org.geysermc - bootstrap-parent - 2.0.1-SNAPSHOT - - bootstrap-spigot - - - - papermc - https://papermc.io/repo/repository/maven-public/ - - - viaversion-repo - https://repo.viaversion.com - - - - - - org.geysermc - core - 2.0.1-SNAPSHOT - compile - - - io.papermc.paper - paper-api - 1.18.1-R0.1-SNAPSHOT - provided - - - com.viaversion - viaversion - 4.0.0 - provided - - - org.geysermc.geyser.adapters - spigot-all - 1.3-SNAPSHOT - - - - ${outputName}-Spigot - - - src/main/resources/ - true - - - - - org.apache.maven.plugins - maven-jar-plugin - 3.2.0 - - - - org.geysermc.geyser.platform.spigot.GeyserSpigotMain - - - - - - org.apache.maven.plugins - maven-shade-plugin - 3.3.0-SNAPSHOT - - - package - - shade - - - - - it.unimi.dsi.fastutil - org.geysermc.geyser.platform.spigot.shaded.fastutil - - - com.fasterxml.jackson - org.geysermc.geyser.platform.spigot.shaded.jackson - - - net.kyori - org.geysermc.geyser.platform.spigot.shaded.kyori - - - org.objectweb.asm - org.geysermc.geyser.platform.spigot.shaded.asm - - - - - - - - - com.google.*:* - org.yaml:* - - - io.netty:netty-transport-native-epoll:* - io.netty:netty-transport-native-unix-common:* - io.netty:netty-transport-native-kqueue:* - io.netty:netty-handler:* - io.netty:netty-common:* - io.netty:netty-buffer:* - io.netty:netty-resolver:* - io.netty:netty-transport:* - io.netty:netty-codec:* - io.netty:netty-codec-dns:* - io.netty:netty-resolver-dns:* - io.netty:netty-resolver-dns-native-macos:* - - - - - - - \ No newline at end of file diff --git a/bootstrap/spigot/src/main/resources/plugin.yml b/bootstrap/spigot/src/main/resources/plugin.yml index 88b2ea1a1..27f51acd1 100644 --- a/bootstrap/spigot/src/main/resources/plugin.yml +++ b/bootstrap/spigot/src/main/resources/plugin.yml @@ -1,8 +1,8 @@ main: org.geysermc.geyser.platform.spigot.GeyserSpigotPlugin -name: ${outputName}-Spigot -author: ${project.organization.name} -website: ${project.organization.url} -version: ${project.version} +name: ${name}-Spigot +author: ${author} +website: ${url} +version: ${version} softdepend: ["ViaVersion", "floodgate"] api-version: 1.13 commands: diff --git a/bootstrap/sponge/build.gradle.kts b/bootstrap/sponge/build.gradle.kts new file mode 100644 index 000000000..2850b2c5e --- /dev/null +++ b/bootstrap/sponge/build.gradle.kts @@ -0,0 +1,36 @@ +val spongeVersion = "7.1.0" + +dependencies { + api(projects.core) +} + +platformRelocate("com.fasterxml.jackson") +platformRelocate("io.netty") +platformRelocate("it.unimi.dsi.fastutil") +platformRelocate("com.google.common") +platformRelocate("com.google.guava") +platformRelocate("net.kyori") + +// Exclude these dependencies +exclude("com.google.code.gson:*") +exclude("org.yaml:*") +exclude("org.slf4j:*") +exclude("org.ow2.asm:*") + +// These dependencies are already present on the platform +provided("org.spongepowered", "spongeapi", spongeVersion) + +application { + mainClass.set("org.geysermc.geyser.platform.sponge.GeyserSpongeMain") +} + +tasks.withType { + archiveBaseName.set("Geyser-Sponge") + + dependencies { + exclude(dependency("com.google.code.gson:.*")) + exclude(dependency("org.yaml:.*")) + exclude(dependency("org.slf4j:.*")) + exclude(dependency("org.ow2.asm:.*")) + } +} \ No newline at end of file diff --git a/bootstrap/sponge/pom.xml b/bootstrap/sponge/pom.xml deleted file mode 100644 index ab3b7d970..000000000 --- a/bootstrap/sponge/pom.xml +++ /dev/null @@ -1,101 +0,0 @@ - - - 4.0.0 - - org.geysermc - bootstrap-parent - 2.0.1-SNAPSHOT - - bootstrap-sponge - - - - org.geysermc - core - 2.0.1-SNAPSHOT - compile - - - org.spongepowered - spongeapi - 7.1.0 - provided - - - - ${outputName}-Sponge - - - src/main/resources/ - true - - - - - org.apache.maven.plugins - maven-jar-plugin - 3.2.0 - - - - org.geysermc.geyser.platform.sponge.GeyserSpongeMain - - - - - - org.apache.maven.plugins - maven-shade-plugin - 3.3.0-SNAPSHOT - - - package - - shade - - - - - com.fasterxml.jackson - org.geysermc.geyser.platform.sponge.shaded.jackson - - - io.netty - org.geysermc.geyser.platform.sponge.shaded.netty - - - it.unimi.dsi.fastutil - org.geysermc.geyser.platform.sponge.shaded.fastutil - - - com.google.common - org.geysermc.geyser.platform.sponge.shaded.google.common - - - com.google.guava - org.geysermc.geyser.platform.sponge.shaded.google.guava - - - net.kyori - org.geysermc.geyser.platform.sponge.shaded.kyori - - - - - - - - - com.google.code.gson:* - org.yaml:* - org.slf4j:* - org.ow2.asm:* - - - - - - - \ No newline at end of file diff --git a/bootstrap/standalone/build.gradle.kts b/bootstrap/standalone/build.gradle.kts new file mode 100644 index 000000000..977a4a7a6 --- /dev/null +++ b/bootstrap/standalone/build.gradle.kts @@ -0,0 +1,33 @@ +import com.github.jengelman.gradle.plugins.shadow.transformers.Log4j2PluginsCacheFileTransformer + +val terminalConsoleVersion = "1.2.0" +val jlineVersion = "3.20.0" + +dependencies { + api(projects.core) + + implementation("net.minecrell", "terminalconsoleappender", terminalConsoleVersion) { + exclude("org.apache.logging.log4j", "log4j-core") + exclude("org.jline", "jline-reader") + exclude("org.jline", "jline-terminal") + exclude("org.jline", "jline-terminal-jna") + } + + implementation("org.jline", "jline-terminal", jlineVersion) + implementation("org.jline", "jline-terminal-jna", jlineVersion) + implementation("org.jline", "jline-reader", jlineVersion) + + implementation("org.apache.logging.log4j", "log4j-api", Versions.log4jVersion) + implementation("org.apache.logging.log4j", "log4j-core", Versions.log4jVersion) + implementation("org.apache.logging.log4j", "log4j-slf4j18-impl", Versions.log4jVersion) +} + +application { + mainClass.set("org.geysermc.geyser.platform.standalone.GeyserStandaloneBootstrap") +} + +tasks.withType { + archiveBaseName.set("Geyser") + + transform(Log4j2PluginsCacheFileTransformer()) +} \ No newline at end of file diff --git a/bootstrap/standalone/pom.xml b/bootstrap/standalone/pom.xml deleted file mode 100644 index 881c87e6c..000000000 --- a/bootstrap/standalone/pom.xml +++ /dev/null @@ -1,140 +0,0 @@ - - - 4.0.0 - - org.geysermc - bootstrap-parent - 2.0.1-SNAPSHOT - - bootstrap-standalone - - - 2.17.1 - - - - - org.geysermc - core - 2.0.1-SNAPSHOT - compile - - - net.minecrell - terminalconsoleappender - 1.2.0 - - - org.apache.logging.log4j - log4j-core - - - org.jline - jline-reader - - - org.jline - jline-terminal-jna - - - org.jline - jline-terminal - - - - - org.jline - jline-terminal - 3.20.0 - - - org.jline - jline-terminal-jna - 3.20.0 - - - org.jline - jline-reader - 3.20.0 - - - org.apache.logging.log4j - log4j-api - ${log4j.version} - - - org.apache.logging.log4j - log4j-core - ${log4j.version} - - - org.apache.logging.log4j - log4j-slf4j18-impl - ${log4j.version} - - - - ${outputName} - - - org.apache.maven.plugins - maven-jar-plugin - 3.2.0 - - - - org.geysermc.geyser.platform.standalone.GeyserStandaloneBootstrap - - - - - - org.apache.maven.plugins - maven-shade-plugin - 3.3.0-SNAPSHOT - - - com.github.edwgiz - maven-shade-plugin.log4j2-cachefile-transformer - 2.8.1 - - - - - package - - shade - - - false - - - - - - - *:* - - META-INF/versions/9/module-info.class - - - - - - org.geysermc.geyser.platform.standalone.GeyserStandaloneBootstrap - - true - - - - - - ${project.build.directory}/dependency-reduced-pom.xml - - - - - diff --git a/bootstrap/standalone/src/main/java/org/geysermc/geyser/platform/standalone/GeyserStandaloneBootstrap.java b/bootstrap/standalone/src/main/java/org/geysermc/geyser/platform/standalone/GeyserStandaloneBootstrap.java index ca41d3c1d..9869fa478 100644 --- a/bootstrap/standalone/src/main/java/org/geysermc/geyser/platform/standalone/GeyserStandaloneBootstrap.java +++ b/bootstrap/standalone/src/main/java/org/geysermc/geyser/platform/standalone/GeyserStandaloneBootstrap.java @@ -38,6 +38,7 @@ import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.core.Appender; import org.apache.logging.log4j.core.Logger; import org.apache.logging.log4j.core.appender.ConsoleAppender; +import org.apache.logging.log4j.core.appender.RollingRandomAccessFileAppender; import org.geysermc.common.PlatformType; import org.geysermc.geyser.GeyserImpl; import org.geysermc.geyser.GeyserBootstrap; @@ -179,6 +180,7 @@ public class GeyserStandaloneBootstrap implements GeyserBootstrap { logger.removeAppender(appender); } } + if (useGui && gui == null) { gui = new GeyserStandaloneGUI(); gui.redirectSystemStreams(); diff --git a/bootstrap/standalone/src/main/java/org/geysermc/geyser/platform/standalone/GeyserStandaloneLogger.java b/bootstrap/standalone/src/main/java/org/geysermc/geyser/platform/standalone/GeyserStandaloneLogger.java index f7ce6d052..31b395a61 100644 --- a/bootstrap/standalone/src/main/java/org/geysermc/geyser/platform/standalone/GeyserStandaloneLogger.java +++ b/bootstrap/standalone/src/main/java/org/geysermc/geyser/platform/standalone/GeyserStandaloneLogger.java @@ -25,7 +25,7 @@ package org.geysermc.geyser.platform.standalone; -import lombok.extern.log4j.Log4j2; +import lombok.extern.slf4j.Slf4j; import net.minecrell.terminalconsole.SimpleTerminalConsole; import org.apache.logging.log4j.Level; import org.apache.logging.log4j.core.config.Configurator; @@ -34,7 +34,7 @@ import org.geysermc.geyser.GeyserLogger; import org.geysermc.geyser.command.GeyserCommandSource; import org.geysermc.geyser.text.ChatColor; -@Log4j2 +@Slf4j public class GeyserStandaloneLogger extends SimpleTerminalConsole implements GeyserLogger, GeyserCommandSource { @Override @@ -54,12 +54,12 @@ public class GeyserStandaloneLogger extends SimpleTerminalConsole implements Gey @Override public void severe(String message) { - log.fatal(ChatColor.DARK_RED + message); + log.error(ChatColor.DARK_RED + message); } @Override public void severe(String message, Throwable error) { - log.fatal(ChatColor.DARK_RED + message, error); + log.error(ChatColor.DARK_RED + message, error); } @Override diff --git a/bootstrap/standalone/src/main/resources/log4j2.xml b/bootstrap/standalone/src/main/resources/log4j2.xml index cd101f306..0738acdcd 100644 --- a/bootstrap/standalone/src/main/resources/log4j2.xml +++ b/bootstrap/standalone/src/main/resources/log4j2.xml @@ -16,7 +16,7 @@ - + diff --git a/bootstrap/velocity/build.gradle.kts b/bootstrap/velocity/build.gradle.kts new file mode 100644 index 000000000..f9fcafb2c --- /dev/null +++ b/bootstrap/velocity/build.gradle.kts @@ -0,0 +1,68 @@ +val velocityVersion = "3.0.0" + +dependencies { + api(projects.core) +} + +platformRelocate("com.fasterxml.jackson") +platformRelocate("it.unimi.fastutil") +platformRelocate("net.kyori.adventure.text.serializer.gson.legacyimpl") + +exclude("com.google.*:*") + +// Needed because Velocity provides every dependency except netty-resolver-dns +exclude("io.netty:netty-transport-native-epoll:*") +exclude("io.netty:netty-transport-native-unix-common:*") +exclude("io.netty:netty-transport-native-kqueue:*") +exclude("io.netty:netty-handler:*") +exclude("io.netty:netty-common:*") +exclude("io.netty:netty-buffer:*") +exclude("io.netty:netty-resolver:*") +exclude("io.netty:netty-transport:*") +exclude("io.netty:netty-codec:*") +exclude("io.netty:netty-codec-haproxy:*") +exclude("org.slf4j:*") +exclude("org.ow2.asm:*") + +// Exclude all Kyori dependencies except the legacy NBT serializer +exclude("net.kyori:adventure-api:*") +exclude("net.kyori:examination-api:*") +exclude("net.kyori:examination-string:*") +exclude("net.kyori:adventure-text-serializer-gson:*") +exclude("net.kyori:adventure-text-serializer-legacy:*") +exclude("net.kyori:adventure-nbt:*") + +// These dependencies are already present on the platform +provided("com.velocitypowered", "velocity-api", velocityVersion) + +application { + mainClass.set("org.geysermc.geyser.platform.velocity.GeyserVelocityMain") +} + +tasks.withType { + archiveBaseName.set("Geyser-Velocity") + + dependencies { + exclude(dependency("com.google.*:.*")) + // Needed because Velocity provides every dependency except netty-resolver-dns + exclude(dependency("io.netty:netty-transport-native-epoll:.*")) + exclude(dependency("io.netty:netty-transport-native-unix-common:.*")) + exclude(dependency("io.netty:netty-transport-native-kqueue:.*")) + exclude(dependency("io.netty:netty-handler:.*")) + exclude(dependency("io.netty:netty-common:.*")) + exclude(dependency("io.netty:netty-buffer:.*")) + exclude(dependency("io.netty:netty-resolver:.*")) + exclude(dependency("io.netty:netty-transport:.*")) + exclude(dependency("io.netty:netty-codec:.*")) + exclude(dependency("io.netty:netty-codec-haproxy:.*")) + exclude(dependency("org.slf4j:.*")) + exclude(dependency("org.ow2.asm:.*")) + // Exclude all Kyori dependencies except the legacy NBT serializer + exclude(dependency("net.kyori:adventure-api:.*")) + exclude(dependency("net.kyori:examination-api:.*")) + exclude(dependency("net.kyori:examination-string:.*")) + exclude(dependency("net.kyori:adventure-text-serializer-gson:.*")) + exclude(dependency("net.kyori:adventure-text-serializer-legacy:.*")) + exclude(dependency("net.kyori:adventure-nbt:.*")) + } +} \ No newline at end of file diff --git a/bootstrap/velocity/pom.xml b/bootstrap/velocity/pom.xml deleted file mode 100644 index ff052471d..000000000 --- a/bootstrap/velocity/pom.xml +++ /dev/null @@ -1,106 +0,0 @@ - - - 4.0.0 - - org.geysermc - bootstrap-parent - 2.0.1-SNAPSHOT - - bootstrap-velocity - - - - org.geysermc - core - 2.0.1-SNAPSHOT - compile - - - com.velocitypowered - velocity-api - 3.0.0 - provided - - - - ${outputName}-Velocity - - - src/main/resources/ - true - - - - - org.apache.maven.plugins - maven-jar-plugin - 3.2.0 - - - - org.geysermc.geyser.platform.velocity.GeyserVelocityMain - - - - - - org.apache.maven.plugins - maven-shade-plugin - 3.3.0-SNAPSHOT - - - package - - shade - - - - - com.fasterxml.jackson - org.geysermc.geyser.platform.velocity.shaded.jackson - - - it.unimi.dsi.fastutil - org.geysermc.geyser.platform.velocity.shaded.fastutil - - - net.kyori.adventure.text.serializer.gson.legacyimpl - org.geysermc.geyser.platform.velocity.shaded.kyori.legacyimpl - - - - - - - - - com.google.*:* - - io.netty:netty-transport-native-epoll:* - io.netty:netty-transport-native-unix-common:* - io.netty:netty-transport-native-kqueue:* - io.netty:netty-handler:* - io.netty:netty-common:* - io.netty:netty-buffer:* - io.netty:netty-resolver:* - io.netty:netty-transport:* - io.netty:netty-codec:* - io.netty:netty-codec-haproxy:* - org.slf4j:* - org.ow2.asm:* - - net.kyori:adventure-api:* - net.kyori:examination-api:* - net.kyori:examination-string:* - net.kyori:adventure-text-serializer-gson:* - net.kyori:adventure-text-serializer-legacy:* - net.kyori:adventure-nbt:* - - - - - - - \ No newline at end of file diff --git a/build-logic/build.gradle.kts b/build-logic/build.gradle.kts new file mode 100644 index 000000000..25cbfe9de --- /dev/null +++ b/build-logic/build.gradle.kts @@ -0,0 +1,21 @@ +import org.jetbrains.kotlin.gradle.tasks.KotlinCompile + +plugins { + `kotlin-dsl` +} + +repositories { + gradlePluginPortal() +} + +dependencies { + implementation("net.kyori", "indra-common", "2.0.6") + implementation("org.jfrog.buildinfo", "build-info-extractor-gradle", "4.26.1") + implementation("gradle.plugin.com.github.johnrengelman", "shadow", "7.1.1") +} + +tasks.withType { + kotlinOptions { + jvmTarget = "16" + } +} \ No newline at end of file diff --git a/build-logic/src/main/kotlin/Versions.kt b/build-logic/src/main/kotlin/Versions.kt new file mode 100644 index 000000000..c6348bc65 --- /dev/null +++ b/build-logic/src/main/kotlin/Versions.kt @@ -0,0 +1,44 @@ +/* + * Copyright (c) 2019-2022 GeyserMC. http://geysermc.org + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + * + * @author GeyserMC + * @link https://github.com/GeyserMC/Geyser + */ + +object Versions { + const val jacksonVersion= "2.12.4" + const val fastutilVersion= "8.5.2" + const val nettyVersion= "4.1.66.Final" + const val guavaVersion= "29.0-jre" + const val nbtVersion= "2.1.0" + const val websocketVersion= "1.5.1" + const val protocolVersion= "0cd24c0" + const val raknetVersion= "1.6.28-SNAPSHOT" + const val mcauthlibVersion= "6c99331" + const val mcprotocollibversion= "6a23a780" + const val packetlibVersion= "2.1-SNAPSHOT" + const val adventureVersion= "4.9.3" + const val eventVersion= "3.0.0" + const val junitVersion= "4.13.1" + const val checkerQualVersion= "3.19.0" + const val cumulusVersion = "1.0-SNAPSHOT" + const val log4jVersion = "2.17.1" +} \ No newline at end of file diff --git a/build-logic/src/main/kotlin/extensions.kt b/build-logic/src/main/kotlin/extensions.kt new file mode 100644 index 000000000..a2c90cd1f --- /dev/null +++ b/build-logic/src/main/kotlin/extensions.kt @@ -0,0 +1,79 @@ +/* + * Copyright (c) 2019-2022 GeyserMC. http://geysermc.org + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + * + * @author GeyserMC + * @link https://github.com/GeyserMC/Geyser + */ + +import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar +import net.kyori.indra.git.IndraGitExtension +import org.gradle.api.Project +import org.gradle.api.artifacts.ProjectDependency +import org.gradle.kotlin.dsl.named +import org.gradle.kotlin.dsl.the + +fun Project.lastCommitHash(): String? = + the().commit()?.name?.substring(0, 7) + +// retrieved from https://wiki.jenkins-ci.org/display/JENKINS/Building+a+software+project +// some properties might be specific to Jenkins +fun Project.branchName(): String = + System.getProperty("GIT_BRANCH", "local/dev") +fun Project.commitHashAbbrev(): String = + System.getProperty("GIT_COMMIT", "0000000") +fun Project.versionName(): String = + System.getProperty("GIT_VERSION", "local/dev") +fun Project.buildNumber(): Int = + Integer.parseInt(System.getProperty("BUILD_NUMBER", "-1")) + +fun Project.relocate(pattern: String) { + tasks.named("shadowJar") { + relocate(pattern, "org.geysermc.geyser.shaded.$pattern") + } +} + +fun Project.exclude(group: String) { + tasks.named("shadowJar") { + exclude(group) + } +} + +fun Project.platformRelocate(pattern: String) { + tasks.named("shadowJar") { + relocate(pattern, "org.geysermc.geyser.platform.${project.name}.shaded.$pattern") + } +} + +val providedDependencies = mutableMapOf>() + +fun Project.provided(pattern: String, name: String, version: String, excludedOn: Int = 0b110) { + providedDependencies.getOrPut(project.name) { mutableSetOf() } + .add("${calcExclusion(pattern, 0b100, excludedOn)}:" + + "${calcExclusion(name, 0b10, excludedOn)}:" + + calcExclusion(version, 0b1, excludedOn)) + dependencies.add("compileOnlyApi", "$pattern:$name:$version") +} + +fun Project.provided(dependency: ProjectDependency) = + provided(dependency.group!!, dependency.name, dependency.version!!) + +private fun calcExclusion(section: String, bit: Int, excludedOn: Int): String = + if (excludedOn and bit > 0) section else "" \ No newline at end of file diff --git a/build-logic/src/main/kotlin/geyser.api-conventions.gradle.kts b/build-logic/src/main/kotlin/geyser.api-conventions.gradle.kts new file mode 100644 index 000000000..0781436c4 --- /dev/null +++ b/build-logic/src/main/kotlin/geyser.api-conventions.gradle.kts @@ -0,0 +1,9 @@ +plugins { + id("geyser.shadow-conventions") +} + +tasks { + shadowJar { + archiveBaseName.set(archiveBaseName.get() + "-api") + } +} \ No newline at end of file diff --git a/build-logic/src/main/kotlin/geyser.base-conventions.gradle.kts b/build-logic/src/main/kotlin/geyser.base-conventions.gradle.kts new file mode 100644 index 000000000..211455d31 --- /dev/null +++ b/build-logic/src/main/kotlin/geyser.base-conventions.gradle.kts @@ -0,0 +1,41 @@ +plugins { + `java-library` + `maven-publish` +} + +dependencies { + compileOnly("org.checkerframework", "checker-qual", Versions.checkerQualVersion) +} + +tasks { + processResources { + filesMatching(listOf("plugin.yml", "bungee.yml", "velocity-plugin.json")) { + expand( + "id" to "Geyser", + "name" to "Geyser", + "version" to project.version, + "description" to project.description, + "url" to "https://geysermc.org", + "author" to "GeyserMC" + ) + } + } + compileJava { + options.encoding = Charsets.UTF_8.name() + } +} + +java { + sourceCompatibility = JavaVersion.VERSION_16 + targetCompatibility = JavaVersion.VERSION_16 + + withSourcesJar() +} + +publishing { + publications.create("mavenJava") { + groupId = project.group as String + artifactId = project.name + version = project.version as String + } +} \ No newline at end of file diff --git a/build-logic/src/main/kotlin/geyser.build-logic.gradle.kts b/build-logic/src/main/kotlin/geyser.build-logic.gradle.kts new file mode 100644 index 000000000..e69de29bb diff --git a/build-logic/src/main/kotlin/geyser.platform-conventions.gradle.kts b/build-logic/src/main/kotlin/geyser.platform-conventions.gradle.kts new file mode 100644 index 000000000..07968f231 --- /dev/null +++ b/build-logic/src/main/kotlin/geyser.platform-conventions.gradle.kts @@ -0,0 +1,4 @@ +plugins { + application + id("geyser.shadow-conventions") +} \ No newline at end of file diff --git a/build-logic/src/main/kotlin/geyser.shadow-conventions.gradle.kts b/build-logic/src/main/kotlin/geyser.shadow-conventions.gradle.kts new file mode 100644 index 000000000..ddd427897 --- /dev/null +++ b/build-logic/src/main/kotlin/geyser.shadow-conventions.gradle.kts @@ -0,0 +1,55 @@ +import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar + +plugins { + id("geyser.base-conventions") + id("com.github.johnrengelman.shadow") + id("com.jfrog.artifactory") +} + +tasks { + named("jar") { + archiveClassifier.set("unshaded") + from(project.rootProject.file("LICENSE")) + } + val shadowJar = named("shadowJar") { + archiveBaseName.set(project.name) + archiveVersion.set("") + archiveClassifier.set("") + + val sJar: ShadowJar = this + + doFirst { + providedDependencies[project.name]?.forEach { string -> + sJar.dependencies { + println("Excluding $string from ${project.name}") + exclude(dependency(string)) + } + } + } + } + named("build") { + dependsOn(shadowJar) + } +} + +publishing { + publications.named("mavenJava") { + artifact(tasks["shadowJar"]) + artifact(tasks["sourcesJar"]) + } +} + +artifactory { + publish { + repository { + setRepoKey("maven-snapshots") + setMavenCompatible(true) + } + defaults { + publishConfigs("archives") + setPublishArtifacts(true) + setPublishPom(true) + setPublishIvy(false) + } + } +} \ No newline at end of file diff --git a/build.gradle.kts b/build.gradle.kts new file mode 100644 index 000000000..573687c7f --- /dev/null +++ b/build.gradle.kts @@ -0,0 +1,43 @@ +plugins { + `java-library` + id("geyser.build-logic") + id("io.freefair.lombok") version "6.3.0" apply false +} + +allprojects { + group = "org.geysermc" + version = "2.1.0-SNAPSHOT" + description = "Allows for players from Minecraft: Bedrock Edition to join Minecraft: Java Edition servers." +} + +val platforms = setOf( + projects.bungeecord, + projects.spigot, + projects.sponge, + projects.standalone, + projects.velocity +).map { it.dependencyProject } + +val api: Project = projects.api.dependencyProject + +subprojects { + apply { + plugin("java-library") + plugin("io.freefair.lombok") + plugin("geyser.build-logic") + } + + val relativePath = projectDir.relativeTo(rootProject.projectDir).path + + if (relativePath.contains("api")) { + group = rootProject.group as String + ".api" + plugins.apply("geyser.api-conventions") + } else { + group = rootProject.group as String + ".geyser" + when (this) { + in platforms -> plugins.apply("geyser.platform-conventions") + api -> plugins.apply("geyser.shadow-conventions") + else -> plugins.apply("geyser.base-conventions") + } + } +} \ No newline at end of file diff --git a/common/build.gradle.kts b/common/build.gradle.kts new file mode 100644 index 000000000..205b20c0e --- /dev/null +++ b/common/build.gradle.kts @@ -0,0 +1,3 @@ +dependencies { + api("org.geysermc.cumulus", "cumulus", Versions.cumulusVersion) +} \ No newline at end of file diff --git a/common/pom.xml b/common/pom.xml deleted file mode 100644 index fde2605bc..000000000 --- a/common/pom.xml +++ /dev/null @@ -1,31 +0,0 @@ - - - 4.0.0 - - org.geysermc - geyser-parent - 2.0.1-SNAPSHOT - - common - - - - 8 - 8 - - - - - org.geysermc.cumulus - cumulus - 1.0-SNAPSHOT - - - com.google.code.gson - gson - 2.8.6 - - - \ No newline at end of file diff --git a/core/build.gradle.kts b/core/build.gradle.kts new file mode 100644 index 000000000..0a1883bc4 --- /dev/null +++ b/core/build.gradle.kts @@ -0,0 +1,86 @@ +import net.kyori.blossom.BlossomExtension + +plugins { + id("net.kyori.blossom") +} + +dependencies { + api(projects.geyserApi) + api(projects.common) + + // Jackson JSON and YAML serialization + api("com.fasterxml.jackson.core", "jackson-annotations", Versions.jacksonVersion) + api("com.fasterxml.jackson.core", "jackson-databind", Versions.jacksonVersion) + api("com.fasterxml.jackson.dataformat", "jackson-dataformat-yaml", Versions.jacksonVersion) + api("com.google.guava", "guava", Versions.guavaVersion) + + api("com.nukkitx", "nbt", Versions.nbtVersion) + + // Fastutil Maps + implementation("com.nukkitx.fastutil", "fastutil-int-int-maps", Versions.fastutilVersion) + implementation("com.nukkitx.fastutil", "fastutil-int-long-maps", Versions.fastutilVersion) + implementation("com.nukkitx.fastutil", "fastutil-int-byte-maps", Versions.fastutilVersion) + implementation("com.nukkitx.fastutil", "fastutil-int-boolean-maps", Versions.fastutilVersion) + implementation("com.nukkitx.fastutil", "fastutil-object-int-maps", Versions.fastutilVersion) + implementation("com.nukkitx.fastutil", "fastutil-object-object-maps", Versions.fastutilVersion) + + // Network libraries + implementation("org.java-websocket", "Java-WebSocket", Versions.websocketVersion) + + api("com.github.CloudburstMC.Protocol", "bedrock-v486", Versions.protocolVersion) { + exclude("com.nukkitx.network", "raknet") + exclude("com.nukkitx", "nbt") + } + + api("com.github.RednedEpic", "MCAuthLib", Versions.mcauthlibVersion) + api("com.github.GeyserMC", "MCProtocolLib", Versions.mcprotocollibversion) { + exclude("com.github.steveice10", "packetlib") + exclude("com.github.steveice10", "mcauthlib") + } + + api("com.github.steveice10", "packetlib", Versions.packetlibVersion) { + exclude("io.netty", "netty-all") + // This is still experimental - additionally, it could only really benefit standalone + exclude("io.netty.incubator", "netty-incubator-transport-native-io_uring") + } + + implementation("com.nukkitx.network", "raknet", Versions.raknetVersion) { + exclude("io.netty", "*"); + } + + implementation("io.netty", "netty-resolver-dns", Versions.nettyVersion) + implementation("io.netty", "netty-resolver-dns-native-macos", Versions.nettyVersion, null, "osx-x86_64") + implementation("io.netty", "netty-codec-haproxy", Versions.nettyVersion) + + // Network dependencies we are updating ourselves + api("io.netty", "netty-handler", Versions.nettyVersion) + + implementation("io.netty", "netty-transport-native-epoll", Versions.nettyVersion, null, "linux-x86_64") + implementation("io.netty", "netty-transport-native-epoll", Versions.nettyVersion, null, "linux-aarch_64") + implementation("io.netty", "netty-transport-native-kqueue", Versions.nettyVersion, null, "osx-x86_64") + + // Adventure text serialization + implementation("net.kyori", "adventure-text-serializer-legacy", Versions.adventureVersion) + implementation("net.kyori", "adventure-text-serializer-plain", Versions.adventureVersion) + + // Kyori Misc + implementation("net.kyori", "event-api", Versions.eventVersion) + + // Test + testImplementation("junit", "junit", Versions.junitVersion) + + // Annotation Processors + annotationProcessor(projects.ap) +} + +provided(projects.ap) + +configure { + val mainFile = "src/main/java/org/geysermc/geyser/GeyserImpl.java" + val gitVersion = "git-${branchName()}-${commitHashAbbrev()}" + + replaceToken("\${version}", "${project.version} ($gitVersion)", mainFile) + replaceToken("\${gitVersion}", gitVersion, mainFile) + replaceToken("\${buildNumber}", buildNumber(), mainFile) + replaceToken("\${branch}", branchName(), mainFile) +} \ No newline at end of file diff --git a/core/pom.xml b/core/pom.xml deleted file mode 100644 index 31f9a075f..000000000 --- a/core/pom.xml +++ /dev/null @@ -1,374 +0,0 @@ - - - 4.0.0 - - org.geysermc - geyser-parent - 2.0.1-SNAPSHOT - - core - - - 8.5.2 - 2.12.4 - 4.1.66.Final - - - - - org.geysermc - ap - 2.0.1-SNAPSHOT - provided - - - org.geysermc - geyser-api - 2.0.1-SNAPSHOT - compile - - - org.geysermc - common - 2.0.1-SNAPSHOT - compile - - - - com.fasterxml.jackson.core - jackson-annotations - ${jackson.version} - compile - - - com.fasterxml.jackson.core - jackson-core - ${jackson.version} - compile - - - com.fasterxml.jackson.core - jackson-databind - ${jackson.version} - compile - - - com.fasterxml.jackson.dataformat - jackson-dataformat-yaml - ${jackson.version} - compile - - - com.google.guava - guava - 29.0-jre - compile - - - - com.nukkitx - nbt - - 2.1.0 - compile - - - com.nukkitx.fastutil - fastutil-int-int-maps - ${fastutil.version} - compile - - - com.nukkitx.fastutil - fastutil-int-long-maps - ${fastutil.version} - compile - - - com.nukkitx.fastutil - fastutil-int-byte-maps - ${fastutil.version} - compile - - - com.nukkitx.fastutil - fastutil-int-boolean-maps - ${fastutil.version} - compile - - - com.nukkitx.fastutil - fastutil-object-int-maps - ${fastutil.version} - compile - - - com.nukkitx.fastutil - fastutil-object-object-maps - ${fastutil.version} - compile - - - - org.java-websocket - Java-WebSocket - 1.5.1 - compile - - - com.github.CloudburstMC.Protocol - bedrock-v486 - 0cd24c0 - compile - - - com.nukkitx.network - raknet - - - com.nukkitx - nbt - - - - - com.nukkitx.network - raknet - 1.6.28-20211202.034102-5 - compile - - - io.netty - * - - - - - com.github.RednedEpic - MCAuthLib - 6c99331 - compile - - - com.github.GeyserMC - MCProtocolLib - 6a23a780 - compile - - - com.github.steveice10 - packetlib - - - com.github.steveice10 - mcauthlib - - - - - com.github.steveice10 - packetlib - 2.1-SNAPSHOT - compile - - - io.netty - netty-all - - - - io.netty.incubator - netty-incubator-transport-native-io_uring - - - - - io.netty - netty-resolver-dns - ${netty.version} - compile - - - io.netty - netty-resolver-dns-native-macos - ${netty.version} - compile - osx-x86_64 - - - io.netty - netty-codec-haproxy - ${netty.version} - compile - - - - io.netty - netty-handler - ${netty.version} - compile - - - io.netty - netty-transport-native-epoll - ${netty.version} - compile - linux-x86_64 - - - io.netty - netty-transport-native-epoll - ${netty.version} - compile - linux-aarch_64 - - - io.netty - netty-transport-native-kqueue - ${netty.version} - compile - osx-x86_64 - - - - net.kyori - adventure-text-serializer-legacy - ${adventure.version} - compile - - - net.kyori - adventure-text-serializer-plain - ${adventure.version} - compile - - - - net.kyori - event-api - 3.0.0 - compile - - - - junit - junit - 4.13.1 - test - - - - - - - org.apache.maven.plugins - maven-jar-plugin - 3.2.0 - - - **/services/javax.annotation.processing.Processor - - - - - pl.project13.maven - git-commit-id-plugin - 4.0.0 - - - get-the-git-infos - - revision - - - - - true - ${project.build.outputDirectory}/git.properties - properties - false - false - false - true - false - - git.user.* - git.*.user.* - git.closest.* - git.commit.id.describe - git.commit.id.describe-short - git.commit.message.short - - flat - - true - - - - - com.google.code.maven-replacer-plugin - replacer - 1.5.3 - - - add-version - process-sources - - replace - - - - ${project.basedir}/src/main/java/org/geysermc/geyser/GeyserImpl.java - - - - String VERSION = ".*" - String VERSION = "${project.version} (" + GIT_VERSION + ")" - - - String GIT_VERSION = ".*" - - String GIT_VERSION = "git-${git.branch}-${git.commit.id.abbrev}" - - - - - - - remove-version - process-classes - - replace - - - - ${project.basedir}/src/main/java/org/geysermc/geyser/GeyserImpl.java - - - - String VERSION = ".*" - String VERSION = "DEV" - - - String GIT_VERSION = ".*" - String GIT_VERSION = "DEV" - - - - - - - - org.apache.maven.plugins - maven-surefire-plugin - 2.22.0 - - - -Dfile.encoding=${project.build.sourceEncoding} - - - - - diff --git a/core/src/main/java/org/geysermc/connector/GeyserConnector.java b/core/src/main/java/org/geysermc/connector/GeyserConnector.java index b3307a134..d9ff694bd 100644 --- a/core/src/main/java/org/geysermc/connector/GeyserConnector.java +++ b/core/src/main/java/org/geysermc/connector/GeyserConnector.java @@ -91,6 +91,6 @@ public class GeyserConnector { } public boolean isProductionEnvironment() { - return GeyserImpl.getInstance().productionEnvironment(); + return GeyserImpl.getInstance().isProductionEnvironment(); } } diff --git a/core/src/main/java/org/geysermc/geyser/GeyserImpl.java b/core/src/main/java/org/geysermc/geyser/GeyserImpl.java index 68bb69b46..681b38449 100644 --- a/core/src/main/java/org/geysermc/geyser/GeyserImpl.java +++ b/core/src/main/java/org/geysermc/geyser/GeyserImpl.java @@ -99,8 +99,11 @@ public class GeyserImpl implements GeyserApi { .enable(JsonParser.Feature.ALLOW_SINGLE_QUOTES); public static final String NAME = "Geyser"; - public static final String GIT_VERSION = "DEV"; // A fallback for running in IDEs - public static final String VERSION = "DEV"; // A fallback for running in IDEs + public static final String GIT_VERSION = "${gitVersion}"; // A fallback for running in IDEs + public static final String VERSION = "${version}"; // A fallback for running in IDEs + + public static final int BUILD_NUMBER = Integer.parseInt("${buildNumber}"); + public static final String BRANCH = "${branch}"; /** * Oauth client ID for Microsoft authentication @@ -268,25 +271,7 @@ public class GeyserImpl implements GeyserApi { } } - String branch = "unknown"; - int buildNumber = -1; - if (this.productionEnvironment()) { - try (InputStream stream = bootstrap.getResource("git.properties")) { - Properties gitProperties = new Properties(); - gitProperties.load(stream); - branch = gitProperties.getProperty("git.branch"); - String build = gitProperties.getProperty("git.build.number"); - if (build != null) { - buildNumber = Integer.parseInt(build); - } - } catch (Throwable e) { - logger.error("Failed to read git.properties", e); - } - } else { - logger.debug("Not getting git properties for the news handler as we are in a development environment."); - } - - this.newsHandler = new NewsHandler(branch, buildNumber); + this.newsHandler = new NewsHandler(BRANCH, BUILD_NUMBER); CooldownUtils.setDefaultShowCooldown(config.getShowCooldown()); DimensionUtils.changeBedrockNetherId(config.isAboveBedrockNetherBuilding()); // Apply End dimension ID workaround to Nether @@ -499,9 +484,9 @@ public class GeyserImpl implements GeyserApi { * @return true if the version number is not 'DEV'. */ @Override - public boolean productionEnvironment() { - //noinspection ConstantConditions - changes in production - return !"DEV".equals(GeyserImpl.VERSION); + public boolean isProductionEnvironment() { + // noinspection ConstantConditions - changes in production + return !"git-local/dev-0000000".equals(GeyserImpl.GIT_VERSION); } @Override diff --git a/core/src/main/java/org/geysermc/geyser/command/defaults/VersionCommand.java b/core/src/main/java/org/geysermc/geyser/command/defaults/VersionCommand.java index 89bea3343..6dd2a4c41 100644 --- a/core/src/main/java/org/geysermc/geyser/command/defaults/VersionCommand.java +++ b/core/src/main/java/org/geysermc/geyser/command/defaults/VersionCommand.java @@ -74,17 +74,14 @@ public class VersionCommand extends GeyserCommand { GeyserImpl.NAME, GeyserImpl.VERSION, javaVersions, bedrockVersions)); // Disable update checking in dev mode and for players in Geyser Standalone - if (GeyserImpl.getInstance().productionEnvironment() && !(!sender.isConsole() && geyser.getPlatformType() == PlatformType.STANDALONE)) { + if (GeyserImpl.getInstance().isProductionEnvironment() && !(!sender.isConsole() && geyser.getPlatformType() == PlatformType.STANDALONE)) { sender.sendMessage(GeyserLocale.getPlayerLocaleString("geyser.commands.version.checking", sender.locale())); - try (InputStream stream = GeyserImpl.getInstance().getBootstrap().getResource("git.properties")) { - Properties gitProp = new Properties(); - gitProp.load(stream); - + try { String buildXML = WebUtils.getBody("https://ci.opencollab.dev/job/GeyserMC/job/Geyser/job/" + - URLEncoder.encode(gitProp.getProperty("git.branch"), StandardCharsets.UTF_8.toString()) + "/lastSuccessfulBuild/api/xml?xpath=//buildNumber"); + URLEncoder.encode(GeyserImpl.BRANCH, StandardCharsets.UTF_8.toString()) + "/lastSuccessfulBuild/api/xml?xpath=//buildNumber"); if (buildXML.startsWith("")) { int latestBuildNum = Integer.parseInt(buildXML.replaceAll("<(\\\\)?(/)?buildNumber>", "").trim()); - int buildNum = Integer.parseInt(gitProp.getProperty("git.build.number")); + int buildNum = GeyserImpl.BUILD_NUMBER; if (latestBuildNum == buildNum) { sender.sendMessage(GeyserLocale.getPlayerLocaleString("geyser.commands.version.no_updates", sender.locale())); } else { @@ -94,7 +91,7 @@ public class VersionCommand extends GeyserCommand { } else { throw new AssertionError("buildNumber missing"); } - } catch (IOException | AssertionError | NumberFormatException e) { + } catch (IOException e) { GeyserImpl.getInstance().getLogger().error(GeyserLocale.getLocaleStringLog("geyser.commands.version.failed"), e); sender.sendMessage(ChatColor.RED + GeyserLocale.getPlayerLocaleString("geyser.commands.version.failed", sender.locale())); } diff --git a/core/src/main/resources/languages b/core/src/main/resources/languages index 94c185193..cef75b344 160000 --- a/core/src/main/resources/languages +++ b/core/src/main/resources/languages @@ -1 +1 @@ -Subproject commit 94c1851931f2319a7e7f42c2fe9066b78235bc39 +Subproject commit cef75b34461d195d50bfcd274b499bd9d641c5aa diff --git a/gradle.properties b/gradle.properties new file mode 100644 index 000000000..8f6ac8e85 --- /dev/null +++ b/gradle.properties @@ -0,0 +1,6 @@ +group=org.geysermc +version=2.1.0-SNAPSHOT + +org.gradle.caching=true +org.gradle.parallel=true +org.gradle.vfs.watch=false \ No newline at end of file diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 000000000..41dfb8790 --- /dev/null +++ b/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,5 @@ +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-7.4-bin.zip +zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists diff --git a/gradlew b/gradlew new file mode 100644 index 000000000..1b6c78733 --- /dev/null +++ b/gradlew @@ -0,0 +1,234 @@ +#!/bin/sh + +# +# Copyright © 2015-2021 the original authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +############################################################################## +# +# Gradle start up script for POSIX generated by Gradle. +# +# Important for running: +# +# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is +# noncompliant, but you have some other compliant shell such as ksh or +# bash, then to run this script, type that shell name before the whole +# command line, like: +# +# ksh Gradle +# +# Busybox and similar reduced shells will NOT work, because this script +# requires all of these POSIX shell features: +# * functions; +# * expansions «$var», «${var}», «${var:-default}», «${var+SET}», +# «${var#prefix}», «${var%suffix}», and «$( cmd )»; +# * compound commands having a testable exit status, especially «case»; +# * various built-in commands including «command», «set», and «ulimit». +# +# Important for patching: +# +# (2) This script targets any POSIX shell, so it avoids extensions provided +# by Bash, Ksh, etc; in particular arrays are avoided. +# +# The "traditional" practice of packing multiple parameters into a +# space-separated string is a well documented source of bugs and security +# problems, so this is (mostly) avoided, by progressively accumulating +# options in "$@", and eventually passing that to Java. +# +# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS, +# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly; +# see the in-line comments for details. +# +# There are tweaks for specific operating systems such as AIX, CygWin, +# Darwin, MinGW, and NonStop. +# +# (3) This script is generated from the Groovy template +# https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt +# within the Gradle project. +# +# You can find Gradle at https://github.com/gradle/gradle/. +# +############################################################################## + +# Attempt to set APP_HOME + +# Resolve links: $0 may be a link +app_path=$0 + +# Need this for daisy-chained symlinks. +while + APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path + [ -h "$app_path" ] +do + ls=$( ls -ld "$app_path" ) + link=${ls#*' -> '} + case $link in #( + /*) app_path=$link ;; #( + *) app_path=$APP_HOME$link ;; + esac +done + +APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit + +APP_NAME="Gradle" +APP_BASE_NAME=${0##*/} + +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' + +# Use the maximum available, or set MAX_FD != -1 to use that value. +MAX_FD=maximum + +warn () { + echo "$*" +} >&2 + +die () { + echo + echo "$*" + echo + exit 1 +} >&2 + +# OS specific support (must be 'true' or 'false'). +cygwin=false +msys=false +darwin=false +nonstop=false +case "$( uname )" in #( + CYGWIN* ) cygwin=true ;; #( + Darwin* ) darwin=true ;; #( + MSYS* | MINGW* ) msys=true ;; #( + NONSTOP* ) nonstop=true ;; +esac + +CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar + + +# Determine the Java command to use to start the JVM. +if [ -n "$JAVA_HOME" ] ; then + if [ -x "$JAVA_HOME/jre/sh/java" ] ; then + # IBM's JDK on AIX uses strange locations for the executables + JAVACMD=$JAVA_HOME/jre/sh/java + else + JAVACMD=$JAVA_HOME/bin/java + fi + if [ ! -x "$JAVACMD" ] ; then + die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." + fi +else + JAVACMD=java + which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." +fi + +# Increase the maximum file descriptors if we can. +if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then + case $MAX_FD in #( + max*) + MAX_FD=$( ulimit -H -n ) || + warn "Could not query maximum file descriptor limit" + esac + case $MAX_FD in #( + '' | soft) :;; #( + *) + ulimit -n "$MAX_FD" || + warn "Could not set maximum file descriptor limit to $MAX_FD" + esac +fi + +# Collect all arguments for the java command, stacking in reverse order: +# * args from the command line +# * the main class name +# * -classpath +# * -D...appname settings +# * --module-path (only if needed) +# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables. + +# For Cygwin or MSYS, switch paths to Windows format before running java +if "$cygwin" || "$msys" ; then + APP_HOME=$( cygpath --path --mixed "$APP_HOME" ) + CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" ) + + JAVACMD=$( cygpath --unix "$JAVACMD" ) + + # Now convert the arguments - kludge to limit ourselves to /bin/sh + for arg do + if + case $arg in #( + -*) false ;; # don't mess with options #( + /?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath + [ -e "$t" ] ;; #( + *) false ;; + esac + then + arg=$( cygpath --path --ignore --mixed "$arg" ) + fi + # Roll the args list around exactly as many times as the number of + # args, so each arg winds up back in the position where it started, but + # possibly modified. + # + # NB: a `for` loop captures its iteration list before it begins, so + # changing the positional parameters here affects neither the number of + # iterations, nor the values presented in `arg`. + shift # remove old arg + set -- "$@" "$arg" # push replacement arg + done +fi + +# Collect all arguments for the java command; +# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of +# shell script including quotes and variable substitutions, so put them in +# double quotes to make sure that they get re-expanded; and +# * put everything else in single quotes, so that it's not re-expanded. + +set -- \ + "-Dorg.gradle.appname=$APP_BASE_NAME" \ + -classpath "$CLASSPATH" \ + org.gradle.wrapper.GradleWrapperMain \ + "$@" + +# Use "xargs" to parse quoted args. +# +# With -n1 it outputs one arg per line, with the quotes and backslashes removed. +# +# In Bash we could simply go: +# +# readarray ARGS < <( xargs -n1 <<<"$var" ) && +# set -- "${ARGS[@]}" "$@" +# +# but POSIX shell has neither arrays nor command substitution, so instead we +# post-process each arg (as a line of input to sed) to backslash-escape any +# character that might be a shell metacharacter, then use eval to reverse +# that process (while maintaining the separation between arguments), and wrap +# the whole thing up as a single "set" statement. +# +# This will of course break if any of these variables contains a newline or +# an unmatched quote. +# + +eval "set -- $( + printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" | + xargs -n1 | + sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' | + tr '\n' ' ' + )" '"$@"' + +exec "$JAVACMD" "$@" diff --git a/gradlew.bat b/gradlew.bat new file mode 100644 index 000000000..107acd32c --- /dev/null +++ b/gradlew.bat @@ -0,0 +1,89 @@ +@rem +@rem Copyright 2015 the original author or authors. +@rem +@rem Licensed under the Apache License, Version 2.0 (the "License"); +@rem you may not use this file except in compliance with the License. +@rem You may obtain a copy of the License at +@rem +@rem https://www.apache.org/licenses/LICENSE-2.0 +@rem +@rem Unless required by applicable law or agreed to in writing, software +@rem distributed under the License is distributed on an "AS IS" BASIS, +@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +@rem See the License for the specific language governing permissions and +@rem limitations under the License. +@rem + +@if "%DEBUG%" == "" @echo off +@rem ########################################################################## +@rem +@rem Gradle startup script for Windows +@rem +@rem ########################################################################## + +@rem Set local scope for the variables with windows NT shell +if "%OS%"=="Windows_NT" setlocal + +set DIRNAME=%~dp0 +if "%DIRNAME%" == "" set DIRNAME=. +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@rem Resolve any "." and ".." in APP_HOME to make it shorter. +for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi + +@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" + +@rem Find java.exe +if defined JAVA_HOME goto findJavaFromJavaHome + +set JAVA_EXE=java.exe +%JAVA_EXE% -version >NUL 2>&1 +if "%ERRORLEVEL%" == "0" goto execute + +echo. +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto execute + +echo. +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:execute +@rem Setup the command line + +set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar + + +@rem Execute Gradle +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* + +:end +@rem End local scope for the variables with windows NT shell +if "%ERRORLEVEL%"=="0" goto mainEnd + +:fail +rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of +rem the _cmd.exe /c_ return code! +if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 +exit /b 1 + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega diff --git a/pom.xml b/pom.xml deleted file mode 100644 index 191a40704..000000000 --- a/pom.xml +++ /dev/null @@ -1,95 +0,0 @@ - - - 4.0.0 - org.geysermc - geyser-parent - 2.0.1-SNAPSHOT - pom - Geyser - Allows for players from Minecraft Bedrock Edition to join Minecraft Java Edition servers. - https://geysermc.org - - - Geyser - UTF-8 - UTF-8 - 16 - 16 - - 4.9.3 - - - - GeyserMC - https://github.com/GeyserMC/Geyser/blob/master/pom.xml - - - - scm:git:https://github.com/GeyserMC/Geyser.git - scm:git:git@github.com:GeyserMC/Geyser.git - https://github.com/GeyserMC/Geyser - - - - ap - api - bootstrap - common - core - - - - - - apache.snapshots - https://repository.apache.org/snapshots/ - - - - - - - apache.snapshots - https://repository.apache.org/snapshots/ - - - jitpack.io - https://jitpack.io - - - opencollab-release-repo - https://repo.opencollab.dev/maven-releases/ - - true - - - false - - - - opencollab-snapshot-repo - https://repo.opencollab.dev/maven-snapshots/ - - false - - - true - - - - sonatype - https://oss.sonatype.org/content/repositories/snapshots/ - - - - - - org.projectlombok - lombok - 1.18.20 - provided - - - diff --git a/settings.gradle.kts b/settings.gradle.kts new file mode 100644 index 000000000..51c1b479d --- /dev/null +++ b/settings.gradle.kts @@ -0,0 +1,73 @@ +enableFeaturePreview("TYPESAFE_PROJECT_ACCESSORS") + +dependencyResolutionManagement { + repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS) + repositories { + // Floodgate, Cumulus etc. + maven("https://repo.opencollab.dev/maven-releases") { + mavenContent { releasesOnly() } + } + maven("https://repo.opencollab.dev/maven-snapshots") { + mavenContent { snapshotsOnly() } + } + + // Paper, Velocity + maven("https://papermc.io/repo/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() } + } + + // Minecraft + maven("https://libraries.minecraft.net") { + name = "minecraft" + mavenContent { releasesOnly() } + } + + mavenLocal() + mavenCentral() + + maven("https://jitpack.io") { + content { includeGroupByRegex("com\\.github\\..*") } + } + } +} + +pluginManagement { + repositories { + gradlePluginPortal() + } + plugins { + id("net.kyori.blossom") version "1.2.0" + id("net.kyori.indra") + id("net.kyori.indra.git") + } + includeBuild("build-logic") +} + +rootProject.name = "geyser-parent" + +include(":ap") +include(":api") +include(":geyser-api") +include(":bungeecord") +include(":spigot") +include(":sponge") +include(":standalone") +include(":velocity") +include(":common") +include(":core") + +// Specify project dirs +project(":api").projectDir = file("api/base") +project(":geyser-api").projectDir = file("api/geyser") +project(":bungeecord").projectDir = file("bootstrap/bungeecord") +project(":spigot").projectDir = file("bootstrap/spigot") +project(":sponge").projectDir = file("bootstrap/sponge") +project(":standalone").projectDir = file("bootstrap/standalone") +project(":velocity").projectDir = file("bootstrap/velocity") \ No newline at end of file