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,