1# Copyright (c) 2018 The WebRTC project authors. All Rights Reserved.
2#
3# Use of this source code is governed by a BSD-style license
4# that can be found in the LICENSE file in the root of the source
5# tree. An additional intellectual property rights grant can be found
6# in the file PATENTS.  All contributing project authors may
7# be found in the AUTHORS file in the root of the source tree.
8
9import argparse
10import datetime
11import os
12import sys
13import textwrap
14
15
16def GenerateUmbrellaHeader():
17  parser = argparse.ArgumentParser(description='Generate umbrella header')
18  parser.add_argument("-o", "--out", type=str, help="Output file.")
19  parser.add_argument("-s", "--sources", default=[], type=str, nargs='+',
20                      help="Headers to include.")
21
22  args = parser.parse_args()
23
24  with open(args.out, "w") as outfile:
25    outfile.write(textwrap.dedent("""\
26    /*
27     *  Copyright %d The WebRTC project authors. All Rights Reserved.
28     *
29     *  Use of this source code is governed by a BSD-style license
30     *  that can be found in the LICENSE file in the root of the source
31     *  tree. An additional intellectual property rights grant can be found
32     *  in the file PATENTS.  All contributing project authors may
33     *  be found in the AUTHORS file in the root of the source tree.
34     */\n\n""" % datetime.datetime.now().year))
35
36    for s in args.sources:
37      outfile.write("#import <WebRTC/{}>\n".format(os.path.basename(s)))
38
39  return 0
40
41
42if __name__ == '__main__':
43  sys.exit(GenerateUmbrellaHeader())
44