Filter some characters out of module names passed to Kotlin from Gradle
This addresses the cases when a module name contains a slash (e.g. when the Gradle project name was set this way to point Gradle to the directory), which led to Kotlin module file being placed under a subdirectory of META-INF and thus undiscoverable for the compiler and reflect. Additionally, this fix removes characters \n, \r, \t whose presence in a module name caused compilation failures. Issue #KT-20608 Fixed
This commit is contained in:
+14
@@ -771,4 +771,18 @@ class KotlinGradleIT : BaseGradleIT() {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
fun testModuleNameFiltering() = with(Project("typeAlias")) { // Use a Project with a top-level typealias
|
||||
setupWorkingDir()
|
||||
|
||||
gradleBuildScript().appendText("\n" + """archivesBaseName = 'a/really\\tricky\n\rmodule\tname'""")
|
||||
build("classes") {
|
||||
assertSuccessful()
|
||||
|
||||
val metaInfDir = File(projectDir, kotlinClassesDir() + "META-INF")
|
||||
assertNotNull(metaInfDir.listFiles().singleOrNull { it.name.endsWith(".kotlin_module") })
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user