2
0
Fork 0
mirror of https://github.com/bazelbuild/bazel-skylib synced 2024-11-27 05:43:25 +00:00

Update internal dependencies to modern versions. Bazel Federation repo is deprecated. (#327)

See https://github.com/bazelbuild/bazel-federation/pull/127

In particular, this allows us to use a modern Stardoc release to fix generated md docs.

And we can remove internal_deps.bzl/internal_setup.bzl - it's unnecessary complexity
needed only for deprecated Federation setup.
This commit is contained in:
Alexandre Rostovtsev 2021-10-27 09:13:59 -04:00 committed by GitHub
parent 8e923ca4b9
commit 6e30a77347
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
24 changed files with 744 additions and 443 deletions

2
BUILD
View file

@ -4,8 +4,6 @@ licenses(["notice"])
package(default_visibility = ["//visibility:public"])
# gazelle:exclude internal_deps.bzl
# gazelle:exclude internal_setup.bzl
# buildifier: disable=skylark-comment
# gazelle:exclude skylark_library.bzl

View file

@ -3,12 +3,47 @@ workspace(name = "bazel_skylib")
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
load("@bazel_tools//tools/build_defs/repo:utils.bzl", "maybe")
http_archive(
name = "rules_pkg",
sha256 = "352c090cc3d3f9a6b4e676cf42a6047c16824959b438895a76c2989c6d7c246a",
maybe(
name = "io_bazel_rules_go",
repo_rule = http_archive,
sha256 = "2b1641428dff9018f9e85c0384f03ec6c10660d935b750e3fa1492a281a53b0f",
urls = [
"https://github.com/bazelbuild/rules_pkg/releases/download/0.2.5/rules_pkg-0.2.5.tar.gz",
"https://mirror.bazel.build/github.com/bazelbuild/rules_pkg/releases/download/0.2.5/rules_pkg-0.2.5.tar.gz",
"https://mirror.bazel.build/github.com/bazelbuild/rules_go/releases/download/v0.29.0/rules_go-v0.29.0.zip",
"https://github.com/bazelbuild/rules_go/releases/download/v0.29.0/rules_go-v0.29.0.zip",
],
)
load("@io_bazel_rules_go//go:deps.bzl", "go_register_toolchains", "go_rules_dependencies")
go_rules_dependencies()
go_register_toolchains(version = "1.17.1")
# Below this line is for documentation generation only,
# and should thus not be included by dependencies on
# bazel-skylib.
maybe(
http_archive,
name = "io_bazel_stardoc",
sha256 = "c9794dcc8026a30ff67cf7cf91ebe245ca294b20b071845d12c192afe243ad72",
urls = [
"https://mirror.bazel.build/github.com/bazelbuild/stardoc/releases/download/0.5.0/stardoc-0.5.0.tar.gz",
"https://github.com/bazelbuild/stardoc/releases/download/0.5.0/stardoc-0.5.0.tar.gz",
],
)
load("@io_bazel_stardoc//:setup.bzl", "stardoc_repositories")
stardoc_repositories()
maybe(
http_archive,
name = "rules_pkg",
sha256 = "a89e203d3cf264e564fcb96b6e06dd70bc0557356eb48400ce4b5d97c2c3720d",
urls = [
"https://mirror.bazel.build/github.com/bazelbuild/rules_pkg/releases/download/0.5.1/rules_pkg-0.5.1.tar.gz",
"https://github.com/bazelbuild/rules_pkg/releases/download/0.5.1/rules_pkg-0.5.1.tar.gz",
],
)
@ -16,60 +51,30 @@ load("@rules_pkg//:deps.bzl", "rules_pkg_dependencies")
rules_pkg_dependencies()
maybe(
name = "bazel_federation",
repo_rule = http_archive,
sha256 = "b10529fcf8a464591e845588348533981e948315b706183481e0d076afe2fa3c",
url = "https://github.com/bazelbuild/bazel-federation/releases/download/0.0.2/bazel_federation-0.0.2.tar.gz",
)
load("@bazel_federation//:repositories.bzl", "bazel_skylib_deps", "rules_go")
bazel_skylib_deps()
rules_go()
load("@bazel_federation//setup:bazel_skylib.bzl", "bazel_skylib_setup")
bazel_skylib_setup()
load("@bazel_federation//setup:rules_go.bzl", "rules_go_setup")
rules_go_setup()
# Below this line is for documentation generation only,
# and should thus not be included by dependencies on
# bazel-skylib.
load("//:internal_deps.bzl", "bazel_skylib_internal_deps")
bazel_skylib_internal_deps()
load("//:internal_setup.bzl", "bazel_skylib_internal_setup")
bazel_skylib_internal_setup()
maybe(
name = "rules_cc",
repo_rule = http_archive,
sha256 = "b4b2a2078bdb7b8328d843e8de07d7c13c80e6c89e86a09d6c4b424cfd1aaa19",
strip_prefix = "rules_cc-cb2dfba6746bfa3c3705185981f3109f0ae1b893",
sha256 = "4dccbfd22c0def164c8f47458bd50e0c7148f3d92002cdb459c2a96a68498241",
urls = [
"https://mirror.bazel.build/github.com/bazelbuild/rules_cc/archive/cb2dfba6746bfa3c3705185981f3109f0ae1b893.zip",
"https://github.com/bazelbuild/rules_cc/archive/cb2dfba6746bfa3c3705185981f3109f0ae1b893.zip",
"https://mirror.bazel.build/github.com/bazelbuild/rules_cc/releases/download/0.0.1/rules_cc-0.0.1.tar.gz",
"https://github.com/bazelbuild/rules_cc/releases/download/0.0.1/rules_cc-0.0.1.tar.gz",
],
)
load("//lib:unittest.bzl", "register_unittest_toolchains")
register_unittest_toolchains()
# Provide a repository hint for Gazelle to inform it that the go package
# github.com/bazelbuild/rules_go is available from io_bazel_rules_go and it
# doesn't need to duplicatively fetch it.
# gazelle:repository go_repository name=io_bazel_rules_go importpath=github.com/bazelbuild/rules_go
http_archive(
name = "bazel_gazelle",
sha256 = "bfd86b3cbe855d6c16c6fce60d76bd51f5c8dbc9cfcaef7a2bb5c1aafd0710e8",
sha256 = "de69a09dc70417580aabf20a28619bb3ef60d038470c7cf8442fafcf627c21cb",
urls = [
"https://mirror.bazel.build/github.com/bazelbuild/bazel-gazelle/releases/download/v0.21.0/bazel-gazelle-v0.21.0.tar.gz",
"https://github.com/bazelbuild/bazel-gazelle/releases/download/v0.21.0/bazel-gazelle-v0.21.0.tar.gz",
"https://mirror.bazel.build/github.com/bazelbuild/bazel-gazelle/releases/download/v0.24.0/bazel-gazelle-v0.24.0.tar.gz",
"https://github.com/bazelbuild/bazel-gazelle/releases/download/v0.24.0/bazel-gazelle-v0.24.0.tar.gz",
],
)
# Another Gazelle repository hint.

View file

@ -1,4 +1,4 @@
load("@io_bazel_skydoc//stardoc:stardoc.bzl", "stardoc")
load("@io_bazel_stardoc//stardoc:stardoc.bzl", "stardoc")
licenses(["notice"])

View file

@ -1,6 +1,8 @@
<!-- Generated with Stardoc: http://skydoc.bazel.build -->
<a name="#analysis_test"></a>
A test verifying other targets can be successfully analyzed as part of a `bazel test`
<a id="#analysis_test"></a>
## analysis_test
@ -39,8 +41,8 @@ Test rule checking that other targets can be successfully analyzed.
| Name | Description | Type | Mandatory | Default |
| :-------------: | :-------------: | :-------------: | :-------------: | :-------------: |
| name | A unique name for this target. | <a href="https://bazel.build/docs/build-ref.html#name">Name</a> | required | |
| targets | - | <a href="https://bazel.build/docs/build-ref.html#labels">List of labels</a> | required | |
| :------------- | :------------- | :------------- | :------------- | :------------- |
| <a id="analysis_test-name"></a>name | A unique name for this target. | <a href="https://bazel.build/docs/build-ref.html#name">Name</a> | required | |
| <a id="analysis_test-targets"></a>targets | - | <a href="https://bazel.build/docs/build-ref.html#labels">List of labels</a> | required | |

View file

@ -1,6 +1,8 @@
<!-- Generated with Stardoc: http://skydoc.bazel.build -->
<a name="#build_test"></a>
A test verifying other targets build as part of a `bazel test`
<a id="#build_test"></a>
## build_test
@ -31,9 +33,9 @@ Typical usage:
| Name | Description | Default Value |
| :-------------: | :-------------: | :-------------: |
| name | The name of the test rule. | none |
| targets | A list of targets to ensure build. | none |
| kwargs | The &lt;a href="https://docs.bazel.build/versions/main/be/common-definitions.html#common-attributes-tests"&gt;common attributes for tests&lt;/a&gt;. | none |
| :------------- | :------------- | :------------- |
| <a id="build_test-name"></a>name | The name of the test rule. | none |
| <a id="build_test-targets"></a>targets | A list of targets to ensure build. | none |
| <a id="build_test-kwargs"></a>kwargs | The &lt;a href="https://docs.bazel.build/versions/main/be/common-definitions.html#common-attributes-tests"&gt;common attributes for tests&lt;/a&gt;. | none |

View file

@ -1,6 +1,8 @@
<!-- Generated with Stardoc: http://skydoc.bazel.build -->
<a name="#collections.after_each"></a>
Skylib module containing functions that operate on collections.
<a id="#collections.after_each"></a>
## collections.after_each
@ -14,12 +16,16 @@ Inserts `separator` after each item in `iterable`.
| Name | Description | Default Value |
| :-------------: | :-------------: | :-------------: |
| separator | The value to insert after each item in <code>iterable</code>. | none |
| iterable | The list into which to intersperse the separator. | none |
| :------------- | :------------- | :------------- |
| <a id="collections.after_each-separator"></a>separator | The value to insert after each item in <code>iterable</code>. | none |
| <a id="collections.after_each-iterable"></a>iterable | The list into which to intersperse the separator. | none |
**RETURNS**
A new list with `separator` after each item in `iterable`.
<a name="#collections.before_each"></a>
<a id="#collections.before_each"></a>
## collections.before_each
@ -33,12 +39,16 @@ Inserts `separator` before each item in `iterable`.
| Name | Description | Default Value |
| :-------------: | :-------------: | :-------------: |
| separator | The value to insert before each item in <code>iterable</code>. | none |
| iterable | The list into which to intersperse the separator. | none |
| :------------- | :------------- | :------------- |
| <a id="collections.before_each-separator"></a>separator | The value to insert before each item in <code>iterable</code>. | none |
| <a id="collections.before_each-iterable"></a>iterable | The list into which to intersperse the separator. | none |
**RETURNS**
A new list with `separator` before each item in `iterable`.
<a name="#collections.uniq"></a>
<a id="#collections.uniq"></a>
## collections.uniq
@ -55,7 +65,11 @@ Requires all the elements to be hashable.
| Name | Description | Default Value |
| :-------------: | :-------------: | :-------------: |
| iterable | An iterable to filter. | none |
| :------------- | :------------- | :------------- |
| <a id="collections.uniq-iterable"></a>iterable | An iterable to filter. | none |
**RETURNS**
A new list with all unique elements from `iterable`.

View file

@ -1,6 +1,15 @@
<!-- Generated with Stardoc: http://skydoc.bazel.build -->
<a name="#bool_flag"></a>
Common build setting rules
These rules return a BuildSettingInfo with the value of the build setting.
For label-typed settings, use the native label_flag and label_setting rules.
More documentation on how to use build settings at
https://docs.bazel.build/versions/main/skylark/config.html#user-defined-build-settings
<a id="#bool_flag"></a>
## bool_flag
@ -14,11 +23,11 @@ A bool-typed build setting that can be set on the command line
| Name | Description | Type | Mandatory | Default |
| :-------------: | :-------------: | :-------------: | :-------------: | :-------------: |
| name | A unique name for this target. | <a href="https://bazel.build/docs/build-ref.html#name">Name</a> | required | |
| :------------- | :------------- | :------------- | :------------- | :------------- |
| <a id="bool_flag-name"></a>name | A unique name for this target. | <a href="https://bazel.build/docs/build-ref.html#name">Name</a> | required | |
<a name="#bool_setting"></a>
<a id="#bool_setting"></a>
## bool_setting
@ -32,11 +41,11 @@ A bool-typed build setting that cannot be set on the command line
| Name | Description | Type | Mandatory | Default |
| :-------------: | :-------------: | :-------------: | :-------------: | :-------------: |
| name | A unique name for this target. | <a href="https://bazel.build/docs/build-ref.html#name">Name</a> | required | |
| :------------- | :------------- | :------------- | :------------- | :------------- |
| <a id="bool_setting-name"></a>name | A unique name for this target. | <a href="https://bazel.build/docs/build-ref.html#name">Name</a> | required | |
<a name="#int_flag"></a>
<a id="#int_flag"></a>
## int_flag
@ -50,11 +59,11 @@ An int-typed build setting that can be set on the command line
| Name | Description | Type | Mandatory | Default |
| :-------------: | :-------------: | :-------------: | :-------------: | :-------------: |
| name | A unique name for this target. | <a href="https://bazel.build/docs/build-ref.html#name">Name</a> | required | |
| :------------- | :------------- | :------------- | :------------- | :------------- |
| <a id="int_flag-name"></a>name | A unique name for this target. | <a href="https://bazel.build/docs/build-ref.html#name">Name</a> | required | |
<a name="#int_setting"></a>
<a id="#int_setting"></a>
## int_setting
@ -68,11 +77,11 @@ An int-typed build setting that cannot be set on the command line
| Name | Description | Type | Mandatory | Default |
| :-------------: | :-------------: | :-------------: | :-------------: | :-------------: |
| name | A unique name for this target. | <a href="https://bazel.build/docs/build-ref.html#name">Name</a> | required | |
| :------------- | :------------- | :------------- | :------------- | :------------- |
| <a id="int_setting-name"></a>name | A unique name for this target. | <a href="https://bazel.build/docs/build-ref.html#name">Name</a> | required | |
<a name="#string_flag"></a>
<a id="#string_flag"></a>
## string_flag
@ -86,12 +95,12 @@ A string-typed build setting that can be set on the command line
| Name | Description | Type | Mandatory | Default |
| :-------------: | :-------------: | :-------------: | :-------------: | :-------------: |
| name | A unique name for this target. | <a href="https://bazel.build/docs/build-ref.html#name">Name</a> | required | |
| values | The list of allowed values for this setting. An error is raised if any other value is given. | List of strings | optional | [] |
| :------------- | :------------- | :------------- | :------------- | :------------- |
| <a id="string_flag-name"></a>name | A unique name for this target. | <a href="https://bazel.build/docs/build-ref.html#name">Name</a> | required | |
| <a id="string_flag-values"></a>values | The list of allowed values for this setting. An error is raised if any other value is given. | List of strings | optional | [] |
<a name="#string_list_flag"></a>
<a id="#string_list_flag"></a>
## string_list_flag
@ -105,11 +114,11 @@ A string list-typed build setting that can be set on the command line
| Name | Description | Type | Mandatory | Default |
| :-------------: | :-------------: | :-------------: | :-------------: | :-------------: |
| name | A unique name for this target. | <a href="https://bazel.build/docs/build-ref.html#name">Name</a> | required | |
| :------------- | :------------- | :------------- | :------------- | :------------- |
| <a id="string_list_flag-name"></a>name | A unique name for this target. | <a href="https://bazel.build/docs/build-ref.html#name">Name</a> | required | |
<a name="#string_list_setting"></a>
<a id="#string_list_setting"></a>
## string_list_setting
@ -123,11 +132,11 @@ A string list-typed build setting that cannot be set on the command line
| Name | Description | Type | Mandatory | Default |
| :-------------: | :-------------: | :-------------: | :-------------: | :-------------: |
| name | A unique name for this target. | <a href="https://bazel.build/docs/build-ref.html#name">Name</a> | required | |
| :------------- | :------------- | :------------- | :------------- | :------------- |
| <a id="string_list_setting-name"></a>name | A unique name for this target. | <a href="https://bazel.build/docs/build-ref.html#name">Name</a> | required | |
<a name="#string_setting"></a>
<a id="#string_setting"></a>
## string_setting
@ -141,12 +150,12 @@ A string-typed build setting that cannot be set on the command line
| Name | Description | Type | Mandatory | Default |
| :-------------: | :-------------: | :-------------: | :-------------: | :-------------: |
| name | A unique name for this target. | <a href="https://bazel.build/docs/build-ref.html#name">Name</a> | required | |
| values | The list of allowed values for this setting. An error is raised if any other value is given. | List of strings | optional | [] |
| :------------- | :------------- | :------------- | :------------- | :------------- |
| <a id="string_setting-name"></a>name | A unique name for this target. | <a href="https://bazel.build/docs/build-ref.html#name">Name</a> | required | |
| <a id="string_setting-values"></a>values | The list of allowed values for this setting. An error is raised if any other value is given. | List of strings | optional | [] |
<a name="#BuildSettingInfo"></a>
<a id="#BuildSettingInfo"></a>
## BuildSettingInfo
@ -160,7 +169,7 @@ A singleton provider that contains the raw value of a build setting
| Name | Description |
| :-------------: | :-------------: |
| value | The value of the build setting in the current configuration. This value may come from the command line or an upstream transition, or else it will be the build setting's default. |
| :------------- | :------------- |
| <a id="BuildSettingInfo-value"></a>value | The value of the build setting in the current configuration. This value may come from the command line or an upstream transition, or else it will be the build setting's default. |

View file

@ -1,6 +1,15 @@
<!-- Generated with Stardoc: http://skydoc.bazel.build -->
<a name="#copy_file"></a>
A rule that copies a file to another place.
native.genrule() is sometimes used to copy files (often wishing to rename them).
The 'copy_file' rule does this with a simpler interface than genrule.
The rule uses a Bash command on Linux/macOS/non-Windows, and a cmd.exe command
on Windows (no Bash is required).
<a id="#copy_file"></a>
## copy_file
@ -19,12 +28,12 @@ This rule uses a Bash command on Linux/macOS/non-Windows, and a cmd.exe command
| Name | Description | Default Value |
| :-------------: | :-------------: | :-------------: |
| name | Name of the rule. | none |
| src | A Label. The file to make a copy of. (Can also be the label of a rule that generates a file.) | none |
| out | Path of the output file, relative to this package. | none |
| is_executable | A boolean. Whether to make the output file executable. When True, the rule's output can be executed using <code>bazel run</code> and can be in the srcs of binary and test rules that require executable sources. WARNING: If <code>allow_symlink</code> is True, <code>src</code> must also be executable. | <code>False</code> |
| allow_symlink | A boolean. Whether to allow symlinking instead of copying. When False, the output is always a hard copy. When True, the output *can* be a symlink, but there is no guarantee that a symlink is created (i.e., at the time of writing, we don't create symlinks on Windows). Set this to True if you need fast copying and your tools can handle symlinks (which most UNIX tools can). | <code>False</code> |
| kwargs | further keyword arguments, e.g. <code>visibility</code> | none |
| :------------- | :------------- | :------------- |
| <a id="copy_file-name"></a>name | Name of the rule. | none |
| <a id="copy_file-src"></a>src | A Label. The file to make a copy of. (Can also be the label of a rule that generates a file.) | none |
| <a id="copy_file-out"></a>out | Path of the output file, relative to this package. | none |
| <a id="copy_file-is_executable"></a>is_executable | A boolean. Whether to make the output file executable. When True, the rule's output can be executed using <code>bazel run</code> and can be in the srcs of binary and test rules that require executable sources. WARNING: If <code>allow_symlink</code> is True, <code>src</code> must also be executable. | <code>False</code> |
| <a id="copy_file-allow_symlink"></a>allow_symlink | A boolean. Whether to allow symlinking instead of copying. When False, the output is always a hard copy. When True, the output *can* be a symlink, but there is no guarantee that a symlink is created (i.e., at the time of writing, we don't create symlinks on Windows). Set this to True if you need fast copying and your tools can handle symlinks (which most UNIX tools can). | <code>False</code> |
| <a id="copy_file-kwargs"></a>kwargs | further keyword arguments, e.g. <code>visibility</code> | none |

View file

@ -1,6 +1,8 @@
<!-- Generated with Stardoc: http://skydoc.bazel.build -->
<a name="#dicts.add"></a>
Skylib module containing functions that operate on dictionaries.
<a id="#dicts.add"></a>
## dicts.add
@ -23,8 +25,12 @@ dictionary, and the sum of a single dictionary is a copy of itself.
| Name | Description | Default Value |
| :-------------: | :-------------: | :-------------: |
| dictionaries | Zero or more dictionaries to be added. | none |
| kwargs | Additional dictionary passed as keyword args. | none |
| :------------- | :------------- | :------------- |
| <a id="dicts.add-dictionaries"></a>dictionaries | Zero or more dictionaries to be added. | none |
| <a id="dicts.add-kwargs"></a>kwargs | Additional dictionary passed as keyword args. | none |
**RETURNS**
A new `dict` that has all the entries of the given dictionaries.

View file

@ -1,6 +1,12 @@
<!-- Generated with Stardoc: http://skydoc.bazel.build -->
<a name="#diff_test"></a>
A test rule that compares two binary files.
The rule uses a Bash command (diff) on Linux/macOS/non-Windows, and a cmd.exe
command (fc.exe) on Windows (no Bash is required).
<a id="#diff_test"></a>
## diff_test
@ -17,10 +23,10 @@ The test succeeds if the files' contents match.
| Name | Description | Default Value |
| :-------------: | :-------------: | :-------------: |
| name | The name of the test rule. | none |
| file1 | Label of the file to compare to &lt;code&gt;file2&lt;/code&gt;. | none |
| file2 | Label of the file to compare to &lt;code&gt;file1&lt;/code&gt;. | none |
| kwargs | The &lt;a href="https://docs.bazel.build/versions/main/be/common-definitions.html#common-attributes-tests"&gt;common attributes for tests&lt;/a&gt;. | none |
| :------------- | :------------- | :------------- |
| <a id="diff_test-name"></a>name | The name of the test rule. | none |
| <a id="diff_test-file1"></a>file1 | Label of the file to compare to &lt;code&gt;file2&lt;/code&gt;. | none |
| <a id="diff_test-file2"></a>file2 | Label of the file to compare to &lt;code&gt;file1&lt;/code&gt;. | none |
| <a id="diff_test-kwargs"></a>kwargs | The &lt;a href="https://docs.bazel.build/versions/main/be/common-definitions.html#common-attributes-tests"&gt;common attributes for tests&lt;/a&gt;. | none |

View file

@ -1,6 +1,14 @@
<!-- Generated with Stardoc: http://skydoc.bazel.build -->
<a name="#native_binary"></a>
native_binary() and native_test() rule implementations.
These rules let you wrap a pre-built binary or script in a conventional binary
and test rule respectively. They fulfill the same goal as sh_binary and sh_test
do, but they run the wrapped binary directly, instead of through Bash, so they
don't depend on Bash and work with --shell_exectuable="".
<a id="#native_binary"></a>
## native_binary
@ -17,15 +25,15 @@ You can "bazel run" this rule like any other binary rule, and use it as a tool i
| Name | Description | Default Value |
| :-------------: | :-------------: | :-------------: |
| name | The name of the test rule. | none |
| src | label; path of the pre-built executable | none |
| out | output; an output name for the copy of the binary. (Bazel requires that this rule make a copy of 'src'.) | none |
| data | list of labels; data dependencies | <code>None</code> |
| kwargs | The &lt;a href="https://docs.bazel.build/versions/main/be/common-definitions.html#common-attributes-binaries"&gt;common attributes for binaries&lt;/a&gt;. | none |
| :------------- | :------------- | :------------- |
| <a id="native_binary-name"></a>name | The name of the test rule. | none |
| <a id="native_binary-src"></a>src | label; path of the pre-built executable | none |
| <a id="native_binary-out"></a>out | output; an output name for the copy of the binary. (Bazel requires that this rule make a copy of 'src'.) | none |
| <a id="native_binary-data"></a>data | list of labels; data dependencies | <code>None</code> |
| <a id="native_binary-kwargs"></a>kwargs | The &lt;a href="https://docs.bazel.build/versions/main/be/common-definitions.html#common-attributes-binaries"&gt;common attributes for binaries&lt;/a&gt;. | none |
<a name="#native_test"></a>
<a id="#native_test"></a>
## native_test
@ -43,11 +51,11 @@ runfiles.
| Name | Description | Default Value |
| :-------------: | :-------------: | :-------------: |
| name | The name of the test rule. | none |
| src | label; path of the pre-built executable | none |
| out | output; an output name for the copy of the binary. (Bazel requires that this rule make a copy of 'src'.) | none |
| data | list of labels; data dependencies | <code>None</code> |
| kwargs | The &lt;a href="https://docs.bazel.build/versions/main/be/common-definitions.html#common-attributes-tests"&gt;common attributes for tests&lt;/a&gt;. | none |
| :------------- | :------------- | :------------- |
| <a id="native_test-name"></a>name | The name of the test rule. | none |
| <a id="native_test-src"></a>src | label; path of the pre-built executable | none |
| <a id="native_test-out"></a>out | output; an output name for the copy of the binary. (Bazel requires that this rule make a copy of 'src'.) | none |
| <a id="native_test-data"></a>data | list of labels; data dependencies | <code>None</code> |
| <a id="native_test-kwargs"></a>kwargs | The &lt;a href="https://docs.bazel.build/versions/main/be/common-definitions.html#common-attributes-tests"&gt;common attributes for tests&lt;/a&gt;. | none |

View file

@ -1,6 +1,17 @@
<!-- Generated with Stardoc: http://skydoc.bazel.build -->
<a name="#sets.make"></a>
Skylib module containing common hash-set algorithms.
An empty set can be created using: `sets.make()`, or it can be created with some starting values
if you pass it an sequence: `sets.make([1, 2, 3])`. This returns a struct containing all of the
values as keys in a dictionary - this means that all passed in values must be hashable. The
values in the set can be retrieved using `sets.to_list(my_set)`.
An arbitrary object can be tested whether it is a set generated by `sets.make()` or not with the
`types.is_set()` method in types.bzl.
<a id="#sets.make"></a>
## sets.make
@ -17,11 +28,15 @@ All elements must be hashable.
| Name | Description | Default Value |
| :-------------: | :-------------: | :-------------: |
| elements | Optional sequence to construct the set out of. | <code>None</code> |
| :------------- | :------------- | :------------- |
| <a id="sets.make-elements"></a>elements | Optional sequence to construct the set out of. | <code>None</code> |
**RETURNS**
A set containing the passed in values.
<a name="#sets.copy"></a>
<a id="#sets.copy"></a>
## sets.copy
@ -35,11 +50,15 @@ Creates a new set from another set.
| Name | Description | Default Value |
| :-------------: | :-------------: | :-------------: |
| s | A set, as returned by <code>sets.make()</code>. | none |
| :------------- | :------------- | :------------- |
| <a id="sets.copy-s"></a>s | A set, as returned by <code>sets.make()</code>. | none |
**RETURNS**
A new set containing the same elements as `s`.
<a name="#sets.to_list"></a>
<a id="#sets.to_list"></a>
## sets.to_list
@ -53,11 +72,15 @@ Creates a list from the values in the set.
| Name | Description | Default Value |
| :-------------: | :-------------: | :-------------: |
| s | A set, as returned by <code>sets.make()</code>. | none |
| :------------- | :------------- | :------------- |
| <a id="sets.to_list-s"></a>s | A set, as returned by <code>sets.make()</code>. | none |
**RETURNS**
A list of values inserted into the set.
<a name="#sets.insert"></a>
<a id="#sets.insert"></a>
## sets.insert
@ -74,12 +97,16 @@ Element must be hashable. This mutates the original set.
| Name | Description | Default Value |
| :-------------: | :-------------: | :-------------: |
| s | A set, as returned by <code>sets.make()</code>. | none |
| e | The element to be inserted. | none |
| :------------- | :------------- | :------------- |
| <a id="sets.insert-s"></a>s | A set, as returned by <code>sets.make()</code>. | none |
| <a id="sets.insert-e"></a>e | The element to be inserted. | none |
**RETURNS**
The set `s` with `e` included.
<a name="#sets.contains"></a>
<a id="#sets.contains"></a>
## sets.contains
@ -93,12 +120,16 @@ Checks for the existence of an element in a set.
| Name | Description | Default Value |
| :-------------: | :-------------: | :-------------: |
| a | A set, as returned by <code>sets.make()</code>. | none |
| e | The element to look for. | none |
| :------------- | :------------- | :------------- |
| <a id="sets.contains-a"></a>a | A set, as returned by <code>sets.make()</code>. | none |
| <a id="sets.contains-e"></a>e | The element to look for. | none |
**RETURNS**
True if the element exists in the set, False if the element does not.
<a name="#sets.is_equal"></a>
<a id="#sets.is_equal"></a>
## sets.is_equal
@ -112,12 +143,16 @@ Returns whether two sets are equal.
| Name | Description | Default Value |
| :-------------: | :-------------: | :-------------: |
| a | A set, as returned by <code>sets.make()</code>. | none |
| b | A set, as returned by <code>sets.make()</code>. | none |
| :------------- | :------------- | :------------- |
| <a id="sets.is_equal-a"></a>a | A set, as returned by <code>sets.make()</code>. | none |
| <a id="sets.is_equal-b"></a>b | A set, as returned by <code>sets.make()</code>. | none |
**RETURNS**
True if `a` is equal to `b`, False otherwise.
<a name="#sets.is_subset"></a>
<a id="#sets.is_subset"></a>
## sets.is_subset
@ -131,12 +166,16 @@ Returns whether `a` is a subset of `b`.
| Name | Description | Default Value |
| :-------------: | :-------------: | :-------------: |
| a | A set, as returned by <code>sets.make()</code>. | none |
| b | A set, as returned by <code>sets.make()</code>. | none |
| :------------- | :------------- | :------------- |
| <a id="sets.is_subset-a"></a>a | A set, as returned by <code>sets.make()</code>. | none |
| <a id="sets.is_subset-b"></a>b | A set, as returned by <code>sets.make()</code>. | none |
**RETURNS**
True if `a` is a subset of `b`, False otherwise.
<a name="#sets.disjoint"></a>
<a id="#sets.disjoint"></a>
## sets.disjoint
@ -153,12 +192,16 @@ Two sets are disjoint if they have no elements in common.
| Name | Description | Default Value |
| :-------------: | :-------------: | :-------------: |
| a | A set, as returned by <code>sets.make()</code>. | none |
| b | A set, as returned by <code>sets.make()</code>. | none |
| :------------- | :------------- | :------------- |
| <a id="sets.disjoint-a"></a>a | A set, as returned by <code>sets.make()</code>. | none |
| <a id="sets.disjoint-b"></a>b | A set, as returned by <code>sets.make()</code>. | none |
**RETURNS**
True if `a` and `b` are disjoint, False otherwise.
<a name="#sets.intersection"></a>
<a id="#sets.intersection"></a>
## sets.intersection
@ -172,12 +215,16 @@ Returns the intersection of two sets.
| Name | Description | Default Value |
| :-------------: | :-------------: | :-------------: |
| a | A set, as returned by <code>sets.make()</code>. | none |
| b | A set, as returned by <code>sets.make()</code>. | none |
| :------------- | :------------- | :------------- |
| <a id="sets.intersection-a"></a>a | A set, as returned by <code>sets.make()</code>. | none |
| <a id="sets.intersection-b"></a>b | A set, as returned by <code>sets.make()</code>. | none |
**RETURNS**
A set containing the elements that are in both `a` and `b`.
<a name="#sets.union"></a>
<a id="#sets.union"></a>
## sets.union
@ -191,11 +238,15 @@ Returns the union of several sets.
| Name | Description | Default Value |
| :-------------: | :-------------: | :-------------: |
| args | An arbitrary number of sets. | none |
| :------------- | :------------- | :------------- |
| <a id="sets.union-args"></a>args | An arbitrary number of sets. | none |
**RETURNS**
The set union of all sets in `*args`.
<a name="#sets.difference"></a>
<a id="#sets.difference"></a>
## sets.difference
@ -209,12 +260,16 @@ Returns the elements in `a` that are not in `b`.
| Name | Description | Default Value |
| :-------------: | :-------------: | :-------------: |
| a | A set, as returned by <code>sets.make()</code>. | none |
| b | A set, as returned by <code>sets.make()</code>. | none |
| :------------- | :------------- | :------------- |
| <a id="sets.difference-a"></a>a | A set, as returned by <code>sets.make()</code>. | none |
| <a id="sets.difference-b"></a>b | A set, as returned by <code>sets.make()</code>. | none |
**RETURNS**
A set containing the elements that are in `a` but not in `b`.
<a name="#sets.length"></a>
<a id="#sets.length"></a>
## sets.length
@ -228,11 +283,15 @@ Returns the number of elements in a set.
| Name | Description | Default Value |
| :-------------: | :-------------: | :-------------: |
| s | A set, as returned by <code>sets.make()</code>. | none |
| :------------- | :------------- | :------------- |
| <a id="sets.length-s"></a>s | A set, as returned by <code>sets.make()</code>. | none |
**RETURNS**
An integer representing the number of elements in the set.
<a name="#sets.remove"></a>
<a id="#sets.remove"></a>
## sets.remove
@ -249,12 +308,16 @@ Element must be hashable. This mutates the original set.
| Name | Description | Default Value |
| :-------------: | :-------------: | :-------------: |
| s | A set, as returned by <code>sets.make()</code>. | none |
| e | The element to be removed. | none |
| :------------- | :------------- | :------------- |
| <a id="sets.remove-s"></a>s | A set, as returned by <code>sets.make()</code>. | none |
| <a id="sets.remove-e"></a>e | The element to be removed. | none |
**RETURNS**
The set `s` with `e` removed.
<a name="#sets.repr"></a>
<a id="#sets.repr"></a>
## sets.repr
@ -268,11 +331,15 @@ Returns a string value representing the set.
| Name | Description | Default Value |
| :-------------: | :-------------: | :-------------: |
| s | A set, as returned by <code>sets.make()</code>. | none |
| :------------- | :------------- | :------------- |
| <a id="sets.repr-s"></a>s | A set, as returned by <code>sets.make()</code>. | none |
**RETURNS**
A string representing the set.
<a name="#sets.str"></a>
<a id="#sets.str"></a>
## sets.str
@ -286,7 +353,11 @@ Returns a string value representing the set.
| Name | Description | Default Value |
| :-------------: | :-------------: | :-------------: |
| s | A set, as returned by <code>sets.make()</code>. | none |
| :------------- | :------------- | :------------- |
| <a id="sets.str-s"></a>s | A set, as returned by <code>sets.make()</code>. | none |
**RETURNS**
A string representing the set.

View file

@ -1,6 +1,13 @@
<!-- Generated with Stardoc: http://skydoc.bazel.build -->
<a name="#partial.make"></a>
Starlark module for working with partial function objects.
Partial function objects allow some parameters are bound before the call.
Similar to https://docs.python.org/3/library/functools.html#functools.partial.
<a id="#partial.make"></a>
## partial.make
@ -106,13 +113,17 @@ partial.call(func, x=2)
| Name | Description | Default Value |
| :-------------: | :-------------: | :-------------: |
| func | The function to be called. | none |
| args | Positional arguments to be passed to function. | none |
| kwargs | Keyword arguments to be passed to function. Note that these can be overridden at the call sites. | none |
| :------------- | :------------- | :------------- |
| <a id="partial.make-func"></a>func | The function to be called. | none |
| <a id="partial.make-args"></a>args | Positional arguments to be passed to function. | none |
| <a id="partial.make-kwargs"></a>kwargs | Keyword arguments to be passed to function. Note that these can be overridden at the call sites. | none |
**RETURNS**
A new `partial` that can be called using `call`
<a name="#partial.call"></a>
<a id="#partial.call"></a>
## partial.call
@ -126,13 +137,17 @@ Calls a partial created using `make`.
| Name | Description | Default Value |
| :-------------: | :-------------: | :-------------: |
| partial | The partial to be called. | none |
| args | Additional positional arguments to be appended to the ones given to make. | none |
| kwargs | Additional keyword arguments to augment and override the ones given to make. | none |
| :------------- | :------------- | :------------- |
| <a id="partial.call-partial"></a>partial | The partial to be called. | none |
| <a id="partial.call-args"></a>args | Additional positional arguments to be appended to the ones given to make. | none |
| <a id="partial.call-kwargs"></a>kwargs | Additional keyword arguments to augment and override the ones given to make. | none |
**RETURNS**
Whatever the function in the partial returns.
<a name="#partial.is_instance"></a>
<a id="#partial.is_instance"></a>
## partial.is_instance
@ -146,7 +161,11 @@ Returns True if v is a partial created using `make`.
| Name | Description | Default Value |
| :-------------: | :-------------: | :-------------: |
| v | The value to check. | none |
| :------------- | :------------- | :------------- |
| <a id="partial.is_instance-v"></a>v | The value to check. | none |
**RETURNS**
True if v was created by `make`, False otherwise.

View file

@ -1,6 +1,13 @@
<!-- Generated with Stardoc: http://skydoc.bazel.build -->
<a name="#paths.basename"></a>
Skylib module containing file path manipulation functions.
NOTE: The functions in this module currently only support paths with Unix-style
path separators (forward slash, "/"); they do not handle Windows-style paths
with backslash separators or drive letters.
<a id="#paths.basename"></a>
## paths.basename
@ -20,11 +27,15 @@ the final slash).
| Name | Description | Default Value |
| :-------------: | :-------------: | :-------------: |
| p | The path whose basename should be returned. | none |
| :------------- | :------------- | :------------- |
| <a id="paths.basename-p"></a>p | The path whose basename should be returned. | none |
**RETURNS**
The basename of the path, which includes the extension.
<a name="#paths.dirname"></a>
<a id="#paths.dirname"></a>
## paths.dirname
@ -43,11 +54,15 @@ included, unless omitting them would make the dirname empty.
| Name | Description | Default Value |
| :-------------: | :-------------: | :-------------: |
| p | The path whose dirname should be returned. | none |
| :------------- | :------------- | :------------- |
| <a id="paths.dirname-p"></a>p | The path whose dirname should be returned. | none |
**RETURNS**
The dirname of the path.
<a name="#paths.is_absolute"></a>
<a id="#paths.is_absolute"></a>
## paths.is_absolute
@ -61,11 +76,15 @@ Returns `True` if `path` is an absolute path.
| Name | Description | Default Value |
| :-------------: | :-------------: | :-------------: |
| path | A path (which is a string). | none |
| :------------- | :------------- | :------------- |
| <a id="paths.is_absolute-path"></a>path | A path (which is a string). | none |
**RETURNS**
`True` if `path` is an absolute path.
<a name="#paths.join"></a>
<a id="#paths.join"></a>
## paths.join
@ -88,12 +107,16 @@ If any component is an absolute path, all previous components are discarded.
| Name | Description | Default Value |
| :-------------: | :-------------: | :-------------: |
| path | A path segment. | none |
| others | Additional path segments. | none |
| :------------- | :------------- | :------------- |
| <a id="paths.join-path"></a>path | A path segment. | none |
| <a id="paths.join-others"></a>others | Additional path segments. | none |
**RETURNS**
A string containing the joined paths.
<a name="#paths.normalize"></a>
<a id="#paths.normalize"></a>
## paths.normalize
@ -122,11 +145,15 @@ POSIX platforms; specifically:
| Name | Description | Default Value |
| :-------------: | :-------------: | :-------------: |
| path | A path. | none |
| :------------- | :------------- | :------------- |
| <a id="paths.normalize-path"></a>path | A path. | none |
**RETURNS**
The normalized path.
<a name="#paths.relativize"></a>
<a id="#paths.relativize"></a>
## paths.relativize
@ -149,12 +176,16 @@ the path both start with the same initial parent references.
| Name | Description | Default Value |
| :-------------: | :-------------: | :-------------: |
| path | The path to relativize. | none |
| start | The ancestor path against which to relativize. | none |
| :------------- | :------------- | :------------- |
| <a id="paths.relativize-path"></a>path | The path to relativize. | none |
| <a id="paths.relativize-start"></a>start | The ancestor path against which to relativize. | none |
**RETURNS**
The portion of `path` that is relative to `start`.
<a name="#paths.replace_extension"></a>
<a id="#paths.replace_extension"></a>
## paths.replace_extension
@ -171,12 +202,16 @@ If the path has no extension, the new extension is added to it.
| Name | Description | Default Value |
| :-------------: | :-------------: | :-------------: |
| p | The path whose extension should be replaced. | none |
| new_extension | The new extension for the file. The new extension should begin with a dot if you want the new filename to have one. | none |
| :------------- | :------------- | :------------- |
| <a id="paths.replace_extension-p"></a>p | The path whose extension should be replaced. | none |
| <a id="paths.replace_extension-new_extension"></a>new_extension | The new extension for the file. The new extension should begin with a dot if you want the new filename to have one. | none |
**RETURNS**
The path with the extension replaced (or added, if it did not have one).
<a name="#paths.split_extension"></a>
<a id="#paths.split_extension"></a>
## paths.split_extension
@ -194,7 +229,14 @@ Leading periods on the basename are ignored, so
| Name | Description | Default Value |
| :-------------: | :-------------: | :-------------: |
| p | The path whose root and extension should be split. | none |
| :------------- | :------------- | :------------- |
| <a id="paths.split_extension-p"></a>p | The path whose root and extension should be split. | none |
**RETURNS**
A tuple `(root, ext)` such that the root is the path without the file
extension, and `ext` is the file extension (which, if non-empty, contains
the leading dot). The returned tuple always satisfies the relationship
`root + ext == p`.

View file

@ -1,6 +1,12 @@
<!-- Generated with Stardoc: http://skydoc.bazel.build -->
<a name="#run_binary"></a>
run_binary() build rule implementation.
Runs a binary as a build action. This rule does not require Bash (unlike native.genrule()).
<a id="#run_binary"></a>
## run_binary
@ -14,12 +20,12 @@ Runs a binary as a build action.<br/><br/>This rule does not require Bash (unlik
| Name | Description | Type | Mandatory | Default |
| :-------------: | :-------------: | :-------------: | :-------------: | :-------------: |
| name | A unique name for this target. | <a href="https://bazel.build/docs/build-ref.html#name">Name</a> | required | |
| args | Command line arguments of the binary.&lt;br/&gt;&lt;br/&gt;Subject to&lt;code&gt;&lt;a href="https://docs.bazel.build/versions/main/be/make-variables.html#location"&gt;$(location)&lt;/a&gt;&lt;/code&gt; expansion. | List of strings | optional | [] |
| env | Environment variables of the action.&lt;br/&gt;&lt;br/&gt;Subject to &lt;code&gt;&lt;a href="https://docs.bazel.build/versions/main/be/make-variables.html#location"&gt;$(location)&lt;/a&gt;&lt;/code&gt; expansion. | <a href="https://bazel.build/docs/skylark/lib/dict.html">Dictionary: String -> String</a> | optional | {} |
| outs | Output files generated by the action.&lt;br/&gt;&lt;br/&gt;These labels are available for &lt;code&gt;$(location)&lt;/code&gt; expansion in &lt;code&gt;args&lt;/code&gt; and &lt;code&gt;env&lt;/code&gt;. | List of labels | required | |
| srcs | Additional inputs of the action.&lt;br/&gt;&lt;br/&gt;These labels are available for &lt;code&gt;$(location)&lt;/code&gt; expansion in &lt;code&gt;args&lt;/code&gt; and &lt;code&gt;env&lt;/code&gt;. | <a href="https://bazel.build/docs/build-ref.html#labels">List of labels</a> | optional | [] |
| tool | The tool to run in the action.&lt;br/&gt;&lt;br/&gt;Must be the label of a *_binary rule, of a rule that generates an executable file, or of a file that can be executed as a subprocess (e.g. an .exe or .bat file on Windows or a binary with executable permission on Linux). This label is available for &lt;code&gt;$(location)&lt;/code&gt; expansion in &lt;code&gt;args&lt;/code&gt; and &lt;code&gt;env&lt;/code&gt;. | <a href="https://bazel.build/docs/build-ref.html#labels">Label</a> | required | |
| :------------- | :------------- | :------------- | :------------- | :------------- |
| <a id="run_binary-name"></a>name | A unique name for this target. | <a href="https://bazel.build/docs/build-ref.html#name">Name</a> | required | |
| <a id="run_binary-args"></a>args | Command line arguments of the binary.&lt;br/&gt;&lt;br/&gt;Subject to&lt;code&gt;&lt;a href="https://docs.bazel.build/versions/main/be/make-variables.html#location"&gt;$(location)&lt;/a&gt;&lt;/code&gt; expansion. | List of strings | optional | [] |
| <a id="run_binary-env"></a>env | Environment variables of the action.&lt;br/&gt;&lt;br/&gt;Subject to &lt;code&gt;&lt;a href="https://docs.bazel.build/versions/main/be/make-variables.html#location"&gt;$(location)&lt;/a&gt;&lt;/code&gt; expansion. | <a href="https://bazel.build/docs/skylark/lib/dict.html">Dictionary: String -> String</a> | optional | {} |
| <a id="run_binary-outs"></a>outs | Output files generated by the action.&lt;br/&gt;&lt;br/&gt;These labels are available for &lt;code&gt;$(location)&lt;/code&gt; expansion in &lt;code&gt;args&lt;/code&gt; and &lt;code&gt;env&lt;/code&gt;. | List of labels | required | |
| <a id="run_binary-srcs"></a>srcs | Additional inputs of the action.&lt;br/&gt;&lt;br/&gt;These labels are available for &lt;code&gt;$(location)&lt;/code&gt; expansion in &lt;code&gt;args&lt;/code&gt; and &lt;code&gt;env&lt;/code&gt;. | <a href="https://bazel.build/docs/build-ref.html#labels">List of labels</a> | optional | [] |
| <a id="run_binary-tool"></a>tool | The tool to run in the action.&lt;br/&gt;&lt;br/&gt;Must be the label of a *_binary rule, of a rule that generates an executable file, or of a file that can be executed as a subprocess (e.g. an .exe or .bat file on Windows or a binary with executable permission on Linux). This label is available for &lt;code&gt;$(location)&lt;/code&gt; expansion in &lt;code&gt;args&lt;/code&gt; and &lt;code&gt;env&lt;/code&gt;. | <a href="https://bazel.build/docs/build-ref.html#labels">Label</a> | required | |

View file

@ -1,6 +1,8 @@
<!-- Generated with Stardoc: http://skydoc.bazel.build -->
<a name="#selects.with_or"></a>
Skylib module containing convenience interfaces for select().
<a id="#selects.with_or"></a>
## selects.with_or
@ -28,12 +30,25 @@ Example:
| Name | Description | Default Value |
| :-------------: | :-------------: | :-------------: |
| input_dict | The same dictionary <code>select()</code> takes, except keys may take either the usual form <code>"//foo:config1"</code> or <code>("//foo:config1", "//foo:config2", ...)</code> to signify <code>//foo:config1</code> OR <code>//foo:config2</code> OR <code>...</code>. | none |
| no_match_error | Optional custom error to report if no condition matches. | <code>""</code> |
| :------------- | :------------- | :------------- |
| <a id="selects.with_or-input_dict"></a>input_dict | The same dictionary <code>select()</code> takes, except keys may take either the usual form <code>"//foo:config1"</code> or <code>("//foo:config1", "//foo:config2", ...)</code> to signify <code>//foo:config1</code> OR <code>//foo:config2</code> OR <code>...</code>. | none |
| <a id="selects.with_or-no_match_error"></a>no_match_error | Optional custom error to report if no condition matches. | <code>""</code> |
**RETURNS**
A native `select()` that expands
`("//configs:two", "//configs:three"): [":dep2or3"]`
to
```build
"//configs:two": [":dep2or3"],
"//configs:three": [":dep2or3"],
```
<a name="#selects.with_or_dict"></a>
<a id="#selects.with_or_dict"></a>
## selects.with_or_dict
@ -51,11 +66,15 @@ macros.
| Name | Description | Default Value |
| :-------------: | :-------------: | :-------------: |
| input_dict | Same as <code>with_or</code>. | none |
| :------------- | :------------- | :------------- |
| <a id="selects.with_or_dict-input_dict"></a>input_dict | Same as <code>with_or</code>. | none |
**RETURNS**
A dictionary usable by a native `select()`.
<a name="#selects.config_setting_group"></a>
<a id="#selects.config_setting_group"></a>
## selects.config_setting_group
@ -91,10 +110,10 @@ Example:
| Name | Description | Default Value |
| :-------------: | :-------------: | :-------------: |
| name | The group's name. This is how <code>select()</code>s reference it. | none |
| match_any | A list of <code>config_settings</code>. This group matches if *any* member in the list matches. If this is set, <code>match_all</code> must not be set. | <code>[]</code> |
| match_all | A list of <code>config_settings</code>. This group matches if *every* member in the list matches. If this is set, <code>match_any</code> must be not set. | <code>[]</code> |
| visibility | Visibility of the config_setting_group. | <code>None</code> |
| :------------- | :------------- | :------------- |
| <a id="selects.config_setting_group-name"></a>name | The group's name. This is how <code>select()</code>s reference it. | none |
| <a id="selects.config_setting_group-match_any"></a>match_any | A list of <code>config_settings</code>. This group matches if *any* member in the list matches. If this is set, <code>match_all</code> must not be set. | <code>[]</code> |
| <a id="selects.config_setting_group-match_all"></a>match_all | A list of <code>config_settings</code>. This group matches if *every* member in the list matches. If this is set, <code>match_any</code> must be not set. | <code>[]</code> |
| <a id="selects.config_setting_group-visibility"></a>visibility | Visibility of the config_setting_group. | <code>None</code> |

View file

@ -1,6 +1,8 @@
<!-- Generated with Stardoc: http://skydoc.bazel.build -->
<a name="#shell.array_literal"></a>
Skylib module containing shell utility functions.
<a id="#shell.array_literal"></a>
## shell.array_literal
@ -22,11 +24,16 @@ safety, even if they do not need to be.
| Name | Description | Default Value |
| :-------------: | :-------------: | :-------------: |
| iterable | A sequence of elements. Elements that are not strings will be converted to strings first, by calling <code>str()</code>. | none |
| :------------- | :------------- | :------------- |
| <a id="shell.array_literal-iterable"></a>iterable | A sequence of elements. Elements that are not strings will be converted to strings first, by calling <code>str()</code>. | none |
**RETURNS**
A string that represents the sequence as a shell array; that is,
parentheses containing the quoted elements.
<a name="#shell.quote"></a>
<a id="#shell.quote"></a>
## shell.quote
@ -44,7 +51,11 @@ shell metacharacters.)
| Name | Description | Default Value |
| :-------------: | :-------------: | :-------------: |
| s | The string to quote. | none |
| :------------- | :------------- | :------------- |
| <a id="shell.quote-s"></a>s | The string to quote. | none |
**RETURNS**
A quoted version of the string that can be passed to a shell command.

View file

@ -1,6 +1,8 @@
<!-- Generated with Stardoc: http://skydoc.bazel.build -->
<a name="#structs.to_dict"></a>
Skylib module containing functions that operate on structs.
<a id="#structs.to_dict"></a>
## structs.to_dict
@ -14,7 +16,13 @@ Converts a `struct` to a `dict`.
| Name | Description | Default Value |
| :-------------: | :-------------: | :-------------: |
| s | A <code>struct</code>. | none |
| :------------- | :------------- | :------------- |
| <a id="structs.to_dict-s"></a>s | A <code>struct</code>. | none |
**RETURNS**
A `dict` whose keys and values are the same as the fields in `s`. The
transformation is only applied to the struct's fields and not to any
nested values.

View file

@ -1,6 +1,8 @@
<!-- Generated with Stardoc: http://skydoc.bazel.build -->
<a name="#types.is_list"></a>
Skylib module containing functions checking types.
<a id="#types.is_list"></a>
## types.is_list
@ -14,11 +16,15 @@ Returns True if v is an instance of a list.
| Name | Description | Default Value |
| :-------------: | :-------------: | :-------------: |
| v | The value whose type should be checked. | none |
| :------------- | :------------- | :------------- |
| <a id="types.is_list-v"></a>v | The value whose type should be checked. | none |
**RETURNS**
True if v is an instance of a list, False otherwise.
<a name="#types.is_string"></a>
<a id="#types.is_string"></a>
## types.is_string
@ -32,11 +38,15 @@ Returns True if v is an instance of a string.
| Name | Description | Default Value |
| :-------------: | :-------------: | :-------------: |
| v | The value whose type should be checked. | none |
| :------------- | :------------- | :------------- |
| <a id="types.is_string-v"></a>v | The value whose type should be checked. | none |
**RETURNS**
True if v is an instance of a string, False otherwise.
<a name="#types.is_bool"></a>
<a id="#types.is_bool"></a>
## types.is_bool
@ -50,11 +60,15 @@ Returns True if v is an instance of a bool.
| Name | Description | Default Value |
| :-------------: | :-------------: | :-------------: |
| v | The value whose type should be checked. | none |
| :------------- | :------------- | :------------- |
| <a id="types.is_bool-v"></a>v | The value whose type should be checked. | none |
**RETURNS**
True if v is an instance of a bool, False otherwise.
<a name="#types.is_none"></a>
<a id="#types.is_none"></a>
## types.is_none
@ -68,11 +82,15 @@ Returns True if v has the type of None.
| Name | Description | Default Value |
| :-------------: | :-------------: | :-------------: |
| v | The value whose type should be checked. | none |
| :------------- | :------------- | :------------- |
| <a id="types.is_none-v"></a>v | The value whose type should be checked. | none |
**RETURNS**
True if v is None, False otherwise.
<a name="#types.is_int"></a>
<a id="#types.is_int"></a>
## types.is_int
@ -86,11 +104,15 @@ Returns True if v is an instance of a signed integer.
| Name | Description | Default Value |
| :-------------: | :-------------: | :-------------: |
| v | The value whose type should be checked. | none |
| :------------- | :------------- | :------------- |
| <a id="types.is_int-v"></a>v | The value whose type should be checked. | none |
**RETURNS**
True if v is an instance of a signed integer, False otherwise.
<a name="#types.is_tuple"></a>
<a id="#types.is_tuple"></a>
## types.is_tuple
@ -104,11 +126,15 @@ Returns True if v is an instance of a tuple.
| Name | Description | Default Value |
| :-------------: | :-------------: | :-------------: |
| v | The value whose type should be checked. | none |
| :------------- | :------------- | :------------- |
| <a id="types.is_tuple-v"></a>v | The value whose type should be checked. | none |
**RETURNS**
True if v is an instance of a tuple, False otherwise.
<a name="#types.is_dict"></a>
<a id="#types.is_dict"></a>
## types.is_dict
@ -122,11 +148,15 @@ Returns True if v is an instance of a dict.
| Name | Description | Default Value |
| :-------------: | :-------------: | :-------------: |
| v | The value whose type should be checked. | none |
| :------------- | :------------- | :------------- |
| <a id="types.is_dict-v"></a>v | The value whose type should be checked. | none |
**RETURNS**
True if v is an instance of a dict, False otherwise.
<a name="#types.is_function"></a>
<a id="#types.is_function"></a>
## types.is_function
@ -140,11 +170,15 @@ Returns True if v is an instance of a function.
| Name | Description | Default Value |
| :-------------: | :-------------: | :-------------: |
| v | The value whose type should be checked. | none |
| :------------- | :------------- | :------------- |
| <a id="types.is_function-v"></a>v | The value whose type should be checked. | none |
**RETURNS**
True if v is an instance of a function, False otherwise.
<a name="#types.is_depset"></a>
<a id="#types.is_depset"></a>
## types.is_depset
@ -158,11 +192,15 @@ Returns True if v is an instance of a `depset`.
| Name | Description | Default Value |
| :-------------: | :-------------: | :-------------: |
| v | The value whose type should be checked. | none |
| :------------- | :------------- | :------------- |
| <a id="types.is_depset-v"></a>v | The value whose type should be checked. | none |
**RETURNS**
True if v is an instance of a `depset`, False otherwise.
<a name="#types.is_set"></a>
<a id="#types.is_set"></a>
## types.is_set
@ -176,7 +214,11 @@ Returns True if v is a set created by sets.make().
| Name | Description | Default Value |
| :-------------: | :-------------: | :-------------: |
| v | The value whose type should be checked. | none |
| :------------- | :------------- | :------------- |
| <a id="types.is_set-v"></a>v | The value whose type should be checked. | none |
**RETURNS**
True if v was created by sets.make(), False otherwise.

View file

@ -1,6 +1,13 @@
<!-- Generated with Stardoc: http://skydoc.bazel.build -->
<a name="#unittest_toolchain"></a>
Unit testing support.
Unlike most Skylib files, this exports two modules: `unittest` which contains
functions to declare and define unit tests, and `asserts` which contains the
assertions used to within tests.
<a id="#unittest_toolchain"></a>
## unittest_toolchain
@ -15,17 +22,17 @@ unittest_toolchain(<a href="#unittest_toolchain-name">name</a>, <a href="#unitte
| Name | Description | Type | Mandatory | Default |
| :-------------: | :-------------: | :-------------: | :-------------: | :-------------: |
| name | A unique name for this target. | <a href="https://bazel.build/docs/build-ref.html#name">Name</a> | required | |
| escape_chars_with | Dictionary of characters that need escaping in test failure message to prefix appended to escape those characters. For example, <code>{"%": "%", "&gt;": "^"}</code> would replace <code>%</code> with <code>%%</code> and <code>&gt;</code> with <code>^&gt;</code> in the failure message before that is included in <code>success_templ</code>. | <a href="https://bazel.build/docs/skylark/lib/dict.html">Dictionary: String -> String</a> | optional | {} |
| escape_other_chars_with | String to prefix every character in test failure message which is not a key in <code>escape_chars_with</code> before including that in <code>success_templ</code>. For example, <code>""</code> would prefix every character in the failure message (except those in the keys of <code>escape_chars_with</code>) with <code>\</code>. | String | optional | "" |
| failure_templ | Test script template with a single <code>%s</code>. That placeholder is replaced with the lines in the failure message joined with the string specified in <code>join_with</code>. The resulting script should print the failure message and exit with non-zero status. | String | required | |
| file_ext | File extension for test script, including leading dot. | String | required | |
| join_on | String used to join the lines in the failure message before including the resulting string in the script specified in <code>failure_templ</code>. | String | required | |
| success_templ | Test script generated when the test passes. Should exit with status 0. | String | required | |
| :------------- | :------------- | :------------- | :------------- | :------------- |
| <a id="unittest_toolchain-name"></a>name | A unique name for this target. | <a href="https://bazel.build/docs/build-ref.html#name">Name</a> | required | |
| <a id="unittest_toolchain-escape_chars_with"></a>escape_chars_with | Dictionary of characters that need escaping in test failure message to prefix appended to escape those characters. For example, <code>{"%": "%", "&gt;": "^"}</code> would replace <code>%</code> with <code>%%</code> and <code>&gt;</code> with <code>^&gt;</code> in the failure message before that is included in <code>success_templ</code>. | <a href="https://bazel.build/docs/skylark/lib/dict.html">Dictionary: String -> String</a> | optional | {} |
| <a id="unittest_toolchain-escape_other_chars_with"></a>escape_other_chars_with | String to prefix every character in test failure message which is not a key in <code>escape_chars_with</code> before including that in <code>success_templ</code>. For example, <code>""</code> would prefix every character in the failure message (except those in the keys of <code>escape_chars_with</code>) with <code>\</code>. | String | optional | "" |
| <a id="unittest_toolchain-failure_templ"></a>failure_templ | Test script template with a single <code>%s</code>. That placeholder is replaced with the lines in the failure message joined with the string specified in <code>join_with</code>. The resulting script should print the failure message and exit with non-zero status. | String | required | |
| <a id="unittest_toolchain-file_ext"></a>file_ext | File extension for test script, including leading dot. | String | required | |
| <a id="unittest_toolchain-join_on"></a>join_on | String used to join the lines in the failure message before including the resulting string in the script specified in <code>failure_templ</code>. | String | required | |
| <a id="unittest_toolchain-success_templ"></a>success_templ | Test script generated when the test passes. Should exit with status 0. | String | required | |
<a name="#analysistest.make"></a>
<a id="#analysistest.make"></a>
## analysistest.make
@ -64,16 +71,21 @@ Recall that names of test rules must end in `_test`.
| Name | Description | Default Value |
| :-------------: | :-------------: | :-------------: |
| impl | The implementation function of the unit test. | none |
| expect_failure | If true, the analysis test will expect the target_under_test to fail. Assertions can be made on the underlying failure using asserts.expect_failure | <code>False</code> |
| attrs | An optional dictionary to supplement the attrs passed to the unit test's <code>rule()</code> constructor. | <code>{}</code> |
| fragments | An optional list of fragment names that can be used to give rules access to language-specific parts of configuration. | <code>[]</code> |
| config_settings | A dictionary of configuration settings to change for the target under test and its dependencies. This may be used to essentially change 'build flags' for the target under test, and may thus be utilized to test multiple targets with different flags in a single build | <code>{}</code> |
| extra_target_under_test_aspects | An optional list of aspects to apply to the target_under_test in addition to those set up by default for the test harness itself. | <code>[]</code> |
| :------------- | :------------- | :------------- |
| <a id="analysistest.make-impl"></a>impl | The implementation function of the unit test. | none |
| <a id="analysistest.make-expect_failure"></a>expect_failure | If true, the analysis test will expect the target_under_test to fail. Assertions can be made on the underlying failure using asserts.expect_failure | <code>False</code> |
| <a id="analysistest.make-attrs"></a>attrs | An optional dictionary to supplement the attrs passed to the unit test's <code>rule()</code> constructor. | <code>{}</code> |
| <a id="analysistest.make-fragments"></a>fragments | An optional list of fragment names that can be used to give rules access to language-specific parts of configuration. | <code>[]</code> |
| <a id="analysistest.make-config_settings"></a>config_settings | A dictionary of configuration settings to change for the target under test and its dependencies. This may be used to essentially change 'build flags' for the target under test, and may thus be utilized to test multiple targets with different flags in a single build | <code>{}</code> |
| <a id="analysistest.make-extra_target_under_test_aspects"></a>extra_target_under_test_aspects | An optional list of aspects to apply to the target_under_test in addition to those set up by default for the test harness itself. | <code>[]</code> |
**RETURNS**
A rule definition that should be stored in a global whose name ends in
`_test`.
<a name="#analysistest.begin"></a>
<a id="#analysistest.begin"></a>
## analysistest.begin
@ -93,11 +105,17 @@ test.
| Name | Description | Default Value |
| :-------------: | :-------------: | :-------------: |
| ctx | The Starlark context. Pass the implementation function's <code>ctx</code> argument in verbatim. | none |
| :------------- | :------------- | :------------- |
| <a id="analysistest.begin-ctx"></a>ctx | The Starlark context. Pass the implementation function's <code>ctx</code> argument in verbatim. | none |
**RETURNS**
A test environment struct that must be passed to assertions and finally to
`unittest.end`. Do not rely on internal details about the fields in this
struct as it may change.
<a name="#analysistest.end"></a>
<a id="#analysistest.end"></a>
## analysistest.end
@ -115,11 +133,15 @@ that the results are reported.
| Name | Description | Default Value |
| :-------------: | :-------------: | :-------------: |
| env | The test environment returned by <code>analysistest.begin</code>. | none |
| :------------- | :------------- | :------------- |
| <a id="analysistest.end-env"></a>env | The test environment returned by <code>analysistest.begin</code>. | none |
**RETURNS**
A list of providers needed to automatically register the analysis test result.
<a name="#analysistest.fail"></a>
<a id="#analysistest.fail"></a>
## analysistest.fail
@ -133,12 +155,12 @@ Unconditionally causes the current test to fail.
| Name | Description | Default Value |
| :-------------: | :-------------: | :-------------: |
| env | The test environment returned by <code>unittest.begin</code>. | none |
| msg | The message to log describing the failure. | none |
| :------------- | :------------- | :------------- |
| <a id="analysistest.fail-env"></a>env | The test environment returned by <code>unittest.begin</code>. | none |
| <a id="analysistest.fail-msg"></a>msg | The message to log describing the failure. | none |
<a name="#analysistest.target_actions"></a>
<a id="#analysistest.target_actions"></a>
## analysistest.target_actions
@ -152,11 +174,15 @@ Returns a list of actions registered by the target under test.
| Name | Description | Default Value |
| :-------------: | :-------------: | :-------------: |
| env | The test environment returned by <code>analysistest.begin</code>. | none |
| :------------- | :------------- | :------------- |
| <a id="analysistest.target_actions-env"></a>env | The test environment returned by <code>analysistest.begin</code>. | none |
**RETURNS**
A list of actions registered by the target under test
<a name="#analysistest.target_bin_dir_path"></a>
<a id="#analysistest.target_bin_dir_path"></a>
## analysistest.target_bin_dir_path
@ -170,11 +196,15 @@ Returns ctx.bin_dir.path for the target under test.
| Name | Description | Default Value |
| :-------------: | :-------------: | :-------------: |
| env | The test environment returned by <code>analysistest.begin</code>. | none |
| :------------- | :------------- | :------------- |
| <a id="analysistest.target_bin_dir_path-env"></a>env | The test environment returned by <code>analysistest.begin</code>. | none |
**RETURNS**
Output bin dir path string.
<a name="#analysistest.target_under_test"></a>
<a id="#analysistest.target_under_test"></a>
## analysistest.target_under_test
@ -188,11 +218,15 @@ Returns the target under test.
| Name | Description | Default Value |
| :-------------: | :-------------: | :-------------: |
| env | The test environment returned by <code>analysistest.begin</code>. | none |
| :------------- | :------------- | :------------- |
| <a id="analysistest.target_under_test-env"></a>env | The test environment returned by <code>analysistest.begin</code>. | none |
**RETURNS**
The target under test.
<a name="#asserts.expect_failure"></a>
<a id="#asserts.expect_failure"></a>
## asserts.expect_failure
@ -210,12 +244,12 @@ This requires that the analysis test is created with `analysistest.make()` and
| Name | Description | Default Value |
| :-------------: | :-------------: | :-------------: |
| env | The test environment returned by <code>analysistest.begin</code>. | none |
| expected_failure_msg | The error message to expect as a result of analysis failures. | <code>""</code> |
| :------------- | :------------- | :------------- |
| <a id="asserts.expect_failure-env"></a>env | The test environment returned by <code>analysistest.begin</code>. | none |
| <a id="asserts.expect_failure-expected_failure_msg"></a>expected_failure_msg | The error message to expect as a result of analysis failures. | <code>""</code> |
<a name="#asserts.equals"></a>
<a id="#asserts.equals"></a>
## asserts.equals
@ -229,14 +263,14 @@ Asserts that the given `expected` and `actual` values are equal.
| Name | Description | Default Value |
| :-------------: | :-------------: | :-------------: |
| env | The test environment returned by <code>unittest.begin</code>. | none |
| expected | The expected value of some computation. | none |
| actual | The actual value returned by some computation. | none |
| msg | An optional message that will be printed that describes the failure. If omitted, a default will be used. | <code>None</code> |
| :------------- | :------------- | :------------- |
| <a id="asserts.equals-env"></a>env | The test environment returned by <code>unittest.begin</code>. | none |
| <a id="asserts.equals-expected"></a>expected | The expected value of some computation. | none |
| <a id="asserts.equals-actual"></a>actual | The actual value returned by some computation. | none |
| <a id="asserts.equals-msg"></a>msg | An optional message that will be printed that describes the failure. If omitted, a default will be used. | <code>None</code> |
<a name="#asserts.false"></a>
<a id="#asserts.false"></a>
## asserts.false
@ -250,13 +284,13 @@ Asserts that the given `condition` is false.
| Name | Description | Default Value |
| :-------------: | :-------------: | :-------------: |
| env | The test environment returned by <code>unittest.begin</code>. | none |
| condition | A value that will be evaluated in a Boolean context. | none |
| msg | An optional message that will be printed that describes the failure. If omitted, a default will be used. | <code>"Expected condition to be false, but was true."</code> |
| :------------- | :------------- | :------------- |
| <a id="asserts.false-env"></a>env | The test environment returned by <code>unittest.begin</code>. | none |
| <a id="asserts.false-condition"></a>condition | A value that will be evaluated in a Boolean context. | none |
| <a id="asserts.false-msg"></a>msg | An optional message that will be printed that describes the failure. If omitted, a default will be used. | <code>"Expected condition to be false, but was true."</code> |
<a name="#asserts.set_equals"></a>
<a id="#asserts.set_equals"></a>
## asserts.set_equals
@ -270,14 +304,14 @@ Asserts that the given `expected` and `actual` sets are equal.
| Name | Description | Default Value |
| :-------------: | :-------------: | :-------------: |
| env | The test environment returned by <code>unittest.begin</code>. | none |
| expected | The expected set resulting from some computation. | none |
| actual | The actual set returned by some computation. | none |
| msg | An optional message that will be printed that describes the failure. If omitted, a default will be used. | <code>None</code> |
| :------------- | :------------- | :------------- |
| <a id="asserts.set_equals-env"></a>env | The test environment returned by <code>unittest.begin</code>. | none |
| <a id="asserts.set_equals-expected"></a>expected | The expected set resulting from some computation. | none |
| <a id="asserts.set_equals-actual"></a>actual | The actual set returned by some computation. | none |
| <a id="asserts.set_equals-msg"></a>msg | An optional message that will be printed that describes the failure. If omitted, a default will be used. | <code>None</code> |
<a name="#asserts.new_set_equals"></a>
<a id="#asserts.new_set_equals"></a>
## asserts.new_set_equals
@ -291,14 +325,14 @@ Asserts that the given `expected` and `actual` sets are equal.
| Name | Description | Default Value |
| :-------------: | :-------------: | :-------------: |
| env | The test environment returned by <code>unittest.begin</code>. | none |
| expected | The expected set resulting from some computation. | none |
| actual | The actual set returned by some computation. | none |
| msg | An optional message that will be printed that describes the failure. If omitted, a default will be used. | <code>None</code> |
| :------------- | :------------- | :------------- |
| <a id="asserts.new_set_equals-env"></a>env | The test environment returned by <code>unittest.begin</code>. | none |
| <a id="asserts.new_set_equals-expected"></a>expected | The expected set resulting from some computation. | none |
| <a id="asserts.new_set_equals-actual"></a>actual | The actual set returned by some computation. | none |
| <a id="asserts.new_set_equals-msg"></a>msg | An optional message that will be printed that describes the failure. If omitted, a default will be used. | <code>None</code> |
<a name="#asserts.true"></a>
<a id="#asserts.true"></a>
## asserts.true
@ -312,13 +346,13 @@ Asserts that the given `condition` is true.
| Name | Description | Default Value |
| :-------------: | :-------------: | :-------------: |
| env | The test environment returned by <code>unittest.begin</code>. | none |
| condition | A value that will be evaluated in a Boolean context. | none |
| msg | An optional message that will be printed that describes the failure. If omitted, a default will be used. | <code>"Expected condition to be true, but was false."</code> |
| :------------- | :------------- | :------------- |
| <a id="asserts.true-env"></a>env | The test environment returned by <code>unittest.begin</code>. | none |
| <a id="asserts.true-condition"></a>condition | A value that will be evaluated in a Boolean context. | none |
| <a id="asserts.true-msg"></a>msg | An optional message that will be printed that describes the failure. If omitted, a default will be used. | <code>"Expected condition to be true, but was false."</code> |
<a name="#register_unittest_toolchains"></a>
<a id="#register_unittest_toolchains"></a>
## register_unittest_toolchains
@ -328,11 +362,9 @@ register_unittest_toolchains()
Registers the toolchains for unittest users.
**PARAMETERS**
<a name="#unittest.make"></a>
<a id="#unittest.make"></a>
## unittest.make
@ -370,12 +402,17 @@ Recall that names of test rules must end in `_test`.
| Name | Description | Default Value |
| :-------------: | :-------------: | :-------------: |
| impl | The implementation function of the unit test. | none |
| attrs | An optional dictionary to supplement the attrs passed to the unit test's <code>rule()</code> constructor. | <code>{}</code> |
| :------------- | :------------- | :------------- |
| <a id="unittest.make-impl"></a>impl | The implementation function of the unit test. | none |
| <a id="unittest.make-attrs"></a>attrs | An optional dictionary to supplement the attrs passed to the unit test's <code>rule()</code> constructor. | <code>{}</code> |
**RETURNS**
A rule definition that should be stored in a global whose name ends in
`_test`.
<a name="#unittest.suite"></a>
<a id="#unittest.suite"></a>
## unittest.suite
@ -426,12 +463,12 @@ name each target.
| Name | Description | Default Value |
| :-------------: | :-------------: | :-------------: |
| name | The name of the <code>test_suite</code> target, and the prefix of all the test target names. | none |
| test_rules | A list of test rules defines by <code>unittest.test</code>. | none |
| :------------- | :------------- | :------------- |
| <a id="unittest.suite-name"></a>name | The name of the <code>test_suite</code> target, and the prefix of all the test target names. | none |
| <a id="unittest.suite-test_rules"></a>test_rules | A list of test rules defines by <code>unittest.test</code>. | none |
<a name="#unittest.begin"></a>
<a id="#unittest.begin"></a>
## unittest.begin
@ -451,11 +488,17 @@ test.
| Name | Description | Default Value |
| :-------------: | :-------------: | :-------------: |
| ctx | The Starlark context. Pass the implementation function's <code>ctx</code> argument in verbatim. | none |
| :------------- | :------------- | :------------- |
| <a id="unittest.begin-ctx"></a>ctx | The Starlark context. Pass the implementation function's <code>ctx</code> argument in verbatim. | none |
**RETURNS**
A test environment struct that must be passed to assertions and finally to
`unittest.end`. Do not rely on internal details about the fields in this
struct as it may change.
<a name="#unittest.end"></a>
<a id="#unittest.end"></a>
## unittest.end
@ -473,11 +516,15 @@ that the results are reported.
| Name | Description | Default Value |
| :-------------: | :-------------: | :-------------: |
| env | The test environment returned by <code>unittest.begin</code>. | none |
| :------------- | :------------- | :------------- |
| <a id="unittest.end-env"></a>env | The test environment returned by <code>unittest.begin</code>. | none |
**RETURNS**
A list of providers needed to automatically register the test result.
<a name="#unittest.fail"></a>
<a id="#unittest.fail"></a>
## unittest.fail
@ -491,8 +538,8 @@ Unconditionally causes the current test to fail.
| Name | Description | Default Value |
| :-------------: | :-------------: | :-------------: |
| env | The test environment returned by <code>unittest.begin</code>. | none |
| msg | The message to log describing the failure. | none |
| :------------- | :------------- | :------------- |
| <a id="unittest.fail-env"></a>env | The test environment returned by <code>unittest.begin</code>. | none |
| <a id="unittest.fail-msg"></a>msg | The message to log describing the failure. | none |

View file

@ -1,6 +1,8 @@
<!-- Generated with Stardoc: http://skydoc.bazel.build -->
<a name="#versions.get"></a>
Skylib module containing functions for checking Bazel versions.
<a id="#versions.get"></a>
## versions.get
@ -10,11 +12,9 @@ versions.get()
Returns the current Bazel version
**PARAMETERS**
<a name="#versions.parse"></a>
<a id="#versions.parse"></a>
## versions.parse
@ -31,11 +31,15 @@ int tuples can be compared directly using binary operators (<, >).
| Name | Description | Default Value |
| :-------------: | :-------------: | :-------------: |
| bazel_version | the Bazel version string | none |
| :------------- | :------------- | :------------- |
| <a id="versions.parse-bazel_version"></a>bazel_version | the Bazel version string | none |
**RETURNS**
An int 3-tuple of a (major, minor, patch) version.
<a name="#versions.check"></a>
<a id="#versions.check"></a>
## versions.check
@ -49,13 +53,13 @@ Check that the version of Bazel is valid within the specified range.
| Name | Description | Default Value |
| :-------------: | :-------------: | :-------------: |
| minimum_bazel_version | minimum version of Bazel expected | none |
| maximum_bazel_version | maximum version of Bazel expected | <code>None</code> |
| bazel_version | the version of Bazel to check. Used for testing, defaults to native.bazel_version | <code>None</code> |
| :------------- | :------------- | :------------- |
| <a id="versions.check-minimum_bazel_version"></a>minimum_bazel_version | minimum version of Bazel expected | none |
| <a id="versions.check-maximum_bazel_version"></a>maximum_bazel_version | maximum version of Bazel expected | <code>None</code> |
| <a id="versions.check-bazel_version"></a>bazel_version | the version of Bazel to check. Used for testing, defaults to native.bazel_version | <code>None</code> |
<a name="#versions.is_at_most"></a>
<a id="#versions.is_at_most"></a>
## versions.is_at_most
@ -69,12 +73,16 @@ Check that a version is lower or equals to a threshold.
| Name | Description | Default Value |
| :-------------: | :-------------: | :-------------: |
| threshold | the maximum version string | none |
| version | the version string to be compared to the threshold | none |
| :------------- | :------------- | :------------- |
| <a id="versions.is_at_most-threshold"></a>threshold | the maximum version string | none |
| <a id="versions.is_at_most-version"></a>version | the version string to be compared to the threshold | none |
**RETURNS**
True if version <= threshold.
<a name="#versions.is_at_least"></a>
<a id="#versions.is_at_least"></a>
## versions.is_at_least
@ -88,8 +96,12 @@ Check that a version is higher or equals to a threshold.
| Name | Description | Default Value |
| :-------------: | :-------------: | :-------------: |
| threshold | the minimum version string | none |
| version | the version string to be compared to the threshold | none |
| :------------- | :------------- | :------------- |
| <a id="versions.is_at_least-threshold"></a>threshold | the minimum version string | none |
| <a id="versions.is_at_least-version"></a>version | the version string to be compared to the threshold | none |
**RETURNS**
True if version >= threshold.

View file

@ -1,6 +1,16 @@
<!-- Generated with Stardoc: http://skydoc.bazel.build -->
<a name="#write_file"></a>
A rule that writes a UTF-8 encoded text file from user-specified contents.
native.genrule() is sometimes used to create a text file. The 'write_file' and
macro does this with a simpler interface than genrule.
The rules generated by the macro do not use Bash or any other shell to write the
file. Instead they use Starlark's built-in file writing action
(ctx.actions.write).
<a id="#write_file"></a>
## write_file
@ -14,12 +24,12 @@ Creates a UTF-8 encoded text file.
| Name | Description | Default Value |
| :-------------: | :-------------: | :-------------: |
| name | Name of the rule. | none |
| out | Path of the output file, relative to this package. | none |
| content | A list of strings. Lines of text, the contents of the file. Newlines are added automatically after every line except the last one. | <code>[]</code> |
| is_executable | A boolean. Whether to make the output file executable. When True, the rule's output can be executed using <code>bazel run</code> and can be in the srcs of binary and test rules that require executable sources. | <code>False</code> |
| newline | one of ["auto", "unix", "windows"]: line endings to use. "auto" for platform-determined, "unix" for LF, and "windows" for CRLF. | <code>"auto"</code> |
| kwargs | further keyword arguments, e.g. &lt;code&gt;visibility&lt;/code&gt; | none |
| :------------- | :------------- | :------------- |
| <a id="write_file-name"></a>name | Name of the rule. | none |
| <a id="write_file-out"></a>out | Path of the output file, relative to this package. | none |
| <a id="write_file-content"></a>content | A list of strings. Lines of text, the contents of the file. Newlines are added automatically after every line except the last one. | <code>[]</code> |
| <a id="write_file-is_executable"></a>is_executable | A boolean. Whether to make the output file executable. When True, the rule's output can be executed using <code>bazel run</code> and can be in the srcs of binary and test rules that require executable sources. | <code>False</code> |
| <a id="write_file-newline"></a>newline | one of ["auto", "unix", "windows"]: line endings to use. "auto" for platform-determined, "unix" for LF, and "windows" for CRLF. | <code>"auto"</code> |
| <a id="write_file-kwargs"></a>kwargs | further keyword arguments, e.g. &lt;code&gt;visibility&lt;/code&gt; | none |

View file

@ -1,27 +0,0 @@
# Copyright 2019 The Bazel Authors. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""Dependencies that are needed for running skylib tests."""
load(
"@bazel_federation//:repositories.bzl",
"bazel",
"bazel_stardoc",
"rules_pkg",
)
def bazel_skylib_internal_deps():
bazel()
bazel_stardoc()
rules_pkg()

View file

@ -1,18 +0,0 @@
# Copyright 2019 The Bazel Authors. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""Setup function that must be invoked before running skylib tests."""
def bazel_skylib_internal_setup():
pass # placeholder function for the federation