77import groovy .lang .Closure ;
88import groovy .lang .DelegatesTo ;
99import groovy .transform .stc .ClosureParams ;
10- import groovy .transform .stc .FromString ;
1110import groovy .transform .stc .SimpleType ;
1211import net .minecraftforge .gradleutils .shared .Closures ;
1312import org .gradle .api .Action ;
14- import org .gradle .api .NamedDomainObjectContainer ;
1513import org .gradle .api .artifacts .ExternalModuleDependency ;
16- import org .gradle .api .provider .Provider ;
1714
1815/// [Project][org.gradle.api.Project]-specific additions for the Minecraft extension. These will be accessible from the
1916/// `minecraft` DSL object within your project's buildscript.
@@ -28,7 +25,26 @@ public interface MinecraftExtensionForProject extends MinecraftExtension, Minecr
2825 /// @return The dependency
2926 /// @see <a href="https://docs.gradle.org/current/userguide/declaring_dependencies.html">Declaring Dependencies
3027 /// in Gradle</a>
31- Provider <ExternalModuleDependency > dependency (
28+ default MavenizerInstance dependency (
29+ Object value ,
30+ @ DelegatesTo (ExternalModuleDependency .class )
31+ @ ClosureParams (value = SimpleType .class , options = "net.minecraftforge.gradle.ClosureOwner.MinecraftDependency" )
32+ Closure <?> closure
33+ ) {
34+ return this .dependency ("default" , value , closure );
35+ }
36+
37+ /// Creates (or marks if existing) the given dependency as a Minecraft dependency and configures it with the given
38+ /// closure.
39+ ///
40+ /// @param name The name to give the Mavenizer instance used to generate the dependency
41+ /// @param value The dependency
42+ /// @param closure The closure to configure the dependency with
43+ /// @return The dependency
44+ /// @see <a href="https://docs.gradle.org/current/userguide/declaring_dependencies.html">Declaring Dependencies
45+ /// in Gradle</a>
46+ MavenizerInstance dependency (
47+ String name ,
3248 Object value ,
3349 @ DelegatesTo (ExternalModuleDependency .class )
3450 @ ClosureParams (value = SimpleType .class , options = "net.minecraftforge.gradle.ClosureOwner.MinecraftDependency" )
@@ -43,17 +59,56 @@ Provider<ExternalModuleDependency> dependency(
4359 /// @return The dependency
4460 /// @see <a href="https://docs.gradle.org/current/userguide/declaring_dependencies.html">Declaring Dependencies
4561 /// in Gradle</a>
46- default Provider <ExternalModuleDependency > dependency (Object value , Action <? super ClosureOwner .MinecraftDependency > action ) {
47- return this .dependency (value , Closures .action (this , action ));
62+ default MavenizerInstance dependency (Object value , Action <? super ClosureOwner .MinecraftDependency > action ) {
63+ return this .dependency ("default" , value , action );
64+ }
65+
66+ /// Creates (or marks if existing) the given dependency as a Minecraft dependency and applies the given action to
67+ /// it.
68+ ///
69+ /// @param name The name to give the Mavenizer instance used to generate the dependency
70+ /// @param value The dependency
71+ /// @param action The action to apply to the dependency attributes
72+ /// @return The dependency
73+ /// @see <a href="https://docs.gradle.org/current/userguide/declaring_dependencies.html">Declaring Dependencies
74+ /// in Gradle</a>
75+ default MavenizerInstance dependency (String name , Object value , Action <? super ClosureOwner .MinecraftDependency > action ) {
76+ return this .dependency (name , value , Closures .action (this , action ));
77+ }
78+
79+ /// Creates (or marks if existing) the given dependency as a Minecraft dependency.
80+ ///
81+ /// @param value The dependency
82+ /// @return The dependency
83+ /// @see <a href="https://docs.gradle.org/current/userguide/declaring_dependencies.html">Declaring Dependencies
84+ /// in Gradle</a>
85+ default MavenizerInstance dependency (Object value ) {
86+ return this .dependency ("default" , value );
4887 }
4988
5089 /// Creates (or marks if existing) the given dependency as a Minecraft dependency.
5190 ///
91+ /// @param name The name to give the Mavenizer instance used to generate the dependency
5292 /// @param value The dependency
5393 /// @return The dependency
5494 /// @see <a href="https://docs.gradle.org/current/userguide/declaring_dependencies.html">Declaring Dependencies
5595 /// in Gradle</a>
56- default Provider < ExternalModuleDependency > dependency (Object value ) {
57- return this .dependency (value , Closures .empty (this ));
96+ default MavenizerInstance dependency (String name , Object value ) {
97+ return this .dependency (name , value , Closures .empty (this ));
5898 }
99+
100+ /// Gets the default Minecraft dependency that was created using one of the [#dependency] methods.
101+ ///
102+ /// @return The default Minecraft dependency
103+ /// @throws java.util.NoSuchElementException If the default Minecraft dependency has not yet been created.
104+ /// @see #getDependency(String)
105+ default MavenizerInstance getDependency () {
106+ return this .getDependency ("default" );
107+ }
108+
109+ /// Gets the named Minecraft dependency that was created using one of the [#dependency] methods.
110+ ///
111+ /// @return The default Minecraft dependency
112+ /// @throws java.util.NoSuchElementException If the named Minecraft dependency has not yet been created.
113+ MavenizerInstance getDependency (String name );
59114}
0 commit comments