Skip to content

Commit

Permalink
fix(builtin): fix localWorkspacePath logic
Browse files Browse the repository at this point in the history
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 bazel-contrib#1087
  • Loading branch information
alexeagle committed Sep 4, 2019
1 parent 10d136a commit 0b2c5e1
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion internal/node/node_loader.js
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ function loadRunfilesManifest(manifestPath) {
const runfilesManifest = Object.create(null);
const reverseRunfilesManifest = Object.create(null);
const input = fs.readFileSync(manifestPath, {encoding: 'utf-8'});
const outputBase = manifestPath.substring(0, manifestPath.indexOf('/execroot/'));

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

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

log_verbose(`using outputBase ${outputBase}`);
log_verbose(`using binRoot ${binRoot}`);
log_verbose(`using genRoot ${genRoot}`);
log_verbose(`using localWorkspacePath ${localWorkspacePath}`);
Expand Down

0 comments on commit 0b2c5e1

Please sign in to comment.