Charles Lyding 7f93735e98 build: use bazel to perform release builds
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.
2023-01-05 03:21:58 +00:00

108 lines
2.8 KiB
Python

load("@npm//@angular/build-tooling/bazel/api-golden:index.bzl", "api_golden_test_npm_package")
load("@npm//@bazel/jasmine:index.bzl", "jasmine_node_test")
load("//tools:defaults.bzl", "pkg_npm", "ts_library")
load("//tools:toolchain_info.bzl", "TOOLCHAINS_NAMES", "TOOLCHAINS_VERSIONS")
# 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
package(default_visibility = ["//visibility:public"])
licenses(["notice"])
# @angular-devkit/core
ts_library(
name = "core",
package_name = "@angular-devkit/core",
srcs = glob(
include = ["src/**/*.ts"],
exclude = [
"src/**/*_spec.ts",
"src/**/*_benchmark.ts",
],
),
data = glob(
include = ["**/*.json"],
# NB: we need to exclude the nested node_modules that is laid out by yarn workspaces
exclude = [
"node_modules/**",
"src/workspace/json/test/**",
],
),
module_name = "@angular-devkit/core",
module_root = "src/index.d.ts",
deps = [
"@npm//@types/node",
"@npm//ajv",
"@npm//ajv-formats",
"@npm//jsonc-parser",
"@npm//rxjs",
"@npm//source-map",
# @node_module: typescript:es2015.proxy
# @node_module: typescript:es2015.reflect
# @node_module: typescript:es2015.symbol.wellknown
# @typings: source_map
],
)
# @external_begin
ts_library(
name = "core_test_lib",
testonly = True,
srcs = glob(["src/**/*_spec.ts"]),
data = glob(["src/workspace/json/test/**/*.json"]),
deps = [
":core",
"//packages/angular_devkit/core/node",
"@npm//rxjs",
],
)
[
jasmine_node_test(
name = "core_test_" + toolchain_name,
srcs = [":core_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",
tags = ["release-package"],
deps = [
":README.md",
":core",
":license",
"//packages/angular_devkit/core/node",
"//packages/angular_devkit/core/node:package.json",
"//packages/angular_devkit/core/node/testing",
],
)
api_golden_test_npm_package(
name = "core_api",
data = [
":npm_package",
"//goldens:public-api",
],
golden_dir = "angular_cli/goldens/public-api/angular_devkit/core",
npm_package = "angular_cli/packages/angular_devkit/core/npm_package",
types = ["@npm//@types/node"],
)
# @external_end