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

Commit 986d98cf authored by Yu Liu's avatar Yu Liu
Browse files

Use VisitDirectDepsProxy in checkStaticExecutables.

Bug: 377723687
Test: Check the ninja and mk files.
Change-Id: I1c12fcabc7b389a85ffede0f9a03fdaeb92f1f5d
parent ac483e08
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -2742,12 +2742,12 @@ func (a *apexBundle) checkApexAvailability(ctx android.ModuleContext) {

// checkStaticExecutable ensures that executables in an APEX are not static.
func (a *apexBundle) checkStaticExecutables(ctx android.ModuleContext) {
	ctx.VisitDirectDeps(func(module android.Module) {
	ctx.VisitDirectDepsProxy(func(module android.ModuleProxy) {
		if ctx.OtherModuleDependencyTag(module) != executableTag {
			return
		}

		if l, ok := module.(cc.LinkableInterface); ok && l.StaticExecutable() {
		if android.OtherModuleProviderOrDefault(ctx, module, cc.LinkableInfoKey).StaticExecutable {
			apex := a.ApexVariationName()
			exec := ctx.OtherModuleName(module)
			if isStaticExecutableAllowed(apex, exec) {
+11 −0
Original line number Diff line number Diff line
@@ -53,6 +53,13 @@ type CcObjectInfo struct {

var CcObjectInfoProvider = blueprint.NewProvider[CcObjectInfo]()

type LinkableInfo struct {
	// StaticExecutable returns true if this is a binary module with "static_executable: true".
	StaticExecutable bool
}

var LinkableInfoKey = blueprint.NewProvider[LinkableInfo]()

func init() {
	RegisterCCBuildComponents(android.InitRegistrationContext)

@@ -2119,6 +2126,10 @@ func (c *Module) GenerateAndroidBuildActions(actx android.ModuleContext) {
		android.SetProvider(ctx, CcObjectInfoProvider, ccObjectInfo)
	}

	android.SetProvider(ctx, LinkableInfoKey, LinkableInfo{
		StaticExecutable: c.StaticExecutable(),
	})

	c.setOutputFiles(ctx)

	if c.makeVarsInfo != nil {
+4 −0
Original line number Diff line number Diff line
@@ -1001,6 +1001,10 @@ func (mod *Module) GenerateAndroidBuildActions(actx android.ModuleContext) {
		ctx.Phony("rust", ctx.RustModule().OutputFile().Path())
	}

	android.SetProvider(ctx, cc.LinkableInfoKey, cc.LinkableInfo{
		StaticExecutable: mod.StaticExecutable(),
	})

	mod.setOutputFiles(ctx)

	buildComplianceMetadataInfo(ctx, mod, deps)