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 1386213002: Upstream presubmit check for Android mdpi assets. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 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 | no next file » | 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 c777fb800552bdeb4bf54c5bd121d5684b1e6e19..704eb0546f486f2ec02491488385ae96dee3ffe6 100644
--- a/PRESUBMIT.py
+++ b/PRESUBMIT.py
@@ -1446,6 +1446,26 @@ def _CheckAndroidCrLogUsage(input_api, output_api):
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
+ ('/res/drawable/' in f.LocalPath() or
+ '/res/drawable-ldrtl/' in f.LocalPath()))
+ errors = []
+ for f in input_api.AffectedFiles(include_deletes=False,
+ file_filter=file_filter):
+ errors.append(' %s' % f.LocalPath())
+
+ results = []
+ if errors:
+ results.append(output_api.PresubmitError(
+ 'MDPI assets should be placed in /res/drawable-mdpi/ or '
+ '/res/drawable-ldrtl-mdpi/\ninstead of /res/drawable/ and'
+ '/res/drawable-ldrtl/.\n'
+ 'Contact newt@chromium.org if you have questions.', errors))
+ return results
+
+
def _CheckForCopyrightedCode(input_api, output_api):
"""Verifies that newly added code doesn't contain copyrighted material
and is properly licensed under the standard Chromium license.
@@ -1575,6 +1595,7 @@ def _AndroidSpecificOnUploadChecks(input_api, output_api):
"""Groups checks that target android code."""
results = []
results.extend(_CheckAndroidCrLogUsage(input_api, output_api))
+ results.extend(_CheckAndroidNewMdpiAssetLocation(input_api, output_api))
results.extend(_CheckAndroidToastUsage(input_api, output_api))
return results
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698