11import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
22
33plugins {
4- id ' java-gradle-plugin'
5- id ' groovy'
4+ id ' dev.gradleplugins.groovy-gradle-plugin'
65 id ' idea'
76 id ' eclipse'
87 id ' maven-publish'
9- id ' net.minecraftforge .licenser' version ' 1.1.1 '
10- id ' net.minecraftforge .gradleutils'
11- id ' com.gradle .plugin-publish ' version ' 1.3.1 '
12- id ' com.gradleup .shadow' version ' 8.3.6 '
8+ alias libs . plugins . licenser
9+ alias libs . plugins . gradleutils
10+ alias libs . plugins . plugin. publish
11+ alias libs . plugins . shadow
1312}
1413
1514final projectDisplayName = ' Forge Gradle Utilities'
@@ -19,33 +18,63 @@ version = gitversion.tagOffset
1918
2019println " Version: $version "
2120
22- apply from : ' build_shared.gradle'
21+ // Git Version requires Java 17
22+ java. toolchain. languageVersion = JavaLanguageVersion . of 17
23+
24+ configurations {
25+ named(JavaPlugin . RUNTIME_CLASSPATH_CONFIGURATION_NAME ) {
26+ // Fixes a conflict between Git Version's shadowed SLF4J from JGit and Gradle's own loggers
27+ exclude group : ' org.slf4j' , module : ' slf4j-api'
28+ }
29+ }
30+
31+ repositories {
32+ maven { url = ' https://maven.minecraftforge.net' }
33+ mavenCentral()
34+ }
35+
36+ dependencies {
37+ // Static Analysis
38+ compileOnly libs. nulls
39+
40+ // GitHub Actions Workflows
41+ implementation libs. yaml
42+
43+ // Git Version
44+ implementation libs. gitver
45+
46+ // Backwards compatibility
47+ implementation libs. jgit
48+ }
49+
50+ // Removes local Gradle API from compileOnly. This is a workaround for bugged plugins.
51+ // TODO [GradleUtils][GradleAPI] Remove this once they are fixed.
52+ // Publish Plugin: https://github.com/gradle/plugin-portal-requests/issues/260
53+ // Shadow: https://github.com/GradleUp/shadow/pull/1422
54+ afterEvaluate { project ->
55+ project. configurations. named(JavaPlugin . COMPILE_ONLY_CONFIGURATION_NAME ) { compileOnly ->
56+ compileOnly. dependencies. remove project. dependencies. gradleApi()
57+ }
58+ }
2359
2460license {
25- header = file( ' LICENSE-header.txt' )
61+ header = rootProject . file ' LICENSE-header.txt'
2662 newLine = false
27- exclude ' ** /*.properties'
63+ exclude ' **/*.properties'
2864}
2965
3066tasks. named(' jar' , Jar ) {
3167 archiveClassifier = ' thin'
3268}
3369
3470tasks. named(' shadowJar' , ShadowJar ) {
35- enableRelocation = true
71+ enableRelocation = true
3672 archiveClassifier = null
3773 relocationPrefix = ' net.minecraftforge.gradleutils.shadow'
3874}
3975
40- javadoc. enabled = false
41- groovydoc. use = true
42-
43- // javadocJar is created after evaluation, so we need to configure it here
44- afterEvaluate {
45- tasks. named(' javadocJar' , Jar ) {
46- dependsOn tasks. named(' groovydoc' , Groovydoc )
47- from groovydoc. destinationDir
48- }
76+ tasks. withType(GroovyCompile ). configureEach {
77+ groovyOptions. optimizationOptions. indy = true
4978}
5079
5180changelog {
@@ -56,37 +85,51 @@ changelog {
5685gradlePlugin {
5786 website. set gitversion. url
5887 vcsUrl. set gitversion. url + ' .git'
88+
89+ compatibility {
90+ minimumGradleVersion = libs. versions. gradle. get()
91+ }
92+
93+ groovy {
94+ withSourcesJar()
95+ withGroovydocJar()
96+ }
97+
5998 plugins {
60- gradleutils {
99+ register( ' gradleutils' ) {
61100 id = ' net.minecraftforge.gradleutils'
62101 implementationClass = ' net.minecraftforge.gradleutils.GradleUtilsPlugin'
63102 displayName = projectDisplayName
64103 description = project. description
65- tags. set( [' minecraftforge' ])
104+ tags = [' minecraftforge' ]
66105 }
67- changelog {
106+ register( ' changelog' ) {
68107 id = ' net.minecraftforge.changelog'
69108 implementationClass = ' net.minecraftforge.gradleutils.changelog.ChangelogPlugin'
70109 displayName = ' Git Changelog'
71- description = ' Creates a changelog text file based on git history using GitVersion '
72- tags. set( [' git' , ' changelog' ])
110+ description = ' Creates a changelog text file based on git history using Git Version '
111+ tags = [' git' , ' changelog' ]
73112 }
74113 }
75114}
76115
77116publishing {
78117 publications. register(' pluginMaven' , MavenPublication ) {
79- changelog. publish(it)
118+ artifactId = project. name
119+
120+ changelog. publish it
121+
80122 pom { pom ->
81- artifactId = project. name
82123 name = projectDisplayName
83124 description = project. description
84125
85- gradleutils. pom. gitHubDetails = pom
126+ gradleutils. pom. setGitHubDetails pom
86127
87- license gradleutils.pom.licenses.LGPLv2_1
128+ licenses {
129+ license gradleutils.pom.licenses.LGPLv2_1
130+ }
88131
89- // TODO [GradleUtils] Re-evaluate active developers in GU 3.0
132+ // TODO [GradleUtils][GU3.0] Re-evaluate active developers in GU 3.0
90133 developers {
91134 developer gradleutils.pom.developers.LexManos
92135 developer gradleutils.pom.developers.SizableShrimp
0 commit comments