summaryrefslogtreecommitdiff
path: root/rust/rust.go
diff options
context:
space:
mode:
author Cole Faust <colefaust@google.com> 2023-08-22 19:26:14 +0000
committer Gerrit Code Review <noreply-gerritcodereview@google.com> 2023-08-22 19:26:14 +0000
commit1311c1af27e76d365062772acfe1d79e19219de1 (patch)
tree58900e8288c82a11f155b5e2d56a894dd4797427 /rust/rust.go
parent962bcdb18e18b3b1a3c87b79d3c97a36eae9ad65 (diff)
parentb6e6f99521cee714c066fa33369d8d38f5cca17a (diff)
Merge "Add transitive shared libs to LOCAL_SHARED_LIBRARIES for rust modules" into main
Diffstat (limited to 'rust/rust.go')
-rw-r--r--rust/rust.go12
1 files changed, 10 insertions, 2 deletions
diff --git a/rust/rust.go b/rust/rust.go
index fc8db8655..689ff38c0 100644
--- a/rust/rust.go
+++ b/rust/rust.go
@@ -66,7 +66,6 @@ type BaseProperties struct {
AndroidMkRlibs []string `blueprint:"mutated"`
AndroidMkDylibs []string `blueprint:"mutated"`
AndroidMkProcMacroLibs []string `blueprint:"mutated"`
- AndroidMkSharedLibs []string `blueprint:"mutated"`
AndroidMkStaticLibs []string `blueprint:"mutated"`
ImageVariationPrefix string `blueprint:"mutated"`
@@ -168,6 +167,8 @@ type Module struct {
// For apex variants, this is set as apex.min_sdk_version
apexSdkVersion android.ApiLevel
+
+ transitiveAndroidMkSharedLibs *android.DepSet[string]
}
func (mod *Module) Header() bool {
@@ -1218,6 +1219,9 @@ func (mod *Module) depsToPaths(ctx android.ModuleContext) PathDeps {
})
}
+ var transitiveAndroidMkSharedLibs []*android.DepSet[string]
+ var directAndroidMkSharedLibs []string
+
ctx.VisitDirectDeps(func(dep android.Module) {
depName := ctx.OtherModuleName(dep)
depTag := ctx.OtherModuleDependencyTag(dep)
@@ -1261,6 +1265,8 @@ func (mod *Module) depsToPaths(ctx android.ModuleContext) PathDeps {
mod.Properties.AndroidMkProcMacroLibs = append(mod.Properties.AndroidMkProcMacroLibs, makeLibName)
}
+ transitiveAndroidMkSharedLibs = append(transitiveAndroidMkSharedLibs, rustDep.transitiveAndroidMkSharedLibs)
+
if android.IsSourceDepTagWithOutputTag(depTag, "") {
// Since these deps are added in path_properties.go via AddDependencies, we need to ensure the correct
// OS/Arch variant is used.
@@ -1388,7 +1394,7 @@ func (mod *Module) depsToPaths(ctx android.ModuleContext) PathDeps {
// Record baseLibName for snapshots.
mod.Properties.SnapshotSharedLibs = append(mod.Properties.SnapshotSharedLibs, cc.BaseLibName(depName))
- mod.Properties.AndroidMkSharedLibs = append(mod.Properties.AndroidMkSharedLibs, makeLibName)
+ directAndroidMkSharedLibs = append(directAndroidMkSharedLibs, makeLibName)
exportDep = true
case cc.IsHeaderDepTag(depTag):
exportedInfo := ctx.OtherModuleProvider(dep, cc.FlagExporterInfoProvider).(cc.FlagExporterInfo)
@@ -1425,6 +1431,8 @@ func (mod *Module) depsToPaths(ctx android.ModuleContext) PathDeps {
}
})
+ mod.transitiveAndroidMkSharedLibs = android.NewDepSet[string](android.PREORDER, directAndroidMkSharedLibs, transitiveAndroidMkSharedLibs)
+
var rlibDepFiles RustLibraries
for _, dep := range directRlibDeps {
rlibDepFiles = append(rlibDepFiles, RustLibrary{Path: dep.UnstrippedOutputFile(), CrateName: dep.CrateName()})