generated from bazel-contrib/rules-template
-
Notifications
You must be signed in to change notification settings - Fork 5
Open
Description
Compiler toolchain
Define the Zig compiler toolchain
- Download and register the latest Zig release for Linux #2
- Download and register any supported Zig release for all supported platforms #72
- Support Zig nightly releases. #76
- Support MacOS as host&exec platform #23
- Support a globally installed Zig compiler toolchain. #70
- Support a Nix provided Zig compiler toolchain. #71
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
- Define
zig_binary
for a single source Zig binary without dependencies #4 -
zig_binary
should support a multi source Zig binary without dependencies #6 -
zig_binary
should support a Zig binary with Zig package dependencies #9 -
zig_binary|library|test
should support a Zig binary with library dependencies (.a
,.so
) #15 -
zig_binary|library|test
should support other source inputs supported byzig build-exe
#80
(.o
,.obj
,.a
,.lib
,.so
,.dll
,.dylib
,.s
,.c
, etc.) - Support arbitrary Zig compiler flags through a
zigopts
attribute. #83 - Support extra source files / build inputs, e.g. for
@embedFile
. #93
- Define
zig_package
forzig ... --pkg-begin ... -pkg-end
zig_library
forzig build-lib
zig_test
- Add
zig_test
rule to build and execute Zig test-suites. #18
Note,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. - 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 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 executesqemu
,wine
, etc. depending on its own target platform.
- Add
zig build-obj
-
rules_zig
should support Zig'sbuild-obj
command.
Consider whether this should be its ownzig_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).
-
- Support build options
- Support Zig build modes #34
- Distinguish target and exec configuration for build mode #37
- Default to build mode following
--compilation_mode
#38 - Support single threaded builds #44
- Support custom linker scripts #46
- Support cross-compilation for minimal set of targets #48
- Support cross-compilation for all relevant targets #51
- See cross-compilation and supported targets.
- Support libc selection #54
- Support generating documentation #221
- Support build mode, target platform, libc, etc. selection per build target #39
- Support platform specific build options. #100
- Set or expose Zig's root-name (--name) parameter #82
- Third party dependencies
- Support
zig build
for third-party dependencies #231 - Consider package manager integration for Zig. #232
zigmod 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.
- Support
- Documentation
- Provide a minimal description in the README. #56
- Ensure that the generated API reference documentation is complete. #57
- Create a small, instructive example. #58
- Write a brief motivation in the README. #63
- Refer to releases in the bzlmod and WORKSPACE installation instructions. #139
- Add a user-guide. #59
- Generate Stardoc documentation for providers #64
- Generate Stardoc documentation for internal rules and utilities #65
- 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.
Bazel concepts
- Bazel runfiles support
- Support
rules_cc
interop. - Test remote execution and tightly sandboxed builds chore!: enable remote execution on CI for Linux #296
Either using a remote execution service, or the remote worker.
Or consider using sandboxfs. - Build targets from a mix of sources and generated sources.
- Decide whether the main source may be duplicated across the
main
andsrcs
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. - Define bzlmod
MODULE.bazel
files and run all tests withbzlmod
enabled. #88 - Configure and install the release to BCR app. #140
- Provide a Bazel registry entry. #90
- Separate tests out into a separate testing workspace/module. #89
Meta
GZGavinZhao, TheGrizzlyDev, vctrmn, turmanticant, xinzhengzhang and 2 more
Metadata
Metadata
Assignees
Labels
No labels