@diff.bzl@diff.bzl//diff:defs.bzl
Public diff.bzl API re-exports
Functions & Macros
cmpRuns cmp (binary diff) between two files and returns the output.
Parameters
*name | The name of the rule |
*file1 | The first file to compare |
*file2 | The second file to compare |
args | Additional arguments to pass to cmp Default: [] |
out | The output file to write the output of cmp to. Defaults to ${name}.out. Default: None |
kwargs | Additional arguments to pass to the underlying rule. |
diffRuns a diff between two files and return a patch.
Parameters
*name | The name of the rule |
*file1 | The first file to compare |
*file2 | The second file to compare |
args | Additional arguments to pass to diff Default: ["--unified"] |
patch | The output file to write the diff to. Defaults to ${name}.patch. Default: None |
kwargs | Additional arguments to pass to the underlying rule |
@diff.bzl@diff.bzl//diff:extensions.bzl
Extensions for bzlmod
Module Extensions
diffutilsModule extension for installing a diffutils toolchain based on prebuilt GNU diffutils
binaries from https://github.com/kormide/diffutils-prebuilt.
Every module can define a toolchain version under the default name, "diffutils".
The latest of those versions will be selected (the rest discarded),
and will always be registered by diff.bzl.
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.
Tag Classes
toolchain| Attribute | Type | Description |
|---|---|---|
name | name | Base name for generated repositories, allowing more than one diffutils toolchain to be registered. A host toolchain repo is set up using {name} so that hermetically fetched diffutils binaries
Default: "diffutils" |
diffutils_version | string | Explicit version of GNU prebuilt diffutils binaries. Default: "3.12" |
@diff.bzl//diff:defs.bzl
Public diff.bzl API re-exports
Functions & Macros
cmpRuns cmp (binary diff) between two files and returns the output.
Parameters
*name | The name of the rule |
*file1 | The first file to compare |
*file2 | The second file to compare |
args | Additional arguments to pass to cmp Default: [] |
out | The output file to write the output of cmp to. Defaults to ${name}.out. Default: None |
kwargs | Additional arguments to pass to the underlying rule. |
diffRuns a diff between two files and return a patch.
Parameters
*name | The name of the rule |
*file1 | The first file to compare |
*file2 | The second file to compare |
args | Additional arguments to pass to diff Default: ["--unified"] |
patch | The output file to write the diff to. Defaults to ${name}.patch. Default: None |
kwargs | Additional arguments to pass to the underlying rule |
@diff.bzl//diff:extensions.bzl
Extensions for bzlmod
Module Extensions
diffutilsModule extension for installing a diffutils toolchain based on prebuilt GNU diffutils
binaries from https://github.com/kormide/diffutils-prebuilt.
Every module can define a toolchain version under the default name, "diffutils".
The latest of those versions will be selected (the rest discarded),
and will always be registered by diff.bzl.
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.
Tag Classes
toolchain| Attribute | Type | Description |
|---|---|---|
name | name | Base name for generated repositories, allowing more than one diffutils toolchain to be registered. A host toolchain repo is set up using {name} so that hermetically fetched diffutils binaries
Default: "diffutils" |
diffutils_version | string | Explicit version of GNU prebuilt diffutils binaries. Default: "3.12" |
@diff.bzl//diff: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
diffutils_register_toolchainsConvenience macro for users which does typical setup.
- creates a repository for each built-in platform like "diff_linux_amd64"
- creates a repository exposing toolchains for each platform in "diffutils_toolchains"
- registers 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 "diff1_14" |
*diffutils_version | Version of diffutils prebuilt binaries to download |
register | whether to call through to native.register_toolchains. Default: True |
kwargs | passed to each diff_repositories call |
Repository Rules
diffutils_repositoryFetch external tools needed for diffutils toolchain
| Attribute | Type | Description |
|---|---|---|
*name | name | A unique name for this repository. |
*diffutils_version | string | Version of diffutils binaries to download |
*platform | string | Platform to download binaries for |
diffutils_host_alias_repoCreates a diffutils repository with a shorter name meant for the host platform, which contains
a BUILD.bazel file that exports symlinks to the host platform's binaries.
| Attribute | Type | Description |
|---|---|---|
*name | name | A unique name for this repository. |
@diff.bzl//diff:toolchain.bzl
Implement the language-specific toolchain rule.
Rules
diffutils_toolchainDefines a diff toolchain.
For usage see https://docs.bazel.build/versions/main/toolchains.html#defining-toolchains.
Providers
DiffutilsInfoInformation about how to invoke the tool executable
Fields
cmp_bin | diffutils cmp binary |
diff_bin | diffutils diff binary |
diff3_bin | diffutils diff3 binary |
sdiff_bin | diffutils sdiff binary |