You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Consider support for cross-platform tests, i.e. executing a test binary that targets a different platform than the execution platform.
The Zig compiler takes additional arguments --test-cmd and --test-cmd-bin. These define the command-line executed by zig test and are used to inject execution wrappers like qemu or wine to enable executing cross-platform tests. However, Bazel separates test build from test execution and the resulting test binary must be executable on the configured target platform (the compiler toolchain is only compatible with the execution platform).
An approach that would fit better into Bazel might be a separate test (or binary) rule that takes a binary for a different target platform and generates a binary that executes qemu, wine, etc. depending on its own target platform.
zig build-obj
rules_zig should support Zig's build-obj command.
Consider whether this should be its own zig_object rule or a mode of zig_library.
rules_zig should support Zig's fmt command for automated reformatting.
zig ast-check
rules_zig should support Zig's ast-check command.
Consider whether this should be its own rule, an automatic test target, or perhaps a validation action (see relevant bazel-discuss thread).
Handle Zig's global and local cache meaningfully. #87
The global cache may be beneficial to persist and re-use across targets, at least for the same target platform. Perhaps a persistent worker could facilitate this.
Consider whether the local cache should be shared across actions. If not, consider discarding it immediately.
Build targets from a mix of sources and generated sources.
Decide whether the main source may be duplicated across the main and srcs attributes or not and enforce the rule.
Support the new bzlmod dependency manager.
Separate tests out into a separate testing workspace/module. #89
The Bazel Central Registry has only limited capability to run tests for registered Bazel modules. In particular, local modules are very difficult, or impossible to integrate. Therefore, it's generally recommended to keep the tests on the BCR very light.
Compiler toolchain
Define the Zig compiler toolchain
Zig concepts and commands
Define build rules corresponding to Zig concepts and build commands taking the Starlark style guide into account
zig_binary
forzig build-exe
zig_binary
for a single source Zig binary without dependencies #4zig_binary
should support a multi source Zig binary without dependencies #6zig_binary
should support a Zig binary with Zig package dependencies #9zig_binary|library|test
should support a Zig binary with library dependencies (.a
,.so
) #15zig_binary|library|test
should support other source inputs supported byzig build-exe
#80(
.o
,.obj
,.a
,.lib
,.so
,.dll
,.dylib
,.s
,.c
, etc.)zigopts
attribute. #83@embedFile
. #93zig_package
forzig ... --pkg-begin ... -pkg-end
zig_package
to bundle Zig sources into a Zig package. #8zig_library
forzig build-lib
zig_library
to generate a static C library (.a
,.lib
) #13zig_library
should be a valid dependency for cc-rules likecc_library
. #14zig_library
should support generating a dynamic C library #16zig_test
zig_test
rule to build and execute Zig test-suites. #18Note,
zig test
builds and executes Zig tests all in one by default. Use the flags--test-no-exec -femit-bin=...
to just build a test-executable.The Zig compiler takes additional arguments
--test-cmd
and--test-cmd-bin
. These define the command-line executed byzig test
and are used to inject execution wrappers likeqemu
orwine
to enable executing cross-platform tests. However, Bazel separates test build from test execution and the resulting test binary must be executable on the configured target platform (the compiler toolchain is only compatible with the execution platform).An approach that would fit better into Bazel might be a separate test (or binary) rule that takes a binary for a different target platform and generates a binary that executes
qemu
,wine
, etc. depending on its own target platform.zig build-obj
rules_zig
should support Zig'sbuild-obj
command.Consider whether this should be its own
zig_object
rule or a mode ofzig_library
.zig fmt
rules_zig
should support Zig'sfmt
command for formatting tests.Consider whether this should be its own rule, an automatic test target, a validation action (see relevant bazel-discuss thread, or perhaps an apple_rules_lint integration.
rules_zig
should support Zig'sfmt
command for automated reformatting.zig ast-check
rules_zig
should support Zig'sast-check
command.Consider whether this should be its own rule, an automatic test target, or perhaps a validation action (see relevant bazel-discuss thread).
--compilation_mode
#38zig build
for third-party dependencies #231zigmod is a community maintained package manager, pending package manager integration into the Zig compiler itself. Aquila is a package index for it. The package metadata format is specified here.
The global cache may be beneficial to persist and re-use across targets, at least for the same target platform. Perhaps a persistent worker could facilitate this.
Consider whether the local cache should be shared across actions. If not, consider discarding it immediately.
Bazel concepts
zigopts
orcopts
. #84rules_cc
interop.zig_library
should be a valid dependency for cc-rules likecc_library
. #14Either using a remote execution service, or the remote worker.
Or consider using sandboxfs.
main
andsrcs
attributes or not and enforce the rule.bzlmod
dependency manager.The Bazel Central Registry has only limited capability to run tests for registered Bazel modules. In particular, local modules are very difficult, or impossible to integrate. Therefore, it's generally recommended to keep the tests on the BCR very light.
MODULE.bazel
files and run all tests withbzlmod
enabled. #88Meta
The text was updated successfully, but these errors were encountered: