@@ -6,7 +6,7 @@ description: Conventions for editing Bazel files in the github/codeql repository
66# Bazel in the codeql repository
77
88A bzlmod module named ` ql ` , repo name ` @codeql ` ([ ` MODULE.bazel ` ] ( ../../../MODULE.bazel ) ). It builds standalone, and is
9- also consumed by an internal module that depends on it ; standalone builds replace that module with a stub.
9+ also consumed by an internal module; standalone builds replace that module with a stub.
1010
1111## Traps
1212
@@ -24,10 +24,10 @@ Things that will waste your time or produce a wrong edit here. Read this section
2424* ** Do not stub your way out of a missing internal dependency.** See [ Building standalone] ( #building-standalone ) for the
2525 one narrow case where extending the stub is correct.
2626
27- ## Rules of thumb
27+ ## Conventions
2828
29- * ** Copy a neighbouring target rather than inventing a shape.** Packaging is not uniform: some packages use the
30- ` codeql_* ` wrappers, others still use ` pkg_files ` directly. Copy the closest * working* neighbour , and prefer the
29+ * ** Copy a neighboring target rather than inventing a shape.** Packaging is not uniform: some packages use the
30+ ` codeql_* ` wrappers, others still use ` pkg_files ` directly. Copy the closest * working* neighbor , and prefer the
3131 wrapper for new code.
3232* ** Pin anything fetched over the network** with ` sha256 ` or ` integrity ` . Bazel only * warns* on an unpinned download, so
3333 nothing fails loudly, but the build stops being reproducible and a retagged upstream release silently changes what you
@@ -79,10 +79,11 @@ the platform string here; use `os.bzl`.
7979
8080## Platform selection
8181
82- ` codeql_platform_select ` discriminates the platforms CodeQL knows about: ` linux64 ` , ` linux_arm64 ` , ` osx64 ` and ` win64 ` .
83- ` otherwise ` supplies the value for whichever of those you leave unset; it is ** not** a ` //conditions:default ` . ** There
84- is deliberately no fallback from ` linux_arm64 ` to ` linux64 ` .** If you only care about the OS, use ` os_select ` , which
85- gives Linux the same value on both architectures and has a ` posix ` shorthand for the shared Linux/macOS value.
82+ [ ` codeql_platform_select ` ] ( ../../../misc/bazel/os.bzl ) takes one keyword argument per CodeQL platform: ` linux64 ` ,
83+ ` linux_arm64 ` , ` osx64 ` and ` win64 ` . ` otherwise ` supplies the value for whichever of those you leave unset; it is ** not**
84+ a ` //conditions:default ` . ** There is deliberately no fallback from ` linux_arm64 ` to ` linux64 ` .** If you only care about
85+ the OS, use ` os_select ` , which gives Linux the same value on both architectures and has a ` posix ` shorthand for the
86+ shared Linux/macOS value.
8687
8788In a macro (no ` ctx ` ) it returns a ` select() ` :
8889
@@ -132,7 +133,7 @@ for a minimal complete example and [`pkg.bzl`](../../../misc/bazel/pkg.bzl) for
132133 ` installer_alias = None ` if one package defines several packs.
133134* ` codeql_pack_group ` exists for bundling packs into distribution zips, but nothing in this repo instantiates it.
134135
135- ## Dependencies and ` MODULE.bazel `
136+ ## Adding a dependency
136137
137138In order of preference:
138139
@@ -145,7 +146,8 @@ In order of preference:
145146 keep its checksum field populated.
146147
147148Vendored Rust crates under [ ` misc/bazel/3rdparty ` ] ( ../../../misc/bazel/3rdparty ) are generated. Regenerate with
148- ` update_cargo_deps.sh ` rather than editing, and keep the ` use_repo ` lists in sync (` bazel mod tidy ` handles several).
149+ [ ` update_cargo_deps.sh ` ] ( ../../../misc/bazel/3rdparty/update_cargo_deps.sh ) rather than editing, and keep the
150+ ` use_repo ` lists in sync, which ` bazel mod tidy ` does for module extensions.
149151
150152## Building standalone
151153
0 commit comments