Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(153)

Unified Diff: PRESUBMIT.py

Issue 2346103002: Fix BUILD.gn files and add presubmit step (Closed)
Patch Set: windows Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « BUILD.gn ('k') | src/v8.gyp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: PRESUBMIT.py
diff --git a/PRESUBMIT.py b/PRESUBMIT.py
index 5255ca11fa257b7a94fdaf36ccfa62f43d47aa48..78e7482efbab5da80a2a0f5b8efa40ca4861c79d 100644
--- a/PRESUBMIT.py
+++ b/PRESUBMIT.py
@@ -216,6 +216,38 @@ def _CheckNoProductionCodeUsingTestOnlyFunctions(input_api, output_api):
return []
+def _CheckMissingFiles(input_api, output_api):
+ """Runs verify_source_deps.py to ensure no files were added that are not in
+ GN.
+ """
+ # We need to wait until we have an input_api object and use this
+ # roundabout construct to import checkdeps because this file is
+ # eval-ed and thus doesn't have __file__.
+ original_sys_path = sys.path
+ try:
+ sys.path = sys.path + [input_api.os_path.join(
+ input_api.PresubmitLocalPath(), 'tools')]
+ from verify_source_deps import missing_gn_files, missing_gyp_files
+ finally:
+ # Restore sys.path to what it was before.
+ sys.path = original_sys_path
+
+ gn_files = missing_gn_files()
+ gyp_files = missing_gyp_files()
+ results = []
+ if gn_files:
+ results.append(output_api.PresubmitError(
+ "You added one or more source files but didn't update the\n"
+ "corresponding BUILD.gn files:\n",
+ gn_files))
+ if gyp_files:
+ results.append(output_api.PresubmitError(
+ "You added one or more source files but didn't update the\n"
+ "corresponding gyp files:\n",
+ gyp_files))
+ return results
+
+
def _CommonChecks(input_api, output_api):
"""Checks common to both upload and commit."""
results = []
@@ -231,6 +263,7 @@ def _CommonChecks(input_api, output_api):
_CheckNoProductionCodeUsingTestOnlyFunctions(input_api, output_api))
results.extend(
_CheckNoInlineHeaderIncludesInNormalHeaders(input_api, output_api))
+ results.extend(_CheckMissingFiles(input_api, output_api))
return results
« no previous file with comments | « BUILD.gn ('k') | src/v8.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698