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 bzlmod #902

Closed
wants to merge 6 commits into from
Closed

Support bzlmod #902

wants to merge 6 commits into from

Conversation

comius
Copy link
Contributor

@comius comius commented Dec 22, 2022

This is a merge of following PRs:

And 3 more simple commits that enable bzlmod for rules_kotlin.

Before this is merged, Kotlin compiler should be released on bazel-central-registry and in PR MODULE.bazel should use it.

Only trivial example is supported so far. Others examples should be added as well.

Fixes: #660

Move Kotlin specific targets (like `kt_jvm_import`) from `BUILD.com_github_jetbrains_kotlin` to `//kotlin/compiler`.

This will make it possible to release `kotlin-compiler` module on `bazel-central-registry` without depending on `rules_kotlin`. The release will contain the new form `BUILD.com_github_jetbrains_kotlin` which doesn't depend on `rules_kotlin`.

RELNOTES[INC]: This breaks users that depend on `@com_github_jetbrains_kotlin//:*` targets. The same targets can be found under  `@io_bazel_rules_kotlin//kotlin/compiler:*`.

It's not possible to add an `alias` to `@com_github_jetbrains_kotlin` repository, becuase it would already create a dependency on `rules_kotlin` repository in the bzlmod world.

Technically it's possible to release 2 bzlmod modules that have a circular dependency. But this might create some unexpected problems. It addition it would be harder to convince `com_github_jetbrains_kotlin` owners to depend on `rules_kotlin`.

Works toward: bazelbuild#660
Add `capabilities.bzl` to Kotlin compiler repository. Generate `kt_kotlinc_options` rule from it, that is filter out options that are not available in a specific version.

This change makes a narrow interface between Kotlin compiler and Kotlin rules. It will make it possible to release and use new versions of Kotlin compiler independently from Kotlin rules.

The release of Kotlin compiler should include the new `capabilities.bzl` file.

The `capabilities.bzl` files were generated by grepping respective version of Kotlin compiler sources for `@Argument` annotation (some of them are not documented). The `legacy` file was generated from Kotlin compiler 1.3.0 additionally removing options that weren't available in `src/legacy`.

There are some minor differences from previous `src/legacy` - javac opts are the same for versions.

Works toward: bazelbuild#660
@Bencodes Bencodes mentioned this pull request Aug 11, 2023
@Bencodes Bencodes added the bzlmod label Sep 7, 2023
@Bencodes Bencodes closed this Sep 18, 2023
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.

Release rules_kotlin as a Bazel module
2 participants