1
0
mirror of https://github.com/angular/angular-cli.git synced 2025-05-25 00:31:36 +08:00
Charles Lyding 11e0a51b17 build: minor cleanup of bazel build rules
BUILD files for each package have had outdated glob excludes removed.
Additionally, some src args have been reduced to a single file where possible.
The root bazel ignore file has also been expanded to include all node module
directories in each package. The ignore file does not appear to currently support
globs so each path has been individually specified.
2023-05-22 09:36:44 -04:00

178 lines
5.0 KiB
Python

# Copyright Google Inc. All Rights Reserved.
#
# 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("@npm//@bazel/jasmine:index.bzl", "jasmine_node_test")
load("//tools:defaults.bzl", "pkg_npm", "ts_library")
load("//tools:ts_json_schema.bzl", "ts_json_schema")
load("//tools:toolchain_info.bzl", "TOOLCHAINS_NAMES", "TOOLCHAINS_VERSIONS")
licenses(["notice"])
package(default_visibility = ["//visibility:public"])
# Create a list of Tuple("path/file.json", "path_file") to be used as rules
ALL_SCHEMA_TARGETS = [
(
x,
x.replace("/", "_").replace("-", "_").replace(".json", ""),
)
for x in glob(
include = ["*/schema.json"],
exclude = [
# NB: we need to exclude the nested node_modules that is laid out by yarn workspaces
"node_modules/**",
],
)
]
# Create all the targets.
[
ts_json_schema(
name = name,
src = src,
)
for (src, name) in ALL_SCHEMA_TARGETS
]
ts_library(
name = "angular",
package_name = "@schematics/angular",
srcs = glob(
include = ["**/*.ts"],
exclude = [
"**/*_spec.ts",
# Also exclude templated files.
"*/files/**/*.ts",
"*/other-files/**/*.ts",
"*/implements-files/**/*",
"*/type-files/**/*",
"*/functional-files/**/*",
"*/class-files/**/*",
# Exclude test helpers.
"utility/test/**/*.ts",
# NB: we need to exclude the nested node_modules that is laid out by yarn workspaces
"node_modules/**",
],
) + [
"//packages/schematics/angular:" + src.replace(".json", ".ts")
for (src, _) in ALL_SCHEMA_TARGETS
],
data = glob(
include = [
"collection.json",
"package.json",
"utility/latest-versions/package.json",
"migrations/migration-collection.json",
"*/schema.json",
"*/files/**/*",
"*/other-files/**/*",
"*/implements-files/**/*",
"*/type-files/**/*",
"*/functional-files/**/*",
"*/class-files/**/*",
],
exclude = [
# NB: we need to exclude the nested node_modules that is laid out by yarn workspaces
"node_modules/**",
],
),
module_name = "@schematics/angular",
deps = [
"//packages/angular_devkit/core",
"//packages/angular_devkit/schematics",
"//packages/angular_devkit/schematics/tasks",
"//packages/schematics/angular/third_party/github.com/Microsoft/TypeScript",
"@npm//@types/node",
"@npm//browserslist",
"@npm//jsonc-parser",
],
)
[
jasmine_node_test(
name = "no_typescript_runtime_dep_test_" + toolchain_name,
srcs = ["no_typescript_runtime_dep_spec.js"],
tags = [toolchain_name],
toolchain = toolchain,
deps = [
":angular",
"@npm//jasmine",
],
)
for toolchain_name, toolchain in zip(
TOOLCHAINS_NAMES,
TOOLCHAINS_VERSIONS,
)
]
ts_library(
name = "angular_test_lib",
testonly = True,
srcs = glob(
include = [
"**/*_spec.ts",
"utility/test/**/*.ts",
],
exclude = [
# NB: we need to exclude the nested node_modules that is laid out by yarn workspaces
"node_modules/**",
],
),
# @external_begin
deps = [
":angular",
"//packages/angular_devkit/core",
"//packages/angular_devkit/core/node/testing",
"//packages/angular_devkit/schematics",
"//packages/angular_devkit/schematics/tasks",
"//packages/angular_devkit/schematics/testing",
"//packages/schematics/angular/third_party/github.com/Microsoft/TypeScript",
"@npm//jsonc-parser",
],
# @external_end
)
[
jasmine_node_test(
name = "angular_test_" + toolchain_name,
srcs = [":angular_test_lib"],
tags = [toolchain_name],
toolchain = toolchain,
deps = [
"//packages/schematics/angular/third_party/github.com/Microsoft/TypeScript",
"@npm//jasmine",
"@npm//source-map",
],
)
for toolchain_name, toolchain in zip(
TOOLCHAINS_NAMES,
TOOLCHAINS_VERSIONS,
)
]
genrule(
name = "license",
srcs = ["//:LICENSE"],
outs = ["LICENSE"],
cmd = "cp $(execpath //:LICENSE) $@",
)
pkg_npm(
name = "npm_package",
pkg_deps = [
"//packages/angular_devkit/schematics:package.json",
"//packages/angular_devkit/core:package.json",
],
tags = ["release-package"],
deps = [
":README.md",
":angular",
":license",
":migrations/migration-collection.json",
":utility/latest-versions/package.json",
"//packages/schematics/angular/third_party/github.com/Microsoft/TypeScript:LICENSE",
],
)