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 bzlmod support #42

Merged
merged 2 commits into from
Nov 7, 2023
Merged

Add bzlmod support #42

merged 2 commits into from
Nov 7, 2023

Conversation

alexeagle
Copy link
Contributor

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

CLAassistant commented Oct 11, 2023

CLA assistant check
All committers have signed the CLA.

alexeagle added 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 added 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
Contributor Author

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

alexeagle added 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 added 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 added 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 added 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 added 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 added 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 added 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 added 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 added 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 added 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 added 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 added 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 added 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 added 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
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
Member

Closes #33

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

@srikrsna-buf done

@alexeagle
Copy link
Contributor Author

Ping @srikrsna-buf

@srikrsna-buf
Copy link
Member

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

Copy link
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.

MODULE.bazel Outdated Show resolved Hide resolved
@debkanchan
Copy link

plis merge i cri everyday

@alexeagle
Copy link
Contributor Author

I am also in emotional distress @srikrsna-buf

@srikrsna-buf
Copy link
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

Hey @alexeagle , any update?

@srikrsna-buf
Copy link
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
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

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",
)

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
Contributor 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
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
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
5 checks passed
@alexeagle
Copy link
Contributor Author

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

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