Skip to content

Commit 3af9b79

Browse files
authored
Deprecate "operationOutput" and ./gradlew downloadApolloSchema (#6097)
* Deprecate "operationOutput" * Deprecate ./gradlew downloadApolloSchema
1 parent edc9dbe commit 3af9b79

File tree

8 files changed

+17
-3
lines changed

8 files changed

+17
-3
lines changed

docs/source/index.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ Apollo Kotlin supports three types of files:
7272
- `.json` schema files: describes the types in your backend using the Json syntax.
7373
- `.graphql` executable files: describes your queries and operations in the GraphQL syntax.
7474

75-
By default, Apollo Kotlin requires a schema in your module's `src/main/graphql` (or `src/commonMain/graphql` for KMP) directory. You can download a schema using introspection with the `./gradlew downloadApolloSchema` task. Sometimes introspection is disabled, and you will have to ask your backend team to provide a schema. Copy this schema to your module:
75+
By default, Apollo Kotlin requires a schema in your module's `src/main/graphql` (or `src/commonMain/graphql` for KMP) directory. You can download a schema using introspection using GraphiQL or Studio. Sometimes introspection is disabled, and you will have to ask your backend team to provide a schema. Copy this schema to your module:
7676

7777
```
7878
cp ${schema} ${module}/src/main/graphql/

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,5 +31,6 @@ annotation class ApolloDeprecatedSince(val version: Version) {
3131
v3_7_2,
3232
v3_7_5,
3333
v4_0_0,
34+
v4_0_1,
3435
}
3536
}

libraries/apollo-compiler/src/main/kotlin/com/apollographql/apollo/compiler/Options.kt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package com.apollographql.apollo.compiler
22

3+
import com.apollographql.apollo.annotations.ApolloDeprecatedSince
34
import com.apollographql.apollo.annotations.ApolloExperimental
45
import kotlinx.serialization.SerialName
56
import kotlinx.serialization.Serializable
@@ -13,6 +14,8 @@ const val ADD_TYPENAME_IF_POLYMORPHIC = "ifPolymorphic"
1314
const val ADD_TYPENAME_IF_ABSTRACT = "ifAbstract"
1415
const val ADD_TYPENAME_ALWAYS = "always"
1516

17+
@Deprecated("Use $MANIFEST_PERSISTED_QUERY instead")
18+
@ApolloDeprecatedSince(ApolloDeprecatedSince.Version.v4_0_1)
1619
const val MANIFEST_OPERATION_OUTPUT = "operationOutput"
1720
const val MANIFEST_PERSISTED_QUERY = "persistedQueryManifest"
1821
const val MANIFEST_NONE = "none"

libraries/apollo-gradle-plugin-external/src/main/kotlin/com/apollographql/apollo/gradle/api/Service.kt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ package com.apollographql.apollo.gradle.api
55
import com.android.build.gradle.api.BaseVariant
66
import com.apollographql.apollo.annotations.ApolloDeprecatedSince
77
import com.apollographql.apollo.annotations.ApolloExperimental
8+
import com.apollographql.apollo.compiler.MANIFEST_PERSISTED_QUERY
89
import com.apollographql.apollo.compiler.OperationIdGenerator
910
import com.apollographql.apollo.compiler.OperationOutputGenerator
1011
import com.apollographql.apollo.compiler.PackageNameGenerator
@@ -542,7 +543,7 @@ interface Service {
542543
*
543544
* Defaults value: false
544545
*/
545-
@Deprecated("Use operationManifestFormat", ReplaceWith("operationManifestFormat.set(\"operationOutput\""))
546+
@Deprecated("Use operationManifestFormat", ReplaceWith("operationManifestFormat.set(\"$MANIFEST_PERSISTED_QUERY\")"))
546547
@ApolloDeprecatedSince(ApolloDeprecatedSince.Version.v4_0_0)
547548
val generateOperationOutput: Property<Boolean>
548549

libraries/apollo-gradle-plugin-external/src/main/kotlin/com/apollographql/apollo/gradle/internal/ApolloGenerateOptionsTask.kt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ import com.apollographql.apollo.compiler.ExpressionAdapterInitializer
66
import com.apollographql.apollo.compiler.GeneratedMethod
77
import com.apollographql.apollo.compiler.IrOptions
88
import com.apollographql.apollo.compiler.JavaNullable
9+
import com.apollographql.apollo.compiler.MANIFEST_OPERATION_OUTPUT
10+
import com.apollographql.apollo.compiler.MANIFEST_PERSISTED_QUERY
911
import com.apollographql.apollo.compiler.MODELS_OPERATION_BASED
1012
import com.apollographql.apollo.compiler.MODELS_OPERATION_BASED_WITH_INTERFACES
1113
import com.apollographql.apollo.compiler.MODELS_RESPONSE_BASED

libraries/apollo-gradle-plugin-external/src/main/kotlin/com/apollographql/apollo/gradle/internal/ApolloRegisterOperationsTask.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@ abstract class ApolloRegisterOperationsTask: DefaultTask() {
7979
}
8080
} else {
8181
logger.warn("Apollo: registering operations without a listId is deprecated")
82+
@Suppress("DEPRECATION")
8283
check(operationManifestFormat.get() == MANIFEST_OPERATION_OUTPUT) {
8384
"""Apollo: registering legacy operations requires operationManifestFormat = "$MANIFEST_OPERATION_OUTPUT":
8485
|apollo {

libraries/apollo-gradle-plugin-external/src/main/kotlin/com/apollographql/apollo/gradle/internal/DefaultApolloExtension.kt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,9 @@ abstract class DefaultApolloExtension(
160160
project.tasks.register(ModelNames.downloadApolloSchema(), ApolloDownloadSchemaTask::class.java) { task ->
161161
task.group = TASK_GROUP
162162
task.projectRootDir = project.rootDir.absolutePath
163+
task.doLast {
164+
it.logger.lifecycle("Apollo: using './gradlew downloadApolloSchema' is deprecated. Please use the Apollo Kotlin cli for one-time downloads or the introspection {} block for Gradle downloads. See https://go.apollo.dev/ak-download-schema.")
165+
}
163166
}
164167

165168
/**

libraries/apollo-gradle-plugin-external/src/main/kotlin/com/apollographql/apollo/gradle/internal/defaults.kt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,14 +30,17 @@ private fun DefaultService.resolveOperationManifest(): Pair<String, File?> {
3030
var format = operationManifestFormat.orNull
3131
if (format == null) {
3232
if (generateOperationOutput.orElse(false).get()) {
33+
println("Apollo: using 'generateOperationOutput' is deprecated, please use 'operationManifestFormat.set(\"$MANIFEST_PERSISTED_QUERY\")' instead")
3334
format = MANIFEST_OPERATION_OUTPUT
3435
}
3536
} else {
3637
when (format) {
3738
MANIFEST_NONE,
38-
MANIFEST_OPERATION_OUTPUT,
3939
MANIFEST_PERSISTED_QUERY,
4040
-> Unit
41+
MANIFEST_OPERATION_OUTPUT -> {
42+
println("Apollo: using '$MANIFEST_OPERATION_OUTPUT' is deprecated, please use '$MANIFEST_PERSISTED_QUERY' instead")
43+
}
4144

4245
else -> {
4346
error("Apollo: unknown operation manifest format: $format")

0 commit comments

Comments
 (0)