Skip to content

Commit 89fad7d

Browse files
BoDAnkaAnkaAnkaAnka
authored
Bump Kotlin to 2.1.0 (#6291)
* Add Kotlin Dev and Maven Central Snapshots repositories * Bump Kotlin to 2.1.0-Beta1 (cherry picked from commit 5cbb969) * Update yarn.lock * Bump agp * Add kotlinx-browser to wasm dependencies * Run Gradle LanguageVersion tests with Kotlin min version * Use kotlin-test 2.0 in apollo-compiler in order to not break generated code compilation with 1.9 * Prefix private fields with _ to workaround google/ksp#2135 * Bump Kotlin and KSP * Bump Kotlin and KSP * Bump Kotlin and KSP * Bump Kotlin and KSP * Bump Kotlin and KSP * Bump Kotlin and KSP * Bump Kotlin and KSP * Bump Kotlin and KSP * Bump Kotlin and KSP * Bump Kotlin and KSP * Bump Kotlin and KSP * Bump Kotlin and KSP * Bump Kotlin and KSP * Bump Kotlin and KSP * Use stable versions * Add a note about google/ksp#2135 * Revert android-plugin bump and avoid using options.release only on Android * [infra] Use same version as apiVersion for stdlib & friends (#6293) * Use same version as apiVersion for stdlib & friends See https://youtrack.jetbrains.com/issue/KT-58999/ * Do not conflict with KGP dependency handling * Keep JS stdlib aligned with the compiler * fixed parallel forks * Revert "fixed parallel forks" This reverts commit 479651f. * more heap size --------- Co-authored-by: Anka <runner@mac-1719540188453.local> Co-authored-by: Anka <runner@Mac-1730686884729.local> Co-authored-by: Anka <runner@Mac-1730901543745.local> Co-authored-by: Anka <runner@Mac-1731032005904.local> Co-authored-by: Anka <runner@Mac-1731117854774.local> Co-authored-by: Anka <runner@Mac-1731377555621.local> Co-authored-by: Anka <runner@Mac-1731575874743.local> Co-authored-by: Anka <runner@Mac-1731636688998.local> Co-authored-by: Anka <runner@Mac-1731723383296.local> Co-authored-by: Anka <runner@Mac-1731809340619.local> Co-authored-by: Anka <runner@Mac-1731896425358.local> Co-authored-by: Anka <runner@Mac-1732155547302.local> Co-authored-by: Anka <runner@Mac-1732328210301.local> Co-authored-by: Anka <runner@Mac-1732673814818.local> Co-authored-by: Anka <runner@Mac-1732759963402.local> Co-authored-by: Martin Bonnin <martin@mbonnin.net>
1 parent f52d13b commit 89fad7d

File tree

17 files changed

+155
-126
lines changed

17 files changed

+155
-126
lines changed

build-logic/src/main/kotlin/CompilerOptions.kt

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
21
import com.android.build.gradle.BaseExtension
32
import org.gradle.api.JavaVersion
43
import org.gradle.api.Project
4+
import org.gradle.api.artifacts.ExternalDependency
55
import org.gradle.api.plugins.JavaPluginExtension
66
import org.gradle.api.tasks.compile.JavaCompile
77
import org.gradle.api.tasks.testing.Test
@@ -29,6 +29,7 @@ fun KotlinCommonCompilerOptions.configure(target: Int, kotlinCompilerOptions: Ko
2929
// D8 can dex Java17 bytecode
3030
17
3131
}
32+
3233
else -> target
3334
}
3435

@@ -67,7 +68,7 @@ fun KotlinCommonCompilerOptions.configure(target: Int, kotlinCompilerOptions: Ko
6768
}
6869

