Commit 85c2a515 authored by Dan Harrington's avatar Dan Harrington Committed by Commit Bot

Allow -check directives that R8 ignores

There are some of these directives being brought in
through the internal roll.

Change-Id: I9fa30dd0ab859e8f80b5bc3b203ef720afbea837
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2503191Reviewed-by: default avatarAndrew Grieve <agrieve@chromium.org>
Commit-Queue: Dan H <harringtond@chromium.org>
Cr-Commit-Position: refs/heads/master@{#821388}
parent ee657fa3
......@@ -31,7 +31,9 @@ _API_LEVEL_VERSION_CODE = [
]
_CHECKDISCARD_RE = re.compile(r'^[ \t\r\f\v]*-checkdiscard[^\n{]*({[\s\S]*?})?',
re.MULTILINE)
_DIRECTIVE_RE = re.compile(r'^\s*-', re.MULTILINE)
# Ignore remaining directives that start with -check, as they're not supported
# by R8 anyway.
_DIRECTIVE_RE = re.compile(r'^\s*-(?<!check)[a-zA-Z].*')
def _ValidateAndFilterCheckDiscards(configs):
......@@ -55,10 +57,13 @@ def _ValidateAndFilterCheckDiscards(configs):
contents = f.read()
if _CHECKDISCARD_RE.search(contents):
contents = _CHECKDISCARD_RE.sub('', contents)
if _DIRECTIVE_RE.search(contents):
raise Exception('Proguard configs containing -checkdiscards cannot '
'contain other directives so that they can be '
'disabled in test APKs ({}).'.format(config_path))
directive_match = _DIRECTIVE_RE.search(contents)
if directive_match:
raise Exception(
'Proguard configs containing -checkdiscards cannot '
'contain other directives so that they can be '
'disabled in test APKs ({}). Directive "{}" found.'.format(
config_path, directive_match.group()))
else:
valid_configs.append(config_path)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment