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

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

Issue 1871063002: [iOS/OSX] Remove unused GN templates and helper scripts. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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/ios/lldb_start_commands.txt ('k') | build/config/mac/rules.gni » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 # Copyright (c) 2015 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file.
4
5 import argparse
6 import errno
7 import os
8 import subprocess
9 import sys
10
11 def MakeDirectories(path):
12 try:
13 os.makedirs(path)
14 except OSError as exc:
15 if exc.errno == errno.EEXIST and os.path.isdir(path):
16 return 0
17 else:
18 return -1
19
20 return 0
21
22
23 def ProcessInfoPlist(args):
24 output_plist_file = os.path.abspath(os.path.join(args.output, 'Info.plist'))
25 return subprocess.check_call([
26 '/usr/bin/env',
27 'xcrun',
28 'plutil',
29 '-convert',
30 'binary1',
31 '-o',
32 output_plist_file,
33 '--',
34 args.input,
35 ])
36
37
38 def ProcessNIB(args):
39 output_nib_file = os.path.join(os.path.abspath(args.output),
40 "%s.nib" % os.path.splitext(os.path.basename(args.input))[0])
41
42 return subprocess.check_call([
43 '/usr/bin/env',
44 'xcrun',
45 'ibtool',
46 '--module',
47 args.module,
48 '--auto-activate-custom-fonts',
49 '--target-device',
50 'mac',
51 '--compile',
52 output_nib_file,
53 os.path.abspath(args.input),
54 ])
55
56
57 def GenerateProjectStructure(args):
58 application_path = os.path.join( args.dir, args.name + ".app", "Contents" )
59 return MakeDirectories( application_path )
60
61
62 def main():
63 parser = argparse.ArgumentParser(description='A script that aids in '
64 'the creation of an Mac application')
65
66 subparsers = parser.add_subparsers()
67
68 # Plist Parser
69 plist_parser = subparsers.add_parser('plist',
70 help='Process the Info.plist')
71 plist_parser.set_defaults(func=ProcessInfoPlist)
72
73 plist_parser.add_argument('-i', dest='input', help='The input plist path')
74 plist_parser.add_argument('-o', dest='output', help='The output plist dir')
75
76 # NIB Parser
77 plist_parser = subparsers.add_parser('nib',
78 help='Process a NIB file')
79 plist_parser.set_defaults(func=ProcessNIB)
80
81 plist_parser.add_argument('-i', dest='input', help='The input nib path')
82 plist_parser.add_argument('-o', dest='output', help='The output nib dir')
83 plist_parser.add_argument('-m', dest='module', help='The module name')
84
85 # Directory Structure Parser
86 dir_struct_parser = subparsers.add_parser('structure',
87 help='Creates the directory of an Mac application')
88
89 dir_struct_parser.set_defaults(func=GenerateProjectStructure)
90
91 dir_struct_parser.add_argument('-d', dest='dir', help='Out directory')
92 dir_struct_parser.add_argument('-n', dest='name', help='App name')
93
94 args = parser.parse_args()
95 return args.func(args)
96
97
98 if __name__ == '__main__':
99 sys.exit(main())
OLDNEW
« no previous file with comments | « build/config/ios/lldb_start_commands.txt ('k') | build/config/mac/rules.gni » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698