Skip to content

Commit 396bf93

Browse files
authored
Merge pull request github#17716 from github/criemen/rules-kotlin-2.0.0
Upgrade rules_kotlin to 2.0.0.
2 parents 4df9cd8 + 4de0fef commit 396bf93

File tree

7 files changed

+32
-26
lines changed

7 files changed

+32
-26
lines changed

MODULE.bazel

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ bazel_dep(name = "bazel_skylib", version = "1.6.1")
2323
bazel_dep(name = "abseil-cpp", version = "20240116.0", repo_name = "absl")
2424
bazel_dep(name = "nlohmann_json", version = "3.11.3", repo_name = "json")
2525
bazel_dep(name = "fmt", version = "10.0.0")
26-
bazel_dep(name = "rules_kotlin", version = "1.9.4-codeql.1")
26+
bazel_dep(name = "rules_kotlin", version = "2.0.0-codeql.1")
2727
bazel_dep(name = "gazelle", version = "0.38.0")
2828
bazel_dep(name = "rules_dotnet", version = "0.15.1")
2929
bazel_dep(name = "googletest", version = "1.14.0.bcr.1")

misc/bazel/registry/modules/rules_kotlin/1.9.4-codeql.1/source.json

Lines changed: 0 additions & 9 deletions
This file was deleted.

misc/bazel/registry/modules/rules_kotlin/1.9.4-codeql.1/MODULE.bazel renamed to misc/bazel/registry/modules/rules_kotlin/2.0.0-codeql.1/MODULE.bazel

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,16 @@
11
module(
22
name = "rules_kotlin",
3-
version = "1.9.4-codeql.1",
3+
version = "2.0.0-codeql.1",
4+
compatibility_level = 1,
45
repo_name = "rules_kotlin",
56
)
67

7-
bazel_dep(name = "platforms", version = "0.0.6")
8-
bazel_dep(name = "bazel_skylib", version = "1.4.2")
8+
bazel_dep(name = "platforms", version = "0.0.10")
9+
bazel_dep(name = "bazel_skylib", version = "1.7.1")
910
bazel_dep(name = "rules_java", version = "7.2.0")
1011
bazel_dep(name = "rules_python", version = "0.23.1")
1112
bazel_dep(name = "rules_cc", version = "0.0.8")
13+
bazel_dep(name = "rules_android", version = "0.1.1")
1214

1315
rules_kotlin_extensions = use_extension(
1416
"//src/main/starlark/core/repositories:bzlmod_setup.bzl",
@@ -19,7 +21,9 @@ use_repo(
1921
"com_github_google_ksp",
2022
"com_github_jetbrains_kotlin",
2123
"com_github_pinterest_ktlint",
22-
"rules_android",
24+
"kotlinx_serialization_core_jvm",
25+
"kotlinx_serialization_json",
26+
"kotlinx_serialization_json_jvm",
2327
)
2428

2529
register_toolchains("//kotlin/internal:default_toolchain")
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
We need to build different extractor variants with different -language-version options, which is not allowed
22
in current kotlin_rules
33
diff --git a/src/main/starlark/core/options/opts.kotlinc.bzl b/src/main/starlark/core/options/opts.kotlinc.bzl
4-
index 9b15fb8..c0ac2cd 100644
4+
index 5e1461b..b93e6aa 100644
55
--- a/src/main/starlark/core/options/opts.kotlinc.bzl
66
+++ b/src/main/starlark/core/options/opts.kotlinc.bzl
7-
@@ -28,6 +28,11 @@ def _map_jvm_target_to_flag(version):
7+
@@ -33,6 +33,11 @@ def _map_jdk_release_to_flag(version):
88
return None
9-
return ["-jvm-target=%s" % version]
10-
9+
return ["-Xjdk-release=%s" % version]
10+
1111
+def _map_language_version_to_flag(version):
1212
+ if not version:
1313
+ return None
@@ -16,9 +16,9 @@ index 9b15fb8..c0ac2cd 100644
1616
_KOPTS_ALL = {
1717
"warn": struct(
1818
args = dict(
19-
@@ -349,6 +354,15 @@ _KOPTS_ALL = {
19+
@@ -417,6 +422,15 @@ _KOPTS_ALL = {
2020
value_to_flag = None,
21-
map_value_to_flag = _map_jvm_target_to_flag,
21+
map_value_to_flag = _map_jdk_release_to_flag,
2222
),
2323
+ "language_version": struct(
2424
+ args = dict(
@@ -30,5 +30,5 @@ index 9b15fb8..c0ac2cd 100644
3030
+ map_value_to_flag = _map_language_version_to_flag,
3131
+ ),
3232
}
33-
34-
# Filters out options that are not available in current compiler release
33+
34+
# Filters out options that are not available in current compiler release

misc/bazel/registry/modules/rules_kotlin/1.9.4-codeql.1/patches/codeql_do_not_emit_jdeps.patch renamed to misc/bazel/registry/modules/rules_kotlin/2.0.0-codeql.1/patches/codeql_do_not_emit_jdeps.patch

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
Emitting jdeps is broken for the 2.0.0 kotlin extractor, and we don't need those files.
22
Patching it here rather than passing `--@rules_kotlin//kotlin/settings:jvm_emit_jdeps=false`
33
allows us to not have to specify that option (and therefore pull in `rules_kotlin`) in `semmle-code`.
4-
--- a/kotlin/settings/BUILD.bazel 2000-01-01 01:00:00.000000000 +0100
5-
+++ b/kotlin/settings/BUILD.bazel 2024-04-10 14:51:16.060085986 +0200
6-
@@ -16,7 +16,7 @@
4+
diff --git a/kotlin/settings/BUILD.bazel b/kotlin/settings/BUILD.bazel
5+
index 2c93c11..f352b80 100644
6+
--- a/kotlin/settings/BUILD.bazel
7+
+++ b/kotlin/settings/BUILD.bazel
8+
@@ -25,7 +25,7 @@ release_archive(
79
# Flag that controls the emission of jdeps files during kotlin jvm compilation.
810
bool_flag(
911
name = "jvm_emit_jdeps",
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"integrity": "sha256-2JcjzJ67t72y66yhr30jg+B0YVZDz5ejZrdYp2t9xEM=",
3+
"url": "https://github.com/bazelbuild/rules_kotlin/releases/download/v2.0.0/rules_kotlin-v2.0.0.tar.gz",
4+
"patches": {
5+
"codeql_do_not_emit_jdeps.patch": "sha256-1ir4Aio1SICxnj1wafQ0GefT/m7bwn2n+SQwq19V3A8=",
6+
"codeql_add_language_version_option.patch": "sha256-t8Fm0bYZ4Q4vTqcoXZjyK4WPEoAafjE4whJLNnrnRbg="
7+
},
8+
"patch_strip": 1
9+
}

misc/bazel/registry/modules/rules_kotlin/metadata.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
"github:bazelbuild/rules_kotlin"
2222
],
2323
"versions": [
24-
"1.9.4-codeql.1"
24+
"2.0.0-codeql.1"
2525
],
2626
"yanked_versions": {}
2727
}

0 commit comments

Comments
 (0)