Allopen, Gradle: Fix JPS build on Windows (KT-17830)

Appears that plugin classpath can contain not only `File.separatorChar`, but also '/' on Windows. Without the proper handling of this case, Gradle importer may import the plugin JAR made for Gradle with shaded 'com.intellij' and cause an exception during the JPS build.
This commit is contained in:
Yan Zhulanow
2017-05-15 14:35:07 +03:00
committed by Yan Zhulanow
parent fd0578b564
commit 5d31e00d27
@@ -41,7 +41,11 @@ internal fun modifyCompilerArgumentsForPlugin(
val newPluginOptions = oldPluginOptions + annotationOptions
val oldPluginClasspaths = (commonArguments.pluginClasspaths ?: emptyArray()).filterTo(mutableListOf()) {
!it.substringAfterLast(File.separatorChar, missingDelimiterValue = "").matches("(kotlin-)?(maven-)?$pluginName-.*\\.jar".toRegex())
val lastIndexOfFile = it.lastIndexOfAny(charArrayOf('/', File.separatorChar))
if (lastIndexOfFile < 0) {
return@filterTo true
}
!it.drop(lastIndexOfFile + 1).matches("(kotlin-)?(maven-)?$pluginName-.*\\.jar".toRegex())
}
val newPluginClasspaths = oldPluginClasspaths + (setup?.classpath ?: emptyList())