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

Unified Diff: PRESUBMIT.py

Issue 697733002: Add a PRESUBMIT for gn check, currently only for //sky/* (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Actually run the presubmit check Created 6 years, 2 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 | « no previous file | sky/engine/wtf/BUILD.gn » ('j') | sky/services/inspector/BUILD.gn » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: PRESUBMIT.py
diff --git a/PRESUBMIT.py b/PRESUBMIT.py
index 1f2067ddbfa81096f87d4d886788b05ed19617de..f54a03b178732846386c612fcc06dbbbf8a41cbd 100644
--- a/PRESUBMIT.py
+++ b/PRESUBMIT.py
@@ -412,6 +412,29 @@ def _CheckValidHostsInDEPS(input_api, output_api):
long_text=error.output)]
+def _CheckGNCheck(input_api, output_api):
+ """Checks that gn gen and gn check pass"""
+ # TODO(eseidel): We should not have to pass dir= here but unfortunately
jamesr 2014/10/31 19:57:45 could this be a bug? or do we have a bug?
+ # build/config/clang/BUILD.gn:19 rebase_path can't handle absolute paths!
+ temp_dir = input_api.change.RepositoryRoot()
+ out_dir = input_api.tempfile.mkdtemp(dir=temp_dir)
+ relative_out_dir = input_api.os_path.relpath(out_dir)
+ try:
+ input_api.subprocess.check_output(['gn', 'gen', relative_out_dir])
+ except input_api.subprocess.CalledProcessError, error:
+ return [output_api.PresubmitError(
+ 'gn gen must not fail.', long_text=error.output)]
+
+ try:
+ # TODO(eseidel): Currently only //sky/* are known to pass.
+ input_api.subprocess.check_output(['gn', 'check', relative_out_dir,
+ '//sky/*'])
jamesr 2014/10/31 19:57:45 can we make this a list somewhere? i made //mojo/p
+ except input_api.subprocess.CalledProcessError, error:
+ return [output_api.PresubmitError(
+ 'gn check must not fail.', long_text=error.output)]
+ return []
+
+
def _CheckNoBannedFunctions(input_api, output_api):
"""Make sure that banned functions are not used."""
warnings = []
@@ -1292,6 +1315,7 @@ def _CommonChecks(input_api, output_api):
results.extend(_CheckParseErrors(input_api, output_api))
results.extend(_CheckForIPCRules(input_api, output_api))
results.extend(_CheckForOverrideAndFinalRules(input_api, output_api))
+ results.extend(_CheckGNCheck(input_api, output_api))
if any('PRESUBMIT.py' == f.LocalPath() for f in input_api.AffectedFiles()):
results.extend(input_api.canned_checks.RunUnitTestsInDirectory(
« no previous file with comments | « no previous file | sky/engine/wtf/BUILD.gn » ('j') | sky/services/inspector/BUILD.gn » ('J')

Powered by Google App Engine
This is Rietveld 408576698