Fix non-incremental compilation
This commit is contained in:
@@ -525,7 +525,6 @@ class CompileServiceImpl(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// todo: non-IC non-KTS scripts?
|
|
||||||
private fun execIncrementalCompiler(
|
private fun execIncrementalCompiler(
|
||||||
k2jvmArgs: K2JVMCompilerArguments,
|
k2jvmArgs: K2JVMCompilerArguments,
|
||||||
incrementalCompilationOptions: IncrementalCompilationOptions,
|
incrementalCompilationOptions: IncrementalCompilationOptions,
|
||||||
|
|||||||
+19
-3
@@ -124,10 +124,19 @@ class SubpluginsIT : BaseGradleIT() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
fun testScriptingCustomExtensionNonIncremental() {
|
||||||
|
testScriptingCustomExtensionImpl(withIC = false)
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun testScriptingCustomExtensionIncremental() {
|
fun testScriptingCustomExtensionIncremental() {
|
||||||
|
testScriptingCustomExtensionImpl(withIC = true)
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun testScriptingCustomExtensionImpl(withIC: Boolean) {
|
||||||
val project = Project("scriptingCustomExtension")
|
val project = Project("scriptingCustomExtension")
|
||||||
val options = defaultBuildOptions().copy(incremental = true, kotlinDaemonDebugPort = null)
|
val options = defaultBuildOptions().copy(incremental = withIC)
|
||||||
|
|
||||||
project.setupWorkingDir()
|
project.setupWorkingDir()
|
||||||
val bobGreet = project.projectFile("bob.greet")
|
val bobGreet = project.projectFile("bob.greet")
|
||||||
@@ -137,17 +146,24 @@ class SubpluginsIT : BaseGradleIT() {
|
|||||||
|
|
||||||
project.build("build", options = options) {
|
project.build("build", options = options) {
|
||||||
assertSuccessful()
|
assertSuccessful()
|
||||||
assertCompiledKotlinSources(project.relativize(bobGreet, aliceGreet, worldGreet, greetScriptTemplateKt))
|
|
||||||
val classesDir = kotlinClassesDir("app", "main")
|
val classesDir = kotlinClassesDir("app", "main")
|
||||||
assertFileExists("${classesDir}World.class")
|
assertFileExists("${classesDir}World.class")
|
||||||
assertFileExists("${classesDir}Alice.class")
|
assertFileExists("${classesDir}Alice.class")
|
||||||
assertFileExists("${classesDir}Bob.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") }
|
bobGreet.modify { it.replace("Bob", "Uncle Bob") }
|
||||||
project.build("build", options = options) {
|
project.build("build", options = options) {
|
||||||
assertSuccessful()
|
assertSuccessful()
|
||||||
assertCompiledKotlinSources(project.relativize(bobGreet))
|
|
||||||
|
if (withIC) {
|
||||||
|
assertCompiledKotlinSources(project.relativize(bobGreet))
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
-5
@@ -76,11 +76,6 @@ internal open class GradleCompilerRunner(protected val task: Task) {
|
|||||||
args.commonSources = commonSources.map { it.absolutePath }.toTypedArray()
|
args.commonSources = commonSources.map { it.absolutePath }.toTypedArray()
|
||||||
args.javaSourceRoots = javaSourceRoots.map { it.absolutePath }.toTypedArray()
|
args.javaSourceRoots = javaSourceRoots.map { it.absolutePath }.toTypedArray()
|
||||||
args.javaPackagePrefix = javaPackagePrefix
|
args.javaPackagePrefix = javaPackagePrefix
|
||||||
|
|
||||||
if (environment.incrementalCompilationEnvironment == null || kotlinCompilerExecutionStrategy() != DAEMON_EXECUTION_STRATEGY) {
|
|
||||||
args.destination = null
|
|
||||||
}
|
|
||||||
|
|
||||||
runCompilerAsync(KotlinCompilerClass.JVM, args, environment)
|
runCompilerAsync(KotlinCompilerClass.JVM, args, environment)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user