diff --git a/kotlin/internal/BUILD b/kotlin/internal/BUILD index 2605db892..223323d20 100644 --- a/kotlin/internal/BUILD +++ b/kotlin/internal/BUILD @@ -45,5 +45,6 @@ bzl_library( "//kotlin/internal/lint", "//kotlin/internal/utils", "//src/main/starlark", + "@rules_java//java:rules", ], ) diff --git a/kotlin/internal/defs.bzl b/kotlin/internal/defs.bzl index c01558fd9..eb91aaa9e 100644 --- a/kotlin/internal/defs.bzl +++ b/kotlin/internal/defs.bzl @@ -19,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/associates.bzl b/kotlin/internal/jvm/associates.bzl index 121671c3c..1b2668a52 100644 --- a/kotlin/internal/jvm/associates.bzl +++ b/kotlin/internal/jvm/associates.bzl @@ -11,6 +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") load( "//kotlin/internal:defs.bzl", _KtJvmInfo = "KtJvmInfo", diff --git a/kotlin/internal/jvm/compile.bzl b/kotlin/internal/jvm/compile.bzl index 4ad2af49a..117c8a41a 100644 --- a/kotlin/internal/jvm/compile.bzl +++ b/kotlin/internal/jvm/compile.bzl @@ -17,6 +17,7 @@ load( # 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( "//kotlin/internal:defs.bzl", _KtCompilerPluginInfo = "KtCompilerPluginInfo", diff --git a/kotlin/internal/jvm/impl.bzl b/kotlin/internal/jvm/impl.bzl index 78116f477..4c6569829 100644 --- a/kotlin/internal/jvm/impl.bzl +++ b/kotlin/internal/jvm/impl.bzl @@ -1,6 +1,6 @@ +load("@rules_java//java:defs.bzl", "JavaInfo", "JavaPluginInfo", "java_common") load( "//kotlin/internal:defs.bzl", - _JavaPluginInfo = "JavaPluginInfo", _KspPluginInfo = "KspPluginInfo", _KtCompilerPluginInfo = "KtCompilerPluginInfo", _KtJvmInfo = "KtJvmInfo", @@ -422,15 +422,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/jvm.bzl b/kotlin/internal/jvm/jvm.bzl index ed3029c35..ea2374740 100644 --- a/kotlin/internal/jvm/jvm.bzl +++ b/kotlin/internal/jvm/jvm.bzl @@ -92,6 +92,7 @@ kt_jvm_binary( ``` """ +load("@rules_java//java:defs.bzl", "JavaInfo") load( "//kotlin/internal:defs.bzl", _JAVA_RUNTIME_TOOLCHAIN_TYPE = "JAVA_RUNTIME_TOOLCHAIN_TYPE", diff --git a/kotlin/internal/jvm/plugins.bzl b/kotlin/internal/jvm/plugins.bzl index 2fca70acc..71c44026e 100644 --- a/kotlin/internal/jvm/plugins.bzl +++ b/kotlin/internal/jvm/plugins.bzl @@ -11,9 +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", "JavaPluginInfo") load( "//kotlin/internal:defs.bzl", - _JavaPluginInfo = "JavaPluginInfo", _KspPluginInfo = "KspPluginInfo", ) @@ -31,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: @@ -50,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: diff --git a/kotlin/internal/lint/ktlint_test.bzl b/kotlin/internal/lint/ktlint_test.bzl index 7a8c5dd91..f46a71a16 100644 --- a/kotlin/internal/lint/ktlint_test.bzl +++ b/kotlin/internal/lint/ktlint_test.bzl @@ -1,3 +1,4 @@ +load("@rules_java//java:defs.bzl", "java_common") load("//kotlin/internal/utils:windows.bzl", "create_windows_native_launcher_script") load(":editorconfig.bzl", "get_editorconfig", "is_android_rules_enabled", "is_experimental_rules_enabled") load(":ktlint_config.bzl", "KtlintConfigInfo") diff --git a/kotlin/internal/toolchains.bzl b/kotlin/internal/toolchains.bzl index 40fd21de2..849957128 100644 --- a/kotlin/internal/toolchains.bzl +++ b/kotlin/internal/toolchains.bzl @@ -1,4 +1,5 @@ load("@bazel_skylib//rules:common_settings.bzl", "BuildSettingInfo") +load("@rules_java//java:defs.bzl", "JavaInfo", "java_common") load( "//kotlin/internal:defs.bzl", _KT_COMPILER_REPO = "KT_COMPILER_REPO", diff --git a/kotlin/internal/utils/generate_jvm_service.bzl b/kotlin/internal/utils/generate_jvm_service.bzl index 3d757972c..8af8c12a0 100644 --- a/kotlin/internal/utils/generate_jvm_service.bzl +++ b/kotlin/internal/utils/generate_jvm_service.bzl @@ -11,6 +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") def _generate_jvm_service_impl(ctx): """ diff --git a/third_party/jarjar.bzl b/third_party/jarjar.bzl index 8f03fdbb5..0eedc25a8 100644 --- a/third_party/jarjar.bzl +++ b/third_party/jarjar.bzl @@ -11,6 +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") def jarjar_action(actions, rules, input, output, jarjar): actions.run(