Skip to content

Commit d237a11

Browse files
BoDmartinbonnin
andauthored
Prepare for K2 (#5890)
* Enable K2 * Workaround for https://youtrack.jetbrains.com/issue/KT-60561 * Workaround for https://youtrack.jetbrains.com/issue/KT-65105 * Bump kotlin-plugin-min to 1.9.0 * Add -Xskip-prerelease-check for Gradle tests * make wasm compile * Remove deprecated tryK2 flag * Tweak runTest on wasm * Tweak the tweak for KT-60561 and wasm * Revert to use K1 --------- Co-authored-by: Martin Bonnin <[email protected]>
1 parent 44e556d commit d237a11

File tree

12 files changed

+45
-53
lines changed

12 files changed

+45
-53
lines changed

gradle/libraries.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ guava = "31.1-jre"
2424
javaPoet = "1.13.0"
2525
jetbrains-annotations = "24.0.1"
2626
junit = "4.13.2"
27-
kotlin-plugin-min = "1.8.0"
27+
kotlin-plugin-min = "1.9.0"
2828
kotlin-plugin = "2.0.0-RC3"
2929
kotlin-plugin-max = "2.0.0-RC3"
3030
kotlin-stdlib = "2.0.0-RC3"

libraries/apollo-api/api/apollo-api.api

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -630,9 +630,6 @@ public final class com/apollographql/apollo3/api/FileUpload {
630630
}
631631

632632
public abstract interface class com/apollographql/apollo3/api/Fragment : com/apollographql/apollo3/api/Executable {
633-
public abstract fun adapter ()Lcom/apollographql/apollo3/api/Adapter;
634-
public abstract fun rootField ()Lcom/apollographql/apollo3/api/CompiledField;
635-
public abstract fun serializeVariables (Lcom/apollographql/apollo3/api/json/JsonWriter;Lcom/apollographql/apollo3/api/CustomScalarAdapters;Z)V
636633
}
637634

638635
public abstract interface class com/apollographql/apollo3/api/Fragment$Data : com/apollographql/apollo3/api/Executable$Data {
@@ -773,12 +770,9 @@ public final class com/apollographql/apollo3/api/ObjectType$Builder {
773770
}
774771

775772
public abstract interface class com/apollographql/apollo3/api/Operation : com/apollographql/apollo3/api/Executable {
776-
public abstract fun adapter ()Lcom/apollographql/apollo3/api/Adapter;
777773
public abstract fun document ()Ljava/lang/String;
778774
public abstract fun id ()Ljava/lang/String;
779775
public abstract fun name ()Ljava/lang/String;
780-
public abstract fun rootField ()Lcom/apollographql/apollo3/api/CompiledField;
781-
public abstract fun serializeVariables (Lcom/apollographql/apollo3/api/json/JsonWriter;Lcom/apollographql/apollo3/api/CustomScalarAdapters;Z)V
782776
}
783777

784778
public abstract interface class com/apollographql/apollo3/api/Operation$Data : com/apollographql/apollo3/api/Executable$Data {

libraries/apollo-api/api/apollo-api.klib.api

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -51,21 +51,15 @@ abstract interface <#A: com.apollographql.apollo3.api/Executable.Data> com.apoll
5151
}
5252
}
5353
abstract interface <#A: com.apollographql.apollo3.api/Fragment.Data> com.apollographql.apollo3.api/Fragment : com.apollographql.apollo3.api/Executable<#A> { // com.apollographql.apollo3.api/Fragment|null[0]
54-
abstract fun adapter(): com.apollographql.apollo3.api/Adapter<#A> // com.apollographql.apollo3.api/Fragment.adapter|adapter(){}[0]
55-
abstract fun rootField(): com.apollographql.apollo3.api/CompiledField // com.apollographql.apollo3.api/Fragment.rootField|rootField(){}[0]
56-
abstract fun serializeVariables(com.apollographql.apollo3.api.json/JsonWriter, com.apollographql.apollo3.api/CustomScalarAdapters, kotlin/Boolean) // com.apollographql.apollo3.api/Fragment.serializeVariables|serializeVariables(com.apollographql.apollo3.api.json.JsonWriter;com.apollographql.apollo3.api.CustomScalarAdapters;kotlin.Boolean){}[0]
5754
abstract interface Data : com.apollographql.apollo3.api/Executable.Data // com.apollographql.apollo3.api/Fragment.Data|null[0]
5855
}
5956
abstract interface <#A: com.apollographql.apollo3.api/Mutation.Data> com.apollographql.apollo3.api/Mutation : com.apollographql.apollo3.api/Operation<#A> { // com.apollographql.apollo3.api/Mutation|null[0]
6057
abstract interface Data : com.apollographql.apollo3.api/Operation.Data // com.apollographql.apollo3.api/Mutation.Data|null[0]
6158
}
6259
abstract interface <#A: com.apollographql.apollo3.api/Operation.Data> com.apollographql.apollo3.api/Operation : com.apollographql.apollo3.api/Executable<#A> { // com.apollographql.apollo3.api/Operation|null[0]
63-
abstract fun adapter(): com.apollographql.apollo3.api/Adapter<#A> // com.apollographql.apollo3.api/Operation.adapter|adapter(){}[0]
6460
abstract fun document(): kotlin/String // com.apollographql.apollo3.api/Operation.document|document(){}[0]
6561
abstract fun id(): kotlin/String // com.apollographql.apollo3.api/Operation.id|id(){}[0]
6662
abstract fun name(): kotlin/String // com.apollographql.apollo3.api/Operation.name|name(){}[0]
67-
abstract fun rootField(): com.apollographql.apollo3.api/CompiledField // com.apollographql.apollo3.api/Operation.rootField|rootField(){}[0]
68-
abstract fun serializeVariables(com.apollographql.apollo3.api.json/JsonWriter, com.apollographql.apollo3.api/CustomScalarAdapters, kotlin/Boolean) // com.apollographql.apollo3.api/Operation.serializeVariables|serializeVariables(com.apollographql.apollo3.api.json.JsonWriter;com.apollographql.apollo3.api.CustomScalarAdapters;kotlin.Boolean){}[0]
6963
abstract interface Data : com.apollographql.apollo3.api/Executable.Data // com.apollographql.apollo3.api/Operation.Data|null[0]
7064
}
7165
abstract interface <#A: com.apollographql.apollo3.api/Query.Data> com.apollographql.apollo3.api/Query : com.apollographql.apollo3.api/Operation<#A> { // com.apollographql.apollo3.api/Query|null[0]

