[Gradle] Add FileCollection version of filterKlibsPassedToCompiler
This commit is contained in:
+8
-7
@@ -128,9 +128,12 @@ private fun FileCollection.filterOutPublishableInteropLibs(project: Project): Fi
|
|||||||
* for it (NO-SOURCE check). So we need to take this case into account
|
* for it (NO-SOURCE check). So we need to take this case into account
|
||||||
* and skip libraries that were not compiled. See also: GH-2617 (K/N repo).
|
* and skip libraries that were not compiled. See also: GH-2617 (K/N repo).
|
||||||
*/
|
*/
|
||||||
private fun Collection<File>.filterKlibsPassedToCompiler(): List<File> = filter {
|
private val File.canKlibBePassedToCompiler get() = (extension == "klib" || isDirectory) && exists()
|
||||||
(it.extension == "klib" || it.isDirectory) && it.exists()
|
|
||||||
}
|
private fun Collection<File>.filterKlibsPassedToCompiler(): List<File> = filter(File::canKlibBePassedToCompiler)
|
||||||
|
|
||||||
|
/* Returned FileCollection is lazy */
|
||||||
|
private fun FileCollection.filterKlibsPassedToCompiler(): FileCollection = filter(File::canKlibBePassedToCompiler)
|
||||||
|
|
||||||
// endregion
|
// endregion
|
||||||
abstract class AbstractKotlinNativeCompile<
|
abstract class AbstractKotlinNativeCompile<
|
||||||
@@ -577,9 +580,7 @@ constructor(
|
|||||||
}
|
}
|
||||||
|
|
||||||
@get:Internal
|
@get:Internal
|
||||||
val apiFiles by lazy {
|
val apiFiles = project.files(project.configurations.getByName(compilation.apiConfigurationName)).filterKlibsPassedToCompiler()
|
||||||
project.files(project.configurations.getByName(compilation.apiConfigurationName)).files.filterKlibsPassedToCompiler()
|
|
||||||
}
|
|
||||||
|
|
||||||
private val localKotlinOptions get() =
|
private val localKotlinOptions get() =
|
||||||
object : KotlinCommonToolOptions {
|
object : KotlinCommonToolOptions {
|
||||||
@@ -612,7 +613,7 @@ constructor(
|
|||||||
.filterIsInstance<ResolvedDependencyResult>()
|
.filterIsInstance<ResolvedDependencyResult>()
|
||||||
.forEach {
|
.forEach {
|
||||||
val dependencyFiles = exportLibrariesResolvedGraph.dependencyArtifacts(it).map { it.file }.filterKlibsPassedToCompiler()
|
val dependencyFiles = exportLibrariesResolvedGraph.dependencyArtifacts(it).map { it.file }.filterKlibsPassedToCompiler()
|
||||||
if (!apiFiles.containsAll(dependencyFiles)) {
|
if (!apiFiles.files.containsAll(dependencyFiles)) {
|
||||||
failed.add(it)
|
failed.add(it)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user