Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ END_UNRELEASED_TEMPLATE

### New

* TBD
* Added `--@rules_xcodeproj//xcodeproj:separate_index_build_output_base` flag to configure the generator to use a separate output base for index builds: [#3243](https://github.com/MobileNativeFoundation/rules_xcodeproj/pull/3243)

### Adjusted

Expand Down
10 changes: 10 additions & 0 deletions docs/usage.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
- [Workspace `xcodeproj.bazelrc`](#workspace-xcodeprojbazelrc)
- [Workspace `.bazelrc`](#workspace-bazelrc)
- [Project `xcodeproj_extra_flags.bazelrc`](#project-xcodeproj_extra_flagsbazelrc)
- [Separate the index build output base](#separate-the-index-build-output-base)
- [Command-line API](#command-line-api)
- [Commands](#commands)
- [`build`](#build)
Expand Down Expand Up @@ -187,6 +188,15 @@ a project `xcodeproj_extra_flags.bazelrc` file, which is loaded after the
workspace `.bazelrc` file. This ensures that they override any flags set
earlier, mimicking the behavior of command-line set flags taking precedence.

## Separate the index build output base

By default, rules_xcodeproj configures Xcode to use a combined output base For
both normal builds and index builds. This is done to save disk space and improve
cache hit rates, since both types of builds can share outputs. However, if you
find that index builds are interfering with normal builds, you can disable
this behavior during project generation by setting
`--@rules_xcodeproj//xcodeproj:separate_index_build_output_base` in your bazelrc.

# Command-line API

rules_xcodeproj builds targets in its own
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ def _write_pbxproj_prefix_test_impl(ctx):
pre_build_script = ctx.attr.pre_build_script,
project_options = ctx.attr.project_options,
resolved_repositories_file = ctx.attr.resolved_repositories_file,
separate_index_build_output_base = ctx.attr.separate_index_build_output_base,
target_ids_list = ctx.attr.target_ids_list,
tool = None,
workspace_directory = ctx.attr.workspace_directory,
Expand Down Expand Up @@ -153,6 +154,7 @@ write_pbxproj_prefix_test = unittest.make(
"pre_build_script": attr.string(),
"project_options": attr.string_dict(mandatory = True),
"resolved_repositories_file": attr.string(mandatory = True),
"separate_index_build_output_base": attr.bool(mandatory = True),
"target_ids_list": attr.string(mandatory = True),
"workspace_directory": attr.string(mandatory = True),
"xcode_configurations": attr.string_list(mandatory = True),
Expand Down Expand Up @@ -190,6 +192,7 @@ def write_pbxproj_prefix_test_suite(name):
pre_build_script = None,
project_options,
resolved_repositories_file,
separate_index_build_output_base = False,
target_ids_list,
workspace_directory,
xcode_configurations,
Expand All @@ -215,6 +218,7 @@ def write_pbxproj_prefix_test_suite(name):
pre_build_script = pre_build_script,
project_options = project_options,
resolved_repositories_file = resolved_repositories_file,
separate_index_build_output_base = separate_index_build_output_base,
target_ids_list = target_ids_list,
workspace_directory = workspace_directory,
xcode_configurations = xcode_configurations,
Expand Down Expand Up @@ -271,6 +275,8 @@ def write_pbxproj_prefix_test_suite(name):
"some/path/to/legacy/index_import",
# indexImport
"some/path/to/index_import",
# separateIndexBuildOutputBase
"0",
# resolvedRepositoriesFile
"some/path/to/resolved_repositories_file",
# minimumXcodeVersion
Expand Down Expand Up @@ -316,6 +322,7 @@ def write_pbxproj_prefix_test_suite(name):
"organization_name": "MobileNativeFoundation 2",
},
minimum_xcode_version = "14.2.1",
separate_index_build_output_base = True,
resolved_repositories_file = "some/path/to/resolved_repositories_file",
target_ids_list = "a/path/to/target_ids_list",
workspace_directory = "/Users/TimApple/StarBoard",
Expand All @@ -340,6 +347,8 @@ def write_pbxproj_prefix_test_suite(name):
"some/path/to/legacy/index_import",
# indexImport
"some/path/to/index_import",
# separateIndexBuildOutputBase
"1",
# resolvedRepositoriesFile
"some/path/to/resolved_repositories_file",
# minimumXcodeVersion
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ def _write_target_build_settings_test_impl(ctx):
previews_include_path = ctx.attr.previews_include_path,
provisioning_profile_is_xcode_managed = ctx.attr.provisioning_profile_is_xcode_managed,
provisioning_profile_name = ctx.attr.provisioning_profile_name,
separate_index_build_output_base = ctx.attr.separate_index_build_output_base,
swift_args = swift_args,
swift_debug_settings_to_merge = swift_debug_settings_to_merge,
team_id = ctx.attr.team_id,
Expand Down Expand Up @@ -185,6 +186,7 @@ write_target_build_settings_test = unittest.make(
"previews_include_path": attr.string(mandatory = True),
"provisioning_profile_is_xcode_managed": attr.bool(mandatory = True),
"provisioning_profile_name": attr.string(),
"separate_index_build_output_base": attr.bool(mandatory = True),
"swift_debug_settings_to_merge": attr.string_list(mandatory = True),
"swift_args": attr.string_list(mandatory = True),
"team_id": attr.string(),
Expand Down Expand Up @@ -229,6 +231,7 @@ def write_target_build_settings_test_suite(name):
previews_include_path = "",
provisioning_profile_is_xcode_managed = False,
provisioning_profile_name = None,
separate_index_build_output_base = False,
swift_args,
swift_debug_settings_to_merge = [],
team_id = None,
Expand Down Expand Up @@ -261,6 +264,7 @@ def write_target_build_settings_test_suite(name):
previews_include_path = previews_include_path,
provisioning_profile_is_xcode_managed = provisioning_profile_is_xcode_managed,
provisioning_profile_name = provisioning_profile_name,
separate_index_build_output_base = separate_index_build_output_base,
swift_args = swift_args,
swift_debug_settings_to_merge = swift_debug_settings_to_merge,
team_id = team_id,
Expand Down Expand Up @@ -338,6 +342,8 @@ def write_target_build_settings_test_suite(name):
"",
# previewsIncludePath
"",
# separateIndexBuildOutputBase
"0",
],
)

Expand Down Expand Up @@ -386,6 +392,8 @@ def write_target_build_settings_test_suite(name):
"",
# previewsIncludePath
"",
# separateIndexBuildOutputBase
"0",
],
)

Expand Down Expand Up @@ -432,6 +440,8 @@ def write_target_build_settings_test_suite(name):
"",
# previewsIncludePath
"",
# separateIndexBuildOutputBase
"0",
],
)

Expand Down Expand Up @@ -478,6 +488,8 @@ def write_target_build_settings_test_suite(name):
"",
# previewsIncludePath
"",
# separateIndexBuildOutputBase
"0",
],
)

Expand Down Expand Up @@ -531,6 +543,8 @@ def write_target_build_settings_test_suite(name):
"",
# previewsIncludePath
"",
# separateIndexBuildOutputBase
"0",
],
)

