Skip to content

Bug: index builds invalidate regular builds #3168

@mjburghard

Description

@mjburghard

Description

rules_xcodeproj's index build invalidate some actions/output of regular builds, causing recompiles during consecutive builds without any local changes or invalidations of unrelated parts of the build graph.

Reproduction steps

Reproduction steps for iOSApp in rules_xcodeproj/examples/integration:

  1. Generate a project (bazelisk run //:xcodeproj-incremental-bazel-sim_arm64)
  2. Build iOSApp on the command line using the bazel invocation Xcode would produce
  3. Run same invocation again
  4. Run index build invocation from Xcode on the command line for @//Lib/dist/dynamic:iOS
  5. Run build invocation for iOS App again.
    Important: Keep Xcode closed while performing the steps above.

Bazel invocation for steps two, three and five:

bazel \
--host_jvm_args=-Xdock:name=/Applications/Xcode.app/Contents/Developer \
--noworkspace_rc \
--bazelrc=<path_to>/rules_xcodeproj/examples/integration/Integration.xcodeproj/rules_xcodeproj/bazel/xcodeproj.bazelrc \
--bazelrc=.bazelrc \
--output_base <path_to>/rules_xcodeproj/examples/integration/bazel-output-base/rules_xcodeproj.noindex/build_output_base build \
--xcode_version=16A242d \
--repo_env=DEVELOPER_DIR=/Applications/Xcode.app/Contents/Developer \
--repo_env=USE_CLANG_CL=16A242d --repo_env=XCODE_VERSION=16A242d \
--bes_upload_mode=NOWAIT_FOR_UPLOAD_COMPLETE \
'--remote_download_regex=.*\.indexstore/.*|.*\.(a|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)$' \
--nokeep_going \
--config=_rules_xcodeproj_integration_build \
--color=yes \
'--output_groups=index_import,target_ids_list,bc @@//iOSApp/Source:iOSApp ios_sim_arm64-dbg-ios-sim_arm64-min15.0-applebin_ios-ST-076e152330dd,bp @@//iOSApp/Source:iOSApp ios_sim_arm64-dbg-ios-sim_arm64-min15.0-applebin_ios-ST-076e152330dd,bi @@//iOSApp/Source:iOSApp ios_sim_arm64-dbg-ios-sim_arm64-min15.0-applebin_ios-ST-076e152330dd' @@rules_xcodeproj++internal+rules_xcodeproj_generated//generator/xcodeproj-incremental-bazel-sim_arm64:xcodeproj-incremental-bazel-sim_arm64 \
--build_metadata=PATTERN=@@//iOSApp/Source:iOSApp

Bazel invocation for step four:

bazel \
    --host_jvm_args=-Xdock:name=/Applications/Xcode.app/Contents/Developer \
    --noworkspace_rc \
    --bazelrc=<path_to>/rules_xcodeproj/examples/integration/Integration.xcodeproj/rules_xcodeproj/bazel/xcodeproj.bazelrc \
    --bazelrc=.bazelrc \
    --output_base <path_to>/rules_xcodeproj/examples/integration/bazel-output-base/rules_xcodeproj.noindex/build_output_base \
    --preemptible \
    build \
    --xcode_version=16A242d \
    --repo_env=DEVELOPER_DIR=/Applications/Xcode.app/Contents/Developer \
    --repo_env=USE_CLANG_CL=16A242d \
    --repo_env=XCODE_VERSION=16A242d \
    --bes_upload_mode=NOWAIT_FOR_UPLOAD_COMPLETE \
    '--remote_download_regex=.*\.indexstore/.*|.*|.*\.(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)$' \
    --config=rules_xcodeproj_integration_indexbuild \
    --color=yes \
    '--output_groups=bc @@//Lib/dist/dynamic:iOS ios_sim_arm64-dbg-ios-sim_arm64-min15.0-applebin_ios-ST-076e152330dd,bp @@//Lib/dist/dynamic:iOS ios_sim_arm64-dbg-ios-sim_arm64-min15.0-applebin_ios-ST-076e152330dd,index_import,bi @@//Lib/dist/dynamic:iOS ios_sim_arm64-dbg-ios-sim_arm64-min15.0-applebin_ios-ST-076e152330dd' @@rules_xcodeproj++internal+rules_xcodeproj_generated//generator/xcodeproj-incremental-bazel-sim_arm64:xcodeproj-incremental-bazel-sim_arm64

Expected behavior

Index build actions can run in the background without causing recompiles for the next regular build.

rules_xcodeproj version

41929ac

Xcode version

16.0

Bazel version

8.1.1, 7.5.0

rules_apple version

3.16.1

rules_swift version

2.8.0

Additional information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions