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

Side by Side Diff: build/config/mac/compile_xib.py

Issue 2387723002: Test CL to demonstrate GN + hermetic toolchain
Patch Set: more fixes. Created 4 years, 2 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
« no previous file with comments | « build/config/mac/base_rules.gni ('k') | build/config/mac/xcrun.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright 2016 The Chromium Authors. All rights reserved. 1 # Copyright 2016 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be 2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file. 3 # found in the LICENSE file.
4 4
5 5
6 import argparse 6 import argparse
7 import logging
7 import os 8 import os
8 import re 9 import re
9 import subprocess 10 import subprocess
10 import sys 11 import sys
11 12
12 13
13 def main(): 14 def main():
14 parser = argparse.ArgumentParser( 15 parser = argparse.ArgumentParser(
15 description='A script to compile xib and storyboard.', 16 description='A script to compile xib and storyboard.',
16 fromfile_prefix_chars='@') 17 fromfile_prefix_chars='@')
17 parser.add_argument('-o', '--output', required=True, 18 parser.add_argument('-o', '--output', required=True,
18 help='Path to output bundle.') 19 help='Path to output bundle.')
19 parser.add_argument('-i', '--input', required=True, 20 parser.add_argument('-i', '--input', required=True,
20 help='Path to input xib or storyboard.') 21 help='Path to input xib or storyboard.')
22 parser.add_argument('--developer_dir', required=False,
23 help='Path to ibtool.')
21 args, unknown_args = parser.parse_known_args() 24 args, unknown_args = parser.parse_known_args()
22 25
23 ibtool_args = [ 26 ibtool_args = ['xcrun', 'ibtool']
24 'xcrun', 'ibtool', 27 if (args.developer_dir):
28 os.environ['DEVELOPER_DIR'] = args.developer_dir
29 # ibtools_args = [ args.ibtool_path ]
30
31 ibtool_args.extend([
25 '--errors', '--warnings', '--notices', 32 '--errors', '--warnings', '--notices',
26 '--output-format', 'human-readable-text' 33 '--output-format', 'human-readable-text'
27 ] 34 ])
28 ibtool_args += unknown_args 35 ibtool_args += unknown_args
29 ibtool_args += [ 36 ibtool_args += [
30 '--compile', 37 '--compile',
31 os.path.abspath(args.output), 38 os.path.abspath(args.output),
32 os.path.abspath(args.input) 39 os.path.abspath(args.input)
33 ] 40 ]
34 41
35 ibtool_section_re = re.compile(r'/\*.*\*/') 42 ibtool_section_re = re.compile(r'/\*.*\*/')
36 ibtool_re = re.compile(r'.*note:.*is clipping its content') 43 ibtool_re = re.compile(r'.*note:.*is clipping its content')
37 ibtoolout = subprocess.Popen(ibtool_args, stdout=subprocess.PIPE) 44 ibtoolout = subprocess.Popen(ibtool_args, stdout=subprocess.PIPE)
38 current_section_header = None 45 current_section_header = None
39 for line in ibtoolout.stdout: 46 for line in ibtoolout.stdout:
40 if ibtool_section_re.match(line): 47 if ibtool_section_re.match(line):
41 current_section_header = line 48 current_section_header = line
42 elif not ibtool_re.match(line): 49 elif not ibtool_re.match(line):
43 if current_section_header: 50 if current_section_header:
44 sys.stdout.write(current_section_header) 51 sys.stdout.write(current_section_header)
45 current_section_header = None 52 current_section_header = None
46 sys.stdout.write(line) 53 sys.stdout.write(line)
47 return ibtoolout.returncode 54 return ibtoolout.returncode
48 55
49 56
50 if __name__ == '__main__': 57 if __name__ == '__main__':
51 sys.exit(main()) 58 sys.exit(main())
OLDNEW
« no previous file with comments | « build/config/mac/base_rules.gni ('k') | build/config/mac/xcrun.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698