mirror of
https://github.com/GeyserMC/Floodgate.git
synced 2025-12-19 14:59:20 +00:00
Re-added some git properties and updated Gradle to 7.3.3
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
|
||||
|
||||
plugins {
|
||||
`kotlin-dsl`
|
||||
java
|
||||
}
|
||||
|
||||
repositories {
|
||||
@@ -8,6 +9,13 @@ repositories {
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation("gradle.plugin.com.github.jengelman.gradle.plugins", "shadow", "7.0.0")
|
||||
implementation("org.jfrog.buildinfo", "build-info-extractor-gradle", "4.25.2")
|
||||
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<KotlinCompile> {
|
||||
kotlinOptions {
|
||||
jvmTarget = "1.8"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,9 +24,21 @@
|
||||
*/
|
||||
|
||||
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<IndraGitExtension>().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.buildNumber(): Int =
|
||||
Integer.parseInt(System.getProperty("BUILD_NUMBER", "-1"))
|
||||
|
||||
fun Project.relocate(pattern: String) {
|
||||
tasks.named<ShadowJar>("shadowJar") {
|
||||
@@ -44,10 +56,8 @@ fun Project.provided(pattern: String, name: String, version: String, excludedOn:
|
||||
dependencies.add("compileOnlyApi", "$pattern:$name:$version")
|
||||
}
|
||||
|
||||
fun Project.provided(dependency: ProjectDependency) {
|
||||
fun Project.provided(dependency: ProjectDependency) =
|
||||
provided(dependency.group!!, dependency.name, dependency.version!!)
|
||||
}
|
||||
|
||||
private fun calcExclusion(section: String, bit: Int, excludedOn: Int): String {
|
||||
return if (excludedOn and bit > 0) section else ""
|
||||
}
|
||||
private fun calcExclusion(section: String, bit: Int, excludedOn: Int): String =
|
||||
if (excludedOn and bit > 0) section else ""
|
||||
@@ -1,6 +1,6 @@
|
||||
plugins {
|
||||
`java-library`
|
||||
id("floodgate.build-logic") apply false
|
||||
id("floodgate.build-logic")
|
||||
// id("com.github.spotbugs") version "4.8.0" apply false
|
||||
id("io.freefair.lombok") version "6.3.0" apply false
|
||||
}
|
||||
@@ -17,8 +17,7 @@ val platforms = setOf(
|
||||
projects.velocity
|
||||
).map { it.dependencyProject }
|
||||
|
||||
//todo re-add git properties (or at least build number, branch and commit)
|
||||
// re-add pmd and organisation/license/sdcm/issuemanagement stuff
|
||||
//todo re-add pmd and organisation/license/sdcm/issuemanagement stuff
|
||||
|
||||
val api: Project = projects.api.dependencyProject
|
||||
|
||||
|
||||
@@ -1,3 +1,9 @@
|
||||
import net.kyori.blossom.BlossomExtension
|
||||
|
||||
plugins {
|
||||
id("net.kyori.blossom")
|
||||
}
|
||||
|
||||
dependencies {
|
||||
api(projects.api)
|
||||
|
||||
@@ -13,3 +19,9 @@ dependencies {
|
||||
// present on all platforms
|
||||
provided("io.netty", "netty-transport", Versions.nettyVersion)
|
||||
provided("io.netty", "netty-codec", Versions.nettyVersion)
|
||||
|
||||
configure<BlossomExtension> {
|
||||
val constantsFile = "src/main/java/org/geysermc/floodgate/util/Constants.java"
|
||||
replaceToken("\${branch}", branchName(), constantsFile)
|
||||
replaceToken("\${buildNumber}", buildNumber(), constantsFile)
|
||||
}
|
||||
|
||||
@@ -47,7 +47,6 @@ import org.geysermc.floodgate.link.PlayerLinkLoader;
|
||||
import org.geysermc.floodgate.module.ConfigLoadedModule;
|
||||
import org.geysermc.floodgate.module.PostInitializeModule;
|
||||
import org.geysermc.floodgate.news.NewsChecker;
|
||||
import org.geysermc.floodgate.util.GitProperties;
|
||||
import org.geysermc.floodgate.util.PrefixCheckTask;
|
||||
|
||||
public class FloodgatePlatform {
|
||||
@@ -60,9 +59,6 @@ public class FloodgatePlatform {
|
||||
private FloodgateConfig config;
|
||||
private Injector guice;
|
||||
|
||||
@Inject
|
||||
private GitProperties properties;
|
||||
|
||||
@Inject
|
||||
public FloodgatePlatform(
|
||||
FloodgateApi api,
|
||||
@@ -104,8 +100,7 @@ public class FloodgatePlatform {
|
||||
|
||||
InstanceHolder.set(api, link, this.injector, packetHandlers, handshakeHandlers, KEY);
|
||||
|
||||
// for Geyser dump
|
||||
// FloodgateInfoHolder.setGitProperties(properties.getProperties());
|
||||
// todo provide build number and branch for Geyser dump
|
||||
|
||||
guice.getInstance(NewsChecker.class).start();
|
||||
}
|
||||
|
||||
@@ -59,7 +59,7 @@ import org.geysermc.floodgate.player.FloodgateHandshakeHandler;
|
||||
import org.geysermc.floodgate.pluginmessage.PluginMessageManager;
|
||||
import org.geysermc.floodgate.skin.SkinApplier;
|
||||
import org.geysermc.floodgate.skin.SkinUploadManager;
|
||||
import org.geysermc.floodgate.util.GitProperties;
|
||||
import org.geysermc.floodgate.util.Constants;
|
||||
import org.geysermc.floodgate.util.LanguageManager;
|
||||
|
||||
@RequiredArgsConstructor
|
||||
@@ -174,24 +174,8 @@ public class CommonModule extends AbstractModule {
|
||||
|
||||
@Provides
|
||||
@Singleton
|
||||
public GitProperties gitProperties() {
|
||||
return new GitProperties();
|
||||
}
|
||||
|
||||
@Provides
|
||||
@Singleton
|
||||
public NewsChecker newsChecker(
|
||||
CommandUtil commandUtil,
|
||||
FloodgateLogger logger,
|
||||
GitProperties properties) {
|
||||
|
||||
String branch = properties.getProperty("git.branch");
|
||||
String build = properties.getProperty("git.build.number");
|
||||
int buildNumber = -1;
|
||||
if (build != null) {
|
||||
buildNumber = Integer.parseInt(build);
|
||||
}
|
||||
return new NewsChecker(commandUtil, logger, branch, buildNumber);
|
||||
public NewsChecker newsChecker(CommandUtil commandUtil, FloodgateLogger logger) {
|
||||
return new NewsChecker(commandUtil, logger, Constants.GIT_BRANCH, Constants.BUILD_NUMBER);
|
||||
}
|
||||
|
||||
@Provides
|
||||
|
||||
@@ -26,6 +26,9 @@
|
||||
package org.geysermc.floodgate.util;
|
||||
|
||||
public final class Constants {
|
||||
public static final int BUILD_NUMBER = Integer.parseInt("${buildNumber}");
|
||||
public static final String GIT_BRANCH = "${branch}";
|
||||
|
||||
public static final char COLOR_CHAR = '§';
|
||||
|
||||
public static final boolean DEBUG_MODE = false;
|
||||
|
||||
@@ -1,58 +0,0 @@
|
||||
/*
|
||||
* 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/Floodgate
|
||||
*/
|
||||
|
||||
package org.geysermc.floodgate.util;
|
||||
|
||||
import java.util.Properties;
|
||||
|
||||
public class GitProperties {
|
||||
private final Properties properties;
|
||||
|
||||
public GitProperties() {
|
||||
// properties = Utils.readProperties("git.properties");
|
||||
properties = new Properties();
|
||||
properties.setProperty("git.branch", "dev/2.1.1");
|
||||
}
|
||||
|
||||
public Properties getProperties() {
|
||||
return properties;
|
||||
}
|
||||
|
||||
public Object get(Object key) {
|
||||
return properties.get(key);
|
||||
}
|
||||
|
||||
public String getProperty(String key) {
|
||||
return properties.getProperty(key);
|
||||
}
|
||||
|
||||
public String getProperty(String key, String defaultValue) {
|
||||
return properties.getProperty(key, defaultValue);
|
||||
}
|
||||
|
||||
public Object getOrDefault(Object key, Object defaultValue) {
|
||||
return properties.getOrDefault(key, defaultValue);
|
||||
}
|
||||
}
|
||||
@@ -1,2 +1,3 @@
|
||||
org.gradle.configureondemand=true
|
||||
org.gradle.caching=true
|
||||
org.gradle.parallel=true
|
||||
2
gradle/wrapper/gradle-wrapper.properties
vendored
2
gradle/wrapper/gradle-wrapper.properties
vendored
@@ -1,5 +1,5 @@
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.1-bin.zip
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.3-bin.zip
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
|
||||
10
gradlew
vendored
10
gradlew
vendored
@@ -1,7 +1,7 @@
|
||||
#!/bin/sh
|
||||
|
||||
#
|
||||
# Copyright <EFBFBD> 2015-2021 the original authors.
|
||||
# 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.
|
||||
@@ -32,10 +32,10 @@
|
||||
# Busybox and similar reduced shells will NOT work, because this script
|
||||
# requires all of these POSIX shell features:
|
||||
# * functions;
|
||||
# * expansions <EFBFBD>$var<EFBFBD>, <EFBFBD>${var}<EFBFBD>, <EFBFBD>${var:-default}<EFBFBD>, <EFBFBD>${var+SET}<EFBFBD>,
|
||||
# <EFBFBD>${var#prefix}<EFBFBD>, <EFBFBD>${var%suffix}<EFBFBD>, and <EFBFBD>$( cmd )<EFBFBD>;
|
||||
# * compound commands having a testable exit status, especially <EFBFBD>case<EFBFBD>;
|
||||
# * various built-in commands including <EFBFBD>command<EFBFBD>, <EFBFBD>set<EFBFBD>, and <EFBFBD>ulimit<EFBFBD>.
|
||||
# * 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:
|
||||
#
|
||||
|
||||
@@ -37,8 +37,13 @@ dependencyResolutionManagement {
|
||||
}
|
||||
|
||||
pluginManagement {
|
||||
repositories {
|
||||
gradlePluginPortal()
|
||||
}
|
||||
plugins {
|
||||
id("net.kyori.blossom") version "1.2.0"
|
||||
id("net.kyori.indra")
|
||||
id("net.kyori.indra.git")
|
||||
}
|
||||
includeBuild("build-logic")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user