improved error message in case of non existing configuration

This commit is contained in:
2020-05-28 14:46:52 +01:00
parent e255ea8f65
commit 5b849ff2d7

View File

@@ -58,9 +58,18 @@ object DependencyExporter {
var sequence = 0 var sequence = 0
val map = HashMap<ResolvedComponentResult, Int>() val map = HashMap<ResolvedComponentResult, Int>()
val resolutionResult = project.configurations.single { val requestedConfiguration = project.configurations.singleOrNull {
it.name == ext.configurationName it.name == ext.configurationName
}.incoming.resolutionResult }?.takeIf { it.isCanBeResolved } ?: let {
val resolvableConfigurations = "[" + project.configurations.asSequence()
.filter { it.isCanBeResolved }
.map { "'${it.name}'" }
.joinToString(",") + "]"
throw GradleException("Configuration '${ext.configurationName}' doesn't exist or cannot be resolved, " +
"resolvable configurations in this project are " + resolvableConfigurations)
}
val resolutionResult = requestedConfiguration.incoming.resolutionResult
if (!ext.outputFile.isAbsolute) { if (!ext.outputFile.isAbsolute) {
ext.outputFile = project.buildDir.toPath().resolve(ext.outputFile) ext.outputFile = project.buildDir.toPath().resolve(ext.outputFile)
} }