From 24b246a7a884eb6963f5dfa0f22d82c371e51984 Mon Sep 17 00:00:00 2001 From: Justin Yun Date: Thu, 16 Mar 2023 10:36:16 +0900 Subject: 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 --- rust/rust.go | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'rust/rust.go') 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: -- cgit v1.2.3-59-g8ed1b