aboutsummaryrefslogtreecommitdiffhomepage
path: root/tools/buildgen/plugins
diff options
context:
space:
mode:
Diffstat (limited to 'tools/buildgen/plugins')
-rwxr-xr-xtools/buildgen/plugins/expand_filegroups.py60
-rw-r--r--tools/buildgen/plugins/make_fuzzer_tests.py7
2 files changed, 59 insertions, 8 deletions
diff --git a/tools/buildgen/plugins/expand_filegroups.py b/tools/buildgen/plugins/expand_filegroups.py
index 14cb616027..477e69c869 100755
--- a/tools/buildgen/plugins/expand_filegroups.py
+++ b/tools/buildgen/plugins/expand_filegroups.py
@@ -42,7 +42,22 @@ def excluded(filename, exclude_res):
return False
-FILEGROUP_LISTS = ['src', 'headers', 'public_headers']
+def uniquify(lst):
+ out = []
+ for el in lst:
+ if el not in out:
+ out.append(el)
+ return out
+
+
+FILEGROUP_LISTS = ['src', 'headers', 'public_headers', 'deps']
+
+
+FILEGROUP_DEFAULTS = {
+ 'language': 'c',
+ 'boringssl': False,
+ 'zlib': False,
+}
def mako_plugin(dictionary):
@@ -54,10 +69,19 @@ def mako_plugin(dictionary):
"""
libs = dictionary.get('libs')
+ targets = dictionary.get('targets')
filegroups_list = dictionary.get('filegroups')
filegroups = {}
- todo = filegroups_list[:]
+ for fg in filegroups_list:
+ for lst in FILEGROUP_LISTS:
+ fg[lst] = fg.get(lst, [])
+ fg['own_%s' % lst] = list(fg[lst])
+ for attr, val in FILEGROUP_DEFAULTS.iteritems():
+ if attr not in fg:
+ fg[attr] = val
+
+ todo = list(filegroups_list)
skips = 0
while todo:
@@ -91,14 +115,40 @@ def mako_plugin(dictionary):
cur['plugins'] = plugins
filegroups[cur['name']] = cur
+ # build reverse dependency map
+ things = {}
+ for thing in dictionary['libs'] + dictionary['targets'] + dictionary['filegroups']:
+ things[thing['name']] = thing
+ thing['used_by'] = []
+ thing_deps = lambda t: t.get('uses', []) + t.get('filegroups', []) + t.get('deps', [])
+ for thing in things.itervalues():
+ done = set()
+ todo = thing_deps(thing)
+ while todo:
+ cur = todo[0]
+ todo = todo[1:]
+ if cur in done: continue
+ things[cur]['used_by'].append(thing['name'])
+ todo.extend(thing_deps(things[cur]))
+ done.add(cur)
+
# the above expansion can introduce duplicate filenames: contract them here
for fg in filegroups.itervalues():
for lst in FILEGROUP_LISTS:
- fg[lst] = sorted(list(set(fg.get(lst, []))))
+ fg[lst] = uniquify(fg.get(lst, []))
- for lib in libs:
+ for tgt in dictionary['targets']:
+ for lst in FILEGROUP_LISTS:
+ tgt[lst] = tgt.get(lst, [])
+ tgt['own_%s' % lst] = list(tgt[lst])
+
+ for lib in libs + targets:
assert 'plugins' not in lib
plugins = []
+ for lst in FILEGROUP_LISTS:
+ vals = lib.get(lst, [])
+ lib[lst] = list(vals)
+ lib['own_%s' % lst] = list(vals)
for fg_name in lib.get('filegroups', []):
fg = filegroups[fg_name]
for plugin in fg['plugins']:
@@ -113,4 +163,4 @@ def mako_plugin(dictionary):
lib['src'].append('src/core/plugin_registry/%s_plugin_registry.c' %
lib['name'])
for lst in FILEGROUP_LISTS:
- lib[lst] = sorted(list(set(lib.get(lst, []))))
+ lib[lst] = uniquify(lib.get(lst, []))
diff --git a/tools/buildgen/plugins/make_fuzzer_tests.py b/tools/buildgen/plugins/make_fuzzer_tests.py
index 806489bcd2..9d0006973a 100644
--- a/tools/buildgen/plugins/make_fuzzer_tests.py
+++ b/tools/buildgen/plugins/make_fuzzer_tests.py
@@ -41,7 +41,8 @@ def mako_plugin(dictionary):
new_target['build'] = 'test'
new_target['name'] += '_one_entry'
new_target['run'] = False
- new_target['deps'].insert(0, 'one_input_fuzzer')
+ new_target['src'].append('test/core/util/one_corpus_entry_fuzzer.c')
+ new_target['own_src'].append('test/core/util/one_corpus_entry_fuzzer.c')
targets.append(new_target)
for corpus in new_target['corpus_dirs']:
for fn in sorted(glob.glob('%s/*' % corpus)):
@@ -49,8 +50,8 @@ def mako_plugin(dictionary):
'name': new_target['name'],
'args': [fn],
'exclude_configs': [],
- 'platforms': ['linux', 'mac', 'windows', 'posix'],
- 'ci_platforms': ['linux', 'mac', 'windows', 'posix'],
+ 'platforms': ['linux'],
+ 'ci_platforms': ['linux'],
'flaky': False,
'language': 'c',
'cpu_cost': 0.1,