elharo commented on code in PR #412:
URL:
https://github.com/apache/maven-build-cache-extension/pull/412#discussion_r2577020102
##########
src/main/java/org/apache/maven/buildcache/BuildCacheMojosExecutionStrategy.java:
##########
@@ -260,13 +281,14 @@ private CacheRestorationStatus restoreProject(
cacheCandidate.getMojoDescriptor().getFullGoalName());
// need maven 4 as minumum
// mojoExecutionScope.seed(
- // org.apache.maven.api.plugin.Log.class,
- // new DefaultLog(LoggerFactory.getLogger(
- //
cacheCandidate.getMojoDescriptor().getFullGoalName())));
+ // org.apache.maven.api.plugin.Log.class,
+ // new DefaultLog(LoggerFactory.getLogger(
+ // cacheCandidate.getMojoDescriptor().getFullGoalName())));
Review Comment:
just delete the commented code
##########
src/main/java/org/apache/maven/buildcache/BuildCacheMojosExecutionStrategy.java:
##########
@@ -178,13 +182,30 @@ public void execute(
}
/**
- * Cache configuration could demand to restore some files in the project
directory (generated sources or even arbitrary content)
- * If an error occurs during or after this kind of restoration AND a clean
phase was required in the build :
- * we execute an extra clean phase to remove any potential partially
restored files
+ * Check if the current mojo execution is for the clean goal
+ *
+ * @param mojoExecutions the mojo executions
+ * @return true if the goal is clean and it is the only goal, false
otherwise
+ */
+ private boolean isGoalClean(List<MojoExecution> mojoExecutions) {
+ if (mojoExecutions.stream().allMatch(mojoExecution ->
"clean".equals(mojoExecution.getLifecyclePhase()))) {
+ LOGGER.warn("Build cache is disabled for 'clean' goal.");
+ return true;
+ }
+ return false;
+ }
+
+ /**
+ * Cache configuration could demand to restore some files in the project
+ * directory (generated sources or even arbitrary content)
+ * If an error occurs during or after this kind of restoration AND a clean
phase
+ * was required in the build :
Review Comment:
: - ,
##########
src/main/java/org/apache/maven/buildcache/BuildCacheMojosExecutionStrategy.java:
##########
@@ -178,13 +182,30 @@ public void execute(
}
/**
- * Cache configuration could demand to restore some files in the project
directory (generated sources or even arbitrary content)
- * If an error occurs during or after this kind of restoration AND a clean
phase was required in the build :
- * we execute an extra clean phase to remove any potential partially
restored files
+ * Check if the current mojo execution is for the clean goal
+ *
+ * @param mojoExecutions the mojo executions
+ * @return true if the goal is clean and it is the only goal, false
otherwise
+ */
+ private boolean isGoalClean(List<MojoExecution> mojoExecutions) {
+ if (mojoExecutions.stream().allMatch(mojoExecution ->
"clean".equals(mojoExecution.getLifecyclePhase()))) {
+ LOGGER.warn("Build cache is disabled for 'clean' goal.");
Review Comment:
Maybe info or debug level? Is a warning really needed here?
--
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]