From cb974e9a6ecc709606f47502f83fba45761316f2 Mon Sep 17 00:00:00 2001 From: Krasimir Georgiev Date: Thu, 19 Oct 2023 15:43:47 +0200 Subject: [PATCH] add compile_data attr to cargo_build_script (#2203) No functional changes intended. Before https://github.com/bazelbuild/rules_rust/commit/3e124fb9f5fb91554908fd7fb82d10c378ee4ca8 this was implicitly handled by passing **binary_kwargs to the rust_binary, now we're making this explicit. --- cargo/private/cargo_build_script_wrapper.bzl | 3 +++ docs/cargo.md | 5 +++-- docs/flatten.md | 5 +++-- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/cargo/private/cargo_build_script_wrapper.bzl b/cargo/private/cargo_build_script_wrapper.bzl index 579630fa5a..c82ffdb15d 100644 --- a/cargo/private/cargo_build_script_wrapper.bzl +++ b/cargo/private/cargo_build_script_wrapper.bzl @@ -21,6 +21,7 @@ def cargo_build_script( proc_macro_deps = [], build_script_env = {}, data = [], + compile_data = [], tools = [], links = None, rundir = None, @@ -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. @@ -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, diff --git a/docs/cargo.md b/docs/cargo.md index 15cf0280e0..193ed08fbd 100644 --- a/docs/cargo.md +++ b/docs/cargo.md @@ -65,8 +65,8 @@ A rule for generating variables for dependent `cargo_build_script`s without a bu
 cargo_build_script(name, edition, crate_name, crate_root, srcs, crate_features, version, deps,
-                   link_deps, proc_macro_deps, build_script_env, data, tools, links, rundir,
-                   rustc_env, rustc_flags, visibility, tags, aliases, kwargs)
+                   link_deps, proc_macro_deps, build_script_env, data, compile_data, tools, links,
+                   rundir, rustc_env, rustc_flags, visibility, tags, aliases, kwargs)
 
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 | proc_macro_deps | List of rust_proc_macro targets used to build the script. | `[]` | | build_script_env | Environment variables for build scripts. | `{}` | | data | Files needed by the build script. | `[]` | +| compile_data | Files needed for the compilation of the build script. | `[]` | | tools | Tools (executables) needed by the build script. | `[]` | | links | Name of the native library this crate links against. | `None` | | rundir | A directory to cd to before the cargo_build_script is run. This should be a path relative to the exec root.

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.

If set to ., the cargo build script will run in the exec root. | `None` | diff --git a/docs/flatten.md b/docs/flatten.md index 03a23a9183..e089ec5997 100644 --- a/docs/flatten.md +++ b/docs/flatten.md @@ -1546,8 +1546,8 @@ A collection of files either found within the `rust-stdlib` artifact or generate
 cargo_build_script(name, edition, crate_name, crate_root, srcs, crate_features, version, deps,
-                   link_deps, proc_macro_deps, build_script_env, data, tools, links, rundir,
-                   rustc_env, rustc_flags, visibility, tags, aliases, kwargs)
+                   link_deps, proc_macro_deps, build_script_env, data, compile_data, tools, links,
+                   rundir, rustc_env, rustc_flags, visibility, tags, aliases, kwargs)
 
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 | proc_macro_deps | List of rust_proc_macro targets used to build the script. | `[]` | | build_script_env | Environment variables for build scripts. | `{}` | | data | Files needed by the build script. | `[]` | +| compile_data | Files needed for the compilation of the build script. | `[]` | | tools | Tools (executables) needed by the build script. | `[]` | | links | Name of the native library this crate links against. | `None` | | rundir | A directory to cd to before the cargo_build_script is run. This should be a path relative to the exec root.

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.

If set to ., the cargo build script will run in the exec root. | `None` |