Skip to content

Commit 4a9fa8d

Browse files
committed
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.
1 parent ba7c9e7 commit 4a9fa8d

2 files changed

Lines changed: 14 additions & 4 deletions

File tree

xcodeproj/internal/bazel_integration_files/generate_index_build_bazel_dependencies.sh

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,12 @@ readonly config="${BAZEL_CONFIG}_indexbuild"
1010
output_groups=(
1111
# Compile params
1212
"bc $BAZEL_TARGET_ID"
13-
# Products (i.e. bundles) and index store data. The products themselves aren't
14-
# used, they cause transitive files to be created. We use
15-
# `--remote_download_regex` below to collect the files we care
13+
# Indexstores and their filelist. Requesting indexstore directories triggers
14+
# transitive Swift compilation (producing swiftmodules, indexstores, and
15+
# generated headers) without linking, avoiding large product binaries. We use
16+
# `--remote_download_regex` below to download the files we care
1617
# about.
17-
"bp $BAZEL_TARGET_ID"
18+
"bi $BAZEL_TARGET_ID"
1819
)
1920

2021
indexstores_filelists=()

xcodeproj/internal/files/output_files.bzl

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -262,8 +262,17 @@ def _collect_output_files(
262262
transitive = [transitive_products],
263263
)
264264

265+
# Indexing output group: contains indexstores (to trigger Swift compilation)
266+
# and the indexstores filelist (for import_indexstores). Unlike `bp`, this
267+
# does not include linked products, avoiding large binary materialization.
268+
indexing_depset = memory_efficient_depset(
269+
[indexstores_filelist],
270+
transitive = [transitive_indexstores],
271+
)
272+
265273
direct_group_list = [
266274
("bc {}".format(id), transitive_compile_params),
275+
("bi {}".format(id), indexing_depset),
267276
("bl {}".format(id), transitive_link_params),
268277
(products_output_group_name, products_depset),
269278
]

0 commit comments

Comments
 (0)