aboutsummaryrefslogtreecommitdiff
path: root/java/com/google/turbine/deps
diff options
context:
space:
mode:
authorcushon <cushon@google.com>2019-08-09 20:56:07 -0700
committerLiam Miller-Cushon <cushon@google.com>2019-08-14 20:18:03 -0700
commitace1a32a87856b2a6e42006d48bbf7842b89d7e1 (patch)
tree2c3c7b2537de0f4515f35abe9e544c197679cd60 /java/com/google/turbine/deps
parenta1a865126f3e43519de714891b8b9bfb5c0f50bf (diff)
downloadturbine-ace1a32a87856b2a6e42006d48bbf7842b89d7e1.tar.gz
Make reduced classpath computation more lenient
I changed this in [] but some code paths are relying on the old behaviour. GOOGLE: RELNOTES: N/A ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=262683944
Diffstat (limited to 'java/com/google/turbine/deps')
-rw-r--r--java/com/google/turbine/deps/Dependencies.java7
1 files changed, 7 insertions, 0 deletions
diff --git a/java/com/google/turbine/deps/Dependencies.java b/java/com/google/turbine/deps/Dependencies.java
index 4235bc2..92193e8 100644
--- a/java/com/google/turbine/deps/Dependencies.java
+++ b/java/com/google/turbine/deps/Dependencies.java
@@ -184,11 +184,18 @@ public class Dependencies {
/**
* Filters a transitive classpath to contain only the entries for direct dependencies, and the
* types needed to compile those direct deps as reported by jdeps.
+ *
+ * <p>If no direct dependency information is available the full transitive classpath is returned.
*/
public static Collection<String> reduceClasspath(
ImmutableList<String> transitiveClasspath,
ImmutableSet<String> directJars,
ImmutableList<String> depsArtifacts) {
+ if (directJars.isEmpty()) {
+ // the compilation doesn't support strict deps (e.g. proto libraries)
+ // TODO(cushon): make this a usage error
+ return transitiveClasspath;
+ }
Set<String> reduced = new HashSet<>(directJars);
for (String path : depsArtifacts) {
DepsProto.Dependencies.Builder deps = DepsProto.Dependencies.newBuilder();