0

I try migrating from Maven to Bazel and want to use another (newer) version of kotlinc than the standard default.

I have started from the example given on https://github.com/bazelbuild/rules_kotlin#custom-kotlinc-distribution-and-version:

load("@io_bazel_rules_kotlin//kotlin:repositories.bzl", "kotlin_repositories", "kotlinc_version")
kotlin_repositories(
    compiler_release = kotlinc_version(
        release = "1.6.21", # just the numeric version
        sha256 = "632166fed89f3f430482f5aa07f2e20b923b72ef688c8f5a7df3aa1502c6d8ba"
    )
)

However, the link and the example explain only the syntax. It is nice that the Bazel configuration is so concise, but on the downside it is hard to see what the effect of this rule is.

How can I know/verify what binary for kotlinc will be download and where from? Can I figure out which other kotlinc releases are available, and more importantly, what the correct sha256 should be?

(Since this seems to be an official part of Bazel (loading from @io_bazel…), maybe there is a public directory (like https://mvnrepository.com/ for mvn, https://www.npmjs.com/ for npm, etc.) to check?)

Christian Fuchs
  • 430
  • 3
  • 9
  • It will [download](https://github.com/bazelbuild/rules_kotlin/releases) from the different release versions you mention in your workspace file . You can see the SHA256 of each release and release notes explaining the different support issues and features which are included. – SG_Bazel Oct 10 '22 at 08:56
  • @SG_Bazel thanks, but it seems that applies for rules_kotlin, not for kotlinc? (also the hash '632166fed8…' from the example does not appear on that page); I have rephrased my question a bit, that point was not fully clear. – Christian Fuchs Oct 10 '22 at 09:25

1 Answers1

0

Both the hash and the download location for the kotlinc that are apparently used by Bazel kotlin_rule can currently be found on GitHub:

https://github.com/JetBrains/kotlin/releases

  • hash for each release is printed at the end of the respective release note, next to kotlin-compiler-*.zip
  • download URL follows under "Asset", which for older releases may be collapsed (not immediately visible)

(as for the last part of the question: a unified directory for dependencies (artifacts, plugins, toolchains) seems to be unfeasible for a general-purpose build automation tool such as Bazel; it works for specific-purpose tools like Maven, NPM and so on; but all these ecosystems use quite different approaches and conventions, its probably too much hassle to provide that in a unified way for a system like Bazel; at least some of these bounded ecosystems already started to provide configuration snippets for Bazel)

Christian Fuchs
  • 430
  • 3
  • 9