libraries/apollo-api/src/commonMain/kotlin/com/apollographql/apollo3/api/Fragment.kt

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,11 @@
11
package com.apollographql.apollo3.api
22

3-
import com.apollographql.apollo3.api.json.JsonWriter
4-
import okio.IOException
5-
63
/**
74
* Base interface for a fragment implementation.
85
* Fragments do not have variables per the GraphQL spec but they are inferred from arguments and used when reading the cache
96
* See https://github.com/graphql/graphql-spec/issues/204 for a proposal to add fragment arguments
107
*/
118
interface Fragment<D : Fragment.Data> : Executable<D> {
12-
@Throws(IOException::class)
13-
override fun serializeVariables(writer: JsonWriter, customScalarAdapters: CustomScalarAdapters, withDefaultValues: Boolean)
14-
15-
override fun adapter(): Adapter<D>
16-
17-
override fun rootField(): CompiledField
18-
199
/**
2010
* Marker interface for generated models of this fragment
2111
*/

libraries/apollo-api/src/commonMain/kotlin/com/apollographql/apollo3/api/Operation.kt

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
package com.apollographql.apollo3.api
22

3-
import com.apollographql.apollo3.api.json.JsonWriter
4-
import okio.IOException
53
import kotlin.js.JsName
64

75
/**
@@ -29,13 +27,6 @@ interface Operation<D : Operation.Data> : Executable<D> {
2927
@JsName("operationId")
3028
fun id(): String
3129

32-
override fun adapter(): Adapter<D>
33-
34-
@Throws(IOException::class)
35-
override fun serializeVariables(writer: JsonWriter, customScalarAdapters: CustomScalarAdapters, withDefaultValues: Boolean)
36-
37-
override fun rootField(): CompiledField
38-
3930
/**
4031
* Marker interface for generated models built from data returned by the server in response to this operation.
4132
*/

libraries/apollo-compiler/src/test/kotlin/com/apollographql/apollo3/compiler/KotlinCompiler.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ object KotlinCompiler {
1919
val result = KotlinCompilation().apply {
2020
sources = kotlinFiles
2121

22-
kotlincArguments = kotlincArguments + "-opt-in=kotlin.RequiresOptIn"
22+
kotlincArguments = kotlincArguments + "-opt-in=kotlin.RequiresOptIn" + "-Xskip-prerelease-check"
2323
inheritClassPath = true
2424
verbose = false
2525
messageOutputStream = okio.blackholeSink().buffer().outputStream()

libraries/apollo-gradle-plugin/testProjects/kotlin-android-plugin-version/build.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import com.android.build.gradle.BaseExtension
21
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
32

43
plugins {
@@ -41,5 +40,6 @@ tasks.withType<KotlinCompile>().configureEach {
4140
// Required for Kotlin < 1.6.10
4241
// See https://kotlinlang.org/docs/whatsnew1620.html#compatibility-changes-in-the-xjvm-default-modes
4342
freeCompilerArgs += "-Xjvm-default=all"
43+
freeCompilerArgs += "-Xskip-prerelease-check"
4444
}
4545
}

libraries/apollo-testing-support/api/apollo-testing-support.klib.api

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,3 @@ final fun com.apollographql.apollo3.testing/cwd(): kotlin/String // com.apollogr
2323
// Targets: [js]
2424
final val com.apollographql.apollo3.testing/HostFileSystem // com.apollographql.apollo3.testing/HostFileSystem|{}HostFileSystem[0]
2525
final fun <get-HostFileSystem>(): okio/FileSystem // com.apollographql.apollo3.testing/HostFileSystem.<get-HostFileSystem>|<get-HostFileSystem>(){}[0]
26-
// Targets: [wasmJs]
27-
final val com.apollographql.apollo3.testing.internal/empty // com.apollographql.apollo3.testing.internal/empty|{}empty[0]
28-
final fun <get-empty>(): kotlin.js/JsAny // com.apollographql.apollo3.testing.internal/empty.<get-empty>|<get-empty>(){}[0]
Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,17 @@ import kotlinx.coroutines.DelicateCoroutinesApi
66
import kotlinx.coroutines.GlobalScope
77
import kotlinx.coroutines.promise
88
import kotlin.coroutines.CoroutineContext
9-
import kotlin.js.Promise
109

11-
// https://youtrack.jetbrains.com/issue/KT-21846/
12-
@Suppress("ACTUAL_WITHOUT_EXPECT", "ACTUAL_TYPE_ALIAS_TO_CLASS_WITH_DECLARATION_SITE_VARIANCE", "INCOMPATIBLE_MATCHING")
1310
@ApolloInternal
14-
actual typealias ApolloTestResult = Promise<Any>
11+
actual typealias ApolloTestResult = JsPromiseInterfaceForTesting
12+
13+
// https://youtrack.jetbrains.com/issue/KT-60561
14+
@ApolloInternal
15+
@JsName("Promise")
16+
external class JsPromiseInterfaceForTesting {
17+
fun then(onFulfilled: ((Unit) -> Unit), onRejected: ((Throwable) -> Unit)): JsPromiseInterfaceForTesting
18+
fun then(onFulfilled: ((Unit) -> Unit)): JsPromiseInterfaceForTesting
19+
}
1520

1621
@ApolloInternal
1722
@OptIn(DelicateCoroutinesApi::class)
@@ -40,5 +45,5 @@ actual fun runTest(
4045
after()
4146
}
4247
}
43-
}
48+
}.unsafeCast<ApolloTestResult>()
4449
}

0 commit comments

Comments
 (0)