File tree Expand file tree Collapse file tree 2 files changed +21
-2
lines changed
src/main/groovy/net/minecraftforge/gradleutils Expand file tree Collapse file tree 2 files changed +21
-2
lines changed Original file line number Diff line number Diff line change 44 */
55package net .minecraftforge .gradleutils ;
66
7+ import org .gradle .api .Action ;
78import org .gradle .api .publish .maven .MavenPublication ;
89import org .gradle .api .tasks .TaskProvider ;
910
@@ -19,5 +20,19 @@ public sealed interface GradleUtilsExtensionForProject extends GradleUtilsExtens
1920 ///
2021 /// @param publication The publication to promote
2122 /// @return The provider for the promotion task
22- TaskProvider <? extends PromotePublication > promote (MavenPublication publication );
23+ default TaskProvider <? extends PromotePublication > promote (MavenPublication publication ) {
24+ return this .promote (publication , null );
25+ }
26+
27+ /// Promotes a publication to the <a href="https://files.minecraftforge.net">Forge Files Site</a>.
28+ ///
29+ /// Publications that are promoted will automatically have the relevant task added as a finalizer to the
30+ /// `publishPublicationToForgeRepository` task, where the publication matches the task's publication and the
31+ /// repository name is "forge". The publishing Forge repo added via [GradleUtilsExtension#getPublishingForgeMaven]
32+ /// always sets it with the name "forge".
33+ ///
34+ /// @param publication The publication to promote
35+ /// @param cfg A configuring action for the task
36+ /// @return The provider for the promotion task
37+ TaskProvider <? extends PromotePublication > promote (MavenPublication publication , Action <? super PromotePublication > cfg );
2338}
Original file line number Diff line number Diff line change @@ -23,6 +23,7 @@ import org.gradle.api.publish.maven.tasks.PublishToMavenRepository
2323import org.gradle.api.tasks.TaskProvider
2424import org.gradle.authentication.http.BasicAuthentication
2525import org.gradle.initialization.layout.BuildLayout
26+ import org.jetbrains.annotations.Nullable
2627
2728import javax.inject.Inject
2829
@@ -129,8 +130,11 @@ import static net.minecraftforge.gradleutils.GradleUtilsPlugin.LOGGER
129130 }
130131
131132 @Override
132- TaskProvider<? extends PromotePublication > promote (MavenPublication publication ) {
133+ TaskProvider<? extends PromotePublication > promote (MavenPublication publication , @Nullable Action<? super PromotePublication > cfg ) {
133134 this . project. tasks. register(' promote' + publication. name. capitalize(), PromotePublicationImpl ). tap { promote ->
135+ if (cfg != = null )
136+ promote. configure { cfg. execute(it) }
137+
134138 this . project. tasks. withType(PublishToMavenRepository ). configureEach { publish ->
135139 // if the publish task's publication isn't this one and the repo name isn't 'forge', skip
136140 // the name being 'forge' is enforced by gradle utils
You can’t perform that action at this time.
0 commit comments