Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Manifest path logic gets wrong localWorkspacePath, breaks require #1087

Closed
alexeagle opened this issue Sep 4, 2019 · 0 comments · Fixed by #1088
Closed

Manifest path logic gets wrong localWorkspacePath, breaks require #1087

alexeagle opened this issue Sep 4, 2019 · 0 comments · Fixed by #1088

Comments

@alexeagle
Copy link
Collaborator

alexeagle commented Sep 4, 2019

When we resolve from a RUNFILES_MANIFEST_FILE (generally Windows only), then we load the runfiles manifest and do some path logic on it to power later resolutions.

A manifest typically looks like

bazel_tools/tools/bash/runfiles/runfiles.bash C:/users/alexeagle/_bazel_alexeagle/7yoikqcr/external/bazel_tools/tools/bash/runfiles/runfiles.bash
build_bazel_rules_nodejs/packages/terser/test/inline_sourcemap/out.min.js C:/users/alexeagle/_bazel_alexeagle/7yoikqcr/execroot/build_bazel_rules_nodejs/bazel-out/x64_windows-fastbuild/bin/packages/terser/test/inline_sourcemap/out.min.js
build_bazel_rules_nodejs/packages/terser/test/inline_sourcemap/out.min.js.map C:/users/alexeagle/_bazel_alexeagle/7yoikqcr/execroot/build_bazel_rules_nodejs/bazel-out/x64_windows-fastbuild/bin/packages/terser/test/inline_sourcemap/out.min.js.map
build_bazel_rules_nodejs/packages/terser/test/inline_sourcemap/spec.js C:/users/alexeagle/documents/github/rules_nodejs/packages/terser/test/inline_sourcemap/spec.js

We iterate through these entries and skip to the last one, thanks to this logic:
https://github.com/bazelbuild/rules_nodejs/blob/df37fca0113f9e7e7536185cb907e2e6ca9e33f2/internal/node/node_loader.js#L126-L129
so we print

[test_loader.js] using localWorkspacePath C:/users/alexeagle/documents/github/rules_nodejs/

and things work.


However, if the manifest has a new entry that appears higher, and is under the output_base but not under the bin_dir (like the linker.js I was adding in #1079) then the manifest starts like this

bazel_tools/tools/bash/runfiles/runfiles.bash C:/users/alexeagle/_bazel_alexeagle/7yoikqcr/external/bazel_tools/tools/bash/runfiles/runfiles.bash
build_bazel_rules_nodejs/internal/node/node_loader.js C:/users/alexeagle/_bazel_alexeagle/7yoikqcr/external/build_bazel_rules_nodejs/internal/node/node_loader.js

The second entry isn't matched by the short-circuit logic, so it gets used. then we print
[test_loader.js] using localWorkspacePath C:/users/alexeagle/_bazel_alexeagle/7yoikqcr/external/build_bazel_rules_nodejs/
and later module resolutions fail.

alexeagle added a commit to alexeagle/rules_nodejs that referenced this issue Sep 4, 2019
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
alexeagle added a commit to alexeagle/rules_nodejs that referenced this issue Sep 4, 2019
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
alexeagle added a commit to alexeagle/rules_nodejs that referenced this issue Sep 4, 2019
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
alexeagle added a commit to alexeagle/rules_nodejs that referenced this issue Sep 4, 2019
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
alexeagle added a commit that referenced this issue Sep 4, 2019
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant