JPS MPP tests: Don't do anything for common modules, enable js ic, fix test data

Original commit: 359909dcff
This commit is contained in:
Sergey Rostov
2018-09-07 14:57:41 +03:00
parent 2b967e571c
commit d015b8b8a1
25 changed files with 721 additions and 127 deletions
@@ -184,7 +184,7 @@ class KotlinBuilder : ModuleLevelBuilder(BuilderCategory.SOURCE_PROCESSOR) {
val kotlinChunk = kotlinContext.getChunk(chunk) ?: return
kotlinContext.checkChunkCacheVersion(kotlinChunk)
if (!kotlinContext.rebuildingAllKotlin) {
if (!kotlinContext.rebuildingAllKotlin && kotlinChunk.isEnabled) {
markAdditionalFilesForInitialRound(kotlinChunk, chunk, kotlinContext)
}
@@ -327,10 +327,17 @@ class KotlinBuilder : ModuleLevelBuilder(BuilderCategory.SOURCE_PROCESSOR) {
return NOTHING_DONE
}
val kotlinChunk = chunk.toKotlinChunk(context)!!
if (!kotlinChunk.isEnabled) {
return NOTHING_DONE
}
val kotlinContext = context.kotlin
val projectDescriptor = context.projectDescriptor
val dataManager = projectDescriptor.dataManager
val targets = chunk.targets
val isChunkRebuilding = JavaBuilderUtil.isForcedRecompilationAllJavaModules(context)
|| targets.any { kotlinContext.rebuildAfterCacheVersionChanged[it] == true }
@@ -361,7 +368,6 @@ class KotlinBuilder : ModuleLevelBuilder(BuilderCategory.SOURCE_PROCESSOR) {
return ABORT
}
val kotlinChunk = chunk.toKotlinChunk(context)!!
val project = projectDescriptor.project
val lookupTracker = getLookupTracker(project, representativeTarget)
val exceptActualTracer = ExpectActualTrackerImpl()
@@ -376,12 +382,6 @@ class KotlinBuilder : ModuleLevelBuilder(BuilderCategory.SOURCE_PROCESSOR) {
messageCollector
) ?: return ABORT
val commonArguments = kotlinChunk.compilerArguments.apply {
reportOutputFiles = true
version = true // Always report the version to help diagnosing user issues if they submit the compiler output
if (languageVersion == null) languageVersion = VersionView.RELEASED_VERSION.versionString
}
if (LOG.isDebugEnabled) {
LOG.debug("Compiling files: ${kotlinDirtyFilesHolder.allDirtyFiles}")
}
@@ -391,7 +391,7 @@ class KotlinBuilder : ModuleLevelBuilder(BuilderCategory.SOURCE_PROCESSOR) {
kotlinChunk,
chunk,
representativeTarget,
commonArguments,
kotlinChunk.compilerArguments,
context,
kotlinDirtyFilesHolder,
fsOperations,
@@ -46,15 +46,26 @@ class KotlinChunk internal constructor(val context: KotlinCompileContext, val ta
}
}
val compilerArguments = representativeTarget.jpsModuleBuildTarget.module.kotlinCompilerArguments
private val defaultLanguageVersion = VersionView.RELEASED_VERSION
val compilerArguments = representativeTarget.jpsModuleBuildTarget.module.kotlinCompilerArguments.also {
it.reportOutputFiles = true
// Always report the version to help diagnosing user issues if they submit the compiler output
it.version = true
if (it.languageVersion == null) it.languageVersion = defaultLanguageVersion.versionString
}
val langVersion =
compilerArguments.languageVersion?.let { LanguageVersion.fromVersionString(it) } ?: VersionView.RELEASED_VERSION
compilerArguments.languageVersion?.let { LanguageVersion.fromVersionString(it) }
?: defaultLanguageVersion // use default language version when version string is invalid (todo: report warning?)
val apiVersion =
compilerArguments.apiVersion?.let { ApiVersion.parse(it) } ?: ApiVersion.createByLanguageVersion(
langVersion
)
compilerArguments.apiVersion?.let { ApiVersion.parse(it) }
?: ApiVersion.createByLanguageVersion(langVersion) // todo: report version parse error?
val isEnabled: Boolean = representativeTarget.isEnabled(compilerArguments)
fun shouldRebuild(): Boolean {
val buildMetaInfo = representativeTarget.buildMetaInfoFactory.create(compilerArguments)
@@ -27,6 +27,11 @@ 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 {
val k2MetadataArguments = module.k2MetadataCompilerArguments
return k2MetadataArguments.enabledInJps || (chunkCompilerArguments as? K2MetadataCompilerArguments)?.enabledInJps == true
}
override val isIncrementalCompilationEnabled: Boolean
get() = false
@@ -47,18 +52,15 @@ class KotlinCommonModuleBuildTarget(kotlinContext: KotlinCompileContext, jpsModu
): Boolean {
reportAndSkipCircular(chunk, environment)
val k2MetadataArguments = module.k2MetadataCompilerArguments
if (k2MetadataArguments.enabledInJps || (commonArguments as? K2MetadataCompilerArguments)?.enabledInJps == true) {
JpsKotlinCompilerRunner().runK2MetadataCompiler(
commonArguments,
k2MetadataArguments,
module.kotlinCompilerSettings,
environment,
destination,
dependenciesOutputDirs + libraryFiles,
sourceFiles // incremental K2MetadataCompiler not supported yet
)
}
JpsKotlinCompilerRunner().runK2MetadataCompiler(
commonArguments,
module.k2MetadataCompilerArguments,
module.kotlinCompilerSettings,
environment,
destination,
dependenciesOutputDirs + libraryFiles,
sourceFiles // incremental K2MetadataCompiler not supported yet
)
return true
}
@@ -64,6 +64,8 @@ abstract class KotlinModuleBuildTarget<BuildMetaInfoType : BuildMetaInfo> intern
abstract val isIncrementalCompilationEnabled: Boolean
open fun isEnabled(chunkCompilerArguments: CommonCompilerArguments): Boolean = true
@Suppress("LeakingThis")
val localCacheVersionManager = localCacheVersionManager(
kotlinContext.dataPaths.getTargetDataRoot(jpsModuleBuildTarget),