3434import org .gradle .api .attributes .Attribute ;
3535import org .gradle .api .file .Directory ;
3636import org .gradle .api .file .DirectoryProperty ;
37- import org .gradle .api .file .FileSystemLocationProperty ;
3837import org .gradle .api .file .ProjectLayout ;
39- import org .gradle .api .file .RegularFileProperty ;
4038import org .gradle .api .model .ObjectFactory ;
4139import org .gradle .api .plugins .JavaPlugin ;
4240import org .gradle .api .plugins .JavaPluginExtension ;
5048import org .gradle .api .tasks .compile .JavaCompile ;
5149import org .gradle .language .base .plugins .LifecycleBasePlugin ;
5250import org .gradle .plugins .ide .eclipse .model .EclipseModel ;
53- import org .jetbrains .annotations .Nullable ;
5451import org .jetbrains .annotations .VisibleForTesting ;
5552
5653import javax .inject .Inject ;
@@ -117,15 +114,11 @@ private void setup(ForgeDevPlugin plugin, Project project) {
117114 var downloadClientMappings = tasks .register ("downloadClientMappings" , DownloadMappings .class , task -> task .getSide ().set ("client" ));
118115 var downloadServerMappings = tasks .register ("downloadServerMappings" , DownloadMappings .class , task -> task .getSide ().set ("server" ));
119116
120- var syncMavenizer = tasks .register ("syncMavenizer" , MavenizerMCPMaven .class );
121- var syncMavenizerForExtra = tasks .register ("syncMavenizerForExtra" , MavenizerMCPMaven .class );
122- var syncMappingsMaven = tasks .register ("syncMappingsMaven" , MavenizerSyncMappings .class );
123- Util .runFirst (project , syncMavenizer );
124- Util .runFirst (project , syncMavenizerForExtra );
125- Util .runFirst (project , syncMappingsMaven );
117+ var syncMavenizer = Util .runFirst (project , tasks .register ("syncMavenizer" , MavenizerMCPMaven .class ));
118+ var syncMavenizerForExtra = Util .runFirst (project , tasks .register ("syncMavenizerForExtra" , MavenizerMCPMaven .class ));
119+ var syncMappingsMaven = Util .runFirst (project , tasks .register ("syncMappingsMaven" , MavenizerSyncMappings .class ));
126120 var minecraftDepsConfiguration = project .getConfigurations ().detachedConfiguration ();
127121 var mappingsConfiguration = project .getConfigurations ().detachedConfiguration ();
128- var mappingsZipFile = this .getProviders ().provider (mappingsConfiguration ::getSingleFile );
129122
130123 var applyPatches = tasks .register ("applyPatches" , ApplyPatches .class , task -> {
131124 final Provider <Directory > workDir = project .getLayout ().getBuildDirectory ().dir (task .getName ());
@@ -144,8 +137,10 @@ private void setup(ForgeDevPlugin plugin, Project project) {
144137 });
145138
146139 var toMCPConfig = tasks .register ("srg2mcp" , LegacyApplyMappings .class , task -> {
140+ task .dependsOn (syncMappingsMaven );
141+
147142 task .getInput ().set (applyPatches .flatMap (ApplyPatches ::getOutput ));
148- task .getMappingsZip ().fileProvider ( mappingsZipFile );
143+ task .getMappings ().setFrom ( mappingsConfiguration );
149144 task .getLambdas ().set (false );
150145 });
151146 var extractMapped = tasks .register ("extractMapped" , LegacyExtractZip .class , task -> {
@@ -210,6 +205,8 @@ private void setup(ForgeDevPlugin plugin, Project project) {
210205 });
211206
212207 var reobfJar = tasks .register ("reobfJar" , LegacyReobfuscateJar .class , task -> {
208+ task .dependsOn (syncMavenizer );
209+
213210 task .getInput ().set (jar .flatMap (Jar ::getArchiveFile ));
214211 task .getLibraries ().from (minecraftDepsConfiguration );
215212 task .getOutput ().convention (task .getDefaultOutputFile ());
@@ -367,7 +364,11 @@ private void setup(ForgeDevPlugin plugin, Project project) {
367364 // This was actually filtering the PARENT jar file. Since we don't support parent Patchers anymore, this is not needed.
368365 //filterNew.configure(task -> task.getBlacklist().from(jar.flatMap(AbstractArchiveTask::getArchiveFile)));
369366
370- tasks .withType (LegacyGenerateSRG .class , task -> task .getMappingsZip ().fileProvider (mappingsZipFile ));
367+ tasks .withType (LegacyGenerateSRG .class , task -> {
368+ task .dependsOn (syncMappingsMaven );
369+
370+ task .getMappings ().setFrom (mappingsConfiguration );
371+ });
371372
372373 createMcp2Obf .configure (task -> task .getMcpSrgData ().convention (createMcp2Srg .flatMap (LegacyGenerateSRG ::getMcpSrgData )));
373374 createSrg2Mcp .configure (task -> task .getMcpSrgData ().convention (createMcp2Srg .flatMap (LegacyGenerateSRG ::getMcpSrgData )));
@@ -454,8 +455,10 @@ private void setup(ForgeDevPlugin plugin, Project project) {
454455 } else {
455456 // Remap the 'clean' with out mappings.
456457 TaskProvider <LegacyApplyMappings > toMCPClean = tasks .register ("srg2mcpClean" , LegacyApplyMappings .class , task -> {
458+ task .dependsOn (syncMappingsMaven );
459+
457460 task .getInput ().set (legacyPatcher .getCleanSrc ());
458- task .getMappingsZip ().fileProvider ( mappingsZipFile );
461+ task .getMappings ().setFrom ( mappingsConfiguration );
459462 task .getLambdas ().set (false );
460463 });
461464
0 commit comments