Chromium Code Reviews| 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( |