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 SwiftGRPCInfo provider #1121

Merged

Conversation

AttilaTheFun
Copy link
Contributor

@AttilaTheFun AttilaTheFun commented Oct 6, 2023

Hi folks! I'm working on a tool to copy generated .pb.swift and .grpc.swift files out of the Bazel build tree into my repo. These files aren't used directly, they're just meant for reference / easy lookup / non-Xcode editor support (VSCode).

Currently, getting this information from GRPC targets is a pain, and they don't differentiate the providers based on flavor. Also in the case of the existing SwiftProtoInfo you get a depset of all of the transitive, generated pbswift files, not just those for direct dependencies. And the SwiftProtoInfo doesn't include the GRPC files at all.

This change is purely additive so it should not break anyone. It introduces a new SwiftGRPCInfo provider returned from the swift_grpc_library rule which exposes the flavor and direct_grpc_files generated by the target. I also added an analogous direct_pbswift_files field to the SwiftProtoInfo provider. These are just flat lists of the generated .pb.swift and .grpc.swift files respectively for direct (proto) deps of those targets.

swift/swift.bzl Outdated Show resolved Hide resolved
swift/internal/swift_protoc_gen_aspect.bzl Outdated Show resolved Hide resolved
swift/internal/providers.bzl Outdated Show resolved Hide resolved
@AttilaTheFun
Copy link
Contributor Author

Thanks @brentleyjones ! I addressed your comments in the latest commit.

@AttilaTheFun AttilaTheFun force-pushed the lshire-add-grpc-provider branch 3 times, most recently from 62f3837 to 77bb7bd Compare October 18, 2023 21:15
@brentleyjones brentleyjones merged commit 4217d3f into bazelbuild:master Oct 19, 2023
15 checks passed
cgrindel-self-hosted-renovate bot referenced this pull request in cgrindel/rules_swiftformat Oct 19, 2023
This PR contains the following updates:

