File tree Expand file tree Collapse file tree 3 files changed +12
-4
lines changed
compiler/build-tools/kotlin-build-tools-api-tests/src/main/kotlin/compilation Expand file tree Collapse file tree 3 files changed +12
-4
lines changed Original file line number Diff line number Diff line change @@ -15,6 +15,7 @@ import java.util.concurrent.TimeoutException
15
15
16
16
private class CompilationOutcomeImpl (
17
17
rawLogLines : Map <LogLevel , Collection <String >>,
18
+ override val actualResult : CompilationResult
18
19
) : CompilationOutcome {
19
20
private val _logLines by lazy {
20
21
rawLogLines.mapValues { (_, lines) -> lines.toList() }
@@ -90,7 +91,7 @@ abstract class AbstractModule(
90
91
): CompilationResult {
91
92
val kotlinLogger = TestKotlinLogger ()
92
93
val result = compileImpl(strategyConfig, compilationConfigAction, kotlinLogger)
93
- val outcome = CompilationOutcomeImpl (kotlinLogger.logMessagesByLevel)
94
+ val outcome = CompilationOutcomeImpl (kotlinLogger.logMessagesByLevel, result )
94
95
try {
95
96
assertions(outcome, this )
96
97
assertEquals(outcome.expectedResult, result) {
Original file line number Diff line number Diff line change @@ -12,9 +12,11 @@ interface CompilationOutcome {
12
12
13
13
val uniqueLogLines: Map <LogLevel , Set <String >>
14
14
15
+ val actualResult: CompilationResult
16
+
15
17
fun requireLogLevel (logLevel : LogLevel )
16
18
17
19
fun expectFail ()
18
20
19
21
fun expectCompilationResult (compilationResult : CompilationResult )
20
- }
22
+ }
Original file line number Diff line number Diff line change 5
5
6
6
package org.jetbrains.kotlin.buildtools.api.tests.compilation.scenario
7
7
8
+ import org.jetbrains.kotlin.buildtools.api.CompilationResult
8
9
import org.jetbrains.kotlin.buildtools.api.CompilerExecutionStrategyConfiguration
9
10
import org.jetbrains.kotlin.buildtools.api.SourcesChanges
10
11
import org.jetbrains.kotlin.buildtools.api.jvm.IncrementalJvmCompilationConfiguration
@@ -124,9 +125,13 @@ internal class ExternallyTrackedScenarioModuleImpl(
124
125
override fun getSourcesChanges () = sourcesChanges
125
126
126
127
override fun compile (forceOutput : LogLevel ? , assertions : CompilationOutcome .(Module , ScenarioModule ) -> Unit ) {
127
- super .compile(forceOutput, assertions)
128
+ super .compile(forceOutput) { module, scenarioModule ->
129
+ assertions(module, scenarioModule)
128
130
129
- sourcesChanges = SourcesChanges .Known (emptyList(), emptyList())
131
+ if (actualResult == CompilationResult .COMPILATION_SUCCESS ) {
132
+ sourcesChanges = SourcesChanges .Known (emptyList(), emptyList())
133
+ }
134
+ }
130
135
}
131
136
132
137
private fun addToModifiedFiles (file : Path ) {
You can’t perform that action at this time.
0 commit comments