6970
private fun Int.toJvmTarget(): JvmTarget {
70-
return when(this) {
71+
return when (this) {
7172
8 -> JvmTarget.JVM_1_8
7273
else -> JvmTarget.fromTarget(this.toString())
7374
}
@@ -107,14 +108,20 @@ val Project.androidExtensionOrNull: BaseExtension?
107108

108109
fun Project.configureJavaAndKotlinCompilers(jvmTarget: Int?, kotlinCompilerOptions: KotlinCompilerOptions) {
109110
@Suppress("NAME_SHADOWING")
110-
val jvmTarget = jvmTarget?: 8
111+
val jvmTarget = jvmTarget ?: 8
111112

112113
kotlinExtensionOrNull?.forEachCompilerOptions { isAndroid ->
113114
configure(jvmTarget, kotlinCompilerOptions, isAndroid)
114115
}
115116
project.tasks.withType(JavaCompile::class.java).configureEach {
116117
// For JVM only modules, this dictates the "org.gradle.jvm.version" Gradle attribute
117-
options.release.set(jvmTarget)
118+
if (androidExtensionOrNull == null) {
119+
options.release.set(jvmTarget)
120+
} else {
121+
// Do not use options.release - see https://issuetracker.google.com/issues/278800528
122+
sourceCompatibility = "$jvmTarget"
123+
targetCompatibility = "$jvmTarget"
124+
}
118125
}
119126
androidExtensionOrNull?.run {
120127
compileOptions {
@@ -141,6 +148,7 @@ fun Project.configureJavaAndKotlinCompilers(jvmTarget: Int?, kotlinCompilerOptio
141148
toolchain.languageVersion.set(JavaLanguageVersion.of(17))
142149
}
143150

151+
kotlinExtensionOrNull?.coreLibrariesVersion = "${kotlinCompilerOptions.version.version}.0"
144152
/**
145153
* Required because of:
146154
*

gradle.properties

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,3 +30,5 @@ org.gradle.parallel=true
3030
org.jetbrains.dokka.experimental.gradle.pluginMode=V2Enabled
3131
org.jetbrains.dokka.experimental.gradle.pluginMode.noWarn=true
3232
org.jetbrains.dokka.gradle.enableLogHtmlPublicationLink=false
33+
34+
ksp.useKSP2=true

gradle/libraries.toml

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
[versions]
22
# The version we use by default in tests and benchmarks
33
# Can be as high as IJ supports
4+
# Consult https://kotlinlang.org/docs/multiplatform-compatibility-guide.html#version-compatibility for compatibility with KGP
45
android-plugin = "8.2.2"
56
# The version we compile against
67
android-plugin-min = "8.0.0"
@@ -27,13 +28,12 @@ javaPoet = "1.13.0"
2728
jetbrains-annotations = "24.0.1"
2829
junit = "4.13.2"
2930
kotlin-plugin-min = "1.9.0"
30-
kotlin-plugin = "2.0.20"
31-
kotlin-plugin-max = "2.0.20"
32-
kotlin-stdlib = "2.0.0"
31+
kotlin-plugin = "2.1.0"
32+
kotlin-plugin-max = "2.1.0"
3333
kotlinx-coroutines = "1.9.0"
3434
kotlinx-datetime = "0.5.0"
3535
kotlinx-serialization-runtime = "1.6.2"
36-
ksp = "2.0.20-1.0.24"
36+
ksp = "2.1.0-1.0.29"
3737
ktor = "3.0.0"
3838
moshix = "0.14.1"
3939
node-fetch = "2.6.7"
@@ -117,24 +117,28 @@ intellij-changelog = "org.jetbrains.intellij.plugins:gradle-changelog-plugin:2.0
117117
jetbrains-annotations = { group = "org.jetbrains", name = "annotations", version.ref = "jetbrains-annotations" }
118118
junit = { group = "junit", name = "junit", version.ref = "junit" }
119119
kotlin-allopen = { group = "org.jetbrains.kotlin", name = "kotlin-allopen", version.ref = "kotlin-plugin" }
120-
kotlin-compiletesting = { group = "dev.zacsweers.kctfork", name = "core", version = "0.4.0" }
120+
kotlin-compiletesting = { group = "dev.zacsweers.kctfork", name = "core", version = "0.6.0" }
121121
graphql-java = "com.graphql-java:graphql-java:20.4"
122122
# The main kotlin version for build-logic and Gradle tests
123123
kotlin-plugin = { group = "org.jetbrains.kotlin", name = "kotlin-gradle-plugin", version.ref = "kotlin-plugin" }
124124
kotlin-plugin-compose = { group = "org.jetbrains.kotlin", name = "compose-compiler-gradle-plugin", version.ref = "kotlin-plugin" }
125125
# For Gradle integration tests to make sure we stay compatible with 1.5.0
126126
kotlin-plugin-min = { group = "org.jetbrains.kotlin", name = "kotlin-gradle-plugin", version.ref = "kotlin-plugin-min" }
127127
kotlin-plugin-max = { group = "org.jetbrains.kotlin", name = "kotlin-gradle-plugin", version.ref = "kotlin-plugin-max" }
128-
kotlin-reflect = { group = "org.jetbrains.kotlin", name = "kotlin-reflect" } # the Kotlin plugin resolves the version
129-
kotlin-stdlib-common = { group = "org.jetbrains.kotlin", name = "kotlin-stdlib-common", version.ref = "kotlin-stdlib" }
130-
kotlin-stdlib-jvm = { group = "org.jetbrains.kotlin", name = "kotlin-stdlib", version.ref = "kotlin-stdlib" }
131-
kotlin-stdlib-js = { group = "org.jetbrains.kotlin", name = "kotlin-stdlib-js", version.ref = "kotlin-stdlib" }
132-
kotlin-stdlib-wasm-js = { group = "org.jetbrains.kotlin", name = "kotlin-stdlib-wasm-js", version.ref = "kotlin-stdlib" }
133-
kotlin-test = { group = "org.jetbrains.kotlin", name = "kotlin-test" } # the Kotlin plugin resolves the version
134-
kotlin-test-js = { group = "org.jetbrains.kotlin", name = "kotlin-test-js" } # the Kotlin plugin resolves the version
135-
kotlin-test-junit = { group = "org.jetbrains.kotlin", name = "kotlin-test-junit" } # the Kotlin plugin resolves the version
128+
kotlin-reflect = { group = "org.jetbrains.kotlin", name = "kotlin-reflect" } # use same version as apiVersion
129+
kotlin-stdlib-common = { group = "org.jetbrains.kotlin", name = "kotlin-stdlib-common" } # use same version as apiVersion
130+
kotlin-stdlib-jvm = { group = "org.jetbrains.kotlin", name = "kotlin-stdlib" } # use same version as apiVersion
131+
kotlin-test = { group = "org.jetbrains.kotlin", name = "kotlin-test" } # use same version as apiVersion
132+
kotlin-test-js = { group = "org.jetbrains.kotlin", name = "kotlin-test-js" } # use same version as apiVersion
133+
kotlin-test-junit = { group = "org.jetbrains.kotlin", name = "kotlin-test-junit" } # use same version as apiVersion
134+
# Kotlin/JS has no apiVersion:
135+
# The Kotlin/JS standard library has an older version (2.0.20-release-360) than the compiler (2.1.0). Such a configuration is not supported.
136+
# Please, make sure that the standard library has the version in the range [2.1.0 .. 2.1.255]. Adjust your project's settings if necessary.
137+
kotlin-stdlib-js = { group = "org.jetbrains.kotlin", name = "kotlin-stdlib-js", version.ref = "kotlin-plugin" }
138+
kotlin-stdlib-wasm-js = { group = "org.jetbrains.kotlin", name = "kotlin-stdlib-wasm-js", version.ref = "kotlin-plugin" }
136139
kotlinx-benchmark-runtime = "org.jetbrains.kotlinx:kotlinx-benchmark-runtime:0.4.8"
137140
kotlinx-benchmark = "org.jetbrains.kotlinx:kotlinx-benchmark-plugin:0.4.12"
141+
kotlinx-browser = "org.jetbrains.kotlinx:kotlinx-browser:0.2"
138142
androidx-benchmark-macro = "androidx.benchmark:benchmark-macro-junit4:1.2.0-alpha16"
139143
kotlinx-coroutines = { group = "org.jetbrains.kotlinx", name = "kotlinx-coroutines-core", version.ref = "kotlinx-coroutines" }
140144
kotlinx-coroutines-rx2 = { group = "org.jetbrains.kotlinx", name = "kotlinx-coroutines-rx2", version.ref = "kotlinx-coroutines" }

gradle/repositories.gradle.kts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@ listOf(pluginManagement.repositories, dependencyResolutionManagement.repositorie
22
it.apply {
33
// Uncomment this one to use the Kotlin "dev" repository
44
// maven { url = uri("https://maven.pkg.jetbrains.space/kotlin/p/kotlin/dev/") }
5+
// Uncomment this one to use the Sonatype OSSRH snapshots repository
6+
// maven { url = uri("https://oss.sonatype.org/content/repositories/snapshots/") }
57

68
mavenCentral()
79
exclusiveContent {

intellij-plugin/build.gradle.kts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@ commonSetup()
2828
repositories {
2929
// Uncomment this one to use the Kotlin "dev" repository
3030
// maven { url = uri("https://maven.pkg.jetbrains.space/kotlin/p/kotlin/dev/") }
31+
// Uncomment this one to use the Sonatype OSSRH snapshots repository
32+
// maven { url = uri("https://oss.sonatype.org/content/repositories/snapshots/") }
3133
mavenCentral()
3234

3335
intellijPlatform {

kotlin-js-store-2.0/yarn.lock renamed to kotlin-js-store-2.1/yarn.lock

Lines changed: 26 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -67,11 +67,11 @@ brace-expansion@^2.0.1:
6767
balanced-match "^1.0.0"
6868

6969
braces@~3.0.2:
70-
version "3.0.2"
71-
resolved "https://registry.yarnpkg.com/braces/-/braces-3.0.2.tgz#3454e1a462ee8d599e236df336cd9ea4f8afe107"
72-
integrity sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==
70+
version "3.0.3"
71+
resolved "https://registry.yarnpkg.com/braces/-/braces-3.0.3.tgz#490332f40919452272d55a8480adc0c441358789"
72+
integrity sha512-yQbXgO/OSZVD2IsiLlro+7Hf6Q18EJrKSEsdoMzKePKXct3gvD8oLcOQdIzGupr5Fj+EDe8gO/lxc1BzfMpxvA==
7373
dependencies:
74-
fill-range "^7.0.1"
74+
fill-range "^7.1.1"
7575

7676
browser-stdout@^1.3.1:
7777
version "1.3.1"
@@ -133,11 +133,11 @@ color-name@~1.1.4:
133133
integrity sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==
134134

135135
debug@^4.3.5:
136-
version "4.3.6"
137-
resolved "https://registry.yarnpkg.com/debug/-/debug-4.3.6.tgz#2ab2c38fbaffebf8aa95fdfe6d88438c7a13c52b"
138-
integrity sha512-O/09Bd4Z1fBrU4VzkhFqVgpPzaGbw6Sm9FEkBT1A/YBXQFGuuSxa1dN2nxgxS34JmKXqYx8CZAwEVoJFImUXIg==
136+
version "4.3.7"
137+
resolved "https://registry.yarnpkg.com/debug/-/debug-4.3.7.tgz#87945b4151a011d76d95a198d7111c865c360a52"
138+
integrity sha512-Er2nc/H7RrMXZBFCEim6TCmMk02Z8vLC2Rbi1KEBggpo0fS6l0S1nnapwmIi3yW/+GOJap1Krg4w0Hg80oCqgQ==
139139
dependencies:
140-
ms "2.1.2"
140+
ms "^2.1.3"
141141

142142
decamelize@^4.0.0:
143143
version "4.0.0"
@@ -155,9 +155,9 @@ emoji-regex@^8.0.0:
155155
integrity sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==
156156

157157
escalade@^3.1.1:
158-
version "3.1.2"
159-
resolved "https://registry.yarnpkg.com/escalade/-/escalade-3.1.2.tgz#54076e9ab29ea5bf3d8f1ed62acffbb88272df27"
160-
integrity sha512-ErCHMCae19vR8vQGe50xIsVomy19rg6gFu3+r3jkEO46suLMWBksvVyoGgQV+jOfl84ZSOSlmv6Gxa89PmTGmA==
158+
version "3.2.0"
159+
resolved "https://registry.yarnpkg.com/escalade/-/escalade-3.2.0.tgz#011a3f69856ba189dffa7dc8fcce99d2a87903e5"
160+
integrity sha512-WUj2qlxaQtO4g6Pq5c29GTcWGDyd8itL8zTlipgECz3JesAiiOKotd8JU6otB3PACgG6xkJUyVhboMS+bje/jA==
161161

162162
escape-string-regexp@^4.0.0:
163163
version "4.0.0"
@@ -169,10 +169,10 @@ event-target-shim@^5.0.0:
169169
resolved "https://registry.yarnpkg.com/event-target-shim/-/event-target-shim-5.0.1.tgz#5d4d3ebdf9583d63a5333ce2deb7480ab2b05789"
170170
integrity sha512-i/2XbnSz/uxRCU6+NdVJgKWDTM427+MqYbkQzD321DuCQJUqOuJKIA0IM2+W2xtYHdKOmZ4dR6fExsd4SXL+WQ==
171171

172-
fill-range@^7.0.1:
173-
version "7.0.1"
174-
resolved "https://registry.yarnpkg.com/fill-range/-/fill-range-7.0.1.tgz#1919a6a7c75fe38b2c7c77e5198535da9acdda40"
175-
integrity sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ==
172+
fill-range@^7.1.1:
173+
version "7.1.1"
174+
resolved "https://registry.yarnpkg.com/fill-range/-/fill-range-7.1.1.tgz#44265d3cac07e3ea7dc247516380643754a05292"
175+
integrity sha512-YsGpe3WHLK8ZYi4tWDg2Jy3ebRz2rXowDxnld4bkQB00cc/1Zw9AWnC0i9ztDJitivtQvaI9KaLyKrc+hBW0yg==
176176
dependencies:
177177
to-regex-range "^5.0.1"
178178

@@ -296,6 +296,13 @@ js-yaml@^4.1.0:
296296
dependencies:
297297
argparse "^2.0.1"
298298

299+
kotlin-web-helpers@2.0.0:
300+
version "2.0.0"
301+
resolved "https://registry.yarnpkg.com/kotlin-web-helpers/-/kotlin-web-helpers-2.0.0.tgz#b112096b273c1e733e0b86560998235c09a19286"
302+
integrity sha512-xkVGl60Ygn/zuLkDPx+oHj7jeLR7hCvoNF99nhwXMn8a3ApB4lLiC9pk4ol4NHPjyoCbvQctBqvzUcp8pkqyWw==
303+
dependencies:
304+
format-util "^1.0.5"
305+
299306
locate-path@^6.0.0:
300307
version "6.0.0"
301308
resolved "https://registry.yarnpkg.com/locate-path/-/locate-path-6.0.0.tgz#55321eb309febbc59c4801d931a72452a681d286"
@@ -318,10 +325,10 @@ minimatch@^5.0.1, minimatch@^5.1.6:
318325
dependencies:
319326
brace-expansion "^2.0.1"
320327

321-
mocha@10.7.0:
322-
version "10.7.0"
323-
resolved "https://registry.yarnpkg.com/mocha/-/mocha-10.7.0.tgz#9e5cbed8fa9b37537a25bd1f7fb4f6fc45458b9a"
324-
integrity sha512-v8/rBWr2VO5YkspYINnvu81inSz2y3ODJrhO175/Exzor1RcEZZkizgE2A+w/CAXXoESS8Kys5E62dOHGHzULA==
328+
mocha@10.7.3:
329+
version "10.7.3"
330+
resolved "https://registry.yarnpkg.com/mocha/-/mocha-10.7.3.tgz#ae32003cabbd52b59aece17846056a68eb4b0752"
331+
integrity sha512-uQWxAu44wwiACGqjbPYmjo7Lg8sFrS3dQe7PP2FQI+woptP4vZXSMcfMyFL/e1yFEeEpV4RtyTpZROOKmxis+A==
325332
dependencies:
326333
ansi-colors "^4.1.3"
327334
browser-stdout "^1.3.1"
@@ -344,11 +351,6 @@ mocha@10.7.0:
344351
yargs-parser "^20.2.9"
345352
yargs-unparser "^2.0.0"
346353

347-
ms@2.1.2:
348-
version "2.1.2"
349-
resolved "https://registry.yarnpkg.com/ms/-/ms-2.1.2.tgz#d09d1f357b443f493382a8eb3ccd183872ae6009"
350-
integrity sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==
351-
352354
ms@^2.1.3:
353355
version "2.1.3"
354356
resolved "https://registry.yarnpkg.com/ms/-/ms-2.1.3.tgz#574c8138ce1d2b5861f0b44579dbadd60c6615b2"

libraries/apollo-debug-server/build.gradle.kts

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
21
import org.jetbrains.dokka.gradle.tasks.DokkaGenerateTask
3-
import org.jetbrains.kotlin.gradle.dsl.KotlinVersion
42

53
plugins {
64
id("org.jetbrains.kotlin.multiplatform")
@@ -16,11 +14,6 @@ apolloLibrary(
1614
withJs = false,
1715
withWasm = false,
1816
androidOptions = AndroidOptions(withCompose = false),
19-
// Can't use apiVersion KOTLIN_2_0 when using languageVersion KOTLIN_1_9, which is the case here because we're using KSP 1
20-
// TODO: move to KSP 2 and remove this when https://github.com/google/ksp/issues/1823 is resolved
21-
kotlinCompilerOptions = KotlinCompilerOptions(
22-
version = KotlinVersion.KOTLIN_1_9,
23-
)
2417
)
2518

2619
kotlin {

libraries/apollo-debug-server/src/commonMain/kotlin/com/apollographql/apollo/debugserver/internal/graphql/GraphQL.kt

Lines changed: 24 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,11 @@ import com.apollographql.apollo.api.ExecutionContext
66
import com.apollographql.apollo.ast.GQLValue
77
import com.apollographql.execution.Coercing
88
import com.apollographql.execution.ExecutableSchema
9+
import com.apollographql.execution.ExternalValue
910
import com.apollographql.execution.StringCoercing
1011
import com.apollographql.execution.annotation.GraphQLName
1112
import com.apollographql.execution.annotation.GraphQLQuery
1213
import com.apollographql.execution.annotation.GraphQLScalar
13-
import com.apollographql.execution.ExternalValue
1414
import com.apollographql.execution.parseAsGraphQLRequest
1515
import kotlinx.coroutines.runBlocking
1616
import okio.Buffer
@@ -49,12 +49,13 @@ internal class GraphQL(
4949
* The root query
5050
*/
5151
@GraphQLQuery
52-
internal class Query(private val apolloClients: AtomicReference<Map<ApolloClient, String>>) {
52+
// Prefixing private fields with _ to work around https://github.com/google/ksp/issues/2135
53+
internal class Query(private val _apolloClients: AtomicReference<Map<ApolloClient, String>>) {
5354
private fun graphQLApolloClients() =
54-
apolloClients.get().map { (apolloClient, apolloClientId) ->
55+
_apolloClients.get().map { (apolloClient, apolloClientId) ->
5556
GraphQLApolloClient(
56-
id = apolloClientId,
57-
apolloClient = apolloClient
57+
_id = apolloClientId,
58+
_apolloClient = apolloClient
5859
)
5960
}
6061

@@ -72,17 +73,17 @@ internal class Query(private val apolloClients: AtomicReference<Map<ApolloClient
7273

7374
@GraphQLName("ApolloClient")
7475
internal class GraphQLApolloClient(
75-
private val id: String,
76-
private val apolloClient: ApolloClient,
76+
private val _id: String,
77+
private val _apolloClient: ApolloClient,
7778
) {
78-
fun id(): ID = id
79+
fun id(): ID = _id
7980

80-
fun displayName() = id
81+
fun displayName() = _id
8182

8283
fun normalizedCaches(): List<NormalizedCache> {
83-
val cacheDumpProvider = apolloClient.executionContext[CacheDumpProviderContext]?.cacheDumpProvider ?: return emptyList()
84+
val cacheDumpProvider = _apolloClient.executionContext[CacheDumpProviderContext]?.cacheDumpProvider ?: return emptyList()
8485
return cacheDumpProvider().map { (displayName, cacheDump) ->
85-
NormalizedCache(apolloClientId = id, displayName = displayName, cacheDump = cacheDump)
86+
NormalizedCache(apolloClientId = _id, _displayName = displayName, _cacheDump = cacheDump)
8687
}
8788
}
8889

@@ -93,34 +94,34 @@ internal class GraphQLApolloClient(
9394

9495
internal class NormalizedCache(
9596
apolloClientId: ID,
96-
private val displayName: String,
97-
private val cacheDump: CacheDump,
97+
private val _displayName: String,
98+
private val _cacheDump: CacheDump,
9899
) {
99-
private val id: String = "$apolloClientId:$displayName"
100+
private val id: String = "$apolloClientId:$_displayName"
100101
fun id(): ID = id
101102

102-
fun displayName() = displayName
103+
fun displayName() = _displayName
103104

104-
fun recordCount() = cacheDump.count()
105+
fun recordCount() = _cacheDump.count()
105106

106107
fun records(): List<GraphQLRecord> =
107-
cacheDump.map { (key, record) -> GraphQLRecord(key = key, sizeInBytes = record.first, fields = record.second) }
108+
_cacheDump.map { (key, record) -> GraphQLRecord(_key = key, _sizeInBytes = record.first, _fields = record.second) }
108109
}
109110

110111
@GraphQLScalar(FieldsCoercing::class)
111112
typealias Fields = Map<String, Any?>
112113

113114
@GraphQLName("Record")
114115
internal class GraphQLRecord(
115-
private val key: String,
116-
private val sizeInBytes: Int,
117-
private val fields: Fields,
116+
private val _key: String,
117+
private val _sizeInBytes: Int,
118+
private val _fields: Fields,
118119
) {
119-
fun key(): String = key
120+
fun key(): String = _key
120121

121-
fun fields(): Fields = fields
122+
fun fields(): Fields = _fields
122123

123-
fun sizeInBytes(): Int = sizeInBytes
124+
fun sizeInBytes(): Int = _sizeInBytes
124125
}
125126

126127
internal object FieldsCoercing : Coercing<Fields> {

libraries/apollo-gradle-plugin/build.gradle.kts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,8 @@ tasks.withType<Test> {
150150
addRelativeInput("testFiles", "testFiles")
151151
addRelativeInput("testProjects", "testProjects")
152152

153+
maxHeapSize = "1g"
154+
153155
maxParallelForks = (Runtime.getRuntime().availableProcessors() / 2).takeIf { it > 0 } ?: 1
154156
}
155157

0 commit comments

Comments
 (0)