summaryrefslogtreecommitdiff
path: root/rust/rust.go
diff options
context:
space:
mode:
author Justin Yun <justinyun@google.com> 2023-03-16 10:36:16 +0900
committer Justin Yun <justinyun@google.com> 2023-03-16 11:05:41 +0900
commit24b246a7a884eb6963f5dfa0f22d82c371e51984 (patch)
tree4db5d8f8f600db6b987890fab886962293049a9c /rust/rust.go
parenteabe937355676de6490cfa6804b279e66919a252 (diff)
Fix the make name of rust snapshots
Rust snapshot must have proper suffix for androidmk to avoid conflict with the existing modules. Bug: 230780263 Bug: 235895567 Test: m nothing Change-Id: I35794196553621cd722c067d7965b2a61aa351bd
Diffstat (limited to 'rust/rust.go')
-rw-r--r--rust/rust.go13
1 files changed, 12 insertions, 1 deletions
diff --git a/rust/rust.go b/rust/rust.go
index 8a13ba364..a200617de 100644
--- a/rust/rust.go
+++ b/rust/rust.go
@@ -1111,6 +1111,17 @@ func (mod *Module) Prebuilt() *android.Prebuilt {
return nil
}
+func rustMakeLibName(ctx android.ModuleContext, c cc.LinkableInterface, dep cc.LinkableInterface, depName string) string {
+ if rustDep, ok := dep.(*Module); ok {
+ // Use base module name for snapshots when exporting to Makefile.
+ if snapshotPrebuilt, ok := rustDep.compiler.(cc.SnapshotInterface); ok {
+ baseName := rustDep.BaseModuleName()
+ return baseName + snapshotPrebuilt.SnapshotAndroidMkSuffix() + rustDep.AndroidMkSuffix()
+ }
+ }
+ return cc.MakeLibName(ctx, c, dep, depName)
+}
+
func (mod *Module) depsToPaths(ctx android.ModuleContext) PathDeps {
var depPaths PathDeps
@@ -1142,7 +1153,7 @@ func (mod *Module) depsToPaths(ctx android.ModuleContext) PathDeps {
if rustDep, ok := dep.(*Module); ok && !rustDep.CcLibraryInterface() {
//Handle Rust Modules
- makeLibName := cc.MakeLibName(ctx, mod, rustDep, depName+rustDep.Properties.RustSubName)
+ makeLibName := rustMakeLibName(ctx, mod, rustDep, depName+rustDep.Properties.RustSubName)
switch depTag {
case dylibDepTag: