mirror of
https://github.com/angular/angular-cli.git
synced 2025-05-28 11:10:12 +08:00
When performing a release via the dev-infra `ng-dev` tooling, the release builds for the packages that will be published are now performed using bazel. Prior to this, the release builds were performed using a custom build script that programmatically invoked TypeScript APIs. The Bazel build and discovery process for the releasable packages is performed by a script that is based on the scripts from components and framework repositories. Several small modifications were performed to match the behavior and structure of the cli repository: * Use of `packages` as the source root in the bazel query * Use of `pkg_npm` rule in the bazel query * Partial transition to native Node.js `fs` APIs instead of `shelljs` * Directory creation per package when copying output (supports multiple package scopes) * Copying of archives (tgz) for each package The snapshot and local build capabilities are not modified as part of this change but will be merged in a followup as part of a larger transition to use bazel throughout the package build process.
98 lines
2.5 KiB
Python
98 lines
2.5 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"])
|
|
|
|
ts_library(
|
|
name = "pwa",
|
|
package_name = "@angular/pwa",
|
|
srcs = glob(
|
|
["**/*.ts"],
|
|
# Currently, this library is used only with the rollup plugin.
|
|
# To make it simpler for downstream repositories to compile this, we
|
|
# neither provide compile-time deps as an `npm_install` rule, nor do we
|
|
# expect the downstream repository to install @types/webpack[-*]
|
|
# So we exclude files that depend on webpack typings.
|
|
exclude = [
|
|
"pwa/files/**/*",
|
|
"**/*_spec.ts",
|
|
# NB: we need to exclude the nested node_modules that is laid out by yarn workspaces
|
|
"node_modules/**",
|
|
],
|
|
) + [
|
|
"//packages/angular/pwa:pwa/schema.ts",
|
|
],
|
|
data = glob(
|
|
include = [
|
|
"collection.json",
|
|
"pwa/schema.json",
|
|
"pwa/files/**/*",
|
|
],
|
|
),
|
|
deps = [
|
|
"//packages/angular_devkit/schematics",
|
|
"//packages/schematics/angular",
|
|
"@npm//@types/node",
|
|
"@npm//@types/parse5-html-rewriting-stream",
|
|
],
|
|
)
|
|
|
|
ts_json_schema(
|
|
name = "pwa_schema",
|
|
src = "pwa/schema.json",
|
|
)
|
|
|
|
ts_library(
|
|
name = "pwa_test_lib",
|
|
testonly = True,
|
|
srcs = glob(["pwa/**/*_spec.ts"]),
|
|
deps = [
|
|
":pwa",
|
|
"//packages/angular_devkit/schematics/testing",
|
|
"@npm//parse5-html-rewriting-stream",
|
|
],
|
|
)
|
|
|
|
[
|
|
jasmine_node_test(
|
|
name = "pwa_test_" + toolchain_name,
|
|
srcs = [":pwa_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/schematics:package.json",
|
|
"//packages/schematics/angular:package.json",
|
|
],
|
|
tags = ["release-package"],
|
|
deps = [
|
|
":README.md",
|
|
":license",
|
|
":pwa",
|
|
],
|
|
)
|