JS IR gradle plugin: don't run IC for the main module

This commit is contained in:
Anton Bannykh
2021-07-06 22:46:41 +03:00
committed by teamcityserver
parent e03cb372b7
commit 525c5b886f
@@ -104,6 +104,7 @@ abstract class KotlinJsIrLink @Inject constructor(
val cacheBuilder = CacheBuilder(
buildDir,
compilation as KotlinCompilation<*>,
kotlinOptions,
libraryFilter,
compilerRunner.get(),
@@ -150,6 +151,7 @@ abstract class KotlinJsIrLink @Inject constructor(
.buildCompilerArgs(
project.configurations.getByName(compilation.compileDependencyConfigurationName),
compilation.output.classesDirs,
compilation,
associatedCaches
)
}
@@ -175,6 +177,7 @@ abstract class KotlinJsIrLink @Inject constructor(
internal class CacheBuilder(
private val buildDir: File,
private val rootCompilation: KotlinCompilation<*>,
private val kotlinOptions: KotlinJsOptions,
private val libraryFilter: (File) -> Boolean,
private val compilerRunner: GradleCompilerRunner,
@@ -198,6 +201,7 @@ internal class CacheBuilder(
fun buildCompilerArgs(
compileClasspath: Configuration,
additionalForResolve: FileCollection?,
compilation: KotlinCompilation<*>,
associatedCaches: List<File>
): List<File> {
@@ -222,16 +226,18 @@ internal class CacheBuilder(
}
}
additionalForResolve?.files?.forEach { file ->
val cacheDirectory = rootCacheDirectory.resolve(file.name)
cacheDirectory.mkdirs()
runCompiler(
file,
compileClasspath.files,
cacheDirectory,
(allCacheDirectories + associatedCaches).distinct()
)
allCacheDirectories.add(cacheDirectory)
if (compilation != rootCompilation) {
additionalForResolve?.files?.forEach { file ->
val cacheDirectory = rootCacheDirectory.resolve(file.name)
cacheDirectory.mkdirs()
runCompiler(
file,
compileClasspath.files,
cacheDirectory,
(allCacheDirectories + associatedCaches).distinct()
)
allCacheDirectories.add(cacheDirectory)
}
}
return associatedCaches + allCacheDirectories