blob: 531fb6c4ccca09aa72407fcc59ea8cc205bc2193 [file]
# Copyright (C) 2026 The Android Open Source Project
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import os
import pathlib
def find_bp_files(*root_dirs):
"""
Recursively searches for all Android.bp files under the given directories.
Args:
*root_dirs: Variable number of directories to start the search from.
Returns:
A list of absolute paths to all found Android.bp files.
"""
# TODO: Can we cache this somehow to make it faster?
bp_files = []
for root_dir in root_dirs:
for root, _, files in os.walk(root_dir):
if "Android.bp" in files:
bp_files.append(pathlib.Path(root) / "Android.bp")
return bp_files