Merge "Output machine-readable file with all soong keywords." am: ed00a40686
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1699938 Change-Id: I7454f784af7fdd1318bff574c8dee428acee1986
This commit is contained in:
@@ -114,7 +114,10 @@ func writeDocs(ctx *android.Context, config interface{}, filename string) error
|
|||||||
err = ioutil.WriteFile(filename, buf.Bytes(), 0666)
|
err = ioutil.WriteFile(filename, buf.Bytes(), 0666)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Now, produce per-package module lists with detailed information.
|
// Now, produce per-package module lists with detailed information, and a list
|
||||||
|
// of keywords.
|
||||||
|
keywordsTmpl := template.Must(template.New("file").Parse(keywordsTemplate))
|
||||||
|
keywordsBuf := &bytes.Buffer{}
|
||||||
for _, pkg := range packages {
|
for _, pkg := range packages {
|
||||||
// We need a module name getter/setter function because I couldn't
|
// We need a module name getter/setter function because I couldn't
|
||||||
// find a way to keep it in a variable defined within the template.
|
// find a way to keep it in a variable defined within the template.
|
||||||
@@ -141,7 +144,17 @@ func writeDocs(ctx *android.Context, config interface{}, filename string) error
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
err = keywordsTmpl.Execute(keywordsBuf, data)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Write out list of keywords. This includes all module and property names, which is useful for
|
||||||
|
// building syntax highlighters.
|
||||||
|
keywordsFilename := filepath.Join(filepath.Dir(filename), "keywords.txt")
|
||||||
|
err = ioutil.WriteFile(keywordsFilename, keywordsBuf.Bytes(), 0666)
|
||||||
|
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -412,5 +425,10 @@ window.addEventListener('message', (e) => {
|
|||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
{{end}}
|
{{end}}
|
||||||
|
`
|
||||||
|
|
||||||
|
keywordsTemplate = `
|
||||||
|
{{range $moduleType := .Modules}}{{$moduleType.Name}}:{{range $property := $moduleType.Properties}}{{$property.Name}},{{end}}
|
||||||
|
{{end}}
|
||||||
`
|
`
|
||||||
)
|
)
|
||||||
|
Reference in New Issue
Block a user