Bazel/Kotlin: patch jdep emission

This commit is contained in:
Paolo Tranquilli
2024-04-10 14:57:02 +02:00
parent a15681a181
commit 35a2ed87b6
9 changed files with 21 additions and 9 deletions

View File

@@ -17,5 +17,4 @@ build:windows --cxxopt=/std:c++20 --cxxopt=/Zc:preprocessor
common --registry=file://%workspace%/misc/bazel/registry
common --registry=https://bcr.bazel.build
import %workspace%/.bazelrc.exported
try-import %workspace%/local.bazelrc

View File

@@ -1,4 +0,0 @@
# these settings are shared between `codeql` and `semmle-code`
# emitting jdeps does not work when building the 2.0.0+ kotlin extractor
build --@rules_kotlin//kotlin/settings:jvm_emit_jdeps=false

View File

@@ -21,7 +21,7 @@ bazel_dep(name = "bazel_skylib", version = "1.5.0")
bazel_dep(name = "abseil-cpp", version = "20240116.0", repo_name = "absl")
bazel_dep(name = "nlohmann_json", version = "3.11.3", repo_name = "json")
bazel_dep(name = "fmt", version = "10.0.0")
bazel_dep(name = "rules_kotlin", version = "1.9.4-patched")
bazel_dep(name = "rules_kotlin", version = "1.9.4-codeql.1")
pip = use_extension("@rules_python//python/extensions:pip.bzl", "pip")
pip.parse(

View File

@@ -1,6 +1,6 @@
module(
name = "rules_kotlin",
version = "1.9.4-patched",
version = "1.9.4-codeql.1",
repo_name = "rules_kotlin",
)

View File

@@ -1,3 +1,5 @@
We need to build different extractor variants with different -language-version options, which is not allowed
in current kotlin_rules
diff --git a/src/main/starlark/core/options/opts.kotlinc.bzl b/src/main/starlark/core/options/opts.kotlinc.bzl
index 9b15fb8..c0ac2cd 100644
--- a/src/main/starlark/core/options/opts.kotlinc.bzl

View File

@@ -0,0 +1,14 @@
Emitting jdeps is broken for the 2.0.0 kotlin extractor, and we don't need those files.
Patching it here rather than passing `--@rules_kotlin//kotlin/settings:jvm_emit_jdeps=false`
allows us to not have to specify that option (and therefore pull in `rules_kotlin`) in `semmle-code`.
--- a/kotlin/settings/BUILD.bazel 2000-01-01 01:00:00.000000000 +0100
+++ b/kotlin/settings/BUILD.bazel 2024-04-10 14:51:16.060085986 +0200
@@ -16,7 +16,7 @@
# Flag that controls the emission of jdeps files during kotlin jvm compilation.
bool_flag(
name = "jvm_emit_jdeps",
- build_setting_default = True, # Upstream default behavior
+ build_setting_default = False,
visibility = ["//visibility:public"],
)

View File

@@ -3,7 +3,8 @@
"url": "https://github.com/bazelbuild/rules_kotlin/releases/download/v1.9.4/rules_kotlin-v1.9.4.tar.gz",
"patches": {
"module_dot_bazel_version.patch": "sha256-0GnFHOv9wuuv3jFcHBSXrdo7JMFP7y66O5C4rccy5wg=",
"codeql_add_language_version_option.patch": "sha256-uF6LFpkqe9ye7+avviY1NE5ZhxJ3WMLenS+mbg4XFTM="
"codeql_do_not_emit_jdeps.patch": "sha256-x/HsujFlR1FGrgmbAbRZag9V4vKZZinBcs73tgRS478=",
"codeql_add_language_version_option.patch": "sha256-qFpP/hIvqGzjJi0h8LAQK0UuWqwlj/oCecZYGqlMVP8="
},
"patch_strip": 1
}

View File

@@ -1,5 +1,5 @@
{
"versions": [
"1.9.4-patched"
"1.9.4-codeql.1"
]
}