Repository navigation
Bump rules_kotlin from 2.2.2-codeql.1 to 2.4.21-codeql.1 - #22950
Conversation
Carry forward CodeQL's jdeps and language/API-version customizations for the new upstream release, and fix redundant string conversions rejected by the upgraded Kotlin compiler. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
b81c919 to
86050c1
Compare
There was a problem hiding this comment.
Warning
Copilot couldn't run its full agentic review because it didn't start before the timeout. Make sure your repository has a runner available, or add a copilot-code-review.yml file specifying one with the runs-on attribute. See the docs for more details.
Copilot review overview
2 open issues
What changed in this PR
Updates the Bazel registry entry and repository module configuration for rules_kotlin to 2.4.21-codeql.1 while preserving CodeQL-specific patches and pinning the Kotlin compiler to 2.2.21 to retain support for older language/API versions used by extractors.
Changes:
- Bump
rules_kotlinmodule version in the internal registry and rootMODULE.bazel, adding akotlinc_versionpin via the module extension. - Add a new
2.4.21-codeql.1registrysource.jsonplus CodeQL patches (language/API mapping and javac warning-mode propagation behavior). - Minor extractor/build adjustments (remove redundant string conversions; add missing coroutines jar placeholder).
| File | Description |
|---|---|
| misc/bazel/registry/modules/rules_kotlin/metadata.json | Updates registry version list to 2.4.21-codeql.1. |
| misc/bazel/registry/modules/rules_kotlin/2.4.21-codeql.1/source.json | Adds new source archive + patch set for 2.4.21-codeql.1. |
| misc/bazel/registry/modules/rules_kotlin/2.4.21-codeql.1/patches/codeql_do_not_propagate_kotlin_warning_mode_to_javac.patch | Prevents Kotlin warning mode from affecting javac warnings. |
| misc/bazel/registry/modules/rules_kotlin/2.4.21-codeql.1/patches/codeql_add_language_version_option.patch | Adjusts language-version flag mapping to keep API version aligned and allow <2.0. |
| misc/bazel/registry/modules/rules_kotlin/2.2.2-codeql.1/source.json | Removes old 2.2.2-codeql.1 source.json entry. |
| misc/bazel/registry/modules/rules_kotlin/2.2.2-codeql.1/patches/codeql_do_not_emit_jdeps.patch | Tweaks patch formatting/context for the old entry. |
| misc/bazel/registry/modules/rules_kotlin/2.2.2-codeql.1/patches/codeql_add_language_version_option.patch | Removes old patch content for 2.2.2-codeql.1. |
| misc/bazel/registry/modules/rules_kotlin/2.2.2-codeql.1/MODULE.bazel | Updates module metadata/deps, but under the 2.2.2-codeql.1 directory. |
| java/kotlin-extractor/src/main/kotlin/KotlinFileExtractor.kt | Removes redundant toString() conversions for string literals. |
| java/kotlin-extractor/deps.bzl | Adds kotlinx-coroutines-core-jvm.jar to symlink list. |
| MODULE.bazel | Bumps rules_kotlin and pins Kotlin compiler to 2.2.21 via extension. |
Review effort: Lite (auto)
Format the compiler override's generated repository imports for readability and update registry links to the current bazel-contrib upstream, retaining the old repository ID as an alias. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
andersfugmann
left a comment
There was a problem hiding this comment.
LGTM. Two questions, but I dont see anything blocking, although I'm not an expert on the kotlin/bazel rules.
| - if int(version.split(".")[0]) < 2: | ||
| - fail("rules_kotlin requires language_version 2.0 or newer; got %s" % version) | ||
| - return ["-language-version=%s" % version] | ||
| + return ["-language-version=%s" % version, "-api-version=%s" % version] |
There was a problem hiding this comment.
Why do we need to add -api-version?
There was a problem hiding this comment.
This just carries over from the patch I'm updating here. See also the comment at the top of this file.
| bool_flag( | ||
| name = "jvm_emit_jdeps", | ||
| - build_setting_default = True, # Upstream default behavior | ||
| + build_setting_default = False, |
There was a problem hiding this comment.
What does build_setting_default=False do?
There was a problem hiding this comment.
Again just carries over. Note the comment at the top of this file.

I would have preferred not to do this, as we depend on Kotlin 2.2.21, which is the default with
rules_kotlin2.2.2. However, I cannot update our Abseil dependency without this, as that transitively pulls inrules_kotlin2.3.20, breaking our build.Updates
rules_kotlinto2.4.21-codeql.1and carries forward the two CodeQL-specific modifications from the 2.2.2 registry entry: the language/API version mapping and disabling jdeps emission. The registry metadata and module dependency use the matching CodeQL suffix; the archive remains pinned to upstream 2.4.21. Both patches retain standard three-line unified-diff context. No extra source-archive module-version rewrite patch is added.Pins Kotlin compiler
2.2.21through the rules_kotlin module extension to support the Kotlin 1.8 and 1.9 language/API versions still required by older extractor variants. The new rules default to Kotlin 2.4, which no longer supports those versions. The language-version patch also removes the new analysis-time restriction to language versions 2.0 and newer.The rules_kotlin patch keeps Kotlin warning settings scoped to Kotlin compilation rather than propagating them to javac. Java warnings remain visible and are not promoted to errors by Kotlin
warn = "error". The extractor build provides the compiler classpath’skotlinx-coroutines-core-jvm.jarmanifest entry. Redundant Kotlin string conversions rejected by the upgraded compiler are also removed.