[KGP] Fix sharing build cache between Windows and Linux

On Windows, path() uses backslash as a file separator, and Mac/Linux
are using forward slashes. If friendPathsSet differs, remote build outputs
from other platforms can't be reused.

This patch uses invariant paths to address the issue.

^KT-63460 Fixed


Merge-request: KT-MR-13261
Merged-by: Evgenii Mazhukin <evgenii.mazhukin@jetbrains.com>
This commit is contained in:
Evgenii Mazhukin
2023-11-28 12:09:39 +00:00
committed by Space Team
parent 5258e2044d
commit 563c878f20
@@ -111,7 +111,7 @@ abstract class AbstractKotlinCompile<T : CommonCompilerArguments> @Inject constr
val buildDirFile = projectLayout.buildDirectory.asFile.get()
return friendPaths
.filter { it.exists() }
.map { it.normalize().relativeTo(buildDirFile).path }.toSet()
.map { it.normalize().relativeTo(buildDirFile).invariantSeparatorsPath }.toSet()
}
@Deprecated("Scheduled for removal with Kotlin 2.0", ReplaceWith("moduleName"))