diff options
author | Michael Staib <mstaib@google.com> | 2016-07-22 20:34:18 +0000 |
---|---|---|
committer | Damien Martin-Guillerez <dmarting@google.com> | 2016-07-25 11:40:01 +0000 |
commit | 33ac07ccfe4825aa078643c40b2bd230b380de48 (patch) | |
tree | 1fbb65c5b560ce1503fe30ac88d822e081a89cf1 /src/main/java/com/google/devtools/build/lib/util | |
parent | 6054ff324f42dddc8e8e4b85076e7304a2958ab9 (diff) |
Be less naive with CcLibraryHelper precompiled library collision detection.
The naive algorithm was O(n*m) where n = number of precompiled libraries and
m = number of libraries linked during this rule. Ugly!
This one provides hopefully much more reasonable performance.
--
MOS_MIGRATED_REVID=128206057
Diffstat (limited to 'src/main/java/com/google/devtools/build/lib/util')
-rw-r--r-- | src/main/java/com/google/devtools/build/lib/util/FileType.java | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/util/FileType.java b/src/main/java/com/google/devtools/build/lib/util/FileType.java index b8b4fdc119..b984e98d70 100644 --- a/src/main/java/com/google/devtools/build/lib/util/FileType.java +++ b/src/main/java/com/google/devtools/build/lib/util/FileType.java @@ -14,6 +14,7 @@ package com.google.devtools.build.lib.util; +import com.google.common.base.Function; import com.google.common.base.Predicate; import com.google.common.base.Predicates; import com.google.common.collect.ImmutableList; @@ -129,6 +130,14 @@ public abstract class FileType implements Predicate<String> { String getFilename(); } + public static final Function<HasFilename, String> TO_FILENAME = + new Function<HasFilename, String>() { + @Override + public String apply(HasFilename input) { + return input.getFilename(); + } + }; + /** * Checks whether an Iterable<? extends HasFileType> contains any of the specified file types. * |