Skip to content

Commit

Permalink
[WIP] Update to Ktor 3 (#6214)
Browse files Browse the repository at this point in the history
* uadpte Ktor

* Fix a warning

* Remove Ktor and publish a relocation marker instead

* Make JS tests run again

* fix JS tests

* Update to Ktor 3

* Remove deprecated apollo-mockserver

* remove unused version, fix substitution rules

* update to new apollo-kotlin-execution

* use snapshots

* remove SNAPSHOTs and bump a couple of versions

* update apiDump
  • Loading branch information
martinbonnin authored Oct 23, 2024
1 parent eff92cb commit 88748d0
Show file tree
Hide file tree
Showing 65 changed files with 2,102 additions and 3,681 deletions.
25 changes: 22 additions & 3 deletions build-logic/src/main/kotlin/Publishing.kt
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,12 @@ import org.jetbrains.dokka.gradle.engine.plugins.DokkaVersioningPluginParameters
import org.jetbrains.dokka.gradle.tasks.DokkaGenerateTask
import javax.inject.Inject

fun Project.configurePublishing(isAggregateKdoc: Boolean = false) {
class Tombstone(
val group: String,
val artifact: String,
val version: String,
)
fun Project.configurePublishing(isAggregateKdoc: Boolean = false, tombstone: Tombstone? = null) {
apply {
plugin("signing")
}
Expand All @@ -44,7 +49,7 @@ fun Project.configurePublishing(isAggregateKdoc: Boolean = false) {
if (isAggregateKdoc) {
configureDokkaAggregate()
}
configurePublishingInternal()
configurePublishingInternal(tombstone)
}

fun Project.configureDokkaCommon(): DokkaExtension {
Expand Down Expand Up @@ -194,7 +199,7 @@ private fun Project.getOssStagingUrl(): String {
}
}

private fun Project.configurePublishingInternal() {
private fun Project.configurePublishingInternal(tombstone: Tombstone?) {
val emptyJavadocJar = tasks.register("emptyJavadocJar", org.gradle.jvm.tasks.Jar::class.java) {
archiveClassifier.set("javadoc")

Expand Down Expand Up @@ -284,6 +289,20 @@ private fun Project.configurePublishingInternal() {
artifactId = project.name
}
}
tombstone != null ->{
withType(MavenPublication::class.java).configureEach {
pom {
distributionManagement {
relocation {
groupId.set(tombstone.group)
artifactId.set(tombstone.artifact)
version.set(tombstone.version)
message.set("This artifact is has moved. See https://go.apollo.dev/ak-moved-artifacts")
}
}
}
}
}

else -> {
/**
Expand Down
13 changes: 12 additions & 1 deletion build-logic/src/main/kotlin/api.kt
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,14 @@ class KotlinCompilerOptions(
val version: KotlinVersion = KotlinVersion.KOTLIN_2_0,
)

fun Project.apolloTombstone(
group: String,
artifact: String,
version: String,
) {
configurePublishing(tombstone = Tombstone(group, artifact, version))
}

fun Project.apolloLibrary(
namespace: String,
jvmTarget: Int? = null,
Expand Down Expand Up @@ -49,7 +57,10 @@ fun Project.apolloLibrary(
// Within the 'tests' project (a composite build), dependencies are automatically substituted to use the project's one.
// But we don't want this, for example apollo-tooling depends on a published version of apollo-api.
// So disable this behavior (see https://docs.gradle.org/current/userguide/composite_builds.html#deactivate_included_build_substitutions).
configurations.all {
configurations.configureEach {
if (name != "apolloPublished") {
return@configureEach
}
resolutionStrategy.useGlobalDependencySubstitutionRules.set(false)
}

Expand Down
2 changes: 1 addition & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ tasks.register("ciTestsNoGradle") {
dependsOn(tasks.matching { it.name == "test" })
}
dependsOn(tasks.matching { it.name == "jvmTest" })
dependsOn(tasks.matching { it.name == "jsIrTest" })
dependsOn(tasks.matching { it.name == "jsNodeTest" })
dependsOn(tasks.withType(KotlinNativeHostTest::class.java))
dependsOn(tasks.matching { it.name == "apiCheck" })
}
Expand Down
12 changes: 6 additions & 6 deletions gradle/libraries.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@ android-sdkversion-target = "30"
androidx-sqlite = "2.3.1"
# This is used by the gradle integration tests to get the artifacts locally
apollo = "4.0.2-SNAPSHOT"
apollo-execution = "0.0.3"
apollo-execution = "0.1.0"
apollo-normalizedcache-incubating = "0.0.3"
apollo-normalizedcache-incubating-snapshot = "0.0.4-SNAPSHOT"
apollo-normalizedcache-incubating-snapshot = "0.0.4"
# Used by the apollo-tooling project which uses a published version of Apollo
apollo-published = "4.0.0-rc.1"
apollo-published = "4.0.1"
atomicfu = "0.24.0"
compose = "1.5.1"
guava = "31.1-jre"
Expand All @@ -34,7 +34,7 @@ kotlinx-coroutines = "1.8.0"
kotlinx-datetime = "0.5.0"
kotlinx-serialization-runtime = "1.6.2"
ksp = "2.0.20-1.0.24"
ktor = "2.3.11"
ktor = "3.0.0"
moshix = "0.14.1"
node-fetch = "2.6.7"
okio = "3.9.0"
Expand Down Expand Up @@ -63,7 +63,7 @@ apollo-api = { group = "com.apollographql.apollo", name = "apollo-api", version.
apollo-api-java = { group = "com.apollographql.apollo", name = "apollo-api-java", version.ref = "apollo" }
apollo-httpCache = { group = "com.apollographql.apollo", name = "apollo-http-cache", version.ref = "apollo" }
apollo-idlingresource = { group = "com.apollographql.apollo", name = "apollo-idling-resource", version.ref = "apollo" }
apollo-mockserver = { group = "com.apollographql.mockserver", name = "apollo-mockserver", version = "0.0.3" }
apollo-mockserver = { group = "com.apollographql.mockserver", name = "apollo-mockserver", version = "0.1.0" }
apollo-mpputils = { group = "com.apollographql.apollo", name = "apollo-mpp-utils", version.ref = "apollo" }
apollo-normalizedcache = { group = "com.apollographql.apollo", name = "apollo-normalized-cache", version.ref = "apollo" }
apollo-normalizedcache-incubating-snapshot = { group = "com.apollographql.cache", name = "normalized-cache-incubating", version.ref = "apollo-normalizedcache-incubating-snapshot" }
Expand Down Expand Up @@ -144,7 +144,7 @@ kotlinx-datetime = { group = "org.jetbrains.kotlinx", name = "kotlinx-datetime",
kotlin-node = "org.jetbrains.kotlin-wrappers:kotlin-node:18.16.12-pre.634"
kotlinx-serialization-plugin = { group = "org.jetbrains.kotlin", name = "kotlin-serialization", version.ref = "kotlin-plugin" }
kotlinx-serialization-json = { group = "org.jetbrains.kotlinx", name = "kotlinx-serialization-json", version.ref = "kotlinx-serialization-runtime" }
kotlinx-binarycompatibilityvalidator = { group = "org.jetbrains.kotlinx", name = "binary-compatibility-validator", version = "0.15.0-Beta.2" }
kotlinx-binarycompatibilityvalidator = { group = "org.jetbrains.kotlinx", name = "binary-compatibility-validator", version = "0.16.3" }
ksp = { module = "com.google.devtools.ksp:symbol-processing-gradle-plugin", version.ref = "ksp" }
ktor-client-core = { group = "io.ktor", name= "ktor-client-core", version.ref = "ktor" }
ktor-client-okhttp = { group = "io.ktor", name = "ktor-client-okhttp", version.ref = "ktor" }
Expand Down
9 changes: 7 additions & 2 deletions intellij-plugin/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import org.gradle.api.tasks.testing.logging.TestExceptionFormat
import org.gradle.api.tasks.testing.logging.TestLogEvent
import org.jetbrains.changelog.markdownToHTML
import org.jetbrains.intellij.platform.gradle.TestFrameworkType
import java.net.URI
import java.net.URL
import java.text.SimpleDateFormat
import java.util.Date
Expand Down Expand Up @@ -99,7 +100,7 @@ tasks.register("downloadMockJdk") {
val rtJar = mockJdkRoot.resolve("java/mockJDK-1.7/jre/lib/rt.jar")
if (!rtJar.exists()) {
rtJar.parentFile.mkdirs()
rtJar.writeBytes(URL("https://github.com/JetBrains/intellij-community/raw/master/java/mockJDK-1.7/jre/lib/rt.jar").openStream()
rtJar.writeBytes(URI("https://github.com/JetBrains/intellij-community/raw/master/java/mockJDK-1.7/jre/lib/rt.jar").toURL().openStream()
.readBytes()
)
}
Expand Down Expand Up @@ -135,6 +136,10 @@ tasks.configureEach {
}
}

val apolloPublished = configurations.dependencyScope("apolloPublished").get()

configurations.getByName("implementation").extendsFrom(apolloPublished)

dependencies {
// IntelliJ Platform dependencies must be declared before the intellijPlatform block - see https://github.com/JetBrains/intellij-platform-gradle-plugin/issues/1784
intellijPlatform {
Expand All @@ -161,7 +166,7 @@ dependencies {
implementation(libs.apollo.normalizedcache.sqlite.incubating) {
exclude(group = "org.jetbrains.kotlinx", module = "kotlinx-coroutines-core")
}
implementation(libs.apollo.runtime.published) {
add("apolloPublished", libs.apollo.runtime.published.get().toString()) {
exclude(group = "org.jetbrains.kotlinx", module = "kotlinx-coroutines-core")
}
runtimeOnly(libs.slf4j.simple)
Expand Down
11 changes: 10 additions & 1 deletion libraries/apollo-adapters/api/apollo-adapters.klib.api
Original file line number Diff line number Diff line change
Expand Up @@ -7,33 +7,40 @@
// - Show declarations: true

// Library unique name: <com.apollographql.apollo:apollo-adapters>
final fun (com.apollographql.apollo.adapter/BigDecimal).com.apollographql.apollo.adapter/toNumber(): kotlin/Number // com.apollographql.apollo.adapter/toNumber|toNumber@com.apollographql.apollo.adapter.BigDecimal(){}[0]
final object com.apollographql.apollo.adapter/BigDecimalAdapter : com.apollographql.apollo.api/Adapter<com.apollographql.apollo.adapter/BigDecimal> { // com.apollographql.apollo.adapter/BigDecimalAdapter|null[0]
final fun fromJson(com.apollographql.apollo.api.json/JsonReader, com.apollographql.apollo.api/CustomScalarAdapters): com.apollographql.apollo.adapter/BigDecimal // com.apollographql.apollo.adapter/BigDecimalAdapter.fromJson|fromJson(com.apollographql.apollo.api.json.JsonReader;com.apollographql.apollo.api.CustomScalarAdapters){}[0]
final fun toJson(com.apollographql.apollo.api.json/JsonWriter, com.apollographql.apollo.api/CustomScalarAdapters, com.apollographql.apollo.adapter/BigDecimal) // com.apollographql.apollo.adapter/BigDecimalAdapter.toJson|toJson(com.apollographql.apollo.api.json.JsonWriter;com.apollographql.apollo.api.CustomScalarAdapters;com.apollographql.apollo.adapter.BigDecimal){}[0]
}

final object com.apollographql.apollo.adapter/KotlinxInstantAdapter : com.apollographql.apollo.api/Adapter<kotlinx.datetime/Instant> { // com.apollographql.apollo.adapter/KotlinxInstantAdapter|null[0]
final fun fromJson(com.apollographql.apollo.api.json/JsonReader, com.apollographql.apollo.api/CustomScalarAdapters): kotlinx.datetime/Instant // com.apollographql.apollo.adapter/KotlinxInstantAdapter.fromJson|fromJson(com.apollographql.apollo.api.json.JsonReader;com.apollographql.apollo.api.CustomScalarAdapters){}[0]
final fun toJson(com.apollographql.apollo.api.json/JsonWriter, com.apollographql.apollo.api/CustomScalarAdapters, kotlinx.datetime/Instant) // com.apollographql.apollo.adapter/KotlinxInstantAdapter.toJson|toJson(com.apollographql.apollo.api.json.JsonWriter;com.apollographql.apollo.api.CustomScalarAdapters;kotlinx.datetime.Instant){}[0]
}

final object com.apollographql.apollo.adapter/KotlinxLocalDateAdapter : com.apollographql.apollo.api/Adapter<kotlinx.datetime/LocalDate> { // com.apollographql.apollo.adapter/KotlinxLocalDateAdapter|null[0]
final fun fromJson(com.apollographql.apollo.api.json/JsonReader, com.apollographql.apollo.api/CustomScalarAdapters): kotlinx.datetime/LocalDate // com.apollographql.apollo.adapter/KotlinxLocalDateAdapter.fromJson|fromJson(com.apollographql.apollo.api.json.JsonReader;com.apollographql.apollo.api.CustomScalarAdapters){}[0]
final fun toJson(com.apollographql.apollo.api.json/JsonWriter, com.apollographql.apollo.api/CustomScalarAdapters, kotlinx.datetime/LocalDate) // com.apollographql.apollo.adapter/KotlinxLocalDateAdapter.toJson|toJson(com.apollographql.apollo.api.json.JsonWriter;com.apollographql.apollo.api.CustomScalarAdapters;kotlinx.datetime.LocalDate){}[0]
}

final object com.apollographql.apollo.adapter/KotlinxLocalDateTimeAdapter : com.apollographql.apollo.api/Adapter<kotlinx.datetime/LocalDateTime> { // com.apollographql.apollo.adapter/KotlinxLocalDateTimeAdapter|null[0]
final fun fromJson(com.apollographql.apollo.api.json/JsonReader, com.apollographql.apollo.api/CustomScalarAdapters): kotlinx.datetime/LocalDateTime // com.apollographql.apollo.adapter/KotlinxLocalDateTimeAdapter.fromJson|fromJson(com.apollographql.apollo.api.json.JsonReader;com.apollographql.apollo.api.CustomScalarAdapters){}[0]
final fun toJson(com.apollographql.apollo.api.json/JsonWriter, com.apollographql.apollo.api/CustomScalarAdapters, kotlinx.datetime/LocalDateTime) // com.apollographql.apollo.adapter/KotlinxLocalDateTimeAdapter.toJson|toJson(com.apollographql.apollo.api.json.JsonWriter;com.apollographql.apollo.api.CustomScalarAdapters;kotlinx.datetime.LocalDateTime){}[0]
}

final object com.apollographql.apollo.adapter/KotlinxLocalTimeAdapter : com.apollographql.apollo.api/Adapter<kotlinx.datetime/LocalTime> { // com.apollographql.apollo.adapter/KotlinxLocalTimeAdapter|null[0]
final fun fromJson(com.apollographql.apollo.api.json/JsonReader, com.apollographql.apollo.api/CustomScalarAdapters): kotlinx.datetime/LocalTime // com.apollographql.apollo.adapter/KotlinxLocalTimeAdapter.fromJson|fromJson(com.apollographql.apollo.api.json.JsonReader;com.apollographql.apollo.api.CustomScalarAdapters){}[0]
final fun toJson(com.apollographql.apollo.api.json/JsonWriter, com.apollographql.apollo.api/CustomScalarAdapters, kotlinx.datetime/LocalTime) // com.apollographql.apollo.adapter/KotlinxLocalTimeAdapter.toJson|toJson(com.apollographql.apollo.api.json.JsonWriter;com.apollographql.apollo.api.CustomScalarAdapters;kotlinx.datetime.LocalTime){}[0]
}

final fun (com.apollographql.apollo.adapter/BigDecimal).com.apollographql.apollo.adapter/toNumber(): kotlin/Number // com.apollographql.apollo.adapter/toNumber|toNumber@com.apollographql.apollo.adapter.BigDecimal(){}[0]

// Targets: [apple]
final class com.apollographql.apollo.adapter/BigDecimal : kotlin/Number { // com.apollographql.apollo.adapter/BigDecimal|null[0]
constructor <init>(kotlin/Double) // com.apollographql.apollo.adapter/BigDecimal.<init>|<init>(kotlin.Double){}[0]
constructor <init>(kotlin/Int) // com.apollographql.apollo.adapter/BigDecimal.<init>|<init>(kotlin.Int){}[0]
constructor <init>(kotlin/Long) // com.apollographql.apollo.adapter/BigDecimal.<init>|<init>(kotlin.Long){}[0]
constructor <init>(kotlin/String) // com.apollographql.apollo.adapter/BigDecimal.<init>|<init>(kotlin.String){}[0]

final fun add(com.apollographql.apollo.adapter/BigDecimal): com.apollographql.apollo.adapter/BigDecimal // com.apollographql.apollo.adapter/BigDecimal.add|add(com.apollographql.apollo.adapter.BigDecimal){}[0]
final fun divide(com.apollographql.apollo.adapter/BigDecimal): com.apollographql.apollo.adapter/BigDecimal // com.apollographql.apollo.adapter/BigDecimal.divide|divide(com.apollographql.apollo.adapter.BigDecimal){}[0]
final fun equals(kotlin/Any?): kotlin/Boolean // com.apollographql.apollo.adapter/BigDecimal.equals|equals(kotlin.Any?){}[0]
Expand All @@ -50,13 +57,15 @@ final class com.apollographql.apollo.adapter/BigDecimal : kotlin/Number { // com
final fun toShort(): kotlin/Short // com.apollographql.apollo.adapter/BigDecimal.toShort|toShort(){}[0]
final fun toString(): kotlin/String // com.apollographql.apollo.adapter/BigDecimal.toString|toString(){}[0]
}

// Targets: [js, wasmJs]
final class com.apollographql.apollo.adapter/BigDecimal { // com.apollographql.apollo.adapter/BigDecimal|null[0]
constructor <init>() // com.apollographql.apollo.adapter/BigDecimal.<init>|<init>(){}[0]
constructor <init>(kotlin/Double) // com.apollographql.apollo.adapter/BigDecimal.<init>|<init>(kotlin.Double){}[0]
constructor <init>(kotlin/Int) // com.apollographql.apollo.adapter/BigDecimal.<init>|<init>(kotlin.Int){}[0]
constructor <init>(kotlin/Long) // com.apollographql.apollo.adapter/BigDecimal.<init>|<init>(kotlin.Long){}[0]
constructor <init>(kotlin/String) // com.apollographql.apollo.adapter/BigDecimal.<init>|<init>(kotlin.String){}[0]

final fun add(com.apollographql.apollo.adapter/BigDecimal): com.apollographql.apollo.adapter/BigDecimal // com.apollographql.apollo.adapter/BigDecimal.add|add(com.apollographql.apollo.adapter.BigDecimal){}[0]
final fun divide(com.apollographql.apollo.adapter/BigDecimal): com.apollographql.apollo.adapter/BigDecimal // com.apollographql.apollo.adapter/BigDecimal.divide|divide(com.apollographql.apollo.adapter.BigDecimal){}[0]
final fun equals(kotlin/Any?): kotlin/Boolean // com.apollographql.apollo.adapter/BigDecimal.equals|equals(kotlin.Any?){}[0]
Expand Down
4 changes: 4 additions & 0 deletions libraries/apollo-annotations/api/apollo-annotations.klib.api
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,19 @@
// Library unique name: <com.apollographql.apollo:apollo-annotations>
open annotation class com.apollographql.apollo.annotations/ApolloAdaptableWith : kotlin/Annotation { // com.apollographql.apollo.annotations/ApolloAdaptableWith|null[0]
constructor <init>(kotlin.reflect/KClass<*>) // com.apollographql.apollo.annotations/ApolloAdaptableWith.<init>|<init>(kotlin.reflect.KClass<*>){}[0]

final val adapter // com.apollographql.apollo.annotations/ApolloAdaptableWith.adapter|{}adapter[0]
final fun <get-adapter>(): kotlin.reflect/KClass<*> // com.apollographql.apollo.annotations/ApolloAdaptableWith.adapter.<get-adapter>|<get-adapter>(){}[0]
}

open annotation class com.apollographql.apollo.annotations/ApolloExperimental : kotlin/Annotation { // com.apollographql.apollo.annotations/ApolloExperimental|null[0]
constructor <init>() // com.apollographql.apollo.annotations/ApolloExperimental.<init>|<init>(){}[0]
}

open annotation class com.apollographql.apollo.annotations/ApolloInternal : kotlin/Annotation { // com.apollographql.apollo.annotations/ApolloInternal|null[0]
constructor <init>() // com.apollographql.apollo.annotations/ApolloInternal.<init>|<init>(){}[0]
}

open annotation class com.apollographql.apollo.annotations/ApolloRequiresOptIn : kotlin/Annotation { // com.apollographql.apollo.annotations/ApolloRequiresOptIn|null[0]
constructor <init>() // com.apollographql.apollo.annotations/ApolloRequiresOptIn.<init>|<init>(){}[0]
}
1 change: 0 additions & 1 deletion libraries/apollo-api/api/apollo-api.api
Original file line number Diff line number Diff line change
Expand Up @@ -402,7 +402,6 @@ public final class com/apollographql/apollo/api/CompiledVariable {
public final class com/apollographql/apollo/api/CustomScalarAdapters : com/apollographql/apollo/api/ExecutionContext$Element {
public static final field Empty Lcom/apollographql/apollo/api/CustomScalarAdapters;
public static final field Key Lcom/apollographql/apollo/api/CustomScalarAdapters$Key;
public static final field PassThrough Lcom/apollographql/apollo/api/CustomScalarAdapters;
public final field deferredFragmentIdentifiers Ljava/util/Set;
public final field errors Ljava/util/List;
public final field falseVariables Ljava/util/Set;
Expand Down
Loading

0 comments on commit 88748d0

Please sign in to comment.