diff options
author | 2016-08-25 18:29:43 +0000 | |
---|---|---|
committer | 2016-08-25 20:21:30 +0000 | |
commit | 8ebfb43117a6d6a2597e0b54ebfbddf93922b98d (patch) | |
tree | 60c2ca4b69d0a9e0c9931b80ae5dfa6ba7370176 /src/test/java/com/google/devtools/build/lib/packages | |
parent | a6595116da5fb80554496cd69e4ab74b93c7b1e4 (diff) |
Some optimizations in Type#flatten (used under the covers by AggregatingAttributeMapper#visitLabels):
-Rename Type#flatten to Type#extractLabels.
-Change the return type of Type#extractLabels from Collection to Iterable. This way we don't need to create and concatenate large lists.
-Add an internal-only Type#containsLabels so this way ListType and DictType can have efficient implementations of Type#extractLabels.
Note that AggregatingAttributeMapper#visitLabels is called multiple times on the same in several different places during the lifetime of a non-incremental Blaze invocation (e.g. during Package loading, during transitive target visitation, etc)
--
MOS_MIGRATED_REVID=131311698
Diffstat (limited to 'src/test/java/com/google/devtools/build/lib/packages')
-rw-r--r-- | src/test/java/com/google/devtools/build/lib/packages/BuildTypeTest.java | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/test/java/com/google/devtools/build/lib/packages/BuildTypeTest.java b/src/test/java/com/google/devtools/build/lib/packages/BuildTypeTest.java index 089430dfdf..dfd4f28cef 100644 --- a/src/test/java/com/google/devtools/build/lib/packages/BuildTypeTest.java +++ b/src/test/java/com/google/devtools/build/lib/packages/BuildTypeTest.java @@ -66,7 +66,7 @@ public class BuildTypeTest { /* symlinkBehavior */ null, /* stripPrefix */ null); assertEquals(input, BuildType.FILESET_ENTRY.convert(input, null, currentRule)); - assertThat(BuildType.FILESET_ENTRY.flatten(input)).containsExactly(entryLabel); + assertThat(BuildType.FILESET_ENTRY.extractLabels(input)).containsExactly(entryLabel); } @Test @@ -90,7 +90,8 @@ public class BuildTypeTest { /* symlinkBehavior */ null, /* stripPrefix */ null)); assertEquals(input, BuildType.FILESET_ENTRY_LIST.convert(input, null, currentRule)); - assertThat(BuildType.FILESET_ENTRY_LIST.flatten(input)).containsExactly(entry1Label, entry2Label); + assertThat(BuildType.FILESET_ENTRY_LIST.extractLabels(input)).containsExactly( + entry1Label, entry2Label); } /** |