[IC] Allow to not specify the root project dir

When it's specified, it's used to calculate relative paths
This commit is contained in:
Alexander.Likhachev
2023-07-13 16:30:36 +02:00
committed by Space Team
parent b3677fa0ca
commit 91dc33f398
4 changed files with 9 additions and 5 deletions
@@ -73,7 +73,7 @@ class IncrementalCompilationOptions(
/** /**
* Root project directory, used to resolve relative paths * Root project directory, used to resolve relative paths
*/ */
val rootProjectDir: File, val rootProjectDir: File?,
kotlinScriptExtensions: Array<String>? = null, kotlinScriptExtensions: Array<String>? = null,
val withAbiSnapshot: Boolean = false, val withAbiSnapshot: Boolean = false,
val preciseCompilationResultsBackup: Boolean = false, val preciseCompilationResultsBackup: Boolean = false,
@@ -559,8 +559,9 @@ abstract class CompileServiceImplBase(
val modulesApiHistory = incrementalCompilationOptions.multiModuleICSettings?.run { val modulesApiHistory = incrementalCompilationOptions.multiModuleICSettings?.run {
val modulesInfo = incrementalCompilationOptions.modulesInfo val modulesInfo = incrementalCompilationOptions.modulesInfo
?: error("The build is configured to use the history-file based IC approach, but doesn't provide the modulesInfo") ?: error("The build is configured to use the history-file based IC approach, but doesn't provide the modulesInfo")
val rootProjectDir = incrementalCompilationOptions.rootProjectDir
ModulesApiHistoryJs(incrementalCompilationOptions.rootProjectDir, modulesInfo) ?: error("rootProjectDir is expected to be non null when the history-file based IC approach is used")
ModulesApiHistoryJs(rootProjectDir, modulesInfo)
} ?: EmptyModulesApiHistory } ?: EmptyModulesApiHistory
val compiler = IncrementalJsCompilerRunner( val compiler = IncrementalJsCompilerRunner(
@@ -617,6 +618,9 @@ abstract class CompileServiceImplBase(
reporter.info { "Use module detection: $useModuleDetection" } reporter.info { "Use module detection: $useModuleDetection" }
val modulesInfo = incrementalCompilationOptions.modulesInfo val modulesInfo = incrementalCompilationOptions.modulesInfo
?: error("The build is configured to use the history-file based IC approach, but doesn't provide the modulesInfo") ?: error("The build is configured to use the history-file based IC approach, but doesn't provide the modulesInfo")
check(projectRoot != null) {
"rootProjectDir is expected to be non null when the history-file based IC approach is used"
}
if (!useModuleDetection) { if (!useModuleDetection) {
ModulesApiHistoryJvm(projectRoot, modulesInfo) ModulesApiHistoryJvm(projectRoot, modulesInfo)
@@ -19,7 +19,7 @@ import java.io.File
@VisibleForTesting @VisibleForTesting
class BuildReportICReporter( class BuildReportICReporter(
private val compilationResults: CompilationResults, private val compilationResults: CompilationResults,
rootDir: File, rootDir: File?,
private val isVerbose: Boolean = false private val isVerbose: Boolean = false
) : ICReporterBase(rootDir), RemoteICReporter { ) : ICReporterBase(rootDir), RemoteICReporter {
private val icLogLines = arrayListOf<String>() private val icLogLines = arrayListOf<String>()
@@ -19,7 +19,7 @@ import java.io.File
@VisibleForTesting @VisibleForTesting
class DebugMessagesICReporter( class DebugMessagesICReporter(
private val servicesFacade: CompilerServicesFacadeBase, private val servicesFacade: CompilerServicesFacadeBase,
rootDir: File, rootDir: File?,
private val reportSeverity: ICReporter.ReportSeverity private val reportSeverity: ICReporter.ReportSeverity
) : ICReporterBase(rootDir), RemoteICReporter { ) : ICReporterBase(rootDir), RemoteICReporter {