Skip to content

Commit 7ae56a5

Browse files
ALikhachevSpace Team
authored andcommitted
[BTA] Replace SHUTDOWN_DELAY by SHUTDOWN_DELAY_MILLIS
In the current form, the existing form seems to be inconvenient for Java consumers. Let's fall back to a long value compatible with any consumer for now. Relates to KT-81520
1 parent 73612c6 commit 7ae56a5

File tree

5 files changed

+12
-14
lines changed

5 files changed

+12
-14
lines changed

compiler/build-tools/kotlin-build-tools-api/api/kotlin-build-tools-api.api

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ public abstract interface class org/jetbrains/kotlin/buildtools/api/ExecutionPol
6060
public abstract interface class org/jetbrains/kotlin/buildtools/api/ExecutionPolicy$WithDaemon : org/jetbrains/kotlin/buildtools/api/ExecutionPolicy {
6161
public static final field Companion Lorg/jetbrains/kotlin/buildtools/api/ExecutionPolicy$WithDaemon$Companion;
6262
public static final field JVM_ARGUMENTS Lorg/jetbrains/kotlin/buildtools/api/ExecutionPolicy$WithDaemon$Option;
63-
public static final field SHUTDOWN_DELAY Lorg/jetbrains/kotlin/buildtools/api/ExecutionPolicy$WithDaemon$Option;
63+
public static final field SHUTDOWN_DELAY_MILLIS Lorg/jetbrains/kotlin/buildtools/api/ExecutionPolicy$WithDaemon$Option;
6464
public abstract fun get (Lorg/jetbrains/kotlin/buildtools/api/ExecutionPolicy$WithDaemon$Option;)Ljava/lang/Object;
6565
public abstract fun set (Lorg/jetbrains/kotlin/buildtools/api/ExecutionPolicy$WithDaemon$Option;Ljava/lang/Object;)V
6666
}

compiler/build-tools/kotlin-build-tools-api/src/main/kotlin/org/jetbrains/kotlin/buildtools/api/ExecutionPolicy.kt

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
package org.jetbrains.kotlin.buildtools.api
77

88
import org.jetbrains.kotlin.buildtools.api.internal.BaseOption
9-
import kotlin.time.Duration
109

1110
/**
1211
* An execution policy for a build operation.
@@ -58,10 +57,10 @@ public sealed interface ExecutionPolicy {
5857
public val JVM_ARGUMENTS: Option<List<String>?> = Option("JVM_ARGUMENTS")
5958

6059
/**
61-
* The time that the daemon process continues to live after all clients have disconnected.
60+
* The time in milliseconds that the daemon process continues to live after all clients have disconnected.
6261
*/
6362
@JvmField
64-
public val SHUTDOWN_DELAY: Option<Duration?> = Option("SHUTDOWN_DELAY")
63+
public val SHUTDOWN_DELAY_MILLIS: Option<Long?> = Option("SHUTDOWN_DELAY_MILLIS")
6564
}
6665
}
6766
}

