Skip to content

Commit c16e9a1

Browse files
committed
Use Blossom for runtime library versions
1 parent 064af98 commit c16e9a1

3 files changed

Lines changed: 53 additions & 7 deletions

File tree

build.gradle.kts

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ plugins {
99
java
1010
id("xyz.srnyx.gradle-galaxy") version "2.1.0"
1111
id("com.gradleup.shadow") version "8.3.9"
12+
id("net.kyori.blossom") version "2.2.0"
13+
id("org.jetbrains.gradle.plugin.idea-ext") version "1.3"
1214
}
1315

1416
paper(DependencyConfig(version = "1.18.2"))
@@ -20,19 +22,31 @@ setupAnnoyingAPI(
2022
javaVersion = JavaVersion.VERSION_21),
2123
annoyingAPIConfig = DependencyConfig(version = "5.2.0"))
2224

23-
repository(Repository.TRIUMPH_SNAPSHOTS)
25+
// Runtime dependency versions
26+
val javaWebSocketVersion: String = "1.6.0"
27+
val bsonVersion: String = "5.6.3"
28+
val jEmojiVersion: String = "1.7.5"
29+
30+
// Blossom (see java-templates module)
31+
sourceSets.main { blossom.javaSources {
32+
property("java_websocket_version", javaWebSocketVersion)
33+
property("bson_version", bsonVersion)
34+
property("jemoji_version", jEmojiVersion)
35+
} }
2436

37+
// Dependencies
38+
repository(Repository.TRIUMPH_SNAPSHOTS)
2539
dependencies {
2640
implementationRelocate("dev.triumphteam:triumph-gui-paper:4.0.0-SNAPSHOT", "dev.triumphteam")
2741

28-
compileOnly("org.java-websocket:Java-WebSocket:1.6.0") { // Downloaded on runtime
42+
compileOnly("org.java-websocket:Java-WebSocket:$javaWebSocketVersion") { // Downloaded on runtime
2943
relocate("org.java_websocket")
3044
}
31-
compileOnly("org.mongodb:bson:5.6.3") { // Downloaded on runtime
45+
compileOnly("org.mongodb:bson:$bsonVersion") { // Downloaded on runtime
3246
relocate("org.bson")
3347
relocate("org.checkerframework")
3448
}
35-
compileOnly("net.fellbaum:jemoji:1.7.5") { // Downloaded on runtime
49+
compileOnly("net.fellbaum:jemoji:$jEmojiVersion") { // Downloaded on runtime
3650
relocate("net.fellbaum")
3751
}
3852
}
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
package gg.eventalerts.eventalertsintegration;
2+
3+
import org.jetbrains.annotations.NotNull;
4+
5+
6+
/**
7+
* This class is used to store properties defined in the build.gradle.kts file
8+
* <br>Uses <a href="https://github.com/KyoriPowered/blossom">Blossom</a>
9+
*/
10+
public class BuildProperties {
11+
/**
12+
* The version of Java WebSocket that the plugin is built with
13+
*/
14+
@NotNull public static final String JAVA_WEBSOCKET_VERSION = "{{ java_websocket_version }}";
15+
16+
/**
17+
* The version of BSON that the plugin is built with
18+
*/
19+
@NotNull public static final String BSON_VERSION = "{{ bson_version }}";
20+
21+
/**
22+
* The version of JEmoji that the plugin is built with
23+
*/
24+
@NotNull public static final String JEMOJI_VERSION = "{{ jemoji_version }}";
25+
26+
/**
27+
* This class cannot be instantiated
28+
*/
29+
public BuildProperties() {
30+
throw new UnsupportedOperationException("This class cannot be instantiated");
31+
}
32+
}

src/main/java/gg/eventalerts/eventalertsintegration/EALibrary.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ public enum EALibrary implements AnnoyingLibrary {
2424
.repository(Repositories.MAVEN_CENTRAL)
2525
.groupId("org{}java-websocket")
2626
.artifactId("Java-WebSocket")
27-
.version("1.6.0"),
27+
.version(BuildProperties.JAVA_WEBSOCKET_VERSION),
2828
plugin -> Collections.singleton(plugin.getRelocation("org{}java_websocket"))),
2929
/**
3030
* {@code org.mongodb:bson}
@@ -34,7 +34,7 @@ public enum EALibrary implements AnnoyingLibrary {
3434
.repository(Repositories.MAVEN_CENTRAL)
3535
.groupId("org{}mongodb")
3636
.artifactId("bson")
37-
.version("5.6.3"),
37+
.version(BuildProperties.BSON_VERSION),
3838
plugin -> List.of(
3939
plugin.getRelocation("org{}bson"),
4040
plugin.getRelocation("org{}checkerframework"))), //TODO not sure if should include checkerframework here
@@ -46,7 +46,7 @@ public enum EALibrary implements AnnoyingLibrary {
4646
.repository(Repositories.MAVEN_CENTRAL)
4747
.groupId("net{}fellbaum")
4848
.artifactId("jemoji")
49-
.version("1.7.5"),
49+
.version(BuildProperties.JEMOJI_VERSION),
5050
plugin -> Collections.singleton(plugin.getRelocation("net{}fellbaum")));
5151

5252
@NotNull public final Supplier<Library.Builder> librarySupplier;

0 commit comments

Comments
 (0)