Module/providers can now emit extra JSON data. am: 1602226f23 am: 0c19d0fec8 am: d83120ca1c

Original change: https://android-review.googlesource.com/c/platform/build/blueprint/+/1748035

Change-Id: Id557ff2976126971694c800864dcbaa1d2a1e1f5
This commit is contained in:
Lukacs T. Berki 2021-06-25 16:21:08 +00:00 committed by Automerger Merge Worker
commit 7e0188edd8

View file

@ -2281,11 +2281,12 @@ type jsonDep struct {
Tag string
}
type jsonModule struct {
type JsonModule struct {
jsonModuleName
Deps []jsonDep
Type string
Blueprint string
Module map[string]interface{}
}
func toJsonVariationMap(vm variationMap) jsonVariationMap {
@ -2300,17 +2301,33 @@ func jsonModuleNameFromModuleInfo(m *moduleInfo) *jsonModuleName {
}
}
func jsonModuleFromModuleInfo(m *moduleInfo) *jsonModule {
return &jsonModule{
type JSONDataSupplier interface {
AddJSONData(d *map[string]interface{})
}
func jsonModuleFromModuleInfo(m *moduleInfo) *JsonModule {
result := &JsonModule{
jsonModuleName: *jsonModuleNameFromModuleInfo(m),
Deps: make([]jsonDep, 0),
Type: m.typeName,
Blueprint: m.relBlueprintsFile,
Module: make(map[string]interface{}),
}
if j, ok := m.logicModule.(JSONDataSupplier); ok {
j.AddJSONData(&result.Module)
}
for _, p := range m.providers {
if j, ok := p.(JSONDataSupplier); ok {
j.AddJSONData(&result.Module)
}
}
return result
}
func (c *Context) PrintJSONGraph(w io.Writer) {
modules := make([]*jsonModule, 0)
modules := make([]*JsonModule, 0)
for _, m := range c.modulesSorted {
jm := jsonModuleFromModuleInfo(m)
for _, d := range m.directDeps {