Skip to content

Commit

Permalink
declare data inputs from applicable Android Lint package configurat…
Browse files Browse the repository at this point in the history
…ions.

PiperOrigin-RevId: 368117316
  • Loading branch information
kevin1e100 authored and copybara-github committed Apr 13, 2021
1 parent 28c00ce commit 3d060fc
Showing 1 changed file with 8 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -76,10 +76,6 @@ static Artifact create(
.build();
}

Artifact result =
ruleContext.getPackageRelativeArtifact(
ruleContext.getLabel().getName() + "_android_lint_output.xml",
ruleContext.getBinOrGenfilesDirectory());
CustomCommandLine.Builder cmd = CustomCommandLine.builder();
cmd.addExecPaths("--sources", attributes.getSourceFiles())
.addExecPaths("--source_jars", allSrcJars)
Expand All @@ -96,15 +92,22 @@ static Artifact create(
}
cmd.add("--lintopts");
cmd.addAll(androidLint.options());

NestedSetBuilder<Artifact> inputs = NestedSetBuilder.stableOrder();
for (JavaPackageConfigurationProvider provider : androidLint.packageConfiguration()) {
if (provider.matches(ruleContext.getLabel())) {
cmd.addAll(provider.javacopts());
inputs.addTransitive(provider.data());
}
}

Artifact result =
ruleContext.getPackageRelativeArtifact(
ruleContext.getLabel().getName() + "_android_lint_output.xml",
ruleContext.getBinOrGenfilesDirectory());
cmd.addExecPath("--xml", result);

SpawnAction.Builder spawnAction = new SpawnAction.Builder();
NestedSetBuilder<Artifact> inputs = NestedSetBuilder.stableOrder();
androidLint.tool().buildCommandLine(spawnAction.executableArguments(), toolchain, inputs);
ruleContext.registerAction(
spawnAction
Expand Down

0 comments on commit 3d060fc

Please sign in to comment.