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

Unified Diff: PRESUBMIT.py

Issue 2583933003: Replace deprecated Android java test annotations (Closed)
Patch Set: Rebase again :( Created 4 years 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 | PRESUBMIT_test.py » ('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 5548a58b0d611d8c82d4b9ae7d8dd159d2f793fb..32a16e1471d4f4ceca549c578b6aebae260fc88b 100644
--- a/PRESUBMIT.py
+++ b/PRESUBMIT.py
@@ -1721,6 +1721,29 @@ def _CheckAndroidCrLogUsage(input_api, output_api):
return results
+def _CheckAndroidTestAnnotationUsage(input_api, output_api):
+ """Checks that android.test.suitebuilder.annotation.* is no longer used."""
+ deprecated_annotation_import_pattern = input_api.re.compile(
+ r'^import android\.test\.suitebuilder\.annotation\..*;',
+ input_api.re.MULTILINE)
+ sources = lambda x: input_api.FilterSourceFile(
+ x, white_list=(r'.*\.java$',), black_list=None)
+ errors = []
+ for f in input_api.AffectedFiles(sources):
+ for line_num, line in f.ChangedContents():
+ if deprecated_annotation_import_pattern.search(line):
+ errors.append("%s:%d" % (f.LocalPath(), line_num))
+
+ results = []
+ if errors:
+ results.append(output_api.PresubmitError(
+ 'Annotations in android.test.suitebuilder.annotation have been'
+ ' deprecated since API level 24. Please use android.support.test.filters'
+ ' from //third_party/android_support_test_runner:runner_java instead.'
+ ' Contact yolandyan@chromium.org if you have any questions.', errors))
+ return results
+
+
def _CheckAndroidNewMdpiAssetLocation(input_api, output_api):
"""Checks if MDPI assets are placed in a correct directory."""
file_filter = lambda f: (f.LocalPath().endswith('.png') and
@@ -1998,6 +2021,7 @@ def _AndroidSpecificOnUploadChecks(input_api, output_api):
results.extend(_CheckAndroidCrLogUsage(input_api, output_api))
results.extend(_CheckAndroidNewMdpiAssetLocation(input_api, output_api))
results.extend(_CheckAndroidToastUsage(input_api, output_api))
+ results.extend(_CheckAndroidTestAnnotationUsage(input_api, output_api))
return results
« no previous file with comments | « no previous file | PRESUBMIT_test.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698