blob: 08e393f6c99060c9199ecba5be2be3162f6ce8d5 [file] [log] [blame]
Joe Onorato88ede352023-12-19 02:56:38 +00001# Copyright (C) 2023 The Android Open Source Project
2#
3# Licensed under the Apache License, Version 2.0 (the "License");
4# you may not use this file except in compliance with the License.
5# You may obtain a copy of the License at
6#
7# http://www.apache.org/licenses/LICENSE-2.0
8#
9# Unless required by applicable law or agreed to in writing, software
10# distributed under the License is distributed on an "AS IS" BASIS,
11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12# See the License for the specific language governing permissions and
13# limitations under the License.
14
15import os
16import pathlib
17
18DEFAULT_REPORT_DIR = "benchmarks"
19
20def get_root():
21 top_dir = os.environ.get("ANDROID_BUILD_TOP")
22 if top_dir:
23 return pathlib.Path(top_dir).resolve()
24 d = pathlib.Path.cwd()
25 while True:
26 if d.joinpath("build", "soong", "soong_ui.bash").exists():
27 return d.resolve().absolute()
28 d = d.parent
29 if d == pathlib.Path("/"):
30 return None