Skip to content

Commit 35a2ed8

Browse files
committed
Bazel/Kotlin: patch jdep emission
1 parent a15681a commit 35a2ed8

File tree

9 files changed

+21
-9
lines changed

9 files changed

+21
-9
lines changed

.bazelrc

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,5 +17,4 @@ build:windows --cxxopt=/std:c++20 --cxxopt=/Zc:preprocessor
1717
common --registry=file://%workspace%/misc/bazel/registry
1818
common --registry=https://bcr.bazel.build
1919

20-
import %workspace%/.bazelrc.exported
2120
try-import %workspace%/local.bazelrc

.bazelrc.exported

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

MODULE.bazel

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ bazel_dep(name = "bazel_skylib", version = "1.5.0")
2121
bazel_dep(name = "abseil-cpp", version = "20240116.0", repo_name = "absl")
2222
bazel_dep(name = "nlohmann_json", version = "3.11.3", repo_name = "json")
2323
bazel_dep(name = "fmt", version = "10.0.0")
24-
bazel_dep(name = "rules_kotlin", version = "1.9.4-patched")
24+
bazel_dep(name = "rules_kotlin", version = "1.9.4-codeql.1")
2525

2626
pip = use_extension("@rules_python//python/extensions:pip.bzl", "pip")
2727
pip.parse(

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
module(
22
name = "rules_kotlin",
3-
version = "1.9.4-patched",
3+
version = "1.9.4-codeql.1",
44
repo_name = "rules_kotlin",
55
)
66

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
We need to build different extractor variants with different -language-version options, which is not allowed
2+
in current kotlin_rules
13
diff --git a/src/main/starlark/core/options/opts.kotlinc.bzl b/src/main/starlark/core/options/opts.kotlinc.bzl
24
index 9b15fb8..c0ac2cd 100644
35
--- a/src/main/starlark/core/options/opts.kotlinc.bzl
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
Emitting jdeps is broken for the 2.0.0 kotlin extractor, and we don't need those files.
2+
Patching it here rather than passing `--@rules_kotlin//kotlin/settings:jvm_emit_jdeps=false`
3+
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 @@
7+
# Flag that controls the emission of jdeps files during kotlin jvm compilation.
8+
bool_flag(
9+
name = "jvm_emit_jdeps",
10+
- build_setting_default = True, # Upstream default behavior
11+
+ build_setting_default = False,
12+
visibility = ["//visibility:public"],
13+
)
14+

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@
33
"url": "https://github.com/bazelbuild/rules_kotlin/releases/download/v1.9.4/rules_kotlin-v1.9.4.tar.gz",
44
"patches": {
55
"module_dot_bazel_version.patch": "sha256-0GnFHOv9wuuv3jFcHBSXrdo7JMFP7y66O5C4rccy5wg=",
6-
"codeql_add_language_version_option.patch": "sha256-uF6LFpkqe9ye7+avviY1NE5ZhxJ3WMLenS+mbg4XFTM="
6+
"codeql_do_not_emit_jdeps.patch": "sha256-x/HsujFlR1FGrgmbAbRZag9V4vKZZinBcs73tgRS478=",
7+
"codeql_add_language_version_option.patch": "sha256-qFpP/hIvqGzjJi0h8LAQK0UuWqwlj/oCecZYGqlMVP8="
78
},
89
"patch_strip": 1
910
}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
22
"versions": [
3-
"1.9.4-patched"
3+
"1.9.4-codeql.1"
44
]
55
}

0 commit comments

Comments
 (0)