Anders Carlsson | dc6b477 | 2018-01-15 13:31:03 +0100 | [diff] [blame] | 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 | |
| 9 | import argparse |
| 10 | import datetime |
Anders Carlsson | 7bca8ca | 2018-08-30 09:30:29 +0200 | [diff] [blame] | 11 | import os |
Anders Carlsson | dc6b477 | 2018-01-15 13:31:03 +0100 | [diff] [blame] | 12 | import sys |
Anders Carlsson | 7bca8ca | 2018-08-30 09:30:29 +0200 | [diff] [blame] | 13 | import textwrap |
Anders Carlsson | dc6b477 | 2018-01-15 13:31:03 +0100 | [diff] [blame] | 14 | |
| 15 | |
| 16 | def GenerateUmbrellaHeader(): |
Mirko Bonadei | 8cc6695 | 2020-10-30 10:13:45 +0100 | [diff] [blame] | 17 | 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 Carlsson | dc6b477 | 2018-01-15 13:31:03 +0100 | [diff] [blame] | 25 | |
Mirko Bonadei | 8cc6695 | 2020-10-30 10:13:45 +0100 | [diff] [blame] | 26 | args = parser.parse_args() |
Anders Carlsson | dc6b477 | 2018-01-15 13:31:03 +0100 | [diff] [blame] | 27 | |
Mirko Bonadei | 8cc6695 | 2020-10-30 10:13:45 +0100 | [diff] [blame] | 28 | with open(args.out, "w") as outfile: |
| 29 | outfile.write( |
| 30 | textwrap.dedent("""\ |
Anders Carlsson | 7bca8ca | 2018-08-30 09:30:29 +0200 | [diff] [blame] | 31 | /* |
Anders Carlsson | dc6b477 | 2018-01-15 13:31:03 +0100 | [diff] [blame] | 32 | * 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 Carlsson | 7bca8ca | 2018-08-30 09:30:29 +0200 | [diff] [blame] | 39 | */\n\n""" % datetime.datetime.now().year)) |
Anders Carlsson | dc6b477 | 2018-01-15 13:31:03 +0100 | [diff] [blame] | 40 | |
Mirko Bonadei | 8cc6695 | 2020-10-30 10:13:45 +0100 | [diff] [blame] | 41 | for s in args.sources: |
| 42 | outfile.write("#import <WebRTC/{}>\n".format(os.path.basename(s))) |
Anders Carlsson | dc6b477 | 2018-01-15 13:31:03 +0100 | [diff] [blame] | 43 | |
Mirko Bonadei | 8cc6695 | 2020-10-30 10:13:45 +0100 | [diff] [blame] | 44 | return 0 |
Anders Carlsson | dc6b477 | 2018-01-15 13:31:03 +0100 | [diff] [blame] | 45 | |
| 46 | |
| 47 | if __name__ == '__main__': |
Mirko Bonadei | 8cc6695 | 2020-10-30 10:13:45 +0100 | [diff] [blame] | 48 | sys.exit(GenerateUmbrellaHeader()) |