summaryrefslogtreecommitdiff
path: root/rust/builder.go
diff options
context:
space:
mode:
author Ivan Lozano <ivanlozano@google.com> 2019-10-31 19:38:29 -0700
committer Ivan Lozano <ivanlozano@google.com> 2019-11-04 09:20:08 -0800
commitad8b18b87260a83aeadb28d637f77474158fcdb1 (patch)
tree0362797ca4b2cf0d34eb14ad3cfd0ed61ad67dc0 /rust/builder.go
parent5d0b3b7195e35199f48bc8cd685f0b5786487cfe (diff)
Enforce correct rust library file names.
rustc expects libraries and proc_macro filenames to conform to a particular format, alphanumeric with underscores and lib${crate_name}.*. Enforce this with a check when getStem() is called. This makes the crate_name property required for proc_macros and libraries. This also removes the notion of a default crate name derived from the module name. It's not needed for binaries, so this won't impact them. Bug: 143579265 Test: m -j crosvm.experimental Change-Id: I2770cf7d02dd4291c3d240d58d242b940098dcee
Diffstat (limited to 'rust/builder.go')
-rw-r--r--rust/builder.go4
1 files changed, 3 insertions, 1 deletions
diff --git a/rust/builder.go b/rust/builder.go
index 2a7643d62..d9e36dbbe 100644
--- a/rust/builder.go
+++ b/rust/builder.go
@@ -88,7 +88,9 @@ func transformSrctoCrate(ctx android.ModuleContext, main android.Path,
rustcFlags = append(rustcFlags, flags.GlobalRustFlags...)
rustcFlags = append(rustcFlags, flags.RustFlags...)
rustcFlags = append(rustcFlags, "--crate-type="+crate_type)
- rustcFlags = append(rustcFlags, "--crate-name="+crate_name)
+ if crate_name != "" {
+ rustcFlags = append(rustcFlags, "--crate-name="+crate_name)
+ }
if targetTriple != "" {
rustcFlags = append(rustcFlags, "--target="+targetTriple)
linkFlags = append(linkFlags, "-target "+targetTriple)