mirror of
https://github.com/angular/angular-cli.git
synced 2025-05-15 01:54:04 +08:00
build: update bazel pkg tars to .tgz file extension
This commit is contained in:
parent
856720b913
commit
14a95d8eb9
@ -139,7 +139,7 @@ export default async function (
|
|||||||
for (const target of targets) {
|
for (const target of targets) {
|
||||||
const packageDir = target.replace(/\/\/packages\/(.*):npm_package_archive/, '$1');
|
const packageDir = target.replace(/\/\/packages\/(.*):npm_package_archive/, '$1');
|
||||||
const bazelOutDir = join(bazelBin, 'packages', packageDir, 'npm_package');
|
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 packageJsonPath = `${bazelOutDir}/package.json`;
|
||||||
const packageName = require(packageJsonPath).name;
|
const packageName = require(packageJsonPath).name;
|
||||||
const destDir = `${distRoot}/${packageName}`;
|
const destDir = `${distRoot}/${packageName}`;
|
||||||
|
@ -59,7 +59,7 @@ def pkg_npm(name, pkg_deps = [], use_prodmode_output = False, **kwargs):
|
|||||||
in the same folder to exist.
|
in the same folder to exist.
|
||||||
|
|
||||||
Args:
|
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.
|
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.
|
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.
|
**kwargs: Additional arguments passed to the real pkg_npm.
|
||||||
@ -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
|
# 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(
|
copy_to_bin(
|
||||||
name = "package_json_copy",
|
name = "package_json_copy",
|
||||||
srcs = [pkg_json],
|
srcs = [pkg_json],
|
||||||
@ -195,7 +195,7 @@ def pkg_npm(name, pkg_deps = [], use_prodmode_output = False, **kwargs):
|
|||||||
pkg_tar(
|
pkg_tar(
|
||||||
name = name + "_archive",
|
name = name + "_archive",
|
||||||
srcs = [":%s" % name],
|
srcs = [":%s" % name],
|
||||||
extension = "tar.gz",
|
extension = "tgz",
|
||||||
strip_prefix = "./%s" % name,
|
strip_prefix = "./%s" % name,
|
||||||
visibility = visibility,
|
visibility = visibility,
|
||||||
)
|
)
|
||||||
|
@ -8,7 +8,7 @@ load("@aspect_bazel_lib//lib:utils.bzl", "to_label")
|
|||||||
def link_package_json_to_tarballs(name, src, pkg_deps, out):
|
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.
|
"""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:
|
Args:
|
||||||
name: Name of the rule
|
name: Name of the rule
|
||||||
@ -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.
|
# for the tar for this package as that would create a circular dependency.
|
||||||
pkg_label = to_label(pkg_dep)
|
pkg_label = to_label(pkg_dep)
|
||||||
if pkg_label.package != src_pkg:
|
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)
|
srcs.append(pkg_tar)
|
||||||
|
|
||||||
# Deriving the absolute path to the tar in the execroot requries different
|
# Deriving the absolute path to the tar in the execroot requries different
|
||||||
@ -53,7 +53,7 @@ def link_package_json_to_tarballs(name, src, pkg_deps, out):
|
|||||||
name = "%s_%s_filter" % (name, i),
|
name = "%s_%s_filter" % (name, i),
|
||||||
srcs = srcs,
|
srcs = srcs,
|
||||||
cmd = """
|
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}))
|
PKGNAME=$$(cat $(execpath {pkg_name}))
|
||||||
if [[ "$$TAR" != *bazel-out* ]]; then
|
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."
|
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."
|
||||||
|
Loading…
x
Reference in New Issue
Block a user