Fix test expects slightly different variant selection error message.

Error message was slightly changed on Gradle 7.

^KT-44949 In Progress
This commit is contained in:
Yahor Berdnikau
2021-03-01 16:00:20 +01:00
parent c96c50a73c
commit 2e1c1cd154
@@ -1004,9 +1004,11 @@ class KotlinGradleIT : BaseGradleIT() {
gradleBuildScript("projB").appendText("\nkotlin.target.attributes.attribute(targetAttribute, \"bar\")") gradleBuildScript("projB").appendText("\nkotlin.target.attributes.attribute(targetAttribute, \"bar\")")
build(":projB:compileKotlin") { build(":projB:compileKotlin") {
assertFailed() assertFailed()
if (projectGradleVersion < GradleVersion.version("6.4")) { when {
projectGradleVersion < GradleVersion.version("6.4") -> {
assertContains("Required com.example.target 'bar'") assertContains("Required com.example.target 'bar'")
} else { }
projectGradleVersion < GradleVersion.version("6.8.4") -> {
assertContains( assertContains(
"No matching variant of project :projA was found. The consumer was configured to find an API of a library " + "No matching variant of project :projA was found. The consumer was configured to find an API of a library " +
"compatible with Java 8, preferably in the form of class files, " + "compatible with Java 8, preferably in the form of class files, " +
@@ -1016,6 +1018,17 @@ class KotlinGradleIT : BaseGradleIT() {
"attribute 'com.example.target' with value 'bar' but:" "attribute 'com.example.target' with value 'bar' but:"
) )
} }
else -> {
assertContains(
"No matching variant of project :projA was found. The consumer was configured to find an API of a library " +
"compatible with Java 8, preferably in the form of class files, " +
"preferably optimized for standard JVMs, and its dependencies declared externally, " +
"as well as attribute 'org.jetbrains.kotlin.platform.type' with value 'jvm', " +
"attribute 'com.example.compilation' with value 'foo', " +
"attribute 'com.example.target' with value 'bar' but:"
)
}
}
} }
// And using the compilation attributes (fix the target attributes first): // And using the compilation attributes (fix the target attributes first):
@@ -1027,10 +1040,11 @@ class KotlinGradleIT : BaseGradleIT() {
) )
build(":projB:compileKotlin") { build(":projB:compileKotlin") {
assertFailed() assertFailed()
val projectGradleVersion = project.chooseWrapperVersionOrFinishTest() when {
if (GradleVersion.version(projectGradleVersion) < GradleVersion.version("6.4")) { projectGradleVersion < GradleVersion.version("6.4") -> {
assertContains("Required com.example.compilation 'bar'") assertContains("Required com.example.compilation 'bar'")
} else { }
projectGradleVersion < GradleVersion.version("6.8.4") -> {
assertContains( assertContains(
"No matching variant of project :projA was found. The consumer was configured to find an API of a library " + "No matching variant of project :projA was found. The consumer was configured to find an API of a library " +
"compatible with Java 8, preferably in the form of class files, and its dependencies declared externally, " + "compatible with Java 8, preferably in the form of class files, and its dependencies declared externally, " +
@@ -1039,6 +1053,17 @@ class KotlinGradleIT : BaseGradleIT() {
"attribute 'com.example.target' with value 'foo' but:" "attribute 'com.example.target' with value 'foo' but:"
) )
} }
else -> {
assertContains(
"No matching variant of project :projA was found. The consumer was configured to find an API of a library " +
"compatible with Java 8, preferably in the form of class files, preferably optimized for standard JVMs, " +
"and its dependencies declared externally, " +
"as well as attribute 'org.jetbrains.kotlin.platform.type' with value 'jvm', " +
"attribute 'com.example.compilation' with value 'bar', " +
"attribute 'com.example.target' with value 'foo' but:"
)
}
}
} }
} }