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

Migrate to bzlmod #1743

Open
dmah42 opened this issue Jan 24, 2024 · 9 comments
Open

Migrate to bzlmod #1743

dmah42 opened this issue Jan 24, 2024 · 9 comments
Assignees

Comments

@dmah42
Copy link
Member

dmah42 commented Jan 24, 2024

https://bazel.build/external/migration#migration

it seems we've started (we have both WORKSPACE and MODULE.bazel) but not finished. we should finish it as then we'll have nice things like module_version() available to our build scripts, and can push to the bazel central repo for distribution, etc.

@dmah42 dmah42 self-assigned this Jan 24, 2024
@nicholasjng
Copy link
Contributor

I'm happy to help with the Python part, just say the word :)

@dmah42
Copy link
Member Author

dmah42 commented Jan 29, 2024

i think we're most of the way there:

$  ~/dev/bazel-central-registry/tools/migrate_to_bzlmod.py -t //test/...
INFO: Executing command: bazel --version
bazel 7.0.2
INFO: Detected original workspace name: com_github_google_benchmark
INFO: Generating ./resolved_deps.py file
INFO: Executing command: bazel clean --expunge
INFO: Executing command: bazel build --nobuild --experimental_repository_resolved_file=resolved_deps.py //test/...
INFO: Found 42 external repositories in the ./resolved_deps.py file.
INFO: Executing command: bazel build --nobuild --enable_bzlmod //test/...
INFO: Congratulations! All external repositories needed for building `//test/...` are available with Bzlmod (and the WORKSPACE.bzlmod file)!
INFO: Things you should do next:
INFO:   - Migrate remaining dependencies in the WORKSPACE.bzlmod file to Bzlmod.
INFO:   - Run the actual build with Bzlmod enabled (with --enable_bzlmod, but without --nobuild) and fix remaining build time issues.
~/dev/bazel-central-registry/tools/migrate_to_bzlmod.py -t //tools/...
INFO: Executing command: bazel --version
bazel 7.0.2
INFO: Detected original workspace name: com_github_google_benchmark
INFO: Found existing ./resolved_deps.py file, if it's out of date, please add `--force/-f` flag to force update it.
INFO: Found 42 external repositories in the ./resolved_deps.py file.
INFO: Executing command: bazel build --nobuild --enable_bzlmod //tools/...
INFO: Congratulations! All external repositories needed for building `//tools/...` are available with Bzlmod (and the WORKSPACE.bzlmod file)!
INFO: Things you should do next:
INFO:   - Migrate remaining dependencies in the WORKSPACE.bzlmod file to Bzlmod.
INFO:   - Run the actual build with Bzlmod enabled (with --enable_bzlmod, but without --nobuild) and fix remaining build time issues.

what isn't clear from https://bazel.build/external/migration#migration is what to do now we can build with bzlmod enabled.

dmah42 added a commit that referenced this issue Jan 29, 2024
@dmah42
Copy link
Member Author

dmah42 commented Jan 29, 2024

https://github.com/bazel-contrib/publish-to-bcr may be the next step.

@dmah42
Copy link
Member Author

dmah42 commented Jan 29, 2024

@mmorel-35
Copy link

Have you considered using the BCR bot to automatically update in BCR after each new release ?

https://github.com/bazelbuild/bazel-central-registry/tree/main/docs#bazel-central-registry-bcr-contribution-guidelines

@dmah42
Copy link
Member Author

dmah42 commented Mar 25, 2024

i haven't but i'm happy to. anything that makes this process easier :)

patches welcome!

@mmorel-35
Copy link

That is something only maintainers can do through https://github.com/apps/publish-to-bcr

@dmah42
Copy link
Member Author

dmah42 commented Mar 25, 2024

given this repo is owned by a company that have a large number of projects, i fail to see how this could possibly work. having the ruleset and BCR fork under my personal github is unmaintainable, and having it under google as a whole would cause issues when multiple projects want to use it.

unless i'm failing to understand how this works. it seems like a ... not great solution in terms of scaled maintenance.

@mmorel-35
Copy link

To my understanding publish to bcr is an app/bot that requires a .bcr folder in each project that needs to be published. In this folder you have some files to configure how to publish and test the project.

Based on that configuration when the project create a release it creates a new PR to BCR to publish the new version.
You don't have to enable publihs to bcr to the whole organisation but only to the concerned projects.

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

No branches or pull requests

3 participants