Skip to content

Commit f270838

Browse files
committed
Merge branch 'master' into java-serialization-fixes
2 parents 39f5dc4 + 89fd818 commit f270838

File tree

72 files changed

+2211
-189
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

72 files changed

+2211
-189
lines changed

.teamcity/additionalConfiguration.kt

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

README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -475,7 +475,9 @@ and after that add the following initialization code in your project:
475475
@JsNonModule
476476
external object JsJodaTimeZoneModule
477477

478-
private val jsJodaTz = JsJodaTimeZoneModule
478+
@OptIn(ExperimentalJsExport::class)
479+
@JsExport
480+
val jsJodaTz = JsJodaTimeZoneModule
479481
```
480482

481483
#### Note about time zones in Wasm/JS

core/api/kotlinx-datetime.api

Lines changed: 174 additions & 0 deletions
Large diffs are not rendered by default.

core/api/kotlinx-datetime.klib.api

Lines changed: 158 additions & 0 deletions
Large diffs are not rendered by default.

core/build.gradle.kts

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import java.net.URL
44
import javax.xml.parsers.DocumentBuilderFactory
55
import java.io.ByteArrayOutputStream
66
import java.io.PrintWriter
7-
import org.jetbrains.dokka.gradle.AbstractDokkaLeafTask
87
import org.jetbrains.kotlin.gradle.ExperimentalKotlinGradlePluginApi
98
import org.jetbrains.kotlin.gradle.plugin.KotlinSourceSet
109
import org.jetbrains.kotlin.konan.target.Family
@@ -379,26 +378,31 @@ val downloadWindowsZonesMapping by tasks.registering {
379378
}
380379
}
381380

382-
tasks.withType<AbstractDokkaLeafTask>().configureEach {
383-
pluginsMapConfiguration.set(mapOf("org.jetbrains.dokka.base.DokkaBase" to """{ "templatesDir" : "${projectDir.toString().replace('\\', '/')}/dokka-templates" }"""))
381+
dokka {
382+
pluginsConfiguration.html {
383+
templatesDir.set(projectDir.resolve("dokka-templates"))
384+
}
385+
386+
dokkaPublications.html {
387+
failOnWarning.set(true)
388+
// Enum members and undocumented toString()
389+
suppressInheritedMembers.set(true)
390+
}
384391

385-
failOnWarning.set(true)
386392
dokkaSourceSets.configureEach {
387-
val testSourceSet = kotlin.sourceSets.named("${name.dropLast(4)}Test")
388-
samples.from(testSourceSet.map { it.kotlin.srcDirs })
393+
val platform = name.dropLast(4)
394+
samples.from("$platform/test")
389395

390396
// reportUndocumented.set(true) // much noisy output about `hashCode` and serializer encoders, decoders etc
391397
skipDeprecated.set(true)
392-
// Enum members and undocumented toString()
393-
suppressInheritedMembers.set(true)
394398
// hide the `internal` package, which, on JS, has public members generated by Dukat that would get mentioned
395399
perPackageOption {
396400
matchingRegex.set(".*\\.internal(\\..*)?")
397401
suppress.set(true)
398402
}
399403
sourceLink {
400404
localDirectory.set(rootDir)
401-
remoteUrl.set(URL("https://github.com/kotlin/kotlinx-datetime/tree/latest-release"))
405+
remoteUrl("https://github.com/kotlin/kotlinx-datetime/tree/latest-release")
402406
remoteLineSuffix.set("#L")
403407
}
404408
}

core/common/src/DateTimePeriod.kt

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,9 @@ import kotlinx.datetime.internal.*
99
import kotlinx.datetime.serializers.DatePeriodIso8601Serializer
1010
import kotlinx.datetime.serializers.DateTimePeriodIso8601Serializer
1111
import kotlinx.datetime.serializers.DatePeriodComponentSerializer
12+
import kotlinx.datetime.serializers.DatePeriodSerializer
1213
import kotlinx.datetime.serializers.DateTimePeriodComponentSerializer
14+
import kotlinx.datetime.serializers.DateTimePeriodSerializer
1315
import kotlin.math.*
1416
import kotlin.time.Duration
1517
import kotlinx.serialization.Serializable
@@ -63,13 +65,14 @@ import kotlinx.serialization.Serializable
6365
* `DateTimePeriod` can also be returned as the result of instant arithmetic operations (see [Instant.periodUntil]).
6466
*
6567
* Additionally, there are several `kotlinx-serialization` serializers for [DateTimePeriod]:
66-
* - [DateTimePeriodIso8601Serializer] for the ISO 8601 format;
68+
* - The default serializer, delegating to [toString] and [parse].
69+
* - [DateTimePeriodIso8601Serializer] for the ISO 8601 format.
6770
* - [DateTimePeriodComponentSerializer] for an object with components.
6871
*
6972
* @sample kotlinx.datetime.test.samples.DateTimePeriodSamples.construction
7073
* @sample kotlinx.datetime.test.samples.DateTimePeriodSamples.simpleParsingAndFormatting
7174
*/
72-
@Serializable(with = DateTimePeriodIso8601Serializer::class)
75+
@Serializable(with = DateTimePeriodSerializer::class)
7376
// TODO: could be error-prone without explicitly named params
7477
public sealed class DateTimePeriod {
7578
internal abstract val totalMonths: Long
@@ -430,7 +433,7 @@ public fun String.toDateTimePeriod(): DateTimePeriod = DateTimePeriod.parse(this
430433
*
431434
* @sample kotlinx.datetime.test.samples.DatePeriodSamples.simpleParsingAndFormatting
432435
*/
433-
@Serializable(with = DatePeriodIso8601Serializer::class)
436+
@Serializable(with = DatePeriodSerializer::class)
434437
public class DatePeriod internal constructor(
435438
internal override val totalMonths: Long,
436439
override val days: Int,

core/common/src/Instant.kt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,7 @@ package kotlinx.datetime
77

88
import kotlinx.datetime.format.*
99
import kotlinx.datetime.internal.*
10-
import kotlinx.datetime.serializers.InstantIso8601Serializer
11-
import kotlinx.datetime.serializers.InstantComponentSerializer
10+
import kotlinx.datetime.serializers.*
1211
import kotlinx.serialization.Serializable
1312
import kotlin.time.*
1413

@@ -189,12 +188,13 @@ import kotlin.time.*
189188
* ```
190189
*
191190
* Additionally, there are several `kotlinx-serialization` serializers for [Instant]:
191+
* - The default serializer, delegating to [toString] and [parse].
192192
* - [InstantIso8601Serializer] for the ISO 8601 extended format.
193193
* - [InstantComponentSerializer] for an object with components.
194194
*
195195
* @see LocalDateTime for a user-visible representation of moments in time in an unspecified time zone.
196196
*/
197-
@Serializable(with = InstantIso8601Serializer::class)
197+
@Serializable(with = InstantSerializer::class)
198198
public expect class Instant : Comparable<Instant> {
199199

200200
/**

core/common/src/LocalDate.kt

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ import kotlin.internal.*
5757
* See sample 4.
5858
*
5959
* Additionally, there are several `kotlinx-serialization` serializers for [LocalDate]:
60+
* - The default serializer, delegating to [toString] and [parse].
6061
* - [LocalDateIso8601Serializer] for the ISO 8601 extended format.
6162
* - [LocalDateComponentSerializer] for an object with components.
6263
*
@@ -65,7 +66,7 @@ import kotlin.internal.*
6566
* @sample kotlinx.datetime.test.samples.LocalDateSamples.simpleParsingAndFormatting
6667
* @sample kotlinx.datetime.test.samples.LocalDateSamples.customFormat
6768
*/
68-
@Serializable(with = LocalDateIso8601Serializer::class)
69+
@Serializable(with = LocalDateSerializer::class)
6970
public expect class LocalDate : Comparable<LocalDate> {
7071
public companion object {
7172
/**
@@ -246,6 +247,20 @@ public expect class LocalDate : Comparable<LocalDate> {
246247
*/
247248
public fun toEpochDays(): Long
248249

250+
/**
251+
* Creates a [LocalDateRange] from `this` to [that], inclusive.
252+
*
253+
* @sample kotlinx.datetime.test.samples.LocalDateRangeSamples.simpleRangeCreation
254+
*/
255+
public operator fun rangeTo(that: LocalDate): LocalDateRange
256+
257+
/**
258+
* Creates a [LocalDateRange] from `this` to [that], exclusive, i.e., from this to (that - 1 day)
259+
*
260+
* @sample kotlinx.datetime.test.samples.LocalDateRangeSamples.simpleRangeCreation
261+
*/
262+
public operator fun rangeUntil(that: LocalDate): LocalDateRange
263+
249264
/**
250265
* Compares `this` date with the [other] date.
251266
* Returns zero if this date represents the same day as the other (meaning they are equal to one other),

0 commit comments

Comments
 (0)