File tree Expand file tree Collapse file tree 2 files changed +29
-1
lines changed
functionalTest/kotlin/kotlinx/validation/test Expand file tree Collapse file tree 2 files changed +29
-1
lines changed Original file line number Diff line number Diff line change @@ -89,6 +89,29 @@ internal class DefaultConfigTests : BaseKotlinGradleTest() {
89
89
}
90
90
}
91
91
92
+ @Test
93
+ fun `apiCheck should succeed when public classes match api file ignoring case` () {
94
+ val runner = test {
95
+ buildGradleKts {
96
+ resolve(" examples/gradle/base/withPlugin.gradle.kts" )
97
+ }
98
+ kotlin(" AnotherBuildConfig.kt" ) {
99
+ resolve(" examples/classes/AnotherBuildConfig.kt" )
100
+ }
101
+ apiFile(projectName = rootProjectDir.name.toUpperCase()) {
102
+ resolve(" examples/classes/AnotherBuildConfig.dump" )
103
+ }
104
+
105
+ runner {
106
+ arguments.add(" :apiCheck" )
107
+ }
108
+ }
109
+
110
+ runner.build().apply {
111
+ assertTaskSuccess(" :apiCheck" )
112
+ }
113
+ }
114
+
92
115
@Test
93
116
fun `apiCheck should fail, when a public class is not in api-File` () {
94
117
val runner = test {
Original file line number Diff line number Diff line change @@ -11,6 +11,7 @@ import org.gradle.api.file.*
11
11
import org.gradle.api.model.ObjectFactory
12
12
import org.gradle.api.tasks.*
13
13
import java.io.*
14
+ import java.util.TreeSet
14
15
import javax.inject.Inject
15
16
16
17
open class ApiCompareCompareTask @Inject constructor(private val objects : ObjectFactory ): DefaultTask() {
@@ -53,7 +54,11 @@ open class ApiCompareCompareTask @Inject constructor(private val objects: Object
53
54
54
55
val subject = projectName
55
56
val apiBuildDirFiles = mutableSetOf<RelativePath >()
56
- val expectedApiFiles = mutableSetOf<RelativePath >()
57
+ // We use case-insensitive comparison to workaround issues with case-insensitive OSes
58
+ // and Gradle behaving slightly different on different platforms
59
+ val expectedApiFiles = TreeSet <RelativePath > { rp, rp2 ->
60
+ rp.toString().compareTo(rp2.toString(), true )
61
+ }
57
62
objects.fileTree().from(apiBuildDir).visit { file ->
58
63
apiBuildDirFiles.add(file.relativePath)
59
64
}
You can’t perform that action at this time.
0 commit comments