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
diff --git a/rust/compiler.go b/rust/compiler.go
index 3f02835..85e8ba6 100644
--- a/rust/compiler.go
+++ b/rust/compiler.go
@@ -18,9 +18,10 @@
"fmt"
"path/filepath"
+ "github.com/google/blueprint/proptools"
+
"android/soong/android"
"android/soong/rust/config"
- "github.com/google/blueprint/proptools"
)
func getEdition(compiler *baseCompiler) string {
@@ -64,7 +65,7 @@
// list of C static library dependencies
Static_libs []string `android:"arch_variant"`
- // crate name (defaults to module name); if library, this must be the expected extern crate name
+ // crate name, required for libraries. This must be the expected extern crate name used in source
Crate_name string `android:"arch_variant"`
// list of features to enable for this crate
@@ -207,6 +208,7 @@
return stem
}
+
func (compiler *baseCompiler) relativeInstallPath() string {
return String(compiler.Properties.Relative_install_path)
}