[JPS] Don't compute compiler args on start-up of the build process
Initialization of compiler arguments takes a long time because of its copying, but for initial context check, there is no need to do it at all for all targets except Common. #KTIJ-21161 In Progress
This commit is contained in:
committed by
Space Team
parent
516efe77c9
commit
772745b0ad
@@ -135,7 +135,7 @@ class KotlinChunk internal constructor(val context: KotlinCompileContext, val ta
|
||||
}
|
||||
|
||||
val isEnabled: Boolean by lazy {
|
||||
representativeTarget.isEnabled(compilerArguments)
|
||||
representativeTarget.isEnabled(lazy { compilerArguments })
|
||||
}
|
||||
|
||||
fun shouldRebuild(): Boolean {
|
||||
|
||||
+2
-2
@@ -26,9 +26,9 @@ private const val COMMON_BUILD_META_INFO_FILE_NAME = "common-build-meta-info.txt
|
||||
class KotlinCommonModuleBuildTarget(kotlinContext: KotlinCompileContext, jpsModuleBuildTarget: ModuleBuildTarget) :
|
||||
KotlinModuleBuildTarget<CommonBuildMetaInfo>(kotlinContext, jpsModuleBuildTarget) {
|
||||
|
||||
override fun isEnabled(chunkCompilerArguments: CommonCompilerArguments): Boolean {
|
||||
override fun isEnabled(chunkCompilerArguments: Lazy<CommonCompilerArguments>): Boolean {
|
||||
val k2MetadataArguments = module.k2MetadataCompilerArguments
|
||||
return k2MetadataArguments.enabledInJps || (chunkCompilerArguments as? K2MetadataCompilerArguments)?.enabledInJps == true
|
||||
return k2MetadataArguments.enabledInJps || (chunkCompilerArguments.value as? K2MetadataCompilerArguments)?.enabledInJps == true
|
||||
}
|
||||
|
||||
override val isIncrementalCompilationEnabled: Boolean
|
||||
|
||||
@@ -65,7 +65,7 @@ abstract class KotlinModuleBuildTarget<BuildMetaInfoType : BuildMetaInfo> intern
|
||||
|
||||
abstract val isIncrementalCompilationEnabled: Boolean
|
||||
|
||||
open fun isEnabled(chunkCompilerArguments: CommonCompilerArguments): Boolean = true
|
||||
open fun isEnabled(chunkCompilerArguments: Lazy<CommonCompilerArguments>): Boolean = true
|
||||
|
||||
@Suppress("LeakingThis")
|
||||
val localCacheVersionManager = localCacheVersionManager(
|
||||
|
||||
+1
-1
@@ -24,7 +24,7 @@ class KotlinUnsupportedModuleBuildTarget(
|
||||
|
||||
private fun shouldNotBeCalled(): Nothing = error("Should not be called")
|
||||
|
||||
override fun isEnabled(chunkCompilerArguments: CommonCompilerArguments): Boolean {
|
||||
override fun isEnabled(chunkCompilerArguments: Lazy<CommonCompilerArguments>): Boolean {
|
||||
return false
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user