compiler/build-tools/kotlin-build-tools-compat/src/main/kotlin/org/jetbrains/kotlin/buildtools/internal/compat/KotlinToolchainsV1Adapter.kt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -297,9 +297,9 @@ private interface ExecutionPolicyV1Adapter {
297297
override val strategyConfiguration: CompilerExecutionStrategyConfiguration
298298
get() {
299299
val jvmArguments = get(JVM_ARGUMENTS) ?: emptyList()
300-
return get(SHUTDOWN_DELAY)?.let {
300+
return get(SHUTDOWN_DELAY_MILLIS)?.let {
301301
compilationService.makeCompilerExecutionStrategyConfiguration().useDaemonStrategy(
302-
jvmArguments, it.toJavaDuration()
302+
jvmArguments, java.time.Duration.ofMillis(it)
303303
)
304304
} ?: compilationService.makeCompilerExecutionStrategyConfiguration().useDaemonStrategy(
305305
jvmArguments
@@ -332,9 +332,9 @@ private interface ExecutionPolicyV1Adapter {
332332
val JVM_ARGUMENTS: Option<List<String>?> = Option("JVM_ARGUMENTS", default = null)
333333

334334
/**
335-
* The time that the daemon process continues to live after all clients have disconnected.
335+
* The time in milliseconds that the daemon process continues to live after all clients have disconnected.
336336
*/
337-
val SHUTDOWN_DELAY: Option<Duration?> = Option("SHUTDOWN_DELAY", null)
337+
val SHUTDOWN_DELAY_MILLIS: Option<Long?> = Option("SHUTDOWN_DELAY_MILLIS", null)
338338
}
339339
}
340340
}

compiler/build-tools/kotlin-build-tools-impl/src/main/kotlin/org/jetbrains/kotlin/buildtools/internal/executionPolicyImpls.kt

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
package org.jetbrains.kotlin.buildtools.internal
77

88
import org.jetbrains.kotlin.buildtools.api.ExecutionPolicy
9-
import kotlin.time.Duration
109

1110
internal object InProcessExecutionPolicyImpl : ExecutionPolicy.InProcess
1211

@@ -41,8 +40,8 @@ internal class DaemonExecutionPolicyImpl : ExecutionPolicy.WithDaemon {
4140
val JVM_ARGUMENTS: Option<List<String>?> = Option("JVM_ARGUMENTS", default = null)
4241

4342
/**
44-
* The time that the daemon process continues to live after all clients have disconnected.
43+
* The time in milliseconds that the daemon process continues to live after all clients have disconnected.
4544
*/
46-
val SHUTDOWN_DELAY: Option<Duration?> = Option("SHUTDOWN_DELAY", null)
45+
val SHUTDOWN_DELAY_MILLIS: Option<Long?> = Option("SHUTDOWN_DELAY_MILLIS", null)
4746
}
4847
}

compiler/build-tools/kotlin-build-tools-impl/src/main/kotlin/org/jetbrains/kotlin/buildtools/internal/jvm/operations/JvmCompilationOperationImpl.kt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ import org.jetbrains.kotlin.buildtools.api.jvm.operations.JvmCompilationOperatio
2525
import org.jetbrains.kotlin.buildtools.api.trackers.CompilerLookupTracker
2626
import org.jetbrains.kotlin.buildtools.internal.*
2727
import org.jetbrains.kotlin.buildtools.internal.DaemonExecutionPolicyImpl.Companion.JVM_ARGUMENTS
28-
import org.jetbrains.kotlin.buildtools.internal.DaemonExecutionPolicyImpl.Companion.SHUTDOWN_DELAY
28+
import org.jetbrains.kotlin.buildtools.internal.DaemonExecutionPolicyImpl.Companion.SHUTDOWN_DELAY_MILLIS
2929
import org.jetbrains.kotlin.buildtools.internal.arguments.CommonCompilerArgumentsImpl.Companion.LANGUAGE_VERSION
3030
import org.jetbrains.kotlin.buildtools.internal.arguments.CommonCompilerArgumentsImpl.Companion.X_USE_FIR_IC
3131
import org.jetbrains.kotlin.buildtools.internal.arguments.CommonToolArgumentsImpl.Companion.VERBOSE
@@ -189,8 +189,8 @@ internal class JvmCompilationOperationImpl(
189189

190190
val daemonOptions = configureDaemonOptions(
191191
DaemonOptions().apply {
192-
executionPolicy[SHUTDOWN_DELAY]?.let { shutdownDelay ->
193-
shutdownDelayMilliseconds = shutdownDelay.inWholeMilliseconds
192+
executionPolicy[SHUTDOWN_DELAY_MILLIS]?.let { shutdownDelay ->
193+
shutdownDelayMilliseconds = shutdownDelay
194194
}
195195
})
196196

0 commit comments

Comments
 (0)