diff options
-rw-r--r-- | README.md | 1 | ||||
-rw-r--r-- | rules/cargo/RULES | 21 |
2 files changed, 19 insertions, 3 deletions
@@ -160,6 +160,7 @@ provided by the "defaults" for the "HOST_ARCH". | `"defaults"` | The Rust toolchain to use. | | `"deps"` | Any other libraries this binary depends upon. | | `"edition"` | The edition of the compiler to use during compilation. If unset, 2015 is used. | +| `"extra_data"` | Extra files needed while running the build script. | | `"name"` | The name of the crate being built. | | `"pkg_name"` | The name of the package the crate belongs to. It is exported to the CARGO_PKG_NAME environment variable. | | `"srcs"` | The source files of the binary. | diff --git a/rules/cargo/RULES b/rules/cargo/RULES index 59ef326..dd48c4d 100644 --- a/rules/cargo/RULES +++ b/rules/cargo/RULES @@ -8,7 +8,8 @@ , "provided by the \"defaults\" for the \"HOST_ARCH\"." ] , "string_fields": ["name", "edition", "stage", "version", "pkg_name"] - , "target_fields": ["crate_root", "srcs", "deps", "cargo_features"] + , "target_fields": + ["crate_root", "srcs", "deps", "cargo_features", "extra_data"] , "field_doc": { "name": ["The name of the crate being built."] , "cargo_features": @@ -37,6 +38,7 @@ , "three elements are used for the major, minor, and patch" , "number respectively." ] + , "extra_data": ["Extra files needed while running the build script."] } , "config_vars": ["ARCH", "HOST_ARCH", "ENV"] , "config_doc": @@ -68,7 +70,7 @@ { "call rustc artifact": ["./", "../rust", "call rustc artifact"] , "for host": ["./", "../rust", "for host"] , "for host as rlib": ["./", "../rust", "for host as rlib"] - , "get_runfiles": ["./", "..", "get_runfiles"] + , "get_artifacts": ["./", "..", "get_artifacts"] } , "implicit": {"defaults": [["./", "../rust", "defaults"]]} , "expression": @@ -134,6 +136,13 @@ , "map": {"type": "var", "name": "artifact result"} } ] + , [ "extra_data" + , { "type": "let*" + , "bindings": + [["field_content", {"type": "FIELD", "name": "extra_data"}]] + , "body": {"type": "CALL_EXPRESSION", "name": "get_artifacts"} + } + ] , [ "out_name" , { "type": "join" , "$1": [{"type": "var", "name": "stage"}, "out"] @@ -143,7 +152,13 @@ , [ "out" , { "type": "ACTION" , "outs": [{"type": "var", "name": "out_name"}] - , "inputs": {"type": "var", "name": "exe"} + , "inputs": + { "type": "map_union" + , "$1": + [ {"type": "var", "name": "extra_data"} + , {"type": "var", "name": "exe"} + ] + } , "cmd": [ "sh" , "-ce" |