File tree Expand file tree Collapse file tree 2 files changed +29
-1
lines changed 
libraries/tools/abi-validation/src 
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() {
8989        }
9090    }
9191
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+ 
92115    @Test
93116    fun  `apiCheck should fail, when a public class is not in api-File`  () {
94117        val  runner =  test {
Original file line number Diff line number Diff line change @@ -11,6 +11,7 @@ import org.gradle.api.file.*
1111import  org.gradle.api.model.ObjectFactory 
1212import  org.gradle.api.tasks.* 
1313import  java.io.* 
14+ import  java.util.TreeSet 
1415import  javax.inject.Inject 
1516
1617open  class  ApiCompareCompareTask  @Inject constructor(private  val  objects :  ObjectFactory ): DefaultTask() {
@@ -53,7 +54,11 @@ open class ApiCompareCompareTask @Inject constructor(private val objects: Object
5354
5455        val  subject =  projectName
5556        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+         }
5762        objects.fileTree().from(apiBuildDir).visit { file -> 
5863            apiBuildDirFiles.add(file.relativePath)
5964        }
    
 
   
 
     
   
   
          
     
  
    
     
 
    
      
     
 
     
    You can’t perform that action at this time.
  
 
    
  
     
    
      
        
     
 
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments