[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
*/
val rootProjectDir: File,
val rootProjectDir: File?,
kotlinScriptExtensions: Array<String>? = null,
val withAbiSnapshot: Boolean = false,
val preciseCompilationResultsBackup: Boolean = false,
@@ -559,8 +559,9 @@ abstract class CompileServiceImplBase(
val modulesApiHistory = incrementalCompilationOptions.multiModuleICSettings?.run {
val modulesInfo = incrementalCompilationOptions.modulesInfo
?: error("The build is configured to use the history-file based IC approach, but doesn't provide the modulesInfo")
ModulesApiHistoryJs(incrementalCompilationOptions.rootProjectDir, modulesInfo)
val rootProjectDir = incrementalCompilationOptions.rootProjectDir
?: error("rootProjectDir is expected to be non null when the history-file based IC approach is used")
ModulesApiHistoryJs(rootProjectDir, modulesInfo)
} ?: EmptyModulesApiHistory
val compiler = IncrementalJsCompilerRunner(
@@ -617,6 +618,9 @@ abstract class CompileServiceImplBase(
reporter.info { "Use module detection: $useModuleDetection" }
val modulesInfo = incrementalCompilationOptions.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) {
ModulesApiHistoryJvm(projectRoot, modulesInfo)
@@ -19,7 +19,7 @@ import java.io.File
@VisibleForTesting
class BuildReportICReporter(
private val compilationResults: CompilationResults,
rootDir: File,
rootDir: File?,
private val isVerbose: Boolean = false
) : ICReporterBase(rootDir), RemoteICReporter {
private val icLogLines = arrayListOf<String>()
@@ -19,7 +19,7 @@ import java.io.File
@VisibleForTesting
class DebugMessagesICReporter(
private val servicesFacade: CompilerServicesFacadeBase,
rootDir: File,
rootDir: File?,
private val reportSeverity: ICReporter.ReportSeverity
) : ICReporterBase(rootDir), RemoteICReporter {