Skip to content

Commit fc11dfe

Browse files
committed
Update GradleUtils Shared to fix rare runtime issues
1 parent 2343cae commit fc11dfe

7 files changed

Lines changed: 51 additions & 52 deletions

File tree

build.gradle

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ plugins {
55
id 'idea'
66
id 'eclipse'
77
id 'maven-publish'
8-
alias libs.plugins.javadoc.links
98
alias libs.plugins.licenser
109
alias libs.plugins.gradleutils
1110
id 'net.minecraftforge.gitversion'

gitversion-gradle/build.gradle

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,7 @@ plugins {
88
id 'idea'
99
id 'eclipse'
1010
id 'maven-publish'
11-
id 'io.freefair.javadoc-links'
12-
id 'net.minecraftforge.gradleutils'
11+
alias libs.plugins.gradleutils
1312
alias libs.plugins.licenser
1413
alias libs.plugins.gitversion
1514
alias libs.plugins.changelog

gitversion-gradle/changelog-gradle/build.gradle

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,7 @@ plugins {
77
id 'idea'
88
id 'eclipse'
99
id 'maven-publish'
10-
id 'io.freefair.javadoc-links'
11-
id 'net.minecraftforge.gradleutils'
10+
alias libs.plugins.gradleutils
1211
alias libs.plugins.licenser
1312
alias libs.plugins.gitversion
1413
alias libs.plugins.changelog

gitversion-gradle/changelog-gradle/src/main/java/net/minecraftforge/gitversion/gradle/changelog/GenerateChangelogImpl.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
import org.gradle.api.file.ProjectLayout;
1010
import org.gradle.api.file.RegularFileProperty;
1111
import org.gradle.api.provider.Property;
12+
import org.gradle.api.provider.ProviderFactory;
1213
import org.gradle.api.tasks.Input;
1314
import org.gradle.api.tasks.Optional;
1415
import org.gradle.api.tasks.OutputFile;
@@ -22,6 +23,7 @@ abstract class GenerateChangelogImpl extends ToolExecBase<ChangelogProblems> imp
2223
@Override public abstract @Input @Optional Property<String> getProjectUrl();
2324
@Override public abstract @Input Property<Boolean> getBuildMarkdown();
2425

26+
protected abstract @Inject ProviderFactory getProviders();
2527
protected abstract @Inject ProjectLayout getProjectLayout();
2628

2729
@Inject
@@ -35,7 +37,7 @@ public GenerateChangelogImpl() {
3537
this.getBuildMarkdown().convention(false);
3638

3739
// Internal inputs
38-
this.getInputs().property("projectVersion", this.getProviderFactory().provider(this.getProject()::getVersion));
40+
this.getInputs().property("projectVersion", this.getProviders().provider(this.getProject()::getVersion));
3941
this.getInputs().property("projectPath", this.getProjectLayout().getProjectDirectory().getAsFile().getAbsoluteFile());
4042
}
4143

gitversion-gradle/common/build.gradle

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ plugins {
44
id 'idea'
55
id 'eclipse'
66
alias libs.plugins.licenser
7+
alias libs.plugins.gradleutils
78
}
89

910
java.toolchain.languageVersion = JavaLanguageVersion.of(17)

gitversion-gradle/settings.gradle

Lines changed: 41 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,13 @@
11
pluginManagement {
22
repositories {
3-
//mavenLocal()
43
gradlePluginPortal()
54
maven { url = 'https://maven.minecraftforge.net' }
5+
//mavenLocal()
66
}
77
}
88

99
plugins {
1010
id 'org.gradle.toolchains.foojay-resolver-convention' version '1.0.0' // https://plugins.gradle.org/plugin/org.gradle.toolchains.foojay-resolver-convention
11-
12-
// NOTE: We need to load this into the classpath before GradleUtils for the service to load correctly
13-
id 'io.freefair.javadoc-links' version '8.14' apply false // https://plugins.gradle.org/plugin/io.freefair.javadoc-links
14-
15-
id 'net.minecraftforge.gradleutils' version '3.3.0' // https://plugins.gradle.org/plugin/net.minecraftforge.gradleutils
1611
}
1712

1813
rootProject.name = 'gitversion-gradle'
@@ -22,41 +17,46 @@ include 'changelog-gradle'
2217

2318
enableFeaturePreview 'TYPESAFE_PROJECT_ACCESSORS'
2419

25-
dependencyResolutionManagement {
26-
repositories {
27-
//mavenLocal()
28-
mavenCentral()
29-
gradlePluginPortal()
30-
maven gradleutils.forgeMaven
31-
maven { url = 'https://maven.moddinglegacy.com' } // Gradle API
20+
// Applying plugins causes them to not have any IDE support when also applied to any build.gradle files
21+
// The workaround for now is to use this listener here so that it can stay in settings.gradle
22+
// Note: The project will need to apply GradleUtils in order for these repositories to be added
23+
// See: https://youtrack.jetbrains.com/issue/IDEA-332061/Gradle-Missing-Code-Completion-Suggestions-for-Settings-Plugins-in-Groovy-DSL
24+
gradle.beforeProject { Project project ->
25+
project.pluginManager.withPlugin('net.minecraftforge.gradleutils') {
26+
project.repositories {
27+
mavenCentral()
28+
maven project.gradleutils.forgeMaven
29+
//mavenLocal()
30+
}
3231
}
32+
}
3333

34-
versionCatalogs.register('libs') {
35-
version 'gradleutils', '3.3.0'
36-
37-
plugin 'licenser', 'net.minecraftforge.licenser' version '1.2.0' // https://plugins.gradle.org/plugin/net.minecraftforge.licenser
38-
plugin 'javadoc-links', 'io.freefair.javadoc-links' version '8.14' // https://plugins.gradle.org/plugin/io.freefair.javadoc-links
39-
plugin 'gitversion', 'net.minecraftforge.gitversion' version '3.0.7' // https://plugins.gradle.org/plugin/net.minecraftforge.gitversion
40-
plugin 'changelog', 'net.minecraftforge.changelog' version '3.0.6' // https://plugins.gradle.org/plugin/net.minecraftforge.changelog
41-
plugin 'plugin-publish', 'com.gradle.plugin-publish' version '1.3.1' // https://plugins.gradle.org/plugin/com.gradle.plugin-publish
42-
plugin 'shadow', 'com.gradleup.shadow' version '9.0.2' // https://plugins.gradle.org/plugin/com.gradleup.shadow
43-
44-
// Static Analysis
45-
library 'nulls', 'org.jetbrains', 'annotations' version '26.0.2'
46-
47-
// Gradle API
48-
// TODO [ForgeGradle][FG7][Gradle Api] REMOVE once Gradle publish their own API artifacts
49-
// Original: https://github.com/remal-gradle-api/packages/packages/760197
50-
// Mirror: https://maven.moddinglegacy.com/#browse/browse:maven-public:name%2Fremal%2Fgradle-api%2Fgradle-api%2F8.14.1
51-
version 'gradle', '9.0.0'
52-
library 'gradle', 'name.remal.gradle-api', 'gradle-api' versionRef 'gradle'
53-
54-
// GradleUtils
55-
// https://plugins.gradle.org/plugin/net.minecraftforge.gradleutils
56-
library 'gradleutils-shared', 'net.minecraftforge', 'gradleutils-shared' versionRef 'gradleutils'
57-
library 'gradleutils-plugin', 'net.minecraftforge.gradleutils', 'net.minecraftforge.gradleutils.gradle.plugin' versionRef 'gradleutils'
58-
59-
// Git Version
60-
library 'gson', 'com.google.code.gson', 'gson' version '2.13.1'
61-
}
34+
dependencyResolutionManagement.versionCatalogs.register('libs') {
35+
version 'gradleutils', '3.3.21'
36+
37+
plugin 'licenser', 'net.minecraftforge.licenser' version '1.2.0' // https://plugins.gradle.org/plugin/net.minecraftforge.licenser
38+
plugin 'javadoc-links', 'io.freefair.javadoc-links' version '8.14' // https://plugins.gradle.org/plugin/io.freefair.javadoc-links
39+
plugin 'gradleutils', 'net.minecraftforge.gradleutils' versionRef 'gradleutils' // https://plugins.gradle.org/plugin/net.minecraftforge.gitversion
40+
plugin 'gitversion', 'net.minecraftforge.gitversion' version '3.0.7' // https://plugins.gradle.org/plugin/net.minecraftforge.gitversion
41+
plugin 'changelog', 'net.minecraftforge.changelog' version '3.0.6' // https://plugins.gradle.org/plugin/net.minecraftforge.changelog
42+
plugin 'plugin-publish', 'com.gradle.plugin-publish' version '1.3.1' // https://plugins.gradle.org/plugin/com.gradle.plugin-publish
43+
plugin 'shadow', 'com.gradleup.shadow' version '9.2.2' // https://plugins.gradle.org/plugin/com.gradleup.shadow
44+
45+
// Static Analysis
46+
library 'nulls', 'org.jetbrains', 'annotations' version '26.0.2'
47+
48+
// Gradle API
49+
// TODO [ForgeGradle][FG7][Gradle Api] REMOVE once Gradle publish their own API artifacts
50+
// Original: https://github.com/remal-gradle-api/packages/packages/760197
51+
// Mirror: https://maven.moddinglegacy.com/#browse/browse:maven-public:name%2Fremal%2Fgradle-api%2Fgradle-api%2F8.14.1
52+
version 'gradle', '9.0.0'
53+
library 'gradle', 'name.remal.gradle-api', 'gradle-api' versionRef 'gradle'
54+
55+
// GradleUtils
56+
// https://plugins.gradle.org/plugin/net.minecraftforge.gradleutils
57+
library 'gradleutils-shared', 'net.minecraftforge', 'gradleutils-shared' versionRef 'gradleutils'
58+
library 'gradleutils-plugin', 'net.minecraftforge.gradleutils', 'net.minecraftforge.gradleutils.gradle.plugin' versionRef 'gradleutils'
59+
60+
// Git Version
61+
library 'gson', 'com.google.code.gson', 'gson' version '2.13.1'
6262
}

settings.gradle

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@ pluginManagement {
55

66
// Manually declare external repos, since the non-shadowJars of the plugins have dependencies from them
77
repositories {
8-
//mavenLocal()
9-
mavenCentral()
108
gradlePluginPortal()
9+
mavenCentral()
1110
maven { url = 'https://maven.minecraftforge.net' }
11+
//mavenLocal()
1212
}
1313
}
1414

@@ -26,10 +26,9 @@ dependencyResolutionManagement {
2626
//@formatter:off
2727
versionCatalogs.register('libs') {
2828
// Plugins
29-
plugin 'javadoc-links', 'io.freefair.javadoc-links' version '8.14'
3029
plugin 'licenser', 'net.minecraftforge.licenser' version '1.2.0'
31-
plugin 'gradleutils', 'net.minecraftforge.gradleutils' version '3.3.0'
32-
plugin 'shadow', 'com.gradleup.shadow' version '9.0.2'
30+
plugin 'gradleutils', 'net.minecraftforge.gradleutils' version '3.3.21'
31+
plugin 'shadow', 'com.gradleup.shadow' version '9.2.2'
3332

3433
// Git
3534
library 'jgit', 'org.eclipse.jgit', 'org.eclipse.jgit' version '7.2.0.202503040940-r'

0 commit comments

Comments
 (0)