Skip to content

Commit 167c12d

Browse files
committed
Add gradleutils.displayName
Useful as an external property to store the display name so it can be accessed in places other than the project or buildscript. Also, used for optional features which can be enabled with a property flag.
1 parent 3a2ab26 commit 167c12d

File tree

3 files changed

+15
-2
lines changed

3 files changed

+15
-2
lines changed

src/main/groovy/net/minecraftforge/gradleutils/GradleUtilsExtensionForProject.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,21 @@
55
package net.minecraftforge.gradleutils;
66

77
import org.gradle.api.Action;
8+
import org.gradle.api.provider.Property;
89
import org.gradle.api.publish.maven.MavenPublication;
910
import org.gradle.api.tasks.TaskProvider;
1011

1112
/// A subset of [GradleUtilsExtension] that is given to projects. Includes additional convenience methods that only
1213
/// apply to projects.
1314
public sealed interface GradleUtilsExtensionForProject extends GradleUtilsExtension permits GradleUtilsExtensionInternal.ForProject {
15+
/// The display name for the project.
16+
///
17+
/// If the relevant properties are enabled, it is used in areas such as the Javadoc window title, among other
18+
/// things.
19+
///
20+
/// @return The property for the display name
21+
Property<String> getDisplayName();
22+
1423
/// Promotes a publication to the <a href="https://files.minecraftforge.net">Forge Files Site</a>.
1524
///
1625
/// Publications that are promoted will automatically have the relevant task added as a finalizer to the

src/main/groovy/net/minecraftforge/gradleutils/GradleUtilsExtensionImpl.groovy

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,13 +125,17 @@ import static net.minecraftforge.gradleutils.GradleUtilsPlugin.LOGGER
125125

126126
private final Project project
127127

128+
final Property<String> displayName
129+
128130
@Inject
129131
ForProjectImpl(Project project) {
130132
super(project)
131133
this.project = project
132134

133135
this.problems = this.objects.newInstance(GradleUtilsProblems)
134136

137+
this.displayName = this.objects.property(String)
138+
135139
project.tasks.register(GenerateActionsWorkflow.NAME, GenerateActionsWorkflowImpl)
136140

137141
project.afterEvaluate { this.finish(it) }

src/main/groovy/net/minecraftforge/gradleutils/GradleUtilsProblems.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ void ghWorkflowGitVersionMissing(String taskName) {
2626
The workflow file will likely be incomplete or be missing details that may cause it to fail.""".formatted(taskName))
2727
.severity(Severity.WARNING)
2828
.stackLocation()
29-
.solution("Apply the Git Version Plugin (net.minecraftforge.gitversion) to your project.")
29+
.solution("Apply the Git Version Gradle plugin (net.minecraftforge.gitversion) to your project.")
3030
.solution("If the Git Version plugin is applied, double check the Git Version Gradle plugin implementation.")
3131
.solution("Manually add in the necessary details to the generated workflow file.")
3232
.solution(HELP_MESSAGE));
@@ -41,7 +41,7 @@ RuntimeException pomUtilsGitVersionMissing(Exception e) {
4141
If the Git Version plugin has not been applied, the URL must be manually specified as the second parameter.""")
4242
.severity(Severity.ERROR)
4343
.stackLocation()
44-
.solution("Apply the Git Version Plugin (net.minecraftforge.gitversion) to your project.")
44+
.solution("Apply the Git Version Gradle plugin (net.minecraftforge.gitversion) to your project.")
4545
.solution("Manually add the remote URL in `addRemoteDetails`.")
4646
.solution(HELP_MESSAGE));
4747
}

0 commit comments

Comments
 (0)