diff --git a/CHANGELOG b/CHANGELOG index d2be93aa8b1..f51b1a7bca1 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,10 @@ +v2024.11.19.0.4 +=============== +Fixes: +* fix: Kotlin toolchain detection (#7122) +* fix: reading of _kt_toolchain attribute (#7115) +* fix: Sync failure after non-fatal bazel failure (#7119) + v2024.11.19.0.3 =============== Fixes: diff --git a/aspect/intellij_info_impl.bzl b/aspect/intellij_info_impl.bzl index 817455b3322..19fd46e40c7 100644 --- a/aspect/intellij_info_impl.bzl +++ b/aspect/intellij_info_impl.bzl @@ -1117,17 +1117,21 @@ def collect_java_toolchain_info(target, ide_info, ide_info_file, output_groups): def artifact_to_path(artifact): return artifact.root_execution_path_fragment + "/" + artifact.relative_path -def collect_kotlin_toolchain_info(target, ide_info, ide_info_file, output_groups): +def collect_kotlin_toolchain_info(target, ctx, ide_info, ide_info_file, output_groups): """Updates kotlin_toolchain-relevant output groups, returns false if not a kotlin_toolchain target.""" - if not hasattr(target, "kt"): + if ctx.rule.kind == "_kt_toolchain" and platform_common.ToolchainInfo in target: + kt = target[platform_common.ToolchainInfo] + elif hasattr(target, "kt") and hasattr(target.kt, "language_version"): + kt = target.kt # Legacy struct provider mechanism + else: return False - kt = target.kt + if not hasattr(kt, "language_version"): return False ide_info["kt_toolchain_ide_info"] = struct( language_version = kt.language_version, ) - update_sync_output_groups(output_groups, "intellij-info-kotlin", depset([ide_info_file])) + update_sync_output_groups(output_groups, "intellij-info-kt", depset([ide_info_file])) return True def _is_proto_library_wrapper(target, ctx): @@ -1293,7 +1297,7 @@ def intellij_info_aspect_impl(target, ctx, semantics): handled = collect_java_info(target, ctx, semantics, ide_info, ide_info_file, output_groups) or handled handled = collect_java_toolchain_info(target, ide_info, ide_info_file, output_groups) or handled handled = collect_android_info(target, ctx, semantics, ide_info, ide_info_file, output_groups) or handled - handled = collect_kotlin_toolchain_info(target, ide_info, ide_info_file, output_groups) or handled + handled = collect_kotlin_toolchain_info(target, ctx, ide_info, ide_info_file, output_groups) or handled # Any extra ide info if hasattr(semantics, "extra_ide_info"): diff --git a/base/src/com/google/idea/blaze/base/buildview/BazelExecService.kt b/base/src/com/google/idea/blaze/base/buildview/BazelExecService.kt index a90063629f9..d171624078a 100644 --- a/base/src/com/google/idea/blaze/base/buildview/BazelExecService.kt +++ b/base/src/com/google/idea/blaze/base/buildview/BazelExecService.kt @@ -170,7 +170,7 @@ class BazelExecService(private val project: Project) : Disposable { parseJob.cancelAndJoin() - if (result.status != BuildResult.Status.SUCCESS) { + if (result.status == BuildResult.Status.FATAL_ERROR) { BlazeBuildOutputs.noOutputs(result) } else { BlazeBuildOutputs.fromParsedBepOutput(result, provider.getBuildOutput()) diff --git a/kotlin/src/com/google/idea/blaze/kotlin/KotlinBlazeRules.java b/kotlin/src/com/google/idea/blaze/kotlin/KotlinBlazeRules.java index fafbb827e57..7306900e46e 100644 --- a/kotlin/src/com/google/idea/blaze/kotlin/KotlinBlazeRules.java +++ b/kotlin/src/com/google/idea/blaze/kotlin/KotlinBlazeRules.java @@ -31,6 +31,8 @@ public final class KotlinBlazeRules implements Kind.Provider { /** Kotlin-specific blaze rule types. */ public enum RuleTypes { + KT_TOOLCHAIN("_kt_toolchain", LanguageClass.KOTLIN, RuleType.UNKNOWN), + KT_TOOLCHAIN_ALIAS("_kt_toolchain_alias", LanguageClass.KOTLIN, RuleType.UNKNOWN), KT_JVM_TOOLCHAIN("kt_jvm_toolchain", LanguageClass.KOTLIN, RuleType.UNKNOWN), // TODO(b/157683101): remove once https://youtrack.jetbrains.com/issue/KT-24309 is fixed KT_JVM_LIBRARY_HELPER("kt_jvm_library_helper", LanguageClass.KOTLIN, RuleType.LIBRARY),