Bazel: move patching of rules_kotlin to a registry override

This commit is contained in:
Paolo Tranquilli
2024-04-09 18:03:41 +02:00
parent c9565b3657
commit 5bdd724221
9 changed files with 78 additions and 8 deletions

View File

@@ -14,5 +14,8 @@ build:linux --cxxopt=-std=c++20
build:macos --cxxopt=-std=c++20 --cpu=darwin_x86_64
build:windows --cxxopt=/std:c++20 --cxxopt=/Zc:preprocessor
common --registry=file://%workspace%/misc/bazel/override_registry
common --registry=https://bcr.bazel.build
import %workspace%/.bazelrc.exported
try-import %workspace%/local.bazelrc

View File

@@ -21,14 +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")
# we patch `rules_kotlin` to allow passing `-language-version` at a jvm_kt_library level
single_version_override(
module_name = "rules_kotlin",
patch_strip = 1,
patches = ["//java/kotlin-extractor:rules_kotlin.patch"],
)
bazel_dep(name = "rules_kotlin", version = "1.9.4-patched")
pip = use_extension("@rules_python//python/extensions:pip.bzl", "pip")
pip.parse(

View File

@@ -0,0 +1,8 @@
This was taken from https://github.com/bazelbuild/bazel-central-repository and readapted:
* The latest version was renamed with a `-patched` suffix
* The above rename was done also in the files:
* `modules/rules_kotlin/metadata.json`
* `module/rules_kotlin/1.9.4-patched/MODULE.bazel`
* `modules/rules_kotlin/1.9.4-patched/patches/add_language_version_option.patch` was added
* the above patch was added in `modules/rules_kotlin/1.9.4-patched/source.json`, with integrity SHAs generated via
`echo -n sha256-; cat <file> | openssl dgst -sha256 -binary | base64`.

View File

@@ -0,0 +1,3 @@
{
"mirrors": []
}

View File

@@ -0,0 +1,31 @@
module(
name = "rules_kotlin",
version = "1.9.4-patched",
repo_name = "rules_kotlin",
)
bazel_dep(name = "platforms", version = "0.0.6")
bazel_dep(name = "bazel_skylib", version = "1.4.2")
bazel_dep(name = "rules_java", version = "7.2.0")
bazel_dep(name = "rules_python", version = "0.23.1")
bazel_dep(name = "rules_cc", version = "0.0.8")
rules_kotlin_extensions = use_extension(
"//src/main/starlark/core/repositories:bzlmod_setup.bzl",
"rules_kotlin_extensions",
)
use_repo(
rules_kotlin_extensions,
"com_github_google_ksp",
"com_github_jetbrains_kotlin",
"com_github_pinterest_ktlint",
"rules_android",
)
register_toolchains("//kotlin/internal:default_toolchain")
# TODO(bencodes) We should be able to remove this once rules_android has rolled out official Bzlmod support
remote_android_extensions = use_extension("@bazel_tools//tools/android:android_extensions.bzl", "remote_android_tools_extensions")
use_repo(remote_android_extensions, "android_gmaven_r8", "android_tools")
bazel_dep(name = "rules_proto", version = "5.3.0-21.7")

View File

@@ -0,0 +1,12 @@
===================================================================
--- a/MODULE.bazel
+++ b/MODULE.bazel
@@ -1,7 +1,7 @@
module(
name = "rules_kotlin",
- version = "1.9.0",
+ version = "1.9.4",
repo_name = "rules_kotlin",
)
bazel_dep(name = "platforms", version = "0.0.6")

View File

@@ -0,0 +1,9 @@
{
"integrity": "sha256-dsD8wsI+33NjIK3tGs2d3guuQY5XMd8Skz2IbLqGt5U=",
"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-8Fu6NiXzckWm8oaVY/rPonGEqWG5ijV0r2GUf7ajKHM=",
"add_language_version_option.patch": "sha256-uF6LFpkqe9ye7+avviY1NE5ZhxJ3WMLenS+mbg4XFTM="
},
"patch_strip": 1
}

View File

@@ -0,0 +1,11 @@
{
"homepage": "https://github.com/bazelbuild/rules_kotlin",
"maintainers": [],
"repository": [
"github:bazelbuild/rules_kotlin"
],
"versions": [
"1.9.4-patched"
],
"yanked_versions": {}
}