-
-
Notifications
You must be signed in to change notification settings - Fork 159
fix: npm_deps tests on Windows, add a fix for Bazel 9.0.0 #2261 #2700
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
base: main
Are you sure you want to change the base?
Changes from 1 commit
3467a06
c6294d0
8cb0190
f3aee52
467e3e6
1b30459
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -14,32 +14,34 @@ function getAcornVersion() { | |
| } | ||
|
|
||
| function sandboxAssert() { | ||
| if (!/-sandbox\/\d+\/execroot\//.test(__filename)) { | ||
| if (!/[/\\]execroot[/\\]/.test(__filename)) { | ||
| throw new Error(`Not in sandbox: ${__filename}`) | ||
| } | ||
|
|
||
| // Use of npm_package() copies files into the npm package store. | ||
| if (!__filename.includes('/node_modules/.aspect_rules_js/')) { | ||
| if (!/[/\\]node_modules[/\\]\.aspect_rules_js[/\\]/.test(__filename)) { | ||
| throw new Error(`Not in package store: ${__filename}`) | ||
| } | ||
|
|
||
| // When running under test, files should be in runfiles. | ||
| // This package may also be used as a run_binary(tool) and not in a test. | ||
| if (process.env.TEST_WORKSPACE) { | ||
| // On Windows, Node.js resolves junctions to their real path so __filename | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is that a fs-patch bug? Why does that only happen on windows? 🤔
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not an fs-patch bug. Node.js on Windows resolves junctions (directory symlinks) to their real path when returning
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I mean... that is a bug. I'm just not sure if we can ever fix it?
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think this is just how node.js is with junctions and we are kind of working around it. What do you have in mind as alternative? |
||
| // won't start with RUNFILES_DIR. | ||
| if (process.env.TEST_WORKSPACE && process.platform !== 'win32') { | ||
| if (!__filename.startsWith(process.env.RUNFILES_DIR)) { | ||
| throw new Error(`Not in runfiles: ${__filename}`) | ||
| } | ||
| } | ||
|
|
||
| // Resolve of third-party package 'uuid' | ||
| const uuid_path = require.resolve('uuid') | ||
| if (!/-sandbox\/\d+\/execroot\//.test(uuid_path)) { | ||
| if (!/[/\\]execroot[/\\]/.test(uuid_path)) { | ||
| throw new Error(`uuid not in sandbox: ${uuid_path}`) | ||
| } | ||
| if (!uuid_path.includes('/node_modules/.aspect_rules_js/uuid@')) { | ||
| if (!/[/\\]node_modules[/\\]\.aspect_rules_js[/\\]uuid@/.test(uuid_path)) { | ||
| throw new Error(`uuid not in package store: ${uuid_path}`) | ||
| } | ||
| if (process.env.TEST_WORKSPACE) { | ||
| if (process.env.TEST_WORKSPACE && process.platform !== 'win32') { | ||
| if (!uuid_path.startsWith(process.env.RUNFILES_DIR)) { | ||
| throw new Error( | ||
| `uuid not in runfiles while __filename is: ${uuid_path}` | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -493,8 +493,11 @@ def _symlink_package_store(ctx, package_store_name, target, name): | |
| name, | ||
| ) | ||
| symlink = ctx.actions.declare_symlink(store_symlink_path) | ||
| ctx.actions.symlink( | ||
jbedard marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| output = symlink, | ||
| target_path = ("../../.." if "/" in name else "../..") + target, | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This logic got replaced with a
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It should be just string concats I think |
||
| ) | ||
| kwargs = { | ||
| "output": symlink, | ||
| "target_path": ("../../.." if "/" in name else "../..") + target, | ||
| } | ||
| if utils.supports_symlink_target_type: | ||
| kwargs["target_type"] = "directory" | ||
| ctx.actions.symlink(**kwargs) | ||
| return symlink | ||
Uh oh!
There was an error while loading. Please reload this page.