Skip to content

Add bzlmod support#42

Merged
srikrsna-buf merged 2 commits intobufbuild:mainfrom
aspect-forks:bzlmod
Nov 7, 2023
Merged

Add bzlmod support#42
srikrsna-buf merged 2 commits intobufbuild:mainfrom
aspect-forks:bzlmod

Conversation

@alexeagle
Copy link
Copy Markdown

Bazel modules are moving away from setup in WORKSPACE files, towards a 'package manager' called bzlmod. Such modules are published on https://registry.bazel.build and are easier for developers to consume in their Bazel projects.

@CLAassistant
Copy link
Copy Markdown

CLAassistant commented Oct 11, 2023

CLA assistant check
All committers have signed the CLA.

alexeagle pushed a commit to aspect-build/bazel-central-registry that referenced this pull request Oct 11, 2023
it comes from aspect-forks until bufbuild/rules_buf#42 is merged, hopefully for the next release
alexeagle pushed a commit to aspect-build/bazel-central-registry that referenced this pull request Oct 11, 2023
it comes from aspect-forks until bufbuild/rules_buf#42 is merged, hopefully for the next release
@alexeagle
Copy link
Copy Markdown
Author

Here's what it looks like going into the Bazel module registry: bazelbuild/bazel-central-registry#997

alexeagle pushed a commit to aspect-build/bazel-central-registry that referenced this pull request Oct 11, 2023
it comes from aspect-forks until bufbuild/rules_buf#42 is merged, hopefully for the next release
alexeagle pushed a commit to aspect-build/bazel-central-registry that referenced this pull request Oct 11, 2023
it comes from aspect-forks until bufbuild/rules_buf#42 is merged, hopefully for the next release
alexeagle pushed a commit to aspect-build/bazel-central-registry that referenced this pull request Oct 11, 2023
it comes from aspect-forks until bufbuild/rules_buf#42 is merged, hopefully for the next release
alexeagle pushed a commit to aspect-build/bazel-central-registry that referenced this pull request Oct 11, 2023
it comes from aspect-forks until bufbuild/rules_buf#42 is merged, hopefully for the next release
alexeagle pushed a commit to aspect-build/bazel-central-registry that referenced this pull request Oct 11, 2023
it comes from aspect-forks until bufbuild/rules_buf#42 is merged, hopefully for the next release
alexeagle pushed a commit to aspect-build/bazel-central-registry that referenced this pull request Oct 11, 2023
it comes from aspect-forks until bufbuild/rules_buf#42 is merged, hopefully for the next release
alexeagle pushed a commit to aspect-build/bazel-central-registry that referenced this pull request Oct 11, 2023
it comes from aspect-forks until bufbuild/rules_buf#42 is merged, hopefully for the next release
alexeagle pushed a commit to aspect-build/bazel-central-registry that referenced this pull request Oct 11, 2023
it comes from aspect-forks until bufbuild/rules_buf#42 is merged, hopefully for the next release
alexeagle pushed a commit to aspect-build/bazel-central-registry that referenced this pull request Oct 11, 2023
it comes from aspect-forks until bufbuild/rules_buf#42 is merged, hopefully for the next release
alexeagle pushed a commit to aspect-build/bazel-central-registry that referenced this pull request Oct 11, 2023
it comes from aspect-forks until bufbuild/rules_buf#42 is merged, hopefully for the next release
alexeagle pushed a commit to aspect-build/bazel-central-registry that referenced this pull request Oct 11, 2023
it comes from aspect-forks until bufbuild/rules_buf#42 is merged, hopefully for the next release
alexeagle pushed a commit to aspect-build/bazel-central-registry that referenced this pull request Oct 11, 2023
it comes from aspect-forks until bufbuild/rules_buf#42 is merged, hopefully for the next release
alexeagle pushed a commit to aspect-build/bazel-central-registry that referenced this pull request Oct 11, 2023
it comes from aspect-forks until bufbuild/rules_buf#42 is merged, hopefully for the next release
alexeagle pushed a commit to bazelbuild/bazel-central-registry that referenced this pull request Oct 11, 2023
it comes from aspect-forks until bufbuild/rules_buf#42 is merged, hopefully for the next release
@srikrsna-buf srikrsna-buf changed the title feat: support bzlmod Add bzlmod support Oct 12, 2023
@srikrsna-buf
Copy link
Copy Markdown
Member

Thank you so much for this PR! Could you also add an example of using the buf_dependencies repo rule?

@srikrsna-buf
Copy link
Copy Markdown
Member

