diff options
author | 2023-01-24 16:36:02 -0800 | |
---|---|---|
committer | 2023-01-24 16:39:52 -0800 | |
commit | 993db7a7cca8818b867d8c1eb1508aaaaf441293 (patch) | |
tree | 0b75e4907fbdbd0563afa92527d774e5cb8393e3 /rust/image.go | |
parent | 6cf5e0d9cb89b909b5087d4057e6f09e4d093f85 (diff) |
rust: Enable Rust modules in Product
The prohibition on Rust dylibs outside system still stands, but rlibs,
rust_ffi_static, and binaries will all work fine.
Test: m nothing (new soong tests added by this commit)
Test: Created sample product_specific rust_binary, checked out/ location
Bug: 165791368
Change-Id: I6453274064bb24b2019f38e57fc0d09b7c0fcf30
Diffstat (limited to 'rust/image.go')
-rw-r--r-- | rust/image.go | 27 |
1 files changed, 13 insertions, 14 deletions
diff --git a/rust/image.go b/rust/image.go index dfc7f7431..50bf02a4a 100644 --- a/rust/image.go +++ b/rust/image.go @@ -129,6 +129,10 @@ func (ctx *moduleContext) DeviceSpecific() bool { return ctx.ModuleContext.DeviceSpecific() || (ctx.RustModule().InVendor() && ctx.RustModule().VendorVariantToOdm()) } +func (ctx *moduleContext) SystemExtSpecific() bool { + return ctx.ModuleContext.SystemExtSpecific() +} + // Returns true when this module creates a vendor variant and wants to install the vendor variant // to the odm partition. func (c *Module) VendorVariantToOdm() bool { @@ -158,22 +162,15 @@ func (mod *Module) InVendorRamdisk() bool { } func (mod *Module) OnlyInRamdisk() bool { - // TODO(b/165791368) - return false + return mod.ModuleBase.InstallInRamdisk() } func (mod *Module) OnlyInRecovery() bool { - // TODO(b/165791368) - return false + return mod.ModuleBase.InstallInRecovery() } func (mod *Module) OnlyInVendorRamdisk() bool { - return false -} - -func (mod *Module) OnlyInProduct() bool { - //TODO(b/165791368) - return false + return mod.ModuleBase.InstallInVendorRamdisk() } // Returns true when this module is configured to have core and vendor variants. @@ -226,10 +223,7 @@ func (mod *Module) ImageMutatorBegin(mctx android.BaseModuleContext) { // Rust does not support installing to the product image yet. vendorSpecific := mctx.SocSpecific() || mctx.DeviceSpecific() - if mctx.ProductSpecific() { - mctx.PropertyErrorf("product_specific", - "Rust modules do not yet support installing to the product image.") - } else if Bool(mod.VendorProperties.Double_loadable) { + if Bool(mod.VendorProperties.Double_loadable) { mctx.PropertyErrorf("double_loadable", "Rust modules do not yet support double loading") } @@ -243,6 +237,11 @@ func (mod *Module) ImageMutatorBegin(mctx android.BaseModuleContext) { mctx.PropertyErrorf("vendor", "Vendor-only dylibs are not yet supported, use rust_library_rlib.") } } + if mctx.ProductSpecific() { + if lib, ok := mod.compiler.(libraryInterface); ok && lib.buildDylib() { + mctx.PropertyErrorf("product", "Product-only dylibs are not yet supported, use rust_library_rlib.") + } + } cc.MutateImage(mctx, mod) |