blob: 0999cb5d7dfe27261a504d98d82055f2089bf975 [file] [log] [blame]
# Copyright 2019 The Fuchsia Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
from recipe_engine import recipe_api
class UploadDebugSymbolsApi(recipe_api.RecipeApi):
"""APIs for uploading debug symbols."""
def __init__(self, *args, **kwargs):
super(UploadDebugSymbolsApi, self).__init__(*args, **kwargs)
self._upload_debug_symbols_tool = None
def __call__(self,
step_name,
upload_debug_symbols_path,
bucket,
build_id_dirs,
record=None,
concurrency_factor=500):
"""
Walk a list of .build-id dirs and upload all found debug symbols to GCS.
Optionally write a record of uploaded symbols to local file.
Args:
step_name (str): The name of the step produced.
upload_debug_symbols_path (Path): Path to the upload_debug_symbols tool.
bucket (str): GCS bucket to upload symbols to.
build_id_dirs (seq<Path>): Paths to .build-id dirs.
record (Path): Path to write record of uploaded symbols. By default,
does not write a record.
concurrency_factor (int): Maximum number of upload routines to spawn.
"""
self._upload_debug_symbols_tool = upload_debug_symbols_path
step_args = [
self._upload_debug_symbols_tool,
'-bucket',
bucket,
'-j',
concurrency_factor,
]
if record is not None:
step_args.extend(['-upload-record', record])
step_args.extend(build_id_dirs)
with self.m.context(infra_steps=True):
return self.m.step(step_name, step_args)