build: update to rules_nodejs v4.0.0-beta.0 (#42760)
Updates the Bazel NodeJS rules to v4.0.0-beta.0. This is necessary so that the Angular components repo can update, and it's generally good to stay as up-to-date as possible with the Bazel rules as it's easy to fall behind, and updating early allows us to discover issues affecting our tooling earlier (where they are easier to address due to e.g. potential breaking change policy). PR Close #42760
This commit is contained in:
parent
9da68a77e6
commit
762e057e85
|
@ -8,8 +8,8 @@ load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
|
|||
# Fetch rules_nodejs so we can install our npm dependencies
|
||||
http_archive(
|
||||
name = "build_bazel_rules_nodejs",
|
||||
sha256 = "8f5f192ba02319254aaf2cdcca00ec12eaafeb979a80a1e946773c520ae0a2c9",
|
||||
urls = ["https://github.com/bazelbuild/rules_nodejs/releases/download/3.7.0/rules_nodejs-3.7.0.tar.gz"],
|
||||
sha256 = "5c40083120eadec50a3497084f99bc75a85400ea727e82e0b2f422720573130f",
|
||||
urls = ["https://github.com/bazelbuild/rules_nodejs/releases/download/4.0.0-beta.0/rules_nodejs-4.0.0-beta.0.tar.gz"],
|
||||
)
|
||||
|
||||
# Check the rules_nodejs version and download npm dependencies
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
# BEGIN-INTERNAL
|
||||
load("@build_bazel_rules_nodejs//:index.bzl", "pkg_npm")
|
||||
load("@npm//@bazel/typescript:index.bzl", "ts_library")
|
||||
load("//dev-infra:index.bzl", "ng_dev_rolled_up_generated_file")
|
||||
load("//dev-infra:defaults.bzl", "ng_dev_rolled_up_generated_file", "ts_library")
|
||||
# END-INTERNAL
|
||||
|
||||
exports_files(["tsconfig.json"])
|
||||
|
@ -12,7 +11,6 @@ ts_library(
|
|||
srcs = [
|
||||
"cli.ts",
|
||||
],
|
||||
module_name = "@angular/dev-infra-private",
|
||||
deps = [
|
||||
"//dev-infra/caretaker",
|
||||
"//dev-infra/commit-message",
|
||||
|
@ -47,6 +45,7 @@ genrule(
|
|||
pkg_npm(
|
||||
name = "npm_package",
|
||||
srcs = [
|
||||
# Main bazel entry-point for the shared `dev-infra` package.
|
||||
"index.bzl",
|
||||
"BUILD.bazel",
|
||||
# Some tools within `dev-infra` which are shipped as Bazel rules might
|
||||
|
@ -60,12 +59,13 @@ pkg_npm(
|
|||
# substitutions to replace these in the published version of dev-infra.
|
||||
"//dev-infra/": "@npm//@angular/dev-infra-private/",
|
||||
"//dev-infra:": "@npm//@angular/dev-infra-private:",
|
||||
|
||||
# Substitutions needed for `//dev-infra/benchmark`:
|
||||
"//packages/benchpress": "@npm//@angular/benchpress",
|
||||
"//packages/bazel": "@npm//@angular/bazel",
|
||||
"//packages/zone.js/bundles:zone.umd.js": "@npm//zone.js",
|
||||
"//packages/core": "@npm//@angular/core",
|
||||
"//packages/platform-browser": "@npm//@angular/platform-browser",
|
||||
|
||||
# This substitution is particularly verbose because we need to make sure
|
||||
# that only things available via Angular Bazel are imported from
|
||||
# tools/defaults.bzl.
|
||||
|
|
|
@ -1,11 +1,10 @@
|
|||
package(default_visibility = ["//visibility:public"])
|
||||
load("//dev-infra:defaults.bzl", "ts_library")
|
||||
|
||||
load("@npm//@bazel/typescript:index.bzl", "ts_library")
|
||||
package(default_visibility = ["//visibility:public"])
|
||||
|
||||
ts_library(
|
||||
name = "driver-utilities",
|
||||
srcs = glob(["*.ts"]),
|
||||
module_name = "@angular/dev-infra-private/benchmark/driver-utilities",
|
||||
tsconfig = "//dev-infra/benchmark/component_benchmark:tsconfig-e2e.json",
|
||||
deps = [
|
||||
"//packages/benchpress",
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
load("@npm//@bazel/typescript:index.bzl", "ts_library")
|
||||
load("//tools:defaults.bzl", "jasmine_node_test")
|
||||
load("//dev-infra:defaults.bzl", "jasmine_node_test", "ts_library")
|
||||
|
||||
ts_library(
|
||||
name = "caretaker",
|
||||
|
@ -7,7 +6,6 @@ ts_library(
|
|||
["**/*.ts"],
|
||||
exclude = ["**/*.spec.ts"],
|
||||
),
|
||||
module_name = "@angular/dev-infra-private/caretaker",
|
||||
visibility = ["//dev-infra:__subpackages__"],
|
||||
deps = [
|
||||
"//dev-infra/release/versioning",
|
||||
|
@ -41,7 +39,6 @@ ts_library(
|
|||
|
||||
jasmine_node_test(
|
||||
name = "test",
|
||||
bootstrap = ["//tools/testing:node_no_angular_es5"],
|
||||
deps = [
|
||||
":test_lib",
|
||||
],
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
load("//tools:defaults.bzl", "jasmine_node_test")
|
||||
load("@npm//@bazel/typescript:index.bzl", "ts_library")
|
||||
load("//dev-infra:defaults.bzl", "jasmine_node_test", "ts_library")
|
||||
|
||||
ts_library(
|
||||
name = "commit-message",
|
||||
|
@ -7,7 +6,6 @@ ts_library(
|
|||
["**/*.ts"],
|
||||
exclude = ["**/*.spec.ts"],
|
||||
),
|
||||
module_name = "@angular/dev-infra-private/commit-message",
|
||||
visibility = ["//dev-infra:__subpackages__"],
|
||||
deps = [
|
||||
"//dev-infra/utils",
|
||||
|
@ -41,7 +39,6 @@ ts_library(
|
|||
|
||||
jasmine_node_test(
|
||||
name = "test",
|
||||
bootstrap = ["//tools/testing:node_no_angular_es5"],
|
||||
deps = [
|
||||
":test_lib",
|
||||
],
|
||||
|
|
|
@ -0,0 +1,67 @@
|
|||
"""
|
||||
Defaults for the `//dev-infra` Bazel package. These are different than
|
||||
the defaults in `//tools:defaults.bzl` which are specific to the package
|
||||
structure as seen within `/packages/`.
|
||||
"""
|
||||
|
||||
load("@build_bazel_rules_nodejs//:index.bzl", "generated_file_test")
|
||||
load("@npm//@bazel/jasmine:index.bzl", _jasmine_node_test = "jasmine_node_test")
|
||||
load("@npm//@bazel/typescript:index.bzl", _ts_library = "ts_library")
|
||||
load("@npm//@bazel/rollup:index.bzl", "rollup_bundle")
|
||||
|
||||
NPM_PACKAGE_NAME = "@angular/dev-infra-private"
|
||||
|
||||
def _compute_module_name():
|
||||
current_pkg = native.package_name()
|
||||
|
||||
if current_pkg == "dev-infra":
|
||||
return NPM_PACKAGE_NAME
|
||||
|
||||
# For deep targets within `//dev-infra` construct the module name in a way that matches
|
||||
# the structure within the NPM package (i.e. simply appending the actual package path)
|
||||
return "%s/%s" % (NPM_PACKAGE_NAME, current_pkg[len("dev-infra/"):])
|
||||
|
||||
def ts_library(name, **kwargs):
|
||||
_ts_library(
|
||||
name = name,
|
||||
# If no `module_name` is set, compute a module name based on the current Bazel
|
||||
# package. The module names should match the NPM package structure so that the NPM
|
||||
# package can be used properly. Note that we disallow any custom `module_name` for
|
||||
# `//dev-infra` as this usually signifies a mistake we want to raise awareness for.
|
||||
module_name = _compute_module_name(),
|
||||
# We use the module name as package name, so that the target can be resolved within
|
||||
# NodeJS executions, by activating the Bazel NodeJS linker.
|
||||
# See: https://github.com/bazelbuild/rules_nodejs/pull/2799.
|
||||
package_name = _compute_module_name(),
|
||||
**kwargs
|
||||
)
|
||||
|
||||
def jasmine_node_test(**kwargs):
|
||||
_jasmine_node_test(**kwargs)
|
||||
|
||||
# This file continues to serve as indicator for `rules_nodejs` and instructs it to preserve the
|
||||
# content output in the NPM install workspace. This allows consumers to use rules and targets from
|
||||
# within Bazel. e.g. by using `@npm//@angular/dev-infra-private/<..>`.
|
||||
# See: https://github.com/bazelbuild/rules_nodejs/commit/4f508b1a0be1f5444e9c13b0439e649449792fef.
|
||||
|
||||
def ng_dev_rolled_up_generated_file(name, entry_point, deps = [], rollup_args = []):
|
||||
"""Rollup and generated file test macro.
|
||||
|
||||
This provides a single macro to create a rollup bundled script and a generated file
|
||||
test for the created script to ensure it stays up to date in the repository.
|
||||
"""
|
||||
rollup_bundle(
|
||||
name = "%s_bundle" % name,
|
||||
args = rollup_args,
|
||||
entry_point = entry_point,
|
||||
format = "cjs",
|
||||
silent = True,
|
||||
sourcemap = "false",
|
||||
deps = deps,
|
||||
)
|
||||
|
||||
generated_file_test(
|
||||
name = name,
|
||||
src = "%s.js" % name,
|
||||
generated = "%s_bundle" % name,
|
||||
)
|
|
@ -1,11 +1,10 @@
|
|||
load("@npm//@bazel/typescript:index.bzl", "ts_library")
|
||||
load("//dev-infra:defaults.bzl", "ts_library")
|
||||
|
||||
ts_library(
|
||||
name = "format",
|
||||
srcs = glob([
|
||||
"**/*.ts",
|
||||
]),
|
||||
module_name = "@angular/dev-infra-private/format",
|
||||
visibility = ["//dev-infra:__subpackages__"],
|
||||
deps = [
|
||||
"//dev-infra/utils",
|
||||
|
|
|
@ -3,32 +3,7 @@
|
|||
# Use of this source code is governed by an MIT-style license that can be
|
||||
# found in the LICENSE file at https://angular.io/license
|
||||
|
||||
load("@build_bazel_rules_nodejs//:index.bzl", "generated_file_test")
|
||||
load("@npm//@bazel/rollup:index.bzl", "rollup_bundle")
|
||||
|
||||
# This file continues to serve as indicator for `rules_nodejs` and instructs it preserve the
|
||||
# content output in the NPM install workspace. This allows consumers to use rules and targets from
|
||||
# within Bazel. e.g. by using `@npm//@angular/dev-infra-private/<..>`.
|
||||
# File is currently empty but serves as indicator for `rules_nodejs` and instructs it to
|
||||
# preserve the content output in the NPM install workspace. This allows consumers to use
|
||||
# rules and targets from within Bazel. e.g. by using `@npm//@angular/dev-infra-private/<..>`.
|
||||
# See: https://github.com/bazelbuild/rules_nodejs/commit/4f508b1a0be1f5444e9c13b0439e649449792fef.
|
||||
|
||||
def ng_dev_rolled_up_generated_file(name, entry_point, deps = [], rollup_args = []):
|
||||
"""Rollup and generated file test macro.
|
||||
|
||||
This provides a single macro to create a rollup bundled script and a generated file test for the
|
||||
created script to ensure it stays up to date in the repository.
|
||||
"""
|
||||
rollup_bundle(
|
||||
name = "%s_bundle" % name,
|
||||
args = rollup_args,
|
||||
entry_point = entry_point,
|
||||
format = "cjs",
|
||||
silent = True,
|
||||
sourcemap = "false",
|
||||
deps = deps,
|
||||
)
|
||||
|
||||
generated_file_test(
|
||||
name = name,
|
||||
src = "%s.js" % name,
|
||||
generated = "%s_bundle" % name,
|
||||
)
|
||||
|
|
|
@ -1,9 +1,8 @@
|
|||
load("@npm//@bazel/typescript:index.bzl", "ts_library")
|
||||
load("//dev-infra:defaults.bzl", "ts_library")
|
||||
|
||||
ts_library(
|
||||
name = "misc",
|
||||
srcs = glob(["**/*.ts"]),
|
||||
module_name = "@angular/dev-infra-private/misc/",
|
||||
visibility = ["//dev-infra:__subpackages__"],
|
||||
deps = [
|
||||
"//dev-infra/release/build",
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
load("@npm//@bazel/typescript:index.bzl", "ts_library")
|
||||
load("//dev-infra:defaults.bzl", "ts_library")
|
||||
|
||||
ts_library(
|
||||
name = "ngbot",
|
||||
|
@ -6,7 +6,6 @@ ts_library(
|
|||
"cli.ts",
|
||||
"verify.ts",
|
||||
],
|
||||
module_name = "@angular/dev-infra-private/ngbot",
|
||||
visibility = ["//dev-infra:__subpackages__"],
|
||||
deps = [
|
||||
"//dev-infra/utils",
|
||||
|
|
|
@ -1,9 +1,8 @@
|
|||
load("@npm//@bazel/typescript:index.bzl", "ts_library")
|
||||
load("//dev-infra:defaults.bzl", "ts_library")
|
||||
|
||||
ts_library(
|
||||
name = "pr",
|
||||
srcs = ["cli.ts"],
|
||||
module_name = "@angular/dev-infra-private/pr",
|
||||
visibility = ["//dev-infra:__subpackages__"],
|
||||
deps = [
|
||||
"//dev-infra/pr/check-target-branches",
|
||||
|
|
|
@ -1,9 +1,8 @@
|
|||
load("@npm//@bazel/typescript:index.bzl", "ts_library")
|
||||
load("//dev-infra:defaults.bzl", "ts_library")
|
||||
|
||||
ts_library(
|
||||
name = "check-target-branches",
|
||||
srcs = glob(["*.ts"]),
|
||||
module_name = "@angular/dev-infra-private/pr/check-target-branches",
|
||||
visibility = ["//dev-infra:__subpackages__"],
|
||||
deps = [
|
||||
"//dev-infra/pr/merge",
|
||||
|
|
|
@ -1,9 +1,8 @@
|
|||
load("@npm//@bazel/typescript:index.bzl", "ts_library")
|
||||
load("//dev-infra:defaults.bzl", "ts_library")
|
||||
|
||||
ts_library(
|
||||
name = "checkout",
|
||||
srcs = glob(["*.ts"]),
|
||||
module_name = "@angular/dev-infra-private/pr/checkout",
|
||||
visibility = ["//dev-infra:__subpackages__"],
|
||||
deps = [
|
||||
"//dev-infra/pr/common",
|
||||
|
|
|
@ -1,9 +1,8 @@
|
|||
load("@npm//@bazel/typescript:index.bzl", "ts_library")
|
||||
load("//dev-infra:defaults.bzl", "ts_library")
|
||||
|
||||
ts_library(
|
||||
name = "common",
|
||||
srcs = glob(["*.ts"]),
|
||||
module_name = "@angular/dev-infra-private/pr/common",
|
||||
visibility = ["//dev-infra:__subpackages__"],
|
||||
deps = [
|
||||
"//dev-infra/utils",
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
load("@npm//@bazel/typescript:index.bzl", "ts_library")
|
||||
load("//dev-infra:defaults.bzl", "ts_library")
|
||||
|
||||
ts_library(
|
||||
name = "discover-new-conflicts",
|
||||
|
@ -6,7 +6,6 @@ ts_library(
|
|||
"cli.ts",
|
||||
"index.ts",
|
||||
],
|
||||
module_name = "@angular/dev-infra-private/pr/discover-new-conflicts",
|
||||
visibility = ["//dev-infra:__subpackages__"],
|
||||
deps = [
|
||||
"//dev-infra/utils",
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
load("@npm//@bazel/typescript:index.bzl", "ts_library")
|
||||
load("//tools:defaults.bzl", "jasmine_node_test")
|
||||
load("//dev-infra:defaults.bzl", "jasmine_node_test", "ts_library")
|
||||
|
||||
ts_library(
|
||||
name = "merge",
|
||||
|
@ -7,7 +6,7 @@ ts_library(
|
|||
["**/*.ts"],
|
||||
exclude = ["**/*.spec.ts"],
|
||||
),
|
||||
module_name = "@angular/dev-infra-private/pr/merge",
|
||||
|
||||
# prodmode target must be set to es5 as the Ora class, which is extended is not a proper
|
||||
# prototyped object.
|
||||
prodmode_target = "es5",
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
load("@npm//@bazel/typescript:index.bzl", "ts_library")
|
||||
load("//dev-infra:defaults.bzl", "ts_library")
|
||||
|
||||
ts_library(
|
||||
name = "rebase",
|
||||
|
@ -6,7 +6,6 @@ ts_library(
|
|||
"cli.ts",
|
||||
"index.ts",
|
||||
],
|
||||
module_name = "@angular/dev-infra-private/pr/rebase",
|
||||
visibility = ["//dev-infra:__subpackages__"],
|
||||
deps = [
|
||||
"//dev-infra/commit-message",
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
load("@npm//@bazel/typescript:index.bzl", "ts_library")
|
||||
load("//tools:defaults.bzl", "jasmine_node_test")
|
||||
load("//dev-infra:defaults.bzl", "jasmine_node_test", "ts_library")
|
||||
|
||||
ts_library(
|
||||
name = "pullapprove",
|
||||
|
@ -13,7 +12,6 @@ ts_library(
|
|||
"utils.ts",
|
||||
"verify.ts",
|
||||
],
|
||||
module_name = "@angular/dev-infra-private/pullapprove",
|
||||
visibility = ["//dev-infra:__subpackages__"],
|
||||
deps = [
|
||||
"//dev-infra/utils",
|
||||
|
|
|
@ -1,11 +1,10 @@
|
|||
load("@npm//@bazel/typescript:index.bzl", "ts_library")
|
||||
load("//dev-infra:defaults.bzl", "ts_library")
|
||||
|
||||
ts_library(
|
||||
name = "release",
|
||||
srcs = glob([
|
||||
"**/*.ts",
|
||||
]),
|
||||
module_name = "@angular/dev-infra-private/release",
|
||||
visibility = ["//dev-infra:__subpackages__"],
|
||||
deps = [
|
||||
"//dev-infra/release/build",
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
load("@npm//@bazel/typescript:index.bzl", "ts_library")
|
||||
load("//tools:defaults.bzl", "jasmine_node_test")
|
||||
load("//dev-infra:defaults.bzl", "jasmine_node_test", "ts_library")
|
||||
|
||||
exports_files([
|
||||
"build-worker.ts",
|
||||
|
@ -13,7 +12,6 @@ ts_library(
|
|||
],
|
||||
exclude = ["*.spec.ts"],
|
||||
),
|
||||
module_name = "@angular/dev-infra-private/release/build",
|
||||
visibility = ["//dev-infra:__subpackages__"],
|
||||
deps = [
|
||||
"//dev-infra/release/config",
|
||||
|
|
|
@ -1,11 +1,10 @@
|
|||
load("@npm//@bazel/typescript:index.bzl", "ts_library")
|
||||
load("//dev-infra:defaults.bzl", "ts_library")
|
||||
|
||||
ts_library(
|
||||
name = "config",
|
||||
srcs = glob([
|
||||
"**/*.ts",
|
||||
]),
|
||||
module_name = "@angular/dev-infra-private/release/config",
|
||||
visibility = ["//dev-infra:__subpackages__"],
|
||||
deps = [
|
||||
"//dev-infra/utils",
|
||||
|
|
|
@ -1,9 +1,8 @@
|
|||
load("@npm//@bazel/typescript:index.bzl", "ts_library")
|
||||
load("//dev-infra:defaults.bzl", "ts_library")
|
||||
|
||||
ts_library(
|
||||
name = "info",
|
||||
srcs = ["cli.ts"],
|
||||
module_name = "@angular/dev-infra-private/release/info",
|
||||
visibility = ["//dev-infra:__subpackages__"],
|
||||
deps = [
|
||||
"//dev-infra/release/config",
|
||||
|
|
|
@ -1,11 +1,10 @@
|
|||
load("@npm//@bazel/typescript:index.bzl", "ts_library")
|
||||
load("//dev-infra:defaults.bzl", "ts_library")
|
||||
|
||||
ts_library(
|
||||
name = "notes",
|
||||
srcs = glob([
|
||||
"**/*.ts",
|
||||
]),
|
||||
module_name = "@angular/dev-infra-private/release/notes",
|
||||
visibility = ["//dev-infra:__subpackages__"],
|
||||
deps = [
|
||||
"//dev-infra/commit-message",
|
||||
|
|
|
@ -1,11 +1,10 @@
|
|||
load("@npm//@bazel/typescript:index.bzl", "ts_library")
|
||||
load("//dev-infra:defaults.bzl", "ts_library")
|
||||
|
||||
ts_library(
|
||||
name = "publish",
|
||||
srcs = glob([
|
||||
"**/*.ts",
|
||||
]),
|
||||
module_name = "@angular/dev-infra-private/release/publish",
|
||||
visibility = ["//dev-infra:__subpackages__"],
|
||||
deps = [
|
||||
"//dev-infra/commit-message",
|
||||
|
|
|
@ -1,12 +1,10 @@
|
|||
load("@npm//@bazel/typescript:index.bzl", "ts_library")
|
||||
load("//tools:defaults.bzl", "jasmine_node_test")
|
||||
load("//dev-infra:defaults.bzl", "jasmine_node_test", "ts_library")
|
||||
|
||||
ts_library(
|
||||
name = "test_lib",
|
||||
srcs = glob([
|
||||
"**/*.ts",
|
||||
]),
|
||||
module_name = "@angular/dev-infra-private/release/test",
|
||||
deps = [
|
||||
"//dev-infra/commit-message",
|
||||
"//dev-infra/release/config",
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
load("@npm//@bazel/typescript:index.bzl", "ts_library")
|
||||
load("//tools:defaults.bzl", "jasmine_node_test")
|
||||
load("//dev-infra:defaults.bzl", "jasmine_node_test", "ts_library")
|
||||
|
||||
ts_library(
|
||||
name = "set-dist-tag",
|
||||
|
@ -9,7 +8,6 @@ ts_library(
|
|||
],
|
||||
exclude = ["*.spec.ts"],
|
||||
),
|
||||
module_name = "@angular/dev-infra-private/release/set-dist-tag",
|
||||
visibility = ["//dev-infra:__subpackages__"],
|
||||
deps = [
|
||||
"//dev-infra/release/config",
|
||||
|
|
|
@ -1,11 +1,10 @@
|
|||
load("@npm//@bazel/typescript:index.bzl", "ts_library")
|
||||
load("//dev-infra:defaults.bzl", "ts_library")
|
||||
|
||||
ts_library(
|
||||
name = "versioning",
|
||||
srcs = glob([
|
||||
"**/*.ts",
|
||||
]),
|
||||
module_name = "@angular/dev-infra-private/release/versioning",
|
||||
visibility = ["//dev-infra:__subpackages__"],
|
||||
deps = [
|
||||
"//dev-infra/release/config",
|
||||
|
|
|
@ -1,9 +1,8 @@
|
|||
load("@npm//@bazel/typescript:index.bzl", "ts_library")
|
||||
load("//dev-infra:defaults.bzl", "ts_library")
|
||||
|
||||
ts_library(
|
||||
name = "ts-circular-dependencies",
|
||||
srcs = glob(["*.ts"]),
|
||||
module_name = "@angular/dev-infra-private/ts-circular-dependencies",
|
||||
visibility = ["//dev-infra:__subpackages__"],
|
||||
deps = [
|
||||
"//dev-infra/utils",
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
load("@npm//@bazel/typescript:index.bzl", "ts_library")
|
||||
load("//dev-infra:defaults.bzl", "ts_library")
|
||||
|
||||
ts_library(
|
||||
name = "utils",
|
||||
|
@ -6,7 +6,7 @@ ts_library(
|
|||
"*.ts",
|
||||
"git/*.ts",
|
||||
]),
|
||||
module_name = "@angular/dev-infra-private/utils",
|
||||
|
||||
# prodmode target must be set to es5 as the Octokit class, which is extended is not a proper
|
||||
# prototyped object.
|
||||
prodmode_target = "es5",
|
||||
|
|
|
@ -1,9 +1,8 @@
|
|||
load("@npm//@bazel/typescript:index.bzl", "ts_library")
|
||||
load("//dev-infra:defaults.bzl", "ts_library")
|
||||
|
||||
ts_library(
|
||||
name = "testing",
|
||||
srcs = glob(["*.ts"]),
|
||||
module_name = "@angular/dev-infra-private/utils/testing",
|
||||
visibility = ["//dev-infra:__subpackages__"],
|
||||
deps = [
|
||||
"//dev-infra/utils",
|
||||
|
|
14
package.json
14
package.json
|
@ -54,13 +54,13 @@
|
|||
"@babel/template": "7.8.6",
|
||||
"@babel/traverse": "7.8.6",
|
||||
"@babel/types": "7.8.6",
|
||||
"@bazel/concatjs": "3.7.0",
|
||||
"@bazel/jasmine": "3.7.0",
|
||||
"@bazel/protractor": "3.7.0",
|
||||
"@bazel/rollup": "3.7.0",
|
||||
"@bazel/runfiles": "3.7.0",
|
||||
"@bazel/terser": "3.7.0",
|
||||
"@bazel/typescript": "3.7.0",
|
||||
"@bazel/concatjs": "4.0.0-beta.0",
|
||||
"@bazel/jasmine": "4.0.0-beta.0",
|
||||
"@bazel/protractor": "4.0.0-beta.0",
|
||||
"@bazel/rollup": "4.0.0-beta.0",
|
||||
"@bazel/runfiles": "4.0.0-beta.0",
|
||||
"@bazel/terser": "4.0.0-beta.0",
|
||||
"@bazel/typescript": "4.0.0-beta.0",
|
||||
"@microsoft/api-extractor": "7.18.1",
|
||||
"@octokit/rest": "^18.6.2",
|
||||
"@octokit/core": "^3.5.1",
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package(default_visibility = ["//visibility:public"])
|
||||
|
||||
load("//tools:defaults.bzl", "ng_package", "ts_library")
|
||||
|
||||
package(default_visibility = ["//visibility:public"])
|
||||
|
||||
ts_library(
|
||||
name = "fake_common",
|
||||
srcs = [
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package(default_visibility = ["//visibility:public"])
|
||||
|
||||
load("//tools:defaults.bzl", "ng_package", "ts_library")
|
||||
|
||||
package(default_visibility = ["//visibility:public"])
|
||||
|
||||
ts_library(
|
||||
name = "fake_core",
|
||||
srcs = [
|
||||
|
|
|
@ -49,7 +49,7 @@ def partial_compliance_golden(filePath):
|
|||
stdout = "%s/this_file_should_not_be_committed" % path,
|
||||
link_workspace_root = True,
|
||||
visibility = [":__pkg__"],
|
||||
data = data,
|
||||
data = [],
|
||||
)
|
||||
|
||||
generated_file_test(
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package(default_visibility = ["//visibility:public"])
|
||||
|
||||
load("//tools:defaults.bzl", "pkg_npm", "ts_config", "ts_library")
|
||||
|
||||
package(default_visibility = ["//visibility:public"])
|
||||
|
||||
ts_config(
|
||||
name = "tsconfig",
|
||||
src = "tsconfig-build.json",
|
||||
|
|
|
@ -94,7 +94,7 @@ def ts_devserver(**kwargs):
|
|||
|
||||
ts_config = _ts_config
|
||||
|
||||
def ts_library(name, tsconfig = None, testonly = False, deps = [], module_name = None, **kwargs):
|
||||
def ts_library(name, tsconfig = None, testonly = False, deps = [], module_name = None, package_name = None, **kwargs):
|
||||
"""Default values for ts_library"""
|
||||
deps = deps + ["@npm//tslib"]
|
||||
if testonly:
|
||||
|
@ -108,12 +108,22 @@ def ts_library(name, tsconfig = None, testonly = False, deps = [], module_name =
|
|||
if not module_name:
|
||||
module_name = _default_module_name(testonly)
|
||||
|
||||
# If no `package_name` is explicitly set, we use the default module name as package
|
||||
# name, so that the target can be resolved within NodeJS executions, by activating
|
||||
# the Bazel NodeJS linker. See: https://github.com/bazelbuild/rules_nodejs/pull/2799.
|
||||
if not package_name:
|
||||
package_name = _default_module_name(testonly)
|
||||
|
||||
_ts_library(
|
||||
name = name,
|
||||
tsconfig = tsconfig,
|
||||
testonly = testonly,
|
||||
deps = deps,
|
||||
# `module_name` is used for AMD module names within emitted JavaScript files.
|
||||
module_name = module_name,
|
||||
# `package_name` can be set to allow for the Bazel NodeJS linker to run. This
|
||||
# allows for resolution of the given target within the `node_modules/`.
|
||||
package_name = package_name,
|
||||
**kwargs
|
||||
)
|
||||
|
||||
|
@ -128,7 +138,7 @@ def ts_library(name, tsconfig = None, testonly = False, deps = [], module_name =
|
|||
output_group = "es5_sources",
|
||||
)
|
||||
|
||||
def ng_module(name, tsconfig = None, entry_point = None, testonly = False, deps = [], module_name = None, bundle_dts = True, **kwargs):
|
||||
def ng_module(name, tsconfig = None, entry_point = None, testonly = False, deps = [], module_name = None, package_name = None, bundle_dts = True, **kwargs):
|
||||
"""Default values for ng_module"""
|
||||
deps = deps + ["@npm//tslib"]
|
||||
if testonly:
|
||||
|
@ -141,6 +151,13 @@ def ng_module(name, tsconfig = None, entry_point = None, testonly = False, deps
|
|||
|
||||
if not module_name:
|
||||
module_name = _default_module_name(testonly)
|
||||
|
||||
# If no `package_name` is explicitly set, we use the default module name as package
|
||||
# name, so that the target can be resolved within NodeJS executions, by activating
|
||||
# the Bazel NodeJS linker. See: https://github.com/bazelbuild/rules_nodejs/pull/2799.
|
||||
if not package_name:
|
||||
package_name = _default_module_name(testonly)
|
||||
|
||||
if not entry_point:
|
||||
entry_point = "public_api.ts"
|
||||
_ng_module(
|
||||
|
@ -154,7 +171,11 @@ def ng_module(name, tsconfig = None, entry_point = None, testonly = False, deps
|
|||
compiler = _INTERNAL_NG_MODULE_COMPILER,
|
||||
api_extractor = _INTERNAL_NG_MODULE_API_EXTRACTOR,
|
||||
ng_xi18n = _INTERNAL_NG_MODULE_XI18N,
|
||||
# `module_name` is used for AMD module names within emitted JavaScript files.
|
||||
module_name = module_name,
|
||||
# `package_name` can be set to allow for the Bazel NodeJS linker to run. This
|
||||
# allows for resolution of the given target within the `node_modules/`.
|
||||
package_name = package_name,
|
||||
perf_flag = "//packages/compiler-cli:ng_perf",
|
||||
**kwargs
|
||||
)
|
||||
|
@ -181,6 +202,21 @@ def ng_package(name, readme_md = None, license_banner = None, deps = [], **kwarg
|
|||
_ng_package(
|
||||
name = name,
|
||||
deps = deps,
|
||||
# We never set a `package_name` for NPM packages, neither do we enable validation.
|
||||
# This is necessary because the source targets of the NPM packages all have
|
||||
# package names set and setting a similar `package_name` on the NPM package would
|
||||
# result in duplicate linker mappings that will conflict. e.g. consider the following
|
||||
# scenario: We have a `ts_library` for `@angular/core`. We will configure a package
|
||||
# name for the target so that it can be resolved in NodeJS executions from `node_modules`.
|
||||
# If we'd also set a `package_name` for the associated `pkg_npm` target, there would be
|
||||
# two mappings for `@angular/core` and the linker will complain. For a better development
|
||||
# experience, we want the mapping to resolve to the direct outputs of the `ts_library`
|
||||
# instead of requiring tests and other targets to assemble the NPM package first.
|
||||
# TODO(devversion): consider removing this if `rules_nodejs` allows for duplicate
|
||||
# linker mappings where transitive-determined mappings are skipped on conflicts.
|
||||
# https://github.com/bazelbuild/rules_nodejs/issues/2810.
|
||||
package_name = None,
|
||||
validate = False,
|
||||
readme_md = readme_md,
|
||||
license_banner = license_banner,
|
||||
substitutions = select({
|
||||
|
@ -218,6 +254,21 @@ def pkg_npm(name, **kwargs):
|
|||
|
||||
_pkg_npm(
|
||||
name = name,
|
||||
# We never set a `package_name` for NPM packages, neither do we enable validation.
|
||||
# This is necessary because the source targets of the NPM packages all have
|
||||
# package names set and setting a similar `package_name` on the NPM package would
|
||||
# result in duplicate linker mappings that will conflict. e.g. consider the following
|
||||
# scenario: We have a `ts_library` for `@angular/core`. We will configure a package
|
||||
# name for the target so that it can be resolved in NodeJS executions from `node_modules`.
|
||||
# If we'd also set a `package_name` for the associated `pkg_npm` target, there would be
|
||||
# two mappings for `@angular/core` and the linker will complain. For a better development
|
||||
# experience, we want the mapping to resolve to the direct outputs of the `ts_library`
|
||||
# instead of requiring tests and other targets to assemble the NPM package first.
|
||||
# TODO(devversion): consider removing this if `rules_nodejs` allows for duplicate
|
||||
# linker mappings where transitive-determined mappings are skipped on conflicts.
|
||||
# https://github.com/bazelbuild/rules_nodejs/issues/2810.
|
||||
package_name = None,
|
||||
validate = False,
|
||||
substitutions = select({
|
||||
"//:stamp": stamped_substitutions,
|
||||
"//conditions:default": substitutions,
|
||||
|
|
|
@ -31,6 +31,7 @@ genrule(
|
|||
|
||||
pkg_npm(
|
||||
name = "ts-api-guardian",
|
||||
package_name = "ts-api-guardian",
|
||||
srcs = [
|
||||
"BUILD.bazel",
|
||||
"README.md",
|
||||
|
|
57
yarn.lock
57
yarn.lock
|
@ -1008,10 +1008,10 @@
|
|||
resolved "https://registry.yarnpkg.com/@bazel/buildifier/-/buildifier-4.0.1.tgz#52cfbad5cbb86e9183a29dde2370cd465730ea0d"
|
||||
integrity sha512-BTmtvJbeeEVrqRApI1gr5hvPgYcHLpdGJ5EXNXEWO692ztMPSj5fB/dH0xUlaW45jn6LimYx8ymqTMhj3538og==
|
||||
|
||||
"@bazel/concatjs@3.7.0":
|
||||
version "3.7.0"
|
||||
resolved "https://registry.yarnpkg.com/@bazel/concatjs/-/concatjs-3.7.0.tgz#f10649d97d93d96bfe815d6b0c620acad394f799"
|
||||
integrity sha512-E+mA3huykyBMcRbhAOYbfmfMIOZD6QtXs6i+IhJQed8DYQLSYf9E2Jq8T/rFefFyZv+loJIAr4JhkAIO5vuFWg==
|
||||
"@bazel/concatjs@4.0.0-beta.0":
|
||||
version "4.0.0-beta.0"
|
||||
resolved "https://registry.yarnpkg.com/@bazel/concatjs/-/concatjs-4.0.0-beta.0.tgz#f1dddefe2cefc543ec61f06c5bc28c908bfb4569"
|
||||
integrity sha512-azGMcLwOIEEbTHm0ORCsSMZ5yBIQaRWlWMN3b7M5uD6C646EaiM7b2wx8CkOJlyZrZOLEajjvePvN7lqkPM1Cg==
|
||||
dependencies:
|
||||
protobufjs "6.8.8"
|
||||
source-map-support "0.5.9"
|
||||
|
@ -1022,38 +1022,38 @@
|
|||
resolved "https://registry.yarnpkg.com/@bazel/ibazel/-/ibazel-0.15.10.tgz#cf0cff1aec6d8e7bb23e1fc618d09fbd39b7a13f"
|
||||
integrity sha512-0v+OwCQ6fsGFa50r6MXWbUkSGuWOoZ22K4pMSdtWiL5LKFIE4kfmMmtQS+M7/ICNwk2EIYob+NRreyi/DGUz5A==
|
||||
|
||||
"@bazel/jasmine@3.7.0":
|
||||
version "3.7.0"
|
||||
resolved "https://registry.yarnpkg.com/@bazel/jasmine/-/jasmine-3.7.0.tgz#9d8ed4c73abb4a927cdffecf5c4c877f969d886b"
|
||||
integrity sha512-q6Nt1T83isYjIcxQrLkvWCzX6R9oDBwDDN9Hx/vQuvLKMRHSCuj8hkhf42waR9SzTiVHXNDv39l4IwvFhVkfvA==
|
||||
"@bazel/jasmine@4.0.0-beta.0":
|
||||
version "4.0.0-beta.0"
|
||||
resolved "https://registry.yarnpkg.com/@bazel/jasmine/-/jasmine-4.0.0-beta.0.tgz#575e9cd88932b19c54447fba43cbd62e14ff3022"
|
||||
integrity sha512-VYEAaHCi8ot0aSMKbIio6usJZqvINd7LzrrGoChGAGwMgGEpTfMGdprwdlrQPKD6/GbLkVtkCcsViG92ynXhdQ==
|
||||
dependencies:
|
||||
c8 "~7.5.0"
|
||||
jasmine-reporters "~2.4.0"
|
||||
|
||||
"@bazel/protractor@3.7.0":
|
||||
version "3.7.0"
|
||||
resolved "https://registry.yarnpkg.com/@bazel/protractor/-/protractor-3.7.0.tgz#04715069cfbf9a8fef147e5d5323ceae434e9a0d"
|
||||
integrity sha512-P/PYAvy2UP8SMfwgOYqNO7OCPkt0A1xsCVXskbiImXRZnG+zyRurA9Orz5OIEo1fagr2N+0wylquqO/+jc7T/A==
|
||||
"@bazel/protractor@4.0.0-beta.0":
|
||||
version "4.0.0-beta.0"
|
||||
resolved "https://registry.yarnpkg.com/@bazel/protractor/-/protractor-4.0.0-beta.0.tgz#fcabfd5c32005fcb93b80f83bcf99058bcf07d4f"
|
||||
integrity sha512-cIlqzPEXu3zFhFR+5Vqo5D/qLkOEY/gZ1xc74/V/CVAlbkCZsWJ18gDE1bhca9t1Mj41igDqwlvXUndxdQjNtw==
|
||||
|
||||
"@bazel/rollup@3.7.0":
|
||||
version "3.7.0"
|
||||
resolved "https://registry.yarnpkg.com/@bazel/rollup/-/rollup-3.7.0.tgz#6045d44f39ebc213fd2f3672421a35d20d9abf37"
|
||||
integrity sha512-B9Gut5wdANpnQCUwwp9q/UAU5MNhfUpjTyygNUWoRWAQXRFgmSgsC0Gr5RaWHx9bugaiyPQbPDmb3cYTU+4RQQ==
|
||||
"@bazel/rollup@4.0.0-beta.0":
|
||||
version "4.0.0-beta.0"
|
||||
resolved "https://registry.yarnpkg.com/@bazel/rollup/-/rollup-4.0.0-beta.0.tgz#ec4bc88f401bd555d43c55c34183cda4f004ae96"
|
||||
integrity sha512-CAl5+iNuVgFA52zOFmoQvY9LpjEf/hPiw/PRPXR0JrXy83xk+Nxnrv7UKvP4Jmux+K24uDf+ZOIr62rGzMHVhA==
|
||||
|
||||
"@bazel/runfiles@3.7.0":
|
||||
version "3.7.0"
|
||||
resolved "https://registry.yarnpkg.com/@bazel/runfiles/-/runfiles-3.7.0.tgz#c00eeee9b7e7c3993f95cab5ad3cced17949869a"
|
||||
integrity sha512-lAj01NxpnHvvyHY1TquaQADFex5hfqmDH5KR7US63rpEuDazaGCk1WxEE/3PzZPUq4kyT6PNPLhuNB+OW1lupQ==
|
||||
"@bazel/runfiles@4.0.0-beta.0":
|
||||
version "4.0.0-beta.0"
|
||||
resolved "https://registry.yarnpkg.com/@bazel/runfiles/-/runfiles-4.0.0-beta.0.tgz#e62679d80cf9fcd84996e5f3ae4bedc33ed1a993"
|
||||
integrity sha512-pFdanyvI0wf2WtdQXUmcTZw7OJ83uj2bxF3rOskx45wewBRAlQZkm2q2A6WEffSfdf2WaBlk5u/x2kqK2nyG7w==
|
||||
|
||||
"@bazel/terser@3.7.0":
|
||||
version "3.7.0"
|
||||
resolved "https://registry.yarnpkg.com/@bazel/terser/-/terser-3.7.0.tgz#a2b3e7488b0c2245add46e0cbf9e89e047223c79"
|
||||
integrity sha512-uvs0ir7me/KSIm4YGhkPolIjs+Fzjg6JrkRg8CYjnVLz+I6Ajr2+X9e3ylZP+0lNWhqJkkCjXm1jybPTUV5RKQ==
|
||||
"@bazel/terser@4.0.0-beta.0":
|
||||
version "4.0.0-beta.0"
|
||||
resolved "https://registry.yarnpkg.com/@bazel/terser/-/terser-4.0.0-beta.0.tgz#2ca1c59e1e109e2f3b0c561b534730a035844a26"
|
||||
integrity sha512-qGDLsmg2ekEojDHrTEiPJd0bdqbCPT2/YImsZhg1swpLEFnFCLCUNVnESt62Wd6bKonzvQeFo8zpKaCK326e4g==
|
||||
|
||||
"@bazel/typescript@3.7.0":
|
||||
version "3.7.0"
|
||||
resolved "https://registry.yarnpkg.com/@bazel/typescript/-/typescript-3.7.0.tgz#a4d648a36f7ef4960c8a16222f853a4c285a522d"
|
||||
integrity sha512-bkNHZaCWg4Jk+10wzhFDhB+RRZkfob/yydC4qRzUVxCDLPFICYgC0PWeLhf/ixEhVeHtS0Cmv74M+QziqKSdbw==
|
||||
"@bazel/typescript@4.0.0-beta.0":
|
||||
version "4.0.0-beta.0"
|
||||
resolved "https://registry.yarnpkg.com/@bazel/typescript/-/typescript-4.0.0-beta.0.tgz#daf2fb0d0bdcd3df331d4320463b1a4beca6031c"
|
||||
integrity sha512-dfI3QLQ5bLyK3BIrrwxuH9cLbMHuku0UZH7nwjHjXwQX70O0MSGN6yXx2Vrqatj2iw/UfHX/akPuhGlNqrDFRw==
|
||||
dependencies:
|
||||
protobufjs "6.8.8"
|
||||
semver "5.6.0"
|
||||
|
@ -11999,7 +11999,6 @@ sauce-connect-launcher@^1.2.4:
|
|||
|
||||
"sauce-connect@https://saucelabs.com/downloads/sc-4.6.2-linux.tar.gz":
|
||||
version "0.0.0"
|
||||
uid "7b7f35433af9c3380758e048894d7b9aecf3754e"
|
||||
resolved "https://saucelabs.com/downloads/sc-4.6.2-linux.tar.gz#7b7f35433af9c3380758e048894d7b9aecf3754e"
|
||||
|
||||
saucelabs@^1.5.0:
|
||||
|
|
Loading…
Reference in New Issue