From b8190c9e40ef02427522ff2764bda734eed90261 Mon Sep 17 00:00:00 2001 From: Googler Date: Thu, 15 Feb 2024 05:56:10 -0800 Subject: [PATCH] Remove CompositeRunfilesSupplier.of() and CompositeRunfilesSupplier.fromSuppliers(). These methods are not called from anywhere. RELNOTES: None. PiperOrigin-RevId: 607305445 Change-Id: I4feee8fddaab68bb594f0165af51455e65b50697 --- .../actions/CompositeRunfilesSupplier.java | 46 ------------------- 1 file changed, 46 deletions(-) diff --git a/src/main/java/com/google/devtools/build/lib/actions/CompositeRunfilesSupplier.java b/src/main/java/com/google/devtools/build/lib/actions/CompositeRunfilesSupplier.java index ec0c4faf520f99..b86200592bf274 100644 --- a/src/main/java/com/google/devtools/build/lib/actions/CompositeRunfilesSupplier.java +++ b/src/main/java/com/google/devtools/build/lib/actions/CompositeRunfilesSupplier.java @@ -14,16 +14,9 @@ package com.google.devtools.build.lib.actions; -import static com.google.common.collect.ImmutableList.toImmutableList; import com.google.common.collect.ImmutableList; -import com.google.common.collect.Iterables; -import com.google.devtools.build.lib.vfs.PathFragment; -import java.util.ArrayList; import java.util.Collection; -import java.util.HashSet; -import java.util.List; -import java.util.Set; /** A {@link RunfilesSupplier} implementation for composing multiple instances. */ public final class CompositeRunfilesSupplier implements RunfilesSupplier { @@ -43,45 +36,6 @@ public static RunfilesSupplier fromRunfilesTrees(Collection runfil return new CompositeRunfilesSupplier(ImmutableList.copyOf(runfilesTrees)); } - /** - * Create a composite {@link RunfilesSupplier} from a collection of suppliers. Suppliers earlier - * in the collection take precedence over later suppliers. - */ - public static RunfilesSupplier fromSuppliers(Collection suppliers) { - ImmutableList nonEmptySuppliers = - suppliers.stream() - .filter((s) -> s != EmptyRunfilesSupplier.INSTANCE) - .collect(toImmutableList()); - - if (nonEmptySuppliers.isEmpty()) { - return EmptyRunfilesSupplier.INSTANCE; - } - - if (nonEmptySuppliers.size() == 1) { - return Iterables.getOnlyElement(nonEmptySuppliers); - } - - Set execPaths = new HashSet<>(); - List trees = new ArrayList<>(); - - for (RunfilesSupplier supplier : nonEmptySuppliers) { - for (RunfilesTree tree : supplier.getRunfilesTrees()) { - if (execPaths.add(tree.getExecPath())) { - trees.add(tree); - } - } - } - - return new CompositeRunfilesSupplier(ImmutableList.copyOf(trees)); - } - - /** - * Convenience method for creating a composite {@link RunfilesSupplier} from two other suppliers. - */ - public static RunfilesSupplier of(RunfilesSupplier supplier1, RunfilesSupplier supplier2) { - return fromSuppliers(ImmutableList.of(supplier1, supplier2)); - } - /** * Create an instance combining all of {@code suppliers}, with earlier elements taking precedence. */