Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 9f59e8db authored by Matthew Maurer's avatar Matthew Maurer
Browse files

rust: Hook up InstallIn functions + Product

InstallIn functions must be hooked up not only to install to special
images, but also to receive special handling by android/arch.go such
that some images are implicitly multilib: first.

Also hook up more product details.

Bug: 178565008
Bug: 165791368
Test: lunch aosp_arm64; m
Change-Id: I1980d5aa9d55f78c222b98d60a404cd6ea5abbfb
parent c6868383
Loading
Loading
Loading
Loading
+8 −1
Original line number Diff line number Diff line
@@ -397,8 +397,15 @@ func (compiler *baseCompiler) installDir(ctx ModuleContext) android.InstallPath
	}

	if compiler.location == InstallInData && ctx.RustModule().UseVndk() {
		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)
}
+7 −1
Original line number Diff line number Diff line
@@ -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 {
+12 −0
Original line number Diff line number Diff line
@@ -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]
}