Skip to content

Commit

Permalink
adding html_support
Browse files Browse the repository at this point in the history
  • Loading branch information
EdbertChan committed Apr 12, 2024
1 parent 80a6d08 commit 0768997
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 1 deletion.
12 changes: 11 additions & 1 deletion rules/impl.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ def _run_android_lint(
android_lint,
module_name,
output,
html_output,
srcs,
deps,
resource_files,
Expand Down Expand Up @@ -63,7 +64,7 @@ def _run_android_lint(
android_lint_skip_bytecode_verifier: Disables bytecode verification
"""
inputs = []
outputs = [output]
outputs = [output, html_output]

args = ctx.actions.args()
args.set_param_file_format("multiline")
Expand Down Expand Up @@ -118,6 +119,13 @@ def _run_android_lint(
args.add("--output", output)
outputs.append(output)

args.add("--html-output", html_output)
outputs.append(html_output)

label = ctx.attr.android_home.label
if ctx.attr.android_home:
args.add("--android_home", label.workspace_root)

ctx.actions.run(
mnemonic = "AndroidLint",
inputs = inputs,
Expand Down Expand Up @@ -198,11 +206,13 @@ def process_android_lint_issues(ctx, regenerate):
)

output = ctx.actions.declare_file("{}.xml".format(ctx.label.name))
html_output = ctx.actions.declare_file("{}.html".format(ctx.label.name))
_run_android_lint(
ctx,
android_lint = _utils.only(_utils.list_or_depset_to_list(_utils.get_android_lint_toolchain(ctx).android_lint.files)),
module_name = _get_module_name(ctx),
output = output,
html_output = html_output,
srcs = ctx.files.srcs,
deps = depset(transitive = deps),
resource_files = ctx.files.resource_files,
Expand Down
6 changes: 6 additions & 0 deletions src/cli/AndroidLintActionArgs.kt
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,12 @@ internal class AndroidLintActionArgs(
transform = argsParserPathTransformer,
)

val htmlOutput: Path by parser.storing(
names = arrayOf("--html-output"),
help = "",
transform = argsParserPathTransformer,
)

val resources: List<Path> by parser.adding(
names = arrayOf("--resource"),
help = "",
Expand Down
2 changes: 2 additions & 0 deletions src/cli/AndroidLintRunner.kt
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,8 @@ internal class AndroidLintRunner {
projectFilePath.pathString,
"--xml",
actionArgs.output.pathString,
"--html",
actionArgs.htmlOutput.pathString,
"--exitcode",
"--compile-sdk-version",
actionArgs.compileSdkVersion,
Expand Down

0 comments on commit 0768997

Please sign in to comment.