Enable assertions for Kotlin daemon in Gradle tests
This commit is contained in:
@@ -364,7 +364,7 @@ public class K2JSCompiler extends CLICompiler<K2JSCompilerArguments> {
|
|||||||
MessageCollector messageCollector = configuration.getNotNull(CLIConfigurationKeys.MESSAGE_COLLECTOR_KEY);
|
MessageCollector messageCollector = configuration.getNotNull(CLIConfigurationKeys.MESSAGE_COLLECTOR_KEY);
|
||||||
|
|
||||||
if (arguments.getTarget() != null) {
|
if (arguments.getTarget() != null) {
|
||||||
assert arguments.getTarget() == "v5" : "Unsupported ECMA version: " + arguments.getTarget();
|
assert "v5".equals(arguments.getTarget()) : "Unsupported ECMA version: " + arguments.getTarget();
|
||||||
}
|
}
|
||||||
configuration.put(JSConfigurationKeys.TARGET, EcmaVersion.defaultVersion());
|
configuration.put(JSConfigurationKeys.TARGET, EcmaVersion.defaultVersion());
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -609,7 +609,7 @@ abstract class BaseGradleIT {
|
|||||||
|
|
||||||
// Workaround: override a console type set in the user machine gradle.properties (since Gradle 4.3):
|
// Workaround: override a console type set in the user machine gradle.properties (since Gradle 4.3):
|
||||||
add("--console=plain")
|
add("--console=plain")
|
||||||
|
add("-Dkotlin.daemon.ea=true")
|
||||||
addAll(options.freeCommandLineArgs)
|
addAll(options.freeCommandLineArgs)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+8
-2
@@ -159,13 +159,19 @@ internal open class GradleCompilerRunner(protected val task: Task) {
|
|||||||
sessionIsAliveFlagFile: File,
|
sessionIsAliveFlagFile: File,
|
||||||
compilerFullClasspath: List<File>,
|
compilerFullClasspath: List<File>,
|
||||||
messageCollector: MessageCollector,
|
messageCollector: MessageCollector,
|
||||||
isDebugEnabled: Boolean
|
isDebugEnabled: Boolean,
|
||||||
|
enableAssertions: Boolean
|
||||||
): CompileServiceSession? {
|
): CompileServiceSession? {
|
||||||
val compilerId = CompilerId.makeCompilerId(compilerFullClasspath)
|
val compilerId = CompilerId.makeCompilerId(compilerFullClasspath)
|
||||||
|
val additionalJvmParams = arrayListOf<String>()
|
||||||
|
if (enableAssertions) {
|
||||||
|
additionalJvmParams.add("ea")
|
||||||
|
}
|
||||||
return KotlinCompilerRunnerUtils.newDaemonConnection(
|
return KotlinCompilerRunnerUtils.newDaemonConnection(
|
||||||
compilerId, clientIsAliveFlagFile, sessionIsAliveFlagFile,
|
compilerId, clientIsAliveFlagFile, sessionIsAliveFlagFile,
|
||||||
messageCollector = messageCollector,
|
messageCollector = messageCollector,
|
||||||
isDebugEnabled = isDebugEnabled
|
isDebugEnabled = isDebugEnabled,
|
||||||
|
additionalJvmParams = additionalJvmParams.toTypedArray()
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+3
-1
@@ -134,6 +134,7 @@ internal class GradleKotlinCompilerWork @Inject constructor(
|
|||||||
|
|
||||||
private fun compileWithDaemon(messageCollector: MessageCollector): ExitCode? {
|
private fun compileWithDaemon(messageCollector: MessageCollector): ExitCode? {
|
||||||
val isDebugEnabled = log.isDebugEnabled || System.getProperty("kotlin.daemon.debug.log")?.toBoolean() ?: false
|
val isDebugEnabled = log.isDebugEnabled || System.getProperty("kotlin.daemon.debug.log")?.toBoolean() ?: false
|
||||||
|
val enableAssertions = System.getProperty("kotlin.daemon.ea")?.toBoolean() ?: false
|
||||||
val daemonMessageCollector =
|
val daemonMessageCollector =
|
||||||
if (isDebugEnabled) messageCollector else MessageCollector.NONE
|
if (isDebugEnabled) messageCollector else MessageCollector.NONE
|
||||||
|
|
||||||
@@ -144,7 +145,8 @@ internal class GradleKotlinCompilerWork @Inject constructor(
|
|||||||
sessionFlagFile,
|
sessionFlagFile,
|
||||||
compilerFullClasspath,
|
compilerFullClasspath,
|
||||||
daemonMessageCollector,
|
daemonMessageCollector,
|
||||||
isDebugEnabled
|
isDebugEnabled = isDebugEnabled,
|
||||||
|
enableAssertions = enableAssertions
|
||||||
)
|
)
|
||||||
} catch (e: Throwable) {
|
} catch (e: Throwable) {
|
||||||
log.error("Caught an exception trying to connect to Kotlin Daemon:")
|
log.error("Caught an exception trying to connect to Kotlin Daemon:")
|
||||||
|
|||||||
Reference in New Issue
Block a user