Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for per-xcodeproj Bazel configurations #1062

Merged
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
9 changes: 5 additions & 4 deletions doc/rules-xcodeproj.md
Original file line number Diff line number Diff line change
Expand Up @@ -268,10 +268,10 @@ A `sequence` of values returned by `xcode_schemes.scheme`.
## xcodeproj

<pre>
xcodeproj(<a href="#xcodeproj-name">name</a>, <a href="#xcodeproj-archived_bundles_allowed">archived_bundles_allowed</a>, <a href="#xcodeproj-bazel_path">bazel_path</a>, <a href="#xcodeproj-build_mode">build_mode</a>, <a href="#xcodeproj-focused_targets">focused_targets</a>, <a href="#xcodeproj-ios_device_cpus">ios_device_cpus</a>,
<a href="#xcodeproj-ios_simulator_cpus">ios_simulator_cpus</a>, <a href="#xcodeproj-project_name">project_name</a>, <a href="#xcodeproj-scheme_autogeneration_mode">scheme_autogeneration_mode</a>, <a href="#xcodeproj-schemes">schemes</a>, <a href="#xcodeproj-top_level_targets">top_level_targets</a>,
<a href="#xcodeproj-tvos_device_cpus">tvos_device_cpus</a>, <a href="#xcodeproj-tvos_simulator_cpus">tvos_simulator_cpus</a>, <a href="#xcodeproj-unfocused_targets">unfocused_targets</a>, <a href="#xcodeproj-watchos_device_cpus">watchos_device_cpus</a>,
<a href="#xcodeproj-watchos_simulator_cpus">watchos_simulator_cpus</a>, <a href="#xcodeproj-kwargs">kwargs</a>)
xcodeproj(<a href="#xcodeproj-name">name</a>, <a href="#xcodeproj-archived_bundles_allowed">archived_bundles_allowed</a>, <a href="#xcodeproj-bazel_path">bazel_path</a>, <a href="#xcodeproj-build_mode">build_mode</a>, <a href="#xcodeproj-config">config</a>, <a href="#xcodeproj-focused_targets">focused_targets</a>,
<a href="#xcodeproj-ios_device_cpus">ios_device_cpus</a>, <a href="#xcodeproj-ios_simulator_cpus">ios_simulator_cpus</a>, <a href="#xcodeproj-project_name">project_name</a>, <a href="#xcodeproj-scheme_autogeneration_mode">scheme_autogeneration_mode</a>, <a href="#xcodeproj-schemes">schemes</a>,
<a href="#xcodeproj-top_level_targets">top_level_targets</a>, <a href="#xcodeproj-tvos_device_cpus">tvos_device_cpus</a>, <a href="#xcodeproj-tvos_simulator_cpus">tvos_simulator_cpus</a>, <a href="#xcodeproj-unfocused_targets">unfocused_targets</a>,
<a href="#xcodeproj-watchos_device_cpus">watchos_device_cpus</a>, <a href="#xcodeproj-watchos_simulator_cpus">watchos_simulator_cpus</a>, <a href="#xcodeproj-kwargs">kwargs</a>)
</pre>

