Fix build errors reporting to the wrong directory by updating blossom (#4771)

* Fix build errors reporting to the wrong directory by updating blossom

* Add info comment
This commit is contained in:
Alex 2024-06-20 19:29:42 +02:00 committed by GitHub
parent ded6f6bb7c
commit fc529a661c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 60 additions and 19 deletions

View file

@ -1,6 +1,6 @@
import net.kyori.blossom.BlossomExtension
plugins {
// Allow blossom to mark sources root of templates
idea
alias(libs.plugins.blossom)
id("geyser.publish-conventions")
}
@ -84,16 +84,20 @@ tasks.processResources {
}
}
configure<BlossomExtension> {
val mainFile = "src/main/java/org/geysermc/geyser/GeyserImpl.java"
val info = GitInfo()
replaceToken("\${version}", "${project.version} (${info.gitVersion})", mainFile)
replaceToken("\${gitVersion}", info.gitVersion, mainFile)
replaceToken("\${buildNumber}", info.buildNumber, mainFile)
replaceToken("\${branch}", info.branch, mainFile)
replaceToken("\${commit}", info.commit, mainFile)
replaceToken("\${repository}", info.repository, mainFile)
sourceSets {
main {
blossom {
val info = GitInfo()
javaSources {
property("version", "${project.version} (${info.gitVersion})")
property("gitVersion", info.gitVersion)
property("buildNumber", info.buildNumber.toString())
property("branch", info.branch)
property("commit", info.commit)
property("repository", info.repository)
}
}
}
}
fun Project.buildNumber(): Int =

View file

@ -0,0 +1,37 @@
/*
* 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
*/
package org.geysermc.geyser;
// The constants are replaced before compilation
public class BuildData {
public static final String GIT_VERSION = "{{ gitVersion }}";
public static final String VERSION = "{{ version }}";
public static final String BUILD_NUMBER = "{{ buildNumber }}";
public static final String BRANCH = "{{ branch }}";
public static final String COMMIT = "{{ commit }}";
public static final String REPOSITORY = "{{ repository }}";
}

View file

@ -115,13 +115,13 @@ public class GeyserImpl implements GeyserApi {
.enable(JsonParser.Feature.ALLOW_SINGLE_QUOTES);
public static final String NAME = "Geyser";
public static final String GIT_VERSION = "${gitVersion}";
public static final String VERSION = "${version}";
public static final String GIT_VERSION = BuildData.GIT_VERSION;
public static final String VERSION = BuildData.VERSION;
public static final String BUILD_NUMBER = "${buildNumber}";
public static final String BRANCH = "${branch}";
public static final String COMMIT = "${commit}";
public static final String REPOSITORY = "${repository}";
public static final String BUILD_NUMBER = BuildData.BUILD_NUMBER;
public static final String BRANCH = BuildData.BRANCH;
public static final String COMMIT = BuildData.COMMIT;
public static final String REPOSITORY = BuildData.REPOSITORY;
/**
* Oauth client ID for Microsoft authentication

View file

@ -42,7 +42,7 @@ architectury-plugin = "3.4-SNAPSHOT"
architectury-loom = "1.6-SNAPSHOT"
minotaur = "2.8.7"
lombok = "8.4"
blossom = "1.2.0"
blossom = "2.1.0"
[libraries]
base-api = { group = "org.geysermc.api", name = "base-api", version.ref = "base-api" }