Enable disabling incremental compilation for tests
This commit is contained in:
@@ -247,7 +247,7 @@ public class MultifileClassCodegen(
|
||||
}
|
||||
|
||||
private fun getCompiledPackageFragment(packageFqName: FqName, state: GenerationState): PackageFragmentDescriptor? =
|
||||
if (!IncrementalCompilation.ENABLED) null
|
||||
if (!IncrementalCompilation.isEnabled()) null
|
||||
else state.module.getPackage(packageFqName).fragments.firstOrNull { fragment ->
|
||||
fragment is IncrementalPackageFragmentProvider.IncrementalPackageFragment &&
|
||||
fragment.target == state.targetId
|
||||
|
||||
@@ -141,7 +141,7 @@ public class PackageCodegen {
|
||||
|
||||
@Nullable
|
||||
private PackageFragmentDescriptor getCompiledPackageFragment(@NotNull FqName fqName) {
|
||||
if (!IncrementalCompilation.ENABLED) {
|
||||
if (!IncrementalCompilation.isEnabled()) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@@ -65,7 +65,7 @@ public open class K2JVMCompiler : CLICompiler<K2JVMCompilerArguments>() {
|
||||
val configuration = CompilerConfiguration()
|
||||
configuration.put(CLIConfigurationKeys.MESSAGE_COLLECTOR_KEY, messageSeverityCollector)
|
||||
|
||||
if (IncrementalCompilation.ENABLED) {
|
||||
if (IncrementalCompilation.isEnabled()) {
|
||||
val incrementalCompilationComponents = services.get(javaClass<IncrementalCompilationComponents>())
|
||||
configuration.put(JVMConfigurationKeys.INCREMENTAL_COMPILATION_COMPONENTS, incrementalCompilationComponents)
|
||||
}
|
||||
|
||||
@@ -16,6 +16,22 @@
|
||||
|
||||
package org.jetbrains.kotlin.config;
|
||||
|
||||
import org.jetbrains.annotations.TestOnly;
|
||||
|
||||
public class IncrementalCompilation {
|
||||
public static final boolean ENABLED = !"false".equals(System.getProperty("kotlin.incremental.compilation"));
|
||||
}
|
||||
private static final String INCREMENTAL_COMPILATION_PROPERTY = "kotlin.incremental.compilation";
|
||||
|
||||
public static boolean isEnabled() {
|
||||
return !"false".equals(System.getProperty(INCREMENTAL_COMPILATION_PROPERTY));
|
||||
}
|
||||
|
||||
@TestOnly
|
||||
public static void disableIncrementalCompilation() {
|
||||
System.setProperty(INCREMENTAL_COMPILATION_PROPERTY, "false");
|
||||
}
|
||||
|
||||
@TestOnly
|
||||
public static void enableIncrementalCompilation() {
|
||||
System.setProperty(INCREMENTAL_COMPILATION_PROPERTY, "true");
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user