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 support for Bzlmod #1006

Merged
merged 27 commits into from
Sep 15, 2023
Merged

Add support for Bzlmod #1006

merged 27 commits into from
Sep 15, 2023

Conversation

Bencodes
Copy link
Collaborator

@Bencodes Bencodes commented Aug 11, 2023

Adding support for Bzlmod now that Android is unblocked. What's included in this PR:

  • The initial first pass at Bzlmod support
  • Updated the examples/trivial example to use Bzlmod with a
  • We've aligned the repository namespace with the Github repository name. Once this is released to the Bazel central registry you can import this as a bzlmod dep by doing: bazel_dep(name = "rules_java", version = "...") with a local_path_override. It's worth noting that this does not yet exercise the release binary that we distribute for releases.
  • Enables Bzlmod by default for rules_kotlin (excluding the examples)

This PR is largely based on the work that @comius did in #902.

#660

.bazelversion Outdated
@@ -1 +1 @@
6.1.1
7.0.0-pre.20230724.1
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Note: I don't think we actually need to be using the latest rolling release here.

@dkthezero
Copy link

@Bencodes This means after merging this PR I can set up a Kotlin project with Bzlmod like?

bazel_dep(name = "rules_kotlin", version = "x")

Currently, I finding a way to work around with io_bazel_rules_kotlin in MODULE.bzl but not work

@Bencodes
Copy link
Collaborator Author

@dkthezero yes it would.

@Bencodes
Copy link
Collaborator Author

Bencodes commented Sep 5, 2023

The bulk of the pre-work has been pulled out into this PR so that we can review it independently.

@Bencodes Bencodes added the bzlmod label Sep 7, 2023
MODULE.bazel Outdated
@@ -0,0 +1,71 @@
module(
name = "io_bazel_rules_kotlin",
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you call this just "rules_kotlin"? This is what gets exported to BCR: https://github.com/bazelbuild/bazel-central-registry/tree/main/modules

So "io_bazel_" prefix would be a precedent.

"repo_name = " attribute controls how this can be used, that is what you need in the load statements and as dependencies.

)

bazel_dep(name = "rules_java", version = "6.4.0")
bazel_dep(name = "io_bazel_rules_kotlin")
Copy link
Contributor

Choose a reason for hiding this comment

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

Should be rules_kotlin with optional repo_name="io_bazel_rules_kotlin".

@comius
Copy link
Contributor

comius commented Sep 11, 2023

Thanks for your effort!

@@ -1,3 +1,5 @@
common --enable_bzlmod=true
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Enabling Bzlmod by default for rules_kotlin

bazel_dep(name = "bazel_skylib", version = "1.3.0")
bazel_dep(name = "rules_java", version = "6.4.0")
bazel_dep(name = "rules_python", version = "0.24.0")
bazel_dep(name = "rules_cc", version = "0.0.8")
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

rules_cc is needed for the remote execution configs.

)

def _extra_repositories():
# TODO(bencodes) This really needs to be a development dependency
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Left a TODO here to move this out into a development dependency. I'll do another pass once this is merged to get these dependencies into better shape so that we can do a production-ready release of rules_kotlin.

@Bencodes Bencodes merged commit dc98c15 into master Sep 15, 2023
3 checks passed
@Bencodes Bencodes deleted the add-support-for-bzlmod branch September 15, 2023 22:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants