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

Side by Side Diff: build/config/ios/ios_sim.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/ios_app.py ('k') | build/config/ios/lldb_start_commands.txt » ('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 errno
8 import os
9 import subprocess
10 import sys
11 import re
12
13 SIMCTL_PATH = [
14 '/usr/bin/env',
15 'xcrun',
16 'simctl',
17 ]
18
19 PLIST_BUDDY_PATH = [
20 '/usr/bin/env',
21 'xcrun',
22 'PlistBuddy',
23 ]
24
25
26 def ApplicationIdentifier(path):
27 identifier = subprocess.check_output(PLIST_BUDDY_PATH + [
28 '-c',
29 'Print CFBundleIdentifier',
30 '%s/Info.plist' % path,
31 ])
32 return identifier.strip()
33
34
35 def Install(args):
36 return subprocess.check_call(SIMCTL_PATH + [
37 'install',
38 'booted',
39 args.path,
40 ])
41
42
43 def InstallLaunchAndWait(args, wait):
44 res = Install(args)
45
46 if res != 0:
47 return res
48
49 identifier = ApplicationIdentifier(args.path)
50
51 launch_args = [ 'launch' ]
52
53 if wait:
54 launch_args += [ '-w' ]
55
56 launch_args += [
57 'booted',
58 identifier,
59 ]
60
61 return subprocess.check_output(SIMCTL_PATH + launch_arg).strip()
62
63
64 def Launch(args):
65 InstallLaunchAndWait(args, False)
66
67
68 def Debug(args):
69 launch_res = InstallLaunchAndWait(args, True)
70 launch_pid = re.search('.*: (\d+)', launch_res).group(1)
71 return os.system(' '.join([
72 '/usr/bin/env',
73 'xcrun',
74 'lldb',
75 '-s',
76 os.path.join(os.path.dirname(__file__), 'lldb_start_commands.txt'),
77 '-p',
78 launch_pid,
79 ]))
80
81
82 def main():
83 parser = argparse.ArgumentParser(description='A script that launches an'
84 ' application in the simulator and attaches'
85 ' the debugger to the same')
86
87 parser.add_argument('-p', dest='path', required=True,
88 help='Path the the simulator application')
89
90 subparsers = parser.add_subparsers()
91
92 launch_parser = subparsers.add_parser('launch', help='Launch')
93 launch_parser.set_defaults(func=Launch)
94
95 install_parser = subparsers.add_parser('install', help='Install')
96 install_parser.set_defaults(func=Install)
97
98 debug_parser = subparsers.add_parser('debug', help='Debug')
99 debug_parser.set_defaults(func=Debug)
100
101 args = parser.parse_args()
102 return args.func(args)
103
104
105 if __name__ == '__main__':
106 sys.exit(main())
OLDNEW
« no previous file with comments | « build/config/ios/ios_app.py ('k') | build/config/ios/lldb_start_commands.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698