11# Gazelle Plugin for Swift and Swift Package Rules for Bazel
22
3- [ ![ Build] ( https://github.com/cgrindel/swift_bazel /actions/workflows/ci.yml/badge.svg?event=schedule )] ( https://github.com/cgrindel/swift_bazel /actions/workflows/ci.yml )
3+ [ ![ Build] ( https://github.com/cgrindel/rules_swift_package_manager /actions/workflows/ci.yml/badge.svg?event=schedule )] ( https://github.com/cgrindel/rules_swift_package_manager /actions/workflows/ci.yml )
44
55This repository contains a [ Gazelle plugin] and Bazel repository rules that can be used to download,
66build, and consume Swift packages. The rules in this repository build the external Swift packages
@@ -18,7 +18,7 @@ development inside a Bazel workspace.
1818 * [ Mac OS] ( #mac-os )
1919 * [ Linux] ( #linux )
2020* [ Quickstart] ( #quickstart )
21- * [ 1\. Configure your workspace to use <a href =" https://github\.com/cgrindel/swift\_bazel " >swift \_ bazel </a >\. ] ( #1-configure-your-workspace-to-use-swift_bazel )
21+ * [ 1\. Configure your workspace to use <a href =" https://github\.com/cgrindel/rules\_swift\_package\_manager " >rules \_ swift \_ package \_ manager </a >\. ] ( #1-configure-your-workspace-to-use-rules_swift_package_manager )
2222 * [ 2\. Create a minimal Package\. swift file\. ] ( #2-create-a-minimal-packageswift-file )
2323 * [ 3\. Add Gazelle targets to BUILD\. bazel at the root of your workspace\. ] ( #3-add-gazelle-targets-to-buildbazel-at-the-root-of-your-workspace )
2424 * [ 4\. Resolve the external dependencies for your project\. ] ( #4-resolve-the-external-dependencies-for-your-project )
@@ -50,7 +50,7 @@ Don't forget that `rules_swift` [expects the use of
5050` clang ` ] ( https://github.com/bazelbuild/rules_swift#3-additional-configuration-linux-only ) . Hence,
5151you will need to specify ` CC=clang ` before running Bazel.
5252
53- Finally, help [ rules_swift] and [ swift_bazel ] find the Swift toolchain by ensuring that a ` PATH `
53+ Finally, help [ rules_swift] and [ rules_swift_package_manager ] find the Swift toolchain by ensuring that a ` PATH `
5454that includes the Swift binary is available in the Bazel actions.
5555
5656``` sh
@@ -68,23 +68,23 @@ actions. See the [CI GitHub workflow] for more details.
6868The following provides a quick introduction on how to set up and use the features in this
6969repository. Also, check out the [ examples] for more information.
7070
71- ### 1. Configure your workspace to use [ swift_bazel ] .
71+ ### 1. Configure your workspace to use [ rules_swift_package_manager ] .
7272
73- Update the ` WORKSPACE ` file to load the dependencies for [ swift_bazel ] , [ rules_swift] and [ Gazelle] .
73+ Update the ` WORKSPACE ` file to load the dependencies for [ rules_swift_package_manager ] , [ rules_swift] and [ Gazelle] .
7474
7575<!-- BEGIN WORKSPACE SNIPPET -->
7676``` python
7777load(" @bazel_tools//tools/build_defs/repo:http.bzl" , " http_archive" )
7878
7979http_archive(
80- name = " cgrindel_swift_bazel " ,
80+ name = " rules_swift_package_manager " ,
8181 sha256 = " 40bf17727804121e54e470e464fb9fd85d6cd3d71007139c33bf1f37675b7fad" ,
8282 urls = [
83- " https://github.com/cgrindel/swift_bazel /releases/download/v0.3.3/swift_bazel .v0.3.3.tar.gz" ,
83+ " https://github.com/cgrindel/rules_swift_package_manager /releases/download/v0.3.3/rules_swift_package_manager .v0.3.3.tar.gz" ,
8484 ],
8585)
8686
87- load(" @cgrindel_swift_bazel //:deps.bzl" , " swift_bazel_dependencies" )
87+ load(" @rules_swift_package_manager //:deps.bzl" , " swift_bazel_dependencies" )
8888
8989swift_bazel_dependencies()
9090
@@ -97,7 +97,7 @@ bazel_starlib_dependencies()
9797# gazelle:repo bazel_gazelle
9898
9999load(" @bazel_gazelle//:deps.bzl" , " gazelle_dependencies" )
100- load(" @cgrindel_swift_bazel //:go_deps.bzl" , " swift_bazel_go_dependencies" )
100+ load(" @rules_swift_package_manager //:go_deps.bzl" , " swift_bazel_go_dependencies" )
101101load(" @io_bazel_rules_go//go:deps.bzl" , " go_register_toolchains" , " go_rules_dependencies" )
102102
103103# Declare Go dependencies before calling go_rules_dependencies.
@@ -167,7 +167,7 @@ let package = Package(
167167```
168168
169169The name of the package can be whatever you like. It is required for the manifest, but it is not
170- used by [ swift_bazel ] . If your proejct is published and consumed as a Swift package, feel free to
170+ used by [ rules_swift_package_manager ] . If your proejct is published and consumed as a Swift package, feel free to
171171populate the rest of the manifest so that your package works properly by Swift package manager. Just
172172note that the Swift Gazelle plugin does not use the manifest to generate Bazel build files, at this
173173time.
@@ -178,7 +178,7 @@ Add the following to the `BUILD.bazel` file at the root of your workspace.
178178
179179``` python
180180load(" @bazel_gazelle//:def.bzl" , " gazelle" , " gazelle_binary" )
181- load(" @cgrindel_swift_bazel //swiftpkg:defs.bzl" , " swift_update_packages" )
181+ load(" @rules_swift_package_manager //swiftpkg:defs.bzl" , " swift_update_packages" )
182182
183183# Ignore the `.build` folder that is created by running Swift package manager
184184# commands. The Swift Gazelle plugin executes some Swift package manager
@@ -191,11 +191,11 @@ load("@cgrindel_swift_bazel//swiftpkg:defs.bzl", "swift_update_packages")
191191
192192# This declaration builds a Gazelle binary that incorporates all of the Gazelle
193193# plugins for the languages that you use in your workspace. In this example, we
194- # are only listing the Gazelle plugin for Swift from cgrindel_swift_bazel .
194+ # are only listing the Gazelle plugin for Swift from rules_swift_package_manager .
195195gazelle_binary(
196196 name = " gazelle_bin" ,
197197 languages = [
198- " @cgrindel_swift_bazel //gazelle" ,
198+ " @rules_swift_package_manager //gazelle" ,
199199 ],
200200)
201201
@@ -295,5 +295,5 @@ The following are a few tips to consider as you work with your repository:
295295[ examples ] : examples/
296296[ rules_spm ] : https://github.com/cgrindel/rules_spm
297297[ rules_swift ] : https://github.com/bazelbuild/rules_swift
298- [ swift_bazel ] : https://github.com/cgrindel/swift_bazel
298+ [ rules_swift_package_manager ] : https://github.com/cgrindel/rules_swift_package_manager
299299[ tidy ] : https://github.com/cgrindel/bazel-starlib/blob/main/doc/bzltidy/rules_and_macros_overview.md#tidy
0 commit comments