Skip to content

Commit e0aaeb2

Browse files
committed
Fix benchmarks (apollographql#5841)
Revert compile time possible types (apollographql#5842) * Revert "fun => val (apollographql#5826)" This reverts commit a0db6ad. * Revert "Add compile time possibleTypes (apollographql#5823)" This reverts commit 0aedd8c.
1 parent bb21996 commit e0aaeb2

File tree

11 files changed

+49
-82
lines changed

11 files changed

+49
-82
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-compiler/src/main/kotlin/com/apollographql/apollo3/compiler/codegen/kotlin/KotlinCodegen.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@ internal object KotlinCodegen {
203203
builders.add(ObjectBuilder(context, irObject, generateDataBuilders))
204204
}
205205
if (generateSchema && context.resolver.resolve(ResolverKey(ResolverKeyKind.Schema, "")) == null) {
206-
builders.add(SchemaBuilder(context, codegenSchema.schema, irSchema.irObjects, irSchema.irInterfaces, irSchema.irUnions, irSchema.irEnums))
206+
builders.add(SchemaBuilder(context, irSchema.irObjects, irSchema.irInterfaces, irSchema.irUnions, irSchema.irEnums))
207207
builders.add(CustomScalarAdaptersBuilder(context, scalarMapping))
208208
}
209209

libraries/apollo-compiler/src/main/kotlin/com/apollographql/apollo3/compiler/codegen/kotlin/schema/SchemaBuilder.kt

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,12 @@
11
package com.apollographql.apollo3.compiler.codegen.kotlin.schema
22

33

4-
import com.apollographql.apollo3.ast.Schema
54
import com.apollographql.apollo3.compiler.codegen.Identifier.type
65
import com.apollographql.apollo3.compiler.codegen.kotlin.CgFile
76
import com.apollographql.apollo3.compiler.codegen.kotlin.CgFileBuilder
87
import com.apollographql.apollo3.compiler.codegen.kotlin.KotlinSchemaContext
98
import com.apollographql.apollo3.compiler.codegen.kotlin.KotlinSymbols
109
import com.apollographql.apollo3.compiler.codegen.schemaSubPackageName
11-
import com.apollographql.apollo3.compiler.decapitalizeFirstLetter
1210
import com.apollographql.apollo3.compiler.ir.IrEnum
1311
import com.apollographql.apollo3.compiler.ir.IrInterface
1412
import com.apollographql.apollo3.compiler.ir.IrObject
@@ -20,12 +18,9 @@ import com.squareup.kotlinpoet.MemberName
2018
import com.squareup.kotlinpoet.ParameterizedTypeName.Companion.parameterizedBy
2119
import com.squareup.kotlinpoet.PropertySpec
2220
import com.squareup.kotlinpoet.TypeSpec
23-
import com.squareup.kotlinpoet.buildCodeBlock
24-
import com.squareup.kotlinpoet.joinToCode
2521

2622
internal class SchemaBuilder(
2723
private val context: KotlinSchemaContext,
28-
private val schema: Schema,
2924
private val objects: List<IrObject>,
3025
private val interfaces: List<IrInterface>,
3126
private val unions: List<IrUnion>,
@@ -70,25 +65,6 @@ internal class SchemaBuilder(
7065
.addKdoc("A __Schema object containing all the composite types and a possibleTypes helper function")
7166
.addProperty(typesPropertySpec())
7267
.addFunction(possibleTypesFunSpec())
73-
.apply {
74-
(interfaces + unions).forEach {
75-
addProperty(possibleTypesPropertySpec(it.name, schema.possibleTypes(schema.typeDefinition(it.name))))
76-
}
77-
}
78-
.build()
79-
}
80-
81-
private fun possibleTypesPropertySpec(name: String, possibleTypes: Set<String>): PropertySpec {
82-
return PropertySpec.builder("${name.decapitalizeFirstLetter()}PossibleTypes", KotlinSymbols.List.parameterizedBy(KotlinSymbols.ObjectType))
83-
.initializer(
84-
buildCodeBlock {
85-
add("listOf(")
86-
add(possibleTypes.map {
87-
CodeBlock.of("%L.$type", context.resolver.resolveSchemaType(it))
88-
}.joinToCode(", "))
89-
add(")")
90-
}
91-
)
9268
.build()
9369
}
9470

libraries/apollo-compiler/src/test/graphql/com/example/data_builders/kotlin/operationBased/data_builders/schema/__Schema.kt.expected

Lines changed: 0 additions & 10 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

libraries/apollo-compiler/src/test/graphql/com/example/data_builders/kotlin/responseBased/data_builders/schema/__Schema.kt.expected

Lines changed: 0 additions & 10 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

libraries/apollo-compiler/src/test/graphql/com/example/measurements

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22
// If you updated the codegen and test fixtures, you should commit this file too.
33

44
Test: Total LOC:
5-
aggregate-all 204924
6-
aggregate-kotlin-responseBased 65822
7-
aggregate-kotlin-operationBased 42426
5+
aggregate-all 204879
6+
aggregate-kotlin-responseBased 65795
7+
aggregate-kotlin-operationBased 42408
88
aggregate-kotlin-compat 0
99
aggregate-java-operationBased 96676
1010

@@ -13,9 +13,9 @@ kotlin-operationBased-fragments_with_defer_and_include_directives
1313
java-operationBased-data_builders 3031
1414
java-operationBased-mutation_create_review 2435
1515
kotlin-responseBased-fragment_with_inline_fragment 2422
16-
kotlin-responseBased-data_builders 2365
16+
kotlin-responseBased-data_builders 2355
1717
java-operationBased-fragment_with_inline_fragment 2261
18-
kotlin-operationBased-data_builders 2014
18+
kotlin-operationBased-data_builders 2004
1919
java-operationBased-nested_named_fragments 1910
2020
java-operationBased-fragment_spread_with_include_directive 1667
2121
java-operationBased-union_inline_fragments 1666
@@ -27,7 +27,7 @@ java-operationBased-mutation_create_review_semantic_naming
2727
java-operationBased-root_query_fragment_with_nested_fragments 1607
2828
java-operationBased-simple_fragment 1505
2929
java-operationBased-named_fragment_delegate 1493
30-
kotlin-responseBased-mutation_create_review 1463
30+
kotlin-responseBased-mutation_create_review 1454
3131
java-operationBased-named_fragment_with_variables 1405
3232
kotlin-responseBased-named_fragment_delegate 1371
3333
kotlin-responseBased-unique_type_name 1354
@@ -42,7 +42,7 @@ kotlin-operationBased-nested_named_fragments
4242
kotlin-responseBased-inline_fragment_intersection 1245
4343
java-operationBased-two_heroes_with_friends 1241
4444
java-operationBased-inline_fragment_merge_fields 1229
45-
kotlin-responseBased-simple_fragment 1203
45+
kotlin-responseBased-simple_fragment 1195
4646
java-operationBased-named_fragment_inside_inline_fragment 1186
4747
java-operationBased-fragments_with_type_condition 1183
4848
java-operationBased-target_name 1168
@@ -69,7 +69,7 @@ kotlin-operationBased-root_query_fragment_with_nested_fragments
6969
java-operationBased-inline_fragments_with_friends 1056
7070
java-operationBased-fragment_spread_with_nested_fields 1054
7171
kotlin-responseBased-simple_fragment_with_inline_fragments 1052
72-
kotlin-operationBased-simple_fragment 1051
72+
kotlin-operationBased-simple_fragment 1043
7373
java-operationBased-operationbased2_ex8 1042
7474
kotlin-operationBased-named_fragment_delegate 1013
7575
java-operationBased-decapitalized_fields 993

libraries/apollo-compiler/src/test/graphql/com/example/mutation_create_review/kotlin/responseBased/mutation_create_review/schema/__Schema.kt.expected

Lines changed: 0 additions & 9 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

libraries/apollo-compiler/src/test/graphql/com/example/simple_fragment/kotlin/operationBased/simple_fragment/schema/__Schema.kt.expected

Lines changed: 0 additions & 8 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

libraries/apollo-compiler/src/test/graphql/com/example/simple_fragment/kotlin/responseBased/simple_fragment/schema/__Schema.kt.expected

Lines changed: 0 additions & 8 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)