Skip to content

Commit cb974e9

Browse files
authored
add compile_data attr to cargo_build_script (#2203)
No functional changes intended. Before 3e124fb this was implicitly handled by passing **binary_kwargs to the rust_binary, now we're making this explicit.
1 parent bd8c36a commit cb974e9

File tree

3 files changed

+9
-4
lines changed

3 files changed

+9
-4
lines changed

cargo/private/cargo_build_script_wrapper.bzl

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ def cargo_build_script(
2121
proc_macro_deps = [],
2222
build_script_env = {},
2323
data = [],
24+
compile_data = [],
2425
tools = [],
2526
links = None,
2627
rundir = None,
@@ -103,6 +104,7 @@ def cargo_build_script(
103104
proc_macro_deps (list of label, optional): List of rust_proc_macro targets used to build the script.
104105
build_script_env (dict, optional): Environment variables for build scripts.
105106
data (list, optional): Files needed by the build script.
107+
compile_data (list, optional): Files needed for the compilation of the build script.
106108
tools (list, optional): Tools (executables) needed by the build script.
107109
links (str, optional): Name of the native library this crate links against.
108110
rundir (str, optional): A directory to `cd` to before the cargo_build_script is run. This should be a path relative to the exec root.
@@ -145,6 +147,7 @@ def cargo_build_script(
145147
deps = deps,
146148
proc_macro_deps = proc_macro_deps,
147149
data = data,
150+
compile_data = compile_data,
148151
rustc_env = rustc_env,
149152
rustc_flags = rustc_flags,
150153
edition = edition,

docs/cargo.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,8 @@ A rule for generating variables for dependent `cargo_build_script`s without a bu
6565

6666
<pre>
6767
cargo_build_script(<a href="#cargo_build_script-name">name</a>, <a href="#cargo_build_script-edition">edition</a>, <a href="#cargo_build_script-crate_name">crate_name</a>, <a href="#cargo_build_script-crate_root">crate_root</a>, <a href="#cargo_build_script-srcs">srcs</a>, <a href="#cargo_build_script-crate_features">crate_features</a>, <a href="#cargo_build_script-version">version</a>, <a href="#cargo_build_script-deps">deps</a>,
68-
<a href="#cargo_build_script-link_deps">link_deps</a>, <a href="#cargo_build_script-proc_macro_deps">proc_macro_deps</a>, <a href="#cargo_build_script-build_script_env">build_script_env</a>, <a href="#cargo_build_script-data">data</a>, <a href="#cargo_build_script-tools">tools</a>, <a href="#cargo_build_script-links">links</a>, <a href="#cargo_build_script-rundir">rundir</a>,
69-
<a href="#cargo_build_script-rustc_env">rustc_env</a>, <a href="#cargo_build_script-rustc_flags">rustc_flags</a>, <a href="#cargo_build_script-visibility">visibility</a>, <a href="#cargo_build_script-tags">tags</a>, <a href="#cargo_build_script-aliases">aliases</a>, <a href="#cargo_build_script-kwargs">kwargs</a>)
68+
<a href="#cargo_build_script-link_deps">link_deps</a>, <a href="#cargo_build_script-proc_macro_deps">proc_macro_deps</a>, <a href="#cargo_build_script-build_script_env">build_script_env</a>, <a href="#cargo_build_script-data">data</a>, <a href="#cargo_build_script-compile_data">compile_data</a>, <a href="#cargo_build_script-tools">tools</a>, <a href="#cargo_build_script-links">links</a>,
69+
<a href="#cargo_build_script-rundir">rundir</a>, <a href="#cargo_build_script-rustc_env">rustc_env</a>, <a href="#cargo_build_script-rustc_flags">rustc_flags</a>, <a href="#cargo_build_script-visibility">visibility</a>, <a href="#cargo_build_script-tags">tags</a>, <a href="#cargo_build_script-aliases">aliases</a>, <a href="#cargo_build_script-kwargs">kwargs</a>)
7070
</pre>
7171

7272
Compile and execute a rust build script to generate build attributes
@@ -144,6 +144,7 @@ The `hello_lib` target will be build with the flags and the environment variable
144144
| <a id="cargo_build_script-proc_macro_deps"></a>proc_macro_deps | List of rust_proc_macro targets used to build the script. | `[]` |
145145
| <a id="cargo_build_script-build_script_env"></a>build_script_env | Environment variables for build scripts. | `{}` |
146146
| <a id="cargo_build_script-data"></a>data | Files needed by the build script. | `[]` |
147+
| <a id="cargo_build_script-compile_data"></a>compile_data | Files needed for the compilation of the build script. | `[]` |
147148
| <a id="cargo_build_script-tools"></a>tools | Tools (executables) needed by the build script. | `[]` |
148149
| <a id="cargo_build_script-links"></a>links | Name of the native library this crate links against. | `None` |
149150
| <a id="cargo_build_script-rundir"></a>rundir | A directory to <code>cd</code> to before the cargo_build_script is run. This should be a path relative to the exec root.<br><br>The default behaviour (and the behaviour if rundir is set to the empty string) is to change to the relative path corresponding to the cargo manifest directory, which replicates the normal behaviour of cargo so it is easy to write compatible build scripts.<br><br>If set to <code>.</code>, the cargo build script will run in the exec root. | `None` |

docs/flatten.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1546,8 +1546,8 @@ A collection of files either found within the `rust-stdlib` artifact or generate
15461546

15471547
<pre>
15481548
cargo_build_script(<a href="#cargo_build_script-name">name</a>, <a href="#cargo_build_script-edition">edition</a>, <a href="#cargo_build_script-crate_name">crate_name</a>, <a href="#cargo_build_script-crate_root">crate_root</a>, <a href="#cargo_build_script-srcs">srcs</a>, <a href="#cargo_build_script-crate_features">crate_features</a>, <a href="#cargo_build_script-version">version</a>, <a href="#cargo_build_script-deps">deps</a>,
1549-
<a href="#cargo_build_script-link_deps">link_deps</a>, <a href="#cargo_build_script-proc_macro_deps">proc_macro_deps</a>, <a href="#cargo_build_script-build_script_env">build_script_env</a>, <a href="#cargo_build_script-data">data</a>, <a href="#cargo_build_script-tools">tools</a>, <a href="#cargo_build_script-links">links</a>, <a href="#cargo_build_script-rundir">rundir</a>,
1550-
<a href="#cargo_build_script-rustc_env">rustc_env</a>, <a href="#cargo_build_script-rustc_flags">rustc_flags</a>, <a href="#cargo_build_script-visibility">visibility</a>, <a href="#cargo_build_script-tags">tags</a>, <a href="#cargo_build_script-aliases">aliases</a>, <a href="#cargo_build_script-kwargs">kwargs</a>)
1549+
<a href="#cargo_build_script-link_deps">link_deps</a>, <a href="#cargo_build_script-proc_macro_deps">proc_macro_deps</a>, <a href="#cargo_build_script-build_script_env">build_script_env</a>, <a href="#cargo_build_script-data">data</a>, <a href="#cargo_build_script-compile_data">compile_data</a>, <a href="#cargo_build_script-tools">tools</a>, <a href="#cargo_build_script-links">links</a>,
1550+
<a href="#cargo_build_script-rundir">rundir</a>, <a href="#cargo_build_script-rustc_env">rustc_env</a>, <a href="#cargo_build_script-rustc_flags">rustc_flags</a>, <a href="#cargo_build_script-visibility">visibility</a>, <a href="#cargo_build_script-tags">tags</a>, <a href="#cargo_build_script-aliases">aliases</a>, <a href="#cargo_build_script-kwargs">kwargs</a>)
15511551
</pre>
15521552

15531553
Compile and execute a rust build script to generate build attributes
@@ -1625,6 +1625,7 @@ The `hello_lib` target will be build with the flags and the environment variable
16251625
| <a id="cargo_build_script-proc_macro_deps"></a>proc_macro_deps | List of rust_proc_macro targets used to build the script. | `[]` |
16261626
| <a id="cargo_build_script-build_script_env"></a>build_script_env | Environment variables for build scripts. | `{}` |
16271627
| <a id="cargo_build_script-data"></a>data | Files needed by the build script. | `[]` |
1628+
| <a id="cargo_build_script-compile_data"></a>compile_data | Files needed for the compilation of the build script. | `[]` |
16281629
| <a id="cargo_build_script-tools"></a>tools | Tools (executables) needed by the build script. | `[]` |
16291630
| <a id="cargo_build_script-links"></a>links | Name of the native library this crate links against. | `None` |
16301631
| <a id="cargo_build_script-rundir"></a>rundir | A directory to <code>cd</code> to before the cargo_build_script is run. This should be a path relative to the exec root.<br><br>The default behaviour (and the behaviour if rundir is set to the empty string) is to change to the relative path corresponding to the cargo manifest directory, which replicates the normal behaviour of cargo so it is easy to write compatible build scripts.<br><br>If set to <code>.</code>, the cargo build script will run in the exec root. | `None` |

0 commit comments

Comments
 (0)