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

Unified Diff: android_webview/tools/PRESUBMIT.py

Issue 667723002: [Android WebView] Prepare the copyrights scanner to run from presubmit scripts (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Simplified ShouldMatchReferenceOutput 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 | android_webview/tools/copyright_scanner.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: android_webview/tools/PRESUBMIT.py
diff --git a/android_webview/tools/PRESUBMIT.py b/android_webview/tools/PRESUBMIT.py
new file mode 100644
index 0000000000000000000000000000000000000000..455701ec27ceeba3a70233264a3f85411e324eec
--- /dev/null
+++ b/android_webview/tools/PRESUBMIT.py
@@ -0,0 +1,29 @@
+# Copyright 2014 The Chromium Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+def CheckChangeOnUpload(input_api, output_api):
+ return _CommonChecks(input_api, output_api)
+
+def CheckChangeOnCommit(input_api, output_api):
+ return _CommonChecks(input_api, output_api)
+
+def _CommonChecks(input_api, output_api):
+ """Checks common to both upload and commit."""
+ results = []
+
+ would_affect_tests = [
+ 'PRESUBMIT.py',
+ 'copyright_scanner.py',
+ 'copyright_scanner_unittest.py'
+ ]
+ need_to_run_unittests = False
+ for f in input_api.AffectedFiles():
+ if any(t for t in would_affect_tests if f.LocalPath().endswith(t)):
+ need_to_run_unittests = True
+ break
+ tests = [input_api.os_path.join(
+ input_api.PresubmitLocalPath(), 'copyright_scanner_unittest.py')]
+ results.extend(
+ input_api.canned_checks.RunUnitTests(input_api, output_api, tests))
+ return results
« no previous file with comments | « no previous file | android_webview/tools/copyright_scanner.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698