| 
142 | 142 | import java.util.concurrent.Phaser;  | 
143 | 143 | import java.util.concurrent.atomic.AtomicBoolean;  | 
144 | 144 | import java.util.function.Predicate;  | 
145 |  | -import java.util.regex.Matcher;  | 
146 | 145 | import java.util.regex.Pattern;  | 
147 | 146 | import javax.annotation.Nullable;  | 
148 | 147 | 
 
  | 
@@ -215,18 +214,25 @@ public RemoteExecutionService(  | 
215 | 214 | 
 
  | 
216 | 215 |     this.scheduler = Schedulers.from(executor, /*interruptibleWorker=*/ true);  | 
217 | 216 | 
 
  | 
218 |  | -    String regex = remoteOptions.remoteDownloadRegex;  | 
219 | 217 |     // TODO(bazel-team): Consider adding a warning or more validation if the remoteDownloadRegex is  | 
220 |  | -    // used without RemoteOutputsMode.MINIMAL.  | 
221 |  | -    this.shouldForceDownloads =  | 
222 |  | -        !regex.isEmpty()  | 
223 |  | -            && (remoteOptions.remoteOutputsMode == RemoteOutputsMode.MINIMAL  | 
224 |  | -                || remoteOptions.remoteOutputsMode == RemoteOutputsMode.TOPLEVEL);  | 
225 |  | -    Pattern pattern = Pattern.compile(regex);  | 
 | 218 | +    // used without Build without the Bytes.  | 
 | 219 | +    ImmutableList.Builder<Pattern> builder = ImmutableList.builder();  | 
 | 220 | +    if (remoteOptions.remoteOutputsMode == RemoteOutputsMode.MINIMAL  | 
 | 221 | +        || remoteOptions.remoteOutputsMode == RemoteOutputsMode.TOPLEVEL) {  | 
 | 222 | +      for (String regex : remoteOptions.remoteDownloadRegex) {  | 
 | 223 | +        builder.add(Pattern.compile(regex));  | 
 | 224 | +      }  | 
 | 225 | +    }  | 
 | 226 | +    ImmutableList<Pattern> patterns = builder.build();  | 
 | 227 | +    this.shouldForceDownloads = !patterns.isEmpty();  | 
226 | 228 |     this.shouldForceDownloadPredicate =  | 
227 | 229 |         path -> {  | 
228 |  | -          Matcher m = pattern.matcher(path);  | 
229 |  | -          return m.matches();  | 
 | 230 | +          for (Pattern pattern : patterns) {  | 
 | 231 | +            if (pattern.matcher(path).matches()) {  | 
 | 232 | +              return true;  | 
 | 233 | +            }  | 
 | 234 | +          }  | 
 | 235 | +          return false;  | 
230 | 236 |         };  | 
231 | 237 |   }  | 
232 | 238 | 
 
  | 
 | 
0 commit comments