mirror of
https://github.com/angular/angular-cli.git
synced 2025-05-16 18:43:42 +08:00
The stylesheet url() resource plugin will now correctly issue warnings for the usage of Webpack specific prefixes such as the tilde when used in an imported Sass file. Previously, these URLs would be rebased by the Sass processing step which would cause the tilde prefix to no longer be a prefix. This would then no longer be considered a warning due to the tilde no longer being the first character of the URL value. Additionally, a warning is also now issued for the previously unsupported but available caret prefix. Removing the caret prefix and adding the path to the `externalDependencies` build option should provide equivalent behavior.
451 lines
13 KiB
Python
451 lines
13 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")
|
|
load("@npm//@angular/build-tooling/bazel/api-golden:index.bzl", "api_golden_test_npm_package")
|
|
|
|
licenses(["notice"])
|
|
|
|
package(default_visibility = ["//visibility:public"])
|
|
|
|
ts_json_schema(
|
|
name = "application_schema",
|
|
src = "src/builders/application/schema.json",
|
|
)
|
|
|
|
ts_json_schema(
|
|
name = "app_shell_schema",
|
|
src = "src/builders/app-shell/schema.json",
|
|
)
|
|
|
|
ts_json_schema(
|
|
name = "browser_schema",
|
|
src = "src/builders/browser/schema.json",
|
|
)
|
|
|
|
ts_json_schema(
|
|
name = "browser_esbuild_schema",
|
|
src = "src/builders/browser-esbuild/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 = "jest_schema",
|
|
src = "src/builders/jest/schema.json",
|
|
)
|
|
|
|
ts_json_schema(
|
|
name = "karma_schema",
|
|
src = "src/builders/karma/schema.json",
|
|
)
|
|
|
|
ts_json_schema(
|
|
name = "protractor_schema",
|
|
src = "src/builders/protractor/schema.json",
|
|
)
|
|
|
|
ts_json_schema(
|
|
name = "server_schema",
|
|
src = "src/builders/server/schema.json",
|
|
)
|
|
|
|
ts_json_schema(
|
|
name = "ng_packagr_schema",
|
|
src = "src/builders/ng-packagr/schema.json",
|
|
)
|
|
|
|
ts_json_schema(
|
|
name = "ssr_dev_server_schema",
|
|
src = "src/builders/ssr-dev-server/schema.json",
|
|
)
|
|
|
|
ts_json_schema(
|
|
name = "prerender_schema",
|
|
src = "src/builders/prerender/schema.json",
|
|
)
|
|
|
|
ts_library(
|
|
name = "build_angular",
|
|
package_name = "@angular-devkit/build-angular",
|
|
srcs = glob(
|
|
include = [
|
|
"src/**/*.ts",
|
|
"plugins/**/*.ts",
|
|
],
|
|
exclude = [
|
|
"src/test-utils.ts",
|
|
"src/**/*_spec.ts",
|
|
"src/**/tests/**/*.ts",
|
|
"plugins/**/*_spec.ts",
|
|
"src/testing/**/*.ts",
|
|
],
|
|
) + [
|
|
"//packages/angular_devkit/build_angular:src/builders/app-shell/schema.ts",
|
|
"//packages/angular_devkit/build_angular:src/builders/application/schema.ts",
|
|
"//packages/angular_devkit/build_angular:src/builders/browser-esbuild/schema.ts",
|
|
"//packages/angular_devkit/build_angular:src/builders/browser/schema.ts",
|
|
"//packages/angular_devkit/build_angular:src/builders/dev-server/schema.ts",
|
|
"//packages/angular_devkit/build_angular:src/builders/extract-i18n/schema.ts",
|
|
"//packages/angular_devkit/build_angular:src/builders/jest/schema.ts",
|
|
"//packages/angular_devkit/build_angular:src/builders/karma/schema.ts",
|
|
"//packages/angular_devkit/build_angular:src/builders/ng-packagr/schema.ts",
|
|
"//packages/angular_devkit/build_angular:src/builders/prerender/schema.ts",
|
|
"//packages/angular_devkit/build_angular:src/builders/protractor/schema.ts",
|
|
"//packages/angular_devkit/build_angular:src/builders/server/schema.ts",
|
|
"//packages/angular_devkit/build_angular:src/builders/ssr-dev-server/schema.ts",
|
|
],
|
|
data = glob(
|
|
include = [
|
|
"package.json",
|
|
"builders.json",
|
|
"src/**/schema.json",
|
|
"src/**/*.js",
|
|
"src/**/*.mjs",
|
|
"src/**/*.html",
|
|
],
|
|
),
|
|
module_name = "@angular-devkit/build-angular",
|
|
module_root = "src/index.d.ts",
|
|
deps = [
|
|
"//packages/angular_devkit/architect",
|
|
"//packages/angular_devkit/build_angular/src/utils/routes-extractor",
|
|
"//packages/angular_devkit/build_webpack",
|
|
"//packages/angular_devkit/core",
|
|
"//packages/angular_devkit/core/node",
|
|
"//packages/ngtools/webpack",
|
|
"@npm//@ampproject/remapping",
|
|
"@npm//@angular/common",
|
|
"@npm//@angular/compiler-cli",
|
|
"@npm//@angular/core",
|
|
"@npm//@angular/localize",
|
|
"@npm//@angular/platform-server",
|
|
"@npm//@angular/service-worker",
|
|
"@npm//@babel/core",
|
|
"@npm//@babel/generator",
|
|
"@npm//@babel/helper-annotate-as-pure",
|
|
"@npm//@babel/helper-split-export-declaration",
|
|
"@npm//@babel/plugin-transform-async-generator-functions",
|
|
"@npm//@babel/plugin-transform-async-to-generator",
|
|
"@npm//@babel/plugin-transform-runtime",
|
|
"@npm//@babel/preset-env",
|
|
"@npm//@babel/runtime",
|
|
"@npm//@discoveryjs/json-ext",
|
|
"@npm//@types/babel__core",
|
|
"@npm//@types/browser-sync",
|
|
"@npm//@types/browserslist",
|
|
"@npm//@types/inquirer",
|
|
"@npm//@types/karma",
|
|
"@npm//@types/less",
|
|
"@npm//@types/loader-utils",
|
|
"@npm//@types/node",
|
|
"@npm//@types/picomatch",
|
|
"@npm//@types/semver",
|
|
"@npm//@types/text-table",
|
|
"@npm//@vitejs/plugin-basic-ssl",
|
|
"@npm//ajv",
|
|
"@npm//ansi-colors",
|
|
"@npm//autoprefixer",
|
|
"@npm//babel-loader",
|
|
"@npm//babel-plugin-istanbul",
|
|
"@npm//browserslist",
|
|
"@npm//chokidar",
|
|
"@npm//copy-webpack-plugin",
|
|
"@npm//critters",
|
|
"@npm//css-loader",
|
|
"@npm//esbuild",
|
|
"@npm//esbuild-wasm",
|
|
"@npm//fast-glob",
|
|
"@npm//http-proxy-middleware",
|
|
"@npm//https-proxy-agent",
|
|
"@npm//inquirer",
|
|
"@npm//jsonc-parser",
|
|
"@npm//karma",
|
|
"@npm//karma-source-map-support",
|
|
"@npm//less",
|
|
"@npm//less-loader",
|
|
"@npm//license-webpack-plugin",
|
|
"@npm//loader-utils",
|
|
"@npm//magic-string",
|
|
"@npm//mini-css-extract-plugin",
|
|
"@npm//mrmime",
|
|
"@npm//ng-packagr",
|
|
"@npm//open",
|
|
"@npm//ora",
|
|
"@npm//parse5-html-rewriting-stream",
|
|
"@npm//piscina",
|
|
"@npm//postcss",
|
|
"@npm//postcss-loader",
|
|
"@npm//resolve-url-loader",
|
|
"@npm//rxjs",
|
|
"@npm//sass",
|
|
"@npm//sass-loader",
|
|
"@npm//semver",
|
|
"@npm//source-map-loader",
|
|
"@npm//source-map-support",
|
|
"@npm//terser",
|
|
"@npm//text-table",
|
|
"@npm//tree-kill",
|
|
"@npm//tslib",
|
|
"@npm//typescript",
|
|
"@npm//vite",
|
|
"@npm//webpack",
|
|
"@npm//webpack-dev-middleware",
|
|
"@npm//webpack-dev-server",
|
|
"@npm//webpack-merge",
|
|
"@npm//webpack-subresource-integrity",
|
|
],
|
|
)
|
|
|
|
ts_library(
|
|
name = "build_angular_test_lib",
|
|
testonly = True,
|
|
srcs = glob(
|
|
include = [
|
|
"src/**/*_spec.ts",
|
|
],
|
|
exclude = [
|
|
"src/builders/**/*_spec.ts",
|
|
],
|
|
),
|
|
data = glob(["test/**/*"]),
|
|
deps = [
|
|
":build_angular",
|
|
":build_angular_test_utils",
|
|
"//packages/angular_devkit/architect/testing",
|
|
"//packages/angular_devkit/core",
|
|
"@npm//prettier",
|
|
"@npm//typescript",
|
|
"@npm//webpack",
|
|
],
|
|
)
|
|
|
|
[
|
|
jasmine_node_test(
|
|
name = "build_angular_test_" + toolchain_name,
|
|
srcs = [":build_angular_test_lib"],
|
|
tags = [toolchain_name],
|
|
toolchain = toolchain,
|
|
)
|
|
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/architect:package.json",
|
|
"//packages/angular_devkit/build_webpack:package.json",
|
|
"//packages/angular_devkit/core:package.json",
|
|
"//packages/ngtools/webpack:package.json",
|
|
],
|
|
tags = ["release-package"],
|
|
deps = [
|
|
":README.md",
|
|
":build_angular",
|
|
":license",
|
|
],
|
|
)
|
|
|
|
api_golden_test_npm_package(
|
|
name = "build_angular_api",
|
|
data = [
|
|
":npm_package",
|
|
"//goldens:public-api",
|
|
],
|
|
golden_dir = "angular_cli/goldens/public-api/angular_devkit/build_angular",
|
|
npm_package = "angular_cli/packages/angular_devkit/build_angular/npm_package",
|
|
)
|
|
|
|
# Large build_angular specs
|
|
|
|
ts_library(
|
|
name = "build_angular_test_utils",
|
|
testonly = True,
|
|
srcs = glob(
|
|
include = [
|
|
"src/test-utils.ts",
|
|
"src/testing/**/*.ts",
|
|
"src/**/tests/*.ts",
|
|
],
|
|
exclude = [
|
|
"src/**/*_spec.ts",
|
|
],
|
|
),
|
|
data = glob(["test/**/*"]),
|
|
tsconfig = "//:tsconfig-test.json",
|
|
deps = [
|
|
":build_angular",
|
|
"//packages/angular_devkit/architect",
|
|
"//packages/angular_devkit/architect/node",
|
|
"//packages/angular_devkit/architect/testing",
|
|
"//packages/angular_devkit/core",
|
|
"//packages/angular_devkit/core/node",
|
|
"@npm//@types/node-fetch",
|
|
"@npm//rxjs",
|
|
],
|
|
)
|
|
|
|
LARGE_SPECS = {
|
|
"application": {
|
|
"shards": 12,
|
|
"size": "large",
|
|
"flaky": True,
|
|
"extra_deps": [
|
|
"@npm//buffer",
|
|
],
|
|
},
|
|
"app-shell": {},
|
|
"dev-server": {
|
|
"shards": 10,
|
|
"size": "large",
|
|
"extra_deps": [
|
|
"@npm//@types/node-fetch",
|
|
"@npm//node-fetch",
|
|
"@npm//@types/http-proxy",
|
|
"@npm//http-proxy",
|
|
"@npm//puppeteer",
|
|
],
|
|
},
|
|
"extract-i18n": {},
|
|
"karma": {
|
|
"shards": 3,
|
|
"size": "large",
|
|
"extra_deps": [
|
|
"@npm//karma",
|
|
"@npm//karma-chrome-launcher",
|
|
"@npm//karma-coverage",
|
|
"@npm//karma-jasmine",
|
|
"@npm//karma-jasmine-html-reporter",
|
|
"@npm//puppeteer",
|
|
],
|
|
},
|
|
"protractor": {
|
|
"extra_deps": [
|
|
"@npm//jasmine-spec-reporter",
|
|
"@npm//protractor",
|
|
"@npm//puppeteer",
|
|
"@npm//ts-node",
|
|
],
|
|
# NB: does not run on rbe because webdriver manager uses an absolute path to chromedriver
|
|
"tags": ["no-remote-exec"],
|
|
# NB: multiple shards will compete for port 4200 so limiting to 1
|
|
"shards": 1,
|
|
},
|
|
"server": {
|
|
"extra_deps": [
|
|
"@npm//@angular/animations",
|
|
],
|
|
},
|
|
"ng-packagr": {},
|
|
"browser": {
|
|
"shards": 10,
|
|
"size": "large",
|
|
"flaky": True,
|
|
"extra_deps": [
|
|
"@npm//@angular/animations",
|
|
"@npm//@angular/material",
|
|
"@npm//bootstrap",
|
|
"@npm//jquery",
|
|
"@npm//popper.js",
|
|
],
|
|
},
|
|
"prerender": {},
|
|
"browser-esbuild": {},
|
|
"jest": {
|
|
"extra_deps": [
|
|
"@npm//fast-glob",
|
|
],
|
|
},
|
|
"ssr-dev-server": {
|
|
"extra_deps": [
|
|
"@npm//@types/browser-sync",
|
|
"@npm//@types/node-fetch",
|
|
"@npm//browser-sync",
|
|
"@npm//node-fetch",
|
|
"//packages/angular/ssr",
|
|
],
|
|
},
|
|
}
|
|
|
|
[
|
|
ts_library(
|
|
name = "build_angular_" + spec + "_test_lib",
|
|
testonly = True,
|
|
srcs = glob(["src/builders/" + spec + "/**/*_spec.ts"]),
|
|
tsconfig = "//:tsconfig-test.json",
|
|
deps = [
|
|
# Dependencies needed to compile and run the specs themselves.
|
|
":build_angular",
|
|
":build_angular_test_utils",
|
|
"//packages/angular_devkit/architect",
|
|
"//packages/angular_devkit/architect/node",
|
|
"//packages/angular_devkit/architect/testing",
|
|
"//packages/angular_devkit/core",
|
|
"//packages/angular_devkit/core/node",
|
|
|
|
# Base dependencies for the application in hello-world-app.
|
|
# Some tests also require extra dependencies.
|
|
"@npm//@angular/common",
|
|
"@npm//@angular/compiler",
|
|
"@npm//@angular/compiler-cli",
|
|
"@npm//@angular/core",
|
|
"@npm//@angular/platform-browser",
|
|
"@npm//@angular/platform-browser-dynamic",
|
|
"@npm//@angular/router",
|
|
"@npm//rxjs",
|
|
"@npm//tslib",
|
|
"@npm//typescript",
|
|
"@npm//zone.js",
|
|
] + LARGE_SPECS[spec].get("extra_deps", []),
|
|
)
|
|
for spec in LARGE_SPECS
|
|
]
|
|
|
|
[
|
|
[
|
|
jasmine_node_test(
|
|
name = "build_angular_" + spec + "_test_" + toolchain_name,
|
|
size = LARGE_SPECS[spec].get("size", "medium"),
|
|
flaky = LARGE_SPECS[spec].get("flaky", False),
|
|
shard_count = LARGE_SPECS[spec].get("shards", 2),
|
|
# These tests are resource intensive and should not be over-parallized as they will
|
|
# compete for the resources of other parallel tests slowing everything down.
|
|
# Ask Bazel to allocate multiple CPUs for these tests with "cpu:n" tag.
|
|
tags = [
|
|
"cpu:2",
|
|
toolchain_name,
|
|
] + LARGE_SPECS[spec].get("tags", []),
|
|
toolchain = toolchain,
|
|
deps = [":build_angular_" + spec + "_test_lib"],
|
|
)
|
|
for spec in LARGE_SPECS
|
|
]
|
|
for toolchain_name, toolchain in zip(
|
|
TOOLCHAINS_NAMES,
|
|
TOOLCHAINS_VERSIONS,
|
|
)
|
|
]
|