Skip to content

Commit d49e247

Browse files
committed
The config is now the source of truth
This essentially boils down to the design change that .gitversion is no longer written to by Git Version, but instead should be updated and edited by project maintainers. I might make some sort of generator in the future. Additionally: - Switched from JSON to TOML for config parsing - Locked down all API, leaving only the essentials for interacting with Git Version (net.minecraftforge.gitver.api) - Use interfaces for utility classes (mainly because I'm lazy and don't have to write as many keywords) - JGit is no longer exposed API in Git Version - Added strict mode, to allow fake version numbers to be used if necessary - `@Override` on the record parameters for IDE linting - Fixed commit counting not working for root projects - Fixed various CLI issues - Fixed some tag filtering implementation details - Now using absolute files for everything, because path resolutions
1 parent 091e5a2 commit d49e247

24 files changed

+1325
-1180
lines changed

build.gradle

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -30,17 +30,16 @@ configurations {
3030

3131
dependencies {
3232
// Git
33-
api libs.eclipse.jgit
33+
implementation libs.eclipse.jgit
3434

35-
// Command Line
35+
// Utilities
36+
implementation libs.toml
37+
38+
// CLI
3639
shadowOnly libs.slf4j
3740
shadowOnly libs.jopt
3841
compileOnly libs.jopt
3942

40-
// Utilities
41-
implementation libs.gson
42-
implementation libs.commons.io
43-
4443
// Static Analysis
4544
compileOnly libs.nulls
4645
}
@@ -60,16 +59,16 @@ jar {
6059
'Implementation-Title' : 'Git Version',
6160
'Implementation-Vendor' : 'Forge Development LLC',
6261
'Implementation-Version': project.version
63-
] as LinkedHashMap, 'net/minecraftforge/gitver/')
62+
] as LinkedHashMap, 'net/minecraftforge/gitver/api/')
6463
}
6564

66-
exclude('net/minecraftforge/gitver/Main.class')
65+
exclude 'net/minecraftforge/gitver/cli/**'
6766
}
6867

6968
tasks.named('shadowJar', com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar).configure {
7069
manifest {
7170
attributes([
72-
'Main-Class': 'net.minecraftforge.gitver.Main'
71+
'Main-Class': 'net.minecraftforge.gitver.cli.Main'
7372
] as LinkedHashMap)
7473
}
7574

settings.gradle

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,10 @@ dependencyResolutionManagement {
1111
library('eclipse-jgit', 'org.eclipse.jgit', 'org.eclipse.jgit').version('7.2.0.202502261823-rc1')
1212

1313
// Utilities
14+
library('toml', 'org.tomlj', 'tomlj').version('1.1.1')
15+
16+
// CLI
1417
library('jopt', 'net.sf.jopt-simple', 'jopt-simple').version('6.0-alpha-3')
15-
library('gson', 'com.google.code.gson', 'gson').version('2.10.1')
16-
library('commons-io', 'commons-io', 'commons-io').version('2.18.0')
1718
library('slf4j', 'org.slf4j', 'slf4j-simple').version('1.7.36')
1819

1920
// Static Analysis

src/main/java/module-info.java

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,11 @@
33
* SPDX-License-Identifier: LGPL-2.1-only
44
*/
55
module net.minecraftforge.gitver {
6-
exports net.minecraftforge.gitver;
7-
exports net.minecraftforge.util.git;
6+
exports net.minecraftforge.gitver.api;
87

9-
requires com.google.gson;
10-
requires org.apache.commons.io;
8+
requires org.tomlj;
119
requires org.eclipse.jgit;
1210

1311
requires static joptsimple;
1412
requires static org.jetbrains.annotations;
15-
}
13+
}

src/main/java/net/minecraftforge/gitver/ActionableLazy.java

Lines changed: 0 additions & 61 deletions
This file was deleted.

src/main/java/net/minecraftforge/gitver/GitInfo.java

Lines changed: 0 additions & 62 deletions
This file was deleted.

0 commit comments

Comments
 (0)