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

Commit d79ae178 authored by Yu Liu's avatar Yu Liu Committed by Gerrit Code Review
Browse files

Merge "Use VisitDirectDepsProxy in checkStaticExecutables." into main

parents 1ac94486 986d98cf
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -2744,12 +2744,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)