-
-
Notifications
You must be signed in to change notification settings - Fork 644
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
additional tools during nodejs processes invocation #21833
base: main
Are you sure you want to change the base?
Conversation
7f739c5
to
c59f2d4
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks reasonable overall. Thanks for contributing!
advanced=True, | ||
) | ||
|
||
_macos_tools = StrListOption( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The approach we've used with Docker is optional_tools
: tools that should be included if they're available. https://www.pantsbuild.org/stable/reference/subsystems/docker#optional_tools
The code that's used for filtering the tools is at:
pants/src/python/pants/backend/docker/util_rules/docker_binary.py
Lines 160 to 177 in c4da187
if optional_tools: | |
optional_tools_requests = [ | |
BinaryPathRequest(binary_name=binary_name, search_path=search_path) | |
for binary_name in optional_tools | |
] | |
optional_tools_paths = await MultiGet( | |
Get(BinaryPaths, BinaryPathRequest, optional_tools_request) | |
for optional_tools_request in optional_tools_requests | |
) | |
all_binary_first_paths.extend( | |
[ | |
cast(BinaryPath, path.first_path) # safe since we check for non-empty paths below | |
for path in optional_tools_paths | |
if path.paths | |
] | |
) |
Maybe a similar approach could work here and be a bit more flexible?
It is a bit more fiddly to get set-up, though.
Ah, it'd also be good to add a test for this, to ensure the functionality keeps working in future. Again the docker version might be handy inspiration: pants/src/python/pants/backend/docker/util_rules/docker_binary_test.py Lines 164 to 211 in c4da187
|
Description
During nodejs processes execution, such as
yarn install
, some additional tools might need to be present on the PATH, e.g. make, cp, c++, etc, specially when the npm dependencies usesnode-gyp
under the hood, so these additional tools are necessary to compile binaries. The current implementation doesn’t allow us to specify more tools than the default.This adds
tools
andmacos_tools
as options to thenodejs
subsystem so that these additional tools can be added to the sandbox during nodejs processes execution.There might be cases where macos specific tools might be needed - mostly when
node-gyp
is used - such asxcrun
andxcodebuild
, which are necessary to compile native stuff, and these tools are not available on linux based os, so I've added themacos_tools
where these specific tools can be set.Fixes #21638.