Skip to content

Commit

Permalink
chore: misc cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
gregmagolan committed Jun 7, 2024
1 parent cb4693d commit d237f81
Show file tree
Hide file tree
Showing 31 changed files with 179 additions and 320 deletions.
13 changes: 2 additions & 11 deletions .bazelignore
Original file line number Diff line number Diff line change
@@ -1,11 +1,2 @@
# NB: sematics here are not the same as .gitignore
# see https://github.com/bazelbuild/bazel/issues/8106
node_modules
.git
bazel-out

# e2e tests are their own workspaces
e2e

# **/dist
dist
e2e/
node_modules/
56 changes: 10 additions & 46 deletions .bazelrc
Original file line number Diff line number Diff line change
@@ -1,48 +1,12 @@
# Import shared settings first so we can override below
import %workspace%/common.bazelrc

###############################
# Remote Build Execution support
# Turn on these settings with
# --config=remote
###############################

# Load default settings for Remote Build Execution.
import %workspace%/third_party/github.com/bazelbuild/bazel-toolchains/bazelrc/bazel-4.1.0.bazelrc

# Remote instance, borrow the one used by Angular devs
build:remote --remote_instance_name=projects/internal-200822/instances/default_instance
build:remote --project_id=internal-200822

# To reproduce Windows issues where there is no runfiles symlink there
build:no-runfiles --noenable_runfiles
# workaround https://github.com/bazelbuild/bazel/issues/7994
build:no-runfiles --spawn_strategy=standalone
# This config is probably only used while debugging
build:no-runfiles --define=VERBOSE_LOG=1

# Docker Sandbox Mode
# Useful for troubleshooting Remote Build Execution problems
# See https://docs.bazel.build/versions/master/remote-execution-sandbox.html#prerequisites
build:docker-sandbox --spawn_strategy=docker --strategy=Javac=docker --genrule_strategy=docker
build:docker-sandbox --define=EXECUTOR=remote
build:docker-sandbox --experimental_docker_verbose
build:docker-sandbox --experimental_enable_docker_sandbox
# This is the same image used on BazelCI rbe_ubuntu1604 job
build:docker-sandbox --experimental_docker_image=gcr.io/cloud-marketplace/google/rbe-ubuntu16-04

# Incompatible flags to run with
build --incompatible_no_implicit_file_export
# Fail if a glob doesn't match anything (https://github.com/bazelbuild/bazel/issues/8195)
build --incompatible_disallow_empty_glob
# TODO(mattem): flip this when dependencies allow
# build --incompatible_struct_has_no_methods
# TODO(alexeagle): turn on this flag when dependencies allow
# build --incompatible_use_platforms_repo_for_constraints

# Allow exclusive tests to run in a sandbox
test --incompatible_exclusive_test_sandboxed

# TODO: migrate all dependencies from WORKSPACE to MODULE.bazel
# TODO: migrate all root WORKSPACE dependencies to MODULE.bazel
# https://github.com/bazelbuild/rules_nodejs/issues/3695
common --noenable_bzlmod

# Load any settings specific to the current user.
# .bazelrc.user should appear in .gitignore so that settings are not shared with team members
# This needs to be last statement in this
# config, as the user configuration should be able to overwrite flags from this file.
# See https://docs.bazel.build/versions/master/best-practices.html#bazelrc
# (Note that we use .bazelrc.user so the file appears next to .bazelrc in directory listing,
# rather than user.bazelrc as suggested in the Bazel docs)
try-import %workspace%/.bazelrc.user
2 changes: 1 addition & 1 deletion .github/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
load("@rules_codeowners//tools:codeowners.bzl", "generate_codeowners")
load("@bazel_skylib//rules:diff_test.bzl", "diff_test")
load("@rules_codeowners//tools:codeowners.bzl", "generate_codeowners")

generate_codeowners(
name = "gen_codeowners",
Expand Down
20 changes: 20 additions & 0 deletions .github/workflows/buildifier.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: Buildifier

# Controls when the action will run.
on:
# Triggers the workflow on push or pull request events but only for the main branch
push:
branches: [main]
pull_request:
branches: [main]

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

jobs:
check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: buildifier
run: bazel run --enable_bzlmod //:buildifier.check
13 changes: 0 additions & 13 deletions .github/workflows/ci.bazelrc

This file was deleted.

1 change: 1 addition & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,5 @@ jobs:
{"bazelversion": "6.4.0", "os": "macos-latest"},
{"bazelversion": "6.4.0", "os": "windows-latest"},
{"bazelversion": "6.4.0", folder: "."}
{"bazelversion": "6.4.0", bzlmodEnabled: "true", folder: "e2e/smoke"}
]
28 changes: 14 additions & 14 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
bazel-*
.bazelrc.user
.idea
node_modules/
rules_nodejs-*.tar.gz
dist
bazel-out
/e2e/*/bazel-*
/packages/*/bazel-*
node_modules
yarn-error.log

.idea/
.ijwb/
.vscode
.DS_Store

