[Gradle] Introduce KotlinToolingDiagnostics.DependencyDoesNotPhysicallyExist
Instead of silently ignoring the non-existing classpath entries, emit a warning to indicate possible project misconfiguration. ^KT-62101 Fixed
This commit is contained in:
committed by
Space Team
parent
5d98758645
commit
c2e0c8b2e9
+4
-1
@@ -6,6 +6,7 @@
|
||||
package org.jetbrains.kotlin.gradle
|
||||
|
||||
import org.gradle.util.GradleVersion
|
||||
import org.jetbrains.kotlin.gradle.plugin.diagnostics.KotlinToolingDiagnostics
|
||||
import org.jetbrains.kotlin.gradle.testbase.*
|
||||
import org.junit.jupiter.api.DisplayName
|
||||
|
||||
@@ -26,7 +27,9 @@ class GeneralClasspathSnapshotIT : KGPBaseTest() {
|
||||
}
|
||||
""".trimIndent()
|
||||
)
|
||||
build("compileKotlin")
|
||||
build("compileKotlin") {
|
||||
assertHasDiagnostic(KotlinToolingDiagnostics.DependencyDoesNotPhysicallyExist)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+4
-1
@@ -71,7 +71,10 @@ abstract class BuildToolsApiClasspathEntrySnapshotTransform : TransformAction<Bu
|
||||
checkVersionConsistency()
|
||||
}
|
||||
val classpathEntryInputDirOrJar = inputArtifact.get().asFile
|
||||
if (!classpathEntryInputDirOrJar.exists()) return
|
||||
if (!classpathEntryInputDirOrJar.exists()) {
|
||||
reportDiagnostic(KotlinToolingDiagnostics.DependencyDoesNotPhysicallyExist(classpathEntryInputDirOrJar))
|
||||
return
|
||||
}
|
||||
|
||||
val snapshotOutputFile = outputs.file(classpathEntryInputDirOrJar.name.replace('.', '_') + "-snapshot.bin")
|
||||
|
||||
|
||||
+10
@@ -21,6 +21,7 @@ import org.jetbrains.kotlin.gradle.plugin.PropertiesProvider.PropertyNames.KOTLI
|
||||
import org.jetbrains.kotlin.gradle.plugin.diagnostics.ToolingDiagnostic.Severity.*
|
||||
import org.jetbrains.kotlin.gradle.plugin.sources.android.multiplatformAndroidSourceSetLayoutV1
|
||||
import org.jetbrains.kotlin.gradle.plugin.sources.android.multiplatformAndroidSourceSetLayoutV2
|
||||
import java.io.File
|
||||
|
||||
@InternalKotlinGradlePluginApi // used in integration tests
|
||||
object KotlinToolingDiagnostics {
|
||||
@@ -702,6 +703,15 @@ object KotlinToolingDiagnostics {
|
||||
""".trimIndent()
|
||||
)
|
||||
}
|
||||
|
||||
object DependencyDoesNotPhysicallyExist : ToolingDiagnosticFactory(WARNING) {
|
||||
operator fun invoke(dependency: File) = build(
|
||||
"""
|
||||
Unable to find the dependency at the location '${dependency.absolutePath}'.
|
||||
Please make sure that the dependency exists at the specified location or ensure that dependency declarations are correct in your project.
|
||||
""".trimIndent()
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
private fun String.indentLines(nSpaces: Int = 4, skipFirstLine: Boolean = true): String {
|
||||
|
||||
Reference in New Issue
Block a user