Skip to content

Commit 8f726eb

Browse files
authored
chore: misc cleanup (#3755)
1 parent cb4693d commit 8f726eb

31 files changed

+180
-321
lines changed

.bazelignore

+2-11
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,2 @@
1-
# NB: sematics here are not the same as .gitignore
2-
# see https://github.com/bazelbuild/bazel/issues/8106
3-
node_modules
4-
.git
5-
bazel-out
6-
7-
# e2e tests are their own workspaces
8-
e2e
9-
10-
# **/dist
11-
dist
1+
e2e/
2+
node_modules/

.bazelrc

+10-46
Original file line numberDiff line numberDiff line change
@@ -1,48 +1,12 @@
1-
# Import shared settings first so we can override below
2-
import %workspace%/common.bazelrc
3-
4-
###############################
5-
# Remote Build Execution support
6-
# Turn on these settings with
7-
# --config=remote
8-
###############################
9-
10-
# Load default settings for Remote Build Execution.
11-
import %workspace%/third_party/github.com/bazelbuild/bazel-toolchains/bazelrc/bazel-4.1.0.bazelrc
12-
13-
# Remote instance, borrow the one used by Angular devs
14-
build:remote --remote_instance_name=projects/internal-200822/instances/default_instance
15-
build:remote --project_id=internal-200822
16-
17-
# To reproduce Windows issues where there is no runfiles symlink there
18-
build:no-runfiles --noenable_runfiles
19-
# workaround https://github.com/bazelbuild/bazel/issues/7994
20-
build:no-runfiles --spawn_strategy=standalone
21-
# This config is probably only used while debugging
22-
build:no-runfiles --define=VERBOSE_LOG=1
23-
24-
# Docker Sandbox Mode
25-
# Useful for troubleshooting Remote Build Execution problems
26-
# See https://docs.bazel.build/versions/master/remote-execution-sandbox.html#prerequisites
27-
build:docker-sandbox --spawn_strategy=docker --strategy=Javac=docker --genrule_strategy=docker
28-
build:docker-sandbox --define=EXECUTOR=remote
29-
build:docker-sandbox --experimental_docker_verbose
30-
build:docker-sandbox --experimental_enable_docker_sandbox
31-
# This is the same image used on BazelCI rbe_ubuntu1604 job
32-
build:docker-sandbox --experimental_docker_image=gcr.io/cloud-marketplace/google/rbe-ubuntu16-04
33-
34-
# Incompatible flags to run with
35-
build --incompatible_no_implicit_file_export
36-
# Fail if a glob doesn't match anything (https://github.com/bazelbuild/bazel/issues/8195)
37-
build --incompatible_disallow_empty_glob
38-
# TODO(mattem): flip this when dependencies allow
39-
# build --incompatible_struct_has_no_methods
40-
# TODO(alexeagle): turn on this flag when dependencies allow
41-
# build --incompatible_use_platforms_repo_for_constraints
42-
43-
# Allow exclusive tests to run in a sandbox
44-
test --incompatible_exclusive_test_sandboxed
45-
46-
# TODO: migrate all dependencies from WORKSPACE to MODULE.bazel
1+
# TODO: migrate all root WORKSPACE dependencies to MODULE.bazel
472
# https://github.com/bazelbuild/rules_nodejs/issues/3695
483
common --noenable_bzlmod
4+
5+
# Load any settings specific to the current user.
6+
# .bazelrc.user should appear in .gitignore so that settings are not shared with team members
7+
# This needs to be last statement in this
8+
# config, as the user configuration should be able to overwrite flags from this file.
9+
# See https://docs.bazel.build/versions/master/best-practices.html#bazelrc
10+
# (Note that we use .bazelrc.user so the file appears next to .bazelrc in directory listing,
11+
# rather than user.bazelrc as suggested in the Bazel docs)
12+
try-import %workspace%/.bazelrc.user

.github/BUILD.bazel

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
load("@rules_codeowners//tools:codeowners.bzl", "generate_codeowners")
21
load("@bazel_skylib//rules:diff_test.bzl", "diff_test")
2+
load("@rules_codeowners//tools:codeowners.bzl", "generate_codeowners")
33

44
generate_codeowners(
55
name = "gen_codeowners",

.github/workflows/buildifier.yaml

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
name: Buildifier
2+
3+
# Controls when the action will run.
4+
on:
5+
# Triggers the workflow on push or pull request events but only for the main branch
6+
push:
7+
branches: [main]
8+
pull_request:
9+
branches: [main]
10+
11+
# Allows you to run this workflow manually from the Actions tab
12+
workflow_dispatch:
13+
14+
jobs:
15+
check:
16+
runs-on: ubuntu-latest
17+
steps:
18+
- uses: actions/checkout@v4
19+
- name: buildifier
20+
run: bazel run --enable_bzlmod //:buildifier.check

.github/workflows/ci.bazelrc

-13
This file was deleted.

.github/workflows/ci.yaml

+2-1
Original file line numberDiff line numberDiff line change
@@ -25,5 +25,6 @@ jobs:
2525
[
2626
{"bazelversion": "6.4.0", "os": "macos-latest"},
2727
{"bazelversion": "6.4.0", "os": "windows-latest"},
28-
{"bazelversion": "6.4.0", folder: "."}
28+
{"bazelversion": "6.4.0", folder: "."},
29+
{"bazelversion": "6.4.0", bzlmodEnabled: true}
2930
]

.gitignore

+14-14
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
1+
bazel-*
12
.bazelrc.user
2-
.idea
3+
node_modules/
34
rules_nodejs-*.tar.gz
4-
dist
5-
bazel-out
6-
/e2e/*/bazel-*
7-
/packages/*/bazel-*
8-
node_modules
9-
yarn-error.log
5+
6+
.idea/
7+
.ijwb/
8+
.vscode
109
.DS_Store
1110

12-
# Disable lockfile for now. It is unstable.
13-
# https://github.com/bazelbuild/bazel/issues/19026
14-
# https://github.com/bazelbuild/bazel/issues/19621
15-
# https://github.com/bazelbuild/bazel/issues/19971
16-
# https://github.com/bazelbuild/bazel/issues/20272
17-
# https://github.com/bazelbuild/bazel/issues/20369
18-
MODULE.bazel.lock
11+
# Bazel's MODULE lockfile isn't ready to check in yet as of Bazel 7.1.
12+
# Do allow for it to be created, however, since it gives a performance boost for local development.
13+
# [Store resolved repository attributes in the Bzlmod lockfile](https://github.com/bazelbuild/bazel/issues/19026)
14+
# [MODULE.bazel.lock file contains user specific paths](https://github.com/bazelbuild/bazel/issues/19621)
15+
# [Consider skipping bazel_tools@_ from lockfile](https://github.com/bazelbuild/bazel/issues/19971)
16+
# [MODULE.bazel.lock file "reads through" already-locked package manager](https://github.com/bazelbuild/bazel/issues/20272)
17+
# [moduleFileHash in MODULE.bazel.lock causes frequent Git merge conflicts](https://github.com/bazelbuild/bazel/issues/20369)
18+
MODULE.bazel.lock

.pre-commit-config.yaml

+22-5
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,30 @@
11
# See CONTRIBUTING.md for instructions.
22
# See https://pre-commit.com for more information
33
# See https://pre-commit.com/hooks.html for more hooks
4+
5+
# Commitizen runs in commit-msg stage
6+
# but we don't want to run the other hooks on commit messages
7+
default_stages: [commit]
8+
49
repos:
10+
# Check formatting and lint for starlark code
511
- repo: https://github.com/keith/pre-commit-buildifier
6-
rev: 4.0.1.1
12+
rev: 6.4.0
713
hooks:
814
- id: buildifier
9-
args: &args
10-
# Keep this argument in sync with .bazelci/presubmit.yml
11-
- --warnings=-bzl-visibility,-function-docstring-args,-function-docstring-return,-print,-unnamed-macro,-provider-params,-function-docstring-header,-no-effect,-uninitialized,-rule-impl-return
1215
- id: buildifier-lint
13-
args: *args
16+
# Enforce that commit messages allow for later changelog generation
17+
- repo: https://github.com/commitizen-tools/commitizen
18+
rev: v3.24.0
19+
hooks:
20+
# Requires that commitizen is already installed
21+
- id: commitizen
22+
stages: [commit-msg]
23+
- repo: https://github.com/pre-commit/mirrors-prettier
24+
rev: v3.1.0
25+
hooks:
26+
- id: prettier
27+
- repo: https://github.com/koalaman/shellcheck-precommit
28+
rev: v0.8.0
29+
hooks:
30+
- id: shellcheck

BUILD.bazel

+17-3
Original file line numberDiff line numberDiff line change
@@ -12,24 +12,38 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15+
load("@buildifier_prebuilt//:rules.bzl", "buildifier")
1516
load("//:tools/defaults.bzl", "codeowners")
1617

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

1920
exports_files([
2021
".bazelci/presubmit.yml",
2122
".bazelversion",
22-
"common.bazelrc",
2323
"package.json",
2424
"LICENSE",
2525
])
2626

27-
# BEGIN-INTERNAL
27+
buildifier(
28+
name = "buildifier",
29+
exclude_patterns = ["./.git/*"],
30+
lint_mode = "fix",
31+
mode = "fix",
32+
tags = ["manual"], # tag as manual so windows ci does not build it by default
33+
)
34+
35+
buildifier(
36+
name = "buildifier.check",
37+
exclude_patterns = ["./.git/*"],
38+
lint_mode = "warn",
39+
mode = "diff",
40+
tags = ["manual"], # tag as manual so windows ci does not build it by default
41+
)
42+
2843
codeowners(
2944
pattern = "*",
3045
teams = [
3146
"@mattem",
3247
"@gregmagolan",
3348
],
3449
)
35-
# END-INTERNAL

MODULE.bazel

+13
Original file line numberDiff line numberDiff line change
@@ -23,16 +23,29 @@ use_repo(node, "nodejs_toolchains")
2323
# https://github.com/bazelbuild/rules_nodejs/blob/4c373209b058d46f2a5f9ab9f8abf11b161ae459/nodejs/repositories.bzl#L461/.
2424
# See https://github.com/bazelbuild/bazel/issues/19645 and https://github.com/bazelbuild/rules_nodejs/pull/3750 for more context.
2525
register_toolchains("@nodejs_toolchains//:linux_amd64_toolchain_target")
26+
2627
register_toolchains("@nodejs_toolchains//:linux_amd64_toolchain")
28+
2729
register_toolchains("@nodejs_toolchains//:linux_arm64_toolchain_target")
30+
2831
register_toolchains("@nodejs_toolchains//:linux_arm64_toolchain")
32+
2933
register_toolchains("@nodejs_toolchains//:linux_s390x_toolchain_target")
34+
3035
register_toolchains("@nodejs_toolchains//:linux_s390x_toolchain")
36+
3137
register_toolchains("@nodejs_toolchains//:linux_ppc64le_toolchain_target")
38+
3239
register_toolchains("@nodejs_toolchains//:linux_ppc64le_toolchain")
40+
3341
register_toolchains("@nodejs_toolchains//:darwin_amd64_toolchain_target")
42+
3443
register_toolchains("@nodejs_toolchains//:darwin_amd64_toolchain")
44+
3545
register_toolchains("@nodejs_toolchains//:darwin_arm64_toolchain_target")
46+
3647
register_toolchains("@nodejs_toolchains//:darwin_arm64_toolchain")
48+
3749
register_toolchains("@nodejs_toolchains//:windows_amd64_toolchain_target")
50+
3851
register_toolchains("@nodejs_toolchains//:windows_amd64_toolchain")

WORKSPACE

+9
Original file line numberDiff line numberDiff line change
@@ -93,3 +93,12 @@ stardoc_external_deps()
9393
load("@stardoc_maven//:defs.bzl", stardoc_pinned_maven_install = "pinned_maven_install")
9494

9595
stardoc_pinned_maven_install()
96+
97+
# Buildifier
98+
load("@buildifier_prebuilt//:deps.bzl", "buildifier_prebuilt_deps")
99+
100+
buildifier_prebuilt_deps()
101+
102+
load("@buildifier_prebuilt//:defs.bzl", "buildifier_prebuilt_register_toolchains")
103+
104+
buildifier_prebuilt_register_toolchains()

common.bazelrc

-93
This file was deleted.

0 commit comments

Comments
 (0)