Fix minor issues in updatability lint CLs.

Test: TreeHugger
Bug: 182349282
Change-Id: Ifae282d51b088d0562605b41a09696d75c5138f1
This commit is contained in:
Jaewoong Jung 2021-04-22 11:01:36 -07:00
parent be1c47b216
commit 3c87b1df11
2 changed files with 7 additions and 6 deletions

View file

@ -261,6 +261,7 @@ func (l *linter) writeLintProjectXML(ctx android.ModuleContext, rule *android.Ru
cmd.FlagForEachArg("--fatal_check ", l.properties.Lint.Fatal_checks) cmd.FlagForEachArg("--fatal_check ", l.properties.Lint.Fatal_checks)
if BoolDefault(l.properties.Lint.Strict_updatability_linting, false) { if BoolDefault(l.properties.Lint.Strict_updatability_linting, false) {
// Verify the module does not baseline issues that endanger safe updatability.
if baselinePath := l.getBaselineFilepath(ctx); baselinePath.Valid() { if baselinePath := l.getBaselineFilepath(ctx); baselinePath.Valid() {
cmd.FlagWithInput("--baseline ", baselinePath.Path()) cmd.FlagWithInput("--baseline ", baselinePath.Path())
cmd.FlagForEachArg("--disallowed_issues ", updatabilityChecks) cmd.FlagForEachArg("--disallowed_issues ", updatabilityChecks)

View file

@ -144,12 +144,12 @@ def check_baseline_for_disallowed_issues(baseline, forced_checks):
if issues_element.tagName != 'issues': if issues_element.tagName != 'issues':
raise RuntimeError('expected issues tag at root') raise RuntimeError('expected issues tag at root')
issues = issues_element.getElementsByTagName('issue') issues = issues_element.getElementsByTagName('issue')
disallwed = set() disallowed = set()
for issue in issues: for issue in issues:
id = issue.getAttribute('id') id = issue.getAttribute('id')
if id in forced_checks: if id in forced_checks:
disallwed.add(id) disallowed.add(id)
return disallwed return disallowed
def main(): def main():
@ -158,10 +158,10 @@ def main():
if args.baseline_path: if args.baseline_path:
baseline = minidom.parse(args.baseline_path) baseline = minidom.parse(args.baseline_path)
diallowed_issues = check_baseline_for_disallowed_issues(baseline, args.disallowed_issues) disallowed_issues = check_baseline_for_disallowed_issues(baseline, args.disallowed_issues)
if bool(diallowed_issues): if bool(disallowed_issues):
raise RuntimeError('disallowed issues %s found in lint baseline file %s for module %s' raise RuntimeError('disallowed issues %s found in lint baseline file %s for module %s'
% (diallowed_issues, args.baseline_path, args.name)) % (disallowed_issues, args.baseline_path, args.name))
if args.project_out: if args.project_out:
with open(args.project_out, 'w') as f: with open(args.project_out, 'w') as f: