Skip to content

Commit e7472f7

Browse files
authored
Fix benchmarks (#5841)
1 parent bb21996 commit e7472f7

File tree

3 files changed

+40
-4
lines changed

3 files changed

+40
-4
lines changed

benchmark/app/build.gradle.kts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ plugins {
55
id("com.android.application")
66
id("org.jetbrains.kotlin.android")
77
id("com.apollographql.apollo3")
8+
alias(libs.plugins.kotlin.compose)
89
}
910

1011
android {
@@ -43,10 +44,6 @@ android {
4344
buildFeatures {
4445
compose = true
4546
}
46-
47-
composeOptions {
48-
kotlinCompilerExtensionVersion = libs.versions.compose.compiler.get()
49-
}
5047
}
5148

5249
dependencies {

gradle/libraries.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -207,6 +207,7 @@ kotlin-jvm = { id = "org.jetbrains.kotlin.jvm", version.ref = "kotlin-plugin" }
207207
kotlin-android = { id = "org.jetbrains.kotlin.android", version.ref = "kotlin-plugin" }
208208
kotlin-android-min = { id = "org.jetbrains.kotlin.android", version.ref = "kotlin-plugin-min" }
209209
kotlin-android-max = { id = "org.jetbrains.kotlin.android", version.ref = "kotlin-plugin-max" }
210+
kotlin-compose = { id = "org.jetbrains.kotlin.plugin.compose", version.ref = "kotlin-plugin" }
210211
kotlin-jvm-min = { id = "org.jetbrains.kotlin.jvm", version.ref = "kotlin-plugin-min" }
211212
kotlin-multiplatform = { id = "org.jetbrains.kotlin.multiplatform", version.ref = "kotlin-plugin" }
212213
android-application = { id = "com.android.application", version.ref = "android-plugin" }

libraries/apollo-normalized-cache-api-incubating/src/commonMain/kotlin/com/apollographql/apollo3/cache/normalized/api/OperationCacheExtensions.kt

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,25 @@ fun <D : Executable.Data> Executable<D>.normalize(
3838
.normalize(writer.root() as Map<String, Any?>, rootField().selections, rootField().type.rawType())
3939
}
4040

41+
@JvmOverloads
42+
fun <D : Executable.Data> Executable<D>.readDataFromCache(
43+
customScalarAdapters: CustomScalarAdapters,
44+
cache: ReadOnlyNormalizedCache,
45+
cacheResolver: CacheResolver,
46+
cacheHeaders: CacheHeaders,
47+
fieldNameGenerator: FieldNameGenerator = DefaultFieldNameGenerator,
48+
): D {
49+
val variables = variables(customScalarAdapters, true)
50+
return readInternal(
51+
cacheKey = CacheKey.rootKey(),
52+
cache = cache,
53+
cacheResolver = cacheResolver,
54+
cacheHeaders = cacheHeaders,
55+
variables = variables,
56+
fieldNameGenerator = fieldNameGenerator,
57+
).toData(adapter(), customScalarAdapters, variables)
58+
}
59+
4160
@JvmOverloads
4261
fun <D : Executable.Data> Executable<D>.readDataFromCache(
4362
cacheKey: CacheKey,
@@ -58,6 +77,25 @@ fun <D : Executable.Data> Executable<D>.readDataFromCache(
5877
).toData(adapter(), customScalarAdapters, variables)
5978
}
6079

80+
@JvmOverloads
81+
fun <D : Executable.Data> Executable<D>.readDataFromCache(
82+
customScalarAdapters: CustomScalarAdapters,
83+
cache: ReadOnlyNormalizedCache,
84+
cacheResolver: ApolloResolver,
85+
cacheHeaders: CacheHeaders,
86+
fieldNameGenerator: FieldNameGenerator = DefaultFieldNameGenerator,
87+
): D {
88+
val variables = variables(customScalarAdapters, true)
89+
return readInternal(
90+
cacheKey = CacheKey.rootKey(),
91+
cache = cache,
92+
cacheResolver = cacheResolver,
93+
cacheHeaders = cacheHeaders,
94+
variables = variables,
95+
fieldNameGenerator = fieldNameGenerator,
96+
).toData(adapter(), customScalarAdapters, variables)
97+
}
98+
6199
@JvmOverloads
62100
fun <D : Executable.Data> Executable<D>.readDataFromCache(
63101
cacheKey: CacheKey,

0 commit comments

Comments
 (0)