Expand Down Expand Up @@ -584,6 +598,8 @@ def write_target_build_settings_test_suite(name):
"",
# previewsIncludePath
"",
# separateIndexBuildOutputBase
"0",
],
)

Expand Down Expand Up @@ -636,6 +652,8 @@ def write_target_build_settings_test_suite(name):
"",
# previewsIncludePath
"",
# separateIndexBuildOutputBase
"0",
],
)

Expand Down Expand Up @@ -692,6 +710,8 @@ def write_target_build_settings_test_suite(name):
"",
# previewsIncludePath
"",
# separateIndexBuildOutputBase
"0",
],
)

Expand All @@ -717,6 +737,7 @@ def write_target_build_settings_test_suite(name):
"external/repo/1.framework",
],
previews_include_path = "bazel-out/swiftmodule/parent",
separate_index_build_output_base = True,
swift_args = [],
swift_debug_settings_to_merge = [
"transitive_debug_settings/3",
Expand Down Expand Up @@ -771,6 +792,8 @@ def write_target_build_settings_test_suite(name):
""",
# previewsIncludePath
"bazel-out/swiftmodule/parent",
# separateIndexBuildOutputBase
"1",
],
)

Expand Down
8 changes: 4 additions & 4 deletions tools/generators/pbxnativetargets/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ Here is an example output:
LINK_PARAMS_FILE = "$(BAZEL_OUT)/darwin_arm64-dbg/bin/external/_main~internal~rules_xcodeproj_generated/generator/tools/xcodeproj/xcodeproj-params/pbxtargetdependencies_tests.25.link.params";
MACOSX_DEPLOYMENT_TARGET = 13.0;
OTHER_LDFLAGS = "@$(DERIVED_FILE_DIR)/link.params";
OTHER_SWIFT_FLAGS = "-Xcc -working-directory -Xcc $(PROJECT_DIR) -working-directory $(PROJECT_DIR) $(PREVIEWS_SWIFT_INCLUDE__$(ENABLE_PREVIEWS)) -DDEBUG -Onone -enable-testing -F$(DEVELOPER_DIR)/Platforms/MacOSX.platform/Developer/Library/Frameworks -I$(DEVELOPER_DIR)/Platforms/MacOSX.platform/Developer/usr/lib -I$(BAZEL_OUT)/macos-arm64-min13.0-applebin_macos-darwin_arm64-dbg-ST-95054d4cebee/bin/external/_main~non_module_deps~com_github_apple_swift_argument_parser -I$(BAZEL_OUT)/macos-arm64-min13.0-applebin_macos-darwin_arm64-dbg-ST-95054d4cebee/bin/tools/lib/ToolCommon -I$(BAZEL_OUT)/macos-arm64-min13.0-applebin_macos-darwin_arm64-dbg-ST-95054d4cebee/bin/external/_main~non_module_deps~com_github_apple_swift_collections -I$(BAZEL_OUT)/macos-arm64-min13.0-applebin_macos-darwin_arm64-dbg-ST-95054d4cebee/bin/tools/generators/lib/PBXProj -I$(BAZEL_OUT)/macos-arm64-min13.0-applebin_macos-darwin_arm64-dbg-ST-95054d4cebee/bin/tools/generators/pbxtargetdependencies -I$(BAZEL_OUT)/macos-arm64-min13.0-applebin_macos-darwin_arm64-dbg-ST-95054d4cebee/bin/external/_main~dev_non_module_deps~com_github_pointfreeco_xctest_dynamic_overlay -I$(BAZEL_OUT)/macos-arm64-min13.0-applebin_macos-darwin_arm64-dbg-ST-95054d4cebee/bin/external/_main~dev_non_module_deps~com_github_pointfreeco_swift_custom_dump -Xcc -iquote -Xcc $(PROJECT_DIR) -Xcc -iquote -Xcc $(BAZEL_OUT)/macos-arm64-min13.0-applebin_macos-darwin_arm64-dbg-ST-95054d4cebee/bin -static -Xcc -O0 -Xcc -DDEBUG=1 -Xcc -fstack-protector -Xcc -fstack-protector-all";
OTHER_SWIFT_FLAGS = "-Xcc -working-directory -Xcc $(PROJECT_DIR) -working-directory $(PROJECT_DIR) -Xcc -ivfsoverlay$(OBJROOT)/bazel-out-overlay.yaml -vfsoverlay $(OBJROOT)/bazel-out-overlay.yaml $(PREVIEWS_SWIFT_INCLUDE__$(ENABLE_PREVIEWS)) -DDEBUG -Onone -enable-testing -F$(DEVELOPER_DIR)/Platforms/MacOSX.platform/Developer/Library/Frameworks -I$(DEVELOPER_DIR)/Platforms/MacOSX.platform/Developer/usr/lib -I$(BAZEL_OUT)/macos-arm64-min13.0-applebin_macos-darwin_arm64-dbg-ST-95054d4cebee/bin/external/_main~non_module_deps~com_github_apple_swift_argument_parser -I$(BAZEL_OUT)/macos-arm64-min13.0-applebin_macos-darwin_arm64-dbg-ST-95054d4cebee/bin/tools/lib/ToolCommon -I$(BAZEL_OUT)/macos-arm64-min13.0-applebin_macos-darwin_arm64-dbg-ST-95054d4cebee/bin/external/_main~non_module_deps~com_github_apple_swift_collections -I$(BAZEL_OUT)/macos-arm64-min13.0-applebin_macos-darwin_arm64-dbg-ST-95054d4cebee/bin/tools/generators/lib/PBXProj -I$(BAZEL_OUT)/macos-arm64-min13.0-applebin_macos-darwin_arm64-dbg-ST-95054d4cebee/bin/tools/generators/pbxtargetdependencies -I$(BAZEL_OUT)/macos-arm64-min13.0-applebin_macos-darwin_arm64-dbg-ST-95054d4cebee/bin/external/_main~dev_non_module_deps~com_github_pointfreeco_xctest_dynamic_overlay -I$(BAZEL_OUT)/macos-arm64-min13.0-applebin_macos-darwin_arm64-dbg-ST-95054d4cebee/bin/external/_main~dev_non_module_deps~com_github_pointfreeco_swift_custom_dump -Xcc -iquote -Xcc $(PROJECT_DIR) -Xcc -iquote -Xcc $(BAZEL_OUT)/macos-arm64-min13.0-applebin_macos-darwin_arm64-dbg-ST-95054d4cebee/bin -static -Xcc -O0 -Xcc -DDEBUG=1 -Xcc -fstack-protector -Xcc -fstack-protector-all";
PREVIEWS_SWIFT_INCLUDE__ = "";
PREVIEWS_SWIFT_INCLUDE__NO = "";
PREVIEWS_SWIFT_INCLUDE__YES = "-I$(BAZEL_OUT)/macos-arm64-min13.0-applebin_macos-darwin_arm64-dbg-ST-95054d4cebee/bin/tools/generators/pbxtargetdependencies";
Expand Down Expand Up @@ -153,7 +153,7 @@ Here is an example output:
LINK_PARAMS_FILE = "$(BAZEL_OUT)/darwin_arm64-dbg/bin/external/_main~internal~rules_xcodeproj_generated/generator/tools/xcodeproj/xcodeproj-params/pbxtargetdependencies_tests.54.link.params";
MACOSX_DEPLOYMENT_TARGET = 13.0;
OTHER_LDFLAGS = "@$(DERIVED_FILE_DIR)/link.params";
OTHER_SWIFT_FLAGS = "-Xcc -working-directory -Xcc $(PROJECT_DIR) -working-directory $(PROJECT_DIR) $(PREVIEWS_SWIFT_INCLUDE__$(ENABLE_PREVIEWS)) -DNDEBUG -O -F$(DEVELOPER_DIR)/Platforms/MacOSX.platform/Developer/Library/Frameworks -I$(DEVELOPER_DIR)/Platforms/MacOSX.platform/Developer/usr/lib -I$(BAZEL_OUT)/macos-arm64-min13.0-applebin_macos-darwin_arm64-opt-ST-1f5196d1a0d9/bin/external/_main~non_module_deps~com_github_apple_swift_argument_parser -I$(BAZEL_OUT)/macos-arm64-min13.0-applebin_macos-darwin_arm64-opt-ST-1f5196d1a0d9/bin/tools/lib/ToolCommon -I$(BAZEL_OUT)/macos-arm64-min13.0-applebin_macos-darwin_arm64-opt-ST-1f5196d1a0d9/bin/external/_main~non_module_deps~com_github_apple_swift_collections -I$(BAZEL_OUT)/macos-arm64-min13.0-applebin_macos-darwin_arm64-opt-ST-1f5196d1a0d9/bin/tools/generators/lib/PBXProj -I$(BAZEL_OUT)/macos-arm64-min13.0-applebin_macos-darwin_arm64-opt-ST-1f5196d1a0d9/bin/tools/generators/pbxtargetdependencies -I$(BAZEL_OUT)/macos-arm64-min13.0-applebin_macos-darwin_arm64-opt-ST-1f5196d1a0d9/bin/external/_main~dev_non_module_deps~com_github_pointfreeco_xctest_dynamic_overlay -I$(BAZEL_OUT)/macos-arm64-min13.0-applebin_macos-darwin_arm64-opt-ST-1f5196d1a0d9/bin/external/_main~dev_non_module_deps~com_github_pointfreeco_swift_custom_dump -Xcc -iquote -Xcc $(PROJECT_DIR) -Xcc -iquote -Xcc $(BAZEL_OUT)/macos-arm64-min13.0-applebin_macos-darwin_arm64-opt-ST-1f5196d1a0d9/bin -static -Xcc -Os -Xcc -DNDEBUG=1 -Xcc -Wno-unused-variable -Xcc -Winit-self -Xcc -Wno-extra";
OTHER_SWIFT_FLAGS = "-Xcc -working-directory -Xcc $(PROJECT_DIR) -working-directory $(PROJECT_DIR) -Xcc -ivfsoverlay$(OBJROOT)/bazel-out-overlay.yaml -vfsoverlay $(OBJROOT)/bazel-out-overlay.yaml $(PREVIEWS_SWIFT_INCLUDE__$(ENABLE_PREVIEWS)) -DNDEBUG -O -F$(DEVELOPER_DIR)/Platforms/MacOSX.platform/Developer/Library/Frameworks -I$(DEVELOPER_DIR)/Platforms/MacOSX.platform/Developer/usr/lib -I$(BAZEL_OUT)/macos-arm64-min13.0-applebin_macos-darwin_arm64-opt-ST-1f5196d1a0d9/bin/external/_main~non_module_deps~com_github_apple_swift_argument_parser -I$(BAZEL_OUT)/macos-arm64-min13.0-applebin_macos-darwin_arm64-opt-ST-1f5196d1a0d9/bin/tools/lib/ToolCommon -I$(BAZEL_OUT)/macos-arm64-min13.0-applebin_macos-darwin_arm64-opt-ST-1f5196d1a0d9/bin/external/_main~non_module_deps~com_github_apple_swift_collections -I$(BAZEL_OUT)/macos-arm64-min13.0-applebin_macos-darwin_arm64-opt-ST-1f5196d1a0d9/bin/tools/generators/lib/PBXProj -I$(BAZEL_OUT)/macos-arm64-min13.0-applebin_macos-darwin_arm64-opt-ST-1f5196d1a0d9/bin/tools/generators/pbxtargetdependencies -I$(BAZEL_OUT)/macos-arm64-min13.0-applebin_macos-darwin_arm64-opt-ST-1f5196d1a0d9/bin/external/_main~dev_non_module_deps~com_github_pointfreeco_xctest_dynamic_overlay -I$(BAZEL_OUT)/macos-arm64-min13.0-applebin_macos-darwin_arm64-opt-ST-1f5196d1a0d9/bin/external/_main~dev_non_module_deps~com_github_pointfreeco_swift_custom_dump -Xcc -iquote -Xcc $(PROJECT_DIR) -Xcc -iquote -Xcc $(BAZEL_OUT)/macos-arm64-min13.0-applebin_macos-darwin_arm64-opt-ST-1f5196d1a0d9/bin -static -Xcc -Os -Xcc -DNDEBUG=1 -Xcc -Wno-unused-variable -Xcc -Winit-self -Xcc -Wno-extra";
PREVIEWS_SWIFT_INCLUDE__ = "";
PREVIEWS_SWIFT_INCLUDE__NO = "";
PREVIEWS_SWIFT_INCLUDE__YES = "-I$(BAZEL_OUT)/macos-arm64-min13.0-applebin_macos-darwin_arm64-opt-ST-1f5196d1a0d9/bin/tools/generators/pbxtargetdependencies";
Expand Down Expand Up @@ -230,7 +230,7 @@ Here is an example output:
BAZEL_TARGET_ID = "@@_main~dev_non_module_deps~com_github_pointfreeco_xctest_dynamic_overlay//:XCTestDynamicOverlay macos-arm64-min13.0-applebin_macos-darwin_arm64-dbg-ST-95054d4cebee";
COMPILE_TARGET_NAME = XCTestDynamicOverlay;
MACOSX_DEPLOYMENT_TARGET = 13.0;
OTHER_SWIFT_FLAGS = "-Xcc -working-directory -Xcc $(PROJECT_DIR) -working-directory $(PROJECT_DIR) -DDEBUG -Onone -enable-testing -Xcc -iquote -Xcc $(PROJECT_DIR) -Xcc -iquote -Xcc $(BAZEL_OUT)/macos-arm64-min13.0-applebin_macos-darwin_arm64-dbg-ST-95054d4cebee/bin -static -Xcc -O0 -Xcc -DDEBUG=1 -Xcc -fstack-protector -Xcc -fstack-protector-all";
OTHER_SWIFT_FLAGS = "-Xcc -working-directory -Xcc $(PROJECT_DIR) -working-directory $(PROJECT_DIR) -Xcc -ivfsoverlay$(OBJROOT)/bazel-out-overlay.yaml -vfsoverlay $(OBJROOT)/bazel-out-overlay.yaml -DDEBUG -Onone -enable-testing -Xcc -iquote -Xcc $(PROJECT_DIR) -Xcc -iquote -Xcc $(BAZEL_OUT)/macos-arm64-min13.0-applebin_macos-darwin_arm64-dbg-ST-95054d4cebee/bin -static -Xcc -O0 -Xcc -DDEBUG=1 -Xcc -fstack-protector -Xcc -fstack-protector-all";
PRODUCT_MODULE_NAME = XCTestDynamicOverlay;
PRODUCT_NAME = XCTestDynamicOverlay;
SDKROOT = macosx;
Expand All @@ -250,7 +250,7 @@ Here is an example output:
BAZEL_TARGET_ID = "@@_main~dev_non_module_deps~com_github_pointfreeco_xctest_dynamic_overlay//:XCTestDynamicOverlay macos-arm64-min13.0-applebin_macos-darwin_arm64-opt-ST-1f5196d1a0d9";
COMPILE_TARGET_NAME = XCTestDynamicOverlay;
MACOSX_DEPLOYMENT_TARGET = 13.0;
OTHER_SWIFT_FLAGS = "-Xcc -working-directory -Xcc $(PROJECT_DIR) -working-directory $(PROJECT_DIR) -DNDEBUG -O -Xcc -iquote -Xcc $(PROJECT_DIR) -Xcc -iquote -Xcc $(BAZEL_OUT)/macos-arm64-min13.0-applebin_macos-darwin_arm64-opt-ST-1f5196d1a0d9/bin -static -Xcc -Os -Xcc -DNDEBUG=1 -Xcc -Wno-unused-variable -Xcc -Winit-self -Xcc -Wno-extra";
OTHER_SWIFT_FLAGS = "-Xcc -working-directory -Xcc $(PROJECT_DIR) -working-directory $(PROJECT_DIR) -Xcc -ivfsoverlay$(OBJROOT)/bazel-out-overlay.yaml -vfsoverlay $(OBJROOT)/bazel-out-overlay.yaml -DNDEBUG -O -Xcc -iquote -Xcc $(PROJECT_DIR) -Xcc -iquote -Xcc $(BAZEL_OUT)/macos-arm64-min13.0-applebin_macos-darwin_arm64-opt-ST-1f5196d1a0d9/bin -static -Xcc -Os -Xcc -DNDEBUG=1 -Xcc -Wno-unused-variable -Xcc -Winit-self -Xcc -Wno-extra";
PRODUCT_MODULE_NAME = XCTestDynamicOverlay;
PRODUCT_NAME = XCTestDynamicOverlay;
SDKROOT = macosx;
Expand Down
Loading