AlexanderAshitkin commented on code in PR #92:
URL:
https://github.com/apache/maven-build-cache-extension/pull/92#discussion_r1310885217
##########
src/main/java/org/apache/maven/buildcache/BuildCacheMojosExecutionStrategy.java:
##########
@@ -206,31 +259,20 @@ private boolean restoreProject(
// org.apache.maven.api.MojoExecution.class, new
DefaultMojoExecution(cacheCandidate));
mojoExecutionRunner.run(cacheCandidate);
} else {
- restored = verifyCacheConsistency(
- cacheCandidate, build, project, session,
mojoExecutionRunner, cacheConfig);
- if (!restored) {
- break;
- }
- }
- }
-
- if (!restored) {
- // cleanup partial state
- project.getArtifact().setFile(null);
- project.getArtifact().setResolved(false);
- mojoListener.remove(project);
- // build as usual
- for (MojoExecution mojoExecution : cachedSegment) {
- mojoExecutionRunner.run(mojoExecution);
+ LOGGER.info(
+ "Skipping plugin execution (cached): {}",
+
cacheCandidate.getMojoDescriptor().getFullGoalName());
}
}
+ // Execute mojos after the cache segment
+ LOGGER.debug("Execute mojos post cache segment");
List<MojoExecution> postCachedSegment =
lifecyclePhasesHelper.getPostCachedSegment(project,
mojoExecutions, build);
for (MojoExecution mojoExecution : postCachedSegment) {
Review Comment:
@kbuntrock, it is out of scope, but please notice two edge cases here:
* A post-cached segment is possible if initially the build was cached at,
say `package` phase and the current build runs a later phase, say `install`. In
that case, the best behavior is to update the cached build with the more
complete version, which won't happen in the `SUCCESS` case - maybe we need a
separate status.
* The same for forced executions - even if the execution is forced, the mojo
configuration could be not consistent with the cached one. If it is not
consistent, it could be desirable to update the cache. We shouldn't update the
cache on discrepancies only if configs prohibit it.
--
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]