summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Liz Kammer <eakammer@google.com> 2021-08-17 17:29:51 -0400
committer Liz Kammer <eakammer@google.com> 2021-08-17 17:29:51 -0400
commit74ec1686aa38e2340ce548cff99a88a1ebbb24cf (patch)
tree95ce8096271627136604c1264d64706f88c8a783
parent0dd067d30908d1cc6d4bfa5e68d6c1c197ecd1d7 (diff)
Collect info on non-cc sources in a cc module.
Cc modules in Soong can contain non-cc srcs, collect information on whether they exist in a module. This is not entirely precise as globs are not evaluated and srcs from other modules (e.g. filegroups, generated sources) are not handled; however, it should give a decent lower bound on how often each type occurs. Bug: 194938896 Test: SOONG_DUMP_JSON_MODULE_GRAPH=/tmp/json_srcs m nothing and verify outputs Change-Id: I7ad52e863727cf5fa4e8d41cf04d27c86e395c6d
-rw-r--r--cc/cc.go18
1 files changed, 18 insertions, 0 deletions
diff --git a/cc/cc.go b/cc/cc.go
index f65af3024..4870fde7e 100644
--- a/cc/cc.go
+++ b/cc/cc.go
@@ -822,6 +822,16 @@ type Module struct {
}
func (c *Module) AddJSONData(d *map[string]interface{}) {
+ var hasAidl, hasLex, hasProto, hasRenderscript, hasSysprop, hasWinMsg, hasYacc bool
+ if b, ok := c.compiler.(*baseCompiler); ok {
+ hasAidl = b.hasSrcExt(".aidl")
+ hasLex = b.hasSrcExt(".l") || b.hasSrcExt(".ll")
+ hasProto = b.hasSrcExt(".proto")
+ hasRenderscript = b.hasSrcExt(".rscript") || b.hasSrcExt(".fs")
+ hasSysprop = b.hasSrcExt(".sysprop")
+ hasWinMsg = b.hasSrcExt(".mc")
+ hasYacc = b.hasSrcExt(".y") || b.hasSrcExt(".yy")
+ }
c.AndroidModuleBase().AddJSONData(d)
(*d)["Cc"] = map[string]interface{}{
"SdkVersion": c.SdkVersion(),
@@ -858,6 +868,14 @@ func (c *Module) AddJSONData(d *map[string]interface{}) {
"IsVendorPublicLibrary": c.IsVendorPublicLibrary(),
"ApexSdkVersion": c.apexSdkVersion,
"TestFor": c.TestFor(),
+ "AidlSrcs": hasAidl,
+ "LexSrcs": hasLex,
+ "ProtoSrcs": hasProto,
+ "RenderscriptSrcs": hasRenderscript,
+ "SyspropSrcs": hasSysprop,
+ "WinMsgSrcs": hasWinMsg,
+ "YaccSrsc": hasYacc,
+ "OnlyCSrcs": !(hasAidl || hasLex || hasProto || hasRenderscript || hasSysprop || hasWinMsg || hasYacc),
}
}