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