Skip to content

Commit 3f232e7

Browse files
committed
Run ktlintFormat
Signed-off-by: mramotar <[email protected]>
1 parent b7aa329 commit 3f232e7

File tree

118 files changed

+4208
-3650
lines changed

Some content is hidden

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

118 files changed

+4208
-3650
lines changed

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,6 @@ captures/
4747
# Keystore files
4848
*.jks
4949

50-
store/kover
50+
*/kover
5151
*.podspec
5252
yarn.lock

build.gradle.kts

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
import org.jetbrains.kotlin.gradle.targets.js.nodejs.NodeJsRootExtension
2+
import org.jetbrains.kotlin.gradle.targets.js.nodejs.NodeJsRootPlugin
3+
import org.jetbrains.kotlin.gradle.targets.js.npm.tasks.KotlinNpmInstallTask
4+
15
plugins {
26
id("org.jlleitschuh.gradle.ktlint") version "11.0.0"
37
id("com.diffplug.spotless") version "6.4.1"
@@ -49,15 +53,26 @@ subprojects {
4953
tasks {
5054
withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile> {
5155
kotlinOptions {
52-
jvmTarget = "11"
56+
jvmTarget = "17"
5357
}
5458
}
5559

5660
withType<JavaCompile>().configureEach {
57-
sourceCompatibility = JavaVersion.VERSION_11.name
58-
targetCompatibility = JavaVersion.VERSION_11.name
61+
sourceCompatibility = JavaVersion.VERSION_17.name
62+
targetCompatibility = JavaVersion.VERSION_17.name
5963
}
6064
}
6165

6266
// Workaround for https://youtrack.jetbrains.com/issue/KT-62040
6367
tasks.getByName("wrapper")
68+
69+
// Workaround for https://youtrack.jetbrains.com/issue/KT-63014
70+
plugins.withType<NodeJsRootPlugin> {
71+
extensions.configure(NodeJsRootExtension::class) {
72+
nodeVersion = "21.0.0-v8-canary20231019bd785be450"
73+
nodeDownloadBaseUrl = "https://nodejs.org/download/v8-canary"
74+
}
75+
tasks.withType<KotlinNpmInstallTask> {
76+
args.add("--ignore-engines")
77+
}
78+
}

cache/build.gradle.kts

Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@
33
import com.vanniktech.maven.publish.SonatypeHost.S01
44
import org.jetbrains.dokka.gradle.DokkaTask
55
import org.jetbrains.kotlin.gradle.targets.js.dsl.ExperimentalWasmDsl
6-
import org.jetbrains.kotlin.gradle.targets.js.nodejs.NodeJsRootExtension
7-
import org.jetbrains.kotlin.gradle.targets.js.npm.tasks.KotlinNpmInstallTask
86

97
plugins {
108
kotlin("multiplatform")
@@ -70,7 +68,7 @@ kotlin {
7068
}
7169
}
7270

73-
jvmToolchain(11)
71+
jvmToolchain(17)
7472
}
7573

7674
android {
@@ -92,8 +90,8 @@ android {
9290
}
9391

9492
compileOptions {
95-
sourceCompatibility = JavaVersion.VERSION_11
96-
targetCompatibility = JavaVersion.VERSION_11
93+
sourceCompatibility = JavaVersion.VERSION_17
94+
targetCompatibility = JavaVersion.VERSION_17
9795
}
9896
}
9997

@@ -127,12 +125,3 @@ koverMerged {
127125
onCheck.set(true)
128126
}
129127
}
130-
131-
// See https://youtrack.jetbrains.com/issue/KT-63014
132-
rootProject.the<NodeJsRootExtension>().apply {
133-
nodeVersion = "21.0.0-v8-canary20231024d0ddc81258"
134-
nodeDownloadBaseUrl = "https://nodejs.org/download/v8-canary"
135-
}
136-
tasks.withType<KotlinNpmInstallTask>().configureEach {
137-
args.add("--ignore-engines")
138-
}