# Disable lockfile for now. It is unstable.
# https://github.com/bazelbuild/bazel/issues/19026
# https://github.com/bazelbuild/bazel/issues/19621
# https://github.com/bazelbuild/bazel/issues/19971
# https://github.com/bazelbuild/bazel/issues/20272
# https://github.com/bazelbuild/bazel/issues/20369
MODULE.bazel.lock
# Bazel's MODULE lockfile isn't ready to check in yet as of Bazel 7.1.
# Do allow for it to be created, however, since it gives a performance boost for local development.
# [Store resolved repository attributes in the Bzlmod lockfile](https://github.com/bazelbuild/bazel/issues/19026)
# [MODULE.bazel.lock file contains user specific paths](https://github.com/bazelbuild/bazel/issues/19621)
# [Consider skipping bazel_tools@_ from lockfile](https://github.com/bazelbuild/bazel/issues/19971)
# [MODULE.bazel.lock file "reads through" already-locked package manager](https://github.com/bazelbuild/bazel/issues/20272)
# [moduleFileHash in MODULE.bazel.lock causes frequent Git merge conflicts](https://github.com/bazelbuild/bazel/issues/20369)
MODULE.bazel.lock
27 changes: 22 additions & 5 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,13 +1,30 @@
# See CONTRIBUTING.md for instructions.
# See https://pre-commit.com for more information
# See https://pre-commit.com/hooks.html for more hooks

# Commitizen runs in commit-msg stage
# but we don't want to run the other hooks on commit messages
default_stages: [commit]

repos:
# Check formatting and lint for starlark code
- repo: https://github.com/keith/pre-commit-buildifier
rev: 4.0.1.1
rev: 6.4.0
hooks:
- id: buildifier
args: &args
# Keep this argument in sync with .bazelci/presubmit.yml
- --warnings=-bzl-visibility,-function-docstring-args,-function-docstring-return,-print,-unnamed-macro,-provider-params,-function-docstring-header,-no-effect,-uninitialized,-rule-impl-return
- id: buildifier-lint
args: *args
# Enforce that commit messages allow for later changelog generation
- repo: https://github.com/commitizen-tools/commitizen
rev: v3.24.0
hooks:
# Requires that commitizen is already installed
- id: commitizen
stages: [commit-msg]
- repo: https://github.com/pre-commit/mirrors-prettier
rev: v3.1.0
hooks:
- id: prettier
- repo: https://github.com/koalaman/shellcheck-precommit
rev: v0.8.0
hooks:
- id: shellcheck
20 changes: 17 additions & 3 deletions BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -12,24 +12,38 @@
# See the License for the specific language governing permissions and
# limitations under the License.

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

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

exports_files([
".bazelci/presubmit.yml",
".bazelversion",
"common.bazelrc",
"package.json",
"LICENSE",
])

# BEGIN-INTERNAL
buildifier(
name = "buildifier",
exclude_patterns = ["./.git/*"],
lint_mode = "fix",
mode = "fix",
tags = ["manual"], # tag as manual so windows ci does not build it by default
)

buildifier(
name = "buildifier.check",
exclude_patterns = ["./.git/*"],
lint_mode = "warn",
mode = "diff",
tags = ["manual"], # tag as manual so windows ci does not build it by default
)

codeowners(
pattern = "*",
teams = [
"@mattem",
"@gregmagolan",
],
)
# END-INTERNAL
13 changes: 13 additions & 0 deletions MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -23,16 +23,29 @@ use_repo(node, "nodejs_toolchains")
# https://github.com/bazelbuild/rules_nodejs/blob/4c373209b058d46f2a5f9ab9f8abf11b161ae459/nodejs/repositories.bzl#L461/.
# See https://github.com/bazelbuild/bazel/issues/19645 and https://github.com/bazelbuild/rules_nodejs/pull/3750 for more context.
register_toolchains("@nodejs_toolchains//:linux_amd64_toolchain_target")

register_toolchains("@nodejs_toolchains//:linux_amd64_toolchain")

register_toolchains("@nodejs_toolchains//:linux_arm64_toolchain_target")

register_toolchains("@nodejs_toolchains//:linux_arm64_toolchain")

register_toolchains("@nodejs_toolchains//:linux_s390x_toolchain_target")

register_toolchains("@nodejs_toolchains//:linux_s390x_toolchain")

register_toolchains("@nodejs_toolchains//:linux_ppc64le_toolchain_target")

register_toolchains("@nodejs_toolchains//:linux_ppc64le_toolchain")

register_toolchains("@nodejs_toolchains//:darwin_amd64_toolchain_target")

register_toolchains("@nodejs_toolchains//:darwin_amd64_toolchain")

register_toolchains("@nodejs_toolchains//:darwin_arm64_toolchain_target")

register_toolchains("@nodejs_toolchains//:darwin_arm64_toolchain")

register_toolchains("@nodejs_toolchains//:windows_amd64_toolchain_target")

register_toolchains("@nodejs_toolchains//:windows_amd64_toolchain")
9 changes: 9 additions & 0 deletions WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -93,3 +93,12 @@ stardoc_external_deps()
load("@stardoc_maven//:defs.bzl", stardoc_pinned_maven_install = "pinned_maven_install")

stardoc_pinned_maven_install()

# Buildifier
load("@buildifier_prebuilt//:deps.bzl", "buildifier_prebuilt_deps")

buildifier_prebuilt_deps()

load("@buildifier_prebuilt//:defs.bzl", "buildifier_prebuilt_register_toolchains")

buildifier_prebuilt_register_toolchains()
93 changes: 0 additions & 93 deletions common.bazelrc

This file was deleted.

Loading

0 comments on commit d237f81

Please sign in to comment.