Skip to content

Commit 34b0098

Browse files
authored
docs: clarify when to enable declare_swift_deps_info (#1185)
Clarify when the `declare_swift_deps_info` attribute should be enabled for workspaces that use `rules_swift_package_manager`. Closes #1176.
1 parent c27daf6 commit 34b0098

File tree

1 file changed

+17
-5
lines changed

1 file changed

+17
-5
lines changed

README.md

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ development inside a Bazel workspace.
2020
* [Quickstart](#quickstart)
2121
* [1. Enable bzlmod](#1-enable-bzlmod)
2222
* [2. Configure your `MODULE.bazel` to use rules_swift_package_manager.](#2-configure-your-modulebazel-to-use-rules_swift_package_manager)
23+
* [(Optional) Enable `swift_deps_info` generation for the Gazelle plugin](#optional-enable-swift_deps_info-generation-for-the-gazelle-plugin)
2324
* [3. Create a minimal `Package.swift` file.](#3-create-a-minimal-packageswift-file)
2425
* [4. Run `swift package update`](#4-run-swift-package-update)
2526
* [5. Run `bazel mod tidy`.](#5-run-bazel-mod-tidy)
@@ -116,16 +117,27 @@ use_repo(
116117
)
117118
```
118119

119-
You will also need to add a dependency on Gazelle and `rules_swift`. Follow
120-
the links below to get the latest bzlmod snippets to insert into your `MODULE.bazel`.
121-
122-
- [gazelle](https://registry.bazel.build/modules/gazelle)
123-
- [rules_swift](https://registry.bazel.build/modules/rules_swift)
120+
You will also need to add a dependency on [rules_swift].
124121

125122
NOTE: Some Swift package manager features (e.g., resources) use rules from [rules_apple]. It is a
126123
dependency for `rules_swift_package_manager`. However, you do not need to declare it unless you use
127124
any of the rules in your project.
128125

126+
#### (Optional) Enable `swift_deps_info` generation for the Gazelle plugin
127+
128+
If you will be using the Gazelle plugin for Swift, you will need to enable the generation of
129+
the `swift_deps_info` repository by enabling `declare_swift_deps_info`.
130+
131+
```bazel
132+
swift_deps.from_package(
133+
declare_swift_deps_info = True, # <=== Enable swift_deps_info generation for the Gazelle plugin
134+
resolved = "//:Package.resolved",
135+
swift = "//:Package.swift",
136+
)
137+
```
138+
139+
You will also need to add a dependency on [Gazelle](https://registry.bazel.build/modules/gazelle).
140+
129141
### 3. Create a minimal `Package.swift` file.
130142

131143
Create a minimal `Package.swift` file that only contains the external dependencies that are directly

0 commit comments

Comments
 (0)