You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/source/migration/5.0.mdx
+41-15Lines changed: 41 additions & 15 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -11,11 +11,11 @@ In most cases, bumping the version should be transparent. The exceptions are:
11
11
- Symbols that were `DeprecationLevel.ERROR` in v4 are now removed. Remove all your deprecated usages before migrating to v5.
12
12
-`apollo-compiler` is still considered experimental. You will need to update your [Apollo Compiler Plugins](https://www.apollographql.com/docs/kotlin/advanced/compiler-plugins).
13
13
14
-
We tried hard to minimize the impact of the binary changes so that running code compiled for v4 will run with v5. But the occasional incompatibility may happen. In that case, the incompatible libraries will need to compile against v5 and make a new release.
14
+
Read below for more details.
15
15
16
-
## Removed `apollo-gradle-plugin-external` and `com.apollographql.apollo.external`
16
+
## `apollo-gradle-plugin-external`
17
17
18
-
The Apollo Gradle Plugin [now uses classloader isolation](https://github.com/apollographql/apollo-kotlin/pull/6524) and does not use R8 to relocate dependencies anymore. As a result, the `apollo-gradle-plugin-external` artifact and the `com.apollographql.apollo.external` plugins have been removed. You should use `apollo-gradle-plugin` and `com.apollographql.apollo` instead:
18
+
The Apollo Gradle Plugin [now uses classloader isolation](https://github.com/apollographql/apollo-kotlin/pull/6524) and does not use R8 to relocate dependencies anymore. As a result, the `apollo-gradle-plugin-external` artifact and the `com.apollographql.apollo.external` plugins are not used anymore and now point to an empty plugin. You should use `apollo-gradle-plugin` and `com.apollographql.apollo` instead:
19
19
20
20
```kotlin
21
21
// Replace
@@ -31,13 +31,13 @@ plugins {
31
31
}
32
32
```
33
33
34
-
## Removed `Service.operationOutputGenerator` and `Service.operationIdGenerator`
34
+
## `apollo-gradle-plugin`
35
35
36
-
While running your `OperationOutputGenerator` directly in your build script classpath was convenient, it required the compiler code to run completely in the global buildscript classpath. This created numerous issues such as incompatible dependencies and/or unneeded build invalidations.
36
+
### `operationOutputGenerator`and`operationIdGenerator` are removed.
37
37
38
-
To mitigate the impact of incompatible dependencies, Apollo Kotlin 4 used to shadow and relocate all its dependencies, which came with additional issues: increased build times, weird stack traces and larger plugin size.
38
+
While running your `OperationOutputGenerator` directly in your build script classpath was convenient, it required the compiler code to run completely in the global buildscript classpath. This created many issues such as incompatible dependencies and/or unneeded build invalidations.
39
39
40
-
Apollo Kotlin v5 instead runs its compiler in isolated classloaders, meaning generating the ids now needs to happen in that same classloader.
40
+
The v5 Apollo Gradle plugin runs the Apollo compiler in isolated classloaders, meaning generating the ids needs to happen in that same classloader using the `ServiceLoader` API.
41
41
42
42
To do so, use `ApolloCompilerPlugin`:
43
43
@@ -56,14 +56,42 @@ class MyPlugin : ApolloCompilerPlugin {
56
56
57
57
Read more in the [persisted queries](https://www.apollographql.com/docs/kotlin/v5/advanced/persisted-queries) and [compiler plugins](https://www.apollographql.com/docs/kotlin/v5/advanced/compiler-plugins) pages.
58
58
59
+
### `downloadApolloSchema` is removed
59
60
60
-
## Removed ApolloIdlingResource
61
+
Apollo Kotlin 4 allowed downloading a schema with a `downloadApolloSchema` Gradle task. This task is now removed.
61
62
62
-
Apollo Kotlin 5 removes `ApolloIdlingResource`. `IdlingResource` usage has been slowly decreasing and there are now better alternatives to do your testing.
63
+
For single-shot downloads of a schema during development, use the [Apollo Kotlin CLI](https://github.com/apollographql/apollo-kotlin-cli). It is much faster (no Gradle configuration), comes with interactive help and soon autocomplete scripts.
63
64
64
-
For a good overview of alternative solutions, we recommend [this article from Jose Alcérreca](https://medium.com/androiddevelopers/alternatives-to-idling-resources-in-compose-tests-8ae71f9fc473).
65
+
Alternatively, configure [your introspection block](https://www.apollographql.com/docs/kotlin/advanced/plugin-recipes#downloading-a-schema). Doing so documents how to update the schema for other developers and makes it easy to update the schema without passing extra arguments.
65
66
66
-
## Using `@nonnull` is now an error
67
+
```kotlin
68
+
apollo {
69
+
service("service") {
70
+
packageName.set("com.example")
71
+
72
+
// This creates a downloadServiceApolloSchemaFromIntrospection task
Apollo Kotlin 5 removes the `apollo-idling-resource` artifact. Usage of `ApolloIdlingResource` has been decreasing, and better alternatives for testing are now available.
89
+
90
+
For a good overview of alternative solutions, we recommend reading [this article from Jose Alcérreca](https://medium.com/androiddevelopers/alternatives-to-idling-resources-in-compose-tests-8ae71f9fc473).
91
+
92
+
## `apollo-compiler`
93
+
94
+
### `@nonnull` is an error
67
95
68
96
Apollo Kotlin 4 had a `@nonnull` client directive to force generating fields as non-null.
69
97
@@ -98,9 +126,9 @@ query GetUser {
98
126
You can read more in the ["handling nullability" page](https://www.apollographql.com/docs/kotlin/advanced/nullability).
99
127
100
128
101
-
## `apollo-http-cache` is deprecated
129
+
## `apollo-http-cache`
102
130
103
-
Apollo Kotlin 5 removes the `apollo-http-cache`artifact. Instead, it uses the existing OkHttp cache using [cacheUrlOverride](https://square.github.io/okhttp/5.x/okhttp/okhttp3/-request/-builder/cache-url-override.html).
131
+
`apollo-http-cache`is now deprecated. Instead, it uses the existing OkHttp cache using [cacheUrlOverride](https://square.github.io/okhttp/5.x/okhttp/okhttp3/-request/-builder/cache-url-override.html).
We believe this new caching scheme is simpler and more aligned with the rest of the ecosystem, but there are important differences with the previous scheme:
174
200
175
201
- There is no equivalent to `NetworkFirst` and/or `httpExpireTimeout()`.
0 commit comments