Exclude prebuilts/clang/host/linux-x86/clang-dev/BUILD from the symlink forest.
Background: toolchain/llvm_android/test_compiler.py generates clang-dev, a directory symlink pointing to out/install/linux-x86/clang-dev, which itself contains a BUILD file. This BUILD file should be excluded from the symlink forest because it's not an allowlisted BUILD file. Problem: However, our current symlink forest logic and finder logic doesn't handle this situation. It's not in bazel.list: ``` $ less out/.module_paths/bazel.list | grep prebuilts/clang prebuilts/clang/host/linux-x86/BUILD.bazel prebuilts/clang/host/linux-x86/cc_toolchain_config.bzl prebuilts/clang/host/linux-x86/cc_toolchain_constants.bzl prebuilts/clang/host/linux-x86/cc_toolchain_features.bzl prebuilts/clang/host/linux-x86/clang-r450784d/BUILD.bazel prebuilts/clang/host/linux-x86/clang-r450784e/BUILD.bazel prebuilts/clang/host/linux-x86/clang-r458507/BUILD.bazel prebuilts/clang/host/linux-x86/clang-r468909/BUILD.bazel prebuilts/clang/host/linux-x86/clang-r468909b/BUILD.bazel prebuilts/clang/host/linux-x86/clang-r475365/BUILD.bazel ``` The symlink forest logic uses this bazel.list file and matches it against the keepExistingBuildFile list to exclude BUILD files from the symlink forest. Since clang-dev/BUILD.bazel is not in bazel.list, it's symlinked into the forest. All of these gymnastics could be avoided if we added custom BUILD file name support to Bazel, and only symlinked (e.g.) Android.bazel and ignored all other BUILD files in the tree. It would be very clear which checked-in BUILD files we want to use in the symlink forest. I think we should pursue custom BUILD file names instead of adding more complexities, to say, the finder logic, to support such a use case. It's also why I decided to add this hardcoded exclusion to keep the workaround simple. Bug: 260809113 Test: presubmits Test: $ DIST_DIR=/tmp/dist prebuilts/python/linux-x86/bin/python3 toolchain/llvm_android/test_compiler.py --build-only --target aosp_raven-userdebug --no-clean-built-target --module dist --module droid --module tidy-soong_subset --with-tidy ./ Change-Id: I415371543585c1c5e8e00e6958105f65ea5978ee
Loading
Please register or sign in to comment