You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by gn...@apache.org on 2022/05/17 07:49:22 UTC

[maven-build-cache-extension] 02/02: [MBUILDCACHE-20] Use local cache before remote cache

This is an automated email from the ASF dual-hosted git repository.

gnodet pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/maven-build-cache-extension.git

commit abe934cd4088a42d778d50dc4cc0aa2385388e89
Author: Guillaume Nodet <gn...@gmail.com>
AuthorDate: Mon May 16 20:58:19 2022 +0200

    [MBUILDCACHE-20] Use local cache before remote cache
---
 .../org/apache/maven/buildcache/CacheControllerImpl.java   | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/src/main/java/org/apache/maven/buildcache/CacheControllerImpl.java b/src/main/java/org/apache/maven/buildcache/CacheControllerImpl.java
index 8cfb145..2e5762b 100644
--- a/src/main/java/org/apache/maven/buildcache/CacheControllerImpl.java
+++ b/src/main/java/org/apache/maven/buildcache/CacheControllerImpl.java
@@ -166,22 +166,22 @@ public class CacheControllerImpl implements CacheController
         ProjectsInputInfo inputInfo = projectInputCalculator.calculateInput( project );
 
         final CacheContext context = new CacheContext( project, inputInfo, session );
-        // remote build first
-        CacheResult result = findCachedBuild( mojoExecutions, context );
+        // local build first
+        CacheResult result = findLocalBuild( mojoExecutions, context );
 
         if ( !result.isSuccess() && result.getContext() != null )
         {
-            LOGGER.debug( "Remote cache is incomplete or missing, trying local build" );
+            LOGGER.debug( "Local cache is incomplete or missing, trying remote build" );
 
-            CacheResult localBuild = findLocalBuild( mojoExecutions, context );
+            CacheResult remoteBuild = findCachedBuild( mojoExecutions, context );
 
-            if ( localBuild.isSuccess() || ( localBuild.isPartialSuccess() && !result.isPartialSuccess() ) )
+            if ( remoteBuild.isSuccess() || ( remoteBuild.isPartialSuccess() && !result.isPartialSuccess() ) )
             {
-                result = localBuild;
+                result = remoteBuild;
             }
             else
             {
-                LOGGER.info( "Local build was not found by checksum " + inputInfo.getChecksum() );
+                LOGGER.info( "Remote build was not found by checksum " + inputInfo.getChecksum() );
             }
         }
         cacheResults.put( getVersionlessProjectKey( project ), result );