Skip to content

Commit

Permalink
add compile_data attr to cargo_build_script (#2203)
Browse files Browse the repository at this point in the history
No functional changes intended.

Before
3e124fb
this was implicitly handled by passing **binary_kwargs to the
rust_binary, now we're making this explicit.
  • Loading branch information
krasimirgg authored Oct 19, 2023
1 parent bd8c36a commit cb974e9
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
3 changes: 3 additions & 0 deletions cargo/private/cargo_build_script_wrapper.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ def cargo_build_script(
proc_macro_deps = [],
build_script_env = {},
data = [],
compile_data = [],
tools = [],
links = None,
rundir = None,
Expand Down Expand Up @@ -103,6 +104,7 @@ def cargo_build_script(
proc_macro_deps (list of label, optional): List of rust_proc_macro targets used to build the script.
build_script_env (dict, optional): Environment variables for build scripts.
data (list, optional): Files needed by the build script.
compile_data (list, optional): Files needed for the compilation of the build script.
tools (list, optional): Tools (executables) needed by the build script.
links (str, optional): Name of the native library this crate links against.
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.
Expand Down Expand Up @@ -145,6 +147,7 @@ def cargo_build_script(
deps = deps,
proc_macro_deps = proc_macro_deps,
data = data,
compile_data = compile_data,
rustc_env = rustc_env,
rustc_flags = rustc_flags,
edition = edition,
Expand Down
5 changes: 3 additions & 2 deletions docs/cargo.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,8 @@ A rule for generating variables for dependent `cargo_build_script`s without a bu

<pre>
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>,
<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>,
<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>)
<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>,
<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>)
</pre>

Compile and execute a rust build script to generate build attributes
Expand Down Expand Up @@ -144,6 +144,7 @@ The `hello_lib` target will be build with the flags and the environment variable
| <a id="cargo_build_script-proc_macro_deps"></a>proc_macro_deps | List of rust_proc_macro targets used to build the script. | `[]` |
| <a id="cargo_build_script-build_script_env"></a>build_script_env | Environment variables for build scripts. | `{}` |
| <a id="cargo_build_script-data"></a>data | Files needed by the build script. | `[]` |
| <a id="cargo_build_script-compile_data"></a>compile_data | Files needed for the compilation of the build script. | `[]` |
| <a id="cargo_build_script-tools"></a>tools | Tools (executables) needed by the build script. | `[]` |
| <a id="cargo_build_script-links"></a>links | Name of the native library this crate links against. | `None` |
| <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` |
Expand Down
5 changes: 3 additions & 2 deletions docs/flatten.md
Original file line number Diff line number Diff line change
Expand Up @@ -1546,8 +1546,8 @@ A collection of files either found within the `rust-stdlib` artifact or generate

<pre>
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>,
<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>,
<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>)
<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>,
<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>)
</pre>

Compile and execute a rust build script to generate build attributes
Expand Down Expand Up @@ -1625,6 +1625,7 @@ The `hello_lib` target will be build with the flags and the environment variable
| <a id="cargo_build_script-proc_macro_deps"></a>proc_macro_deps | List of rust_proc_macro targets used to build the script. | `[]` |
| <a id="cargo_build_script-build_script_env"></a>build_script_env | Environment variables for build scripts. | `{}` |
| <a id="cargo_build_script-data"></a>data | Files needed by the build script. | `[]` |
| <a id="cargo_build_script-compile_data"></a>compile_data | Files needed for the compilation of the build script. | `[]` |
| <a id="cargo_build_script-tools"></a>tools | Tools (executables) needed by the build script. | `[]` |
| <a id="cargo_build_script-links"></a>links | Name of the native library this crate links against. | `None` |
| <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` |
Expand Down

0 comments on commit cb974e9

Please sign in to comment.