Skip to content

Commit cd9f7ea

Browse files
committed
Move all Git-related operations to GitVersion
GradleUtils 2.3 was 90% JGit and Git-related operations, which are all now housed in the framework-agnostic GitVersion. Projects that do not opt-in to using GitVersion or having subprojects are not affected. There are a small amount of binary breaking changes in this update, but it should not affect Gradle buildscripts (the primary consumer of this) as they are dynamically compiled and can use Groovy's funky syntax to get what they need.
1 parent 0bdf45f commit cd9f7ea

22 files changed

+1248
-1155
lines changed

.github/workflows/publish.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ jobs:
1111
build:
1212
uses: MinecraftForge/SharedActions/.github/workflows/gradle.yml@main
1313
with:
14-
java: 11
14+
java: 17
1515
gradle_tasks: "publish publishPlugins"
1616
artifact_name: "gradleutils"
1717
secrets:

build.gradle

Lines changed: 24 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,19 @@
11
plugins {
22
id 'java-gradle-plugin'
33
id 'groovy'
4+
id 'idea'
45
id 'maven-publish'
5-
id 'net.minecraftforge.licenser' version '1.0.1'
6+
id 'net.minecraftforge.licenser' version '1.1.1'
67
id 'com.gradle.plugin-publish' version '1.2.1'
78
id 'net.minecraftforge.gradleutils'
8-
id 'com.github.johnrengelman.shadow' version '8.1.1'
9+
id 'com.gradleup.shadow' version '8.3.6'
910
}
1011

11-
group 'net.minecraftforge'
12-
version gradleutils.tagOffsetVersion
12+
group = 'net.minecraftforge'
13+
version = gitversion.version.tagOffset
1314
println "Version: $version"
1415

15-
repositories {
16-
mavenCentral()
17-
}
18-
19-
dependencies {
20-
implementation 'org.eclipse.jgit:org.eclipse.jgit:6.7.0.202309050840-r'
21-
}
22-
23-
java {
24-
// JGit 6.7 requires Java 11
25-
toolchain.languageVersion = JavaLanguageVersion.of(11)
26-
withSourcesJar()
27-
}
16+
apply from: 'build_shared.gradle'
2817

