Repo

Repository-specific information

Setup

  • Install packages:
    sudo dnf install \
      clang clang-format java-latest-openjdk-devel rust cargo mesa-libGL-devel \
      go Xvfb python3 gmp-devel patch podman git git-lfs fuse
    
  • Install bazelisk: https://bazel.build/install/bazelisk
  • Symlink bazel:
    ln -s ~/.local/bin/bazelisk ~/.local/bin/bazel
    
  • Install git hooks:
    bazel run //tools/git_hooks:install
    
  • Setup dotfiles (optional):
    bazel run //projects/dotfiles:install
    
  • Install android tools:
    bazel run //tools/android:install
    
  • Install nvm: https://github.com/nvm-sh/nvm
  • Install node:
    nvm install node
    
  • Install qt:
    bazel run //tools/qt:install
    
  • Set up secrets:
    bazel run //tools/secrets:systemd_creds_edit
    

Setup .bzlenv

. "$(bazel run //tools/bzlenv)"

Compile commands

Build compile_commands.json:

bazel run :refresh_compile_commands

Build everything

This requires around 90G

bazel build //...

Test everything

bazel test //...

Replace a rule with another one

find \
  "(" -name "*.bazel" -o -name "*.bzl" -o -name ".bazelrc" -o -name "*.md" ")" \
  -type f \
  -exec sed -i 's|//bzl/rules/txt|//tools/txt|g' "{}" ";"`

Parse a tar manifest

bazel build //projects/alwaldend.com:site_source_archive && \
  cat bazel-bin/projects/alwaldend.com/site_source_archive.manifest | \
  jq -r --slurp ". | flatten | .[].dest" | \
  grep "^content"

Remove a rule

find -name "BUILD.bazel" -type f -exec sed -i '/al_readme(/,/)/d' "{}" ";"

Find all public targets (ignores default_visibility)

bazel query 'attr(visibility, "//visibility:public", //...)'