Always run codegen when IC is enabled
We may need to run code generation when no source files are specified for incremental compilation (to update caches & metadata)
This commit is contained in:
@@ -80,7 +80,10 @@ class K2JVMCompiler : CLICompiler<K2JVMCompilerArguments>() {
|
|||||||
configuration.configureExplicitContentRoots(arguments)
|
configuration.configureExplicitContentRoots(arguments)
|
||||||
configuration.configureStandardLibs(paths, arguments)
|
configuration.configureStandardLibs(paths, arguments)
|
||||||
|
|
||||||
if (arguments.buildFile == null && arguments.freeArgs.isEmpty() && !arguments.version) {
|
// in case of IC we need to run compiler even
|
||||||
|
// when there are no files to compile (to update caches & metadata when a file is removed)
|
||||||
|
val isICEnabled = configuration[JVMConfigurationKeys.INCREMENTAL_COMPILATION_COMPONENTS] != null
|
||||||
|
if (arguments.buildFile == null && arguments.freeArgs.isEmpty() && !(arguments.version || isICEnabled)) {
|
||||||
if (arguments.script) {
|
if (arguments.script) {
|
||||||
messageCollector.report(ERROR, "Specify script source path to evaluate")
|
messageCollector.report(ERROR, "Specify script source path to evaluate")
|
||||||
return COMPILATION_ERROR
|
return COMPILATION_ERROR
|
||||||
@@ -141,13 +144,6 @@ class K2JVMCompiler : CLICompiler<K2JVMCompilerArguments>() {
|
|||||||
val module = ModuleBuilder(moduleName, destination?.path ?: ".", "java-production")
|
val module = ModuleBuilder(moduleName, destination?.path ?: ".", "java-production")
|
||||||
module.configureFromArgs(arguments)
|
module.configureFromArgs(arguments)
|
||||||
|
|
||||||
if (module.getSourceFiles().isEmpty()) {
|
|
||||||
if (arguments.version) return OK
|
|
||||||
|
|
||||||
messageCollector.report(ERROR, "No source files")
|
|
||||||
return COMPILATION_ERROR
|
|
||||||
}
|
|
||||||
|
|
||||||
ModuleChunk(listOf(module))
|
ModuleChunk(listOf(module))
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -157,6 +153,14 @@ class K2JVMCompiler : CLICompiler<K2JVMCompilerArguments>() {
|
|||||||
environment.registerJavacIfNeeded(arguments).let {
|
environment.registerJavacIfNeeded(arguments).let {
|
||||||
if (!it) return COMPILATION_ERROR
|
if (!it) return COMPILATION_ERROR
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (environment.getSourceFiles().isEmpty() && !isICEnabled && buildFile == null) {
|
||||||
|
if (arguments.version) return OK
|
||||||
|
|
||||||
|
messageCollector.report(ERROR, "No source files")
|
||||||
|
return COMPILATION_ERROR
|
||||||
|
}
|
||||||
|
|
||||||
KotlinToJVMBytecodeCompiler.compileModules(environment, buildFile, moduleChunk.modules)
|
KotlinToJVMBytecodeCompiler.compileModules(environment, buildFile, moduleChunk.modules)
|
||||||
return OK
|
return OK
|
||||||
} catch (e: CompilationException) {
|
} catch (e: CompilationException) {
|
||||||
|
|||||||
+5
@@ -101,6 +101,11 @@ public class IncrementalJsCompilerRunnerTestGenerated extends AbstractIncrementa
|
|||||||
runTest("jps-plugin/testData/incremental/pureKotlin/classRecreated/");
|
runTest("jps-plugin/testData/incremental/pureKotlin/classRecreated/");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("classRemoved")
|
||||||
|
public void testClassRemoved() throws Exception {
|
||||||
|
runTest("jps-plugin/testData/incremental/pureKotlin/classRemoved/");
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("classSignatureChanged")
|
@TestMetadata("classSignatureChanged")
|
||||||
public void testClassSignatureChanged() throws Exception {
|
public void testClassSignatureChanged() throws Exception {
|
||||||
runTest("jps-plugin/testData/incremental/pureKotlin/classSignatureChanged/");
|
runTest("jps-plugin/testData/incremental/pureKotlin/classSignatureChanged/");
|
||||||
|
|||||||
+5
@@ -101,6 +101,11 @@ public class IncrementalJvmCompilerRunnerTestGenerated extends AbstractIncrement
|
|||||||
runTest("jps-plugin/testData/incremental/pureKotlin/classRecreated/");
|
runTest("jps-plugin/testData/incremental/pureKotlin/classRecreated/");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("classRemoved")
|
||||||
|
public void testClassRemoved() throws Exception {
|
||||||
|
runTest("jps-plugin/testData/incremental/pureKotlin/classRemoved/");
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("classSignatureChanged")
|
@TestMetadata("classSignatureChanged")
|
||||||
public void testClassSignatureChanged() throws Exception {
|
public void testClassSignatureChanged() throws Exception {
|
||||||
runTest("jps-plugin/testData/incremental/pureKotlin/classSignatureChanged/");
|
runTest("jps-plugin/testData/incremental/pureKotlin/classSignatureChanged/");
|
||||||
|
|||||||
+5
@@ -752,6 +752,11 @@ public class IncrementalJpsTestGenerated extends AbstractIncrementalJpsTest {
|
|||||||
runTest("jps-plugin/testData/incremental/pureKotlin/classRecreated/");
|
runTest("jps-plugin/testData/incremental/pureKotlin/classRecreated/");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("classRemoved")
|
||||||
|
public void testClassRemoved() throws Exception {
|
||||||
|
runTest("jps-plugin/testData/incremental/pureKotlin/classRemoved/");
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("classSignatureChanged")
|
@TestMetadata("classSignatureChanged")
|
||||||
public void testClassSignatureChanged() throws Exception {
|
public void testClassSignatureChanged() throws Exception {
|
||||||
runTest("jps-plugin/testData/incremental/pureKotlin/classSignatureChanged/");
|
runTest("jps-plugin/testData/incremental/pureKotlin/classSignatureChanged/");
|
||||||
|
|||||||
@@ -0,0 +1,3 @@
|
|||||||
|
package test
|
||||||
|
|
||||||
|
class A
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
================ Step #1 =================
|
||||||
|
|
||||||
|
Cleaning output files:
|
||||||
|
out/production/module/META-INF/module.kotlin_module
|
||||||
|
out/production/module/test/A.class
|
||||||
|
End of files
|
||||||
|
Compiling files:
|
||||||
|
End of files
|
||||||
|
Exit code: OK
|
||||||
|
------------------------------------------
|
||||||
@@ -0,0 +1,4 @@
|
|||||||
|
package test
|
||||||
|
|
||||||
|
fun other() {
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user