@@ -93,6 +93,7 @@ public MinecraftMaven(File output, boolean dependenciesOnly, File cacheRoot, Fil
9393 LOGGER .info (" JDK Cache: " + cache .jdks ().root ().getAbsolutePath ());
9494 LOGGER .info (" Offline: " + Mavenizer .isOffline ());
9595 LOGGER .info (" Cache Only: " + Mavenizer .isCacheOnly ());
96+ LOGGER .info (" Ignore Cache: " + Mavenizer .ignoreCache ());
9697 LOGGER .info (" Mappings: " + mappings );
9798 if (!foreignRepositories .isEmpty ())
9899 LOGGER .info (" Foreign Repos: [" + String .join (", " , foreignRepositories .values ()) + ']' );
@@ -119,8 +120,8 @@ public void run(Artifact artifact) {
119120 LOGGER .info ("Processing Minecraft dependency: %s:%s" .formatted (module , version ));
120121 Map <String , Supplier <String >> outputJson = null ;
121122 if (outputJsonFile != null ) {
122- outputJson = new HashMap <>();
123- outputJson .put ("spec" , () -> "1" );
123+ outputJson = new HashMap <>();
124+ outputJson .put ("spec" , () -> "1" );
124125 }
125126
126127 var mcprepo = new MCPConfigRepo (this .cache , dependenciesOnly );
@@ -134,19 +135,19 @@ public void run(Artifact artifact) {
134135 }
135136
136137 if (outputJson != null ) {
137- var finalized = new TreeMap <String , String >();
138- for (var entry : outputJson .entrySet ())
139- finalized .put (entry .getKey (), entry .getValue ().get ());
138+ var finalized = new TreeMap <String , String >();
139+ for (var entry : outputJson .entrySet ())
140+ finalized .put (entry .getKey (), entry .getValue ().get ());
140141
141- var parent = outputJsonFile .getParentFile ();
142- if (parent != null && !parent .exists ())
143- parent .mkdirs ();
142+ var parent = outputJsonFile .getParentFile ();
143+ if (parent != null && !parent .exists ())
144+ parent .mkdirs ();
144145
145146 try (var writer = new FileWriter (outputJsonFile )) {
146147 Util .GSON .toJson (finalized , writer );
147148 } catch (IOException e ) {
148- LOGGER .error ("Failed to write output json file: " + outputJsonFile .getAbsolutePath (), e );
149- Util .sneak (e );
149+ LOGGER .error ("Failed to write output json file: " + outputJsonFile .getAbsolutePath (), e );
150+ Util .sneak (e );
150151 }
151152 }
152153 }
@@ -160,8 +161,8 @@ protected void createForge(Artifact artifact, MCPConfigRepo mcprepo, ForgeRepo r
160161 throw new IllegalArgumentException ("No version specified for Forge" );
161162
162163 if ("all" .equals (version )) {
163- if (outputJson != null )
164- throw new IllegalArgumentException ("Output Json does not support bulk operations" );
164+ if (outputJson != null )
165+ throw new IllegalArgumentException ("Output Json does not support bulk operations" );
165166
166167 var versions = this .cache .maven ().getVersions (artifact );
167168 var mappingCache = new HashMap <String , Mappings >();
@@ -195,8 +196,8 @@ protected void createMinecraft(Artifact artifact, MCPConfigRepo mcprepo, Map<Str
195196 throw new IllegalArgumentException ("No version specified for Forge" );
196197
197198 if ("all" .equals (version )) {
198- if (outputJson != null )
199- throw new IllegalArgumentException ("Output Json does not support bulk operations" );
199+ if (outputJson != null )
200+ throw new IllegalArgumentException ("Output Json does not support bulk operations" );
200201
201202 var manifestFile = mcprepo .getLauncherManifestTask ().execute ();
202203 var manifest = JsonData .launcherManifest (manifestFile );
@@ -322,7 +323,7 @@ protected void finalize(Artifact module, Mappings mappings, List<Repo.PendingArt
322323 var cache = HashStore .fromFile (varTarget )
323324 .add ("source" , source );
324325
325- if (!varTarget . exists () || ! cache . isSame ( )) {
326+ if (!Mavenizer . checkCache ( varTarget , cache )) {
326327 variants .add (Artifact .from (artifact .getGroup (), artifact .getName (), artifact .getVersion ()));
327328 try {
328329 GradleModule .Variant [] data = JsonData .fromJson (source , GradleModule .Variant [].class );
@@ -377,6 +378,8 @@ private void updateFile(File target, File source, Artifact artifact) {
377378 } else {
378379 write = !target .exists () || !cache .isSame ();
379380 }
381+ if (Mavenizer .ignoreCache ())
382+ write = true ;
380383
381384 if (write ) {
382385 try {
@@ -399,7 +402,7 @@ private void writeStub(File target, File source, Artifact artifact) {
399402 .add ("tool" , tool )
400403 .add ("source" , source );
401404
402- if (target . exists () && cache . isSame ( ))
405+ if (Mavenizer . checkCache ( target , cache ))
403406 return ;
404407
405408 File jdk ;
@@ -431,7 +434,7 @@ private void writeAccessTransformed(File target, File source, Artifact artifact)
431434 .add (accessTransformer )
432435 .add ("source" , source );
433436
434- if (target . exists () && cache . isSame ( ))
437+ if (Mavenizer . checkCache ( target , cache ))
435438 return ;
436439
437440 File jdk ;
@@ -483,7 +486,7 @@ private void updateVariants(Artifact artifact) {
483486 cache .add (input );
484487 }
485488
486- if (target . exists () && cache . isSame ( ))
489+ if (Mavenizer . checkCache ( target , cache ))
487490 return ;
488491
489492 var module = GradleModule .of (artifact );
0 commit comments