xref: /aosp_15_r20/external/webrtc/tools_webrtc/ios/generate_umbrella_header.py (revision d9f758449e529ab9291ac668be2861e7a55c2422)
1#!/usr/bin/env vpython3
2
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
11import argparse
12import datetime
13import os
14import sys
15import textwrap
16
17
18def GenerateUmbrellaHeader():
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.")
27
28  args = parser.parse_args()
29
30  with open(args.out, "w") as outfile:
31    outfile.write(
32        textwrap.dedent("""\
33    /*
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.
41     */\n\n""" % datetime.datetime.now().year))
42
43    for s in args.sources:
44      outfile.write("#import <WebRTC/{}>\n".format(os.path.basename(s)))
45
46  return 0
47
48
49if __name__ == '__main__':
50  sys.exit(GenerateUmbrellaHeader())
51