xref: /aosp_15_r20/external/webrtc/tools_webrtc/ios/generate_modulemap.py (revision d9f758449e529ab9291ac668be2861e7a55c2422)
1*d9f75844SAndroid Build Coastguard Worker#!/usr/bin/env vpython3
2*d9f75844SAndroid Build Coastguard Worker
3*d9f75844SAndroid Build Coastguard Worker# Copyright (c) 2018 The WebRTC project authors. All Rights Reserved.
4*d9f75844SAndroid Build Coastguard Worker#
5*d9f75844SAndroid Build Coastguard Worker# Use of this source code is governed by a BSD-style license
6*d9f75844SAndroid Build Coastguard Worker# that can be found in the LICENSE file in the root of the source
7*d9f75844SAndroid Build Coastguard Worker# tree. An additional intellectual property rights grant can be found
8*d9f75844SAndroid Build Coastguard Worker# in the file PATENTS.  All contributing project authors may
9*d9f75844SAndroid Build Coastguard Worker# be found in the AUTHORS file in the root of the source tree.
10*d9f75844SAndroid Build Coastguard Worker
11*d9f75844SAndroid Build Coastguard Workerimport argparse
12*d9f75844SAndroid Build Coastguard Workerimport sys
13*d9f75844SAndroid Build Coastguard Worker
14*d9f75844SAndroid Build Coastguard Worker
15*d9f75844SAndroid Build Coastguard Workerdef GenerateModulemap():
16*d9f75844SAndroid Build Coastguard Worker  parser = argparse.ArgumentParser(description='Generate modulemap')
17*d9f75844SAndroid Build Coastguard Worker  parser.add_argument("-o", "--out", type=str, help="Output file.")
18*d9f75844SAndroid Build Coastguard Worker  parser.add_argument("-n", "--name", type=str, help="Name of binary.")
19*d9f75844SAndroid Build Coastguard Worker
20*d9f75844SAndroid Build Coastguard Worker  args = parser.parse_args()
21*d9f75844SAndroid Build Coastguard Worker
22*d9f75844SAndroid Build Coastguard Worker  with open(args.out, "w") as outfile:
23*d9f75844SAndroid Build Coastguard Worker    module_template = 'framework module %s {\n' \
24*d9f75844SAndroid Build Coastguard Worker                      '  umbrella header "%s.h"\n' \
25*d9f75844SAndroid Build Coastguard Worker                      '\n' \
26*d9f75844SAndroid Build Coastguard Worker                      '  export *\n' \
27*d9f75844SAndroid Build Coastguard Worker                      '  module * { export * }\n' \
28*d9f75844SAndroid Build Coastguard Worker                      '}\n' % (args.name, args.name)
29*d9f75844SAndroid Build Coastguard Worker    outfile.write(module_template)
30*d9f75844SAndroid Build Coastguard Worker  return 0
31*d9f75844SAndroid Build Coastguard Worker
32*d9f75844SAndroid Build Coastguard Worker
33*d9f75844SAndroid Build Coastguard Workerif __name__ == '__main__':
34*d9f75844SAndroid Build Coastguard Worker  sys.exit(GenerateModulemap())
35