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