Skip to content

Commit

Permalink
Generate build parameters during build-time
Browse files Browse the repository at this point in the history
  • Loading branch information
RealTriassic committed Oct 13, 2024
1 parent 91cc2dc commit 6b9011d
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
15 changes: 15 additions & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
plugins {
java
id("net.kyori.blossom") version "2.1.0"
id("net.kyori.indra.git") version "3.1.3"
id("io.freefair.lombok") version "8.10.2"
id("com.gradleup.shadow") version "8.3.3"
id("org.jetbrains.gradle.plugin.idea-ext") version "1.1.9"
}

repositories {
Expand Down Expand Up @@ -45,6 +48,18 @@ tasks {
)
}
}

sourceSets {
main {
blossom {
javaSources {
property("version", project.version.toString())
property("gitBranch", indraGit.branchName())
property("gitCommit", indraGit.commit()?.name)
}
}
}
}
}

java.toolchain.languageVersion = JavaLanguageVersion.of(17)
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package com.triassic.geyserdebuginfo;

class BuildParameters {
public static final String VERSION = "{{ version }}";
public static final String GIT_BRANCH = "{{ gitBranch | default("unknown") }}";
public static final String GIT_COMMIT = "{{ gitCommit | default("unknown") }}";
}

0 comments on commit 6b9011d

Please sign in to comment.