Skip to content

Commit

Permalink
Resolve no-ide targets to the bazel project
Browse files Browse the repository at this point in the history
  • Loading branch information
guw committed Nov 26, 2024
1 parent 3df1379 commit 5510f5f
Showing 1 changed file with 9 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -597,7 +597,7 @@ private ClasspathEntry resolveLibrary(BlazeJarLibrary library) throws CoreExcept
return resolveJar(library.libraryArtifact);
}

public ClasspathEntry resolveProject(final Label targetLabel) throws CoreException {
private ClasspathEntry resolveProject(final Label targetLabel) throws CoreException {
var workspace = bazelWorkspace;

// check for project mapping (it trumps everything)
Expand Down Expand Up @@ -662,6 +662,14 @@ public ClasspathEntry resolveProject(final Label targetLabel) throws CoreExcepti
.anyMatch(t -> t.getTargetName().equals(targetName))) {
return newProjectReference(targetLabel, bazelPackage.getBazelProject());
}

// it may be possible that the target is explicitly hidden from IDEs
// in this case, it won't match in the above condition, however, we still want to make it a project references
// the reason is that we do expect the project to represent the package adequately
// design question: this assumes project per package strategy, which is actually the case here
if (!bazelTarget.isVisibleToIde()) {
return newProjectReference(targetLabel, bazelPackage.getBazelProject());
}
}

// nothing found
Expand Down

0 comments on commit 5510f5f

Please sign in to comment.