Skip to content

Commit 0bc6277

Browse files
committed
chore(angular-ngc): upgrade to bzlmod
1 parent 863f752 commit 0bc6277

18 files changed

+159
-222
lines changed

angular-ngc/.aspect/bazelrc/bazel6.bazelrc

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,34 @@ build --reuse_sandbox_directories
1313
# Avoid this flag being enabled by remote_download_minimal or remote_download_toplevel
1414
# See https://meroton.com/blog/bazel-6-errors-build-without-the-bytes/
1515
build --noexperimental_action_cache_store_output_metadata
16+
17+
# Speed up all builds by not checking if output files have been modified. Lets you make changes to
18+
# the output tree without triggering a build for local debugging. For example, you can modify
19+
# [rules_js](https://github.com/aspect-build/rules_js) 3rd party npm packages in the output tree
20+
# when local debugging.
21+
# Docs: https://github.com/bazelbuild/bazel/blob/1af61b21df99edc2fc66939cdf14449c2661f873/src/main/java/com/google/devtools/build/lib/pkgcache/PackageOptions.java#L185
22+
# NB: This flag is in bazel6.bazelrc as when used in Bazel 7 is has been observed to break
23+
# "build without the bytes" --remote_download_outputs=toplevel. See https://github.com/bazel-contrib/bazel-lib/pull/711
24+
# for more info.
25+
build --noexperimental_check_output_files
26+
fetch --noexperimental_check_output_files
27+
query --noexperimental_check_output_files
28+
29+
# Don't apply `--noremote_upload_local_results` and `--noremote_accept_cached` to the disk cache.
30+
# If you have both `--noremote_upload_local_results` and `--disk_cache`, then this fixes a bug where
31+
# Bazel doesn't write to the local disk cache as it treats as a remote cache.
32+
# Docs: https://bazel.build/reference/command-line-reference#flag--incompatible_remote_results_ignore_disk
33+
# NB: This flag is in bazel6.bazelrc because it became a no-op in Bazel 7 and has been removed
34+
# in Bazel 8.
35+
build --incompatible_remote_results_ignore_disk
36+
37+
# Propagate tags from a target declaration to the actions' execution requirements.
38+
# Ensures that tags applied in your BUILD file, like `tags=["no-remote"]`
39+
# get propagated to actions created by the rule.
40+
# Without this option, you rely on rules authors to manually check the tags you passed
41+
# and apply relevant ones to the actions they create.
42+
# See https://github.com/bazelbuild/bazel/issues/8830 for details.
43+
# Docs: https://bazel.build/reference/command-line-reference#flag--experimental_allow_tags_propagation
44+
build --experimental_allow_tags_propagation
45+
fetch --experimental_allow_tags_propagation
46+
query --experimental_allow_tags_propagation

angular-ngc/.aspect/bazelrc/convenience.bazelrc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
build --keep_going
44

55
# Output test errors to stderr so users don't have to `cat` or open test failure log files when test
6-
# fail. This makes the log noiser in exchange for reducing the time-to-feedback on test failures for
6+
# fail. This makes the log noisier in exchange for reducing the time-to-feedback on test failures for
77
# users.
88
# Docs: https://bazel.build/docs/user-manual#test-output
99
test --test_output=errors

angular-ngc/.aspect/bazelrc/correctness.bazelrc

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ test --test_verbose_timeout_warnings
2424
# Allow the Bazel server to check directory sources for changes. Ensures that the Bazel server
2525
# notices when a directory changes, if you have a directory listed in the srcs of some target.
2626
# Recommended when using
27-
# [copy_directory](https://github.com/aspect-build/bazel-lib/blob/main/docs/copy_directory.md) and
27+
# [copy_directory](https://github.com/bazel-contrib/bazel-lib/blob/main/docs/copy_directory.md) and
2828
# [rules_js](https://github.com/aspect-build/rules_js) since npm package are source directories
2929
# inputs to copy_directory actions.
3030
# Docs: https://bazel.build/reference/command-line-reference#flag--host_jvm_args
@@ -42,21 +42,23 @@ test --incompatible_exclusive_test_sandboxed
4242
# Docs: https://bazel.build/reference/command-line-reference#flag--incompatible_strict_action_env
4343
build --incompatible_strict_action_env
4444

