aboutsummaryrefslogtreecommitdiffhomepage
path: root/tools/buildgen/plugins/expand_filegroups.py
diff options
context:
space:
mode:
authorGravatar Nicolas Noble <nnoble@google.com>2015-01-06 18:08:25 -0800
committerGravatar Nicolas Noble <nnoble@google.com>2015-01-06 18:08:25 -0800
commitddef24620a67fa352d94415dc56121c01e3d8af8 (patch)
treef2383ee6e84a21e92f1524d23436ab28cfe04756 /tools/buildgen/plugins/expand_filegroups.py
parent9f2b09e112f5b95e843de786d7d3ecfd026170b6 (diff)
Adding the tools directory to the git export.
Diffstat (limited to 'tools/buildgen/plugins/expand_filegroups.py')
-rwxr-xr-xtools/buildgen/plugins/expand_filegroups.py45
1 files changed, 45 insertions, 0 deletions
diff --git a/tools/buildgen/plugins/expand_filegroups.py b/tools/buildgen/plugins/expand_filegroups.py
new file mode 100755
index 0000000000..108debefd5
--- /dev/null
+++ b/tools/buildgen/plugins/expand_filegroups.py
@@ -0,0 +1,45 @@
+"""Buildgen expand filegroups plugin.
+
+This takes the list of libs from our json dictionary,
+and expands any and all filegroup.
+
+"""
+
+
+def excluded(filename, exclude_res):
+ for r in exclude_res:
+ if r.search(filename):
+ return True
+ return False
+
+
+def mako_plugin(dictionary):
+ """The exported plugin code for expand_filegroups.
+
+ The list of libs in the build.json file can contain "filegroups" tags.
+ These refer to the filegroups in the root object. We will expand and
+ merge filegroups on the src, headers and public_headers properties.
+
+ """
+ libs = dictionary.get('libs')
+ filegroups_list = dictionary.get('filegroups')
+ filegroups = {}
+
+ for fg in filegroups_list:
+ filegroups[fg['name']] = fg
+
+ for lib in libs:
+ for fg_name in lib.get('filegroups', []):
+ fg = filegroups[fg_name]
+
+ src = lib.get('src', [])
+ src.extend(fg.get('src', []))
+ lib['src'] = src
+
+ headers = lib.get('headers', [])
+ headers.extend(fg.get('headers', []))
+ lib['headers'] = headers
+
+ public_headers = lib.get('public_headers', [])
+ public_headers.extend(fg.get('public_headers', []))
+ lib['public_headers'] = public_headers