-
Notifications
You must be signed in to change notification settings - Fork 181
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Copy rules_directory to bazel-skylib.
Original implementation is at https://github.com/matts1/rules_directory
- Loading branch information
Showing
27 changed files
with
1,607 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
<!-- Generated with Stardoc: http://skydoc.bazel.build --> | ||
|
||
Skylib module containing rules to create metadata about directories. | ||
|
||
<a id="directory"></a> | ||
|
||
## directory | ||
|
||
<pre> | ||
directory(<a href="#directory-name">name</a>, <a href="#directory-srcs">srcs</a>, <a href="#directory-kwargs">kwargs</a>) | ||
</pre> | ||
|
||
A marker for a bazel directory and its contents. | ||
|
||
Example usage: | ||
directory( | ||
name = "foo", | ||
srcs = glob( | ||
["**/*"], | ||
exclude=["BUILD.bazel", "WORKSPACE.bazel", "MODULE.bazel"]) | ||
) | ||
) | ||
|
||
|
||
**PARAMETERS** | ||
|
||
|
||
| Name | Description | Default Value | | ||
| :------------- | :------------- | :------------- | | ||
| <a id="directory-name"></a>name | (str) The name of the label. | none | | ||
| <a id="directory-srcs"></a>srcs | (List[Label\|File]) The files contained within this directory and subdirectories.", | `[]` | | ||
| <a id="directory-kwargs"></a>kwargs | Kwargs to be passed to the underlying rule. | none | | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
<!-- Generated with Stardoc: http://skydoc.bazel.build --> | ||
|
||
Rules to filter files from a directory. | ||
|
||
<a id="directory_filter"></a> | ||
|
||
## directory_filter | ||
|
||
<pre> | ||
directory_filter(<a href="#directory_filter-name">name</a>, <a href="#directory_filter-srcs">srcs</a>, <a href="#directory_filter-data">data</a>, <a href="#directory_filter-directory">directory</a>) | ||
</pre> | ||
|
||
Extracts files from a directory by relative path. | ||
|
||
Usage: | ||
|
||
``` | ||
directory_filter( | ||
name = "clang", | ||
directory = "//:sysroot", | ||
srcs = ["usr/bin/clang"], | ||
data = ["lib/libc.so.6"], | ||
) | ||
``` | ||
|
||
**ATTRIBUTES** | ||
|
||
|
||
| Name | Description | Type | Mandatory | Default | | ||
| :------------- | :------------- | :------------- | :------------- | :------------- | | ||
| <a id="directory_filter-name"></a>name | A unique name for this target. | <a href="https://bazel.build/concepts/labels#target-names">Name</a> | required | | | ||
| <a id="directory_filter-srcs"></a>srcs | A list of relative paths to files within the directory to put in the runfiles.<br><br>For example, `srcs = ["foo/bar"]` would collect the file at `<directory>/foo/bar` into the files. | List of strings | optional | `[]` | | ||
| <a id="directory_filter-data"></a>data | A list of relative paths to files within the directory to put in the files.<br><br>For example, `data = ["foo/bar"]` would collect the file at `<directory>/foo/bar` into the runfiles. | List of strings | optional | `[]` | | ||
| <a id="directory_filter-directory"></a>directory | - | <a href="https://bazel.build/concepts/labels">Label</a> | required | | | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
<!-- Generated with Stardoc: http://skydoc.bazel.build --> | ||
|
||
Rules to filter files from a directory. | ||
|
||
<a id="directory_glob"></a> | ||
|
||
## directory_glob | ||
|
||
<pre> | ||
directory_glob(<a href="#directory_glob-name">name</a>, <a href="#directory_glob-srcs">srcs</a>, <a href="#directory_glob-data">data</a>, <a href="#directory_glob-allow_empty">allow_empty</a>, <a href="#directory_glob-directory">directory</a>, <a href="#directory_glob-exclude">exclude</a>) | ||
</pre> | ||
|
||
globs files from a directory by relative path. | ||
|
||
Usage: | ||
|
||
``` | ||
directory_glob( | ||
name = "foo", | ||
directory = ":directory", | ||
srcs = ["foo/bar"], | ||
data = ["foo/**"], | ||
exclude = ["foo/**/*.h"] | ||
) | ||
``` | ||
|
||
**ATTRIBUTES** | ||
|
||
|
||
| Name | Description | Type | Mandatory | Default | | ||
| :------------- | :------------- | :------------- | :------------- | :------------- | | ||
| <a id="directory_glob-name"></a>name | A unique name for this target. | <a href="https://bazel.build/concepts/labels#target-names">Name</a> | required | | | ||
| <a id="directory_glob-srcs"></a>srcs | A list of globs to files within the directory to put in the files.<br><br>For example, `srcs = ["foo/**"]` would collect the file at `<directory>/foo` into the files. | List of strings | optional | `[]` | | ||
| <a id="directory_glob-data"></a>data | A list of globs to files within the directory to put in the runfiles.<br><br>For example, `data = ["foo/**"]` would collect all files contained within `<directory>/foo` into the runfiles. | List of strings | optional | `[]` | | ||
| <a id="directory_glob-allow_empty"></a>allow_empty | If true, allows globs to not match anything. | Boolean | optional | `False` | | ||
| <a id="directory_glob-directory"></a>directory | - | <a href="https://bazel.build/concepts/labels">Label</a> | required | | | ||
| <a id="directory_glob-exclude"></a>exclude | A list of globs to files within the directory to exclude from the files and runfiles. | List of strings | optional | `[]` | | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
<!-- Generated with Stardoc: http://skydoc.bazel.build --> | ||
|
||
Skylib module containing providers for directories. | ||
|
||
<a id="DirectoryInfo"></a> | ||
|
||
## DirectoryInfo | ||
|
||
<pre> | ||
DirectoryInfo(<a href="#DirectoryInfo-entries">entries</a>, <a href="#DirectoryInfo-transitive_files">transitive_files</a>, <a href="#DirectoryInfo-source_path">source_path</a>, <a href="#DirectoryInfo-generated_path">generated_path</a>, <a href="#DirectoryInfo-human_readable">human_readable</a>) | ||
</pre> | ||
|
||
Information about a directory | ||
|
||
**FIELDS** | ||
|
||
|
||
| Name | Description | | ||
| :------------- | :------------- | | ||
| <a id="DirectoryInfo-entries"></a>entries | (Dict[str, Either[File, DirectoryInfo]]) The entries contained directly within. Ordered by filename | | ||
| <a id="DirectoryInfo-transitive_files"></a>transitive_files | (depset[File]) All files transitively contained within this directory. | | ||
| <a id="DirectoryInfo-source_path"></a>source_path | (Optional[string]) Path to all source files contained within this directory. Only provided if the directory actually contains source files. | | ||
| <a id="DirectoryInfo-generated_path"></a>generated_path | (Optional[string]) Path to all generated files contained within this directory. Only provided if the directory actually contains generated files. | | ||
| <a id="DirectoryInfo-human_readable"></a>human_readable | (string) A human readable identifier for a directory. Useful for providing error messages to a user. | | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
<!-- Generated with Stardoc: http://skydoc.bazel.build --> | ||
|
||
Skylib module containing rules to create metadata about subdirectories. | ||
|
||
<a id="subdirectory"></a> | ||
|
||
## subdirectory | ||
|
||
<pre> | ||
subdirectory(<a href="#subdirectory-name">name</a>, <a href="#subdirectory-parent">parent</a>, <a href="#subdirectory-path">path</a>) | ||
</pre> | ||
|
||
|
||
|
||
**ATTRIBUTES** | ||
|
||
|
||
| Name | Description | Type | Mandatory | Default | | ||
| :------------- | :------------- | :------------- | :------------- | :------------- | | ||
| <a id="subdirectory-name"></a>name | A unique name for this target. | <a href="https://bazel.build/concepts/labels#target-names">Name</a> | required | | | ||
| <a id="subdirectory-parent"></a>parent | A label corresponding to the parent directory. | <a href="https://bazel.build/concepts/labels">Label</a> | required | | | ||
| <a id="subdirectory-path"></a>path | A path relative to the parent directory | String | required | | | ||
|
||
|
Oops, something went wrong.