diff --git a/doc/rules-xcodeproj.md b/doc/rules-xcodeproj.md index 3340522c71..96b4f2c17f 100755 --- a/doc/rules-xcodeproj.md +++ b/doc/rules-xcodeproj.md @@ -268,10 +268,10 @@ A `sequence` of values returned by `xcode_schemes.scheme`. ## xcodeproj
-xcodeproj(name, archived_bundles_allowed, bazel_path, build_mode, focused_targets, ios_device_cpus, - ios_simulator_cpus, project_name, scheme_autogeneration_mode, schemes, top_level_targets, - tvos_device_cpus, tvos_simulator_cpus, unfocused_targets, watchos_device_cpus, - watchos_simulator_cpus, kwargs) +xcodeproj(name, archived_bundles_allowed, bazel_path, build_mode, config, focused_targets, + ios_device_cpus, ios_simulator_cpus, project_name, scheme_autogeneration_mode, schemes, + top_level_targets, tvos_device_cpus, tvos_simulator_cpus, unfocused_targets, + watchos_device_cpus, watchos_simulator_cpus, kwargs)Creates an `.xcodeproj` file in the workspace when run. @@ -292,6 +292,7 @@ argument will pass forward values for globally available attributes (e.g. | archived_bundles_allowed | This argument is deprecated and is now a no-op. It will be removed in a future release. Adjust the setting of
--define=apple.experimental.tree_artifact_outputs
on build:rules_xcodeproj
in your .bazelrc
or xcodeproj.bazelrc
file. | None
|
| bazel_path | Optional. The path the bazel
binary or wrapper script. If the path is relative it will be resolved using the PATH
environment variable (which is set to /opt/homebrew/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin
in Xcode). If you want to specify a path to a workspace-relative binary, you must prepend the path with ./
(e.g. "./bazelw"
). | "bazel"
|
| build_mode | Optional. The build mode the generated project should use."xcode"
, the project will use the Xcode build system to build targets. Generated files and unfocused targets (see the focused_targets
and unfocused_targets
arguments) will be built with Bazel."bazel"
, the project will use Bazel to build targets, inside of Xcode. The Xcode build system still unavoidably orchestrates some things at a high level. | "bazel"
|
+| config | Optional. The Bazel configuration to use when generating the project or invoking bazel
inside of Xcode. This is the basename of multiple configurations. For example, if this is set to "rules_xcodeproj"
, then the following configurations will be valid for you to extend in your .bazelrc
file: rules_xcodeproj
, rules_xcodeproj_build
, rules_xcodeproj_indexbuild
, rules_xcodeproj_info
, and rules_xcodeproj_swiftuipreviews
.xcodeproj.bazelrc
file](../xcodeproj/internal:xcodeproj.template.bazelrc) that is used for more information on these configs. | "rules_xcodeproj"
|
| focused_targets | Optional. A list
of target labels as string
values. If specified, only these targets will be included in the generated project; all other targets will be excluded, as if they were listed explicitly in the unfocused_targets
argument. The labels must match transitive dependencies of the targets specified in the top_level_targets
argument. | []
|
| ios_device_cpus | Optional. The value to use for --ios_multi_cpus
when building the transitive dependencies of the targets specified in the top_level_targets
argument with the "device"
target_environment
.top_level_targets
argument with the "device"
target_environment
, even if they aren't iOS targets. | "arm64"
|
| ios_simulator_cpus | Optional. The value to use for --ios_multi_cpus
when building the transitive dependencies of the targets specified in the top_level_targets
argument with the "simulator"
target_environment
.--host_cpu
(i.e. sim_arm64
on Apple Silicon and x86_64
on Intel).top_level_targets
argument with the "simulator"
target_environment
, even if they aren't iOS targets. | None
|
diff --git a/examples/integration/.bazelrc b/examples/integration/.bazelrc
index 209119f27d..6fa6ddb998 100644
--- a/examples/integration/.bazelrc
+++ b/examples/integration/.bazelrc
@@ -11,5 +11,7 @@ build --@com_github_buildbuddy_io_rules_xcodeproj//xcodeproj:extra_build_flags='
build --@com_github_buildbuddy_io_rules_xcodeproj//xcodeproj:extra_indexbuild_flags='--noverbose_failures'
build --@com_github_buildbuddy_io_rules_xcodeproj//xcodeproj:extra_swiftuipreviews_flags='--noverbose_failures'
+build:rules_xcodeproj_integration --define=foo=bar
+
# Use a user.bazelrc if it exists
try-import %workspace%/user.bazelrc
diff --git a/examples/integration/BUILD b/examples/integration/BUILD
index 528a7f6be9..176ca2d433 100644
--- a/examples/integration/BUILD
+++ b/examples/integration/BUILD
@@ -2,11 +2,12 @@ load(
"@com_github_buildbuddy_io_rules_xcodeproj//xcodeproj:xcodeproj.bzl",
"xcodeproj",
)
-load(":xcodeproj_targets.bzl", "XCODEPROJ_TARGETS")
+load(":xcodeproj_targets.bzl", "CONFIG", "XCODEPROJ_TARGETS")
xcodeproj(
name = "xcodeproj",
build_mode = "xcode",
+ config = CONFIG,
project_name = "Integration",
tags = ["manual"],
top_level_targets = XCODEPROJ_TARGETS,
diff --git a/examples/integration/test/fixtures/BUILD b/examples/integration/test/fixtures/BUILD
index ee36e4b980..1f4272f758 100644
--- a/examples/integration/test/fixtures/BUILD
+++ b/examples/integration/test/fixtures/BUILD
@@ -4,9 +4,10 @@ load(
"validate_fixtures",
"xcodeproj_fixture",
)
-load("//:xcodeproj_targets.bzl", "XCODEPROJ_TARGETS")
+load("//:xcodeproj_targets.bzl", "CONFIG", "XCODEPROJ_TARGETS")
xcodeproj_fixture(
+ config = CONFIG,
top_level_targets = XCODEPROJ_TARGETS,
)
diff --git a/examples/integration/test/fixtures/bwb.xcodeproj/project.pbxproj b/examples/integration/test/fixtures/bwb.xcodeproj/project.pbxproj
index 70b87a9596..c464e15aff 100644
--- a/examples/integration/test/fixtures/bwb.xcodeproj/project.pbxproj
+++ b/examples/integration/test/fixtures/bwb.xcodeproj/project.pbxproj
@@ -4734,6 +4734,7 @@
5AFD85147E5F7EEA259481C2 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
+ BAZEL_CONFIG = rules_xcodeproj_integration;
BAZEL_PACKAGE_BIN_DIR = rules_xcodeproj;
CALCULATE_OUTPUT_GROUPS_SCRIPT = "$(BAZEL_INTEGRATION_DIR)/calculate_output_groups.py";
GENERATOR_LABEL = "//test/fixtures:xcodeproj_bwb.generator";
diff --git a/examples/integration/test/fixtures/bwb.xcodeproj/rules_xcodeproj/bazel/bazel_build.sh b/examples/integration/test/fixtures/bwb.xcodeproj/rules_xcodeproj/bazel/bazel_build.sh
index bb22735f36..2e54c345e2 100755
--- a/examples/integration/test/fixtures/bwb.xcodeproj/rules_xcodeproj/bazel/bazel_build.sh
+++ b/examples/integration/test/fixtures/bwb.xcodeproj/rules_xcodeproj/bazel/bazel_build.sh
@@ -111,7 +111,7 @@ fi
output_path=$("${bazel_cmd[@]}" \
info \
- --config=rules_xcodeproj_info \
+ --config="${BAZEL_CONFIG}_info" \
--color="$color" \
--experimental_convenience_symlinks=ignore \
--symlink_prefix=/ \
@@ -162,11 +162,11 @@ EOF
# Build
if [ "$ACTION" == "indexbuild" ]; then
- config=rules_xcodeproj_indexbuild
+ config="${BAZEL_CONFIG}_indexbuild"
elif [ "${ENABLE_PREVIEWS:-}" == "YES" ]; then
- config=rules_xcodeproj_swiftuipreviews
+ config="${BAZEL_CONFIG}_swiftuipreviews"
else
- config=rules_xcodeproj_build
+ config="${BAZEL_CONFIG}_build"
fi
mkdir -p /tmp/rules_xcodeproj
@@ -178,7 +178,7 @@ touch "$build_marker"
"$BAZEL_INTEGRATION_DIR/process_bazel_build_log.py" \
"${bazel_cmd[@]}" \
build \
- --config=$config \
+ --config="$config" \
--color=yes \
--experimental_convenience_symlinks=ignore \
--symlink_prefix=/ \
diff --git a/examples/integration/test/fixtures/bwb.xcodeproj/rules_xcodeproj/bazel/xcodeproj.bazelrc b/examples/integration/test/fixtures/bwb.xcodeproj/rules_xcodeproj/bazel/xcodeproj.bazelrc
old mode 100644
new mode 100755
index 1ea3876659..a603ebefa1
--- a/examples/integration/test/fixtures/bwb.xcodeproj/rules_xcodeproj/bazel/xcodeproj.bazelrc
+++ b/examples/integration/test/fixtures/bwb.xcodeproj/rules_xcodeproj/bazel/xcodeproj.bazelrc
@@ -78,5 +78,22 @@ build:rules_xcodeproj_swiftuipreviews --swiftcopt=-Xfrontend --swiftcopt=-enable
build:rules_xcodeproj_swiftuipreviews --swiftcopt=-Xfrontend --swiftcopt=-enable-private-imports
build:rules_xcodeproj_swiftuipreviews --swiftcopt=-Xfrontend --swiftcopt=-enable-dynamic-replacement-chaining
+### Project specific configs
+
+# Set `--verbose_failures` on `info` as the closest to a "no-op" config as
+# possible, until https://github.com/bazelbuild/bazel/issues/12844 is fixed
+info:rules_xcodeproj_integration --verbose_failures
+
+build:rules_xcodeproj_integration_build --config=rules_xcodeproj_build
+build:rules_xcodeproj_integration_build --config=rules_xcodeproj_integration
+build:rules_xcodeproj_integration_generator --config=rules_xcodeproj_generator
+build:rules_xcodeproj_integration_generator --config=rules_xcodeproj_integration
+build:rules_xcodeproj_integration_indexbuild --config=rules_xcodeproj_indexbuild
+build:rules_xcodeproj_integration_indexbuild --config=rules_xcodeproj_integration
+info:rules_xcodeproj_integration_info --config=rules_xcodeproj_info
+info:rules_xcodeproj_integration_info --config=rules_xcodeproj_integration
+build:rules_xcodeproj_integration_swiftuipreviews --config=rules_xcodeproj_swiftuipreviews
+build:rules_xcodeproj_integration_swiftuipreviews --config=rules_xcodeproj_integration
+
# Import `xcodeproj.bazelrc` if it exists
try-import %workspace%/xcodeproj.bazelrc
diff --git a/examples/integration/test/fixtures/bwb.xcodeproj/rules_xcodeproj/bazel/xcodeproj_extra_flags.bazelrc b/examples/integration/test/fixtures/bwb.xcodeproj/rules_xcodeproj/bazel/xcodeproj_extra_flags.bazelrc
index f4cbc1bed9..edd64ab2ac 100755
--- a/examples/integration/test/fixtures/bwb.xcodeproj/rules_xcodeproj/bazel/xcodeproj_extra_flags.bazelrc
+++ b/examples/integration/test/fixtures/bwb.xcodeproj/rules_xcodeproj/bazel/xcodeproj_extra_flags.bazelrc
@@ -1,4 +1,4 @@
-build:rules_xcodeproj --config=cache
-build:rules_xcodeproj_build --noverbose_failures
-build:rules_xcodeproj_indexbuild --noverbose_failures
-build:rules_xcodeproj_swiftuipreviews --noverbose_failures
+build:rules_xcodeproj_integration --config=cache
+build:rules_xcodeproj_integration_build --noverbose_failures
+build:rules_xcodeproj_integration_indexbuild --noverbose_failures
+build:rules_xcodeproj_integration_swiftuipreviews --noverbose_failures
diff --git a/examples/integration/test/fixtures/bwb_spec.json b/examples/integration/test/fixtures/bwb_spec.json
index 8da331f5a5..b1e0715a92 100644
--- a/examples/integration/test/fixtures/bwb_spec.json
+++ b/examples/integration/test/fixtures/bwb_spec.json
@@ -1,4 +1,5 @@
{
+ "bazel_config": "rules_xcodeproj_integration",
"bazel_workspace_name": "__main__",
"build_settings": {
"ALWAYS_SEARCH_USER_PATHS": false,
diff --git a/examples/integration/test/fixtures/bwx.xcodeproj/project.pbxproj b/examples/integration/test/fixtures/bwx.xcodeproj/project.pbxproj
index d1735ddbb4..6f8f83ac8a 100644
--- a/examples/integration/test/fixtures/bwx.xcodeproj/project.pbxproj
+++ b/examples/integration/test/fixtures/bwx.xcodeproj/project.pbxproj
@@ -4324,6 +4324,7 @@
67F44AB65FA7A2E38A56F5FB /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
+ BAZEL_CONFIG = rules_xcodeproj_integration;
BAZEL_PACKAGE_BIN_DIR = rules_xcodeproj;
CALCULATE_OUTPUT_GROUPS_SCRIPT = "$(BAZEL_INTEGRATION_DIR)/calculate_output_groups.py";
GENERATOR_LABEL = "//test/fixtures:xcodeproj_bwx.generator";
diff --git a/examples/integration/test/fixtures/bwx.xcodeproj/rules_xcodeproj/bazel/bazel_build.sh b/examples/integration/test/fixtures/bwx.xcodeproj/rules_xcodeproj/bazel/bazel_build.sh
index bb22735f36..2e54c345e2 100755
--- a/examples/integration/test/fixtures/bwx.xcodeproj/rules_xcodeproj/bazel/bazel_build.sh
+++ b/examples/integration/test/fixtures/bwx.xcodeproj/rules_xcodeproj/bazel/bazel_build.sh
@@ -111,7 +111,7 @@ fi
output_path=$("${bazel_cmd[@]}" \
info \
- --config=rules_xcodeproj_info \
+ --config="${BAZEL_CONFIG}_info" \
--color="$color" \
--experimental_convenience_symlinks=ignore \
--symlink_prefix=/ \
@@ -162,11 +162,11 @@ EOF
# Build
if [ "$ACTION" == "indexbuild" ]; then
- config=rules_xcodeproj_indexbuild
+ config="${BAZEL_CONFIG}_indexbuild"
elif [ "${ENABLE_PREVIEWS:-}" == "YES" ]; then
- config=rules_xcodeproj_swiftuipreviews
+ config="${BAZEL_CONFIG}_swiftuipreviews"
else
- config=rules_xcodeproj_build
+ config="${BAZEL_CONFIG}_build"
fi
mkdir -p /tmp/rules_xcodeproj
@@ -178,7 +178,7 @@ touch "$build_marker"
"$BAZEL_INTEGRATION_DIR/process_bazel_build_log.py" \
"${bazel_cmd[@]}" \
build \
- --config=$config \
+ --config="$config" \
--color=yes \
--experimental_convenience_symlinks=ignore \
--symlink_prefix=/ \
diff --git a/examples/integration/test/fixtures/bwx.xcodeproj/rules_xcodeproj/bazel/xcodeproj.bazelrc b/examples/integration/test/fixtures/bwx.xcodeproj/rules_xcodeproj/bazel/xcodeproj.bazelrc
old mode 100644
new mode 100755
index 1ea3876659..a603ebefa1
--- a/examples/integration/test/fixtures/bwx.xcodeproj/rules_xcodeproj/bazel/xcodeproj.bazelrc
+++ b/examples/integration/test/fixtures/bwx.xcodeproj/rules_xcodeproj/bazel/xcodeproj.bazelrc
@@ -78,5 +78,22 @@ build:rules_xcodeproj_swiftuipreviews --swiftcopt=-Xfrontend --swiftcopt=-enable
build:rules_xcodeproj_swiftuipreviews --swiftcopt=-Xfrontend --swiftcopt=-enable-private-imports
build:rules_xcodeproj_swiftuipreviews --swiftcopt=-Xfrontend --swiftcopt=-enable-dynamic-replacement-chaining
+### Project specific configs
+
+# Set `--verbose_failures` on `info` as the closest to a "no-op" config as
+# possible, until https://github.com/bazelbuild/bazel/issues/12844 is fixed
+info:rules_xcodeproj_integration --verbose_failures
+
+build:rules_xcodeproj_integration_build --config=rules_xcodeproj_build
+build:rules_xcodeproj_integration_build --config=rules_xcodeproj_integration
+build:rules_xcodeproj_integration_generator --config=rules_xcodeproj_generator
+build:rules_xcodeproj_integration_generator --config=rules_xcodeproj_integration
+build:rules_xcodeproj_integration_indexbuild --config=rules_xcodeproj_indexbuild
+build:rules_xcodeproj_integration_indexbuild --config=rules_xcodeproj_integration
+info:rules_xcodeproj_integration_info --config=rules_xcodeproj_info
+info:rules_xcodeproj_integration_info --config=rules_xcodeproj_integration
+build:rules_xcodeproj_integration_swiftuipreviews --config=rules_xcodeproj_swiftuipreviews
+build:rules_xcodeproj_integration_swiftuipreviews --config=rules_xcodeproj_integration
+
# Import `xcodeproj.bazelrc` if it exists
try-import %workspace%/xcodeproj.bazelrc
diff --git a/examples/integration/test/fixtures/bwx.xcodeproj/rules_xcodeproj/bazel/xcodeproj_extra_flags.bazelrc b/examples/integration/test/fixtures/bwx.xcodeproj/rules_xcodeproj/bazel/xcodeproj_extra_flags.bazelrc
index f4cbc1bed9..edd64ab2ac 100755
--- a/examples/integration/test/fixtures/bwx.xcodeproj/rules_xcodeproj/bazel/xcodeproj_extra_flags.bazelrc
+++ b/examples/integration/test/fixtures/bwx.xcodeproj/rules_xcodeproj/bazel/xcodeproj_extra_flags.bazelrc
@@ -1,4 +1,4 @@
-build:rules_xcodeproj --config=cache
-build:rules_xcodeproj_build --noverbose_failures
-build:rules_xcodeproj_indexbuild --noverbose_failures
-build:rules_xcodeproj_swiftuipreviews --noverbose_failures
+build:rules_xcodeproj_integration --config=cache
+build:rules_xcodeproj_integration_build --noverbose_failures
+build:rules_xcodeproj_integration_indexbuild --noverbose_failures
+build:rules_xcodeproj_integration_swiftuipreviews --noverbose_failures
diff --git a/examples/integration/test/fixtures/bwx_spec.json b/examples/integration/test/fixtures/bwx_spec.json
index a02b1bda72..55a6978445 100644
--- a/examples/integration/test/fixtures/bwx_spec.json
+++ b/examples/integration/test/fixtures/bwx_spec.json
@@ -1,4 +1,5 @@
{
+ "bazel_config": "rules_xcodeproj_integration",
"bazel_workspace_name": "__main__",
"build_settings": {
"ALWAYS_SEARCH_USER_PATHS": false,
diff --git a/examples/integration/xcodeproj_targets.bzl b/examples/integration/xcodeproj_targets.bzl
index f367d8f661..85d829039e 100644
--- a/examples/integration/xcodeproj_targets.bzl
+++ b/examples/integration/xcodeproj_targets.bzl
@@ -5,6 +5,8 @@ load(
"top_level_target",
)
+CONFIG = "rules_xcodeproj_integration"
+
XCODEPROJ_TARGETS = [
top_level_target(
label = "//CommandLine/CommandLineTool",
diff --git a/examples/ios_app/test/fixtures/bwb.xcodeproj/project.pbxproj b/examples/ios_app/test/fixtures/bwb.xcodeproj/project.pbxproj
index a21dcbbd35..c8d3a8d3c8 100644
--- a/examples/ios_app/test/fixtures/bwb.xcodeproj/project.pbxproj
+++ b/examples/ios_app/test/fixtures/bwb.xcodeproj/project.pbxproj
@@ -1471,6 +1471,7 @@
5AFD85147E5F7EEA259481C2 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
+ BAZEL_CONFIG = rules_xcodeproj;
BAZEL_PACKAGE_BIN_DIR = rules_xcodeproj;
CALCULATE_OUTPUT_GROUPS_SCRIPT = "$(BAZEL_INTEGRATION_DIR)/calculate_output_groups.py";
GENERATOR_LABEL = "//test/fixtures:xcodeproj_bwb.generator";
diff --git a/examples/ios_app/test/fixtures/bwb.xcodeproj/rules_xcodeproj/bazel/bazel_build.sh b/examples/ios_app/test/fixtures/bwb.xcodeproj/rules_xcodeproj/bazel/bazel_build.sh
index bb22735f36..2e54c345e2 100755
--- a/examples/ios_app/test/fixtures/bwb.xcodeproj/rules_xcodeproj/bazel/bazel_build.sh
+++ b/examples/ios_app/test/fixtures/bwb.xcodeproj/rules_xcodeproj/bazel/bazel_build.sh
@@ -111,7 +111,7 @@ fi
output_path=$("${bazel_cmd[@]}" \
info \
- --config=rules_xcodeproj_info \
+ --config="${BAZEL_CONFIG}_info" \
--color="$color" \
--experimental_convenience_symlinks=ignore \
--symlink_prefix=/ \
@@ -162,11 +162,11 @@ EOF
# Build
if [ "$ACTION" == "indexbuild" ]; then
- config=rules_xcodeproj_indexbuild
+ config="${BAZEL_CONFIG}_indexbuild"
elif [ "${ENABLE_PREVIEWS:-}" == "YES" ]; then
- config=rules_xcodeproj_swiftuipreviews
+ config="${BAZEL_CONFIG}_swiftuipreviews"
else
- config=rules_xcodeproj_build
+ config="${BAZEL_CONFIG}_build"
fi
mkdir -p /tmp/rules_xcodeproj
@@ -178,7 +178,7 @@ touch "$build_marker"
"$BAZEL_INTEGRATION_DIR/process_bazel_build_log.py" \
"${bazel_cmd[@]}" \
build \
- --config=$config \
+ --config="$config" \
--color=yes \
--experimental_convenience_symlinks=ignore \
--symlink_prefix=/ \
diff --git a/examples/ios_app/test/fixtures/bwb.xcodeproj/rules_xcodeproj/bazel/xcodeproj.bazelrc b/examples/ios_app/test/fixtures/bwb.xcodeproj/rules_xcodeproj/bazel/xcodeproj.bazelrc
old mode 100644
new mode 100755
index 1ea3876659..9335b0ac36
--- a/examples/ios_app/test/fixtures/bwb.xcodeproj/rules_xcodeproj/bazel/xcodeproj.bazelrc
+++ b/examples/ios_app/test/fixtures/bwb.xcodeproj/rules_xcodeproj/bazel/xcodeproj.bazelrc
@@ -78,5 +78,7 @@ build:rules_xcodeproj_swiftuipreviews --swiftcopt=-Xfrontend --swiftcopt=-enable
build:rules_xcodeproj_swiftuipreviews --swiftcopt=-Xfrontend --swiftcopt=-enable-private-imports
build:rules_xcodeproj_swiftuipreviews --swiftcopt=-Xfrontend --swiftcopt=-enable-dynamic-replacement-chaining
+### Project specific configs
+
# Import `xcodeproj.bazelrc` if it exists
try-import %workspace%/xcodeproj.bazelrc
diff --git a/examples/ios_app/test/fixtures/bwb_spec.json b/examples/ios_app/test/fixtures/bwb_spec.json
index 30eb792d68..ee958ab1a1 100644
--- a/examples/ios_app/test/fixtures/bwb_spec.json
+++ b/examples/ios_app/test/fixtures/bwb_spec.json
@@ -1,4 +1,5 @@
{
+ "bazel_config": "rules_xcodeproj",
"bazel_workspace_name": "__main__",
"build_settings": {
"ALWAYS_SEARCH_USER_PATHS": false,
diff --git a/examples/ios_app/test/fixtures/bwx.xcodeproj/project.pbxproj b/examples/ios_app/test/fixtures/bwx.xcodeproj/project.pbxproj
index c65229eb0d..801e75d8e7 100644
--- a/examples/ios_app/test/fixtures/bwx.xcodeproj/project.pbxproj
+++ b/examples/ios_app/test/fixtures/bwx.xcodeproj/project.pbxproj
@@ -1873,6 +1873,7 @@
67F44AB65FA7A2E38A56F5FB /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
+ BAZEL_CONFIG = rules_xcodeproj;
BAZEL_PACKAGE_BIN_DIR = rules_xcodeproj;
CALCULATE_OUTPUT_GROUPS_SCRIPT = "$(BAZEL_INTEGRATION_DIR)/calculate_output_groups.py";
GENERATOR_LABEL = "//test/fixtures:xcodeproj_bwx.generator";
diff --git a/examples/ios_app/test/fixtures/bwx.xcodeproj/rules_xcodeproj/bazel/bazel_build.sh b/examples/ios_app/test/fixtures/bwx.xcodeproj/rules_xcodeproj/bazel/bazel_build.sh
index bb22735f36..2e54c345e2 100755
--- a/examples/ios_app/test/fixtures/bwx.xcodeproj/rules_xcodeproj/bazel/bazel_build.sh
+++ b/examples/ios_app/test/fixtures/bwx.xcodeproj/rules_xcodeproj/bazel/bazel_build.sh
@@ -111,7 +111,7 @@ fi
output_path=$("${bazel_cmd[@]}" \
info \
- --config=rules_xcodeproj_info \
+ --config="${BAZEL_CONFIG}_info" \
--color="$color" \
--experimental_convenience_symlinks=ignore \
--symlink_prefix=/ \
@@ -162,11 +162,11 @@ EOF
# Build
if [ "$ACTION" == "indexbuild" ]; then
- config=rules_xcodeproj_indexbuild
+ config="${BAZEL_CONFIG}_indexbuild"
elif [ "${ENABLE_PREVIEWS:-}" == "YES" ]; then
- config=rules_xcodeproj_swiftuipreviews
+ config="${BAZEL_CONFIG}_swiftuipreviews"
else
- config=rules_xcodeproj_build
+ config="${BAZEL_CONFIG}_build"
fi
mkdir -p /tmp/rules_xcodeproj
@@ -178,7 +178,7 @@ touch "$build_marker"
"$BAZEL_INTEGRATION_DIR/process_bazel_build_log.py" \
"${bazel_cmd[@]}" \
build \
- --config=$config \
+ --config="$config" \
--color=yes \
--experimental_convenience_symlinks=ignore \
--symlink_prefix=/ \
diff --git a/examples/ios_app/test/fixtures/bwx.xcodeproj/rules_xcodeproj/bazel/xcodeproj.bazelrc b/examples/ios_app/test/fixtures/bwx.xcodeproj/rules_xcodeproj/bazel/xcodeproj.bazelrc
old mode 100644
new mode 100755
index 1ea3876659..9335b0ac36
--- a/examples/ios_app/test/fixtures/bwx.xcodeproj/rules_xcodeproj/bazel/xcodeproj.bazelrc
+++ b/examples/ios_app/test/fixtures/bwx.xcodeproj/rules_xcodeproj/bazel/xcodeproj.bazelrc
@@ -78,5 +78,7 @@ build:rules_xcodeproj_swiftuipreviews --swiftcopt=-Xfrontend --swiftcopt=-enable
build:rules_xcodeproj_swiftuipreviews --swiftcopt=-Xfrontend --swiftcopt=-enable-private-imports
build:rules_xcodeproj_swiftuipreviews --swiftcopt=-Xfrontend --swiftcopt=-enable-dynamic-replacement-chaining
+### Project specific configs
+
# Import `xcodeproj.bazelrc` if it exists
try-import %workspace%/xcodeproj.bazelrc
diff --git a/examples/ios_app/test/fixtures/bwx_spec.json b/examples/ios_app/test/fixtures/bwx_spec.json
index 438ee97b56..48cf64bb05 100644
--- a/examples/ios_app/test/fixtures/bwx_spec.json
+++ b/examples/ios_app/test/fixtures/bwx_spec.json
@@ -1,4 +1,5 @@
{
+ "bazel_config": "rules_xcodeproj",
"bazel_workspace_name": "__main__",
"build_settings": {
"ALWAYS_SEARCH_USER_PATHS": false,
diff --git a/test/fixtures/cc/bwb.xcodeproj/project.pbxproj b/test/fixtures/cc/bwb.xcodeproj/project.pbxproj
index 0f583c7d57..ea6a34cd1c 100644
--- a/test/fixtures/cc/bwb.xcodeproj/project.pbxproj
+++ b/test/fixtures/cc/bwb.xcodeproj/project.pbxproj
@@ -655,6 +655,7 @@
5AFD85147E5F7EEA259481C2 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
+ BAZEL_CONFIG = rules_xcodeproj;
BAZEL_PACKAGE_BIN_DIR = rules_xcodeproj;
CALCULATE_OUTPUT_GROUPS_SCRIPT = "$(BAZEL_INTEGRATION_DIR)/calculate_output_groups.py";
GENERATOR_LABEL = "//test/fixtures/cc:xcodeproj_bwb.generator";
diff --git a/test/fixtures/cc/bwb.xcodeproj/rules_xcodeproj/bazel/bazel_build.sh b/test/fixtures/cc/bwb.xcodeproj/rules_xcodeproj/bazel/bazel_build.sh
index bb22735f36..2e54c345e2 100755
--- a/test/fixtures/cc/bwb.xcodeproj/rules_xcodeproj/bazel/bazel_build.sh
+++ b/test/fixtures/cc/bwb.xcodeproj/rules_xcodeproj/bazel/bazel_build.sh
@@ -111,7 +111,7 @@ fi
output_path=$("${bazel_cmd[@]}" \
info \
- --config=rules_xcodeproj_info \
+ --config="${BAZEL_CONFIG}_info" \
--color="$color" \
--experimental_convenience_symlinks=ignore \
--symlink_prefix=/ \
@@ -162,11 +162,11 @@ EOF
# Build
if [ "$ACTION" == "indexbuild" ]; then
- config=rules_xcodeproj_indexbuild
+ config="${BAZEL_CONFIG}_indexbuild"
elif [ "${ENABLE_PREVIEWS:-}" == "YES" ]; then
- config=rules_xcodeproj_swiftuipreviews
+ config="${BAZEL_CONFIG}_swiftuipreviews"
else
- config=rules_xcodeproj_build
+ config="${BAZEL_CONFIG}_build"
fi
mkdir -p /tmp/rules_xcodeproj
@@ -178,7 +178,7 @@ touch "$build_marker"
"$BAZEL_INTEGRATION_DIR/process_bazel_build_log.py" \
"${bazel_cmd[@]}" \
build \
- --config=$config \
+ --config="$config" \
--color=yes \
--experimental_convenience_symlinks=ignore \
--symlink_prefix=/ \
diff --git a/test/fixtures/cc/bwb.xcodeproj/rules_xcodeproj/bazel/xcodeproj.bazelrc b/test/fixtures/cc/bwb.xcodeproj/rules_xcodeproj/bazel/xcodeproj.bazelrc
old mode 100644
new mode 100755
index 1ea3876659..9335b0ac36
--- a/test/fixtures/cc/bwb.xcodeproj/rules_xcodeproj/bazel/xcodeproj.bazelrc
+++ b/test/fixtures/cc/bwb.xcodeproj/rules_xcodeproj/bazel/xcodeproj.bazelrc
@@ -78,5 +78,7 @@ build:rules_xcodeproj_swiftuipreviews --swiftcopt=-Xfrontend --swiftcopt=-enable
build:rules_xcodeproj_swiftuipreviews --swiftcopt=-Xfrontend --swiftcopt=-enable-private-imports
build:rules_xcodeproj_swiftuipreviews --swiftcopt=-Xfrontend --swiftcopt=-enable-dynamic-replacement-chaining
+### Project specific configs
+
# Import `xcodeproj.bazelrc` if it exists
try-import %workspace%/xcodeproj.bazelrc
diff --git a/test/fixtures/cc/bwb_spec.json b/test/fixtures/cc/bwb_spec.json
index fc2a294a78..3f6dc3cd4b 100644
--- a/test/fixtures/cc/bwb_spec.json
+++ b/test/fixtures/cc/bwb_spec.json
@@ -1,4 +1,5 @@
{
+ "bazel_config": "rules_xcodeproj",
"bazel_workspace_name": "com_github_buildbuddy_io_rules_xcodeproj",
"build_settings": {
"ALWAYS_SEARCH_USER_PATHS": false,
diff --git a/test/fixtures/cc/bwx.xcodeproj/project.pbxproj b/test/fixtures/cc/bwx.xcodeproj/project.pbxproj
index b3923019a1..8a8099e8f8 100644
--- a/test/fixtures/cc/bwx.xcodeproj/project.pbxproj
+++ b/test/fixtures/cc/bwx.xcodeproj/project.pbxproj
@@ -577,6 +577,7 @@
67F44AB65FA7A2E38A56F5FB /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
+ BAZEL_CONFIG = rules_xcodeproj;
BAZEL_PACKAGE_BIN_DIR = rules_xcodeproj;
CALCULATE_OUTPUT_GROUPS_SCRIPT = "$(BAZEL_INTEGRATION_DIR)/calculate_output_groups.py";
GENERATOR_LABEL = "//test/fixtures/cc:xcodeproj_bwx.generator";
diff --git a/test/fixtures/cc/bwx.xcodeproj/rules_xcodeproj/bazel/bazel_build.sh b/test/fixtures/cc/bwx.xcodeproj/rules_xcodeproj/bazel/bazel_build.sh
index bb22735f36..2e54c345e2 100755
--- a/test/fixtures/cc/bwx.xcodeproj/rules_xcodeproj/bazel/bazel_build.sh
+++ b/test/fixtures/cc/bwx.xcodeproj/rules_xcodeproj/bazel/bazel_build.sh
@@ -111,7 +111,7 @@ fi
output_path=$("${bazel_cmd[@]}" \
info \
- --config=rules_xcodeproj_info \
+ --config="${BAZEL_CONFIG}_info" \
--color="$color" \
--experimental_convenience_symlinks=ignore \
--symlink_prefix=/ \
@@ -162,11 +162,11 @@ EOF
# Build
if [ "$ACTION" == "indexbuild" ]; then
- config=rules_xcodeproj_indexbuild
+ config="${BAZEL_CONFIG}_indexbuild"
elif [ "${ENABLE_PREVIEWS:-}" == "YES" ]; then
- config=rules_xcodeproj_swiftuipreviews
+ config="${BAZEL_CONFIG}_swiftuipreviews"
else
- config=rules_xcodeproj_build
+ config="${BAZEL_CONFIG}_build"
fi
mkdir -p /tmp/rules_xcodeproj
@@ -178,7 +178,7 @@ touch "$build_marker"
"$BAZEL_INTEGRATION_DIR/process_bazel_build_log.py" \
"${bazel_cmd[@]}" \
build \
- --config=$config \
+ --config="$config" \
--color=yes \
--experimental_convenience_symlinks=ignore \
--symlink_prefix=/ \
diff --git a/test/fixtures/cc/bwx.xcodeproj/rules_xcodeproj/bazel/xcodeproj.bazelrc b/test/fixtures/cc/bwx.xcodeproj/rules_xcodeproj/bazel/xcodeproj.bazelrc
old mode 100644
new mode 100755
index 1ea3876659..9335b0ac36
--- a/test/fixtures/cc/bwx.xcodeproj/rules_xcodeproj/bazel/xcodeproj.bazelrc
+++ b/test/fixtures/cc/bwx.xcodeproj/rules_xcodeproj/bazel/xcodeproj.bazelrc
@@ -78,5 +78,7 @@ build:rules_xcodeproj_swiftuipreviews --swiftcopt=-Xfrontend --swiftcopt=-enable
build:rules_xcodeproj_swiftuipreviews --swiftcopt=-Xfrontend --swiftcopt=-enable-private-imports
build:rules_xcodeproj_swiftuipreviews --swiftcopt=-Xfrontend --swiftcopt=-enable-dynamic-replacement-chaining
+### Project specific configs
+
# Import `xcodeproj.bazelrc` if it exists
try-import %workspace%/xcodeproj.bazelrc
diff --git a/test/fixtures/cc/bwx_spec.json b/test/fixtures/cc/bwx_spec.json
index 0f9a220204..cb276446bb 100644
--- a/test/fixtures/cc/bwx_spec.json
+++ b/test/fixtures/cc/bwx_spec.json
@@ -1,4 +1,5 @@
{
+ "bazel_config": "rules_xcodeproj",
"bazel_workspace_name": "com_github_buildbuddy_io_rules_xcodeproj",
"build_settings": {
"ALWAYS_SEARCH_USER_PATHS": false,
diff --git a/test/fixtures/generator/bwb.xcodeproj/project.pbxproj b/test/fixtures/generator/bwb.xcodeproj/project.pbxproj
index 8b9b0b9603..309735b714 100644
--- a/test/fixtures/generator/bwb.xcodeproj/project.pbxproj
+++ b/test/fixtures/generator/bwb.xcodeproj/project.pbxproj
@@ -2438,6 +2438,7 @@
5AFD85147E5F7EEA259481C2 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
+ BAZEL_CONFIG = rules_xcodeproj;
BAZEL_PACKAGE_BIN_DIR = rules_xcodeproj;
CALCULATE_OUTPUT_GROUPS_SCRIPT = "$(BAZEL_INTEGRATION_DIR)/calculate_output_groups.py";
GENERATOR_LABEL = "//test/fixtures/generator:xcodeproj_bwb.generator";
diff --git a/test/fixtures/generator/bwb.xcodeproj/rules_xcodeproj/bazel/bazel_build.sh b/test/fixtures/generator/bwb.xcodeproj/rules_xcodeproj/bazel/bazel_build.sh
index bb22735f36..2e54c345e2 100755
--- a/test/fixtures/generator/bwb.xcodeproj/rules_xcodeproj/bazel/bazel_build.sh
+++ b/test/fixtures/generator/bwb.xcodeproj/rules_xcodeproj/bazel/bazel_build.sh
@@ -111,7 +111,7 @@ fi
output_path=$("${bazel_cmd[@]}" \
info \
- --config=rules_xcodeproj_info \
+ --config="${BAZEL_CONFIG}_info" \
--color="$color" \
--experimental_convenience_symlinks=ignore \
--symlink_prefix=/ \
@@ -162,11 +162,11 @@ EOF
# Build
if [ "$ACTION" == "indexbuild" ]; then
- config=rules_xcodeproj_indexbuild
+ config="${BAZEL_CONFIG}_indexbuild"
elif [ "${ENABLE_PREVIEWS:-}" == "YES" ]; then
- config=rules_xcodeproj_swiftuipreviews
+ config="${BAZEL_CONFIG}_swiftuipreviews"
else
- config=rules_xcodeproj_build
+ config="${BAZEL_CONFIG}_build"
fi
mkdir -p /tmp/rules_xcodeproj
@@ -178,7 +178,7 @@ touch "$build_marker"
"$BAZEL_INTEGRATION_DIR/process_bazel_build_log.py" \
"${bazel_cmd[@]}" \
build \
- --config=$config \
+ --config="$config" \
--color=yes \
--experimental_convenience_symlinks=ignore \
--symlink_prefix=/ \
diff --git a/test/fixtures/generator/bwb.xcodeproj/rules_xcodeproj/bazel/xcodeproj.bazelrc b/test/fixtures/generator/bwb.xcodeproj/rules_xcodeproj/bazel/xcodeproj.bazelrc
old mode 100644
new mode 100755
index 1ea3876659..9335b0ac36
--- a/test/fixtures/generator/bwb.xcodeproj/rules_xcodeproj/bazel/xcodeproj.bazelrc
+++ b/test/fixtures/generator/bwb.xcodeproj/rules_xcodeproj/bazel/xcodeproj.bazelrc
@@ -78,5 +78,7 @@ build:rules_xcodeproj_swiftuipreviews --swiftcopt=-Xfrontend --swiftcopt=-enable
build:rules_xcodeproj_swiftuipreviews --swiftcopt=-Xfrontend --swiftcopt=-enable-private-imports
build:rules_xcodeproj_swiftuipreviews --swiftcopt=-Xfrontend --swiftcopt=-enable-dynamic-replacement-chaining
+### Project specific configs
+
# Import `xcodeproj.bazelrc` if it exists
try-import %workspace%/xcodeproj.bazelrc
diff --git a/test/fixtures/generator/bwb_spec.json b/test/fixtures/generator/bwb_spec.json
index f72152f6cc..db135080f1 100644
--- a/test/fixtures/generator/bwb_spec.json
+++ b/test/fixtures/generator/bwb_spec.json
@@ -1,4 +1,5 @@
{
+ "bazel_config": "rules_xcodeproj",
"bazel_workspace_name": "com_github_buildbuddy_io_rules_xcodeproj",
"build_settings": {
"ALWAYS_SEARCH_USER_PATHS": false,
diff --git a/test/fixtures/generator/bwx.xcodeproj/project.pbxproj b/test/fixtures/generator/bwx.xcodeproj/project.pbxproj
index fc358d7571..ffb5567bd1 100644
--- a/test/fixtures/generator/bwx.xcodeproj/project.pbxproj
+++ b/test/fixtures/generator/bwx.xcodeproj/project.pbxproj
@@ -2411,6 +2411,7 @@
67F44AB65FA7A2E38A56F5FB /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
+ BAZEL_CONFIG = rules_xcodeproj;
BAZEL_PACKAGE_BIN_DIR = rules_xcodeproj;
CALCULATE_OUTPUT_GROUPS_SCRIPT = "$(BAZEL_INTEGRATION_DIR)/calculate_output_groups.py";
GENERATOR_LABEL = "//test/fixtures/generator:xcodeproj_bwx.generator";
diff --git a/test/fixtures/generator/bwx.xcodeproj/rules_xcodeproj/bazel/bazel_build.sh b/test/fixtures/generator/bwx.xcodeproj/rules_xcodeproj/bazel/bazel_build.sh
index bb22735f36..2e54c345e2 100755
--- a/test/fixtures/generator/bwx.xcodeproj/rules_xcodeproj/bazel/bazel_build.sh
+++ b/test/fixtures/generator/bwx.xcodeproj/rules_xcodeproj/bazel/bazel_build.sh
@@ -111,7 +111,7 @@ fi
output_path=$("${bazel_cmd[@]}" \
info \
- --config=rules_xcodeproj_info \
+ --config="${BAZEL_CONFIG}_info" \
--color="$color" \
--experimental_convenience_symlinks=ignore \
--symlink_prefix=/ \
@@ -162,11 +162,11 @@ EOF
# Build
if [ "$ACTION" == "indexbuild" ]; then
- config=rules_xcodeproj_indexbuild
+ config="${BAZEL_CONFIG}_indexbuild"
elif [ "${ENABLE_PREVIEWS:-}" == "YES" ]; then
- config=rules_xcodeproj_swiftuipreviews
+ config="${BAZEL_CONFIG}_swiftuipreviews"
else
- config=rules_xcodeproj_build
+ config="${BAZEL_CONFIG}_build"
fi
mkdir -p /tmp/rules_xcodeproj
@@ -178,7 +178,7 @@ touch "$build_marker"
"$BAZEL_INTEGRATION_DIR/process_bazel_build_log.py" \
"${bazel_cmd[@]}" \
build \
- --config=$config \
+ --config="$config" \
--color=yes \
--experimental_convenience_symlinks=ignore \
--symlink_prefix=/ \
diff --git a/test/fixtures/generator/bwx.xcodeproj/rules_xcodeproj/bazel/xcodeproj.bazelrc b/test/fixtures/generator/bwx.xcodeproj/rules_xcodeproj/bazel/xcodeproj.bazelrc
old mode 100644
new mode 100755
index 1ea3876659..9335b0ac36
--- a/test/fixtures/generator/bwx.xcodeproj/rules_xcodeproj/bazel/xcodeproj.bazelrc
+++ b/test/fixtures/generator/bwx.xcodeproj/rules_xcodeproj/bazel/xcodeproj.bazelrc
@@ -78,5 +78,7 @@ build:rules_xcodeproj_swiftuipreviews --swiftcopt=-Xfrontend --swiftcopt=-enable
build:rules_xcodeproj_swiftuipreviews --swiftcopt=-Xfrontend --swiftcopt=-enable-private-imports
build:rules_xcodeproj_swiftuipreviews --swiftcopt=-Xfrontend --swiftcopt=-enable-dynamic-replacement-chaining
+### Project specific configs
+
# Import `xcodeproj.bazelrc` if it exists
try-import %workspace%/xcodeproj.bazelrc
diff --git a/test/fixtures/generator/bwx_spec.json b/test/fixtures/generator/bwx_spec.json
index 4a9fcee821..a2ffca8bba 100644
--- a/test/fixtures/generator/bwx_spec.json
+++ b/test/fixtures/generator/bwx_spec.json
@@ -1,4 +1,5 @@
{
+ "bazel_config": "rules_xcodeproj",
"bazel_workspace_name": "com_github_buildbuddy_io_rules_xcodeproj",
"build_settings": {
"ALWAYS_SEARCH_USER_PATHS": false,
diff --git a/test/fixtures/simple/bwb.xcodeproj/project.pbxproj b/test/fixtures/simple/bwb.xcodeproj/project.pbxproj
index 4358ff30a2..faf57a8b8e 100644
--- a/test/fixtures/simple/bwb.xcodeproj/project.pbxproj
+++ b/test/fixtures/simple/bwb.xcodeproj/project.pbxproj
@@ -299,6 +299,7 @@
5AFD85147E5F7EEA259481C2 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
+ BAZEL_CONFIG = rules_xcodeproj;
BAZEL_PACKAGE_BIN_DIR = rules_xcodeproj;
CALCULATE_OUTPUT_GROUPS_SCRIPT = "$(BAZEL_INTEGRATION_DIR)/calculate_output_groups.py";
GENERATOR_LABEL = "//test/fixtures/simple:xcodeproj_bwb.generator";
diff --git a/test/fixtures/simple/bwb.xcodeproj/rules_xcodeproj/bazel/bazel_build.sh b/test/fixtures/simple/bwb.xcodeproj/rules_xcodeproj/bazel/bazel_build.sh
index bb22735f36..2e54c345e2 100755
--- a/test/fixtures/simple/bwb.xcodeproj/rules_xcodeproj/bazel/bazel_build.sh
+++ b/test/fixtures/simple/bwb.xcodeproj/rules_xcodeproj/bazel/bazel_build.sh
@@ -111,7 +111,7 @@ fi
output_path=$("${bazel_cmd[@]}" \
info \
- --config=rules_xcodeproj_info \
+ --config="${BAZEL_CONFIG}_info" \
--color="$color" \
--experimental_convenience_symlinks=ignore \
--symlink_prefix=/ \
@@ -162,11 +162,11 @@ EOF
# Build
if [ "$ACTION" == "indexbuild" ]; then
- config=rules_xcodeproj_indexbuild
+ config="${BAZEL_CONFIG}_indexbuild"
elif [ "${ENABLE_PREVIEWS:-}" == "YES" ]; then
- config=rules_xcodeproj_swiftuipreviews
+ config="${BAZEL_CONFIG}_swiftuipreviews"
else
- config=rules_xcodeproj_build
+ config="${BAZEL_CONFIG}_build"
fi
mkdir -p /tmp/rules_xcodeproj
@@ -178,7 +178,7 @@ touch "$build_marker"
"$BAZEL_INTEGRATION_DIR/process_bazel_build_log.py" \
"${bazel_cmd[@]}" \
build \
- --config=$config \
+ --config="$config" \
--color=yes \
--experimental_convenience_symlinks=ignore \
--symlink_prefix=/ \
diff --git a/test/fixtures/simple/bwb.xcodeproj/rules_xcodeproj/bazel/xcodeproj.bazelrc b/test/fixtures/simple/bwb.xcodeproj/rules_xcodeproj/bazel/xcodeproj.bazelrc
old mode 100644
new mode 100755
index 1ea3876659..9335b0ac36
--- a/test/fixtures/simple/bwb.xcodeproj/rules_xcodeproj/bazel/xcodeproj.bazelrc
+++ b/test/fixtures/simple/bwb.xcodeproj/rules_xcodeproj/bazel/xcodeproj.bazelrc
@@ -78,5 +78,7 @@ build:rules_xcodeproj_swiftuipreviews --swiftcopt=-Xfrontend --swiftcopt=-enable
build:rules_xcodeproj_swiftuipreviews --swiftcopt=-Xfrontend --swiftcopt=-enable-private-imports
build:rules_xcodeproj_swiftuipreviews --swiftcopt=-Xfrontend --swiftcopt=-enable-dynamic-replacement-chaining
+### Project specific configs
+
# Import `xcodeproj.bazelrc` if it exists
try-import %workspace%/xcodeproj.bazelrc
diff --git a/test/fixtures/simple/bwb_spec.json b/test/fixtures/simple/bwb_spec.json
index b5a1cbf681..8e2ba89a99 100644
--- a/test/fixtures/simple/bwb_spec.json
+++ b/test/fixtures/simple/bwb_spec.json
@@ -1,4 +1,5 @@
{
+ "bazel_config": "rules_xcodeproj",
"bazel_workspace_name": "com_github_buildbuddy_io_rules_xcodeproj",
"build_settings": {
"ALWAYS_SEARCH_USER_PATHS": false,
diff --git a/test/fixtures/simple/bwx.xcodeproj/rules_xcodeproj/bazel/bazel_build.sh b/test/fixtures/simple/bwx.xcodeproj/rules_xcodeproj/bazel/bazel_build.sh
index bb22735f36..2e54c345e2 100755
--- a/test/fixtures/simple/bwx.xcodeproj/rules_xcodeproj/bazel/bazel_build.sh
+++ b/test/fixtures/simple/bwx.xcodeproj/rules_xcodeproj/bazel/bazel_build.sh
@@ -111,7 +111,7 @@ fi
output_path=$("${bazel_cmd[@]}" \
info \
- --config=rules_xcodeproj_info \
+ --config="${BAZEL_CONFIG}_info" \
--color="$color" \
--experimental_convenience_symlinks=ignore \
--symlink_prefix=/ \
@@ -162,11 +162,11 @@ EOF
# Build
if [ "$ACTION" == "indexbuild" ]; then
- config=rules_xcodeproj_indexbuild
+ config="${BAZEL_CONFIG}_indexbuild"
elif [ "${ENABLE_PREVIEWS:-}" == "YES" ]; then
- config=rules_xcodeproj_swiftuipreviews
+ config="${BAZEL_CONFIG}_swiftuipreviews"
else
- config=rules_xcodeproj_build
+ config="${BAZEL_CONFIG}_build"
fi
mkdir -p /tmp/rules_xcodeproj
@@ -178,7 +178,7 @@ touch "$build_marker"
"$BAZEL_INTEGRATION_DIR/process_bazel_build_log.py" \
"${bazel_cmd[@]}" \
build \
- --config=$config \
+ --config="$config" \
--color=yes \
--experimental_convenience_symlinks=ignore \
--symlink_prefix=/ \
diff --git a/test/fixtures/simple/bwx.xcodeproj/rules_xcodeproj/bazel/xcodeproj.bazelrc b/test/fixtures/simple/bwx.xcodeproj/rules_xcodeproj/bazel/xcodeproj.bazelrc
old mode 100644
new mode 100755
index 1ea3876659..9335b0ac36
--- a/test/fixtures/simple/bwx.xcodeproj/rules_xcodeproj/bazel/xcodeproj.bazelrc
+++ b/test/fixtures/simple/bwx.xcodeproj/rules_xcodeproj/bazel/xcodeproj.bazelrc
@@ -78,5 +78,7 @@ build:rules_xcodeproj_swiftuipreviews --swiftcopt=-Xfrontend --swiftcopt=-enable
build:rules_xcodeproj_swiftuipreviews --swiftcopt=-Xfrontend --swiftcopt=-enable-private-imports
build:rules_xcodeproj_swiftuipreviews --swiftcopt=-Xfrontend --swiftcopt=-enable-dynamic-replacement-chaining
+### Project specific configs
+
# Import `xcodeproj.bazelrc` if it exists
try-import %workspace%/xcodeproj.bazelrc
diff --git a/test/fixtures/simple/bwx_spec.json b/test/fixtures/simple/bwx_spec.json
index a856a55ac9..a311d69851 100644
--- a/test/fixtures/simple/bwx_spec.json
+++ b/test/fixtures/simple/bwx_spec.json
@@ -1,4 +1,5 @@
{
+ "bazel_config": "rules_xcodeproj",
"bazel_workspace_name": "com_github_buildbuddy_io_rules_xcodeproj",
"build_settings": {
"ALWAYS_SEARCH_USER_PATHS": false,
diff --git a/tools/generator/src/DTO/Project.swift b/tools/generator/src/DTO/Project.swift
index 4aa5c11f79..257c19c3e7 100644
--- a/tools/generator/src/DTO/Project.swift
+++ b/tools/generator/src/DTO/Project.swift
@@ -1,6 +1,7 @@
struct Project: Equatable, Decodable {
let name: String
let bazelWorkspaceName: String
+ let bazelConfig: String
let label: BazelLabel
let configuration: String
let buildSettings: [String: BuildSetting]
diff --git a/tools/generator/src/Generator/AddBazelDependenciesTarget.swift b/tools/generator/src/Generator/AddBazelDependenciesTarget.swift
index 29672b1c4f..868de782a5 100644
--- a/tools/generator/src/Generator/AddBazelDependenciesTarget.swift
+++ b/tools/generator/src/Generator/AddBazelDependenciesTarget.swift
@@ -25,6 +25,7 @@ extension Generator {
files: [FilePath: File],
filePathResolver: FilePathResolver,
resolvedExternalRepositories: [(Path, Path)],
+ bazelConfig: String,
xcodeprojBazelLabel: BazelLabel,
xcodeprojConfiguration: String,
consolidatedTargets: ConsolidatedTargets
@@ -49,6 +50,7 @@ extension Generator {
let debugConfiguration = XCBuildConfiguration(
name: "Debug",
buildSettings: [
+ "BAZEL_CONFIG": bazelConfig,
"BAZEL_PACKAGE_BIN_DIR": "rules_xcodeproj",
"CALCULATE_OUTPUT_GROUPS_SCRIPT": """
$(BAZEL_INTEGRATION_DIR)/calculate_output_groups.py
diff --git a/tools/generator/src/Generator/Environment.swift b/tools/generator/src/Generator/Environment.swift
index 0656093773..1e128df437 100644
--- a/tools/generator/src/Generator/Environment.swift
+++ b/tools/generator/src/Generator/Environment.swift
@@ -67,6 +67,7 @@ struct Environment {
_ files: [FilePath: File],
_ filePathResolver: FilePathResolver,
_ resolvedExternalRepositories: [(Path, Path)],
+ _ bazelConfig: String,
_ xcodeprojBazelLabel: BazelLabel,
_ xcodeprojConfiguration: String,
_ consolidatedTargets: ConsolidatedTargets
diff --git a/tools/generator/src/Generator/Generator.swift b/tools/generator/src/Generator/Generator.swift
index a4c3045d77..6e6b6927f3 100644
--- a/tools/generator/src/Generator/Generator.swift
+++ b/tools/generator/src/Generator/Generator.swift
@@ -129,6 +129,7 @@ class Generator {
files,
filePathResolver,
resolvedExternalRepositories,
+ project.bazelConfig,
project.label,
project.configuration,
consolidatedTargets
diff --git a/tools/generator/test/Fixtures.swift b/tools/generator/test/Fixtures.swift
index a59d35190b..464806b525 100644
--- a/tools/generator/test/Fixtures.swift
+++ b/tools/generator/test/Fixtures.swift
@@ -8,6 +8,7 @@ enum Fixtures {
static let project = Project(
name: "Bazel",
bazelWorkspaceName: "bazel_workspace",
+ bazelConfig: "rules_xcodeproj_fixtures",
label: "//:xcodeproj",
configuration: "z3y2z",
buildSettings: [
diff --git a/tools/generator/test/GeneratorTests.swift b/tools/generator/test/GeneratorTests.swift
index 861a5e59f0..61a1baf240 100644
--- a/tools/generator/test/GeneratorTests.swift
+++ b/tools/generator/test/GeneratorTests.swift
@@ -12,6 +12,7 @@ final class GeneratorTests: XCTestCase {
let project = Project(
name: "P",
bazelWorkspaceName: "bazel_workspace",
+ bazelConfig: "rules_xcodeproj_test",
label: "//a/P:xcodeproj",
configuration: "abc123",
buildSettings: [:],
@@ -466,6 +467,7 @@ final class GeneratorTests: XCTestCase {
let forceBazelDependencies: Bool
let files: [FilePath: File]
let filePathResolver: FilePathResolver
+ let bazelConfig: String
let xcodeprojBazelLabel: BazelLabel
let xcodeprojConfiguration: String
let consolidatedTargets: ConsolidatedTargets
@@ -480,6 +482,7 @@ final class GeneratorTests: XCTestCase {
files: [FilePath: File],
filePathResolver: FilePathResolver,
resolvedExternalRepositories: [(Path, Path)],
+ bazelConfig: String,
xcodeprojBazelLabel: BazelLabel,
xcodeprojConfiguration: String,
consolidatedTargets: ConsolidatedTargets
@@ -490,6 +493,7 @@ final class GeneratorTests: XCTestCase {
forceBazelDependencies: forceBazelDependencies,
files: files,
filePathResolver: filePathResolver,
+ bazelConfig: bazelConfig,
xcodeprojBazelLabel: xcodeprojBazelLabel,
xcodeprojConfiguration: xcodeprojConfiguration,
consolidatedTargets: consolidatedTargets
@@ -504,6 +508,7 @@ final class GeneratorTests: XCTestCase {
forceBazelDependencies: project.forceBazelDependencies,
files: files,
filePathResolver: filePathResolver,
+ bazelConfig: project.bazelConfig,
xcodeprojBazelLabel: project.label,
xcodeprojConfiguration: project.configuration,
consolidatedTargets: consolidatedTargets
diff --git a/xcodeproj/internal/BUILD b/xcodeproj/internal/BUILD
index 8d11c22199..e95dee8efc 100644
--- a/xcodeproj/internal/BUILD
+++ b/xcodeproj/internal/BUILD
@@ -29,7 +29,7 @@ exports_files([
"installer.template.sh",
"runner.template.sh",
"updater.template.sh",
- "xcodeproj.bazelrc",
+ "xcodeproj.template.bazelrc",
])
string_setting(
@@ -55,8 +55,8 @@ filegroup(
exclude = [
"fixtures.bzl",
"updater.template.sh",
- "xcodeproj_tests.bzl",
"validator.template.sh",
+ "xcodeproj_tests.bzl",
],
) + [
"//" + package_name() + "/bazel_integration_files:release_files",
diff --git a/xcodeproj/internal/bazel_integration_files/BUILD b/xcodeproj/internal/bazel_integration_files/BUILD
index 4e7dc9959e..13ab2d5095 100644
--- a/xcodeproj/internal/bazel_integration_files/BUILD
+++ b/xcodeproj/internal/bazel_integration_files/BUILD
@@ -3,13 +3,8 @@ _BASE_FILES = [
"calculate_output_groups.py",
"create_lldbinit.sh",
"process_bazel_build_log.py",
- "xcodeproj.bazelrc",
]
-exports_files([
- "xcodeproj.bazelrc",
-])
-
filegroup(
name = "base_integration_files",
srcs = _BASE_FILES,
diff --git a/xcodeproj/internal/bazel_integration_files/bazel_build.sh b/xcodeproj/internal/bazel_integration_files/bazel_build.sh
index bb22735f36..2e54c345e2 100644
--- a/xcodeproj/internal/bazel_integration_files/bazel_build.sh
+++ b/xcodeproj/internal/bazel_integration_files/bazel_build.sh
@@ -111,7 +111,7 @@ fi
output_path=$("${bazel_cmd[@]}" \
info \
- --config=rules_xcodeproj_info \
+ --config="${BAZEL_CONFIG}_info" \
--color="$color" \
--experimental_convenience_symlinks=ignore \
--symlink_prefix=/ \
@@ -162,11 +162,11 @@ EOF
# Build
if [ "$ACTION" == "indexbuild" ]; then
- config=rules_xcodeproj_indexbuild
+ config="${BAZEL_CONFIG}_indexbuild"
elif [ "${ENABLE_PREVIEWS:-}" == "YES" ]; then
- config=rules_xcodeproj_swiftuipreviews
+ config="${BAZEL_CONFIG}_swiftuipreviews"
else
- config=rules_xcodeproj_build
+ config="${BAZEL_CONFIG}_build"
fi
mkdir -p /tmp/rules_xcodeproj
@@ -178,7 +178,7 @@ touch "$build_marker"
"$BAZEL_INTEGRATION_DIR/process_bazel_build_log.py" \
"${bazel_cmd[@]}" \
build \
- --config=$config \
+ --config="$config" \
--color=yes \
--experimental_convenience_symlinks=ignore \
--symlink_prefix=/ \
diff --git a/xcodeproj/internal/fixtures.bzl b/xcodeproj/internal/fixtures.bzl
index b3b2b6be03..8a0341116a 100644
--- a/xcodeproj/internal/fixtures.bzl
+++ b/xcodeproj/internal/fixtures.bzl
@@ -144,6 +144,7 @@ def xcodeproj_fixture(
*,
name = "xcodeproj",
modes_and_suffixes = [("xcode", "bwx"), ("bazel", "bwb")],
+ config = "rules_xcodeproj",
top_level_targets = [],
focused_targets = [],
unfocused_targets = [],
@@ -159,6 +160,7 @@ def xcodeproj_fixture(
modes_and_suffixes: A `list` of `tuple`s of `build_mode` and `suffix`.
The `build_mode` will be pass to `xcodeproj.build_mode` and the
`suffix` will be used as the suffix of the project and spec files.
+ config: Maps to `xcodeproj.config`.
top_level_targets: Maps to `xcodeproj.top_level_targets`.
focused_targets: Maps to `xcodeproj.focused_targets`.
unfocused_targets: Maps to `xcodeproj.unfocused_targets`.
@@ -182,6 +184,7 @@ def xcodeproj_fixture(
xcodeproj(
name = fixture_name,
build_mode = mode,
+ config = config,
focused_targets = focused_targets,
project_name = suffix,
top_level_targets = top_level_targets,
diff --git a/xcodeproj/internal/installer.template.sh b/xcodeproj/internal/installer.template.sh
index 8ff18df670..53ac9ab9a4 100644
--- a/xcodeproj/internal/installer.template.sh
+++ b/xcodeproj/internal/installer.template.sh
@@ -22,6 +22,10 @@ include_spec=0
while (("$#")); do
case "${1}" in
+ "--bazelrc")
+ bazelrc="${2}"
+ shift 2
+ ;;
"--destination")
dest="${2}"
shift 2
@@ -79,6 +83,10 @@ if [[ -d "$dest/rules_xcodeproj/bazel" ]]; then
chmod u+x "$dest/rules_xcodeproj/bazel/"*.{py,sh}
fi
+# Copy over xcodeproj.bazelrc
+cp "$bazelrc" "$dest/rules_xcodeproj/bazel/xcodeproj.bazelrc"
+chmod u+w "$dest/rules_xcodeproj/bazel/xcodeproj.bazelrc"
+
# Copy over xcodeproj_extra_flags.bazelrc if it exists
# We can't include this file as an input to the generator, because it would
# require setting ` --@com_github_buildbuddy_io_rules_xcodeproj//xcodeproj:extra_*_flags`
diff --git a/xcodeproj/internal/runner.template.sh b/xcodeproj/internal/runner.template.sh
index 3718e387fc..4ff572f41e 100644
--- a/xcodeproj/internal/runner.template.sh
+++ b/xcodeproj/internal/runner.template.sh
@@ -2,7 +2,6 @@
set -euo pipefail
-
# Functions
# Echos the provided message to stderr and exits with an error (1)
@@ -22,7 +21,10 @@ fail() {
readonly bazelrc="$PWD/%bazelrc%"
readonly extra_flags_bazelrc="$PWD/%extra_flags_bazelrc%"
-installer_flags=(--extra_flags_bazelrc "$extra_flags_bazelrc")
+installer_flags=(
+ --bazelrc "$bazelrc"
+ --extra_flags_bazelrc "$extra_flags_bazelrc"
+)
while (("$#")); do
case "$1" in
@@ -61,7 +63,7 @@ if [[ -z "${build_output_groups:-}" ]]; then
"%bazel_path%" \
"${bazelrcs[@]}" \
run \
- --config=rules_xcodeproj_generator \
+ "--config=%config%_generator" \
%extra_generator_flags% \
"%generator_label%" \
-- "${installer_flags[@]}"
@@ -71,7 +73,7 @@ else
"%bazel_path%" \
"${bazelrcs[@]}" \
build \
- --config=rules_xcodeproj_build \
+ "--config=%config%_build" \
--output_groups="$build_output_groups" \
"%generator_label%"
fi
diff --git a/xcodeproj/internal/bazel_integration_files/xcodeproj.bazelrc b/xcodeproj/internal/xcodeproj.template.bazelrc
similarity index 98%
rename from xcodeproj/internal/bazel_integration_files/xcodeproj.bazelrc
rename to xcodeproj/internal/xcodeproj.template.bazelrc
index 1ea3876659..1d066a82df 100644
--- a/xcodeproj/internal/bazel_integration_files/xcodeproj.bazelrc
+++ b/xcodeproj/internal/xcodeproj.template.bazelrc
@@ -78,5 +78,7 @@ build:rules_xcodeproj_swiftuipreviews --swiftcopt=-Xfrontend --swiftcopt=-enable
build:rules_xcodeproj_swiftuipreviews --swiftcopt=-Xfrontend --swiftcopt=-enable-private-imports
build:rules_xcodeproj_swiftuipreviews --swiftcopt=-Xfrontend --swiftcopt=-enable-dynamic-replacement-chaining
+### Project specific configs
+%project_configs%
# Import `xcodeproj.bazelrc` if it exists
try-import %workspace%/xcodeproj.bazelrc
diff --git a/xcodeproj/internal/xcodeproj_macro.bzl b/xcodeproj/internal/xcodeproj_macro.bzl
index 3630d73591..0ea11cc6d6 100644
--- a/xcodeproj/internal/xcodeproj_macro.bzl
+++ b/xcodeproj/internal/xcodeproj_macro.bzl
@@ -13,6 +13,7 @@ def xcodeproj(
archived_bundles_allowed = None,
bazel_path = "bazel",
build_mode = "bazel",
+ config = "rules_xcodeproj",
focused_targets = [],
ios_device_cpus = "arm64",
ios_simulator_cpus = None,
@@ -57,6 +58,16 @@ def xcodeproj(
If this is set to `"bazel"`, the project will use Bazel to build
targets, inside of Xcode. The Xcode build system still unavoidably
orchestrates some things at a high level.
+ config: Optional. The Bazel configuration to use when generating the
+ project or invoking `bazel` inside of Xcode. This is the basename of
+ multiple configurations. For example, if this is set to
+ `"rules_xcodeproj"`, then the following configurations will be valid
+ for you to extend in your `.bazelrc` file: `rules_xcodeproj`,
+ `rules_xcodeproj_build`, `rules_xcodeproj_indexbuild`,
+ `rules_xcodeproj_info`, and `rules_xcodeproj_swiftuipreviews`.
+
+ See the [baseline `xcodeproj.bazelrc` file](../xcodeproj/internal:xcodeproj.template.bazelrc)
+ that is used for more information on these configs.
focused_targets: Optional. A `list` of target labels as `string` values.
If specified, only these targets will be included in the generated
project; all other targets will be excluded, as if they were
@@ -225,6 +236,7 @@ in your `.bazelrc` or `xcodeproj.bazelrc` file.""")
name = generator_name,
build_mode = build_mode,
bazel_path = bazel_path,
+ config = config,
focused_targets = focused_targets,
ios_device_cpus = ios_device_cpus,
ios_simulator_cpus = ios_simulator_cpus,
@@ -246,6 +258,7 @@ in your `.bazelrc` or `xcodeproj.bazelrc` file.""")
xcodeproj_runner(
name = name,
bazel_path = bazel_path,
+ config = config,
project_name = project_name,
tags = tags,
testonly = testonly,
diff --git a/xcodeproj/internal/xcodeproj_rule.bzl b/xcodeproj/internal/xcodeproj_rule.bzl
index abfcb015e0..dd85e860ef 100644
--- a/xcodeproj/internal/xcodeproj_rule.bzl
+++ b/xcodeproj/internal/xcodeproj_rule.bzl
@@ -225,6 +225,7 @@ def _write_json_spec(
*,
ctx,
project_name,
+ config,
configuration,
targets,
target_dtos,
@@ -316,6 +317,7 @@ def _write_json_spec(
# TODO: Strip fat frameworks instead of setting `VALIDATE_WORKSPACE`
spec_json = """\
{{\
+"bazel_config":"{bazel_config}",\
"bazel_workspace_name":"{bazel_workspace_name}",\
"build_settings":{{\
"ALWAYS_SEARCH_USER_PATHS":false,\
@@ -340,6 +342,7 @@ def _write_json_spec(
"targets":{targets}\
}}
""".format(
+ bazel_config = config,
bazel_path = ctx.attr.bazel_path,
bazel_workspace_name = ctx.workspace_name,
configuration = configuration,
@@ -678,6 +681,7 @@ def _xcodeproj_impl(ctx):
spec_file = _write_json_spec(
ctx = ctx,
project_name = project_name,
+ config = ctx.attr.config,
configuration = configuration,
targets = targets,
target_dtos = target_dtos,
@@ -779,6 +783,9 @@ high level.
mandatory = True,
values = ["xcode", "bazel"],
),
+ "config": attr.string(
+ mandatory = True,
+ ),
"focused_targets": attr.string_list(
doc = """\
A `list` of target labels as `string` values. If specified, only these targets
diff --git a/xcodeproj/internal/xcodeproj_runner.bzl b/xcodeproj/internal/xcodeproj_runner.bzl
index c6ee4c5c36..e0829b08c0 100644
--- a/xcodeproj/internal/xcodeproj_runner.bzl
+++ b/xcodeproj/internal/xcodeproj_runner.bzl
@@ -10,6 +10,39 @@ def _process_extra_flags(*, attr, content, setting, config, config_suffix):
"build:{}{} {}".format(config, config_suffix, extra_flags),
)
+def _write_xcodeproj_bazelrc(name, actions, config, template):
+ output = actions.declare_file("{}.bazelrc".format(name))
+
+ if config != "rules_xcodeproj":
+ project_configs = """
+# Set `--verbose_failures` on `info` as the closest to a "no-op" config as
+# possible, until https://github.com/bazelbuild/bazel/issues/12844 is fixed
+info:{config} --verbose_failures
+
+build:{config}_build --config=rules_xcodeproj_build
+build:{config}_build --config={config}
+build:{config}_generator --config=rules_xcodeproj_generator
+build:{config}_generator --config={config}
+build:{config}_indexbuild --config=rules_xcodeproj_indexbuild
+build:{config}_indexbuild --config={config}
+info:{config}_info --config=rules_xcodeproj_info
+info:{config}_info --config={config}
+build:{config}_swiftuipreviews --config=rules_xcodeproj_swiftuipreviews
+build:{config}_swiftuipreviews --config={config}
+""".format(config = config)
+ else:
+ project_configs = ""
+
+ actions.expand_template(
+ template = template,
+ output = output,
+ substitutions = {
+ "%project_configs%": project_configs,
+ },
+ )
+
+ return output
+
def _write_extra_flags_bazelrc(name, actions, attr, config):
output = actions.declare_file("{}-extra-flags.bazelrc".format(name))
@@ -86,10 +119,15 @@ def _write_runner(
return output
def _xcodeproj_runner_impl(ctx):
- bazelrc = ctx.file._bazelrc
- config = "rules_xcodeproj"
+ config = ctx.attr.config
project_name = ctx.attr.project_name
+ bazelrc = _write_xcodeproj_bazelrc(
+ name = ctx.attr.name,
+ actions = ctx.actions,
+ config = config,
+ template = ctx.file._bazelrc_template,
+ )
extra_flags_bazelrc = _write_extra_flags_bazelrc(
name = ctx.attr.name,
actions = ctx.actions,
@@ -115,7 +153,9 @@ def _xcodeproj_runner_impl(ctx):
return [
DefaultInfo(
executable = runner,
- runfiles = ctx.runfiles(files = [bazelrc, extra_flags_bazelrc]),
+ runfiles = ctx.runfiles(
+ files = [bazelrc, extra_flags_bazelrc],
+ ),
),
XcodeProjRunnerOutputInfo(
project_name = project_name,
@@ -129,15 +169,18 @@ xcodeproj_runner = rule(
"bazel_path": attr.string(
mandatory = True,
),
+ "config": attr.string(
+ mandatory = True,
+ ),
"project_name": attr.string(
mandatory = True,
),
"xcodeproj_target": attr.string(
mandatory = True,
),
- "_bazelrc": attr.label(
+ "_bazelrc_template": attr.label(
allow_single_file = True,
- default = Label("//xcodeproj/internal/bazel_integration_files:xcodeproj.bazelrc"),
+ default = Label("//xcodeproj/internal:xcodeproj.template.bazelrc"),
),
"_extra_build_flags": attr.label(
default = Label("//xcodeproj:extra_build_flags"),