Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(259)

Side by Side Diff: talk/build/export_headers

Issue 1673503002: Update build_ios_libs.sh script to build new Objective-C API (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Changes based on feedback Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 #!/usr/bin/python
2
3 # Copyright 2016 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 """Script for exporting iOS header files."""
12
13 import errno
14 import optparse
15 import os
16 import re
17 import shutil
18 import sys
19
20 old_header_dirs = ['talk/app/webrtc/objc/public']
tkchin_webrtc 2016/02/17 22:15:58 these should be constants, so all caps
hjon_webrtc 2016/02/18 19:26:41 Done.
21 new_header_dirs = ['webrtc/api/objc/', 'webrtc/base/objc/']
tkchin_webrtc 2016/02/17 22:15:58 nit: suggest legacy_header_dirs header_dirs so no
hjon_webrtc 2016/02/18 19:26:41 Done.
22 # Individual header files that should also be exported.
23 old_include_headers = []
tkchin_webrtc 2016/02/17 22:15:58 nit: header_includes header_excludes
hjon_webrtc 2016/02/18 19:26:41 Done.
24 new_include_headers = []
25 # Individual header files that should not be exported.
26 old_exclude_headers = ['talk/app/webrtc/objc/public/RTCNSGLVideoView.h']
27 new_exclude_headers = ['webrtc/api/objc/avfoundationvideocapturer.h',
28 'webrtc/api/objc/RTCNSGLVideoView.h']
29
30 def ExportHeaders(include_base_dir, use_new_headers):
31 """Exports iOS header files.
32
33 Creates an include directory and recreates the hierarchy for the header files
34 within the include directory.
35
36 Args:
37 include_base_dir: directory where the include directory should be created
38 """
39
40 include_dir_name = 'include'
41 include_path = os.path.join(include_base_dir, include_dir_name)
42
43 script_path = sys.path[0]
44 webrtc_base_path = os.path.join(script_path, '../..')
45
46 header_dirs = old_header_dirs
47 include_headers = old_include_headers
48 exclude_headers = old_exclude_headers
49 if int(use_new_headers):
50 header_dirs = new_header_dirs
51 include_headers = new_include_headers
52 exclude_headers = new_exclude_headers
53
54 for directory in header_dirs:
55 full_dir_path = os.path.join(webrtc_base_path, directory)
56 filenames = os.listdir(full_dir_path)
57 for filename in filenames:
58 if filename.endswith('.h') and not filename.endswith('+Private.h'):
59 include_headers.append(os.path.join(directory, filename))
60
61 for header in exclude_headers:
62 include_headers.remove(header)
63
64 for header_path in include_headers:
65 output_dir = os.path.join(include_path, os.path.dirname(header_path))
66 # Create hierarchy for the header file within the include directory.
67 try:
68 os.makedirs(output_dir)
69 except OSError as exc:
70 if exc.errno != errno.EEXIST:
71 raise exc
72 current_path = os.path.join(webrtc_base_path, header_path)
73 new_path = os.path.join(include_path, header_path)
74 shutil.copy(current_path, new_path)
75
76 def Main():
77 parser = optparse.OptionParser()
78 _, args = parser.parse_args()
79 if len(args) != 2:
80 parser.error('Error: Exactly 2 arguments required.')
81 include_base_dir = args[0]
82 use_new_headers = args[1]
83 ExportHeaders(include_base_dir, use_new_headers)
84
85 if __name__ == '__main__':
86 sys.exit(Main())
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698