45-
# Propagate tags from a target declaration to the actions' execution requirements.
46-
# Ensures that tags applied in your BUILD file, like `tags=["no-remote"]`
47-
# get propagated to actions created by the rule.
48-
# Without this option, you rely on rules authors to manually check the tags you passed
49-
# and apply relevant ones to the actions they create.
50-
# See https://github.com/bazelbuild/bazel/issues/8830 for details.
51-
# Docs: https://bazel.build/reference/command-line-reference#flag--experimental_allow_tags_propagation
52-
build --experimental_allow_tags_propagation
53-
fetch --experimental_allow_tags_propagation
54-
query --experimental_allow_tags_propagation
55-
5645
# Do not automatically create `__init__.py` files in the runfiles of Python targets. Fixes the wrong
5746
# default that comes from Google's internal monorepo by using `__init__.py` to delimit a Python
5847
# package. Precisely, when a `py_binary` or `py_test` target has `legacy_create_init` set to `auto (the
5948
# default), it is treated as false if and only if this flag is set. See
6049
# https://github.com/bazelbuild/bazel/issues/10076.
6150
# Docs: https://bazel.build/reference/command-line-reference#flag--incompatible_default_to_explicit_init_py
6251
build --incompatible_default_to_explicit_init_py
52+
53+
# Set default value of `allow_empty` to `False` in `glob()`. This prevents a common mistake when
54+
# attempting to use `glob()` to match files in a subdirectory that is opaque to the current package
55+
# because it contains a BUILD file. See https://github.com/bazelbuild/bazel/issues/8195.
56+
# Docs: https://bazel.build/reference/command-line-reference#flag--incompatible_disallow_empty_glob
57+
common --incompatible_disallow_empty_glob
58+
59+
# Always download coverage files for tests from the remote cache. By default, coverage files are not
60+
# downloaded on test result cache hits when --remote_download_minimal is enabled, making it impossible
61+
# to generate a full coverage report.
62+
# Docs: https://bazel.build/reference/command-line-reference#flag--experimental_fetch_all_coverage_outputs
63+
# detching remote cache results
64+
test --experimental_fetch_all_coverage_outputs

angular-ngc/.aspect/bazelrc/javascript.bazelrc

