Skip to content

Commit 757f6c6

Browse files
authored
Remove apollo-execution (#5978)
* Remove apollo-execution * fix tests
1 parent 9e8bd50 commit 757f6c6

File tree

52 files changed

+432
-3266
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

52 files changed

+432
-3266
lines changed

build-logic/build.gradle.kts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ dependencies {
2222

2323
implementation(libs.kotlinx.benchmark)
2424
implementation(libs.dokkatoo)
25+
implementation(libs.apollo.execution.gradle.plugin)
2526

2627
// We add all the plugins to the classpath here so that they are loaded with proper conflict resolution
2728
// See https://github.com/gradle/gradle/issues/4741

gradle/libraries.toml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ android-sdkversion-target = "30"
1515
androidx-sqlite = "2.3.1"
1616
# This is used by the gradle integration tests to get the artifacts locally
1717
apollo = "4.0.0-beta.8-SNAPSHOT"
18+
apollo-execution = "0.0.1"
1819
# Used by the apollo-tooling project which uses a published version of Apollo
1920
apollo-published = "4.0.0-beta.6"
2021
atomicfu = "0.23.1"
@@ -77,7 +78,10 @@ apollo-plugin = { group = "com.apollographql.apollo3", name = "apollo-gradle-plu
7778
apollo-runtime = { group = "com.apollographql.apollo3", name = "apollo-runtime", version.ref = "apollo" }
7879
apollo-compiler = { group = "com.apollographql.apollo3", name = "apollo-compiler", version.ref = "apollo" }
7980
apollo-ast = { group = "com.apollographql.apollo3", name = "apollo-ast", version.ref = "apollo" }
80-
apollo-execution = { group = "com.apollographql.apollo3", name = "apollo-execution-incubating", version.ref = "apollo" }
81+
apollo-execution = { group = "com.apollographql.execution", name = "runtime", version.ref = "apollo-execution" }
82+
apollo-execution-ktor = { group = "com.apollographql.execution", name = "runtime-ktor", version.ref = "apollo-execution" }
83+
apollo-execution-processor = { group = "com.apollographql.execution", name = "processor", version.ref = "apollo-execution" }
84+
apollo-execution-gradle-plugin = { group = "com.apollographql.execution", name = "gradle-plugin", version.ref = "apollo-execution" }
8185
# Used by the apollo-tooling project which uses a published version of Apollo
8286
apollo-runtime-published = { group = "com.apollographql.apollo3", name = "apollo-runtime", version.ref = "apollo-published" }
8387
apollo-annotations = { group = "com.apollographql.apollo3", name = "apollo-annotations", version.ref = "apollo" }

intellij-plugin/build.gradle.kts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -186,10 +186,10 @@ fun isSnapshotBuild() = System.getenv("IJ_PLUGIN_SNAPSHOT").toBoolean()
186186
apollo {
187187
service("apolloDebug") {
188188
packageName.set("com.apollographql.apollo3.debug")
189-
schemaFiles.from(file("../libraries/apollo-debug-server/src/androidMain/resources/schema.graphqls"))
189+
schemaFiles.from(file("../libraries/apollo-debug-server/graphql/schema.graphqls"))
190190
introspection {
191191
endpointUrl.set("http://localhost:12200/")
192-
schemaFile.set(file("../libraries/apollo-debug-server/src/androidMain/resources/schema.graphqls"))
192+
schemaFile.set(file("../libraries/apollo-debug-server/graphql/schema.graphqls"))
193193
}
194194
}
195195
}

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

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -36,15 +36,3 @@ public abstract interface annotation class com/apollographql/apollo3/annotations
3636
public abstract interface annotation class com/apollographql/apollo3/annotations/ApolloRequiresOptIn : java/lang/annotation/Annotation {
3737
}
3838

39-
public abstract interface annotation class com/apollographql/apollo3/annotations/GraphQLAdapter : java/lang/annotation/Annotation {
40-
public abstract fun forScalar ()Ljava/lang/String;
41-
}
42-
43-
public abstract interface annotation class com/apollographql/apollo3/annotations/GraphQLName : java/lang/annotation/Annotation {
44-
public abstract fun name ()Ljava/lang/String;
45-
}
46-
47-
public abstract interface annotation class com/apollographql/apollo3/annotations/GraphQLObject : java/lang/annotation/Annotation {
48-
public abstract fun name ()Ljava/lang/String;
49-
}
50-

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

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -46,18 +46,3 @@ open annotation class com.apollographql.apollo3.annotations/ApolloInternal : kot
4646
open annotation class com.apollographql.apollo3.annotations/ApolloRequiresOptIn : kotlin/Annotation { // com.apollographql.apollo3.annotations/ApolloRequiresOptIn|null[0]
4747
constructor <init>() // com.apollographql.apollo3.annotations/ApolloRequiresOptIn.<init>|<init>(){}[0]
4848
}
49-
open annotation class com.apollographql.apollo3.annotations/GraphQLAdapter : kotlin/Annotation { // com.apollographql.apollo3.annotations/GraphQLAdapter|null[0]
50-
constructor <init>(kotlin/String) // com.apollographql.apollo3.annotations/GraphQLAdapter.<init>|<init>(kotlin.String){}[0]
51-
final val forScalar // com.apollographql.apollo3.annotations/GraphQLAdapter.forScalar|{}forScalar[0]
52-
final fun <get-forScalar>(): kotlin/String // com.apollographql.apollo3.annotations/GraphQLAdapter.forScalar.<get-forScalar>|<get-forScalar>(){}[0]
53-
}
54-
open annotation class com.apollographql.apollo3.annotations/GraphQLName : kotlin/Annotation { // com.apollographql.apollo3.annotations/GraphQLName|null[0]
55-
constructor <init>(kotlin/String) // com.apollographql.apollo3.annotations/GraphQLName.<init>|<init>(kotlin.String){}[0]
56-
final val name // com.apollographql.apollo3.annotations/GraphQLName.name|{}name[0]
57-
final fun <get-name>(): kotlin/String // com.apollographql.apollo3.annotations/GraphQLName.name.<get-name>|<get-name>(){}[0]
58-
}
59-
open annotation class com.apollographql.apollo3.annotations/GraphQLObject : kotlin/Annotation { // com.apollographql.apollo3.annotations/GraphQLObject|null[0]
60-
constructor <init>(kotlin/String = ...) // com.apollographql.apollo3.annotations/GraphQLObject.<init>|<init>(kotlin.String){}[0]
61-
final val name // com.apollographql.apollo3.annotations/GraphQLObject.name|{}name[0]
62-
final fun <get-name>(): kotlin/String // com.apollographql.apollo3.annotations/GraphQLObject.name.<get-name>|<get-name>(){}[0]
63-
}

libraries/apollo-annotations/src/commonMain/kotlin/com/apollographql/apollo3/annotations/GraphQLAdapter.kt

Lines changed: 0 additions & 11 deletions
This file was deleted.

libraries/apollo-annotations/src/commonMain/kotlin/com/apollographql/apollo3/annotations/GraphQLName.kt

Lines changed: 0 additions & 15 deletions
This file was deleted.

libraries/apollo-annotations/src/commonMain/kotlin/com/apollographql/apollo3/annotations/GraphQLObject.kt

Lines changed: 0 additions & 11 deletions
This file was deleted.
Lines changed: 30 additions & 82 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,13 @@
11

2-
import com.android.build.gradle.tasks.BundleAar
2+
import com.apollographql.execution.gradle.internal.CopySchema
33
import dev.adamko.dokkatoo.tasks.DokkatooGenerateTask
4-
import org.gradle.api.internal.artifacts.transform.UnzipTransform
54
import org.jetbrains.kotlin.gradle.dsl.KotlinVersion
6-
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
75

86
plugins {
97
id("org.jetbrains.kotlin.multiplatform")
108
alias(libs.plugins.apollo.published)
119
id("com.google.devtools.ksp")
10+
id("com.apollographql.execution")
1211
}
1312

1413
apolloLibrary(
@@ -27,17 +26,29 @@ apolloLibrary(
2726

2827
kotlin {
2928
sourceSets {
30-
findByName("commonMain")?.apply {
31-
kotlin.srcDir("build/generated/ksp/metadata/commonMain/kotlin")
32-
29+
findByName("commonMain")!!.apply {
3330
dependencies {
3431
implementation(project(":apollo-normalized-cache"))
3532
implementation(project(":apollo-normalized-cache-api"))
3633
implementation(project(":apollo-ast"))
3734
api(project(":apollo-runtime"))
35+
implementation(libs.apollo.execution)
3836
}
3937
}
4038

39+
getByName("jvmMain") {
40+
dependencies {
41+
implementation(libs.apollo.execution.ktor)
42+
implementation(libs.ktor.server.cio)
43+
implementation(libs.slf4j)
44+
}
45+
}
46+
getByName("jvmTest") {
47+
dependencies {
48+
implementation(libs.kotlin.test)
49+
implementation(project(":apollo-runtime"))
50+
}
51+
}
4152
findByName("androidMain")?.apply {
4253
dependencies {
4354
implementation(libs.androidx.startup.runtime)
@@ -46,87 +57,24 @@ kotlin {
4657
}
4758
}
4859

49-
val shadow = configurations.create("shadow") {
50-
isCanBeConsumed = false
51-
isCanBeResolved = true
60+
tasks.withType<DokkatooGenerateTask>().configureEach {
61+
dependsOn("kspCommonMainKotlinMetadata")
5262
}
53-
54-
val artifactType = Attribute.of("artifactType", String::class.java)
55-
56-
val shadowUnzipped = configurations.create("shadowUnzipped") {
57-
isCanBeConsumed = false
58-
isCanBeResolved = true
59-
attributes {
60-
attribute(artifactType, ArtifactTypeDefinition.DIRECTORY_TYPE)
61-
}
62-
extendsFrom(shadow)
63-
}
64-
65-
dependencies {
66-
// apollo-execution is not published: we bundle it into the aar artifact
67-
add(shadow.name, project(":apollo-execution-incubating")) {
68-
isTransitive = false
69-
}
70-
}
71-
72-
configurations.all {
73-
resolutionStrategy.eachDependency {
74-
/**
75-
* apollo-ksp is not published yet so we need to get it from the current build
76-
*/
77-
if (requested.module.name == "apollo-ksp") {
78-
useTarget("com.apollographql.apollo3:apollo-ksp-incubating:${requested.version}")
79-
}
80-
}
81-
}
82-
configurations.getByName(kotlin.sourceSets.getByName("commonMain").compileOnlyConfigurationName).extendsFrom(shadow)
83-
84-
/**
85-
* KSP configuration
86-
* KMP support isn't great so we wire most of the things manually
87-
* See https://github.com/google/ksp/pull/1021
88-
*/
89-
fun configureKsp() {
90-
dependencies {
91-
add("kspCommonMainMetadata", project(":apollo-ksp-incubating"))
92-
add(
93-
"kspCommonMainMetadata",
94-
apollo.apolloKspProcessor(
95-
schema = file(path = "src/androidMain/resources/schema.graphqls"),
96-
service = "apolloDebugServer",
97-
packageName = "com.apollographql.apollo3.debugserver.internal.graphql"
98-
)
99-
)
100-
}
101-
tasks.withType<KotlinCompile>().configureEach {
102-
dependsOn("kspCommonMainKotlinMetadata")
103-
}
104-
tasks.withType<DokkatooGenerateTask>().configureEach {
63+
tasks.configureEach {
64+
if (name.endsWith("sourcesJar", ignoreCase = true)) {
10565
dependsOn("kspCommonMainKotlinMetadata")
10666
}
107-
tasks.configureEach {
108-
if (name.endsWith("sourcesJar", ignoreCase = true)) {
109-
dependsOn("kspCommonMainKotlinMetadata")
110-
}
111-
}
11267
}
113-
configureKsp()
11468

115-
// apollo-execution is not published: we bundle it into the aar artifact
116-
val jarApolloExecution = tasks.register<Jar>("jarApolloExecution") {
117-
archiveBaseName.set("apollo-execution")
118-
from(shadowUnzipped)
119-
}
120-
121-
tasks.withType<BundleAar>().configureEach {
122-
from(jarApolloExecution) {
123-
into("libs")
69+
apolloExecution {
70+
service("apolloDebugServer") {
71+
packageName = "com.apollographql.apollo3.debugserver.internal.graphql"
72+
schemaPath.set("graphql/schema.graphqls")
12473
}
12574
}
126-
127-
dependencies {
128-
registerTransform(UnzipTransform::class.java) {
129-
from.attribute(artifactType, ArtifactTypeDefinition.JAR_TYPE)
130-
to.attribute(artifactType, ArtifactTypeDefinition.DIRECTORY_TYPE)
75+
tasks.withType(CopySchema::class.java).configureEach {
76+
doFirst {
77+
// https://github.com/apollographql/apollo-kotlin-execution/pull/6
78+
(this as CopySchema).to.get().asFile.delete()
13179
}
132-
}
80+
}
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
schema {
2+
query: Query
3+
}
4+
5+
scalar Fields
6+
7+
"""
8+
The root query
9+
"""
10+
type Query {
11+
apolloClients: [ApolloClient!]!
12+
13+
"""
14+
Returns null if an ApolloClient with the given id is not found.
15+
"""
16+
apolloClient(id: ID!): ApolloClient
17+
}
18+
19+
type ApolloClient {
20+
id: ID!
21+
22+
displayName: String!
23+
24+
normalizedCaches: [NormalizedCache!]!
25+
26+
normalizedCache(id: ID!): NormalizedCache
27+
}
28+
29+
type NormalizedCache {
30+
id: ID!
31+
32+
displayName: String!
33+
34+
recordCount: Int!
35+
36+
records: [Record!]!
37+
}
38+
39+
type Record {
40+
key: String!
41+
42+
fields: Fields!
43+
44+
sizeInBytes: Int!
45+
}

0 commit comments

Comments
 (0)