Skip to content

Commit 7c284ec

Browse files
committed
Bump to 17 and fix formatting
Signed-off-by: mramotar <[email protected]>
1 parent 3c72e4c commit 7c284ec

File tree

155 files changed

+4635
-3946
lines changed

Some content is hidden

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

155 files changed

+4635
-3946
lines changed

.github/workflows/.ci_test_and_publish.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ jobs:
2020
uses: actions/setup-java@v2
2121
with:
2222
distribution: zulu
23-
java-version: 11
23+
java-version: 17
2424

2525
- name: Upload Artifacts
2626
run: ./gradlew publishAllPublicationsToMavenCentralRepository --no-daemon --no-parallel
@@ -56,7 +56,7 @@ jobs:
5656
uses: actions/setup-java@v2
5757
with:
5858
distribution: zulu
59-
java-version: 11
59+
java-version: 17
6060
- name: Run tests
6161
run: ./gradlew check --rerun-tasks --stacktrace
6262
- name: Upload code coverage

.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,4 +49,6 @@ captures/
4949

5050
store/kover
5151
*.podspec
52-
yarn.lock
52+
yarn.lock
53+
54+
*/kover

build.gradle.kts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
plugins {
2-
id("org.jlleitschuh.gradle.ktlint") version "11.0.0"
2+
id("org.jlleitschuh.gradle.ktlint") version "12.1.0"
33
id("com.diffplug.spotless") version "6.4.1"
44
}
55

@@ -49,13 +49,13 @@ subprojects {
4949
tasks {
5050
withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile> {
5151
kotlinOptions {
52-
jvmTarget = "11"
52+
jvmTarget = "17"
5353
}
5454
}
5555

5656
withType<JavaCompile>().configureEach {
57-
sourceCompatibility = JavaVersion.VERSION_11.name
58-
targetCompatibility = JavaVersion.VERSION_11.name
57+
sourceCompatibility = JavaVersion.VERSION_17.name
58+
targetCompatibility = JavaVersion.VERSION_17.name
5959
}
6060
}
6161

cache/build.gradle.kts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ kotlin {
7070
}
7171
}
7272

73-
jvmToolchain(11)
73+
jvmToolchain(17)
7474
}
7575

7676
android {
@@ -92,8 +92,8 @@ android {
9292
}
9393

9494
compileOptions {
95-
sourceCompatibility = JavaVersion.VERSION_11
96-
targetCompatibility = JavaVersion.VERSION_11
95+
sourceCompatibility = JavaVersion.VERSION_17
96+
targetCompatibility = JavaVersion.VERSION_17
9797
}
9898
}
9999

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)