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

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

Issue 2101243005: Add a snapshot of flutter/engine/src/build to our sdk (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: add README.dart Created 4 years, 5 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/BUILD.gn ('k') | build/config/mac/mac_sdk.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 #!/usr/bin/python
2 # Copyright (c) 2015 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 os
8 import errno
9 import subprocess
10 import sys
11
12 PLUTIL = [
13 '/usr/bin/env',
14 'xcrun',
15 'plutil'
16 ]
17
18 IBTOOL = [
19 '/usr/bin/env',
20 'xcrun',
21 'ibtool',
22 ]
23
24
25 def MakeDirectories(path):
26 try:
27 os.makedirs(path)
28 except OSError as exc:
29 if exc.errno == errno.EEXIST and os.path.isdir(path):
30 return 0
31 else:
32 return -1
33
34 return 0
35
36
37 def ProcessInfoPlist(args):
38 output_plist_file = os.path.abspath(os.path.join(args.output, 'Info.plist'))
39 return subprocess.check_call( PLUTIL + [
40 '-convert',
41 'binary1',
42 '-o',
43 output_plist_file,
44 '--',
45 args.input,
46 ])
47
48
49 def ProcessNIB(args):
50 output_nib_file = os.path.join(os.path.abspath(args.output),
51 "%s.nib" % os.path.splitext(os.path.basename(args.input))[0])
52
53 return subprocess.check_call(IBTOOL + [
54 '--module',
55 args.module,
56 '--auto-activate-custom-fonts',
57 '--target-device',
58 'mac',
59 '--compile',
60 output_nib_file,
61 os.path.abspath(args.input),
62 ])
63
64
65 def GenerateProjectStructure(args):
66 application_path = os.path.join( args.dir, args.name + ".app", "Contents" )
67 return MakeDirectories( application_path )
68
69
70 def Main():
71 parser = argparse.ArgumentParser(description='A script that aids in '
72 'the creation of an Mac application')
73
74 subparsers = parser.add_subparsers()
75
76 # Plist Parser
77
78 plist_parser = subparsers.add_parser('plist',
79 help='Process the Info.plist')
80 plist_parser.set_defaults(func=ProcessInfoPlist)
81
82 plist_parser.add_argument('-i', dest='input', help='The input plist path')
83 plist_parser.add_argument('-o', dest='output', help='The output plist dir')
84
85 # NIB Parser
86
87 plist_parser = subparsers.add_parser('nib',
88 help='Process a NIB file')
89 plist_parser.set_defaults(func=ProcessNIB)
90
91 plist_parser.add_argument('-i', dest='input', help='The input nib path')
92 plist_parser.add_argument('-o', dest='output', help='The output nib dir')
93 plist_parser.add_argument('-m', dest='module', help='The module name')
94
95 # Directory Structure Parser
96
97 dir_struct_parser = subparsers.add_parser('structure',
98 help='Creates the directory of an Mac application')
99
100 dir_struct_parser.set_defaults(func=GenerateProjectStructure)
101
102 dir_struct_parser.add_argument('-d', dest='dir', help='Out directory')
103 dir_struct_parser.add_argument('-n', dest='name', help='App name')
104
105 # Engage!
106
107 args = parser.parse_args()
108
109 return args.func(args)
110
111
112 if __name__ == '__main__':
113 sys.exit(Main())
OLDNEW
« no previous file with comments | « build/config/mac/BUILD.gn ('k') | build/config/mac/mac_sdk.gni » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698