Repo
Repository-specific information
Categories:
Setup
- Install packages:
sudo dnf install \ clang clang-tools-extra java-latest-openjdk-devel rust cargo mesa-libGL-devel \ go Xvfb python3 gmp-devel patch podman git git-lfs fuse fuse-libs pcsc-lite pcsc-lite-devel \ openssl gnutls-utils opensc openssl-pkcs11 libdnet qemu-kvm qemu-img - Install bazelisk: https://bazel.build/install/bazelisk
- Symlink bazel:
ln -s ~/.local/bin/bazelisk ~/.local/bin/bazel - Install git hooks:
bazel run //:write_git_hooks - Install android tools:
The empty repository environment is required for the first installation so Bazel does not try to load the SDK before
ANDROID_HOME="${HOME}/Android/Sdk" \ bazel run --config=agent \ --repo_env=ANDROID_HOME= \ //tools/android:installsdkmanagerinstalls it. Afterwards, exportANDROID_HOMEandANDROID_NDK_HOME, or set both with--repo_envin the ignoreduser.bazelrc. The repository dotfiles export the expected paths. - Setup dotfiles (optional):
bazel run //projects/dotfiles:install - Install nvm: https://github.com/nvm-sh/nvm
- Install node:
nvm install node - Qt is downloaded by Bazel; no host installation is required.
Vault login
bazel run //tools/vault -- login --method=userpass username="${USER}"
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", //...)'
Adding a bazel module
mkdir projects/project_name
cd projects/project_name
ln -s ../../.bazelignore
ln -s ../../.bazeliskrc
ln -s ../../tools/bazelrc/bzl_project.bazelrc .bazelrc
Ssh key using Yubikey’s pgp doesn’t work
Agent restart helps:
gpg-connect-agent updatestartuptty /bye
Check the key:
bazel run //tools/ykman -- info
Remote timeout
If some repo rules are timing out (java ones, for example), you can add
--remote_timeout 1000000
Update pnpm lock
bazel run //tools/pnpm -- --dir "${PWD}" install
Documentation: https://github.com/aspect-build/rules_js/blob/main/docs/pnpm.md#update_pnpm_lock
Ssh config
Proxmox VMs have Kerberos enabled, which slows SSH down, you need to disable it locally
~/.ssh/config.d/config:
GSSAPIAuthentication no
Update certificates on Fedora
sudo cp infra/vault/tf/output/pki_ca_servers.crt /etc/pki/ca-trust/source/anchors/
sudo update-ca-trust
Run go mod tidy
find -name "go.mod" -exec sh -c 'cd "$(dirname "{}")" && bazel run @rules_go//go -- mod tidy' ";"