From 6ab6c0fe69ed99effc8ab1ad527dd9a141926fdf Mon Sep 17 00:00:00 2001 From: Ryo Aoyama Date: Fri, 10 Apr 2026 03:01:46 +0900 Subject: [PATCH] Add `bi` output group for index builds without linking Introduce a new `bi` (build indexing) output group that contains only indexstores and their filelist, without linked product binaries. Index builds use this instead of `bp` to trigger transitive Swift compilation (producing swiftmodules, indexstores, and generated headers) while avoiding materialization of large linked binaries. This reduces remote cache download volume and build time for index builds, since only compilation artifacts needed for indexing are requested. Signed-off-by: Ryo Aoyama --- .../generate_index_build_bazel_dependencies.sh | 9 +++++---- xcodeproj/internal/files/output_files.bzl | 9 +++++++++ 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/xcodeproj/internal/bazel_integration_files/generate_index_build_bazel_dependencies.sh b/xcodeproj/internal/bazel_integration_files/generate_index_build_bazel_dependencies.sh index 4c67d3d4e..1939ed91f 100755 --- a/xcodeproj/internal/bazel_integration_files/generate_index_build_bazel_dependencies.sh +++ b/xcodeproj/internal/bazel_integration_files/generate_index_build_bazel_dependencies.sh @@ -10,11 +10,12 @@ readonly config="${BAZEL_CONFIG}_indexbuild" output_groups=( # Compile params "bc $BAZEL_TARGET_ID" - # Products (i.e. bundles) and index store data. The products themselves aren't - # used, they cause transitive files to be created. We use - # `--remote_download_regex` below to collect the files we care + # Indexstores and their filelist. Requesting indexstore directories triggers + # transitive Swift compilation (producing swiftmodules, indexstores, and + # generated headers) without linking, avoiding large product binaries. We use + # `--remote_download_regex` below to download the files we care # about. - "bp $BAZEL_TARGET_ID" + "bi $BAZEL_TARGET_ID" ) indexstores_filelists=() diff --git a/xcodeproj/internal/files/output_files.bzl b/xcodeproj/internal/files/output_files.bzl index 3b19c0f5a..1565701ee 100644 --- a/xcodeproj/internal/files/output_files.bzl +++ b/xcodeproj/internal/files/output_files.bzl @@ -262,8 +262,17 @@ def _collect_output_files( transitive = [transitive_products], ) + # Indexing output group: contains indexstores (to trigger Swift compilation) + # and the indexstores filelist (for import_indexstores). Unlike `bp`, this + # does not include linked products, avoiding large binary materialization. + indexing_depset = memory_efficient_depset( + [indexstores_filelist], + transitive = [transitive_indexstores], + ) + direct_group_list = [ ("bc {}".format(id), transitive_compile_params), + ("bi {}".format(id), indexing_depset), ("bl {}".format(id), transitive_link_params), (products_output_group_name, products_depset), ]