# rules_d **Repository Path**: mirrors_benjaminp/rules_d ## Basic Information - **Project Name**: rules_d - **Description**: D rules for Bazel - **Primary Language**: Unknown - **License**: Apache-2.0 - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2020-10-29 - **Last Updated**: 2025-07-16 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README [](https://buildkite.com/bazel/rules-d) # D rules ## Status We make sure this repository works with the latest version of Bazel, but no other development is planned. Volunteers are welcome. If you want to use the rules, consider contributing to this repository and becoming a maintainer. ## Rules
## Setup To use the D rules, add the following to your `WORKSPACE` file to add the external repositories for the D toolchain: ```python load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") http_archive( name = "io_bazel_rules_d", urls = ["https://github.com/bazelbuild/rules_d/archive/bcf137e3c9381545ce54715632bc1d31c51ee4da.tar.gz"], sha256 = "a32847bf2ae634563dece49c4dc8353956b64ba5c2d01ce811ea243e1a21b5b7", strip_prefix = "rules_d-bcf137e3c9381545ce54715632bc1d31c51ee4da", ) load("@io_bazel_rules_d//d:d.bzl", "d_repositories") d_repositories() ``` ## Roadmap * Generate documentation using [`ddox`](https://github.com/rejectedsoftware/ddox) for `d_docs` rule. * Support for other options as defined in the [Dub package format](http://code.dlang.org/package-format?lang=json) * Support for specifying different configurations of a library, closer to [Dub's model for configurations](http://code.dlang.org/package-format?lang=json#configurations) * Workspace rule for retrieving dependencies from [Dub](http://code.dlang.org/) ## d_library ```python d_library(name, srcs, deps, includes, linkopts, versions) ```Attributes | |
---|---|
name |
Name, required
A unique name for this rule. This name will be used as the name of the library built by this rule. |
srcs |
List of labels, required
List of D |
deps |
List of labels, optional
List of libraries to be linked to this library target.
These can either be other |
imports |
List of strings, optional
List of import dirs to add to the compile line.
These will be passed to the D compiler via |
linkopts |
List of strings, optional
List of flags that are added to the D linker command.
These will be passed to the D compiler via |
versions |
List of strings, optional
List of versions to be defined during compilation.
Versions are used for conditional compilation and are enabled in the
code using |
Attributes | |
---|---|
name |
Name, required
A unique name for this rule. |
srcs |
List of labels, required
List of D |
deps |
List of labels, optional
List of library targets depended on by this target.
These can either be other |
imports |
List of strings, optional
List of import dirs to add to the compile line.
These will be passed to the D compiler via |
linkopts |
List of strings, optional
List of flags that are added to the D linker command.
These will be passed to the D compiler via |
versions |
List of strings, optional
List of version flags to be defined during compilation.
Versions are used for conditional compilation and are enabled in the
code using |
Attributes | |
---|---|
name |
Name, required
A unique name for this rule. This name will be used as the name of the binary built by this rule. |
srcs |
List of labels, required
List of D |
deps |
List of labels, optional
List of libraries to be linked to this binary target.
These can either be other |
imports |
List of strings, optional
List of import dirs to add to the compile line.
These will be passed to the D compiler via |
linkopts |
List of strings, optional
List of flags that are added to the D linker command.
These will be passed to the D compiler via |
versions |
List of strings, optional
List of versions to be defined during compilation.
Versions are used for conditional compilation and are enabled in the
code using |
Attributes | |
---|---|
name |
Name, required
A unique name for this rule. This name will be used as the name of the test built by this rule. |
srcs |
List of labels, required
List of D |
deps |
List of labels, optional
List of libraries to be linked to this test target.
These can either be other |
imports |
List of strings, optional
List of import dirs to add to the compile line.
These will be passed to the D compiler via |
linkopts |
List of strings, optional
List of flags that are added to the D linker command.
These will be passed to the D compiler via |
versions |
List of strings, optional
List of versions to be defined during compilation.
Versions are used for conditional compilation and are enabled in the
code using |
Attributes | |
---|---|
name |
Name, required
A unique name for this rule. |
dep |
Label, required
The label of the target to generate code documentation for.
|