Skip to content

Commit

Permalink
Import all external libraries on every sync
Browse files Browse the repository at this point in the history
There is a bug in Bazel, that it does not produce proper jdeps files for
the IntelliJ plugin, thus breaking the existing API.

The only workaround seems to be to force the plugin to treat all files to
be part of the working set, and load external dependencies for them.

More info at:
bazelbuild#490
bazelbuild/bazel#5723
bazelbuild/bazel#6587
  • Loading branch information
gergelyfabian committed May 11, 2020
1 parent e19da71 commit 8e1bfda
Showing 1 changed file with 15 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -323,23 +323,21 @@ private void addTargetAsSource(
workspaceBuilder.jdeps.addAll(jars);
}

// Add all deps if this target is in the current working set
if (workingSet == null || workingSet.isTargetInWorkingSet(target)) {
// Add self, so we pick up our own gen jars if in working set
workspaceBuilder.directDeps.add(targetKey);
for (Dependency dep : target.getDependencies()) {
if (dep.getDependencyType() != DependencyType.COMPILE_TIME) {
continue;
}
// forward deps from java proto_library aspect targets
TargetIdeInfo depTarget = targetMap.get(dep.getTargetKey());
if (depTarget != null
&& JavaBlazeRules.getJavaProtoLibraryKinds().contains(depTarget.getKind())) {
workspaceBuilder.directDeps.addAll(
depTarget.getDependencies().stream().map(Dependency::getTargetKey).collect(toList()));
} else {
workspaceBuilder.directDeps.add(dep.getTargetKey());
}
// Add all deps always - workaround - .jdeps missing external dependencies.
// Add self, so we pick up our own gen jars if in working set
workspaceBuilder.directDeps.add(targetKey);
for (Dependency dep : target.getDependencies()) {
if (dep.getDependencyType() != DependencyType.COMPILE_TIME) {
continue;
}
// forward deps from java proto_library aspect targets
TargetIdeInfo depTarget = targetMap.get(dep.getTargetKey());
if (depTarget != null
&& JavaBlazeRules.getJavaProtoLibraryKinds().contains(depTarget.getKind())) {
workspaceBuilder.directDeps.addAll(
depTarget.getDependencies().stream().map(Dependency::getTargetKey).collect(toList()));
} else {
workspaceBuilder.directDeps.add(dep.getTargetKey());
}
}

Expand Down

0 comments on commit 8e1bfda

Please sign in to comment.