[ 
https://issues.apache.org/jira/browse/MBUILDCACHE-22?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17604690#comment-17604690
 ] 

ASF GitHub Bot commented on MBUILDCACHE-22:
-------------------------------------------

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


##########
src/main/java/org/apache/maven/buildcache/CacheControllerImpl.java:
##########
@@ -153,37 +154,50 @@ public CacheControllerImpl(
     @Override
     @Nonnull
     public CacheResult findCachedBuild( MavenSession session, MavenProject 
project,
-            List<MojoExecution> mojoExecutions )
+            List<MojoExecution> mojoExecutions, boolean skipLookup )
     {
         final String highestRequestPhase = CacheUtils.getLast( mojoExecutions 
).getLifecyclePhase();
         if ( !lifecyclePhasesHelper.isLaterPhaseThanClean( highestRequestPhase 
) )
         {
             return empty();
         }
 
-        LOGGER.info( "Attempting to restore project from build cache" );
+        String projectName = getVersionlessProjectKey( project );
 
         ProjectsInputInfo inputInfo = projectInputCalculator.calculateInput( 
project );
 
         final CacheContext context = new CacheContext( project, inputInfo, 
session );
-        // remote build first
-        CacheResult result = findCachedBuild( mojoExecutions, context );
 
-        if ( !result.isSuccess() && result.getContext() != null )
+        CacheResult result = empty( context );
+        if ( !skipLookup )
         {
-            LOGGER.debug( "Remote cache is incomplete or missing, trying local 
build" );
 
-            CacheResult localBuild = findLocalBuild( mojoExecutions, context );
+            LOGGER.info( "Attempting to restore project {} from build cache", 
projectName );
 
-            if ( localBuild.isSuccess() || ( localBuild.isPartialSuccess() && 
!result.isPartialSuccess() ) )
-            {
-                result = localBuild;
-            }
-            else
+            // remote build first

Review Comment:
   could you please change this comment to something like `Published to central 
repository build first`





> Add possibility to skip cache lookup
> ------------------------------------
>
>                 Key: MBUILDCACHE-22
>                 URL: https://issues.apache.org/jira/browse/MBUILDCACHE-22
>             Project: Maven Build Cache Extension
>          Issue Type: New Feature
>          Components: remote build cache
>    Affects Versions: 1.0.0-alpha
>            Reporter: Alexander Eltsov
>            Priority: Major
>              Labels: pull-request-available
>
> Add ability to skip cache lookup for a particular module or whole project 
> (required to get some modules always built e.g. via a profile - e.g. I have 
> some additional artifacts published by CI).
> Alternatively it allows an easy "force" rebuild of a whole project
> The difference with not using cache is that results are put into cache, just 
> current matching versions are not taken from caches



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to