Skip to content

Conversation

@AttilaTheFun
Copy link
Contributor

This PR addresses #509 by introducing a new directive to control the set of GRPC flavors for which the gazelle plugin should generate targets. Currently it generates all three (client, client_stubs and server) but this is probably unnecessary for most people. In my case, I'm using Go on the server and Swift on the client and I don't use the client stubs so I really only need the client targets.

To test, I tried deleting the grpc_example generated BUILD file and regenerating it with just client,server and verified it only included those targets. I then added back client_stubs and verified it added that too. (That's why the order of the targets is now swapped in the BUILD file.)

Copy link
Owner

@cgrindel cgrindel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall, LGTM. Just a couple of questions about some print statements.

@AttilaTheFun
Copy link
Contributor Author

AttilaTheFun commented Oct 11, 2023

@cgrindel okay I cleaned up the print statements and also added a second directive to control the proto library generation.

Now if you add:

# gazelle:swift_generate_proto_libraries false
# gazelle:swift_generate_grpc_libraries_with_flavors -

to your BUILD file, no swift proto libraries or grpc libraries will be generated.

I verified this by deleting the generated BUILD files in the grpc_example and regenerating them with those directives.
They only contained the proto_library from the main gazelle proto plugin.

I then added back:

# gazelle:swift_generate_proto_libraries true
# gazelle:swift_generate_grpc_libraries_with_flavors client,client_stubs,server

and verified it regenerated the targets as expected.

This is also the default behavior to preserve the existing functionality for any users who might have started relying on this already.

Copy link
Owner

@cgrindel cgrindel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@cgrindel cgrindel enabled auto-merge (squash) October 11, 2023 22:23
@cgrindel
Copy link
Owner

@AttilaTheFun It looks like the GRPC examples are failing and we may need to run //:tidy on the repo.

auto-merge was automatically disabled October 12, 2023 16:26

Head branch was pushed to by a user without write access

@cgrindel cgrindel enabled auto-merge (squash) October 12, 2023 17:00
@cgrindel cgrindel merged commit fc8e155 into cgrindel:main Oct 12, 2023
renovate bot referenced this pull request in bazel-contrib/rules_bazel_integration_test Oct 16, 2023
…#220)

[![Mend
Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com)

This PR contains the following updates:

| Package | Type | Update | Change |
|---|---|---|---|
| rules_swift_package_manager | bazel_dep | minor | `0.14.0` -> `0.15.0`
|
|
[rules_swift_package_manager](https://togithub.com/cgrindel/rules_swift_package_manager)
| http_archive | minor | `v0.14.0` -> `v0.15.0` |

---

### Release Notes

<details>
<summary>cgrindel/rules_swift_package_manager
(rules_swift_package_manager)</summary>

###
[`v0.15.0`](https://togithub.com/cgrindel/rules_swift_package_manager/releases/tag/v0.15.0)

[Compare
Source](https://togithub.com/cgrindel/rules_swift_package_manager/compare/v0.14.0...v0.15.0)

#### What's Changed

- chore: update README.md for v0.14.0 by
[@&#8203;cgrindel-app-token-generator](https://togithub.com/cgrindel-app-token-generator)
in
[https://github.com/cgrindel/rules_swift_package_manager/pull/648](https://togithub.com/cgrindel/rules_swift_package_manager/pull/648)
- chore(deps): update dependency vapor/vapor to v4.84.4 by
[@&#8203;cgrindel-self-hosted-renovate](https://togithub.com/cgrindel-self-hosted-renovate)
in
[https://github.com/cgrindel/rules_swift_package_manager/pull/646](https://togithub.com/cgrindel/rules_swift_package_manager/pull/646)
- chore(deps): update dependency rules_xcodeproj to v1.12.1 by
[@&#8203;cgrindel-self-hosted-renovate](https://togithub.com/cgrindel-self-hosted-renovate)
in
[https://github.com/cgrindel/rules_swift_package_manager/pull/642](https://togithub.com/cgrindel/rules_swift_package_manager/pull/642)
- chore(deps): update dependency nicklockwood/swiftformat to from:
"0.52.7" by
[@&#8203;cgrindel-self-hosted-renovate](https://togithub.com/cgrindel-self-hosted-renovate)
in
[https://github.com/cgrindel/rules_swift_package_manager/pull/649](https://togithub.com/cgrindel/rules_swift_package_manager/pull/649)
- chore(deps): update dependency stripe/stripe-ios to from: "23.17.1" by
[@&#8203;cgrindel-self-hosted-renovate](https://togithub.com/cgrindel-self-hosted-renovate)
in
[https://github.com/cgrindel/rules_swift_package_manager/pull/651](https://togithub.com/cgrindel/rules_swift_package_manager/pull/651)
- fix: enable `nimble_example` by
[@&#8203;cgrindel](https://togithub.com/cgrindel) in
[https://github.com/cgrindel/rules_swift_package_manager/pull/654](https://togithub.com/cgrindel/rules_swift_package_manager/pull/654)
- chore(deps): update dependency vapor/vapor to v4.84.6 by
[@&#8203;cgrindel-self-hosted-renovate](https://togithub.com/cgrindel-self-hosted-renovate)
in
[https://github.com/cgrindel/rules_swift_package_manager/pull/653](https://togithub.com/cgrindel/rules_swift_package_manager/pull/653)
- chore(deps): update dependency cgrindel_bazel_starlib to v0.18.0 by
[@&#8203;cgrindel-self-hosted-renovate](https://togithub.com/cgrindel-self-hosted-renovate)
in
[https://github.com/cgrindel/rules_swift_package_manager/pull/656](https://togithub.com/cgrindel/rules_swift_package_manager/pull/656)
- chore(deps): update dependency rules_swift to v1.12.0 by
[@&#8203;cgrindel-self-hosted-renovate](https://togithub.com/cgrindel-self-hosted-renovate)
in
[https://github.com/cgrindel/rules_swift_package_manager/pull/657](https://togithub.com/cgrindel/rules_swift_package_manager/pull/657)
- chore(deps): update dependency quick/nimble to v13 by
[@&#8203;cgrindel-self-hosted-renovate](https://togithub.com/cgrindel-self-hosted-renovate)
in
[https://github.com/cgrindel/rules_swift_package_manager/pull/655](https://togithub.com/cgrindel/rules_swift_package_manager/pull/655)
- feat: Add directive to control set of GRPC flavors generated by
gazelle plugin by
[@&#8203;AttilaTheFun](https://togithub.com/AttilaTheFun) in
[https://github.com/cgrindel/rules_swift_package_manager/pull/650](https://togithub.com/cgrindel/rules_swift_package_manager/pull/650)

**Full Changelog**:
cgrindel/rules_swift_package_manager@v0.14.0...v0.15.0

#### Bazel Module Snippet

```python
bazel_dep(name = "rules_swift_package_manager", version = "0.15.0")
```

#### Workspace Snippet

```python
load("@&#8203;bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")

http_archive(
    name = "rules_swift_package_manager",
    sha256 = "b55c6a626d358bdc80dd61a18f5da87b7c71ec1f54f12f16ab4a1b18d19fe2ca",
    urls = [
        "https://github.com/cgrindel/rules_swift_package_manager/releases/download/v0.15.0/rules_swift_package_manager.v0.15.0.tar.gz",
    ],
)

load("@&#8203;rules_swift_package_manager//:deps.bzl", "swift_bazel_dependencies")

swift_bazel_dependencies()

load("@&#8203;cgrindel_bazel_starlib//:deps.bzl", "bazel_starlib_dependencies")

bazel_starlib_dependencies()

### MARK: - Gazelle
### gazelle:repo bazel_gazelle

load("@&#8203;bazel_gazelle//:deps.bzl", "gazelle_dependencies")
load("@&#8203;rules_swift_package_manager//:go_deps.bzl", "swift_bazel_go_dependencies")
load("@&#8203;io_bazel_rules_go//go:deps.bzl", "go_register_toolchains", "go_rules_dependencies")

### Declare Go dependencies before calling go_rules_dependencies.
swift_bazel_go_dependencies()

go_rules_dependencies()

go_register_toolchains(version = "1.19.1")

gazelle_dependencies()

### MARK: - Swift Toolchain

http_archive(
    name = "build_bazel_rules_swift",

### Populate with your preferred release 
### https://github.com/bazelbuild/rules_swift/releases
)

load(
    "@&#8203;build_bazel_rules_swift//swift:repositories.bzl",
    "swift_rules_dependencies",
)
load("//:swift_deps.bzl", "swift_dependencies")

### gazelle:repository_macro swift_deps.bzl%swift_dependencies
swift_dependencies()

swift_rules_dependencies()

load(
    "@&#8203;build_bazel_rules_swift//swift:extras.bzl",
    "swift_rules_extra_dependencies",
)

swift_rules_extra_dependencies()
```

</details>

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined),
Automerge - At any time (no schedule defined).

🚦 **Automerge**: Enabled.

♻ **Rebasing**: Whenever PR is behind base branch, or you tick the
rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about these
updates again.

---

- [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check
this box

---

This PR has been generated by [Mend
Renovate](https://www.mend.io/free-developer-tools/renovate/). View
repository job log
[here](https://developer.mend.io/github/bazel-contrib/rules_bazel_integration_test).

<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNy44LjEiLCJ1cGRhdGVkSW5WZXIiOiIzNy44LjEiLCJ0YXJnZXRCcmFuY2giOiJtYWluIn0=-->

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants