-
Notifications
You must be signed in to change notification settings - Fork 50
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
MBS-12612 Detect and prevent Kotlin daemon fallback strategy #1326
Conversation
) = gradlew( | ||
projectDir, | ||
task, | ||
"-Dkotlin.daemon.jvm.options=invalid_jvm_argument_to_fail_process_startup", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I kinda like this hacky approach )
but there is a chance that it will be handled differently in the future, just saying
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agree, I understand and accept this trade-off.
I haven't found other good ways to simulate this but having tests is important.
You should probably add this PR to KT issue as a possible workaround |
|
||
fun register(project: Project) { | ||
if (isDaemonDisabled(project)) { | ||
project.logger.debug("Kotlin daemon fallback detection is disabled due to absence of daemon") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lifecycle?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed in #1336
* Copy of internal logic in GradleKotlinCompilerRunner | ||
*/ | ||
private fun isDaemonDisabled(project: Project): Boolean { | ||
val strategy = project.providers.systemProperty("kotlin.compiler.execution.strategy") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It will be broken if property name will be changed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added a test to this case: #1336
val strategy = project.providers.systemProperty("kotlin.compiler.execution.strategy") | ||
.forUseAtConfigurationTime() | ||
.getOrElse("daemon") | ||
return strategy != "daemon" // "in-process", "out-of-process" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We could add to check flag to force using the deamon
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't see the need for it yet.
Daemon is the default behavior for a long time. Also, we don't have proof that it's better than other strategies.
No description provided.