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(): |
| 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: |
Anders Carlsson | 7bca8ca | 2018-08-30 09:30:29 +0200 | [diff] [blame] | 25 | outfile.write(textwrap.dedent("""\ |
| 26 | /* |
Anders Carlsson | dc6b477 | 2018-01-15 13:31:03 +0100 | [diff] [blame] | 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. |
Anders Carlsson | 7bca8ca | 2018-08-30 09:30:29 +0200 | [diff] [blame] | 34 | */\n\n""" % datetime.datetime.now().year)) |
Anders Carlsson | dc6b477 | 2018-01-15 13:31:03 +0100 | [diff] [blame] | 35 | |
| 36 | for s in args.sources: |
Anders Carlsson | 7bca8ca | 2018-08-30 09:30:29 +0200 | [diff] [blame] | 37 | outfile.write("#import <WebRTC/{}>\n".format(os.path.basename(s))) |
Anders Carlsson | dc6b477 | 2018-01-15 13:31:03 +0100 | [diff] [blame] | 38 | |
| 39 | return 0 |
| 40 | |
| 41 | |
| 42 | if __name__ == '__main__': |
| 43 | sys.exit(GenerateUmbrellaHeader()) |