Merge "Allow users to specify extra json action data" am: 57d5937e6f
am: 13a7388e46
Original change: https://android-review.googlesource.com/c/platform/build/blueprint/+/2108469 Change-Id: I5537fb1b2dca354af3874f0d9be5103cb2bde6f4 Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
commit
b84b3ed83a
1 changed files with 26 additions and 4 deletions
30
context.go
30
context.go
|
@ -2285,6 +2285,18 @@ type JSONDataSupplier interface {
|
||||||
AddJSONData(d *map[string]interface{})
|
AddJSONData(d *map[string]interface{})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// JSONAction contains the action-related info we expose to json module graph
|
||||||
|
type JSONAction struct {
|
||||||
|
Inputs []string
|
||||||
|
Outputs []string
|
||||||
|
}
|
||||||
|
|
||||||
|
// JSONActionSupplier allows JSON representation of additional actions that are not registered in
|
||||||
|
// Ninja
|
||||||
|
type JSONActionSupplier interface {
|
||||||
|
JSONActions() []JSONAction
|
||||||
|
}
|
||||||
|
|
||||||
func jsonModuleFromModuleInfo(m *moduleInfo) *JsonModule {
|
func jsonModuleFromModuleInfo(m *moduleInfo) *JsonModule {
|
||||||
result := &JsonModule{
|
result := &JsonModule{
|
||||||
jsonModuleName: *jsonModuleNameFromModuleInfo(m),
|
jsonModuleName: *jsonModuleNameFromModuleInfo(m),
|
||||||
|
@ -2318,17 +2330,27 @@ func jsonModuleWithActionsFromModuleInfo(m *moduleInfo) *JsonModule {
|
||||||
Blueprint: m.relBlueprintsFile,
|
Blueprint: m.relBlueprintsFile,
|
||||||
Module: make(map[string]interface{}),
|
Module: make(map[string]interface{}),
|
||||||
}
|
}
|
||||||
var actions []map[string]interface{}
|
var actions []JSONAction
|
||||||
for _, bDef := range m.actionDefs.buildDefs {
|
for _, bDef := range m.actionDefs.buildDefs {
|
||||||
actions = append(actions, map[string]interface{}{
|
actions = append(actions, JSONAction{
|
||||||
"Inputs": append(
|
Inputs: append(
|
||||||
getNinjaStringsWithNilPkgNames(bDef.Inputs),
|
getNinjaStringsWithNilPkgNames(bDef.Inputs),
|
||||||
getNinjaStringsWithNilPkgNames(bDef.Implicits)...),
|
getNinjaStringsWithNilPkgNames(bDef.Implicits)...),
|
||||||
"Outputs": append(
|
Outputs: append(
|
||||||
getNinjaStringsWithNilPkgNames(bDef.Outputs),
|
getNinjaStringsWithNilPkgNames(bDef.Outputs),
|
||||||
getNinjaStringsWithNilPkgNames(bDef.ImplicitOutputs)...),
|
getNinjaStringsWithNilPkgNames(bDef.ImplicitOutputs)...),
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if j, ok := m.logicModule.(JSONActionSupplier); ok {
|
||||||
|
actions = append(actions, j.JSONActions()...)
|
||||||
|
}
|
||||||
|
for _, p := range m.providers {
|
||||||
|
if j, ok := p.(JSONActionSupplier); ok {
|
||||||
|
actions = append(actions, j.JSONActions()...)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
result.Module["Actions"] = actions
|
result.Module["Actions"] = actions
|
||||||
return result
|
return result
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue