[kotlin] Added logging to LazyKotlinJpsPluginClasspathDownloader to log bundled JPS version

KTIJ-30704

GitOrigin-RevId: 162123fb83467dcd1aafe21ec242f69654488c96
This commit is contained in:
Frederik Haselmeier
2024-09-14 12:54:09 +00:00
committed by intellij-monorepo-bot
parent 8b6e5ebc0c
commit e0ec1044aa
2 changed files with 12 additions and 3 deletions
@@ -29,7 +29,7 @@ class SetupKotlinJpsPluginBeforeCompileTask : CompileTask {
onUnsupportedVersion = { context.addErrorWithReferenceToKotlincXml(it) }
) ?: return true
LOG.debug("Attempting to download non-bundled JPS version: $jpsVersion")
LOG.debug("Attempting to lazy download JPS version: $jpsVersion")
return KotlinArtifactsDownloader.lazyDownloadMissingJpsPluginDependencies(
project = project,
@@ -1,6 +1,7 @@
// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package org.jetbrains.kotlin.idea.compiler.configuration
import com.intellij.openapi.diagnostic.logger
import com.intellij.openapi.progress.ProgressIndicator
import com.intellij.openapi.project.Project
import org.jetbrains.kotlin.idea.base.plugin.KotlinBasePluginBundle
@@ -11,6 +12,8 @@ import java.io.File
private val VERSION_UNTIL_OLD_FAT_JAR_IS_AVAILABLE = IdeKotlinVersion.get("1.7.20")
private val LOG = logger<LazyKotlinJpsPluginClasspathDownloader>()
class LazyKotlinJpsPluginClasspathDownloader(private val version: String) :
LazyFileOutputProducer<Unit, LazyKotlinJpsPluginClasspathDownloader.Context> {
@@ -40,14 +43,20 @@ class LazyKotlinJpsPluginClasspathDownloader(private val version: String) :
?: emptyList()
}
fun getDownloadedIfUpToDateOrEmpty() =
if (IdeKotlinVersion.get(version).isStandaloneCompilerVersion) {
fun getDownloadedIfUpToDateOrEmpty(): List<File> {
LOG.debug("Requested download for version $version")
LOG.debug("Found standalone compiler version ${KotlinPluginLayout.standaloneCompilerVersion}")
return if (IdeKotlinVersion.get(version).isStandaloneCompilerVersion) {
LOG.debug("Using standalone compiler version ${KotlinPluginLayout.standaloneCompilerVersion}")
KotlinPluginLayout.jpsPluginClasspath
} else {
LOG.debug("Starting download for version $version")
newDownloader.getDownloadedIfUpToDateOrEmpty().takeIf { it.isNotEmpty() }
?: oldDownloader?.getDownloadedIfUpToDateOrEmpty()
?: emptyList()
}
}
fun lazyDownload(computationContext: Context) = lazyProduceOutput(Unit, computationContext)