Skip to content

Commit fc529a6

Browse files
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
1 parent ded6f6b commit fc529a6

File tree

4 files changed

+60
-19
lines changed

4 files changed

+60
-19
lines changed

core/build.gradle.kts

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
import net.kyori.blossom.BlossomExtension
2-
31
plugins {
2+
// Allow blossom to mark sources root of templates
3+
idea
44
alias(libs.plugins.blossom)
55
id("geyser.publish-conventions")
66
}
@@ -84,16 +84,20 @@ tasks.processResources {
8484
}
8585
}
8686

87-
configure<BlossomExtension> {
88-
val mainFile = "src/main/java/org/geysermc/geyser/GeyserImpl.java"
89-
val info = GitInfo()
90-
91-
replaceToken("\${version}", "${project.version} (${info.gitVersion})", mainFile)
92-
replaceToken("\${gitVersion}", info.gitVersion, mainFile)
93-
replaceToken("\${buildNumber}", info.buildNumber, mainFile)
94-
replaceToken("\${branch}", info.branch, mainFile)
95-
replaceToken("\${commit}", info.commit, mainFile)
96-
replaceToken("\${repository}", info.repository, mainFile)
87+
sourceSets {
88+
main {
89+
blossom {
90+
val info = GitInfo()
91+
javaSources {
92+
property("version", "${project.version} (${info.gitVersion})")
93+
property("gitVersion", info.gitVersion)
94+
property("buildNumber", info.buildNumber.toString())
95+
property("branch", info.branch)
96+
property("commit", info.commit)
97+
property("repository", info.repository)
98+
}
99+
}
100+
}
97101
}
98102

99103
fun Project.buildNumber(): Int =
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
/*
2+
* Copyright (c) 2019-2022 GeyserMC. http://geysermc.org
3+
*
4+
* Permission is hereby granted, free of charge, to any person obtaining a copy
5+
* of this software and associated documentation files (the "Software"), to deal
6+
* in the Software without restriction, including without limitation the rights
7+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8+
* copies of the Software, and to permit persons to whom the Software is
9+
* furnished to do so, subject to the following conditions:
10+
*
11+
* The above copyright notice and this permission notice shall be included in
12+
* all copies or substantial portions of the Software.
13+
*
14+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20+
* THE SOFTWARE.
21+
*
22+
* @author GeyserMC
23+
* @link https://github.com/GeyserMC/Geyser
24+
*/
25+
26+
package org.geysermc.geyser;
27+
28+
// The constants are replaced before compilation
29+
public class BuildData {
30+
public static final String GIT_VERSION = "{{ gitVersion }}";
31+
public static final String VERSION = "{{ version }}";
32+
33+
public static final String BUILD_NUMBER = "{{ buildNumber }}";
34+
public static final String BRANCH = "{{ branch }}";
35+
public static final String COMMIT = "{{ commit }}";
36+
public static final String REPOSITORY = "{{ repository }}";
37+
}

core/src/main/java/org/geysermc/geyser/GeyserImpl.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -115,13 +115,13 @@ public class GeyserImpl implements GeyserApi {
115115
.enable(JsonParser.Feature.ALLOW_SINGLE_QUOTES);
116116

117117
public static final String NAME = "Geyser";
118-
public static final String GIT_VERSION = "${gitVersion}";
119-
public static final String VERSION = "${version}";
118+
public static final String GIT_VERSION = BuildData.GIT_VERSION;
119+
public static final String VERSION = BuildData.VERSION;
120120

121-
public static final String BUILD_NUMBER = "${buildNumber}";
122-
public static final String BRANCH = "${branch}";
123-
public static final String COMMIT = "${commit}";
124-
public static final String REPOSITORY = "${repository}";
121+
public static final String BUILD_NUMBER = BuildData.BUILD_NUMBER;
122+
public static final String BRANCH = BuildData.BRANCH;
123+
public static final String COMMIT = BuildData.COMMIT;
124+
public static final String REPOSITORY = BuildData.REPOSITORY;
125125

126126
/**
127127
* Oauth client ID for Microsoft authentication

gradle/libs.versions.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ architectury-plugin = "3.4-SNAPSHOT"
4242
architectury-loom = "1.6-SNAPSHOT"
4343
minotaur = "2.8.7"
4444
lombok = "8.4"
45-
blossom = "1.2.0"
45+
blossom = "2.1.0"
4646

4747
[libraries]
4848
base-api = { group = "org.geysermc.api", name = "base-api", version.ref = "base-api" }

0 commit comments

Comments
 (0)