Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 1 addition & 15 deletions BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,13 +1,7 @@
load("@aspect_rules_ts//ts:defs.bzl", rules_js_tsconfig = "ts_config")

# 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.dev/license
load("@bazel_skylib//rules:common_settings.bzl", "bool_flag")
load("@build_bazel_rules_nodejs//:index.bzl", "copy_to_bin")
load("@npm//@bazel/concatjs:index.bzl", "ts_config")
load("@npm2//:defs.bzl", "npm_link_all_packages")
load("//tools:defaults2.bzl", "copy_to_bin")

package(default_visibility = ["//visibility:public"])

Expand Down Expand Up @@ -100,11 +94,3 @@ config_setting(
":enable_snapshot_repo_deps": "true",
},
)

ts_config(
name = "tsconfig-build-esm",
src = "tsconfig-build-esm.json",
deps = [
":tsconfig.json",
],
)
7 changes: 6 additions & 1 deletion packages/angular/build/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
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:defaults2.bzl", "copy_to_bin", "jasmine_test", "npm_package", "ts_project")
load("//tools:ts_json_schema.bzl", "ts_json_schema")

licenses(["notice"])
Expand Down Expand Up @@ -29,6 +29,11 @@ ts_json_schema(
src = "src/builders/ng-packagr/schema.json",
)

copy_to_bin(
name = "schemas",
srcs = glob(["**/schema.json"]),
)

