From ac086af9d8173ba8d0276e34c8d39d476d15e01d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Patrik=20H=C3=B6glund?= Date: Fri, 29 Sep 2017 16:07:49 +0200 Subject: [PATCH] Make orphan check understand public headers. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Bug: webrtc:8277 Change-Id: Id3450185f1bf9e78e4dac10cf4df217f35e02514 Reviewed-on: https://webrtc-review.googlesource.com/4723 Reviewed-by: Henrik Kjellander Commit-Queue: Patrik Höglund Cr-Commit-Position: refs/heads/master@{#20061} --- tools_webrtc/presubmit_checks_lib/check_orphan_headers.py | 2 +- .../presubmit_checks_lib/check_orphan_headers_test.py | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/tools_webrtc/presubmit_checks_lib/check_orphan_headers.py b/tools_webrtc/presubmit_checks_lib/check_orphan_headers.py index 04291669eb..31be7196ba 100644 --- a/tools_webrtc/presubmit_checks_lib/check_orphan_headers.py +++ b/tools_webrtc/presubmit_checks_lib/check_orphan_headers.py @@ -20,7 +20,7 @@ TARGET_RE = re.compile(r'(?P\s*)\w+\("(?P\w+)"\) {' # SOURCES_RE matches a block of sources inside a GN target. SOURCES_RE = re.compile( - r'(sources|common_objc_headers) \+?= \[(?P.*?)\]', + r'(sources|public|common_objc_headers) \+?= \[(?P.*?)\]', re.MULTILINE | re.DOTALL) SOURCE_FILE_RE = re.compile(r'.*\"(?P.*)\"') diff --git a/tools_webrtc/presubmit_checks_lib/check_orphan_headers_test.py b/tools_webrtc/presubmit_checks_lib/check_orphan_headers_test.py index 6587b8aa74..9acf25a517 100755 --- a/tools_webrtc/presubmit_checks_lib/check_orphan_headers_test.py +++ b/tools_webrtc/presubmit_checks_lib/check_orphan_headers_test.py @@ -92,6 +92,10 @@ class GetHeadersInBuildGnFileSourcesTest(unittest.TestCase): deps = [":bar"] } rtc_static_library("bar") { + # Public headers should also be included. + public = [ + "public_foo.h", + ] sources = [ "bar.h", "bar.cc", @@ -107,6 +111,7 @@ class GetHeadersInBuildGnFileSourcesTest(unittest.TestCase): set([ _GetPath('a', 'b', 'foo.h'), _GetPath('a', 'b', 'bar.h'), + _GetPath('a', 'b', 'public_foo.h'), _GetPath('a', 'b', 'baz', 'foo.h'), ]), check_orphan_headers.GetHeadersInBuildGnFileSources(file_content,