mirror of
https://github.com/angular/angular-cli.git
synced 2025-05-21 05:52:41 +08:00
Migrates `@angular/build` tests to native `rules_js`. This involves wiring up the package in the pnpm workspace, as well as adding some missing dependencies that previously weren't needed due to less efficient per-package isolation of transitive deps. In addition, we need to explicitly specify `ssr` as dev dependency as we are not auto-installing peer deps, and the dependency is needed for some server SSR tests.
248 lines
7.3 KiB
Python
248 lines
7.3 KiB
Python
load("@npm//@angular/build-tooling/bazel/api-golden:index.bzl", "api_golden_test_npm_package")
|
|
load("@npm2//:defs.bzl", "npm_link_all_packages")
|
|
load("//tools:defaults2.bzl", "jasmine_test", "npm_package", "ts_project")
|
|
load("//tools:ts_json_schema.bzl", "ts_json_schema")
|
|
|
|
licenses(["notice"])
|
|
|
|
package(default_visibility = ["//visibility:public"])
|
|
|
|
npm_link_all_packages()
|
|
|
|
ts_json_schema(
|
|
name = "application_schema",
|
|
src = "src/builders/application/schema.json",
|
|
)
|
|
|
|
ts_json_schema(
|
|
name = "dev-server_schema",
|
|
src = "src/builders/dev-server/schema.json",
|
|
)
|
|
|
|
ts_json_schema(
|
|
name = "extract_i18n_schema",
|
|
src = "src/builders/extract-i18n/schema.json",
|
|
)
|
|
|
|
ts_json_schema(
|
|
name = "ng_packagr_schema",
|
|
src = "src/builders/ng-packagr/schema.json",
|
|
)
|
|
|
|
RUNTIME_ASSETS = glob(
|
|
include = [
|
|
"src/**/schema.json",
|
|
"src/**/*.js",
|
|
"src/**/*.mjs",
|
|
"src/**/*.html",
|
|
],
|
|
) + [
|
|
"builders.json",
|
|
"package.json",
|
|
]
|
|
|
|
ts_project(
|
|
name = "build",
|
|
srcs = glob(
|
|
include = [
|
|
"src/**/*.ts",
|
|
],
|
|
exclude = [
|
|
"src/test-utils.ts",
|
|
"src/**/*_spec.ts",
|
|
"src/**/tests/**/*.ts",
|
|
"src/testing/**/*.ts",
|
|
],
|
|
) + [
|
|
"index.ts",
|
|
"//packages/angular/build:src/builders/application/schema.ts",
|
|
"//packages/angular/build:src/builders/dev-server/schema.ts",
|
|
"//packages/angular/build:src/builders/extract-i18n/schema.ts",
|
|
"//packages/angular/build:src/builders/ng-packagr/schema.ts",
|
|
],
|
|
data = RUNTIME_ASSETS,
|
|
module_name = "@angular/build",
|
|
deps = [
|
|
":node_modules/@angular-devkit/architect",
|
|
":node_modules/@angular-devkit/core",
|
|
":node_modules/@angular/ssr",
|
|
"//:node_modules/@ampproject/remapping",
|
|
"//:node_modules/@angular/common",
|
|
"//:node_modules/@angular/compiler",
|
|
"//:node_modules/@angular/compiler-cli",
|
|
"//:node_modules/@angular/core",
|
|
"//:node_modules/@angular/localize",
|
|
"//:node_modules/@angular/platform-server",
|
|
"//:node_modules/@angular/service-worker",
|
|
"//:node_modules/@babel/core",
|
|
"//:node_modules/@babel/helper-annotate-as-pure",
|
|
"//:node_modules/@babel/helper-split-export-declaration",
|
|
"//:node_modules/@babel/plugin-syntax-import-attributes",
|
|
"//:node_modules/@inquirer/confirm",
|
|
"//:node_modules/@types/babel__core",
|
|
"//:node_modules/@types/less",
|
|
"//:node_modules/@types/node",
|
|
"//:node_modules/@types/picomatch",
|
|
"//:node_modules/@types/semver",
|
|
"//:node_modules/@types/watchpack",
|
|
"//:node_modules/@vitejs/plugin-basic-ssl",
|
|
"//:node_modules/beasties",
|
|
"//:node_modules/browserslist",
|
|
"//:node_modules/esbuild",
|
|
"//:node_modules/esbuild-wasm",
|
|
"//:node_modules/fast-glob",
|
|
"//:node_modules/https-proxy-agent",
|
|
"//:node_modules/istanbul-lib-instrument",
|
|
"//:node_modules/jsonc-parser",
|
|
"//:node_modules/less",
|
|
"//:node_modules/listr2",
|
|
"//:node_modules/lmdb",
|
|
"//:node_modules/magic-string",
|
|
"//:node_modules/mrmime",
|
|
"//:node_modules/ng-packagr",
|
|
"//:node_modules/parse5-html-rewriting-stream",
|
|
"//:node_modules/picomatch",
|
|
"//:node_modules/piscina",
|
|
"//:node_modules/postcss",
|
|
"//:node_modules/rollup",
|
|
"//:node_modules/sass",
|
|
"//:node_modules/semver",
|
|
"//:node_modules/tslib",
|
|
"//:node_modules/typescript",
|
|
"//:node_modules/vite",
|
|
"//:node_modules/watchpack",
|
|
],
|
|
)
|
|
|
|
ts_project(
|
|
name = "unit_test_lib",
|
|
testonly = True,
|
|
srcs = glob(
|
|
include = ["src/**/*_spec.ts"],
|
|
exclude = ["src/builders/**/tests/**"],
|
|
),
|
|
deps = [
|
|
":build_rjs",
|
|
"//:node_modules/@angular/compiler-cli",
|
|
"//:node_modules/@babel/core",
|
|
"//:node_modules/@types/jasmine",
|
|
"//:node_modules/prettier",
|
|
"//:node_modules/typescript",
|
|
"//packages/angular/build/private:private_rjs",
|
|
],
|
|
)
|
|
|
|
jasmine_test(
|
|
name = "unit_tests",
|
|
data = [":unit_test_lib_rjs"],
|
|
)
|
|
|
|
ts_project(
|
|
name = "application_integration_test_lib",
|
|
testonly = True,
|
|
srcs = glob(include = ["src/builders/application/tests/**/*.ts"]),
|
|
deps = [
|
|
":build_rjs",
|
|
"//packages/angular/build/private:private_rjs",
|
|
"//modules/testing/builder:builder_rjs",
|
|
":node_modules/@angular-devkit/architect",
|
|
|
|
# Base dependencies for the application in hello-world-app.
|
|
"//:node_modules/@angular/common",
|
|
"//:node_modules/@angular/compiler",
|
|
"//:node_modules/@angular/compiler-cli",
|
|
"//:node_modules/@angular/core",
|
|
"//:node_modules/@angular/platform-browser",
|
|
"//:node_modules/@angular/platform-browser-dynamic",
|
|
"//:node_modules/@angular/router",
|
|
"//:node_modules/rxjs",
|
|
"//:node_modules/tslib",
|
|
"//:node_modules/typescript",
|
|
"//:node_modules/zone.js",
|
|
"//:node_modules/buffer",
|
|
],
|
|
)
|
|
|
|
ts_project(
|
|
name = "dev-server_integration_test_lib",
|
|
testonly = True,
|
|
srcs = glob(include = ["src/builders/dev-server/tests/**/*.ts"]),
|
|
deps = [
|
|
":build_rjs",
|
|
"//packages/angular/build/private:private_rjs",
|
|
"//modules/testing/builder:builder_rjs",
|
|
":node_modules/@angular-devkit/architect",
|
|
|
|
# dev server only test deps
|
|
"//:node_modules/@types/http-proxy",
|
|
"//:node_modules/http-proxy",
|
|
"//:node_modules/puppeteer",
|
|
|
|
# Base dependencies for the application in hello-world-app.
|
|
"//:node_modules/@angular/common",
|
|
"//:node_modules/@angular/compiler",
|
|
"//:node_modules/@angular/compiler-cli",
|
|
"//:node_modules/@angular/core",
|
|
"//:node_modules/@angular/platform-browser",
|
|
"//:node_modules/@angular/platform-browser-dynamic",
|
|
"//:node_modules/@angular/router",
|
|
"//:node_modules/ng-packagr",
|
|
"//:node_modules/rxjs",
|
|
"//:node_modules/tslib",
|
|
"//:node_modules/typescript",
|
|
"//:node_modules/zone.js",
|
|
"//:node_modules/buffer",
|
|
],
|
|
)
|
|
|
|
jasmine_test(
|
|
name = "application_integration_tests",
|
|
size = "large",
|
|
data = [":application_integration_test_lib_rjs"],
|
|
flaky = True,
|
|
shard_count = 10,
|
|
)
|
|
|
|
jasmine_test(
|
|
name = "dev-server_integration_tests",
|
|
size = "large",
|
|
data = [":dev-server_integration_test_lib_rjs"],
|
|
flaky = True,
|
|
shard_count = 10,
|
|
)
|
|
|
|
genrule(
|
|
name = "license",
|
|
srcs = ["//:LICENSE"],
|
|
outs = ["LICENSE"],
|
|
cmd = "cp $(execpath //:LICENSE) $@",
|
|
)
|
|
|
|
npm_package(
|
|
name = "pkg",
|
|
pkg_deps = [
|
|
"//packages/angular_devkit/architect:package.json",
|
|
],
|
|
stamp_files = [
|
|
"src/tools/esbuild/utils.js",
|
|
"src/utils/normalize-cache.js",
|
|
],
|
|
tags = ["release-package"],
|
|
deps = RUNTIME_ASSETS + [
|
|
":README.md",
|
|
":build_rjs",
|
|
":license",
|
|
"//packages/angular/build/private:private_rjs",
|
|
],
|
|
)
|
|
|
|
api_golden_test_npm_package(
|
|
name = "api",
|
|
data = [
|
|
":npm_package",
|
|
"//goldens:public-api",
|
|
],
|
|
golden_dir = "angular_cli/goldens/public-api/angular/build",
|
|
npm_package = "angular_cli/packages/angular/build/npm_package",
|
|
)
|