Lines changed: 1 addition & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -8,21 +8,4 @@
88
# details.
99
# Docs: https://nodejs.org/en/docs/guides/debugging-getting-started/#command-line-options
1010
run:debug -- --node_options=--inspect-brk
11-
12-
# Enable runfiles on all platforms. Runfiles are on by default on Linux and MacOS but off on
13-
# Windows.
14-
#
15-
# In general, rules_js and derivate rule sets assume that runfiles are enabled and do not support no
16-
# runfiles case because it does not scale to teach all Node.js tools to use the runfiles manifest.
17-
#
18-
# If you are developing on Windows, you must either run bazel with administrator privileges or
19-
# enable developer mode. If you do not you may hit this error on Windows:
20-
#
21-
# Bazel needs to create symlinks to build the runfiles tree.
22-
# Creating symlinks on Windows requires one of the following:
23-
# 1. Bazel is run with administrator privileges.
24-
# 2. The system version is Windows 10 Creators Update (1703) or later
25-
# and developer mode is enabled.
26-
#
27-
# Docs: https://bazel.build/reference/command-line-reference#flag--enable_runfiles
28-
build --enable_runfiles
11+
test:debug --test_env=NODE_OPTIONS=--inspect-brk
Lines changed: 12 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,3 @@
1-
# Speed up all builds by not checking if output files have been modified. Lets you make changes to
2-
# the output tree without triggering a build for local debugging. For example, you can modify
3-
# [rules_js](https://github.com/aspect-build/rules_js) 3rd party npm packages in the output tree
4-
# when local debugging.
5-
# Docs: https://github.com/bazelbuild/bazel/blob/1af61b21df99edc2fc66939cdf14449c2661f873/src/main/java/com/google/devtools/build/lib/pkgcache/PackageOptions.java#L185
6-
build --noexperimental_check_output_files
7-
fetch --noexperimental_check_output_files
8-
query --noexperimental_check_output_files
9-
10-
# Don't apply `--noremote_upload_local_results` and `--noremote_accept_cached` to the disk cache.
11-
# If you have both `--noremote_upload_local_results` and `--disk_cache`, then this fixes a bug where
12-
# Bazel doesn't write to the local disk cache as it treats as a remote cache.
13-
# Docs: https://bazel.build/reference/command-line-reference#flag--incompatible_remote_results_ignore_disk
14-
build --incompatible_remote_results_ignore_disk
15-
161
# Directories used by sandboxed non-worker execution may be reused to avoid unnecessary setup costs.
172
# Save time on Sandbox creation and deletion when many of the same kind of action run during the
183
# build.
@@ -28,11 +13,15 @@ build --experimental_reuse_sandbox_directories
2813
# Docs: https://bazel.build/reference/command-line-reference#flag--legacy_external_runfiles
2914
build --nolegacy_external_runfiles
3015

31-
# Some actions are always IO-intensive but require little compute. It's wasteful to put the output
32-
# in the remote cache, it just saturates the network and fills the cache storage causing earlier
33-
# evictions. It's also not worth sending them for remote execution.
34-
# For actions like PackageTar it's usually faster to just re-run the work locally every time.
35-
# You'll have to look at an execution log to figure out what other action mnemonics you care about.
36-
# In some cases you may need to patch rulesets to add a mnemonic to actions that don't have one.
37-
# https://bazel.build/reference/command-line-reference#flag--modify_execution_info
38-
build --modify_execution_info=PackageTar=+no-remote
16+
# Avoid creating a runfiles tree for binaries or tests until it is needed.
17+
# Docs: https://bazel.build/reference/command-line-reference#flag--build_runfile_links
18+
# See https://github.com/bazelbuild/bazel/issues/6627
19+
#
20+
# This may break local workflows that `build` a binary target, then run the resulting program
21+
# outside of `bazel run`. In those cases, the script will need to call
22+
# `bazel build --build_runfile_links //my/binary:target` and then execute the resulting program.
23+
build --nobuild_runfile_links
24+
25+
# Needed prior to Bazel 8; see
26+
# https://github.com/bazelbuild/bazel/issues/20577
27+
coverage --build_runfile_links

angular-ngc/WORKSPACE.bazel

Lines changed: 0 additions & 96 deletions
This file was deleted.

angular-ngc/defs.bzl

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,15 @@
1-
load("@bazel_skylib//rules:write_file.bzl", "write_file")
2-
load("@aspect_rules_js//npm:defs.bzl", "npm_package")
1+
"Macros to make BUILD files more ergonomic."
2+
33
load("@aspect_bazel_lib//lib:copy_to_directory.bzl", "copy_to_directory")
44
load("@aspect_rules_esbuild//esbuild:defs.bzl", "esbuild")
5+
load("@aspect_rules_js//npm:defs.bzl", "npm_package")
6+
load("@bazel_skylib//rules:write_file.bzl", "write_file")
57
load("@npm//:history-server/package_json.bzl", history_server_bin = "bin")
68
load("@npm//:html-insert-assets/package_json.bzl", html_insert_assets_bin = "bin")
79
load("@npm//:karma/package_json.bzl", _karma_bin = "bin")
10+
load("//tools:karma.bzl", "generate_karma_config", "generate_test_bootstrap", "generate_test_setup")
811
load("//tools:ng.bzl", "ng_esbuild", "ng_project")
912
load("//tools:ts.bzl", "ts_project")
10-
load("//tools:karma.bzl", "generate_karma_config", "generate_test_bootstrap", "generate_test_setup")
1113

