Commit e09fae49 authored by Tiger Oakes's avatar Tiger Oakes Committed by Commit Bot

Follow OWNERS file references in supersize

OWNERS files can reference other OWNERS files rather than duplicating
their content. If a COMPONENT is not found in an OWNERS file, the
reference is followed to try to find a COMPONENT.

Bug: 860303
Change-Id: Ia676156a4a3945c85409dd93f5ee9f407faa94a8
Reviewed-on: https://chromium-review.googlesource.com/1134093Reviewed-by: default avataragrieve <agrieve@chromium.org>
Reviewed-by: default avatarEric Stevenson <estevenson@chromium.org>
Commit-Queue: agrieve <agrieve@chromium.org>
Cr-Commit-Position: refs/heads/master@{#576287}
parent 118eb6a3
webvr_info @ c58ae99b
Subproject commit c58ae99b9ff9e2aa4c524633519570bf33536248
webxr_samples @ cf02f19c
Subproject commit cf02f19c4ff6894705a9407722ab52551e010c60
......@@ -37,7 +37,8 @@ sys.path.insert(1, os.path.join(path_util.SRC_ROOT, 'tools', 'grit'))
from grit.format import data_pack
_OWNERS_FILENAME = 'OWNERS'
_COMPONENT_REGEX = re.compile('\s*#\s*COMPONENT\s*:\s*(\S+)')
_COMPONENT_REGEX = re.compile(r'\s*#\s*COMPONENT\s*:\s*(\S+)')
_FILE_PATH_REGEX = re.compile(r'\s*file://(\S+)')
# Holds computation state that is live only when an output directory exists.
_OutputDirectoryContext = collections.namedtuple('_OutputDirectoryContext', [
......@@ -551,17 +552,33 @@ def _CalculatePadding(raw_symbols):
def _ParseComponentFromOwners(filename):
"""Searches an OWNERS file for lines that start with `# COMPONENT:`.
If an OWNERS file has no COMPONENT but references another OWNERS file, follow
the reference and check that file instead.
Args:
filename: Path to the file to parse.
Returns:
The text that follows the `# COMPONENT:` prefix, such as 'component>name'
"""
with open(filename) as f:
for line in f:
component_matches = _COMPONENT_REGEX.match(line)
if component_matches:
return component_matches.group(1)
return ''
The text that follows the `# COMPONENT:` prefix, such as 'component>name'.
Empty string if no component found or the file didn't exist.
"""
reference_paths = []
try:
with open(filename) as f:
for line in f:
component_matches = _COMPONENT_REGEX.match(line)
path_matches = _FILE_PATH_REGEX.match(line)
if component_matches:
return component_matches.group(1)
elif path_matches:
reference_paths.append(path_matches.group(1))
except IOError:
return ''
if len(reference_paths) == 1:
newpath = os.path.join(path_util.SRC_ROOT, reference_paths[0])
return _ParseComponentFromOwners(newpath)
else:
return ''
def _FindComponentRoot(start_path, cache, knobs):
......@@ -587,13 +604,10 @@ def _FindComponentRoot(start_path, cache, knobs):
return cached_component
elif cached_component is None:
owners_path = os.path.join(knobs.src_root, test_dir, _OWNERS_FILENAME)
if os.path.isfile(owners_path):
component = _ParseComponentFromOwners(owners_path)
cache[test_dir] = component
if component:
return component
else:
cache[test_dir] = ''
component = _ParseComponentFromOwners(owners_path)
cache[test_dir] = component
if component:
return component
prev_dir = test_dir
test_dir = os.path.dirname(test_dir)
return ''
......
......@@ -56,7 +56,7 @@ Print(c[-1].GroupedByPath(depth=2).Sorted())
# For even more inspiration, look at canned_queries.py
# (and feel free to add your own!).
0: (.rodata@266e600(size_without_padding=5,padding=0,full_name=string literal,object_path=base/base/page_allocator.o,source_path=base/page_allocator.cc,flags={},num_aliases=2,component=), 'Str1\x00')
0: (.rodata@266e600(size_without_padding=5,padding=0,full_name=string literal,object_path=base/base/page_allocator.o,source_path=base/page_allocator.cc,flags={},num_aliases=2,component=Blink>Internal), 'Str1\x00')
1: (.rodata@266e605(size_without_padding=16,padding=0,full_name=string literal,object_path=third_party/icu/icuuc/ucnv_ext.o,source_path=third_party/icu/ucnv_ext.c,flags={gen},num_aliases=1,component=Internal>Android), 'String literal2\x00')
Metadata:
elf_arch=arm
......@@ -94,13 +94,13 @@ Index | Running Total | Section@Address | PSS | Path
------------------------------------------------------------
0) 4 (0.0%) d@0x2de7000 4 base/page_allocator.cc
google::protobuf::internal::pLinuxKernelCmpxchg
1) 8 (0.0%) d@0x2de7004 4 third_party/container.c
1) 8 (0.0%) d@0x2de7004 4 third_party/container/container.c
google::protobuf::internal::pLinuxKernelMemoryBarrier
2) 160 (0.0%) d@0x2de7008 152 third_party/container.c
2) 160 (0.0%) d@0x2de7008 152 third_party/container/container.c
base::android::kBaseRegisteredMethods
3) 164 (0.0%) d@0x2de70a0 4 third_party/container.c
3) 164 (0.0%) d@0x2de70a0 4 third_party/container/container.c
base::android::g_renderer_histogram_code
4) 168 (0.0%) d@0x2de70a4 4 third_party/container.c
4) 168 (0.0%) d@0x2de70a4 4 third_party/container/container.c
base::android::g_library_version_number
5) 101768 (0.1%) d@0x2dffd88 101600 {no path}
** symbol gap 0 (end of section)
......@@ -116,7 +116,7 @@ Index | Running Total | Section@Address | PSS | Path
ChromeMainDelegate [vtable]
11) 1167072 (1.5%) R@0x2c17728 24 $root_gen_dir/third_party/icu/ucnv_ext.c
chrome::mojom::FieldTrialRecorder [vtable]
12) 1956976 (2.5%) R@0x2c17740 789904 third_party/container.c
12) 1956976 (2.5%) R@0x2c17740 789904 third_party/container/container.c
chrome::mojom::FieldTrialRecorderProxy [vtable]
13) 1957008 (2.5%) R@0x2cd84e0 32 third_party/gvr-android-sdk/libgvr_shim_static_arm.a/libcontroller_api_impl.a_controller_api_impl.o
.Lswitch.table.45
......@@ -139,7 +139,7 @@ Index | Running Total | Section@Address | PSS | Path
22) 41192719 (53.0%) r@0x284e364 8 base/page_allocator.cc
23) 41192763 (53.0%) r@0x284e370 44 base/page_allocator.cc
Name
24) 41192795 (53.0%) r@0x284e398 32 third_party/container.c
24) 41192795 (53.0%) r@0x284e398 32 third_party/container/container.c
chrome::mojom::FilePatcher::Name_
25) 41868835 (53.8%) r@0x28f3450 676040 third_party/paint.cc
kAnimationFrameTimeHistogramClassPath
......@@ -175,9 +175,9 @@ Index | Running Total | Section@Address | PSS | Path
blink::ContiguousContainerBase::shrinkToFit (num_aliases=4)
41) 77769429 (100.0%) t@0x2a0010 3 (size=12) third_party/paint.cc
blink::ContiguousContainerBase::shrinkToFit (num_aliases=4)
42) 77769457 (100.0%) t@0x2a0020 28 third_party/container.c
42) 77769457 (100.0%) t@0x2a0020 28 third_party/container/container.c
blink::ContiguousContainerBase::ContiguousContainerBase
43) 77769551 (100.0%) t@0x2a1000 94 third_party/container.c
43) 77769551 (100.0%) t@0x2a1000 94 third_party/container/container.c
blink::PaintChunker::releasePaintChunks
44) 77769551 (100.0%) b@0x0 262144 third_party/fft_float.cc
ff_cos_131072
......
......@@ -44,7 +44,7 @@ Number of unique symbols 44 -> 43 (-1)
0 paths added, 0 removed, 2 changed
Changed files:
third_party/container.c
third_party/container/container.c
Showing 7 symbols (5 -> 4 unique) with total pss: 38 bytes
Histogram of symbols based on PSS:
......@@ -56,13 +56,13 @@ Section Legend: t=.text, r=.rodata, R=.data.rel.ro, d=.data, b=.bss
Index | Running Total | Section@Address | ...
------------------------------------------------------------
~ 0) 10 (26.3%) r@0x284e398 +10 (22->32) num_aliases=1
source_path=third_party/container.c object_path=third_party/sub/ContiguousContainer.o
source_path=third_party/container/container.c object_path=third_party/sub/ContiguousContainer.o
flags={} name=chrome::mojom::FilePatcher::Name_
+ 1) 14 (36.8%) d@0x2de7000 +4 (0->4) num_aliases=1
source_path=base/page_allocator.cc object_path=base/base/page_allocator.o
flags={} name=google::protobuf::internal::pLinuxKernelCmpxchg
+ 2) 18 (47.4%) d@0x2de7004 +4 (0->4) num_aliases=1
source_path=third_party/container.c object_path=third_party/sub/ContiguousContainer.o
source_path=third_party/container/container.c object_path=third_party/sub/ContiguousContainer.o
flags={} name=google::protobuf::internal::pLinuxKernelMemoryBarrier
~ 3) 38 (100.0%) d@0x2dffd88 20 (0->0) num_aliases=1
source_path= object_path=
......
......@@ -87,16 +87,16 @@ Index | Running Total | Section@Address | ...
source_path=base/page_allocator.cc object_path=base/base/page_allocator.o
flags={} name=google::protobuf::internal::pLinuxKernelCmpxchg
1) 8 (0.0%) d@0x2de7004 pss=4 padding=0 num_aliases=1
source_path=third_party/container.c object_path=third_party/sub/ContiguousContainer.o
source_path=third_party/container/container.c object_path=third_party/sub/ContiguousContainer.o
flags={} name=google::protobuf::internal::pLinuxKernelMemoryBarrier
2) 160 (0.0%) d@0x2de7008 pss=152 padding=0 num_aliases=1
source_path=third_party/container.c object_path=third_party/sub/ContiguousContainer.o
source_path=third_party/container/container.c object_path=third_party/sub/ContiguousContainer.o
flags={rel} name=base::android::kBaseRegisteredMethods
3) 164 (0.0%) d@0x2de70a0 pss=4 padding=0 num_aliases=1
source_path=third_party/container.c object_path=third_party/sub/ContiguousContainer.o
source_path=third_party/container/container.c object_path=third_party/sub/ContiguousContainer.o
flags={anon} name=base::android::g_renderer_histogram_code
4) 168 (0.0%) d@0x2de70a4 pss=4 padding=0 num_aliases=1
source_path=third_party/container.c object_path=third_party/sub/ContiguousContainer.o
source_path=third_party/container/container.c object_path=third_party/sub/ContiguousContainer.o
flags={anon,rel.loc} name=base::android::g_library_version_number
5) 101768 (0.1%) d@0x2dffd88 pss=101600 padding=101600 num_aliases=1
source_path= object_path=
......@@ -120,7 +120,7 @@ Index | Running Total | Section@Address | ...
source_path=third_party/icu/ucnv_ext.c object_path=third_party/icu/icuuc/ucnv_ext.o
flags={gen} name=chrome::mojom::FieldTrialRecorder [vtable]
12) 1956976 (2.5%) R@0x2c17740 pss=789904 padding=0 num_aliases=1
source_path=third_party/container.c object_path=third_party/sub/ContiguousContainer.o
source_path=third_party/container/container.c object_path=third_party/sub/ContiguousContainer.o
flags={} name=chrome::mojom::FieldTrialRecorderProxy [vtable]
13) 1957008 (2.5%) R@0x2cd84e0 pss=32 padding=16 num_aliases=1
source_path= object_path=third_party/gvr-android-sdk/libgvr_shim_static_arm.a/libcontroller_api_impl.a_controller_api_impl.o
......@@ -155,7 +155,7 @@ Index | Running Total | Section@Address | ...
source_path=base/page_allocator.cc object_path=base/base/page_allocator.o
flags={} name=Name
24) 37906683 (48.7%) r@0x284e398 pss=32 padding=0 num_aliases=1
source_path=third_party/container.c object_path=third_party/sub/ContiguousContainer.o
source_path=third_party/container/container.c object_path=third_party/sub/ContiguousContainer.o
flags={} name=chrome::mojom::FilePatcher::Name_
25) 38582723 (49.6%) r@0x28f3450 pss=676040 padding=675992 num_aliases=1
source_path=third_party/paint.cc object_path=third_party/sub/PaintChunker.o
......@@ -222,14 +222,14 @@ Index | Running Total | Section@Address | ...
flags={clone} name=blink::ContiguousContainerBase::shrinkToFit
full_name=blink::ContiguousContainerBase::shrinkToFit()
43) 41944415 (53.9%) t@0x2a0020 pss=28 padding=4 num_aliases=1
source_path=third_party/container.c object_path=third_party/sub/ContiguousContainer.o
source_path=third_party/container/container.c object_path=third_party/sub/ContiguousContainer.o
flags={} name=blink::ContiguousContainerBase::ContiguousContainerBase
full_name=blink::ContiguousContainerBase::ContiguousContainerBase(blink::ContiguousContainerBase&&)
44) 41948455 (53.9%) t@0x2a1000 pss=4040 padding=4040 num_aliases=1
source_path= object_path=
flags={} name=** symbol gap 1
45) 41948549 (53.9%) t@0x2a1000 pss=94 padding=0 num_aliases=1
source_path=third_party/container.c object_path=third_party/sub/ContiguousContainer.o
source_path=third_party/container/container.c object_path=third_party/sub/ContiguousContainer.o
flags={anon,clone} name=blink::PaintChunker::releasePaintChunks
full_name=blink::PaintChunker::releasePaintChunks()
46) 77769551 (100.0%) t@0x24ca628 pss=35821002 padding=35821002 num_aliases=1
......@@ -269,16 +269,16 @@ Index | Running Total | Section@Address | ...
source_path=base/page_allocator.cc object_path=base/base/page_allocator.o
flags={} name=google::protobuf::internal::pLinuxKernelCmpxchg
1) 8 (0.0%) d@0x2de7004 pss=4 padding=0 num_aliases=1
source_path=third_party/container.c object_path=third_party/sub/ContiguousContainer.o
source_path=third_party/container/container.c object_path=third_party/sub/ContiguousContainer.o
flags={} name=google::protobuf::internal::pLinuxKernelMemoryBarrier
2) 160 (0.0%) d@0x2de7008 pss=152 padding=0 num_aliases=1
source_path=third_party/container.c object_path=third_party/sub/ContiguousContainer.o
source_path=third_party/container/container.c object_path=third_party/sub/ContiguousContainer.o
flags={rel} name=base::android::kBaseRegisteredMethods
3) 164 (0.0%) d@0x2de70a0 pss=4 padding=0 num_aliases=1
source_path=third_party/container.c object_path=third_party/sub/ContiguousContainer.o
source_path=third_party/container/container.c object_path=third_party/sub/ContiguousContainer.o
flags={anon} name=base::android::g_renderer_histogram_code
4) 168 (0.0%) d@0x2de70a4 pss=4 padding=0 num_aliases=1
source_path=third_party/container.c object_path=third_party/sub/ContiguousContainer.o
source_path=third_party/container/container.c object_path=third_party/sub/ContiguousContainer.o
flags={anon,rel.loc} name=base::android::g_library_version_number
5) 101768 (0.1%) d@0x2dffd88 pss=101600 padding=101600 num_aliases=1
source_path= object_path=
......@@ -302,7 +302,7 @@ Index | Running Total | Section@Address | ...
source_path=third_party/icu/ucnv_ext.c object_path=third_party/icu/icuuc/ucnv_ext.o
flags={gen} name=chrome::mojom::FieldTrialRecorder [vtable]
12) 1956976 (2.5%) R@0x2c17740 pss=789904 padding=0 num_aliases=1
source_path=third_party/container.c object_path=third_party/sub/ContiguousContainer.o
source_path=third_party/container/container.c object_path=third_party/sub/ContiguousContainer.o
flags={} name=chrome::mojom::FieldTrialRecorderProxy [vtable]
13) 1957008 (2.5%) R@0x2cd84e0 pss=32 padding=16 num_aliases=1
source_path= object_path=third_party/gvr-android-sdk/libgvr_shim_static_arm.a/libcontroller_api_impl.a_controller_api_impl.o
......@@ -343,7 +343,7 @@ Index | Running Total | Section@Address | ...
source_path=base/page_allocator.cc object_path=base/base/page_allocator.o
flags={} name=Name
24) 41192795 (53.0%) r@0x284e398 pss=32 padding=0 num_aliases=1
source_path=third_party/container.c object_path=third_party/sub/ContiguousContainer.o
source_path=third_party/container/container.c object_path=third_party/sub/ContiguousContainer.o
flags={} name=chrome::mojom::FilePatcher::Name_
25) 41868835 (53.8%) r@0x28f3450 pss=676040 padding=675992 num_aliases=1
source_path=third_party/paint.cc object_path=third_party/sub/PaintChunker.o
......@@ -416,11 +416,11 @@ Index | Running Total | Section@Address | ...
flags={clone} name=blink::ContiguousContainerBase::shrinkToFit
full_name=blink::ContiguousContainerBase::shrinkToFit()
42) 77769457 (100.0%) t@0x2a0020 pss=28 padding=4 num_aliases=1
source_path=third_party/container.c object_path=third_party/sub/ContiguousContainer.o
source_path=third_party/container/container.c object_path=third_party/sub/ContiguousContainer.o
flags={} name=blink::ContiguousContainerBase::ContiguousContainerBase
full_name=blink::ContiguousContainerBase::ContiguousContainerBase(blink::ContiguousContainerBase&&)
43) 77769551 (100.0%) t@0x2a1000 pss=94 padding=0 num_aliases=1
source_path=third_party/container.c object_path=third_party/sub/ContiguousContainer.o
source_path=third_party/container/container.c object_path=third_party/sub/ContiguousContainer.o
flags={anon,clone} name=blink::PaintChunker::releasePaintChunks
full_name=blink::PaintChunker::releasePaintChunks()
44) 77769551 (100.0%) b@0x0 pss=262144 padding=0 num_aliases=1
......
......@@ -163,7 +163,7 @@ Index | Running Total | Section@Address | PSS | Path
------------------------------------------------------------
0) 8 (0.0%) *@Group 8 {no path}
google (count=2)
1) 168 (0.0%) *@Group 160 third_party/container.c
1) 168 (0.0%) *@Group 160 third_party/container/container.c
base (count=3)
2) 1166900 (1.5%) *@Group 1166732 {no path}
** symbol gap 0 (end of section) (count=2)
......
# COMPONENT: UI>Browser
\ No newline at end of file
file://tools/binary_size/libsupersize/testdata/OWNERS
# COMPONENT: Blink>Internal
\ No newline at end of file
......@@ -4,5 +4,5 @@ build obj/third_party/icu/icuuc/ucnv_ext.o: cxx gen/third_party/icu/ucnv_ext.c |
build obj/base/base/page_allocator.o: rule ../../base/page_allocator.cc
build obj/third_party/sub/fft_float.o: rule ../../third_party/fft_float.cc
build obj/third_party/sub/fft_fixed.o: rule ../../third_party/fft_fixed.cc
build obj/third_party/sub/ContiguousContainer.o: rule ../../third_party/container.c
build obj/third_party/sub/ContiguousContainer.o: rule ../../third_party/container/container.c
build obj/third_party/sub/PaintChunker.o: rule ../../third_party/paint.cc
file://tools/binary_size/libsupersize/testdata/TEST_OWNERS
\ No newline at end of file
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment