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/4.0.mdx
+22-4Lines changed: 22 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -234,7 +234,7 @@ val call = client.query(MyQuery())
234
234
235
235
In Apollo Kotlin 3, you could depend on an upstream GraphQL module by using the `apolloMetadata` configuration.
236
236
237
-
In Apollo Kotlin 4, this is now done with the `Service.dependsOn()`. This allows better management of dependencies when multiple services are used as better symmetry with `isADependencyOf` below.
237
+
In Apollo Kotlin 4, this is now done with the `Service.dependsOn()`. `Service.dependsOn()` works for multi-services repositories and, by hiding the configuration names, allows us to change the implementation in the future if needed. For an example to accommodate [Gradle project isolation](https://docs.gradle.org/current/userguide/isolated_projects.html).
238
238
239
239
```kotlin
240
240
// feature1/build.gradle.kts
@@ -272,7 +272,7 @@ apollo {
272
272
273
273
In multi-module projects, by default, all the types of an upstream module are generated because there is no way to know in advance what types are going to be used by downstream modules. For large projects this can lead to a lot of unused code and an increased build time.
274
274
275
-
To avoid this, in Apollo Kotlin 3 you could manually specify which types to generate by using `alwaysGenerateTypesMatching`. In Apollo Kotlin 4 this can now be computed automatically by detecting which types are used by the downstream modules.
275
+
To avoid this, in Apollo Kotlin 3 you could manually specify which types to generate by using `alwaysGenerateTypesMatching`. In Apollo Kotlin 4 you can opt in auto-detection of used types.
276
276
277
277
To enable this, add the "opposite" link of dependencies with `isADependencyOf()`.
278
278
@@ -319,9 +319,27 @@ dependencies {
319
319
apolloUsedCoordinates(project(":feature1"))
320
320
}
321
321
```
322
-
### Publishing is no longer configured automatically
322
+
### All schema types are generated in the schema module
323
323
324
-
Apollo artifacts are not automatically published anymore. To publish them, create a `MavenPublication`:
324
+
Apollo Kotlin 3 allows to generate schema types for enums or input types in any module. While very flexible, this creates a lot of complexity:
325
+
326
+
- Duplicate types could be generated in sibling modules.
327
+
- It's unclear what package name to use.
328
+
- Using the downstream module package name means the qualified name of the class changes if the type is moved to another module.
329
+
- Using the schema module package name can be surprising as it's not the one specified in the Gradle configuration.
330
+
- Gradle has APIs to aggregate all projects in a project isolation compatible way (see [gradle#22514](https://github.com/gradle/gradle/issues/22514)). But it's not clear yet how to do this for a subset of the projects (see [gradle#29037](https://github.com/gradle/gradle/issues/29037)).
331
+
332
+
In Apollo Kotlin 4, we decided to enforce generating all schema types in a single module, the schema module. This restriction simplifies the Gradle plugin and makes it easier to debug and evolve that code.
333
+
334
+
It also means that you can't publish your schema module with a subset of the types and let other modules generate their own in another repository. If you are publishing your schema module, it needs to contain all the schema types used by your consumers, either using `alwaysGenerateTypesMatching.set(listOf(".*"))` or manually adding them.
335
+
336
+
If that is too much of a limitation, please open an issue and we will revisit.
337
+
338
+
### Apollo metadata publications are no longer created automatically
339
+
340
+
Apollo Kotlin 3 automatically creates an "apollo" publication using artifactId `${project.name}-apollo`. This created dependency resolution issues in some projects (see [apollo-kotlin#4350](https://github.com/apollographql/apollo-kotlin/issues/4350)).
341
+
342
+
Apollo Kotlin 4 exposes a software component instead of a publication to give more control over how publications are created. In order to publish the Apollo metadata, create a `MavenPublication` manually:
Copy file name to clipboardExpand all lines: libraries/apollo-gradle-plugin-external/src/main/kotlin/com/apollographql/apollo/gradle/api/ApolloAttributes.kt
0 commit comments