From 70b227de4712bf5e11adb10a2096c053f2e32bcc Mon Sep 17 00:00:00 2001 From: Ivo List Date: Fri, 29 Sep 2023 22:39:21 +0200 Subject: [PATCH] Cleanup JavaPluginInfo --- kotlin/internal/defs.bzl | 4 ---- kotlin/internal/jvm/impl.bzl | 7 ++----- kotlin/internal/jvm/plugins.bzl | 13 ++++++------- 3 files changed, 8 insertions(+), 16 deletions(-) diff --git a/kotlin/internal/defs.bzl b/kotlin/internal/defs.bzl index 0a1819834..eb91aaa9e 100644 --- a/kotlin/internal/defs.bzl +++ b/kotlin/internal/defs.bzl @@ -11,7 +11,6 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License.# -load("@rules_java//java:defs.bzl", "java_common") # The Kotlin Toolchain type. TOOLCHAIN_TYPE = "%s" % Label("//kotlin/internal:kt_toolchain_type") @@ -20,9 +19,6 @@ TOOLCHAIN_TYPE = "%s" % Label("//kotlin/internal:kt_toolchain_type") JAVA_TOOLCHAIN_TYPE = "@bazel_tools//tools/jdk:toolchain_type" JAVA_RUNTIME_TOOLCHAIN_TYPE = "@bazel_tools//tools/jdk:runtime_toolchain_type" -# Upstream provider for Java plugins -JavaPluginInfo = getattr(java_common, "JavaPluginInfo") - # The name of the Kotlin compiler workspace. KT_COMPILER_REPO = "com_github_jetbrains_kotlin" diff --git a/kotlin/internal/jvm/impl.bzl b/kotlin/internal/jvm/impl.bzl index 3b0a01708..3e0307788 100644 --- a/kotlin/internal/jvm/impl.bzl +++ b/kotlin/internal/jvm/impl.bzl @@ -11,7 +11,7 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. -load("@rules_java//java:defs.bzl", "JavaInfo", "java_common") +load("@rules_java//java:defs.bzl", "JavaInfo", "java_common", "JavaPluginInfo") load( "//kotlin/internal/jvm:compile.bzl", "export_only_providers", @@ -19,7 +19,6 @@ load( ) load( "//kotlin/internal:defs.bzl", - _JavaPluginInfo = "JavaPluginInfo", _KspPluginInfo = "KspPluginInfo", _KtCompilerPluginInfo = "KtCompilerPluginInfo", _KtJvmInfo = "KtJvmInfo", @@ -422,15 +421,13 @@ def kt_compiler_plugin_impl(ctx): ] def kt_ksp_plugin_impl(ctx): - _JavaPluginInfo = getattr(java_common, "JavaPluginInfo") - info = java_common.merge([dep[JavaInfo] for dep in ctx.attr.deps]) classpath = depset(info.runtime_output_jars, transitive = [info.transitive_runtime_jars]) return [ DefaultInfo(files = classpath), _KspPluginInfo(plugins = [ - _JavaPluginInfo( + JavaPluginInfo( runtime_deps = [ info, ], diff --git a/kotlin/internal/jvm/plugins.bzl b/kotlin/internal/jvm/plugins.bzl index 100532578..71c44026e 100644 --- a/kotlin/internal/jvm/plugins.bzl +++ b/kotlin/internal/jvm/plugins.bzl @@ -11,10 +11,9 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. -load("@rules_java//java:defs.bzl", "JavaInfo") +load("@rules_java//java:defs.bzl", "JavaInfo", "JavaPluginInfo") load( "//kotlin/internal:defs.bzl", - _JavaPluginInfo = "JavaPluginInfo", _KspPluginInfo = "KspPluginInfo", ) @@ -32,8 +31,8 @@ def _targets_to_annotation_processors(targets): if _KspPluginInfo in targets: # KSP plugins are handled by the KSP Kotlinc compiler plugin pass - elif _JavaPluginInfo in t: - p = t[_JavaPluginInfo].plugins + elif JavaPluginInfo in t: + p = t[JavaPluginInfo].plugins if p.processor_jars: plugins.append(p) elif JavaInfo in t: @@ -51,13 +50,13 @@ def _targets_to_ksp_annotation_processors(targets): return depset(plugins) def _targets_to_annotation_processors_java_plugin_info(targets): - return [t[_JavaPluginInfo] for t in targets if _JavaPluginInfo in t] + return [t[JavaPluginInfo] for t in targets if JavaPluginInfo in t] def _targets_to_transitive_runtime_jars(targets): transitive = [] for t in targets: - if _JavaPluginInfo in t: - transitive.append(t[_JavaPluginInfo].plugins.processor_jars) + if JavaPluginInfo in t: + transitive.append(t[JavaPluginInfo].plugins.processor_jars) elif JavaInfo in t: transitive.append(t[JavaInfo].plugins.processor_jars) elif _KspPluginInfo in t: