Skip to content

How do define multiple Toolchains? #1206

@ed-irl

Description

@ed-irl

I would like to be able to define and use multiple Kotlin toolchains in my project, which uses bzlmod. I would like to be able to have one toolchain with strict_deps and unused_deps and one without.

This itself is a byproduct of how jvm_test_suite works. For convenience sake, since you have one shared set of test dependencies, the dependencies supplied to jvm_test_suite must consist of the common dependencies of all your tests. At the same time, some of those dependencies may also go unused (eg. test-coroutines may not be used in every test).

The declaration of multiple toolchains itself is possible via the define_kt_toolchain macro, but the macro elides the exec_compatible_with and target_compatible_with attributes of native.toolchain, which is how I think I should select the appropriate toolchain. For whatever reason, the docs discourage users from directly defining Kotlin toolchains.

Is there another way to define and select among multiple toolchains that is encouraged? If not, perhaps you have guidance on dealing with the test dependencies issue?

Thank you!

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions