Skip to content

Commit ff699fd

Browse files
authored
Add a TeamCity configuration to automatically check if the timezone database or the list of WIndows mappings were updated (#513)
1 parent 06b389b commit ff699fd

File tree

2 files changed

+75
-6
lines changed

2 files changed

+75
-6
lines changed

.teamcity/additionalConfiguration.kt

Lines changed: 75 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,16 @@
33
* Use of this source code is governed by the Apache 2.0 License that can be found in the LICENSE.txt file.
44
*/
55

6+
import jetbrains.buildServer.configs.kotlin.BuildType
67
import jetbrains.buildServer.configs.kotlin.DslContext
78
import jetbrains.buildServer.configs.kotlin.Project
89
import jetbrains.buildServer.configs.kotlin.buildFeatures.commitStatusPublisher
10+
import jetbrains.buildServer.configs.kotlin.buildFeatures.notifications
11+
import jetbrains.buildServer.configs.kotlin.buildSteps.gradle
12+
import jetbrains.buildServer.configs.kotlin.buildSteps.script
13+
import jetbrains.buildServer.configs.kotlin.toId
14+
import jetbrains.buildServer.configs.kotlin.triggers.schedule
15+
import jetbrains.buildServer.configs.kotlin.vcs.GitVcsRoot
916

1017
fun Project.additionalConfiguration() {
1118
knownBuilds.buildAll.features {
@@ -19,4 +26,71 @@ fun Project.additionalConfiguration() {
1926
}
2027
}
2128
}
22-
}
29+
30+
vcsRoot(EggertTzRepo)
31+
32+
BuildType {
33+
id("Check_Updates")
34+
name = "Check for timezone database updates"
35+
description = "Queries the Internet to see if the timezone data was updated"
36+
37+
vcs {
38+
root(DslContext.settingsRoot)
39+
root(EggertTzRepo, "+:. => tz")
40+
}
41+
42+
steps {
43+
script {
44+
name = "Check if a new version of the timezone database is present"
45+
id = "Check_if_a_new_version_of_the_timezone_database_is_present"
46+
scriptContent = """
47+
set -efu
48+
latest_tag=$(git -C tz/ describe --abbrev=0 --tags)
49+
current_tag=$(grep tzdbVersion gradle.properties | cut -d= -f2)
50+
if [ "${'$'}latest_tag" != "${'$'}current_tag" ]; then
51+
printf "A new version of the timezone database is available: %s\n" "${'$'}latest_tag" >&2
52+
exit 1
53+
fi
54+
""".trimIndent()
55+
}
56+
gradle {
57+
name = "Check if the Windows names need updating"
58+
id = "Check_if_the_Windows_names_need_updating"
59+
tasks = "downloadWindowsZonesMapping"
60+
jdkHome = "%env.JDK_18_x64%"
61+
}
62+
}
63+
64+
triggers {
65+
schedule {
66+
schedulingPolicy = daily {
67+
hour = 1
68+
minute = 50
69+
}
70+
triggerBuild = always()
71+
}
72+
}
73+
74+
features {
75+
notifications {
76+
notifierSettings = slackNotifier {
77+
connection = "PROJECT_EXT_51"
78+
sendTo = "#kotlin-lib-team"
79+
messageFormat = simpleMessageFormat()
80+
}
81+
buildFailed = true
82+
firstFailureAfterSuccess = true
83+
}
84+
}
85+
86+
requirements {
87+
doesNotContain("teamcity.agent.jvm.os.name", "Windows")
88+
}
89+
}.also { buildType(it) }
90+
}
91+
92+
object EggertTzRepo : GitVcsRoot({
93+
name = "Timezone database repository"
94+
url = "https://github.com/eggert/tz"
95+
branch = "refs/heads/main"
96+
})

core/windows/src/internal/WindowsZoneNames.kt

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,6 @@ internal val standardToWindows: Map<String, String> = mutableMapOf(
225225
"Asia/Brunei" to "Singapore Standard Time",
226226
"Asia/Calcutta" to "India Standard Time",
227227
"Asia/Chita" to "Transbaikal Standard Time",
228-
"Asia/Choibalsan" to "Ulaanbaatar Standard Time",
229228
"Asia/Colombo" to "Sri Lanka Standard Time",
230229
"Asia/Damascus" to "Syria Standard Time",
231230
"Asia/Dhaka" to "Bangladesh Standard Time",
@@ -311,8 +310,6 @@ internal val standardToWindows: Map<String, String> = mutableMapOf(
311310
"Australia/Melbourne" to "AUS Eastern Standard Time",
312311
"Australia/Perth" to "W. Australia Standard Time",
313312
"Australia/Sydney" to "AUS Eastern Standard Time",
314-
"CST6CDT" to "Central Standard Time",
315-
"EST5EDT" to "Eastern Standard Time",
316313
"Etc/GMT" to "UTC",
317314
"Etc/GMT+1" to "Cape Verde Standard Time",
318315
"Etc/GMT+10" to "Hawaiian Standard Time",
@@ -410,8 +407,6 @@ internal val standardToWindows: Map<String, String> = mutableMapOf(
410407
"Indian/Mauritius" to "Mauritius Standard Time",
411408
"Indian/Mayotte" to "E. Africa Standard Time",
412409
"Indian/Reunion" to "Mauritius Standard Time",
413-
"MST7MDT" to "Mountain Standard Time",
414-
"PST8PDT" to "Pacific Standard Time",
415410
"Pacific/Apia" to "Samoa Standard Time",
416411
"Pacific/Auckland" to "New Zealand Standard Time",
417412
"Pacific/Bougainville" to "Bougainville Standard Time",

0 commit comments

Comments
 (0)