Skip to content

Commit

Permalink
Add final output directory option to build/android/test_runner.py
Browse files Browse the repository at this point in the history
mojo gn build for android doesn't follow the
{OUTPUT_DIR}/{Debug|Release} format.

This CL adds a --output-directory option to build/android/test_runner.py
that allows to specify the final build directory.

R=cjhopman@chromium.org

Review URL: https://codereview.chromium.org/708123002

Cr-Commit-Position: refs/heads/master@{#303816}
  • Loading branch information
qsr authored and Commit bot committed Nov 12, 2014
1 parent 597713e commit d783e80
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
8 changes: 8 additions & 0 deletions build/android/pylib/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -216,13 +216,21 @@ def SetBuildDirectory(build_directory):
os.environ['CHROMIUM_OUT_DIR'] = build_directory


def SetOutputDirectort(output_directory):
os.environ['CHROMIUM_OUTPUT_DIR'] = output_directory


def GetOutDirectory(build_type=None):
"""Returns the out directory where the output binaries are built.
Args:
build_type: Build type, generally 'Debug' or 'Release'. Defaults to the
globally set build type environment variable BUILDTYPE.
"""
if 'CHROMIUM_OUTPUT_DIR' in os.environ:
return os.path.abspath(os.path.join(
DIR_SOURCE_ROOT, os.environ.get('CHROMIUM_OUTPUT_DIR')))

return os.path.abspath(os.path.join(
DIR_SOURCE_ROOT, os.environ.get('CHROMIUM_OUT_DIR', 'out'),
GetBuildType() if build_type is None else build_type))
Expand Down
7 changes: 7 additions & 0 deletions build/android/test_runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,11 @@ def AddCommonOptions(option_parser):
group.add_option('--build-directory', dest='build_directory',
help=('Path to the directory in which build files are'
' located (should not include build type)'))
group.add_option('--output-directory', dest='output_directory',
help=('Path to the directory in which build files are'
' located (must include build type). This will take'
' precedence over --debug, --release and'
' --build-directory'))
group.add_option('--num_retries', dest='num_retries', type='int',
default=2,
help=('Number of retries for a test before '
Expand Down Expand Up @@ -95,6 +100,8 @@ def ProcessCommonOptions(options, error_func):
constants.SetBuildType(options.build_type)
if options.build_directory:
constants.SetBuildDirectory(options.build_directory)
if options.output_directory:
constants.SetOutputDirectort(options.output_directory)
if options.environment not in constants.VALID_ENVIRONMENTS:
error_func('--environment must be one of: %s' %
', '.join(constants.VALID_ENVIRONMENTS))
Expand Down

0 comments on commit d783e80

Please sign in to comment.