Skip to content

Commit

Permalink
Clarify naming a bit
Browse files Browse the repository at this point in the history
  • Loading branch information
guw committed Nov 20, 2024
1 parent 6183ee9 commit 0caf298
Showing 1 changed file with 6 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -134,17 +134,19 @@ protected IPath findWorkspaceLocation(BazelWorkspace bazelWorkspace, IPath packa
throw new IllegalArgumentException("absolute path not allowed!");
}

// the root package never is
// the root package never is nested in another workspace
if (packagePath.isEmpty()) {
return bazelWorkspace.getLocation();
}

// there should be no other WORKSPACE file in either the package nor any of its parents
var locationToCheck = bazelWorkspace.getLocation().append(packagePath);
var workspaceFile = findWorkspaceFile(locationToCheck.toPath());
var possibleNestedWorkspacePath = bazelWorkspace.getLocation().append(packagePath);
var workspaceFile = findWorkspaceFile(possibleNestedWorkspacePath.toPath());
if (workspaceFile != null) {
return locationToCheck;
return possibleNestedWorkspacePath;
}

// continue checking the parent package for a nested WORKSPACE
return findWorkspaceLocation(bazelWorkspace, packagePath.removeLastSegments(1));
}
}

0 comments on commit 0caf298

Please sign in to comment.