cache/src/commonMain/kotlin/org/mobilenativefoundation/store/cache5/Cache.kt

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,10 @@ interface Cache<Key : Any, Value : Any> {
1414
* @throws UncheckedExecutionException If an unchecked exception was thrown while loading the value.
1515
* @throws ExecutionError If an error was thrown while loading the value.
1616
*/
17-
fun getOrPut(key: Key, valueProducer: () -> Value): Value
17+
fun getOrPut(
18+
key: Key,
19+
valueProducer: () -> Value,
20+
): Value
1821

1922
/**
2023
* @return Map of the [Value] associated with each [Key] in [keys]. Returned map only contains entries already present in the cache.
@@ -26,7 +29,10 @@ interface Cache<Key : Any, Value : Any> {
2629
* If the cache previously contained a value associated with [key], the old value is replaced by [value].
2730
* Prefer [getOrPut] when using the conventional "If cached, then return. Otherwise create, cache, and then return" pattern.
2831
*/
29-
fun put(key: Key, value: Value)
32+
fun put(
33+
key: Key,
34+
value: Value,
35+
)
3036

3137
/**
3238
* Copies all of the mappings from the specified map to the cache. The effect of this call is

cache/src/commonMain/kotlin/org/mobilenativefoundation/store/cache5/CacheBuilder.kt

Lines changed: 37 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -19,43 +19,52 @@ class CacheBuilder<Key : Any, Output : Any> {
1919
internal var ticker: Ticker? = null
2020
private set
2121

22-
fun concurrencyLevel(producer: () -> Int): CacheBuilder<Key, Output> = apply {
23-
concurrencyLevel = producer.invoke()
24-
}
25-
26-
fun maximumSize(maximumSize: Long): CacheBuilder<Key, Output> = apply {
27-
if (maximumSize < 0) {
28-
throw IllegalArgumentException("Maximum size must be non-negative.")
22+
fun concurrencyLevel(producer: () -> Int): CacheBuilder<Key, Output> =
23+
apply {
24+
concurrencyLevel = producer.invoke()
2925
}
30-
this.maximumSize = maximumSize
31-
}
3226

33-
fun expireAfterAccess(duration: Duration): CacheBuilder<Key, Output> = apply {
34-
if (duration.isNegative()) {
35-
throw IllegalArgumentException("Duration must be non-negative.")
27+
fun maximumSize(maximumSize: Long): CacheBuilder<Key, Output> =
28+
apply {
29+
if (maximumSize < 0) {
30+
throw IllegalArgumentException("Maximum size must be non-negative.")
31+
}
32+
this.maximumSize = maximumSize
3633
}
37-
expireAfterAccess = duration
38-
}
3934

40-
fun expireAfterWrite(duration: Duration): CacheBuilder<Key, Output> = apply {
41-
if (duration.isNegative()) {
42-
throw IllegalArgumentException("Duration must be non-negative.")
35+
fun expireAfterAccess(duration: Duration): CacheBuilder<Key, Output> =
36+
apply {
37+
if (duration.isNegative()) {
38+
throw IllegalArgumentException("Duration must be non-negative.")
39+
}
40+
expireAfterAccess = duration
4341
}
44-
expireAfterWrite = duration
45-
}
4642

47-
fun ticker(ticker: Ticker): CacheBuilder<Key, Output> = apply {
48-
this.ticker = ticker
49-
}
43+
fun expireAfterWrite(duration: Duration): CacheBuilder<Key, Output> =
44+
apply {
45+
if (duration.isNegative()) {
46+
throw IllegalArgumentException("Duration must be non-negative.")
47+
}
48+
expireAfterWrite = duration
49+
}
5050

51-
fun weigher(maximumWeight: Long, weigher: Weigher<Key, Output>): CacheBuilder<Key, Output> = apply {
52-
if (maximumWeight < 0) {
53-
throw IllegalArgumentException("Maximum weight must be non-negative.")
51+
fun ticker(ticker: Ticker): CacheBuilder<Key, Output> =
52+
apply {
53+
this.ticker = ticker
5454
}
5555

56-
this.maximumWeight = maximumWeight
57-
this.weigher = weigher
58-
}
56+
fun weigher(
57+
maximumWeight: Long,
58+
weigher: Weigher<Key, Output>,
59+
): CacheBuilder<Key, Output> =
60+
apply {
61+
if (maximumWeight < 0) {
62+
throw IllegalArgumentException("Maximum weight must be non-negative.")
63+
}
64+
65+
this.maximumWeight = maximumWeight
66+
this.weigher = weigher
67+
}
5968

6069
fun build(): Cache<Key, Output> {
6170
if (maximumSize != -1L && weigher != null) {

0 commit comments

Comments
 (0)