diff --git a/MODULE.bazel b/MODULE.bazel index fc9d609f65ce..1fbe5c3d0acc 100644 --- a/MODULE.bazel +++ b/MODULE.bazel @@ -24,7 +24,7 @@ bazel_dep(name = "bazel_skylib", version = "1.8.1") bazel_dep(name = "abseil-cpp", version = "20240116.1", repo_name = "absl") bazel_dep(name = "nlohmann_json", version = "3.11.3", repo_name = "json") bazel_dep(name = "fmt", version = "12.1.0-codeql.1") -bazel_dep(name = "rules_kotlin", version = "2.1.3-codeql.1") +bazel_dep(name = "rules_kotlin", version = "2.2.0-codeql.1") bazel_dep(name = "gazelle", version = "0.40.0") bazel_dep(name = "rules_dotnet", version = "0.19.2-codeql.1") bazel_dep(name = "googletest", version = "1.14.0.bcr.1") @@ -221,10 +221,6 @@ use_repo( kotlin_extractor_deps, "codeql_kotlin_defaults", "codeql_kotlin_embeddable", - "kotlin-compiler-1.6.0", - "kotlin-compiler-1.6.20", - "kotlin-compiler-1.7.0", - "kotlin-compiler-1.7.20", "kotlin-compiler-1.8.0", "kotlin-compiler-1.9.0-Beta", "kotlin-compiler-1.9.20-Beta", @@ -234,10 +230,7 @@ use_repo( "kotlin-compiler-2.1.20-Beta1", "kotlin-compiler-2.2.0-Beta1", "kotlin-compiler-2.2.20-Beta2", - "kotlin-compiler-embeddable-1.6.0", - "kotlin-compiler-embeddable-1.6.20", - "kotlin-compiler-embeddable-1.7.0", - "kotlin-compiler-embeddable-1.7.20", + "kotlin-compiler-2.3.0-Beta2", "kotlin-compiler-embeddable-1.8.0", "kotlin-compiler-embeddable-1.9.0-Beta", "kotlin-compiler-embeddable-1.9.20-Beta", @@ -247,10 +240,7 @@ use_repo( "kotlin-compiler-embeddable-2.1.20-Beta1", "kotlin-compiler-embeddable-2.2.0-Beta1", "kotlin-compiler-embeddable-2.2.20-Beta2", - "kotlin-stdlib-1.6.0", - "kotlin-stdlib-1.6.20", - "kotlin-stdlib-1.7.0", - "kotlin-stdlib-1.7.20", + "kotlin-compiler-embeddable-2.3.0-Beta2", "kotlin-stdlib-1.8.0", "kotlin-stdlib-1.9.0-Beta", "kotlin-stdlib-1.9.20-Beta", @@ -260,6 +250,7 @@ use_repo( "kotlin-stdlib-2.1.20-Beta1", "kotlin-stdlib-2.2.0-Beta1", "kotlin-stdlib-2.2.20-Beta2", + "kotlin-stdlib-2.3.0-Beta2", ) go_sdk = use_extension("@rules_go//go:extensions.bzl", "go_sdk") diff --git a/java/kotlin-extractor/BUILD.bazel b/java/kotlin-extractor/BUILD.bazel index a714e06d4111..665155d49f2e 100644 --- a/java/kotlin-extractor/BUILD.bazel +++ b/java/kotlin-extractor/BUILD.bazel @@ -124,13 +124,6 @@ kt_javac_options( javac_opts = ":javac-options", kotlinc_opts = ":kotlinc-options-%s" % v, module_name = "codeql-kotlin-extractor", - # resource_strip_prefix is very nit-picky: the following makes it work from - # `codeql`, `@codeql_kotlin_embeddable` and `semmle-code` - resource_strip_prefix = ( - ("../%s/" % repo_name() if repo_name() else "") + - ("%s/" % package_name() if package_name() else "") + - v - ), resources = [ ":resources-%s" % v, ], diff --git a/java/kotlin-extractor/deps/kotlin-compiler-1.6.0.jar b/java/kotlin-extractor/deps/kotlin-compiler-1.6.0.jar deleted file mode 100644 index 4a98879e43e6..000000000000 --- a/java/kotlin-extractor/deps/kotlin-compiler-1.6.0.jar +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:4bd7a92568fd89c23b7f9f36d4380886beed18d3d54ea6adf49bebae627db805 -size 51408858 diff --git a/java/kotlin-extractor/deps/kotlin-compiler-1.6.20.jar b/java/kotlin-extractor/deps/kotlin-compiler-1.6.20.jar deleted file mode 100644 index 5a467a5af518..000000000000 --- a/java/kotlin-extractor/deps/kotlin-compiler-1.6.20.jar +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:90567c5cf297985d028fa39aa3a7904dc8096173e1c7f3d3f35fe7074581098e -size 53370229 diff --git a/java/kotlin-extractor/deps/kotlin-compiler-1.7.0.jar b/java/kotlin-extractor/deps/kotlin-compiler-1.7.0.jar deleted file mode 100644 index ef54ce1e6532..000000000000 --- a/java/kotlin-extractor/deps/kotlin-compiler-1.7.0.jar +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:ce85fafb3e24712d62a0d02d277c2d56197d74afdd4f5ca995eaf33d2c504663 -size 53906809 diff --git a/java/kotlin-extractor/deps/kotlin-compiler-1.7.20.jar b/java/kotlin-extractor/deps/kotlin-compiler-1.7.20.jar deleted file mode 100644 index 442aea3e3425..000000000000 --- a/java/kotlin-extractor/deps/kotlin-compiler-1.7.20.jar +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:0e36d98c56f7c9685ab9d9e1fac9be36a5214939adb3f905b93c62de76023618 -size 54773087 diff --git a/java/kotlin-extractor/deps/kotlin-compiler-2.3.0-Beta2.jar b/java/kotlin-extractor/deps/kotlin-compiler-2.3.0-Beta2.jar new file mode 100644 index 000000000000..81c85be01074 --- /dev/null +++ b/java/kotlin-extractor/deps/kotlin-compiler-2.3.0-Beta2.jar @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:6ed7d52fa82ae3837e63b6f110a8e25ef807c773c1597f93fb3a1e509e2624c6 +size 59087152 diff --git a/java/kotlin-extractor/deps/kotlin-compiler-embeddable-1.6.0.jar b/java/kotlin-extractor/deps/kotlin-compiler-embeddable-1.6.0.jar deleted file mode 100644 index eafb6508d449..000000000000 --- a/java/kotlin-extractor/deps/kotlin-compiler-embeddable-1.6.0.jar +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:0366843cd2defdd583c6b16b10bc32b85f28c5bf9510f10e44c886f5bd24c388 -size 49978431 diff --git a/java/kotlin-extractor/deps/kotlin-compiler-embeddable-1.6.20.jar b/java/kotlin-extractor/deps/kotlin-compiler-embeddable-1.6.20.jar deleted file mode 100644 index f426dae65b1e..000000000000 --- a/java/kotlin-extractor/deps/kotlin-compiler-embeddable-1.6.20.jar +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:be634faaafb56816b6ef6d583e57ab33e4d6e5180cde2f505ccf7d45dc738ef8 -size 51976423 diff --git a/java/kotlin-extractor/deps/kotlin-compiler-embeddable-1.7.0.jar b/java/kotlin-extractor/deps/kotlin-compiler-embeddable-1.7.0.jar deleted file mode 100644 index 0857bed8c9e1..000000000000 --- a/java/kotlin-extractor/deps/kotlin-compiler-embeddable-1.7.0.jar +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:573935b492e65b93a792eaa6270295532f580cd4f26f9f6eb105ecbafcd182d4 -size 52514265 diff --git a/java/kotlin-extractor/deps/kotlin-compiler-embeddable-1.7.20.jar b/java/kotlin-extractor/deps/kotlin-compiler-embeddable-1.7.20.jar deleted file mode 100644 index b95097b6935e..000000000000 --- a/java/kotlin-extractor/deps/kotlin-compiler-embeddable-1.7.20.jar +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:5ec2be1872dc47b9dcb466f1781eded6c59d9eee18657d4b0f1148e619caea36 -size 53395419 diff --git a/java/kotlin-extractor/deps/kotlin-compiler-embeddable-2.3.0-Beta2.jar b/java/kotlin-extractor/deps/kotlin-compiler-embeddable-2.3.0-Beta2.jar new file mode 100644 index 000000000000..aa1aed82c11f --- /dev/null +++ b/java/kotlin-extractor/deps/kotlin-compiler-embeddable-2.3.0-Beta2.jar @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:d66c146d383a7b8463cb1a0fc9bbff9b0db0b136a465730a338f1fc2bf160f1c +size 57665679 diff --git a/java/kotlin-extractor/deps/kotlin-stdlib-1.6.0.jar b/java/kotlin-extractor/deps/kotlin-stdlib-1.6.0.jar deleted file mode 100644 index 3ad56eecdc2d..000000000000 --- a/java/kotlin-extractor/deps/kotlin-stdlib-1.6.0.jar +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:115daea30b0d484afcf2360237b9d9537f48a4a2f03f3cc2a16577dfc6e90342 -size 1508076 diff --git a/java/kotlin-extractor/deps/kotlin-stdlib-1.6.20.jar b/java/kotlin-extractor/deps/kotlin-stdlib-1.6.20.jar deleted file mode 100644 index b170c1da738b..000000000000 --- a/java/kotlin-extractor/deps/kotlin-stdlib-1.6.20.jar +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:eeb51c2b67b26233fd81d0bc4f8044ec849718890905763ceffd84a31e2cb799 -size 1509405 diff --git a/java/kotlin-extractor/deps/kotlin-stdlib-1.7.0.jar b/java/kotlin-extractor/deps/kotlin-stdlib-1.7.0.jar deleted file mode 100644 index bed18f8429b7..000000000000 --- a/java/kotlin-extractor/deps/kotlin-stdlib-1.7.0.jar +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:aa88e9625577957f3249a46cb6e166ee09b369e600f7a11d148d16b0a6d87f05 -size 1524619 diff --git a/java/kotlin-extractor/deps/kotlin-stdlib-1.7.20.jar b/java/kotlin-extractor/deps/kotlin-stdlib-1.7.20.jar deleted file mode 100644 index 9998f1e65920..000000000000 --- a/java/kotlin-extractor/deps/kotlin-stdlib-1.7.20.jar +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:7779ec96b9acbf92ca023858ac04543f9d2c3bdf1722425fff42f25ff3acfc9b -size 1537347 diff --git a/java/kotlin-extractor/deps/kotlin-stdlib-2.3.0-Beta2.jar b/java/kotlin-extractor/deps/kotlin-stdlib-2.3.0-Beta2.jar new file mode 100644 index 000000000000..e0151662ad5b --- /dev/null +++ b/java/kotlin-extractor/deps/kotlin-stdlib-2.3.0-Beta2.jar @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:fb35d6a1bf6df0a5a4e78307c92885f63878a53499cc2800f0ba706e527ab615 +size 1796815 diff --git a/java/kotlin-extractor/src/main/kotlin/KotlinFileExtractor.kt b/java/kotlin-extractor/src/main/kotlin/KotlinFileExtractor.kt index 72c766bb0828..af8015fa4573 100644 --- a/java/kotlin-extractor/src/main/kotlin/KotlinFileExtractor.kt +++ b/java/kotlin-extractor/src/main/kotlin/KotlinFileExtractor.kt @@ -415,6 +415,7 @@ open class KotlinFileExtractor( private fun extractClassModifiers(c: IrClass, id: Label) { with("class modifiers", c) { + @Suppress("REDUNDANT_ELSE_IN_WHEN") when (c.modality) { Modality.FINAL -> addModifiers(id, "final") Modality.SEALED -> addModifiers(id, "sealed") @@ -1644,7 +1645,7 @@ open class KotlinFileExtractor( extractMethodAndParameterTypeAccesses: Boolean, typeSubstitution: TypeSubstitution?, classTypeArgsIncludingOuterClasses: List? - ) = + ) : Label = forceExtractFunction( f, parentId, @@ -2801,6 +2802,7 @@ open class KotlinFileExtractor( private fun extractBody(b: IrBody, callable: Label) { with("body", b) { + @Suppress("REDUNDANT_ELSE_IN_WHEN") when (b) { is IrBlockBody -> extractBlockBody(b, callable) is IrSyntheticBody -> extractSyntheticBody(b, callable) @@ -2973,12 +2975,22 @@ open class KotlinFileExtractor( val locId = tw.getLocation(s) tw.writeStmts_block(blockId, parent, idx, callable) tw.writeHasLocation(blockId, locId) - extractVariable(s.delegate, callable, blockId, 0) + // For Kotlin < 2.3, s.delegate is not-nullable. Cast to a be nullable, + // as a workaround to silence warnings for kotlin < 2.3 about the elvis + // operator being redundant. + // For Kotlin >= 2.3, the cast is redundant, so we need to silence that warning + + @Suppress("USELESS_CAST") + val delegate = (s.delegate as IrVariable?) ?: run { + logger.errorElement("Local delegated property is missing delegate", s) + return + } + extractVariable(delegate, callable, blockId, 0) val propId = tw.getFreshIdLabel() tw.writeKtProperties(propId, s.name.asString()) tw.writeHasLocation(propId, locId) - tw.writeKtPropertyDelegates(propId, useVariable(s.delegate)) + tw.writeKtPropertyDelegates(propId, useVariable(delegate)) // Getter: extractStatement(s.getter, callable, blockId, 1) diff --git a/java/kotlin-extractor/src/main/kotlin/KotlinUsesExtractor.kt b/java/kotlin-extractor/src/main/kotlin/KotlinUsesExtractor.kt index 83cbec771fc5..ba38ac1da373 100644 --- a/java/kotlin-extractor/src/main/kotlin/KotlinUsesExtractor.kt +++ b/java/kotlin-extractor/src/main/kotlin/KotlinUsesExtractor.kt @@ -849,9 +849,6 @@ open class KotlinUsesExtractor( } private fun useSimpleType(s: IrSimpleType, context: TypeContext): TypeResults { - if (s.abbreviation != null) { - // TODO: Extract this information - } // We use this when we don't actually have an IrClass for a class // we want to refer to // TODO: Eliminate the need for this if possible @@ -1836,6 +1833,7 @@ open class KotlinUsesExtractor( // Note this function doesn't return a signature because type arguments are never // incorporated into function signatures. + @Suppress("REDUNDANT_ELSE_IN_WHEN") return when (arg) { is IrStarProjection -> { val anyTypeLabel = diff --git a/java/kotlin-extractor/src/main/kotlin/utils/TypeSubstitution.kt b/java/kotlin-extractor/src/main/kotlin/utils/TypeSubstitution.kt index fb39b6675759..f4eac03df9d0 100644 --- a/java/kotlin-extractor/src/main/kotlin/utils/TypeSubstitution.kt +++ b/java/kotlin-extractor/src/main/kotlin/utils/TypeSubstitution.kt @@ -111,6 +111,7 @@ private fun subProjectedType( } ?: makeTypeProjection(t.substituteTypeArguments(substitutionMap), outerVariance) private fun IrTypeArgument.upperBound(context: IrPluginContext) = + @Suppress("REDUNDANT_ELSE_IN_WHEN") when (this) { is IrStarProjection -> context.irBuiltIns.anyNType is IrTypeProjection -> @@ -125,6 +126,7 @@ private fun IrTypeArgument.upperBound(context: IrPluginContext) = } private fun IrTypeArgument.lowerBound(context: IrPluginContext) = + @Suppress("REDUNDANT_ELSE_IN_WHEN") when (this) { is IrStarProjection -> context.irBuiltIns.nothingType is IrTypeProjection -> @@ -209,6 +211,7 @@ fun IrClass.toRawType(): IrType { } fun IrTypeArgument.withQuestionMark(b: Boolean): IrTypeArgument = + @Suppress("REDUNDANT_ELSE_IN_WHEN") when (this) { is IrStarProjection -> this is IrTypeProjection -> diff --git a/java/kotlin-extractor/src/main/kotlin/utils/versions/v_2_3_0-Beta2/Kotlin2ComponentRegistrar.kt b/java/kotlin-extractor/src/main/kotlin/utils/versions/v_2_3_0-Beta2/Kotlin2ComponentRegistrar.kt new file mode 100644 index 000000000000..e20c45ddc4d4 --- /dev/null +++ b/java/kotlin-extractor/src/main/kotlin/utils/versions/v_2_3_0-Beta2/Kotlin2ComponentRegistrar.kt @@ -0,0 +1,13 @@ +// For ComponentRegistrar +@file:Suppress("DEPRECATION", "DEPRECATION_ERROR") + +package com.github.codeql + +import org.jetbrains.kotlin.compiler.plugin.ComponentRegistrar +import org.jetbrains.kotlin.compiler.plugin.ExperimentalCompilerApi + +@OptIn(ExperimentalCompilerApi::class) +abstract class Kotlin2ComponentRegistrar : ComponentRegistrar { + override val supportsK2: Boolean + get() = true +} diff --git a/java/kotlin-extractor/src/main/kotlin/utils/versions/v_2_3_0-Beta2/getJvmModuleNameForDeserializedDescriptor.kt b/java/kotlin-extractor/src/main/kotlin/utils/versions/v_2_3_0-Beta2/getJvmModuleNameForDeserializedDescriptor.kt new file mode 100644 index 000000000000..21da983e40ed --- /dev/null +++ b/java/kotlin-extractor/src/main/kotlin/utils/versions/v_2_3_0-Beta2/getJvmModuleNameForDeserializedDescriptor.kt @@ -0,0 +1,31 @@ +package com.github.codeql.utils.versions + +import org.jetbrains.kotlin.descriptors.* +import org.jetbrains.kotlin.load.kotlin.JvmPackagePartSource +import org.jetbrains.kotlin.metadata.deserialization.* +import org.jetbrains.kotlin.metadata.jvm.deserialization.* +import org.jetbrains.kotlin.metadata.jvm.JvmProtoBuf +import org.jetbrains.kotlin.resolve.DescriptorUtils.* +import org.jetbrains.kotlin.serialization.deserialization.descriptors.* + +fun getJvmModuleNameForDeserializedDescriptor(descriptor: CallableMemberDescriptor): String? { + val parent = getParentOfType(descriptor, ClassOrPackageFragmentDescriptor::class.java, false) + + when { + parent is DeserializedClassDescriptor -> { + val classProto = parent.classProto + val nameResolver = parent.c.nameResolver + return classProto.getExtensionOrNull(JvmProtoBuf.classModuleName) + ?.let(nameResolver::getString) + ?: JvmProtoBufUtil.DEFAULT_MODULE_NAME + } + descriptor is DeserializedMemberDescriptor -> { + val source = descriptor.containerSource + if (source is JvmPackagePartSource) { + return source.moduleName + } + } + } + + return null +} diff --git a/java/kotlin-extractor/versions.bzl b/java/kotlin-extractor/versions.bzl index 95897f49cc81..b7ae04934e17 100644 --- a/java/kotlin-extractor/versions.bzl +++ b/java/kotlin-extractor/versions.bzl @@ -1,9 +1,5 @@ # when updating this list, `bazel mod tidy` should be run from `codeql` to update `MODULE.bazel` VERSIONS = [ - "1.6.0", - "1.6.20", - "1.7.0", - "1.7.20", "1.8.0", "1.9.0-Beta", "1.9.20-Beta", @@ -13,6 +9,7 @@ VERSIONS = [ "2.1.20-Beta1", "2.2.0-Beta1", "2.2.20-Beta2", + "2.3.0-Beta2", ] def _version_to_tuple(v): diff --git a/misc/bazel/registry/modules/rules_kotlin/2.1.3-codeql.1/source.json b/misc/bazel/registry/modules/rules_kotlin/2.1.3-codeql.1/source.json deleted file mode 100644 index 8abac8eb4bd1..000000000000 --- a/misc/bazel/registry/modules/rules_kotlin/2.1.3-codeql.1/source.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "integrity": "sha256-4USKVrJGJAeyaI3qht9cN1s2oJkb1HjC3dlMlxaBJeI=", - "url": "https://github.com/bazelbuild/rules_kotlin/releases/download/v2.1.3/rules_kotlin-v2.1.3.tar.gz", - "patches": { - "codeql_do_not_emit_jdeps.patch": "sha256-1ir4Aio1SICxnj1wafQ0GefT/m7bwn2n+SQwq19V3A8=", - "codeql_add_language_version_option.patch": "sha256-F7RthnrO6kJlCNcQ76L1Utqll2OwyeFZ/HmT82NwgB4=" - }, - "patch_strip": 1 -} diff --git a/misc/bazel/registry/modules/rules_kotlin/2.1.3-codeql.1/MODULE.bazel b/misc/bazel/registry/modules/rules_kotlin/2.2.0-codeql.1/MODULE.bazel similarity index 54% rename from misc/bazel/registry/modules/rules_kotlin/2.1.3-codeql.1/MODULE.bazel rename to misc/bazel/registry/modules/rules_kotlin/2.2.0-codeql.1/MODULE.bazel index 41bef52cf9f6..df66ce2051ab 100644 --- a/misc/bazel/registry/modules/rules_kotlin/2.1.3-codeql.1/MODULE.bazel +++ b/misc/bazel/registry/modules/rules_kotlin/2.2.0-codeql.1/MODULE.bazel @@ -1,6 +1,6 @@ module( name = "rules_kotlin", - version = "2.1.3-codeql.1", + version = "2.2.0-codeql.1", compatibility_level = 1, repo_name = "rules_kotlin", ) @@ -8,9 +8,15 @@ module( bazel_dep(name = "platforms", version = "0.0.11") bazel_dep(name = "bazel_skylib", version = "1.7.1") 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") -bazel_dep(name = "rules_android", version = "0.1.1") +bazel_dep(name = "rules_android", version = "0.6.4") +bazel_dep(name = "bazel_features", version = "1.25.0") +bazel_dep(name = "protobuf", version = "29.0", repo_name = "com_google_protobuf") +bazel_dep(name = "rules_proto", version = "6.0.2", repo_name = "rules_proto") +bazel_dep(name = "abseil-py", version = "2.1.0", repo_name = "py_absl") +bazel_dep(name = "rules_cc", version = "0.0.16") + +rules_java_toolchains = use_extension("@rules_java//java:extensions.bzl", "toolchains") +use_repo(rules_java_toolchains, "remote_java_tools") rules_kotlin_extensions = use_extension( "//src/main/starlark/core/repositories:bzlmod_setup.bzl", @@ -21,15 +27,10 @@ use_repo( "com_github_google_ksp", "com_github_jetbrains_kotlin", "com_github_pinterest_ktlint", + "kotlin_build_tools_impl", "kotlinx_serialization_core_jvm", "kotlinx_serialization_json", "kotlinx_serialization_json_jvm", ) 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") diff --git a/misc/bazel/registry/modules/rules_kotlin/2.1.3-codeql.1/patches/codeql_add_language_version_option.patch b/misc/bazel/registry/modules/rules_kotlin/2.2.0-codeql.1/patches/codeql_add_language_version_option.patch similarity index 58% rename from misc/bazel/registry/modules/rules_kotlin/2.1.3-codeql.1/patches/codeql_add_language_version_option.patch rename to misc/bazel/registry/modules/rules_kotlin/2.2.0-codeql.1/patches/codeql_add_language_version_option.patch index b0bf85d4faef..795d1f88f387 100644 --- a/misc/bazel/registry/modules/rules_kotlin/2.1.3-codeql.1/patches/codeql_add_language_version_option.patch +++ b/misc/bazel/registry/modules/rules_kotlin/2.2.0-codeql.1/patches/codeql_add_language_version_option.patch @@ -1,22 +1,20 @@ -diff --git a/src/main/starlark/core/options/opts.kotlinc.bzl b/src/main/starlark/core/options/opts.kotlinc.bzl -index 76df826..ef2d6ca 100644 ---- a/src/main/starlark/core/options/opts.kotlinc.bzl -+++ b/src/main/starlark/core/options/opts.kotlinc.bzl -@@ -33,6 +33,11 @@ def _map_jdk_release_to_flag(version): +--- a/src/main/starlark/core/options/opts.kotlinc.bzl 2000-01-01 01:00:00.000000000 +0100 ++++ b/src/main/starlark/core/options/opts.kotlinc.bzl 2025-11-17 16:51:01.012063056 +0100 +@@ -51,6 +51,11 @@ return None return ["-Xjdk-release=%s" % version] - + +def _map_language_version_to_flag(version): + if not version: + return None + return ["-language-version=%s" % version, "-api-version=%s" % version] + _KOPTS_ALL = { - "warn": struct( + "include_stdlibs": struct( args = dict( -@@ -429,6 +434,15 @@ _KOPTS_ALL = { +@@ -495,6 +500,15 @@ value_to_flag = None, - map_value_to_flag = _map_jdk_release_to_flag, + map_value_to_flag = _map_warning_level, ), + "language_version": struct( + args = dict( @@ -28,5 +26,5 @@ index 76df826..ef2d6ca 100644 + map_value_to_flag = _map_language_version_to_flag, + ), } - + def _merge(key, rule_defined): diff --git a/misc/bazel/registry/modules/rules_kotlin/2.1.3-codeql.1/patches/codeql_do_not_emit_jdeps.patch b/misc/bazel/registry/modules/rules_kotlin/2.2.0-codeql.1/patches/codeql_do_not_emit_jdeps.patch similarity index 81% rename from misc/bazel/registry/modules/rules_kotlin/2.1.3-codeql.1/patches/codeql_do_not_emit_jdeps.patch rename to misc/bazel/registry/modules/rules_kotlin/2.2.0-codeql.1/patches/codeql_do_not_emit_jdeps.patch index 380c837d06a4..e6b71ab0c4f5 100644 --- a/misc/bazel/registry/modules/rules_kotlin/2.1.3-codeql.1/patches/codeql_do_not_emit_jdeps.patch +++ b/misc/bazel/registry/modules/rules_kotlin/2.2.0-codeql.1/patches/codeql_do_not_emit_jdeps.patch @@ -1,11 +1,9 @@ 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`. -diff --git a/kotlin/settings/BUILD.bazel b/kotlin/settings/BUILD.bazel -index 2c93c11..f352b80 100644 --- a/kotlin/settings/BUILD.bazel +++ b/kotlin/settings/BUILD.bazel -@@ -25,7 +25,7 @@ release_archive( +@@ -16,6 +16,6 @@ release_archive( # Flag that controls the emission of jdeps files during kotlin jvm compilation. bool_flag( name = "jvm_emit_jdeps", @@ -13,4 +11,4 @@ index 2c93c11..f352b80 100644 + build_setting_default = False, visibility = ["//visibility:public"], ) - + diff --git a/misc/bazel/registry/modules/rules_kotlin/2.2.0-codeql.1/source.json b/misc/bazel/registry/modules/rules_kotlin/2.2.0-codeql.1/source.json new file mode 100644 index 000000000000..bfa243b5a22e --- /dev/null +++ b/misc/bazel/registry/modules/rules_kotlin/2.2.0-codeql.1/source.json @@ -0,0 +1,9 @@ +{ + "integrity": "sha256-4STROYYIW8ChW+LIXBQVurVwhEK3jSSf4iv430OlNA0=", + "url": "https://github.com/bazelbuild/rules_kotlin/releases/download/v2.2.0/rules_kotlin-v2.2.0.tar.gz", + "patches": { + "codeql_do_not_emit_jdeps.patch": "sha256-gIlhXEY71vlCkpr5wj2vm3yv6RwcuKLhgbTGqdVvQfU=", + "codeql_add_language_version_option.patch": "sha256-HoH8NWXxmYHmm/SxaugRdXgMntvcQx5gRLW2yQIvWhM=" + }, + "patch_strip": 1 +} diff --git a/misc/bazel/registry/modules/rules_kotlin/metadata.json b/misc/bazel/registry/modules/rules_kotlin/metadata.json index dace87c72d1c..3609865f4d5b 100644 --- a/misc/bazel/registry/modules/rules_kotlin/metadata.json +++ b/misc/bazel/registry/modules/rules_kotlin/metadata.json @@ -21,7 +21,7 @@ "github:bazelbuild/rules_kotlin" ], "versions": [ - "2.1.3-codeql.1" + "2.2.0-codeql.1", ], "yanked_versions": {} }