diff options
author | Craig Tiller <ctiller@google.com> | 2016-04-11 20:11:18 -0700 |
---|---|---|
committer | Craig Tiller <ctiller@google.com> | 2016-04-11 20:11:18 -0700 |
commit | 3ab2fe009495ce9b13b35e5cb35cf47991a85647 (patch) | |
tree | e051416beb3bdbf9d75328d901c350cdc9213758 /tools/buildgen | |
parent | d626acbb02c93fd15b12d8ef8833a65d0c3781e6 (diff) |
Rollup of changes from the latest import
Diffstat (limited to 'tools/buildgen')
-rwxr-xr-x | tools/buildgen/generate_projects.py | 4 | ||||
-rwxr-xr-x | tools/buildgen/mako_renderer.py | 12 | ||||
-rwxr-xr-x | tools/buildgen/plugins/expand_filegroups.py | 17 | ||||
-rw-r--r-- | tools/buildgen/plugins/make_fuzzer_tests.py | 3 |
4 files changed, 34 insertions, 2 deletions
diff --git a/tools/buildgen/generate_projects.py b/tools/buildgen/generate_projects.py index 5f3af7738b..5e78ad52d6 100755 --- a/tools/buildgen/generate_projects.py +++ b/tools/buildgen/generate_projects.py @@ -47,6 +47,7 @@ os.chdir(os.path.join(os.path.dirname(sys.argv[0]), '..', '..')) argp = argparse.ArgumentParser() argp.add_argument('build_files', nargs='+', default=[]) argp.add_argument('--templates', nargs='+', default=[]) +argp.add_argument('--output_merged', default=None, type=str) argp.add_argument('--jobs', '-j', default=multiprocessing.cpu_count(), type=int) args = argp.parse_args() @@ -74,6 +75,9 @@ for js in json: cmd.append('-w') preprocessed_build = '.preprocessed_build' cmd.append(preprocessed_build) +if args.output_merged is not None: + cmd.append('-M') + cmd.append(args.output_merged) pre_jobs.append(jobset.JobSpec(cmd, shortname='preprocess', timeout_seconds=None)) jobs = [] diff --git a/tools/buildgen/mako_renderer.py b/tools/buildgen/mako_renderer.py index f629e68eb9..866e6fdb06 100755 --- a/tools/buildgen/mako_renderer.py +++ b/tools/buildgen/mako_renderer.py @@ -81,9 +81,10 @@ def main(argv): plugins = [] output_name = None got_preprocessed_input = False + output_merged = None try: - opts, args = getopt.getopt(argv, 'hm:d:o:p:t:P:w:') + opts, args = getopt.getopt(argv, 'hM:m:d:o:p:t:P:w:') except getopt.GetoptError: out('Unknown option') showhelp() @@ -107,6 +108,12 @@ def main(argv): showhelp() sys.exit(4) module_directory = arg + elif opt == '-M': + if output_merged is not None: + out('Got more than one output merged path') + showhelp() + sys.exit(5) + output_merged = arg elif opt == '-P': assert not got_preprocessed_input assert json_dict == {} @@ -126,6 +133,9 @@ def main(argv): if not got_preprocessed_input: for plugin in plugins: plugin.mako_plugin(json_dict) + if output_merged: + with open(output_merged, 'w') as yaml_file: + yaml_file.write(yaml.dump(json_dict)) for k, v in json_dict.items(): dictionary[k] = bunch.to_bunch(v) diff --git a/tools/buildgen/plugins/expand_filegroups.py b/tools/buildgen/plugins/expand_filegroups.py index 69d95deb6b..477e69c869 100755 --- a/tools/buildgen/plugins/expand_filegroups.py +++ b/tools/buildgen/plugins/expand_filegroups.py @@ -115,6 +115,23 @@ 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: diff --git a/tools/buildgen/plugins/make_fuzzer_tests.py b/tools/buildgen/plugins/make_fuzzer_tests.py index 806489bcd2..e8e1bd0aa6 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)): |