Skip to content

Commit

Permalink
Update kotlin and gradle
Browse files Browse the repository at this point in the history
  • Loading branch information
kubovy committed Feb 27, 2021
1 parent b69e635 commit 5512dc9
Show file tree
Hide file tree
Showing 12 changed files with 58 additions and 59 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -250,37 +250,38 @@ class AlertManagerService(override val controller: ControllerInterface, config:
response: AlertManagerResponse,
labelConfigs: Collection<AlertManagerLabelConfig>,
status: Status? = null) = StatusItem(
id = "${config.uuid}-${response.fingerprint}",
serviceId = config.uuid,
configIds = labelConfigs.map { it.configTitle }.toMutableList(),
priority = labelConfigs.maxBy { it.priority }?.priority ?: config.priority,
status = status ?: labelConfigs.maxBy { it.status }?.status ?: Status.UNKNOWN,
title = title,
detail = config.descriptionRefs.mapNotNull { response.annotations[it] ?: response.labels[it] }.firstOrNull()
?: "Annotations:"
+ response.annotations.map { (k, v) -> "\t${k}: ${v}" }.joinToString("\n", "\n", "\n")
+ "Labels:"
+ response.labels.map { (k, v) -> "\t${k}: ${v}" }.joinToString("\n", "\n"),
labels = (response.labels + response.annotations)
.filterNot { (k, _) -> config.nameRefs.contains(k) }
.filterNot { (k, _) -> config.descriptionRefs.contains(k) }
.filter { (k, _) ->
config.labelFilter
.filterNot { it.startsWith("!") }
.let { it.isEmpty() || it.contains(k) }
}
.filter { (k, _) ->
config.labelFilter
.filter { it.startsWith("!") }
.map { it.removePrefix("!") }
.let { it.isEmpty() || !it.contains(k) }
},
link = response.generatorURL,
isRepeatable = true,
startedAt = try {
Instant.parse(response.startsAt)
} catch (e: DateTimeParseException) {
LOGGER.error(e.message, e)
Instant.now()
})
id = "${config.uuid}-${response.fingerprint}",
serviceId = config.uuid,
configIds = labelConfigs.map { it.configTitle }.toMutableList(),
priority = labelConfigs.maxByOrNull { it.priority }?.priority ?: config.priority,
status = status ?: labelConfigs.maxByOrNull { it.status }?.status ?: Status.UNKNOWN,
title = title,
detail = config.descriptionRefs.mapNotNull { response.annotations[it] ?: response.labels[it] }.firstOrNull()
?: "Annotations:"
+ response.annotations.map { (k, v) -> "\t${k}: ${v}" }.joinToString("\n", "\n", "\n")
+ "Labels:"
+ response.labels.map { (k, v) -> "\t${k}: ${v}" }.joinToString("\n", "\n"),
labels = (response.labels + response.annotations)
.filterNot { (k, _) -> config.nameRefs.contains(k) }
.filterNot { (k, _) -> config.descriptionRefs.contains(k) }
.filter { (k, _) ->
config.labelFilter
.filterNot { it.startsWith("!") }
.let { it.isEmpty() || it.contains(k) }
}
.filter { (k, _) ->
config.labelFilter
.filter { it.startsWith("!") }
.map { it.removePrefix("!") }
.let { it.isEmpty() || !it.contains(k) }
},
link = response.generatorURL,
isRepeatable = true,
startedAt = try {
Instant.parse(response.startsAt)
} catch (e: DateTimeParseException) {
LOGGER.error(e.message, e)
Instant.now()
}
)
}
Original file line number Diff line number Diff line change
Expand Up @@ -69,4 +69,4 @@ fun Collection<StatusItem>.topStatus(silencedIds: Collection<String>,
serviceReferences: Collection<NotifierServiceReference> = emptySet(),
includingChildren: Boolean = false) =
filter(silencedIds, minPriority, minStatus, serviceReferences, includingChildren)
.maxBy { it.status.ordinal * 100 + it.priority.ordinal }
.maxByOrNull { it.status.ordinal * 100 + it.priority.ordinal }
4 changes: 2 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile

