From 81c7a60961cc60c69241979b9c0315ef07666979 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Patrik=20H=C3=B6glund?= Date: Thu, 30 Jan 2020 11:32:33 +0100 Subject: [PATCH] Fix public_deps presubmit and gn format fighting each other. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit I changed stuff in test/BUILD.gn, but the suggested formatting broke the presubmit. I tried rewriting the presubmit so it checks the previous line as well, but that turned out to be hard. Please try to enable this presubmit on ALL lines in a changed file. Presubmits that only work on changed lines are really confusing. Bug: None Change-Id: I2386c765367681f683d82739293bc8bc8a873a7b Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/167926 Reviewed-by: Mirko Bonadei Commit-Queue: Patrik Höglund Cr-Commit-Position: refs/heads/master@{#30420} --- PRESUBMIT.py | 15 ++++++++------- test/BUILD.gn | 15 ++++++++++----- 2 files changed, 18 insertions(+), 12 deletions(-) diff --git a/PRESUBMIT.py b/PRESUBMIT.py index 08e6024da0..247b78eaa0 100755 --- a/PRESUBMIT.py +++ b/PRESUBMIT.py @@ -529,16 +529,17 @@ def CheckPublicDepsIsNotUsed(gn_files, input_api, output_api): 'because it doesn\'t map well to downstream build systems.\n' 'Used in: %s (line %d).\n' 'If you are not adding this code (e.g. you are just moving ' - 'existing code) or you have a good reason, you can add a ' - 'comment on the line that causes the problem:\n\n' + 'existing code) or you have a good reason, you can add this ' + 'comment (verbatim) on the line that causes the problem:\n\n' 'public_deps = [ # no-presubmit-check TODO(webrtc:8603)\n') for affected_file in gn_files: for (line_number, affected_line) in affected_file.ChangedContents(): - if ('public_deps' in affected_line - and not no_presubmit_check_re.search(affected_line)): - result.append( - output_api.PresubmitError(error_msg % (affected_file.LocalPath(), - line_number))) + if 'public_deps' in affected_line: + surpressed = no_presubmit_check_re.search(affected_line) + if not surpressed: + result.append( + output_api.PresubmitError(error_msg % (affected_file.LocalPath(), + line_number))) return result diff --git a/test/BUILD.gn b/test/BUILD.gn index abe0801857..464f44f60a 100644 --- a/test/BUILD.gn +++ b/test/BUILD.gn @@ -297,7 +297,8 @@ rtc_source_set("test_support") { public_deps = [] # no-presubmit-check TODO(webrtc:8603) if (is_ios) { - public_deps += [ ":test_support_objc" ] # no-presubmit-check TODO(webrtc:8603) + public_deps += # no-presubmit-check TODO(webrtc:8603) + [ ":test_support_objc" ] } public_configs = [ ":test_main_direct_config" ] @@ -620,7 +621,8 @@ rtc_source_set("run_test") { if (is_mac) { public_deps = [ ":run_test_objc" ] # no-presubmit-check TODO(webrtc:8603) } else { - public_deps = [ ":run_test_generic" ] # no-presubmit-check TODO(webrtc:8603) + public_deps = # no-presubmit-check TODO(webrtc:8603) + [ ":run_test_generic" ] } } @@ -677,7 +679,8 @@ rtc_library("direct_transport") { "../rtc_base/task_utils:repeating_task", "//third_party/abseil-cpp/absl/memory", ] - public_deps = [ "../call:fake_network" ] # no-presubmit-check TODO(webrtc:8603) + public_deps = # no-presubmit-check TODO(webrtc:8603) + [ "../call:fake_network" ] } rtc_library("fake_video_codecs") { @@ -832,10 +835,12 @@ rtc_library("test_common") { } rtc_source_set("test_renderer") { - public_deps = [ ":test_renderer_generic" ] # no-presubmit-check TODO(webrtc:8603) + public_deps = # no-presubmit-check TODO(webrtc:8603) + [ ":test_renderer_generic" ] testonly = true if (is_mac) { - public_deps += [ ":test_renderer_objc" ] # no-presubmit-check TODO(webrtc:8603) + public_deps += # no-presubmit-check TODO(webrtc:8603) + [ ":test_renderer_objc" ] } }