Creates an `.xcodeproj` file in the workspace when run.
Expand All @@ -292,6 +292,7 @@ argument will pass forward values for globally available attributes (e.g.
| <a id="xcodeproj-archived_bundles_allowed"></a>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 <code>--define=apple.experimental.tree_artifact_outputs</code> on <code>build:rules_xcodeproj</code> in your <code>.bazelrc</code> or <code>xcodeproj.bazelrc</code> file. | <code>None</code> |
| <a id="xcodeproj-bazel_path"></a>bazel_path | Optional. The path the <code>bazel</code> binary or wrapper script. If the path is relative it will be resolved using the <code>PATH</code> environment variable (which is set to <code>/opt/homebrew/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin</code> in Xcode). If you want to specify a path to a workspace-relative binary, you must prepend the path with <code>./</code> (e.g. <code>"./bazelw"</code>). | <code>"bazel"</code> |
| <a id="xcodeproj-build_mode"></a>build_mode | Optional. The build mode the generated project should use.<br><br>If this is set to <code>"xcode"</code>, the project will use the Xcode build system to build targets. Generated files and unfocused targets (see the <code>focused_targets</code> and <code>unfocused_targets</code> arguments) will be built with Bazel.<br><br>If this is set to <code>"bazel"</code>, the project will use Bazel to build targets, inside of Xcode. The Xcode build system still unavoidably orchestrates some things at a high level. | <code>"bazel"</code> |
| <a id="xcodeproj-config"></a>config | Optional. The Bazel configuration to use when generating the project or invoking <code>bazel</code> inside of Xcode. This is the basename of multiple configurations. For example, if this is set to <code>"rules_xcodeproj"</code>, then the following configurations will be valid for you to extend in your <code>.bazelrc</code> file: <code>rules_xcodeproj</code>, <code>rules_xcodeproj_build</code>, <code>rules_xcodeproj_indexbuild</code>, <code>rules_xcodeproj_info</code>, and <code>rules_xcodeproj_swiftuipreviews</code>.<br><br>See the [baseline <code>xcodeproj.bazelrc</code> file](../xcodeproj/internal:xcodeproj.template.bazelrc) that is used for more information on these configs. | <code>"rules_xcodeproj"</code> |
| <a id="xcodeproj-focused_targets"></a>focused_targets | Optional. A <code>list</code> of target labels as <code>string</code> 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 <code>unfocused_targets</code> argument. The labels must match transitive dependencies of the targets specified in the <code>top_level_targets</code> argument. | <code>[]</code> |
| <a id="xcodeproj-ios_device_cpus"></a>ios_device_cpus | Optional. The value to use for <code>--ios_multi_cpus</code> when building the transitive dependencies of the targets specified in the <code>top_level_targets</code> argument with the <code>"device"</code> <code>target_environment</code>.<br><br>**Warning:** Changing this value will affect the Starlark transition hash of all transitive dependencies of the targets specified in the <code>top_level_targets</code> argument with the <code>"device"</code> <code>target_environment</code>, even if they aren't iOS targets. | <code>"arm64"</code> |
| <a id="xcodeproj-ios_simulator_cpus"></a>ios_simulator_cpus | Optional. The value to use for <code>--ios_multi_cpus</code> when building the transitive dependencies of the targets specified in the <code>top_level_targets</code> argument with the <code>"simulator"</code> <code>target_environment</code>.<br><br>If no value is specified, it defaults to the simulator cpu that goes with <code>--host_cpu</code> (i.e. <code>sim_arm64</code> on Apple Silicon and <code>x86_64</code> on Intel).<br><br>**Warning:** Changing this value will affect the Starlark transition hash of all transitive dependencies of the targets specified in the <code>top_level_targets</code> argument with the <code>"simulator"</code> <code>target_environment</code>, even if they aren't iOS targets. | <code>None</code> |
Expand Down
2 changes: 2 additions & 0 deletions examples/integration/.bazelrc
Original file line number Diff line number Diff line change
Expand Up @@ -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
3 changes: 2 additions & 1 deletion examples/integration/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
3 changes: 2 additions & 1 deletion examples/integration/test/fixtures/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -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,
)

Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 17 additions & 0 deletions examples/integration/test/fixtures/bwb.xcodeproj/rules_xcodeproj/bazel/xcodeproj.bazelrc
100644 → 100755

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions examples/integration/test/fixtures/bwb_spec.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 17 additions & 0 deletions examples/integration/test/fixtures/bwx.xcodeproj/rules_xcodeproj/bazel/xcodeproj.bazelrc
100644 → 100755

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions examples/integration/test/fixtures/bwx_spec.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions examples/integration/xcodeproj_targets.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ load(
"top_level_target",
)

CONFIG = "rules_xcodeproj_integration"

XCODEPROJ_TARGETS = [
top_level_target(
label = "//CommandLine/CommandLineTool",
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions examples/ios_app/test/fixtures/bwb.xcodeproj/rules_xcodeproj/bazel/xcodeproj.bazelrc
100644 → 100755

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions examples/ios_app/test/fixtures/bwb_spec.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions examples/ios_app/test/fixtures/bwx.xcodeproj/rules_xcodeproj/bazel/xcodeproj.bazelrc
100644 → 100755

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions examples/ios_app/test/fixtures/bwx_spec.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions test/fixtures/cc/bwb.xcodeproj/project.pbxproj

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions test/fixtures/cc/bwb.xcodeproj/rules_xcodeproj/bazel/xcodeproj.bazelrc
100644 → 100755

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions test/fixtures/cc/bwb_spec.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading