@rules_d//d:defs.bzl
Public API of D rules.
Rules
d_binary| Attribute | Type | Description |
|---|---|---|
*name | name | A unique name for this target. |
srcs | list of labels | List of D '.d' or '.di' source files. Default: [] |
deps | list of labels | List of dependencies. Default: [] |
dopts | list of strings | Compiler flags. Default: [] |
imports | list of strings | List of import paths. Default: [] |
linkopts | list of strings | Linker flags passed via -L flags. Default: [] |
string_imports | list of strings | List of string import paths. Default: [] |
string_srcs | list of labels | List of string import source files. Default: [] |
versions | list of strings | List of version identifiers. Default: [] |
env | dictionary: String → String | Environment variables for the binary at runtime. Subject of location and make variable expansion. Default: {} |
data | list of labels | List of files to be made available at runtime. Default: [] |
d_library| Attribute | Type | Description |
|---|---|---|
*name | name | A unique name for this target. |
srcs | list of labels | List of D '.d' or '.di' source files. Default: [] |
deps | list of labels | List of dependencies. Default: [] |
dopts | list of strings | Compiler flags. Default: [] |
imports | list of strings | List of import paths. Default: [] |
linkopts | list of strings | Linker flags passed via -L flags. Default: [] |
string_imports | list of strings | List of string import paths. Default: [] |
string_srcs | list of labels | List of string import source files. Default: [] |
versions | list of strings | List of version identifiers. Default: [] |
source_only | boolean | If true, the source files are compiled, but not library is produced. Default: False |
d_test| Attribute | Type | Description |
|---|---|---|
*name | name | A unique name for this target. |
srcs | list of labels | List of D '.d' or '.di' source files. Default: [] |
deps | list of labels | List of dependencies. Default: [] |
dopts | list of strings | Compiler flags. Default: [] |
imports | list of strings | List of import paths. Default: [] |
linkopts | list of strings | Linker flags passed via -L flags. Default: [] |
string_imports | list of strings | List of string import paths. Default: [] |
string_srcs | list of labels | List of string import source files. Default: [] |
versions | list of strings | List of version identifiers. Default: [] |
env | dictionary: String → String | Environment variables for the binary at runtime. Subject of location and make variable expansion. Default: {} |
data | list of labels | List of files to be made available at runtime. Default: [] |
@rules_d//d:extensions.bzl
Extensions for bzlmod.
Installs a d toolchain.
Every module can define a toolchain version under the default name, "d".
The latest of those versions will be selected (the rest discarded),
and will always be registered by rules_d.
Additionally, the root module can define arbitrarily many more toolchain versions under different
names (the latest version will be picked for each name) and can register them as it sees fit,
effectively overriding the default named toolchain due to toolchain resolution precedence.
Module Extensions
dTag Classes
toolchain| Attribute | Type | Description |
|---|---|---|
name | name | Base name for generated repositories, allowing more than one d toolchain to be registered. Default: "d" |
*d_version | string | Version of the compiler. "auto" will select latest known dmd or ldc compiler available for |
@rules_d//d:repositories.bzl
Declare runtime dependencies
These are needed for local dev, and users must install them as well.
See https://docs.bazel.build/versions/main/skylark/deploying.html#dependencies
Functions & Macros
http_archiveParameters
*name | |
kwargs |
rules_d_dependenciesd_register_toolchainsConvenience macro for users which does typical setup.
- create a repository for each built-in platform like "d_linux_amd64"
- TODO: create a convenience repository for the host platform like "d_host"
- create a repository exposing toolchains for each platform like "d_platforms"
- register a toolchain pointing at each platform
Users can avoid this macro and do these steps themselves, if they want more control.
Parameters
*name | base name for all created repos, like "d1_14" |
register | whether to call through to native.register_toolchains. Default: True |
kwargs | passed to each d_repositories call |
Repository Rules
d_repositoriesFetch external tools needed for d toolchain
| Attribute | Type | Description |
|---|---|---|
*name | name | A unique name for this repository. |
repo_mapping | dictionary: String → String | In For example, an entry This attribute is not supported in |
*d_version | string | |
*platform | string |
@rules_d//d:toolchain.bzl
This module implements the D toolchain rule.
Rules
d_toolchainDefines a d compiler/runtime toolchain.
For usage see https://docs.bazel.build/versions/main/toolchains.html#defining-toolchains.
| Attribute | Type | Description |
|---|---|---|
*name | name | A unique name for this target. |
compiler_flags | list of strings | Compiler flags. Default: [] |
*d_compiler | label | The D compiler. |
dub_tool | label | The dub package manager. Default: None |
linker_flags | list of strings | Linker flags. Default: [] |
rdmd_tool | label | The rdmd compile and execute utility. Default: None |
Providers
DToolchainInfoD compiler information.
Fields
compiler_flags | Default compiler flags. |
d_compiler | The D compiler executable. |
dub_tool | The dub package manager executable. |
linker_flags | Default linker flags. |
rdmd_tool | The rdmd compile and execute utility. |