-
-
Notifications
You must be signed in to change notification settings - Fork 108
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
perf(npm): use actions.run instead of actions.run_shell (#1905)
- Loading branch information
Showing
1 changed file
with
13 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -223,16 +223,21 @@ def _npm_package_store_impl(ctx): | |
# tar to strip one directory level. Some packages have directory permissions missing | ||
# executable which make the directories not listable ([email protected] for example). | ||
bsdtar = ctx.toolchains["@aspect_bazel_lib//lib:tar_toolchain_type"] | ||
args = ctx.actions.args() | ||
args.add(bsdtar.tarinfo.binary) | ||
args.add(src) | ||
args.add(package_store_directory.path) # Need to use `.path` due to: Error in add: Cannot add directories to Args#add since they may expand to multiple values. Either use Args#add_all (if you want expansion) or args.add(directory.path). | ||
ctx.actions.run_shell( | ||
tools = [bsdtar.tarinfo.binary], | ||
ctx.actions.run( | ||
executable = bsdtar.tarinfo.binary, | ||
inputs = depset(direct = [src], transitive = [bsdtar.default.files]), | ||
outputs = [package_store_directory], | ||
command = "$1 --extract --no-same-owner --no-same-permissions --strip-components 1 --file $2 --directory $3", | ||
arguments = [args], | ||
arguments = [ | ||
"--extract", | ||
"--no-same-owner", | ||
"--no-same-permissions", | ||
"--strip-components", | ||
"1", | ||
"--file", | ||
src.path, | ||
"--directory", | ||
package_store_directory.path, | ||
], | ||
mnemonic = "NpmPackageExtract", | ||
progress_message = "Extracting npm package {}@{}".format(package, version), | ||
) | ||
|