1214
# Common dependencies of Angular applications
1315
APPLICATION_DEPS = [
@@ -60,7 +62,7 @@ NG_PROD_DEFINE = {
6062
"ngJitMode": "false",
6163
}
6264

63-
def ng_application(name, deps = [], test_deps = [], assets = None, html_assets = APPLICATION_HTML_ASSETS, visibility = ["//visibility:public"], **kwargs):
65+
def ng_application(name, deps = [], test_deps = [], assets = None, html_assets = APPLICATION_HTML_ASSETS, visibility = ["//visibility:public"]):
6466
"""
6567
Bazel macro for compiling an Angular application. Creates {name}, test, serve targets.
6668
@@ -83,7 +85,6 @@ def ng_application(name, deps = [], test_deps = [], assets = None, html_assets =
8385
html_assets: assets to insert into the index.html, [styles.css, favicon.ico] by default
8486
assets: assets to include in the file bundle
8587
visibility: visibility of the primary targets ({name}, 'test', 'serve')
86-
**kwargs: extra args passed to main Angular CLI rules
8788
"""
8889
assets = assets if assets else native.glob(["assets/**/*"])
8990
html_assets = html_assets if html_assets else []
@@ -246,7 +247,7 @@ def ng_pkg(name, srcs, deps = [], test_deps = [], visibility = ["//visibility:pu
246247
visibility: visibility of the primary targets ('{name}', 'test')
247248
"""
248249

249-
test_spec_srcs = native.glob(["src/**/*.spec.ts"])
250+
test_spec_srcs = native.glob(["src/**/*.spec.ts"], allow_empty = True)
250251

251252
# An index file to allow direct imports of the directory similar to a package.json "main"
252253
write_file(

angular-ngc/packages/connect/BUILD.bazel

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,9 @@ ng_pkg(
1717
"src/public-api.ts",
1818
],
1919
deps = [
20-
":node_modules/@bufbuild/connect",
21-
":node_modules/@bufbuild/connect-web",
2220
":node_modules/@bufbuild/protobuf",
21+
":node_modules/@connectrpc/connect",
22+
":node_modules/@connectrpc/connect-web",
2323
"//packages/connect/src/proto:eliza_ts_proto",
2424
],
2525
)

angular-ngc/packages/connect/package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,13 @@
22
"name": "@ngc-example/connect",
33
"dependencies": {
44
"@bufbuild/buf": "1.25.0",
5-
"@bufbuild/connect": "^0.13.0",
6-
"@bufbuild/connect-web": "^0.13.0",
5+
"@connectrpc/connect": "^1.6.1",
6+
"@connectrpc/connect-web": "^1.6.1",
77
"@bufbuild/protobuf": "^1.3.0"
88
},
99
"devDependencies": {
1010
"@types/node": "18.11.9",
11-
"@bufbuild/protoc-gen-connect-es": "^0.13.0",
11+
"@connectrpc/protoc-gen-connect-es": "^1.6.1",
1212
"@bufbuild/protoc-gen-es": "^1.3.0"
1313
},
1414
"main": "src/public-api"

angular-ngc/packages/connect/src/lib/client.provider.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { Provider } from '@angular/core';
2-
import { Transport } from '@bufbuild/connect';
2+
import { Transport } from '@connectrpc/connect';
33
import { ServiceType } from '@bufbuild/protobuf';
44
import { createObservableClient } from './observable-client';
55
import { TRANSPORT } from './transport.token';

0 commit comments

Comments
 (0)