summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Treehugger Robot <treehugger-gerrit@google.com> 2021-08-20 21:03:18 +0000
committer Gerrit Code Review <noreply-gerritcodereview@google.com> 2021-08-20 21:03:18 +0000
commit13b3b785ec10b3aeff7849461b79409f0b73b61c (patch)
treeeee37a923865b199b59c9439fbe83f650d98e3ec
parent99d5a0f5c9f2ba5386134b44d44be03ccaf94b35 (diff)
parent9f59e8db270f58a3f2e4fe5bc041f84363a5877e (diff)
Merge "rust: Hook up InstallIn functions + Product"
-rw-r--r--rust/compiler.go9
-rw-r--r--rust/image.go8
-rw-r--r--rust/rust.go12
3 files changed, 27 insertions, 2 deletions
diff --git a/rust/compiler.go b/rust/compiler.go
index d9e21ff3a..7bd9af4a8 100644
--- a/rust/compiler.go
+++ b/rust/compiler.go
@@ -397,8 +397,15 @@ func (compiler *baseCompiler) installDir(ctx ModuleContext) android.InstallPath
}
if compiler.location == InstallInData && ctx.RustModule().UseVndk() {
- dir = filepath.Join(dir, "vendor")
+ if ctx.RustModule().InProduct() {
+ dir = filepath.Join(dir, "product")
+ } else if ctx.RustModule().InVendor() {
+ dir = filepath.Join(dir, "vendor")
+ } else {
+ ctx.ModuleErrorf("Unknown data+VNDK installation kind")
+ }
}
+
return android.PathForModuleInstall(ctx, dir, compiler.subDir,
compiler.relativeInstallPath(), compiler.relative)
}
diff --git a/rust/image.go b/rust/image.go
index 5d7c02733..5d57f1522 100644
--- a/rust/image.go
+++ b/rust/image.go
@@ -136,7 +136,13 @@ func (c *Module) VendorVariantToOdm() bool {
}
func (ctx *moduleContext) ProductSpecific() bool {
- return false
+ return ctx.ModuleContext.ProductSpecific() || ctx.RustModule().productSpecificModuleContext()
+}
+
+func (c *Module) productSpecificModuleContext() bool {
+ // Additionally check if this module is inProduct() that means it is a "product" variant of a
+ // module. As well as product specific modules, product variants must be installed to /product.
+ return c.InProduct()
}
func (mod *Module) InRecovery() bool {
diff --git a/rust/rust.go b/rust/rust.go
index ba395ec6e..0cd299dc1 100644
--- a/rust/rust.go
+++ b/rust/rust.go
@@ -1233,6 +1233,18 @@ func (mod *Module) InstallInData() bool {
return mod.compiler.inData()
}
+func (mod *Module) InstallInRamdisk() bool {
+ return mod.InRamdisk()
+}
+
+func (mod *Module) InstallInVendorRamdisk() bool {
+ return mod.InVendorRamdisk()
+}
+
+func (mod *Module) InstallInRecovery() bool {
+ return mod.InRecovery()
+}
+
func linkPathFromFilePath(filepath android.Path) string {
return strings.Split(filepath.String(), filepath.Base())[0]
}