RUNTIME_ASSETS = glob(
include = [
"src/**/schema.json",
Expand Down
37 changes: 3 additions & 34 deletions packages/angular/cli/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -74,40 +74,9 @@ ts_project(
)

CLI_SCHEMA_DATA = [
"//packages/angular/build:src/builders/application/schema.json",
"//packages/angular/build:src/builders/dev-server/schema.json",
"//packages/angular/build:src/builders/extract-i18n/schema.json",
"//packages/angular/build:src/builders/ng-packagr/schema.json",
"//packages/angular_devkit/build_angular:src/builders/app-shell/schema.json",
"//packages/angular_devkit/build_angular:src/builders/browser/schema.json",
"//packages/angular_devkit/build_angular:src/builders/browser-esbuild/schema.json",
"//packages/angular_devkit/build_angular:src/builders/dev-server/schema.json",
"//packages/angular_devkit/build_angular:src/builders/extract-i18n/schema.json",
"//packages/angular_devkit/build_angular:src/builders/jest/schema.json",
"//packages/angular_devkit/build_angular:src/builders/web-test-runner/schema.json",
"//packages/angular_devkit/build_angular:src/builders/karma/schema.json",
"//packages/angular_devkit/build_angular:src/builders/ng-packagr/schema.json",
"//packages/angular_devkit/build_angular:src/builders/prerender/schema.json",
"//packages/angular_devkit/build_angular:src/builders/ssr-dev-server/schema.json",
"//packages/angular_devkit/build_angular:src/builders/protractor/schema.json",
"//packages/angular_devkit/build_angular:src/builders/server/schema.json",
"//packages/schematics/angular:app-shell/schema.json",
"//packages/schematics/angular:application/schema.json",
"//packages/schematics/angular:class/schema.json",
"//packages/schematics/angular:component/schema.json",
"//packages/schematics/angular:directive/schema.json",
"//packages/schematics/angular:enum/schema.json",
"//packages/schematics/angular:guard/schema.json",
"//packages/schematics/angular:interceptor/schema.json",
"//packages/schematics/angular:interface/schema.json",
"//packages/schematics/angular:library/schema.json",
"//packages/schematics/angular:module/schema.json",
"//packages/schematics/angular:ng-new/schema.json",
"//packages/schematics/angular:pipe/schema.json",
"//packages/schematics/angular:resolver/schema.json",
"//packages/schematics/angular:service/schema.json",
"//packages/schematics/angular:service-worker/schema.json",
"//packages/schematics/angular:web-worker/schema.json",
"//packages/angular/build:schemas",
"//packages/angular_devkit/build_angular:schemas",
"//packages/schematics/angular:schemas",
]

cli_json_schema(
Expand Down
5 changes: 2 additions & 3 deletions packages/angular/ssr/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@ load("@aspect_rules_js//npm:defs.bzl", "npm_package")
load("@npm//@angular/build-tooling/bazel/api-golden:index.bzl", "api_golden_test_npm_package")
load("@npm2//:defs.bzl", "npm_link_all_packages")
load("@rules_pkg//:pkg.bzl", "pkg_tar")
load("//tools:defaults.bzl", "ng_package")
load("//tools:defaults2.bzl", "ts_project")
load("//tools:defaults2.bzl", "ng_package", "ts_project")

package(default_visibility = ["//visibility:public"])

Expand Down Expand Up @@ -53,7 +52,7 @@ ng_package(
"../../third_party/beasties",
],
nested_packages = [
"//packages/angular/ssr/schematics:npm_package",
"//packages/angular/ssr/schematics:pkg",
],
deps = [
":ssr",
Expand Down
17 changes: 9 additions & 8 deletions packages/angular/ssr/schematics/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# Use of this source code is governed by an MIT-style license that can be
# found in the LICENSE file at https://angular.dev/license

load("//tools:defaults.bzl", "pkg_npm")
load("@aspect_rules_js//npm:defs.bzl", "npm_package")
load("//tools:defaults2.bzl", "jasmine_test", "ts_project")
load("//tools:ts_json_schema.bzl", "ts_json_schema")

Expand Down Expand Up @@ -57,7 +57,6 @@ ts_project(
"//packages/angular/ssr/schematics:" + src.replace(".json", ".ts")
for (src, _) in ALL_SCHEMA_TARGETS
],
data = [":schematics_assets"],
module_name = "@angular/ssr/schematics",
deps = [
"//packages/angular/ssr:node_modules/@angular-devkit/schematics",
Expand Down Expand Up @@ -86,16 +85,18 @@ ts_project(
jasmine_test(
name = "ssr_schematics_test",
data = [
":schematics_assets",
":ssr_schematics_test_lib_rjs",
],
)

# This package is intended to be combined into the main @angular/ssr package as a dep.
pkg_npm(
name = "npm_package",
pkg_json = None,
visibility = ["//packages/angular/ssr:__pkg__"],
deps = [
":schematics",
npm_package(
name = "pkg",
srcs = [
"package.json",
":schematics_assets",
":schematics_rjs",
],
visibility = ["//packages/angular/ssr:__pkg__"],
)
59 changes: 20 additions & 39 deletions packages/angular/ssr/third_party/beasties/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
load("@aspect_rules_js//js:defs.bzl", "js_library")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice!!!

load("@npm//@bazel/rollup:index.bzl", "rollup_bundle")
load("@npm2//:rollup/package_json.bzl", rollup = "bin")

package(default_visibility = ["//visibility:public"])

Expand All @@ -16,52 +16,33 @@ js_library(
js_library(
name = "beasties_bundled",
srcs = [
":bundled_beasties_files",
],
deps = [
"//:node_modules/beasties",
":bundled_beasties",
],
)

# Filter out esbuild metadata files and only copy the necessary files
genrule(
name = "bundled_beasties_files",
rollup.rollup(
name = "bundled_beasties",
srcs = [
":bundled_beasties",
"rollup.config.mjs",
"//:node_modules/@rollup/plugin-alias",
"//:node_modules/@rollup/plugin-commonjs",
"//:node_modules/@rollup/plugin-node-resolve",
"//:node_modules/beasties",
"//:node_modules/rollup-license-plugin",
"//:node_modules/unenv",
],
outs = [
"THIRD_PARTY_LICENSES.txt",
"index.js",
"index.js.map",
"THIRD_PARTY_LICENSES.txt",
],
cmd = """
for f in $(locations :bundled_beasties); do
# Only process files inside the bundled_beasties directory
if [[ "$${f}" == *bundled_beasties ]]; then
cp "$${f}/index.js" $(location :index.js)
cp "$${f}/index.js.map" $(location :index.js.map)
cp "$${f}/THIRD_PARTY_LICENSES.txt" $(location :THIRD_PARTY_LICENSES.txt)
fi
done
""",
)

rollup_bundle(
name = "bundled_beasties",
config_file = ":rollup.config.mjs",
entry_points = {
"@npm//:node_modules/beasties/dist/index.mjs": "index",
},
format = "esm",
link_workspace_root = True,
output_dir = True,
sourcemap = "true",
deps = [
"@npm//@rollup/plugin-alias",
"@npm//@rollup/plugin-commonjs",
"@npm//@rollup/plugin-node-resolve",
"@npm//beasties",
"@npm//rollup-license-plugin",
"@npm//unenv",
args = [
"--format=esm",
"--config=$(rootpath rollup.config.mjs)",
"--input=node_modules/beasties/dist/index.mjs",
"--sourcemap=true",
"--dir=packages/angular/ssr/third_party/beasties",
],
progress_message = "Bundling beasties",
silent_on_success = False,
)
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ export default {
nodeResolve({
preferBuiltins: false,
browser: true,
jail: process.cwd(),
}),
commonjs(),
alias({
Expand Down
8 changes: 6 additions & 2 deletions packages/angular_devkit/build_angular/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

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:defaults2.bzl", "copy_to_bin", "jasmine_test", "npm_package", "ts_project")
load("//tools:ts_json_schema.bzl", "ts_json_schema")

licenses(["notice"])
Expand Down Expand Up @@ -79,6 +79,11 @@ ts_json_schema(
src = "src/builders/web-test-runner/schema.json",
)

copy_to_bin(
name = "schemas",
srcs = glob(["**/schema.json"]),
)

RUNTIME_ASSETS = glob(
include = [
"src/**/schema.json",
Expand Down Expand Up @@ -300,7 +305,6 @@ ts_project(
"//packages/angular_devkit/architect/testing:testing_rjs",
"//packages/angular_devkit/core:core_rjs",
"//packages/angular_devkit/core/node:node_rjs",
"@npm//rxjs",
],
)

Expand Down
7 changes: 6 additions & 1 deletion packages/schematics/angular/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
# found in the LICENSE file at https://angular.dev/license

load("@npm2//:defs.bzl", "npm_link_all_packages")
load("//tools:defaults2.bzl", "jasmine_test", "npm_package", "ts_project")
load("//tools:defaults2.bzl", "copy_to_bin", "jasmine_test", "npm_package", "ts_project")
load("//tools:ts_json_schema.bzl", "ts_json_schema")

licenses(["notice"])
Expand Down Expand Up @@ -37,6 +37,11 @@ ALL_SCHEMA_TARGETS = [
for (src, name) in ALL_SCHEMA_TARGETS
]

copy_to_bin(
name = "schemas",
srcs = glob(["**/schema.json"]),
)

RUNTIME_ASSETS = [
"collection.json",
"migrations/migration-collection.json",
Expand Down
2 changes: 1 addition & 1 deletion tests/legacy-cli/e2e/assets/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
load("@build_bazel_rules_nodejs//:index.bzl", "copy_to_bin")
load("//tools:defaults2.bzl", "copy_to_bin")

copy_to_bin(
name = "assets",
Expand Down
2 changes: 1 addition & 1 deletion tests/legacy-cli/e2e/ng-snapshot/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
load("@build_bazel_rules_nodejs//:index.bzl", "copy_to_bin")
load("//tools:defaults2.bzl", "copy_to_bin")

copy_to_bin(
name = "ng-snapshot",
Expand Down
17 changes: 4 additions & 13 deletions tools/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,36 +1,28 @@
load("@aspect_bazel_lib//lib/private:tar_toolchain.bzl", "tar_toolchain")
load("@aspect_rules_js//js:defs.bzl", "js_binary")
load("@bazel_skylib//rules:copy_file.bzl", "copy_file")

# 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.dev/license
# @external_begin
load("@build_bazel_rules_nodejs//:index.bzl", "nodejs_binary")
load("//tools:defaults2.bzl", "js_binary")

package(default_visibility = ["//visibility:public"])

exports_files([
"package_json_release_filter.jq",
])

nodejs_binary(
js_binary(
name = "ng_cli_schema",
data = [
"ng_cli_schema_generator.js",
],
entry_point = "ng_cli_schema_generator.js",
)

nodejs_binary(
js_binary(
name = "quicktype_runner",
data = [
"quicktype_runner.js",
"@npm//quicktype-core",
"//:node_modules/quicktype-core",
],
entry_point = "quicktype_runner.js",
templated_args = ["--bazel_patch_module_resolver"],
)

tar_toolchain(
Expand Down Expand Up @@ -62,4 +54,3 @@ js_binary(
entry_point = ":copy_worker_js",
fixed_args = ["--vanilla-ts"],
)
# @external_end
Loading