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

Support gazelle in bzlmod #46

Merged
merged 1 commit into from
Nov 9, 2023
Merged

Support gazelle in bzlmod #46

merged 1 commit into from
Nov 9, 2023

Conversation

srikrsna-buf
Copy link
Member

@srikrsna-buf srikrsna-buf commented Nov 9, 2023

Support gazelle in bzlmod. #42 added support for bzlmod but it did not support the gazelle plugin, this updates the module file to support gazelle.

@srikrsna-buf srikrsna-buf requested a review from Alfus November 9, 2023 13:41
@Geethree
Copy link

Geethree commented Nov 9, 2023

Oh yeah! I want this =)

@srikrsna-buf srikrsna-buf merged commit 906e911 into main Nov 9, 2023
6 checks passed
@srikrsna-buf srikrsna-buf deleted the sk/bzlmod branch November 9, 2023 17:31
@Geethree
Copy link

Geethree commented Nov 9, 2023

Any chance we can get a new patch release out? ;)

@srikrsna-buf
Copy link
Member Author

@Geethree Yes, I'd like get some cleanup work before I tag a release (mainly update deps). Should be soon

@debkanchan
Copy link

@srikrsna-buf any updates on release? This has been a blocker for weeks for us

@srikrsna-buf
Copy link
Member Author

@srikrsna-buf any updates on release? This has been a blocker for weeks for us

After #48 is merged, I have to update the docs and then we can cut a release. In the meantime you can use the git_override

@debkanchan
Copy link

@srikrsna-buf I'm trying to follow the example but I'm getting the following error

ERROR: Analysis of target '//internal/api-handlers:api-handlers_test' failed; build aborted: module extension "buf" from "@rules_buf~override//buf:extensions.bzl" does not generate repository "buf_deps", yet it is imported as "buf_deps" in the usage at /Users/debkanchan/Code/ride/backend/driver-service/MODULE.bazel:15:20

MODULE.bazel

bazel_dep(name = "rules_go", version = "0.42.0")
bazel_dep(name = "gazelle", version = "0.34.0")
bazel_dep(name = "rules_pkg", version = "0.9.1")
bazel_dep(name = "rules_buf", version = "0.1.1")
bazel_dep(name = "rules_proto", version = "5.3.0-21.7")
bazel_dep(name = "rules_oci", version = "1.4.0")
bazel_dep(name = "container_structure_test", version = "1.16.0")

git_override(
    module_name = "rules_buf",
    commit = "ade38fc",
    remote = "https://github.com/bufbuild/rules_buf.git",
)

buf = use_extension("@rules_buf//buf:extensions.bzl", "buf")

# Override the default version of buf
buf.toolchains(version = "v1.27.0")

# Allow references to labels under @buf_deps
use_repo(buf, "buf_deps")

go_deps = use_extension("@gazelle//:extensions.bzl", "go_deps")
go_deps.from_file(go_mod = "//:go.mod")
use_repo(go_deps, "build_buf_gen_go_bufbuild_protovalidate_protocolbuffers_go", "build_buf_gen_go_ride_wallet_connectrpc_go", "build_buf_gen_go_ride_wallet_protocolbuffers_go", "com_connectrpc_connect", "com_github_bufbuild_protovalidate_go", "com_github_golang_jwt_jwt_v5", "com_github_google_wire", "com_github_ilyakaznacheev_cleanenv", "com_github_micahparks_keyfunc_v2", "com_github_mmcloughlin_geohash", "com_github_onsi_ginkgo_v2", "com_github_onsi_gomega", "com_google_cloud_go_firestore", "com_google_firebase_go_v4", "org_golang_google_genproto", "org_golang_google_genproto_googleapis_api", "org_golang_google_grpc", "org_golang_google_protobuf", "org_golang_x_net", "org_uber_go_mock", "org_uber_go_zap")

oci = use_extension("@rules_oci//oci:extensions.bzl", "oci")
oci.pull(
    name = "distroless",
    digest = "sha256:e7e79fb2947f38ce0fab6061733f7e1959c12b843079042fe13f56ca7b9d178c",
    image = "gcr.io/distroless/static",
    platforms = [
        "linux/amd64",
        "linux/arm64/v8",
    ],
)
use_repo(oci, "distroless")

@srikrsna-buf
Copy link
Member Author

@DebkanchanSamadder If you don't need to use buf.dependency like in the example no need to call use_repo(buf, "buf_deps")

@debkanchan
Copy link

There's an existing issue with cel naming convention which is causing build with bzlmod to fail when using protovalidate. Any bzlmod specific workaround @srikrsna-buf ?

@srikrsna-buf
Copy link
Member Author

@DebkanchanSamadder Maybe a better place to open the issue is the protovalidate repo? Also could you give a reproducible example? Maybe the module file?

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.

4 participants