OLD | NEW |
1 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 # Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
4 | 4 |
5 """Defines a set of constants shared by test runners and other scripts.""" | 5 """Defines a set of constants shared by test runners and other scripts.""" |
6 # pylint: disable=W0212 | 6 # pylint: disable=W0212 |
7 | 7 |
8 import collections | 8 import collections |
9 import logging | 9 import logging |
10 import os | 10 import os |
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
165 try: | 165 try: |
166 return os.environ['BUILDTYPE'] | 166 return os.environ['BUILDTYPE'] |
167 except KeyError: | 167 except KeyError: |
168 raise Exception('The BUILDTYPE environment variable has not been set') | 168 raise Exception('The BUILDTYPE environment variable has not been set') |
169 | 169 |
170 | 170 |
171 def SetBuildType(build_type): | 171 def SetBuildType(build_type): |
172 os.environ['BUILDTYPE'] = build_type | 172 os.environ['BUILDTYPE'] = build_type |
173 | 173 |
174 | 174 |
| 175 def SetBuildDirectory(build_directory): |
| 176 os.environ['CHROMIUM_OUT_DIR'] = build_directory |
| 177 |
| 178 |
175 def GetOutDirectory(build_type=None): | 179 def GetOutDirectory(build_type=None): |
176 """Returns the out directory where the output binaries are built. | 180 """Returns the out directory where the output binaries are built. |
177 | 181 |
178 Args: | 182 Args: |
179 build_type: Build type, generally 'Debug' or 'Release'. Defaults to the | 183 build_type: Build type, generally 'Debug' or 'Release'. Defaults to the |
180 globally set build type environment variable BUILDTYPE. | 184 globally set build type environment variable BUILDTYPE. |
181 """ | 185 """ |
182 return os.path.abspath(os.path.join( | 186 return os.path.abspath(os.path.join( |
183 DIR_SOURCE_ROOT, os.environ.get('CHROMIUM_OUT_DIR', 'out'), | 187 DIR_SOURCE_ROOT, os.environ.get('CHROMIUM_OUT_DIR', 'out'), |
184 GetBuildType() if build_type is None else build_type)) | 188 GetBuildType() if build_type is None else build_type)) |
(...skipping 20 matching lines...) Expand all Loading... |
205 subprocess.call(['adb', 'version'], stdout=devnull, stderr=devnull) | 209 subprocess.call(['adb', 'version'], stdout=devnull, stderr=devnull) |
206 return 'adb' | 210 return 'adb' |
207 except OSError: | 211 except OSError: |
208 logging.debug('No adb found in $PATH, fallback to checked in binary.') | 212 logging.debug('No adb found in $PATH, fallback to checked in binary.') |
209 return os.path.join(ANDROID_SDK_ROOT, 'platform-tools', 'adb') | 213 return os.path.join(ANDROID_SDK_ROOT, 'platform-tools', 'adb') |
210 | 214 |
211 | 215 |
212 # Exit codes | 216 # Exit codes |
213 ERROR_EXIT_CODE = 1 | 217 ERROR_EXIT_CODE = 1 |
214 WARNING_EXIT_CODE = 88 | 218 WARNING_EXIT_CODE = 88 |
OLD | NEW |