Merge "Fix inverted error message"
diff --git a/rust/compiler.go b/rust/compiler.go
index d9e21ff..7bd9af4 100644
--- a/rust/compiler.go
+++ b/rust/compiler.go
@@ -397,8 +397,15 @@
}
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/doc.go b/rust/doc.go
index e7f1371..fe3581b 100644
--- a/rust/doc.go
+++ b/rust/doc.go
@@ -29,6 +29,14 @@
type rustdocSingleton struct{}
func (n *rustdocSingleton) GenerateBuildActions(ctx android.SingletonContext) {
+ docDir := android.PathForOutput(ctx, "rustdoc")
+ docZip := android.PathForOutput(ctx, "rustdoc.zip")
+ rule := android.NewRuleBuilder(pctx, ctx)
+ zipCmd := rule.Command().BuiltTool("soong_zip").
+ FlagWithOutput("-o ", docZip).
+ FlagWithArg("-C ", docDir.String()).
+ FlagWithArg("-D ", docDir.String())
+
ctx.VisitAllModules(func(module android.Module) {
if !module.Enabled() {
return
@@ -36,8 +44,10 @@
if m, ok := module.(*Module); ok {
if m.docTimestampFile.Valid() {
- ctx.Phony("rustdoc", m.docTimestampFile.Path())
+ zipCmd.Implicit(m.docTimestampFile.Path())
}
}
})
+ rule.Build("rustdoc-zip", "Zipping all built Rust documentation...")
+ ctx.Phony("rustdoc", docZip)
}
diff --git a/rust/image.go b/rust/image.go
index 5d7c027..5d57f15 100644
--- a/rust/image.go
+++ b/rust/image.go
@@ -136,7 +136,13 @@
}
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 ba395ec..0cd299d 100644
--- a/rust/rust.go
+++ b/rust/rust.go
@@ -1233,6 +1233,18 @@
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]
}
diff --git a/scripts/build-rustdocs.sh b/scripts/build-rustdocs.sh
index ad8ba16..fda9688 100755
--- a/scripts/build-rustdocs.sh
+++ b/scripts/build-rustdocs.sh
@@ -27,5 +27,5 @@
if [ -n "${DIST_DIR}" ]; then
mkdir -p ${DIST_DIR}
- cp -r ${OUT_DIR}/soong/rustdoc $DIST_DIR/rustdoc
+ cp ${OUT_DIR}/soong/rustdoc.zip $DIST_DIR
fi