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

Commit 44616ccd authored by Hugo Drumond Jacob's avatar Hugo Drumond Jacob
Browse files

Dump the required modules into module-info.json

Certain applications, like tracking the dependency chain of modules,
knowing the "required" dependencies is required.

In this context, "required" here means the `required` field in
Android.bp files.

Bug: 339193439
Test: Inspect module-info.json for the `required` field
Change-Id: I420c781d410e715ef86823278f99e4ffe51f8022
parent 9b9d29b8
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -1982,6 +1982,7 @@ func (m *ModuleBase) GenerateBuildActions(blueprintCtx blueprint.ModuleContext)
			TargetDependencies: targetRequired,
			HostDependencies:   hostRequired,
			Data:               data,
			Required:           m.RequiredModuleNames(),
		}
		SetProvider(ctx, ModuleInfoJSONProvider, m.moduleInfoJSON)
	}
+2 −0
Original line number Diff line number Diff line
@@ -17,6 +17,7 @@ type CoreModuleInfoJSON struct {
	HostDependencies   []string `json:"host_dependencies,omitempty"`   // $(sort $(ALL_MODULES.$(m).HOST_REQUIRED_FROM_TARGET))
	TargetDependencies []string `json:"target_dependencies,omitempty"` // $(sort $(ALL_MODULES.$(m).TARGET_REQUIRED_FROM_HOST))
	Data               []string `json:"data,omitempty"`                // $(sort $(ALL_MODULES.$(m).TEST_DATA))
	Required           []string `json:"required,omitempty"`            // $(sort $(ALL_MODULES.$(m).REQUIRED_FROM_TARGET))
}

type ModuleInfoJSON struct {
@@ -77,6 +78,7 @@ func encodeModuleInfoJSON(w io.Writer, moduleInfoJSON *ModuleInfoJSON) error {
	sortAndUnique(&moduleInfoJSONCopy.core.HostDependencies)
	sortAndUnique(&moduleInfoJSONCopy.core.TargetDependencies)
	sortAndUnique(&moduleInfoJSONCopy.core.Data)
	sortAndUnique(&moduleInfoJSONCopy.core.Required)

	sortAndUnique(&moduleInfoJSONCopy.Class)
	sortAndUnique(&moduleInfoJSONCopy.Tags)