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

Side by Side Diff: mojo/devtools/common/mojo_shell

Issue 1248533002: Allow the shell runner to run outside of Mojo checkout. (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Address Tony's comments. Created 5 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 | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/env python 1 #!/usr/bin/env python
2 # Copyright 2014 The Chromium Authors. All rights reserved. 2 # Copyright 2014 The Chromium Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be 3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file. 4 # found in the LICENSE file.
5 5
6 import argparse 6 import argparse
7 import logging 7 import logging
8 import sys 8 import sys
9 9
10 from devtoolslib.android_shell import AndroidShell 10 from devtoolslib.android_shell import AndroidShell
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
67 parser.add_argument('--logcat-tags', 67 parser.add_argument('--logcat-tags',
68 help='(android-only) Comma-separated list of additional ' 68 help='(android-only) Comma-separated list of additional '
69 'logcat tags to display on the console.') 69 'logcat tags to display on the console.')
70 70
71 # Desktop-only arguments. 71 # Desktop-only arguments.
72 parser.add_argument('--use-osmesa', action='store_true', 72 parser.add_argument('--use-osmesa', action='store_true',
73 help='(linux-only) Configure the native viewport service ' 73 help='(linux-only) Configure the native viewport service '
74 'for off-screen rendering.') 74 'for off-screen rendering.')
75 75
76 launcher_args, args = parser.parse_known_args() 76 launcher_args, args = parser.parse_known_args()
77 paths, error_msg = default_paths.infer_default_paths(launcher_args.android, 77 mojo_paths, _ = default_paths.infer_default_paths(launcher_args.android,
78 launcher_args.debug, 78 launcher_args.debug,
79 launcher_args.target_cpu) 79 launcher_args.target_cpu)
80 if not paths: 80 if mojo_paths:
81 print error_msg 81 adb_path = mojo_paths['adb']
82 return -1 82 shell_binary_path = mojo_paths['shell']
83 local_origin_path = mojo_paths['build']
84 if launcher_args.verbose:
85 print 'Running within a Mojo checkout:'
86 print ' - using the locally built shell at ' + shell_binary_path
87 print ' - using the default origin of ' + local_origin_path
88 else:
89 if launcher_args.android:
90 adb_path = 'adb'
91 shell_binary_path = None
92 local_origin_path = '.'
93 if launcher_args.verbose:
94 print 'Running outside a Mojo checkout:'
95 print ' - using the shell already installed on the device'
96 print ' - using the current working directory as default origin'
97 else:
98 print 'Running outside a Mojo checkout is not supported on Linux yet.'
99 return 1
83 100
84 if launcher_args.android: 101 if launcher_args.android:
85 verbose_pipe = sys.stdout if launcher_args.verbose else None 102 verbose_pipe = sys.stdout if launcher_args.verbose else None
86 103
87 shell = AndroidShell(paths['adb'], launcher_args.target_device, 104 shell = AndroidShell(adb_path, launcher_args.target_device,
88 logcat_tags=launcher_args.logcat_tags, 105 logcat_tags=launcher_args.logcat_tags,
89 verbose_pipe=verbose_pipe) 106 verbose_pipe=verbose_pipe)
90 device_status, error = shell.CheckDevice() 107 device_status, error = shell.CheckDevice()
91 if not device_status: 108 if not device_status:
92 print 'Device check failed: ' + error 109 print 'Device check failed: ' + error
93 return 1 110 return 1
94 shell.InstallApk(paths['shell']) 111 if shell_binary_path:
112 shell.InstallApk(shell_binary_path)
95 113
96 args = shell_arguments.RewriteMapOriginParameters(shell, args) 114 args = shell_arguments.RewriteMapOriginParameters(shell, args)
97 if not launcher_args.origin: 115 if not launcher_args.origin:
98 args.extend(shell_arguments.ConfigureLocalOrigin(shell, paths['build'])) 116 args.extend(shell_arguments.ConfigureLocalOrigin(shell,
117 local_origin_path))
99 else: 118 else:
100 shell = LinuxShell(paths['shell']) 119 shell = LinuxShell(shell_binary_path)
101 if launcher_args.use_osmesa: 120 if launcher_args.use_osmesa:
102 args.append('--args-for=mojo:native_viewport_service --use-osmesa') 121 args.append('--args-for=mojo:native_viewport_service --use-osmesa')
103 122
104 if launcher_args.origin: 123 if launcher_args.origin:
105 args.append('--origin=' + launcher_args.origin) 124 args.append('--origin=' + launcher_args.origin)
106 args = shell_arguments.AppendToArgument(args, '--url-mappings=', 125 args = shell_arguments.AppendToArgument(args, '--url-mappings=',
107 'mojo:window_manager=%s' % 126 'mojo:window_manager=%s' %
108 launcher_args.window_manager) 127 launcher_args.window_manager)
109 if not launcher_args.no_debugger: 128 if not launcher_args.no_debugger:
110 args.extend(shell_arguments.ConfigureDebugger(shell)) 129 args.extend(shell_arguments.ConfigureDebugger(shell))
111 130
112 if launcher_args.sky: 131 if launcher_args.sky:
113 args.extend(shell_arguments.ConfigureSky(shell, paths['root'], 132 if not mojo_paths:
114 paths['sky_packages'], 133 print 'Running with --sky is not supported outside of the Mojo checkout.'
134 # See https://github.com/domokit/devtools/issues/27.
135 return 1
136 args.extend(shell_arguments.ConfigureSky(shell, mojo_paths['root'],
137 mojo_paths['sky_packages'],
115 launcher_args.sky)) 138 launcher_args.sky))
116 139
117 if launcher_args.verbose: 140 if launcher_args.verbose:
118 print "Shell arguments: " + str(args) 141 print "Shell arguments: " + str(args)
119 142
120 shell.Run(args) 143 shell.Run(args)
121 return 0 144 return 0
122 145
123 146
124 if __name__ == "__main__": 147 if __name__ == "__main__":
125 sys.exit(main()) 148 sys.exit(main())
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698