2918
tasks.withType(GroovyCompile).configureEach {
3019
groovyOptions.optimizationOptions.indy = true
@@ -36,37 +25,27 @@ license {
3625
exclude '** /*.properties'
3726
}
3827

39-
gradlePlugin {
40-
website = 'https://github.com/MinecraftForge/GradleUtils'
41-
vcsUrl = 'https://github.com/MinecraftForge/GradleUtils.git'
42-
plugins {
43-
gradleutils {
44-
id = 'net.minecraftforge.gradleutils'
45-
implementationClass = 'net.minecraftforge.gradleutils.GradleUtilsPlugin'
46-
displayName = 'Forge Gradle Utilities'
47-
description = 'Small collection of utilities for standerdizing our gradle scripts'
48-
tags.set(['minecraftforge'])
49-
}
50-
changelog {
51-
id = 'net.minecraftforge.changelog'
52-
implementationClass = 'net.minecraftforge.gradleutils.changelog.ChangelogPlugin'
53-
displayName = 'Git Changelog'
54-
description = 'Creates a changelog text file based on git history'
55-
tags.set(['git', 'changelog'])
56-
}
57-
}
58-
}
59-
6028
jar {
6129
archiveClassifier = 'thin'
6230
}
6331

6432
tasks.named('shadowJar', com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar) {
65-
enableRelocation true
33+
enableRelocation = true
6634
archiveClassifier = null
6735
relocationPrefix = 'net.minecraftforge.gradleutils.shadow'
6836
}
6937

38+
javadoc.enabled = false
39+
groovydoc.use = true
40+
41+
// javadocJar is created after evaluation, so we need to configure it here
42+
afterEvaluate {
43+
tasks.named('javadocJar', Jar) {
44+
dependsOn groovydoc
45+
from groovydoc.destinationDir
46+
}
47+
}
48+
7049
changelog {
7150
fromBase()
7251
publishAll = false
@@ -75,20 +54,21 @@ changelog {
7554
publishing {
7655
publications.register('pluginMaven', MavenPublication) {
7756
changelog.publish(it)
78-
pom {
57+
pom { pom ->
7958
artifactId = 'gradleutils'
8059
name = 'Gradle Utils'
8160
description = 'Used by MinecraftForge projects as a util library for Gradle buildscripts'
82-
url = 'https://github.com/MinecraftForge/GradleUtils'
8361

84-
gradleutils.pom.setGitHubDetails(pom, 'GradleUtils')
62+
gradleutils.pom.gitHubDetails = pom
8563

8664
license gradleutils.pom.licenses.LGPLv2_1
8765

66+
// TODO [GradleUtils] Re-evaluate active developers in GU 3.0
8867
developers {
8968
developer gradleutils.pom.Developers.LexManos
9069
developer gradleutils.pom.Developers.SizableShrimp
9170
developer gradleutils.pom.Developers.Paint_Ninja
71+
developer gradleutils.pom.Developers.Jonathing
9272
}
9373
}
9474
}
@@ -97,3 +77,5 @@ publishing {
9777
maven gradleutils.publishingForgeMaven
9878
}
9979
}
80+
81+
idea.module { downloadSources = downloadJavadoc = true }

buildSrc/build.gradle

Lines changed: 1 addition & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,7 @@ plugins {
22
id 'java-gradle-plugin'
33
}
44

5-
repositories {
6-
mavenCentral()
7-
}
8-
9-
// JGit 6.7 requires Java 11
10-
java.toolchain.languageVersion = JavaLanguageVersion.of(11)
11-
12-
dependencies {
13-
implementation 'org.eclipse.jgit:org.eclipse.jgit:6.7.0.202309050840-r'
14-
}
5+
apply from: '../build_shared.gradle'
156

167
sourceSets {
178
main {
@@ -20,16 +11,3 @@ sourceSets {
2011
}
2112
}
2213
}
23-
24-
gradlePlugin {
25-
plugins {
26-
gradleutils {
27-
id = 'net.minecraftforge.gradleutils'
28-
implementationClass = 'net.minecraftforge.gradleutils.GradleUtilsPlugin'
29-
}
30-
changelog {
31-
id = 'net.minecraftforge.changelog'
32-
implementationClass = 'net.minecraftforge.gradleutils.changelog.ChangelogPlugin'
33-
}
34-
}
35-
}

buildSrc/settings.gradle

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
apply from: '../settings_shared.gradle'

build_shared.gradle

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
2+
java {
3+
// GitVersion requires Java 17
4+
toolchain.languageVersion = JavaLanguageVersion.of(17)
5+
withSourcesJar()
6+
}
7+
8+
repositories {
9+
maven { url = 'https://maven.minecraftforge.net' }
10+
maven { url = 'https://repo.eclipse.org/content/groups/releases/' }
11+
mavenCentral()
12+
mavenLocal()
13+
}
14+
15+
dependencies {
16+
// GitHub Actions Workflows
17+
implementation libs.yaml
18+
19+
// Git Version
20+
implementation libs.gitver
21+
22+
// TODO - Deprecated git utilities, remove in 3.0
23+
implementation libs.jgit
24+
}
25+
26+
gradlePlugin {
27+
website = 'https://github.com/MinecraftForge/GradleUtils'
28+
vcsUrl = 'https://github.com/MinecraftForge/GradleUtils.git'
29+
plugins {
30+
gradleutils {
31+
id = 'net.minecraftforge.gradleutils'
32+
implementationClass = 'net.minecraftforge.gradleutils.GradleUtilsPlugin'
33+
displayName = 'Forge Gradle Utilities'
34+
description = 'Small collection of utilities for standardizing our gradle scripts'
35+
tags.set(['minecraftforge'])
36+
}
37+
gitversion {
38+
id = 'net.minecraftforge.gitversion'
39+
implementationClass = 'net.minecraftforge.gradleutils.gitversion.GitVersionPlugin'
40+
displayName = 'Git Version'
41+
description = 'Provides versioning information based on git history and configurable subprojects'
42+
tags.set(['git', 'version'])
43+
}
44+
changelog {
45+
id = 'net.minecraftforge.changelog'
46+
implementationClass = 'net.minecraftforge.gradleutils.changelog.ChangelogPlugin'
47+
displayName = 'Git Changelog'
48+
description = 'Creates a changelog text file based on git history using GitVersion'
49+
tags.set(['git', 'changelog'])
50+
}
51+
}
52+
}

gradle/wrapper/gradle-wrapper.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
distributionBase=GRADLE_USER_HOME
22
distributionPath=wrapper/dists
3-
distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-8.13-bin.zip
44
networkTimeout=10000
55
validateDistributionUrl=true
66
zipStoreBase=GRADLE_USER_HOME

0 commit comments

Comments
 (0)