Skip to content

Commit d06beea

Browse files
authored
Fix --remote_download_regex matching all files unconditionally (#3301)
#### Summary Fix a bug in `generate_index_build_bazel_dependencies.sh` where the `--remote_download_regex` pattern matches all files unconditionally, defeating the purpose of selective downloads during Index Build. #### Problem The current regex: ``` --remote_download_regex=${indexstores_regex}.*|.*\.(cfg|c|C|cc|...)$ ``` The `.*|` at the boundary acts as an unbounded wildcard. Due to regex OR semantics, it matches every file before the alternation is even evaluated. This means all remote cache outputs are downloaded locally during Index Build, regardless of file extension. The intent was to download only indexstores (matched by `${indexstores_regex}`) and files with indexing-relevant extensions (`.swiftmodule`, `.swiftdoc`, `.swift`, headers, etc.). Instead, every output, including `.o` files, intermediate artifacts, and linked binaries, is downloaded. #### Fix Remove the erroneous `.*|` so the regex correctly constrains downloads to indexstores and listed extensions only: ``` --remote_download_regex=${indexstores_regex}.*\.(cfg|c|C|cc|...)$ ``` #### Impact In a large-scale monorepo, this bug caused Index Build's local storage to grow from an expected few GB to over 1TB, as all remote cache outputs were downloaded unconditionally. With the fix, only indexing-relevant files are downloaded. #### Related - #3078 Signed-off-by: Ryo Aoyama <r.fe51028.r@gmail.com>
1 parent ba7c9e7 commit d06beea

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

xcodeproj/internal/bazel_integration_files/generate_index_build_bazel_dependencies.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ readonly build_pre_config_flags=(
5656
# This is brittle. If different file extensions are used for compilation
5757
# inputs, they will need to be added to this list. Ideally we can stop doing
5858
# this once Bazel adds support for a Remote Output Service.
59-
"--remote_download_regex=${indexstores_regex}.*|.*\.(cfg|c|C|cc|cl|cpp|cu|cxx|c++|def|h|H|hh|hpp|hxx|h++|hmap|ilc|inc|inl|ipp|tcc|tlh|tli|tpp|m|modulemap|mm|pch|swift|swiftdoc|swiftmodule|swiftsourceinfo|yaml)$"
59+
"--remote_download_regex=${indexstores_regex}.*\.(cfg|c|C|cc|cl|cpp|cu|cxx|c++|def|h|H|hh|hpp|hxx|h++|hmap|ilc|inc|inl|ipp|tcc|tlh|tli|tpp|m|modulemap|mm|pch|swift|swiftdoc|swiftmodule|swiftsourceinfo|yaml)$"
6060
)
6161

6262
source "$BAZEL_INTEGRATION_DIR/bazel_build.sh"

0 commit comments

Comments
 (0)