Replace deprecated usages of max/min with maxOrNull/minOrNull
This commit is contained in:
@@ -1,5 +1,3 @@
|
||||
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
|
||||
|
||||
description = "Kotlin Daemon Client New"
|
||||
|
||||
plugins {
|
||||
@@ -49,6 +47,12 @@ dependencies {
|
||||
}
|
||||
}
|
||||
|
||||
tasks.withType<org.jetbrains.kotlin.gradle.dsl.KotlinCompile<*>> {
|
||||
kotlinOptions {
|
||||
apiVersion = "1.3"
|
||||
}
|
||||
}
|
||||
|
||||
sourceSets {
|
||||
"main" { projectDefault() }
|
||||
"test" {}
|
||||
|
||||
@@ -38,6 +38,13 @@ dependencies {
|
||||
}
|
||||
}
|
||||
|
||||
tasks.withType<org.jetbrains.kotlin.gradle.dsl.KotlinCompile<*>> {
|
||||
kotlinOptions {
|
||||
// This module is being run from within Gradle, older versions of which only have kotlin-stdlib 1.3 in the runtime classpath.
|
||||
apiVersion = "1.3"
|
||||
}
|
||||
}
|
||||
|
||||
sourceSets {
|
||||
"main" { projectDefault() }
|
||||
"test" {}
|
||||
|
||||
@@ -170,7 +170,7 @@ class CompilerDaemonTest : KotlinIntegrationTestBase() {
|
||||
val opts2 = configureDaemonJVMOptions(inheritMemoryLimits = false, inheritAdditionalProperties = false, inheritOtherJvmOptions = false)
|
||||
assertEquals("300m", opts2.maxMemory)
|
||||
assertEquals( -1, DaemonJVMOptionsMemoryComparator().compare(opts, opts2))
|
||||
assertEquals("300m", listOf(opts, opts2).maxWith(DaemonJVMOptionsMemoryComparator())?.maxMemory)
|
||||
assertEquals("300m", listOf(opts, opts2).maxWithOrNull(DaemonJVMOptionsMemoryComparator())?.maxMemory)
|
||||
|
||||
val myXmxParam = ManagementFactory.getRuntimeMXBean().inputArguments.first { it.startsWith("-Xmx") }
|
||||
TestCase.assertNotNull(myXmxParam)
|
||||
|
||||
+1
-1
@@ -244,7 +244,7 @@ class CompilerDaemonTest : KotlinIntegrationTestBase() {
|
||||
configureDaemonJVMOptions(inheritMemoryLimits = false, inheritAdditionalProperties = false, inheritOtherJvmOptions = false)
|
||||
assertEquals("300m", opts2.maxMemory)
|
||||
assertEquals(-1, DaemonJVMOptionsMemoryComparator().compare(opts, opts2))
|
||||
assertEquals("300m", listOf(opts, opts2).maxWith(DaemonJVMOptionsMemoryComparator())?.maxMemory)
|
||||
assertEquals("300m", listOf(opts, opts2).maxWithOrNull(DaemonJVMOptionsMemoryComparator())?.maxMemory)
|
||||
|
||||
val myXmxParam = ManagementFactory.getRuntimeMXBean().inputArguments.first { it.startsWith("-Xmx") }
|
||||
TestCase.assertNotNull(myXmxParam)
|
||||
|
||||
+1
-1
@@ -229,7 +229,7 @@ class ConnectionsTest : KotlinIntegrationTestBase() {
|
||||
|
||||
private fun expectNewDaemon(serverType: ServerType, extraAction: (CompileServiceAsync) -> Unit = {}) = expectDaemon(
|
||||
getDaemons = ::getNewDaemonsOrAsyncWrappers,
|
||||
chooseDaemon = { daemons -> daemons.maxWith(comparator)!!.daemon },
|
||||
chooseDaemon = { daemons -> daemons.maxWithOrNull(comparator)!!.daemon },
|
||||
getInfo = { d -> runBlocking { d.getDaemonInfo() } },
|
||||
registerClient = { d -> runBlocking { d.registerClient(generateClient()) } },
|
||||
port = { d -> d.serverPort },
|
||||
|
||||
@@ -1006,7 +1006,7 @@ class CompileServiceImpl(
|
||||
val comparator =
|
||||
compareByDescending<DaemonWithMetadata, DaemonJVMOptions>(DaemonJVMOptionsMemoryComparator(), { it.jvmOptions })
|
||||
.thenBy(FileAgeComparator()) { it.runFile }
|
||||
aliveWithOpts.maxWith(comparator)?.let { bestDaemonWithMetadata ->
|
||||
aliveWithOpts.maxWithOrNull(comparator)?.let { bestDaemonWithMetadata ->
|
||||
val fattestOpts = bestDaemonWithMetadata.jvmOptions
|
||||
if (fattestOpts memorywiseFitsInto daemonJVMOptions && FileAgeComparator().compare(
|
||||
bestDaemonWithMetadata.runFile,
|
||||
|
||||
+1
-1
@@ -496,7 +496,7 @@ class CompileServiceServerSideImpl(
|
||||
}
|
||||
.thenBy(FileAgeComparator()) { it.runFile }
|
||||
.thenBy { it.daemon.serverPort }
|
||||
aliveWithOpts.maxWith(comparator)?.let { bestDaemonWithMetadata ->
|
||||
aliveWithOpts.maxWithOrNull(comparator)?.let { bestDaemonWithMetadata ->
|
||||
val fattestOpts = bestDaemonWithMetadata.jvmOptions
|
||||
if (fattestOpts memorywiseFitsInto daemonJVMOptions && FileAgeComparator().compare(
|
||||
bestDaemonWithMetadata.runFile,
|
||||
|
||||
Reference in New Issue
Block a user