diff options
author | 2021-08-12 17:05:39 +0000 | |
---|---|---|
committer | 2021-08-12 17:05:39 +0000 | |
commit | dd7107c84b12a367329334e3e8514d9da75174e2 (patch) | |
tree | f6064de1251e336daca0712090c8d9ddc1ded77b /rust/compiler.go | |
parent | fc30cfc7ae35ac92d2e7b423b23c1bba8fa3f005 (diff) | |
parent | a9a1fc07473ef512d3ae84f4c368d5e3752649e6 (diff) |
Merge "rust: Add support to emit certain Cargo env vars."
Diffstat (limited to 'rust/compiler.go')
-rw-r--r-- | rust/compiler.go | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/rust/compiler.go b/rust/compiler.go index de59f39ac..6b3ccfcfa 100644 --- a/rust/compiler.go +++ b/rust/compiler.go @@ -154,6 +154,14 @@ type BaseCompilerProperties struct { // linkage if all dependencies of the root binary module do not link against libstd\ // the same way. Prefer_rlib *bool `android:"arch_variant"` + + // Enables emitting certain Cargo environment variables. Only intended to be used for compatibility purposes. + // Will set CARGO_CRATE_NAME to the crate_name property's value. + // Will set CARGO_BIN_NAME to the output filename value without the extension. + Cargo_env_compat *bool + + // If cargo_env_compat is true, sets the CARGO_PKG_VERSION env var to this value. + Cargo_pkg_version *string } type baseCompiler struct { @@ -309,6 +317,14 @@ func (compiler *baseCompiler) CargoOutDir() android.OptionalPath { return android.OptionalPathForPath(compiler.cargoOutDir) } +func (compiler *baseCompiler) CargoEnvCompat() bool { + return Bool(compiler.Properties.Cargo_env_compat) +} + +func (compiler *baseCompiler) CargoPkgVersion() string { + return String(compiler.Properties.Cargo_pkg_version) +} + func (compiler *baseCompiler) strippedOutputFilePath() android.OptionalPath { return compiler.strippedOutputFile } |