From 5510f5fc8caa3db889e9a435434465026264554b Mon Sep 17 00:00:00 2001 From: Gunnar Wagenknecht Date: Tue, 26 Nov 2024 19:31:05 +0100 Subject: [PATCH] Resolve no-ide targets to the bazel project --- .../core/model/discovery/JavaAspectsClasspathInfo.java | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/bundles/com.salesforce.bazel.eclipse.core/src/com/salesforce/bazel/eclipse/core/model/discovery/JavaAspectsClasspathInfo.java b/bundles/com.salesforce.bazel.eclipse.core/src/com/salesforce/bazel/eclipse/core/model/discovery/JavaAspectsClasspathInfo.java index 3f403179..0c7ef776 100644 --- a/bundles/com.salesforce.bazel.eclipse.core/src/com/salesforce/bazel/eclipse/core/model/discovery/JavaAspectsClasspathInfo.java +++ b/bundles/com.salesforce.bazel.eclipse.core/src/com/salesforce/bazel/eclipse/core/model/discovery/JavaAspectsClasspathInfo.java @@ -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) @@ -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