plugins {
id 'org.jetbrains.kotlin.jvm' version '1.3.71'
id 'org.jetbrains.kotlin.jvm' version '1.4.10'
id 'de.undercouch.download' version '4.0.0'
id 'idea'
}
Expand Down Expand Up @@ -77,7 +77,7 @@ dependencies {
compile project(':notifications')
compile project(':system-tray')
// Kotlin
compile 'org.jetbrains.kotlin:kotlin-reflect:1.3.71'
compile 'org.jetbrains.kotlin:kotlin-reflect:1.4.10'
// Commons
compile 'commons-cli:commons-cli:1.4'
// Logging
Expand Down
2 changes: 1 addition & 1 deletion data/build.gradle
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
dependencies {
compile project(':javafx-utils')
// Kotlin
implementation 'org.jetbrains.kotlin:kotlin-reflect:1.3.71'
implementation 'org.jetbrains.kotlin:kotlin-reflect:1.4.10'
// JavaFX
compileOnly 'org.openjfx:javafx-base:11'
// Jackson
Expand Down
2 changes: 1 addition & 1 deletion deployment-case/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@ dependencies {
implementation 'com.hubspot.jinjava:jinjava:2.5.2'
// Testing
testImplementation 'junit:junit:4.13'
testImplementation "org.jetbrains.kotlin:kotlin-test-junit:1.3.71"
testImplementation "org.jetbrains.kotlin:kotlin-test-junit:1.4.10"
}
Original file line number Diff line number Diff line change
Expand Up @@ -82,13 +82,13 @@ class DeploymentTask(configuration: Configuration,
private val service = retrofit?.create(JenkinsRestService::class.java)

private fun getPreviousCompletedBuildNumber() = service
?.buildStatus(jobName)
?.execute()
?.body()
?.elements()
?.asSequence()
?.map { it.get("id").asInt(0) to it.get("state").asText() }
?.maxBy { (buildNumber, _) -> buildNumber }
?.buildStatus(jobName)
?.execute()
?.body()
?.elements()
?.asSequence()
?.map { it.get("id").asInt(0) to it.get("state").asText() }
?.maxByOrNull { (buildNumber, _) -> buildNumber }
?.let { (buildNumber, state) -> if (state == "in_progress") IN_PROGRESS else buildNumber }
?: NOT_RUN_YET

Expand All @@ -97,9 +97,9 @@ class DeploymentTask(configuration: Configuration,
val response = service?.buildStatus(jobName)?.execute()
val body = response?.body()
val lastBuildNumber = body?.elements()
?.asSequence()
?.map { it.get("id").asInt(0) }
?.max()
?.asSequence()
?.map { it.get("id").asInt(0) }
?.maxOrNull()
LOGGER.info("Last build number: ${lastBuildNumber}, previous build number: ${previousBuildNumber}")
if (lastBuildNumber != previousBuildNumber) {
triggerUpdate("in_progress")
Expand Down
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#Mon Mar 30 18:57:34 CEST 2020
distributionUrl=https\://services.gradle.org/distributions/gradle-5.2.1-all.zip
distributionUrl=https://services.gradle.org/distributions/gradle-6.8.1-all.zip
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStorePath=wrapper/dists
Expand Down
2 changes: 1 addition & 1 deletion javafx-utils
Submodule javafx-utils updated 1 files
+1 −1 build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -228,10 +228,10 @@ class JiraService(override val controller: ControllerInterface, config: JiraConf

private val JiraIssue.status: Status
get() = fields?.status
?.let { listOf(it.name) + it.statusCategory.let { c -> listOf(c?.key, c?.name, c?.colorName) } }
?.filterNotNull()
?.mapNotNull { config.statusMapping[it] }
?.maxBy { it.ordinal }
?.let { listOf(it.name) + it.statusCategory.let { c -> listOf(c?.key, c?.name, c?.colorName) } }
?.filterNotNull()
?.mapNotNull { config.statusMapping[it] }
?.maxByOrNull { it.ordinal }
?: fields?.issuetype?.name?.let { config.statusMapping[it] }
?: Status.UNKNOWN

Expand Down
2 changes: 1 addition & 1 deletion kotlin-utils
Submodule kotlin-utils updated 1 files
+2 −2 build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -226,9 +226,7 @@ class TabController {
columnAlertsTitle.widthProperty().addListener { _, _, _ -> controller.saveConfig() }

columnAlertsService.prefWidthProperty().bindBidirectional(config.alertServiceWidthProperty)
columnAlertsService.widthProperty().addListener { _, _, value ->
controller.saveConfig()
}
columnAlertsService.widthProperty().addListener { _, _, _ -> controller.saveConfig() }

columnAlertsConfig.prefWidthProperty().bindBidirectional(config.alertConfigWidthProperty)
columnAlertsConfig.widthProperty().addListener { _, _, _ -> controller.saveConfig() }
Expand Down
2 changes: 1 addition & 1 deletion serial-communication

0 comments on commit 5512dc9

Please sign in to comment.