Skip to content

Commit

Permalink
build: update bazel pkg tars to .tgz file extension
Browse files Browse the repository at this point in the history
  • Loading branch information
jbedard authored and angular-robot[bot] committed Nov 28, 2022
1 parent 9b6d190 commit f3fd1e4
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion scripts/build-bazel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ export default async function (
for (const target of targets) {
const packageDir = target.replace(/\/\/packages\/(.*):npm_package_archive/, '$1');
const bazelOutDir = join(bazelBin, 'packages', packageDir, 'npm_package');
const tarPath = `${bazelBin}/packages/${packageDir}/npm_package_archive.tar.gz`;
const tarPath = `${bazelBin}/packages/${packageDir}/npm_package_archive.tgz`;
const packageJsonPath = `${bazelOutDir}/package.json`;
const packageName = require(packageJsonPath).name;
const destDir = `${distRoot}/${packageName}`;
Expand Down
6 changes: 3 additions & 3 deletions tools/defaults.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ def pkg_npm(name, pkg_deps = [], use_prodmode_output = False, **kwargs):
in the same folder to exist.
Args:
name: Name of the pkg_npm rule. '_archive.tar.gz' is appended to create the tarball.
name: Name of the pkg_npm rule. '_archive.tgz' is appended to create the tarball.
pkg_deps: package.json files of dependent packages. These are used for local path substitutions when --config=local is set.
use_prodmode_output: False to ship ES5 devmode output, True to ship ESM output. Defaults to False.
**kwargs: Additional arguments passed to the real pkg_npm.
Expand Down Expand Up @@ -116,7 +116,7 @@ def pkg_npm(name, pkg_deps = [], use_prodmode_output = False, **kwargs):
)

# Copy package.json files to bazel-out so we can use their bazel-out paths to determine
# the corresponding package npm package tar.gz path for substitutions.
# the corresponding package npm package tgz path for substitutions.
copy_to_bin(
name = "package_json_copy",
srcs = [pkg_json],
Expand Down Expand Up @@ -195,7 +195,7 @@ def pkg_npm(name, pkg_deps = [], use_prodmode_output = False, **kwargs):
pkg_tar(
name = name + "_archive",
srcs = [":%s" % name],
extension = "tar.gz",
extension = "tgz",
strip_prefix = "./%s" % name,
visibility = visibility,
)
6 changes: 3 additions & 3 deletions tools/link_package_json_to_tarballs.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ load("@aspect_bazel_lib//lib:utils.bzl", "to_label")
def link_package_json_to_tarballs(name, src, pkg_deps, out):
"""Substitute tar paths into a package.json file for the packages it depends on.
src and pkg_deps must be labels in the bazel-out tree for the derived path to the npm_package_archive.tar.gz to be correct.
src and pkg_deps must be labels in the bazel-out tree for the derived path to the npm_package_archive.tgz to be correct.
Args:
name: Name of the rule
Expand Down Expand Up @@ -41,7 +41,7 @@ def link_package_json_to_tarballs(name, src, pkg_deps, out):
# for the tar for this package as that would create a circular dependency.
pkg_label = to_label(pkg_dep)
if pkg_label.package != src_pkg:
pkg_tar = "@%s//%s:npm_package_archive.tar.gz" % (pkg_label.workspace_name, pkg_label.package)
pkg_tar = "@%s//%s:npm_package_archive.tgz" % (pkg_label.workspace_name, pkg_label.package)
srcs.append(pkg_tar)

# Deriving the absolute path to the tar in the execroot requries different
Expand All @@ -53,7 +53,7 @@ def link_package_json_to_tarballs(name, src, pkg_deps, out):
name = "%s_%s_filter" % (name, i),
srcs = srcs,
cmd = """
TAR=$$(dirname $$({abs_path_sandbox} || {abs_path_nosandbox}))/npm_package_archive.tar.gz
TAR=$$(dirname $$({abs_path_sandbox} || {abs_path_nosandbox}))/npm_package_archive.tgz
PKGNAME=$$(cat $(execpath {pkg_name}))
if [[ "$$TAR" != *bazel-out* ]]; then
echo "ERROR: package.json passed to substitute_tar_deps must be in the output tree. You can use copy_to_bin to copy a source file to the output tree."
Expand Down

0 comments on commit f3fd1e4

Please sign in to comment.