Fix non-incremental compilation

This commit is contained in:
Alexey Tsvetkov
2019-02-15 16:36:53 +03:00
parent 337ca7021d
commit ada880fbad
3 changed files with 19 additions and 9 deletions
@@ -525,7 +525,6 @@ class CompileServiceImpl(
}
}
// todo: non-IC non-KTS scripts?
private fun execIncrementalCompiler(
k2jvmArgs: K2JVMCompilerArguments,
incrementalCompilationOptions: IncrementalCompilationOptions,
@@ -124,10 +124,19 @@ class SubpluginsIT : BaseGradleIT() {
}
}
@Test
fun testScriptingCustomExtensionNonIncremental() {
testScriptingCustomExtensionImpl(withIC = false)
}
@Test
fun testScriptingCustomExtensionIncremental() {
testScriptingCustomExtensionImpl(withIC = true)
}
private fun testScriptingCustomExtensionImpl(withIC: Boolean) {
val project = Project("scriptingCustomExtension")
val options = defaultBuildOptions().copy(incremental = true, kotlinDaemonDebugPort = null)
val options = defaultBuildOptions().copy(incremental = withIC)
project.setupWorkingDir()
val bobGreet = project.projectFile("bob.greet")
@@ -137,17 +146,24 @@ class SubpluginsIT : BaseGradleIT() {
project.build("build", options = options) {
assertSuccessful()
assertCompiledKotlinSources(project.relativize(bobGreet, aliceGreet, worldGreet, greetScriptTemplateKt))
val classesDir = kotlinClassesDir("app", "main")
assertFileExists("${classesDir}World.class")
assertFileExists("${classesDir}Alice.class")
assertFileExists("${classesDir}Bob.class")
if (withIC) {
// compile iterations are not logged when IC is disabled
assertCompiledKotlinSources(project.relativize(bobGreet, aliceGreet, worldGreet, greetScriptTemplateKt))
}
}
bobGreet.modify { it.replace("Bob", "Uncle Bob") }
project.build("build", options = options) {
assertSuccessful()
assertCompiledKotlinSources(project.relativize(bobGreet))
if (withIC) {
assertCompiledKotlinSources(project.relativize(bobGreet))
}
}
}
@@ -76,11 +76,6 @@ internal open class GradleCompilerRunner(protected val task: Task) {
args.commonSources = commonSources.map { it.absolutePath }.toTypedArray()
args.javaSourceRoots = javaSourceRoots.map { it.absolutePath }.toTypedArray()
args.javaPackagePrefix = javaPackagePrefix
if (environment.incrementalCompilationEnvironment == null || kotlinCompilerExecutionStrategy() != DAEMON_EXECUTION_STRATEGY) {
args.destination = null
}
runCompilerAsync(KotlinCompilerClass.JVM, args, environment)
}