| Package | Type | Update | Change |
|---|---|---|---|
| [build_bazel_rules_swift](https://togithub.com/bazelbuild/rules_swift)
| http_archive | minor | `1.12.0` -> `1.13.0` |

---

### Release Notes

<details>
<summary>bazelbuild/rules_swift (build_bazel_rules_swift)</summary>

###
[`v1.13.0`](https://togithub.com/bazelbuild/rules_swift/releases/tag/1.13.0)

[Compare
Source](https://togithub.com/bazelbuild/rules_swift/compare/1.12.0...1.13.0)

##### What's Changed

- Fixed "name 'visibility' is not defined" error on Bazel 5 by
[@&#8203;jesses-canva](https://togithub.com/jesses-canva) in
[https://github.com/bazelbuild/rules_swift/pull/1117](https://togithub.com/bazelbuild/rules_swift/pull/1117)
- Limited `--cxxopt='-std=c++14'` to Linux builds by
[@&#8203;thii](https://togithub.com/thii) in
[https://github.com/bazelbuild/rules_swift/pull/1122](https://togithub.com/bazelbuild/rules_swift/pull/1122)
- Add SwiftGRPCInfo provider by
[@&#8203;AttilaTheFun](https://togithub.com/AttilaTheFun) in
[https://github.com/bazelbuild/rules_swift/pull/1121](https://togithub.com/bazelbuild/rules_swift/pull/1121)

This release is compatible with 5.x LTS, 6.x LTS, and bazel 7.x rolling
releases

##### MODULE.bazel Snippet

```bzl
bazel_dep(name = "rules_swift", version = "1.13.0", repo_name = "build_bazel_rules_swift")
```

##### Workspace Snippet

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

http_archive(
    name = "build_bazel_rules_swift",
    sha256 = "28a66ff5d97500f0304f4e8945d936fe0584e0d5b7a6f83258298007a93190ba",
    url = "https://github.com/bazelbuild/rules_swift/releases/download/1.13.0/rules_swift.1.13.0.tar.gz",
)

load(
    "@&#8203;build_bazel_rules_swift//swift:repositories.bzl",
    "swift_rules_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.

👻 **Immortal**: This PR will be recreated if closed unmerged. Get
[config help](https://togithub.com/renovatebot/renovate/discussions) if
that's undesired.

---

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

---

This PR has been generated by [Renovate
Bot](https://togithub.com/renovatebot/renovate).

<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNi4xMDAuMCIsInVwZGF0ZWRJblZlciI6IjM2LjEwMC4wIiwidGFyZ2V0QnJhbmNoIjoibWFpbiJ9-->

Co-authored-by: Self-hosted Renovate Bot <361546+cgrindel-self-hosted-renovate[bot]@users.noreply.github.enterprise.com>
renovate bot referenced this pull request in bazel-contrib/rules_bazel_integration_test Oct 20, 2023
[![Mend
Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com)

This PR contains the following updates:

| Package | Type | Update | Change |
|---|---|---|---|
| [build_bazel_rules_swift](https://togithub.com/bazelbuild/rules_swift)
| http_archive | minor | `1.12.0` -> `1.13.0` |

---

### Release Notes

<details>
<summary>bazelbuild/rules_swift (build_bazel_rules_swift)</summary>

###
[`v1.13.0`](https://togithub.com/bazelbuild/rules_swift/releases/tag/1.13.0)

[Compare
Source](https://togithub.com/bazelbuild/rules_swift/compare/1.12.0...1.13.0)

#### What's Changed

- Fixed "name 'visibility' is not defined" error on Bazel 5 by
[@&#8203;jesses-canva](https://togithub.com/jesses-canva) in
[https://github.com/bazelbuild/rules_swift/pull/1117](https://togithub.com/bazelbuild/rules_swift/pull/1117)
- Limited `--cxxopt='-std=c++14'` to Linux builds by
[@&#8203;thii](https://togithub.com/thii) in
[https://github.com/bazelbuild/rules_swift/pull/1122](https://togithub.com/bazelbuild/rules_swift/pull/1122)
- Add SwiftGRPCInfo provider by
[@&#8203;AttilaTheFun](https://togithub.com/AttilaTheFun) in
[https://github.com/bazelbuild/rules_swift/pull/1121](https://togithub.com/bazelbuild/rules_swift/pull/1121)

This release is compatible with 5.x LTS, 6.x LTS, and bazel 7.x rolling
releases

##### MODULE.bazel Snippet

```bzl
bazel_dep(name = "rules_swift", version = "1.13.0", repo_name = "build_bazel_rules_swift")
```

##### Workspace Snippet

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

http_archive(
    name = "build_bazel_rules_swift",
    sha256 = "28a66ff5d97500f0304f4e8945d936fe0584e0d5b7a6f83258298007a93190ba",
    url = "https://github.com/bazelbuild/rules_swift/releases/download/1.13.0/rules_swift.1.13.0.tar.gz",
)

load(
    "@&#8203;build_bazel_rules_swift//swift:repositories.bzl",
    "swift_rules_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 this update
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:eyJjcmVhdGVkSW5WZXIiOiIzNy4xOS4yIiwidXBkYXRlZEluVmVyIjoiMzcuMTkuMiIsInRhcmdldEJyYW5jaCI6Im1haW4ifQ==-->

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
cgrindel-self-hosted-renovate bot referenced this pull request in cgrindel/rules_swift_package_manager Oct 20, 2023
This PR contains the following updates:

| Package | Type | Update | Change |
|---|---|---|---|
| [build_bazel_rules_swift](https://togithub.com/bazelbuild/rules_swift)
| http_archive | minor | `1.12.0` -> `1.13.0` |

---

### Release Notes

<details>
<summary>bazelbuild/rules_swift (build_bazel_rules_swift)</summary>

###
[`v1.13.0`](https://togithub.com/bazelbuild/rules_swift/releases/tag/1.13.0)

[Compare
Source](https://togithub.com/bazelbuild/rules_swift/compare/1.12.0...1.13.0)

##### What's Changed

- Fixed "name 'visibility' is not defined" error on Bazel 5 by
[@&#8203;jesses-canva](https://togithub.com/jesses-canva) in
[https://github.com/bazelbuild/rules_swift/pull/1117](https://togithub.com/bazelbuild/rules_swift/pull/1117)
- Limited `--cxxopt='-std=c++14'` to Linux builds by
[@&#8203;thii](https://togithub.com/thii) in
[https://github.com/bazelbuild/rules_swift/pull/1122](https://togithub.com/bazelbuild/rules_swift/pull/1122)
- Add SwiftGRPCInfo provider by
[@&#8203;AttilaTheFun](https://togithub.com/AttilaTheFun) in
[https://github.com/bazelbuild/rules_swift/pull/1121](https://togithub.com/bazelbuild/rules_swift/pull/1121)

This release is compatible with 5.x LTS, 6.x LTS, and bazel 7.x rolling
releases

##### MODULE.bazel Snippet

```bzl
bazel_dep(name = "rules_swift", version = "1.13.0", repo_name = "build_bazel_rules_swift")
```

##### Workspace Snippet

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

http_archive(
    name = "build_bazel_rules_swift",
    sha256 = "28a66ff5d97500f0304f4e8945d936fe0584e0d5b7a6f83258298007a93190ba",
    url = "https://github.com/bazelbuild/rules_swift/releases/download/1.13.0/rules_swift.1.13.0.tar.gz",
)

load(
    "@&#8203;build_bazel_rules_swift//swift:repositories.bzl",
    "swift_rules_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.

👻 **Immortal**: This PR will be recreated if closed unmerged. Get
[config help](https://togithub.com/renovatebot/renovate/discussions) if
that's undesired.

---

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

---

This PR has been generated by [Renovate
Bot](https://togithub.com/renovatebot/renovate).

<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNi4xMDAuMCIsInVwZGF0ZWRJblZlciI6IjM2LjEwMC4wIiwidGFyZ2V0QnJhbmNoIjoibWFpbiJ9-->

Co-authored-by: Self-hosted Renovate Bot <361546+cgrindel-self-hosted-renovate[bot]@users.noreply.github.enterprise.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