blob: 1fd1eed38eedd64b11302c962d24c0cb0f60dc99 [file] [log] [blame]
Christoffer Jansson4e8a7732022-02-08 09:01:12 +01001#!/usr/bin/env vpython3
2
Anders Carlssondc6b4772018-01-15 13:31:03 +01003# 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
11import argparse
12import datetime
Anders Carlsson7bca8ca2018-08-30 09:30:29 +020013import os
Anders Carlssondc6b4772018-01-15 13:31:03 +010014import sys
Anders Carlsson7bca8ca2018-08-30 09:30:29 +020015import textwrap
Anders Carlssondc6b4772018-01-15 13:31:03 +010016
17
18def GenerateUmbrellaHeader():
Christoffer Jansson4e8a7732022-02-08 09:01:12 +010019 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 Carlssondc6b4772018-01-15 13:31:03 +010027
Christoffer Jansson4e8a7732022-02-08 09:01:12 +010028 args = parser.parse_args()
Anders Carlssondc6b4772018-01-15 13:31:03 +010029
Christoffer Jansson4e8a7732022-02-08 09:01:12 +010030 with open(args.out, "w") as outfile:
31 outfile.write(
32 textwrap.dedent("""\
Anders Carlsson7bca8ca2018-08-30 09:30:29 +020033 /*
Anders Carlssondc6b4772018-01-15 13:31:03 +010034 * 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 Carlsson7bca8ca2018-08-30 09:30:29 +020041 */\n\n""" % datetime.datetime.now().year))
Anders Carlssondc6b4772018-01-15 13:31:03 +010042
Christoffer Jansson4e8a7732022-02-08 09:01:12 +010043 for s in args.sources:
44 outfile.write("#import <WebRTC/{}>\n".format(os.path.basename(s)))
Anders Carlssondc6b4772018-01-15 13:31:03 +010045
Christoffer Jansson4e8a7732022-02-08 09:01:12 +010046 return 0
Anders Carlssondc6b4772018-01-15 13:31:03 +010047
48
49if __name__ == '__main__':
Christoffer Jansson4e8a7732022-02-08 09:01:12 +010050 sys.exit(GenerateUmbrellaHeader())