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

Commit a61e31f6 authored by Matthew Maurer's avatar Matthew Maurer
Browse files

Support Rust in native-bridge

Bug: 178565008
Bug: 165791368
Test: Build and link a Rust library into a native-bridge binary
Change-Id: I3546571530529203d9dbfd62777f20de18c6bd51
parent 52af5b05
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -24,7 +24,7 @@ import (
)

var (
	nativeBridgeSuffix  = ".native_bridge"
	NativeBridgeSuffix  = ".native_bridge"
	ProductSuffix       = ".product"
	VendorSuffix        = ".vendor"
	ramdiskSuffix       = ".ramdisk"
@@ -182,7 +182,7 @@ func makeOverrideModuleNames(ctx AndroidMkContext, overrides []string) []string
	if ctx.Target().NativeBridge == android.NativeBridgeEnabled {
		var result []string
		for _, override := range overrides {
			result = append(result, override+nativeBridgeSuffix)
			result = append(result, override+NativeBridgeSuffix)
		}
		return result
	}
+2 −2
Original line number Diff line number Diff line
@@ -1652,7 +1652,7 @@ func (c *Module) setSubnameProperty(actx android.ModuleContext) {
	c.Properties.SubName = ""

	if c.Target().NativeBridge == android.NativeBridgeEnabled {
		c.Properties.SubName += nativeBridgeSuffix
		c.Properties.SubName += NativeBridgeSuffix
	}

	llndk := c.IsLlndk()
@@ -3035,7 +3035,7 @@ func MakeLibName(ctx android.ModuleContext, c LinkableInterface, ccDep LinkableI
	} else if ccDep.InRecovery() && !ccDep.OnlyInRecovery() {
		return libName + RecoverySuffix
	} else if ccDep.Target().NativeBridge == android.NativeBridgeEnabled {
		return libName + nativeBridgeSuffix
		return libName + NativeBridgeSuffix
	} else {
		return libName
	}
+8 −0
Original line number Diff line number Diff line
@@ -766,6 +766,10 @@ func (ctx *baseModuleContext) toolchain() config.Toolchain {
}

func (mod *Module) nativeCoverage() bool {
	// Bug: http://b/137883967 - native-bridge modules do not currently work with coverage
	if mod.Target().NativeBridge == android.NativeBridgeEnabled {
		return false
	}
	return mod.compiler != nil && mod.compiler.nativeCoverage()
}

@@ -819,6 +823,10 @@ func (mod *Module) GenerateAndroidBuildActions(actx android.ModuleContext) {
		mod.Properties.SubName += cc.RecoverySuffix
	}

	if mod.Target().NativeBridge == android.NativeBridgeEnabled {
		mod.Properties.SubName += cc.NativeBridgeSuffix
	}

	if !toolchain.Supported() {
		// This toolchain's unsupported, there's nothing to do for this mod.
		return