diff options
author | kmb <kmb@google.com> | 2018-07-03 12:19:06 -0700 |
---|---|---|
committer | Copybara-Service <copybara-piper@google.com> | 2018-07-03 12:20:45 -0700 |
commit | 0d8136849d900af15f2b94eda4c04efb8ff13186 (patch) | |
tree | 545469c0c00fb83b8dcf92ea9ad3fdb7f4217c6c /src/main/java/com/google/devtools/build/lib/rules/java | |
parent | 88a20ee08c0af7cf187893bcafe0771e5a19ff9d (diff) |
supply transitive and direct deps for aar_import deps checking. This allows producing add_dep commands where possible and avoids the need for direct dependencies on supertypes of directly depended types
RELNOTES: None.
PiperOrigin-RevId: 203164113
Diffstat (limited to 'src/main/java/com/google/devtools/build/lib/rules/java')
-rw-r--r-- | src/main/java/com/google/devtools/build/lib/rules/java/ImportDepsCheckActionBuilder.java | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/rules/java/ImportDepsCheckActionBuilder.java b/src/main/java/com/google/devtools/build/lib/rules/java/ImportDepsCheckActionBuilder.java index 0cc64da096..0ed123e90d 100644 --- a/src/main/java/com/google/devtools/build/lib/rules/java/ImportDepsCheckActionBuilder.java +++ b/src/main/java/com/google/devtools/build/lib/rules/java/ImportDepsCheckActionBuilder.java @@ -39,6 +39,7 @@ public final class ImportDepsCheckActionBuilder { private NestedSet<Artifact> jarsToCheck; private NestedSet<Artifact> bootclasspath; private NestedSet<Artifact> declaredDeps; + private NestedSet<Artifact> transitiveDeps; private ImportDepsCheckingLevel importDepsCheckingLevel; private ImportDepsCheckActionBuilder() {} @@ -86,11 +87,18 @@ public final class ImportDepsCheckActionBuilder { return this; } + public ImportDepsCheckActionBuilder transitiveDeps(NestedSet<Artifact> transitiveDeps) { + checkState(this.transitiveDeps == null); + this.transitiveDeps = checkNotNull(transitiveDeps); + return this; + } + public void buildAndRegister(RuleContext ruleContext) { checkNotNull(outputArtifact); checkNotNull(jarsToCheck); checkNotNull(bootclasspath); checkNotNull(declaredDeps); + checkNotNull(transitiveDeps); checkNotNull(importDepsCheckingLevel); checkNotNull(jdepsArtifact); checkNotNull(ruleLabel); @@ -101,6 +109,7 @@ public final class ImportDepsCheckActionBuilder { .setExecutable(ruleContext.getExecutablePrerequisite("$import_deps_checker", Mode.HOST)) .addTransitiveInputs(jarsToCheck) .addTransitiveInputs(declaredDeps) + .addTransitiveInputs(transitiveDeps) .addTransitiveInputs(bootclasspath) .addOutput(outputArtifact) .addOutput(jdepsArtifact) @@ -120,7 +129,8 @@ public final class ImportDepsCheckActionBuilder { return CustomCommandLine.builder() .addExecPath("--output", outputArtifact) .addExecPaths(VectorArg.addBefore("--input").each(jarsToCheck)) - .addExecPaths(VectorArg.addBefore("--classpath_entry").each(declaredDeps)) + .addExecPaths(VectorArg.addBefore("--directdep").each(declaredDeps)) + .addExecPaths(VectorArg.addBefore("--classpath_entry").each(transitiveDeps)) .addExecPaths(VectorArg.addBefore("--bootclasspath_entry").each(bootclasspath)) .addDynamicString(convertErrorFlag(importDepsCheckingLevel)) .addExecPath("--jdeps_output", jdepsArtifact) |