Skip to content

Commit 744108e

Browse files
[docs] Update migrating to Xcode tutorial (bazelbuild#17563)
As [Tulsi](https://github.com/bazelbuild/tulsi) has been officially archived, this PR updates the Bazel documentation to replace its mentions in favour of [rules_xcodeproj](https://github.com/buildbuddy-io/rules_xcodeproj). On top of that, this PR also removes the page that shortly documented how to move CocoaPods dependencies in favour of a short paragraph about experimental rules for the Swift Package Manager. PiperOrigin-RevId: 511749044 Change-Id: I9aa843011525f556fe6ef7260c02cb426aaca6e3 Co-authored-by: Patrick Balestra <[email protected]>
1 parent a2f013a commit 744108e

File tree

2 files changed

+29
-46
lines changed

2 files changed

+29
-46
lines changed

site/en/migrate/cocoapods.md

-12
This file was deleted.

site/en/migrate/xcode.md

+29-34
Original file line numberDiff line numberDiff line change
@@ -20,27 +20,12 @@ troubleshooting solutions to address common errors.
2020
* When building Xcode projects with Bazel, the `BUILD` file(s) become the
2121
source of truth. If you work on the project in Xcode, you must generate a
2222
new version of the Xcode project that matches the `BUILD` files using
23-
[Tulsi](http://tulsi.bazel.build/) whenever you update the `BUILD` files. If
24-
you're not using Xcode, the `bazel build` and `bazel test` commands provide
25-
build and test capabilities with certain limitations described later in this
26-
guide.
27-
28-
* Due to differences in build configuration schemas, such as directory layouts
29-
or build flags, Xcode might not be fully aware of the "big picture" of the
30-
build and thus some Xcode features might not work. Namely:
31-
32-
* Depending on the targets you select for conversion in Tulsi, Xcode might
33-
not be able to properly index the project source. This affects code
34-
completion and navigation in Xcode, since Xcode won't be able to see all
35-
of the project's source code.
36-
37-
* Static analysis, address sanitizers, and thread sanitizers might not
38-
work, since Bazel does not produce the outputs that Xcode expects for
39-
those features.
40-
41-
* If you generate an Xcode project with Tulsi and use that project to run
42-
tests from within Xcode, Xcode will run the tests instead of
43-
Bazel. To run tests with Bazel, run the `bazel test` command manually.
23+
[rules_xcodeproj](https://github.com/buildbuddy-io/rules_xcodeproj/){: .external}
24+
whenever you update the `BUILD` files. Certain changes to the `BUILD` files
25+
such as adding dependencies to a target don't require regenerating the
26+
project which can speed up development. If you're not using Xcode, the
27+
`bazel build` and `bazel test` commands provide build and test capabilities
28+
with certain limitations described later in this guide.
4429

4530
## Before you begin {:#before-you-begin}
4631

@@ -69,7 +54,7 @@ To build or test an Xcode project with Bazel, do the following:
6954

7055
1. [Create the `WORKSPACE` file](#create-workspace)
7156

72-
2. [(Experimental) Integrate CocoaPods dependencies](#integrate-cocoapods)
57+
2. [(Experimental) Integrate SwiftPM dependencies](#integrate-swiftpm)
7358

7459
3. [Create a `BUILD` file:](#create-build-file)
7560

@@ -83,7 +68,7 @@ To build or test an Xcode project with Bazel, do the following:
8368

8469
5. [Run the build](#run-build)
8570

86-
6. [Generate the Xcode project with Tulsi](#generate-xcode-tulsi)
71+
6. [Generate the Xcode project with rules_xcodeproj](#generate-the-xcode-project-with-rules_xcodeproj)
8772

8873
### Step 1: Create the `WORKSPACE` file {:#create-workspace}
8974

@@ -96,13 +81,13 @@ file.
9681
Note: Place the project source code within the directory tree containing the
9782
`WORKSPACE` file.
9883

99-
### Step 2: (Experimental) Integrate CocoaPods dependencies {:#integrate-cocoapods}
84+
### Step 2: (Experimental) Integrate SwiftPM dependencies {:#integrate-swiftpm}
10085

101-
To integrate CocoaPods dependencies into the Bazel workspace, you must convert
102-
them into Bazel packages as described in [Converting CocoaPods dependencies](/migrate/cocoapods).
86+
To integrate SwiftPM dependencies into the Bazel workspace with [swift_bazel](https://github.com/cgrindel/swift_bazel){: .external},
87+
you must convert them into Bazel packages as described in the [following tutorial](https://chuckgrindel.com/swift-packages-in-bazel-using-swift_bazel/){: .external}.
10388

104-
Note: CocoaPods conversion is a manual process with many variables.
105-
CocoaPods integration with Bazel has not been fully verified and is not
89+
Note: SwiftPM support is a manual process with many variables.
90+
SwiftPM integration with Bazel has not been fully verified and is not
10691
officially supported.
10792

10893
### Step 3: Create a `BUILD` file {:#create-build-file}
@@ -147,19 +132,19 @@ Bazel's [Apple build rules](https://github.com/bazelbuild/rules_apple){: .extern
147132
running library-based unit tests on iOS and macOS, as well as application-based
148133
tests on macOS. For application-based tests on iOS or UI tests on either
149134
platform, Bazel will build the test outputs but the tests must run within Xcode
150-
through a project generated with Tulsi. Add test targets as follows:
135+
through a project generated with rules_xcodeproj. Add test targets as follows:
151136

152137
* [`macos_unit_test`](https://github.com/bazelbuild/rules_apple/blob/master/doc/rules-macos.md#macos_unit_test){: .external} to run library-based and application-based unit tests on a macOS.
153138

154139
* [`ios_unit_test`](https://github.com/bazelbuild/rules_apple/blob/master/doc/rules-ios.md#ios_unit_test){: .external}
155140
to run library-based unit tests on iOS. For tests requiring the iOS
156141
simulator, Bazel will build the test outputs but not run the tests. You must
157-
[generate an Xcode project with Tulsi](#step-5-generate-the-xcode-project-with-tulsi)
142+
[generate an Xcode project with rules_xcodeproj](#generate-the-xcode-project-with-rules_xcodeproj)
158143
and run the tests from within Xcode.
159144

160145
* [`ios_ui_test`](https://github.com/bazelbuild/rules_apple/blob/master/doc/rules-ios.md#ios_ui_test){: .external}
161146
to build outputs required to run user interface tests in the iOS simulator
162-
using Xcode. You must [generate an Xcode project with Tulsi](#step-5-generate-the-xcode-project-with-tulsi)
147+
using Xcode. You must [generate an Xcode project with rules_xcodeproj](#generate-the-xcode-project-with-rules_xcodeproj)
163148
and run the tests from within Xcode. Bazel cannot natively run UI tests.
164149

165150
At the minimum, specify a value for the `minimum_os_version` attribute. While
@@ -173,7 +158,7 @@ simulator, also specify the `ios_application` target name as the value of the
173158
#### Step 3c: Add the library target(s) {:#add-library-target}
174159

175160
Add an [`objc_library`](/reference/be/objective-c#objc_library)
176-
target for each Objective C library and a [`swift_library`](https://github.com/bazelbuild/rules_apple/blob/master/doc/rules-swift.md){: .external}
161+
target for each Objective-C library and a [`swift_library`](https://github.com/bazelbuild/rules_swift/blob/master/doc/rules.md#swift_library){: .external}
177162
target for each Swift library on which the application and/or tests depend.
178163

179164

@@ -192,6 +177,16 @@ Note: You can use the [`glob`](/reference/be/functions#glob)
192177
function to include all sources and/or headers of a certain type. Use it
193178
carefully as it might include files you do not want Bazel to build.
194179

180+
You can browse existing examples for various types of applications directly in the
181+
[rules_apple examples directory](https://github.com/bazelbuild/rules_apple/tree/master/examples/). For example:
182+
183+
* [macOS application targets](https://github.com/bazelbuild/rules_apple/tree/master/examples/macos){: .external}
184+
185+
* [iOS applications targets](https://github.com/bazelbuild/rules_apple/tree/master/examples/ios){: .external}
186+
187+
* [Multi platform applications (macOS, iOS, watchOS, tvOS)](https://github.com/bazelbuild/rules_apple/tree/master/examples/multi_platform){: .external}
188+
189+
195190
For more information on build rules, see [Apple Rules for Bazel](https://github.com/bazelbuild/rules_apple){: .external}.
196191

197192
At this point, it is a good idea to test the build:
@@ -244,11 +239,11 @@ For example:
244239
bazel build //:my-target
245240
```
246241

247-
### Step 6: Generate the Xcode project with Tulsi {:#generate-xcode-tulsi}
242+
### Step 6: Generate the Xcode project with rules_xcodeproj {:#generate-the-xcode-project-with-rules_xcodeproj}
248243

249244
When building with Bazel, the `WORKSPACE` and `BUILD` files become the source
250245
of truth about the build. To make Xcode aware of this, you must generate a
251-
Bazel-compatible Xcode project using [Tulsi](http://tulsi.bazel.build/).
246+
Bazel-compatible Xcode project using [rules_xcodeproj](https://github.com/buildbuddy-io/rules_xcodeproj#features){: .external}.
252247

253248
### Troubleshooting {:#troubleshooting}
254249

0 commit comments

Comments
 (0)