Closes #33

@srikrsna-buf srikrsna-buf changed the title Add bzlmod support Add bzlmod support Oct 12, 2023
@alexeagle
Copy link
Copy Markdown
Author

@srikrsna-buf done

Comment thread buf/extensions.bzl
Comment thread buf/extensions.bzl
@alexeagle
Copy link
Copy Markdown
Author

Ping @srikrsna-buf

@srikrsna-buf
Copy link
Copy Markdown
Member

Was caught up with something I'll take a closer look at this today.

Copy link
Copy Markdown
Member

@srikrsna-buf srikrsna-buf left a comment

Choose a reason for hiding this comment

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

Implementation looks good to me! Thank you!

Instead of a separate example can we add module files to the existing ones? Where they can be run in both modes? At a later stage we can just delete the contents of WORKSPACE file when that is no longer supported.

Comment thread MODULE.bazel Outdated
@debkanchan
Copy link
Copy Markdown

plis merge i cri everyday

@alexeagle
Copy link
Copy Markdown
Author

I am also in emotional distress @srikrsna-buf

@srikrsna-buf
Copy link
Copy Markdown
Member

Hey @alexeagle! I am not sure if you can see this, but I reviewed it last week asking about the examples.

If you have, then don't you think we should update all the examples?

@debkanchan
Copy link
Copy Markdown

Hey @alexeagle , any update?

@srikrsna-buf
Copy link
Copy Markdown
Member

I'll merge this and take up examples in a later PR, @DebkanchanSamadder you can use modules already based on thanks to @alexeagle for using a patch: bazelbuild/bazel-central-registry#997

@srikrsna-buf
Copy link
Copy Markdown
Member

@alexeagle I don't have permission to push to the fork, could you resolve the merge conflicts? Alternatively, I've resolved conflicts and pushed it to bzlmod branch on this repo, you can push that branch to your fork

@debkanchan
Copy link
Copy Markdown

Can't seem to make it work with gazelle. Getting the following error
error loading package '@rules_buf~0.1.1//gazelle/buf': Unable to find package for @[unknown repo 'io_bazel_rules_go' requested from @rules_buf~0.1.1]//go:def.bzl: The repository '@[unknown repo 'io_bazel_rules_go' requested from @rules_buf~0.1.1]' could not be resolved: No repository visible as '@io_bazel_rules_go' from repository '@rules_buf~0.1.1'. and referenced by '//:gazelle-buf'

here's the BUILD file

load("@gazelle//:def.bzl", "DEFAULT_LANGUAGES", "gazelle", "gazelle_binary")

gazelle_binary(
    name = "gazelle-buf",
    languages = DEFAULT_LANGUAGES + [
        # Loads the Buf extension
        "@rules_buf//gazelle/buf:buf",
        # NOTE: This needs to be loaded after the proto language
    ],
)

# gazelle:prefix github.com/ride-app/driver-service
# gazelle:build_file_name BUILD.bazel
# gazelle:exclude infra
# gazelle:proto disable_global
gazelle(
    name = "gazelle",
    gazelle = ":gazelle-buf",
)

Alex Eagle added 2 commits November 6, 2023 19:51
Bazel modules are moving away from setup in WORKSPACE files, towards a 'package manager' called bzlmod.
Such modules are published on https://registry.bazel.build and are easier for developers to consume in their Bazel projects.
@alexeagle
Copy link
Copy Markdown
Author

@srikrsna-buf I rebased it.

Sorry I forgot about your request to merge the examples. I'll do that, but I'm not sure I can get to it right away, so yeah if you're okay to merge in this state, it would help folks who are trying to turn on bzlmod with Bazel 7 right now.

@srikrsna-buf
Copy link
Copy Markdown
Member

I can merge this without the examples but was just looking at #42 (comment) to see if it works with gazelle.

@srikrsna-buf
Copy link
Copy Markdown
Member

srikrsna-buf commented Nov 7, 2023

Actually lets merge this as is, I'll take up fixing it for gazelle in a followup pr as that is not being read from here.

@srikrsna-buf srikrsna-buf merged commit 1191ce8 into bufbuild:main Nov 7, 2023
@alexeagle
Copy link
Copy Markdown
Author

@srikrsna-buf thanks, can we work on publishing a release now?

stef-geo pushed a commit to stef-geo/bazel-central-registry that referenced this pull request Jan 13, 2026
it comes from aspect-forks until bufbuild/rules_buf#42 is merged, hopefully for the next release
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.

5 participants