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

Side by Side Diff: ios/chrome/tools/build/ios_generate_forwarding_headers.py

Issue 1711953003: Adds the OCHamcrest library to the iOS build. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix outputs. 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/env python
2 # Copyright 2016 The Chromium Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file.
5
6 import argparse
7 import datetime
8 import os
9 import sys
10
11 COPYRIGHT = """// Copyright {0} The Chromium Authors. All rights reserved.
12 // Use of this source code is governed by a BSD-style license that can be
13 // found in the LICENSE file.\n
14 """.format(datetime.date.today().year)
15
16 def filter_header_files(inputs):
17 return [filename for filename in inputs if filename.endswith('.h')]
18
19 def get_output_filename(input_filename, dest_dir):
20 return os.path.join(dest_dir, os.path.basename(input_filename))
21
22 def list_outputs(inputs, dest_dir):
23 outputs = []
24 for filename in filter_header_files(inputs):
25 outputs.append(get_output_filename(filename, dest_dir))
26 return ' '.join(outputs)
27
28 def generate_headers(inputs, dest_dir):
baxley 2016/02/20 01:11:51 Would it make any sense to rm the dest_dir? I know
rohitrao (ping after 24h) 2016/02/20 01:18:52 I can't arbitrarily remove dest_dir because then w
29 for filename in filter_header_files(inputs):
30 forwarding_header = get_output_filename(filename, dest_dir)
31 if not os.path.isfile(forwarding_header):
32 with open(forwarding_header, 'w') as header:
33 header.write(COPYRIGHT)
34 header.write('#import "{0}"\n'.format(filename))
35
36 def DoMain(argv):
37 parser = argparse.ArgumentParser(description='Generate forwarding headers.')
38 parser.add_argument('-o', '--list-outputs', action='store_true',
39 help='List output files and exit.')
40 parser.add_argument('-d', '--dest-dir', type=str, required=True,
41 help=('Output directory for forwarding headers.'))
42 parser.add_argument('filenames', metavar='filename', type=str, nargs='+',
43 help='Input filenames.')
44
45 args = parser.parse_args(argv)
46 if args.list_outputs:
47 return list_outputs(args.filenames, args.dest_dir)
baxley 2016/02/20 01:11:51 Does this list get printed?
rohitrao (ping after 24h) 2016/02/20 01:18:52 No, it never gets printed anywhere =) It actually
48 if args.dest_dir:
49 if not os.path.isdir(args.dest_dir):
50 os.makedirs(args.dest_dir)
51 generate_headers(args.filenames, args.dest_dir)
52 return
53 print >>sys.stderr, 'Neither -o nor -d passed, unsure what to do.'
54
55 if __name__ == '__main__':
56 DoMain(sys.argv[1:])
OLDNEW
« no previous file with comments | « DEPS ('k') | ios/ios.gyp » ('j') | ios/third_party/ochamcrest/OWNERS » ('J')

Powered by Google App Engine
This is Rietveld 408576698