Browse Source

Added a BuildInfo.java auto-generated file

OvermindDL1 2 years ago
parent
commit
52d1411dd4
Signed by: OvermindDL1 <overminddl1@gmail.com> GPG Key ID: 3AB7DC53B6993840
3 changed files with 23 additions and 0 deletions
  1. 1
    0
      .gitignore
  2. 14
    0
      build.gradle
  3. 8
    0
      src/template/java/gregtech/BuildInfo.java

+ 1
- 0
.gitignore View File

@@ -34,6 +34,7 @@
34 34
 
35 35
 # Source
36 36
 !/src/main/java/**/*.java
37
+!/src/template/java/**/*.java
37 38
 
38 39
 # License Files inside the Mod
39 40
 !/src/main/resources/**/LICENSE*

+ 14
- 0
build.gradle View File

@@ -363,6 +363,20 @@ processResources {
363 363
 	}
364 364
 }
365 365
 
366
+task generateBuildInfo(type: Copy) {
367
+	def templateContext = [
368
+		version: project.buildInfo.tag,
369
+		mcversion: project.minecraft.version,
370
+		builddate: new Date().toString(),
371
+	]
372
+	inputs.properties templateContext
373
+	from 'src/template/java'
374
+	into "$buildDir/generated-source/java"
375
+	expand templateContext
376
+}
377
+sourceSets.main.java.srcDir "$buildDir/generated-source/java"
378
+compileJava.dependsOn generateBuildInfo
379
+
366 380
 task wrapper(type: Wrapper) {
367 381
 	gradleVersion = '3.5.1'
368 382
 }

+ 8
- 0
src/template/java/gregtech/BuildInfo.java View File

@@ -0,0 +1,8 @@
1
+package gregtech;
2
+
3
+public final class BuildInfo {
4
+	public final static String version = "${version}";
5
+	public final static String mcversion = "${mcversion}";
6
+	public final static String builddate = "${builddate}";
7
+}
8
+

Loading…
Cancel
Save