Skip to content
This repository was archived by the owner on Dec 3, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -74,13 +74,13 @@ internal
data class ResolvedDependenciesWithErrors(
val scriptFile: File?,
val dependencies: KotlinScriptExternalDependencies,
val exceptions: List<Exception>
val exceptions: List<String>
) : ResolverEvent()


internal
data class ResolvedToPreviousWithErrors(
val scriptFile: File?,
val dependencies: KotlinScriptExternalDependencies,
val exceptions: List<Exception>
val exceptions: List<String>
) : ResolverEvent()
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ object DefaultResolverEventLogger : ResolverEventLogger {
}

private
fun stringForExceptions(exceptions: List<Exception>, indentation: Int?) =
fun stringForExceptions(exceptions: List<String>, indentation: Int?) =
if (exceptions.isNotEmpty())
indentationStringFor(indentation).let {
exceptions.joinToString(prefix = "[\n$it\t", separator = ",\n$it\t", postfix = "]") { exception ->
Expand All @@ -217,9 +217,15 @@ object DefaultResolverEventLogger : ResolverEventLogger {

private
fun stringForException(exception: Exception, indentation: Int?) =
stringForException(
StringWriter().also { exception.printStackTrace(PrintWriter(it)) }.toString(),
indentation
)

private
fun stringForException(exception: String, indentation: Int?) =
indentationStringFor(indentation).let {
StringWriter().also { writer -> exception.printStackTrace(PrintWriter(writer)) }.toString()
.prependIndent(it)
exception.prependIndent(it)
}

private
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ class KotlinBuildScriptModelRepositoryTest {
override val sourcePath: List<File> = emptyList(),
override val implicitImports: List<String> = emptyList(),
override val editorReports: List<EditorReport> = emptyList(),
override val exceptions: List<Exception> = emptyList(),
override val exceptions: List<String> = emptyList(),
override val enclosingScriptProjectDir: File? = null
) : KotlinBuildScriptModel
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,9 @@ import org.gradle.kotlin.dsl.typeOf
import org.gradle.tooling.provider.model.ToolingModelBuilder

import java.io.File
import java.io.PrintWriter
import java.io.Serializable
import java.io.StringWriter

import java.util.*

Expand All @@ -78,7 +80,7 @@ data class StandardKotlinBuildScriptModel(
override val sourcePath: List<File>,
override val implicitImports: List<String>,
override val editorReports: List<EditorReport>,
override val exceptions: List<Exception>,
override val exceptions: List<String>,
override val enclosingScriptProjectDir: File?
) : KotlinBuildScriptModel, Serializable

Expand Down Expand Up @@ -349,7 +351,7 @@ data class KotlinScriptTargetModelBuilder(
(gradleSource() + classpathSources + accessorsClassPath.src).asFiles,
implicitImports,
buildEditorReportsFor(classPathModeExceptionCollector.exceptions),
classPathModeExceptionCollector.exceptions,
classPathModeExceptionCollector.exceptions.map(::exceptionToString),
enclosingScriptProjectDir
)
}
Expand Down Expand Up @@ -379,6 +381,10 @@ data class KotlinScriptTargetModelBuilder(
exceptions,
project.isLocationAwareEditorHintsEnabled
)

private
fun exceptionToString(exception: Exception) =
StringWriter().also { exception.printStackTrace(PrintWriter(it)) }.toString()
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ interface KotlinBuildScriptModel {
val sourcePath: List<File>
val implicitImports: List<String>
val editorReports: List<EditorReport>
val exceptions: List<Exception>
val exceptions: List<String>

/**
* The directory of the project in which the script was found.
Expand Down