Skip to content

Commit 0a7fb01

Browse files
committed
fix(builtin): fix localWorkspacePath logic
If the manifest has an entry in the output_base but not in the binDir or genDir, we get a wrong path for later resolutions Fixes #1087
1 parent 10d136a commit 0a7fb01

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

internal/node/node_loader.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,7 @@ function loadRunfilesManifest(manifestPath) {
107107
const runfilesManifest = Object.create(null);
108108
const reverseRunfilesManifest = Object.create(null);
109109
const input = fs.readFileSync(manifestPath, {encoding: 'utf-8'});
110+
const outputBase = manifestPath.substring(0, manifestPath.indexOf('/execroot/'));
110111

111112
// Absolute path that refers to the local workspace path. We need to determine the absolute
112113
// path to the local workspace because it allows us to support absolute path resolving
@@ -124,7 +125,7 @@ function loadRunfilesManifest(manifestPath) {
124125
// runfile refers to a different workspace, or the current runfile resolves to a file
125126
// in the bazel-out directory (bin/genfiles directory).
126127
if (localWorkspacePath || !runfilesPath.startsWith(USER_WORKSPACE_NAME) ||
127-
realPath.includes(BIN_DIR) || realPath.includes(GEN_DIR)) {
128+
realPath.startsWith(outputBase)) {
128129
continue;
129130
}
130131

@@ -149,6 +150,7 @@ function loadRunfilesManifest(manifestPath) {
149150
genRoot = `${execRoot}${GEN_DIR}/`;
150151
}
151152

153+
log_verbose(`using outputBase ${outputBase}`);
152154
log_verbose(`using binRoot ${binRoot}`);
153155
log_verbose(`using genRoot ${genRoot}`);
154156
log_verbose(`using localWorkspacePath ${localWorkspacePath}`);

0 commit comments

Comments
 (0)