AlexanderAshitkin commented on code in PR #92:
URL: 
https://github.com/apache/maven-build-cache-extension/pull/92#discussion_r1303474693


##########
src/main/java/org/apache/maven/buildcache/BuildCacheMojosExecutionStrategy.java:
##########
@@ -129,7 +129,8 @@ public void execute(
             boolean restored = result.isSuccess(); // if partially restored 
need to save increment
             if (restorable) {
                 restored &= restoreProject(result, mojoExecutions, 
mojoExecutionRunner, cacheConfig);
-            } else {
+            }
+            if (!restored) {

Review Comment:
   Some clarifications about the current implementation:
   * Logic of rerunning on failures is already within the 
BuildCacheMojosExecutionStrategy#restoreProject:
   ```java
   if (!restored) {
       // cleanup partial state
       project.getArtifact().setFile(null);
       project.getArtifact().setResolved(false);
       mojoListener.remove(project);
       // build as usual
       for (MojoExecution mojoExecution : cachedSegment) { <<< rebuilding 
everything
           mojoExecutionRunner.run(mojoExecution);
       }
   }
   ```
   * `!restored` condition should be read as "at least part of the project were 
rebuilt, not restored"
   * It doesn't mean an error automatically, it means something was rebuilt (at 
least in the design). 100% successful completion of the `restoreProject` could 
return `false`. 
   
   So, in all, it feels like we might need fixes within the `restoreProject`:
   1) to implement proper clean phase
   2) Add a verification step to the "forced" steps - to force cache update on 
the detected inconsistencies
   3) Make sure that in case of additional executions ("post-cached" or 
similar), we return `false` to update the cache.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to