Skip to content

Commit

Permalink
Bump Kotlin and ktlint
Browse files Browse the repository at this point in the history
Signed-off-by: Matt Ramotar <[email protected]>
  • Loading branch information
matt-ramotar committed Jun 10, 2024
1 parent cc39941 commit 2460b30
Show file tree
Hide file tree
Showing 126 changed files with 18,786 additions and 3,613 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ captures/
# Keystore files
*.jks

store/kover
**/kover/html/
*.podspec
.kotlin/
yarn.lock
2 changes: 1 addition & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
plugins {
id("org.jlleitschuh.gradle.ktlint") version "11.0.0"
alias(libs.plugins.ktlint)
id("com.diffplug.spotless") version "6.4.1"
}

Expand Down
11 changes: 0 additions & 11 deletions cache/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
import com.vanniktech.maven.publish.SonatypeHost.S01
import org.jetbrains.dokka.gradle.DokkaTask
import org.jetbrains.kotlin.gradle.targets.js.dsl.ExperimentalWasmDsl
import org.jetbrains.kotlin.gradle.targets.js.nodejs.NodeJsRootExtension
import org.jetbrains.kotlin.gradle.targets.js.npm.tasks.KotlinNpmInstallTask

plugins {
kotlin("multiplatform")
Expand Down Expand Up @@ -127,12 +125,3 @@ koverMerged {
onCheck.set(true)
}
}

// See https://youtrack.jetbrains.com/issue/KT-63014
rootProject.the<NodeJsRootExtension>().apply {
nodeVersion = "21.0.0-v8-canary20231024d0ddc81258"
nodeDownloadBaseUrl = "https://nodejs.org/download/v8-canary"
}
tasks.withType<KotlinNpmInstallTask>().configureEach {
args.add("--ignore-engines")
}
24 changes: 24 additions & 0 deletions cache/config/ktlint/baseline.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<?xml version="1.0" encoding="utf-8"?>
<baseline version="1.0">
<file name="src/commonMain/kotlin/org/mobilenativefoundation/store/cache5/LocalCache.kt">
<error line="240" column="9" source="standard:no-consecutive-comments" />
<error line="367" column="9" source="standard:no-consecutive-comments" />
<error line="396" column="9" source="standard:no-consecutive-comments" />
<error line="399" column="9" source="standard:no-consecutive-comments" />
<error line="408" column="9" source="standard:no-consecutive-comments" />
<error line="417" column="9" source="standard:no-consecutive-comments" />
<error line="428" column="9" source="standard:no-consecutive-comments" />
<error line="431" column="9" source="standard:no-consecutive-comments" />
<error line="440" column="9" source="standard:no-consecutive-comments" />
<error line="449" column="9" source="standard:no-consecutive-comments" />
<error line="508" column="30" source="standard:discouraged-comment-location" />
<error line="628" column="5" source="standard:no-consecutive-comments" />
<error line="640" column="5" source="standard:no-consecutive-comments" />
<error line="708" column="9" source="standard:no-consecutive-comments" />
<error line="1466" column="13" source="standard:no-consecutive-comments" />
<error line="1873" column="9" source="standard:no-consecutive-comments" />
</file>
<file name="src/commonMain/kotlin/org/mobilenativefoundation/store/cache5/StoreMultiCache.kt">
<error line="15" column="1" source="standard:max-line-length" />
</file>
</baseline>
2,545 changes: 2,545 additions & 0 deletions cache/kover/coverage.xml

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,10 @@ interface Cache<Key : Any, Value : Any> {
* @throws UncheckedExecutionException If an unchecked exception was thrown while loading the value.
* @throws ExecutionError If an error was thrown while loading the value.
*/
fun getOrPut(key: Key, valueProducer: () -> Value): Value
fun getOrPut(
key: Key,
valueProducer: () -> Value,
): Value

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

/**
* Copies all of the mappings from the specified map to the cache. The effect of this call is
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,43 +19,52 @@ class CacheBuilder<Key : Any, Output : Any> {
internal var ticker: Ticker? = null
private set

fun concurrencyLevel(producer: () -> Int): CacheBuilder<Key, Output> = apply {
concurrencyLevel = producer.invoke()
}

fun maximumSize(maximumSize: Long): CacheBuilder<Key, Output> = apply {
if (maximumSize < 0) {
throw IllegalArgumentException("Maximum size must be non-negative.")
fun concurrencyLevel(producer: () -> Int): CacheBuilder<Key, Output> =
apply {
concurrencyLevel = producer.invoke()
}
this.maximumSize = maximumSize
}

fun expireAfterAccess(duration: Duration): CacheBuilder<Key, Output> = apply {
if (duration.isNegative()) {
throw IllegalArgumentException("Duration must be non-negative.")
fun maximumSize(maximumSize: Long): CacheBuilder<Key, Output> =
apply {
if (maximumSize < 0) {
throw IllegalArgumentException("Maximum size must be non-negative.")
}
this.maximumSize = maximumSize
}
expireAfterAccess = duration
}

fun expireAfterWrite(duration: Duration): CacheBuilder<Key, Output> = apply {
if (duration.isNegative()) {
throw IllegalArgumentException("Duration must be non-negative.")
fun expireAfterAccess(duration: Duration): CacheBuilder<Key, Output> =
apply {
if (duration.isNegative()) {
throw IllegalArgumentException("Duration must be non-negative.")
}
expireAfterAccess = duration
}
expireAfterWrite = duration
}

fun ticker(ticker: Ticker): CacheBuilder<Key, Output> = apply {
this.ticker = ticker
}
fun expireAfterWrite(duration: Duration): CacheBuilder<Key, Output> =
apply {
if (duration.isNegative()) {
throw IllegalArgumentException("Duration must be non-negative.")
}
expireAfterWrite = duration
}

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

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

this.maximumWeight = maximumWeight
this.weigher = weigher
}

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

0 comments on commit 2460b30

Please sign in to comment.