Skip to content

Commit

Permalink
Don't check the workspace project
Browse files Browse the repository at this point in the history
The workspace project may not exists in Eclipse as a project. Thus,
don't try to look it up but compare only the properties.
  • Loading branch information
guw committed Jul 29, 2023
1 parent eec3687 commit ea87570
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -138,14 +138,12 @@ static Map<BazelPackage, Map<String, Target>> queryForTargets(BazelWorkspace baz
}

IProject findProject() throws CoreException {
var workspaceProject = getBazelPackage().getBazelWorkspace().getBazelProject().getProject();
var workspaceRoot = getBazelPackage().getBazelWorkspace().getLocation();
// we don't care about the actual project name - we look for the property
var projects = getEclipseWorkspaceRoot().getProjects();
for (IProject project : projects) {
if (project.isAccessible() // is open
&& project.hasNature(BAZEL_NATURE_ID) // is a Bazel project
&& !workspaceProject.equals(project) // is not the workspace project
&& hasWorkspaceRootPropertySetToLocation(project, workspaceRoot) // belongs to the workspace root
&& hasOwnerPropertySetForLabel(project, getBazelPackage().getLabel()) // represents the target
) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,14 +46,12 @@ public BazelTargetInfo(String targetName, BazelTarget bazelTarget) {
}

IProject findProject() throws CoreException {
var workspaceProject = getBazelTarget().getBazelWorkspace().getBazelProject().getProject();
var workspaceRoot = getBazelTarget().getBazelWorkspace().getLocation();
// we don't care about the actual project name - we look for the property
var projects = getEclipseWorkspaceRoot().getProjects();
for (IProject project : projects) {
if (project.isAccessible() // is open
&& project.hasNature(BAZEL_NATURE_ID) // is a Bazel project
&& !workspaceProject.equals(project) // is not the workspace project
&& hasWorkspaceRootPropertySetToLocation(project, workspaceRoot) // belongs to the workspace root
&& hasOwnerPropertySetForLabel(project, getBazelTarget().getLabel()) // represents the target
) {
Expand Down

0 comments on commit ea87570

Please sign in to comment.