blob: 4c700a1c31b9007b301faefe24c5619002084fad [file] [log] [blame]
Anders Carlssondc6b4772018-01-15 13:31:03 +01001# 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
Anders Carlsson7bca8ca2018-08-30 09:30:29 +020011import os
Anders Carlssondc6b4772018-01-15 13:31:03 +010012import sys
Anders Carlsson7bca8ca2018-08-30 09:30:29 +020013import textwrap
Anders Carlssondc6b4772018-01-15 13:31:03 +010014
15
16def GenerateUmbrellaHeader():
Mirko Bonadei8cc66952020-10-30 10:13:45 +010017 parser = argparse.ArgumentParser(description='Generate umbrella header')
18 parser.add_argument("-o", "--out", type=str, help="Output file.")
19 parser.add_argument("-s",
20 "--sources",
21 default=[],
22 type=str,
23 nargs='+',
24 help="Headers to include.")
Anders Carlssondc6b4772018-01-15 13:31:03 +010025
Mirko Bonadei8cc66952020-10-30 10:13:45 +010026 args = parser.parse_args()
Anders Carlssondc6b4772018-01-15 13:31:03 +010027
Mirko Bonadei8cc66952020-10-30 10:13:45 +010028 with open(args.out, "w") as outfile:
29 outfile.write(
30 textwrap.dedent("""\
Anders Carlsson7bca8ca2018-08-30 09:30:29 +020031 /*
Anders Carlssondc6b4772018-01-15 13:31:03 +010032 * Copyright %d The WebRTC project authors. All Rights Reserved.
33 *
34 * Use of this source code is governed by a BSD-style license
35 * that can be found in the LICENSE file in the root of the source
36 * tree. An additional intellectual property rights grant can be found
37 * in the file PATENTS. All contributing project authors may
38 * be found in the AUTHORS file in the root of the source tree.
Anders Carlsson7bca8ca2018-08-30 09:30:29 +020039 */\n\n""" % datetime.datetime.now().year))
Anders Carlssondc6b4772018-01-15 13:31:03 +010040
Mirko Bonadei8cc66952020-10-30 10:13:45 +010041 for s in args.sources:
42 outfile.write("#import <WebRTC/{}>\n".format(os.path.basename(s)))
Anders Carlssondc6b4772018-01-15 13:31:03 +010043
Mirko Bonadei8cc66952020-10-30 10:13:45 +010044 return 0
Anders Carlssondc6b4772018-01-15 13:31:03 +010045
46
47if __name__ == '__main__':
Mirko Bonadei8cc66952020-10-30 10:13:45 +010048 sys.exit(GenerateUmbrellaHeader())