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 4
4
*/
5
5
package net .minecraftforge .gradleutils ;
6
6
7
+ import org .gradle .api .Action ;
7
8
import org .gradle .api .publish .maven .MavenPublication ;
8
9
import org .gradle .api .tasks .TaskProvider ;
9
10
@@ -19,5 +20,19 @@ public sealed interface GradleUtilsExtensionForProject extends GradleUtilsExtens
19
20
///
20
21
/// @param publication The publication to promote
21
22
/// @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 );
23
38
}
Original file line number Diff line number Diff line change @@ -23,6 +23,7 @@ import org.gradle.api.publish.maven.tasks.PublishToMavenRepository
23
23
import org.gradle.api.tasks.TaskProvider
24
24
import org.gradle.authentication.http.BasicAuthentication
25
25
import org.gradle.initialization.layout.BuildLayout
26
+ import org.jetbrains.annotations.Nullable
26
27
27
28
import javax.inject.Inject
28
29
@@ -129,8 +130,11 @@ import static net.minecraftforge.gradleutils.GradleUtilsPlugin.LOGGER
129
130
}
130
131
131
132
@Override
132
- TaskProvider<? extends PromotePublication > promote (MavenPublication publication ) {
133
+ TaskProvider<? extends PromotePublication > promote (MavenPublication publication , @Nullable Action<? super PromotePublication > cfg ) {
133
134
this . project. tasks. register(' promote' + publication. name. capitalize(), PromotePublicationImpl ). tap { promote ->
135
+ if (cfg != = null )
136
+ promote. configure { cfg. execute(it) }
137
+
134
138
this . project. tasks. withType(PublishToMavenRepository ). configureEach { publish ->
135
139
// if the publish task's publication isn't this one and the repo name isn't 'forge', skip
136
140
// the name being 'forge' is enforced by gradle utils
You can’t perform that action at this time.
0 commit comments