Skip to content

Commit cd71e70

Browse files
committed
Avoid bidirectional = true
1 parent d0bfd7c commit cd71e70

File tree

4 files changed

+36
-44
lines changed

4 files changed

+36
-44
lines changed

multi-modules-and-services/feature1/build.gradle.kts

Lines changed: 4 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -15,29 +15,15 @@ apollo {
1515
srcDir("src/main/graphql/servicea")
1616
packageName.set("com.example.servicea")
1717

18-
/*
19-
* Depend on the schema and fragments from service "service-a" in module "graphqlShared".
20-
*
21-
* The `bidirectional` parameter allows to reduce the size of the generated code by telling
22-
* upstream modules to only generate the used types.
23-
*
24-
* See https://www.apollographql.com/docs/kotlin/advanced/multi-modules/#auto-detection-of-used-types
25-
*/
26-
dependsOn(project(":graphqlShared"), bidirectional = true)
18+
// Depend on the schema and fragments from service "service-a" in module "graphqlShared".
19+
dependsOn(project(":graphqlShared"))
2720
}
2821

2922
service("service-b") {
3023
srcDir("src/main/graphql/serviceb")
3124
packageName.set("com.example.serviceb")
3225

33-
/*
34-
* Depend on the schema and fragments from service "service-b" in module "graphqlShared".
35-
*
36-
* The `bidirectional` parameter allows to reduce the size of the generated code by telling
37-
* upstream modules to only generate the used types.
38-
*
39-
* See https://www.apollographql.com/docs/kotlin/advanced/multi-modules/#auto-detection-of-used-types
40-
*/
41-
dependsOn(project(":graphqlShared"), bidirectional = true)
26+
// Depend on the schema and fragments from service "service-b" in module "graphqlShared".
27+
dependsOn(project(":graphqlShared"))
4228
}
4329
}

multi-modules-and-services/feature2/build.gradle.kts

Lines changed: 4 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -15,29 +15,15 @@ apollo {
1515
srcDir("src/main/graphql/servicea")
1616
packageName.set("com.example.servicea")
1717

18-
/*
19-
* Depend on the schema and fragments from service "service-a" in module "graphqlShared".
20-
*
21-
* The `bidirectional` parameter allows to reduce the size of the generated code by telling
22-
* upstream modules to only generate the used types.
23-
*
24-
* See https://www.apollographql.com/docs/kotlin/advanced/multi-modules/#auto-detection-of-used-types
25-
*/
26-
dependsOn(project(":graphqlShared"), bidirectional = true)
18+
// Depend on the schema and fragments from service "service-a" in module "graphqlShared".
19+
dependsOn(project(":graphqlShared"))
2720
}
2821

2922
service("service-b") {
3023
srcDir("src/main/graphql/serviceb")
3124
packageName.set("com.example.serviceb")
3225

33-
/*
34-
* Depend on the schema and fragments from service "service-b" in module "graphqlShared".
35-
*
36-
* The `bidirectional` parameter allows to reduce the size of the generated code by telling
37-
* upstream modules to only generate the used types.
38-
*
39-
* See https://www.apollographql.com/docs/kotlin/advanced/multi-modules/#auto-detection-of-used-types
40-
*/
41-
dependsOn(project(":graphqlShared"), bidirectional = true)
26+
// Depend on the schema and fragments from service "service-b" in module "graphqlShared".
27+
dependsOn(project(":graphqlShared"))
4228
}
4329
}

multi-modules-and-services/graphqlSchema/build.gradle.kts

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,14 @@ apollo {
1919
endpointUrl.set("https://schema-servicea.com")
2020
schemaFile.set(file("src/main/graphql/servicea/schema.graphqls"))
2121
}
22+
23+
/*
24+
* Enable the bidirectional dependency which allows to reduce the size of the generated code by telling
25+
* upstream modules to only generate the used types.
26+
*
27+
* See https://www.apollographql.com/docs/kotlin/advanced/multi-modules/#auto-detection-of-used-types
28+
*/
29+
isADependencyOf(project(":graphqlShared"))
2230
}
2331

2432
service("service-b") {
@@ -31,5 +39,13 @@ apollo {
3139
endpointUrl.set("https://schema-serviceb.com")
3240
schemaFile.set(file("src/main/graphql/serviceb/schema.graphqls"))
3341
}
42+
43+
/*
44+
* Enable the bidirectional dependency which allows to reduce the size of the generated code by telling
45+
* upstream modules to only generate the used types.
46+
*
47+
* See https://www.apollographql.com/docs/kotlin/advanced/multi-modules/#auto-detection-of-used-types
48+
*/
49+
isADependencyOf(project(":graphqlShared"))
3450
}
3551
}

multi-modules-and-services/graphqlShared/build.gradle.kts

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,29 +15,33 @@ apollo {
1515
srcDir("src/main/graphql/servicea")
1616
packageName.set("com.example.servicea")
1717

18+
// Depend on the schema from service "service-a" in module "graphqlSchema".
19+
dependsOn(project(":graphqlSchema"))
20+
1821
/*
19-
* Depend on the schema from service "service-a" in module "graphqlSchema".
20-
*
21-
* The `bidirectional` parameter allows to reduce the size of the generated code by telling
22+
* Enable the bidirectional dependencies which allow to reduce the size of the generated code by telling
2223
* upstream modules to only generate the used types.
2324
*
2425
* See https://www.apollographql.com/docs/kotlin/advanced/multi-modules/#auto-detection-of-used-types
2526
*/
26-
dependsOn(project(":graphqlSchema"), bidirectional = true)
27+
isADependencyOf(project(":feature1"))
28+
isADependencyOf(project(":feature2"))
2729
}
2830

2931
service("service-b") {
3032
srcDir("src/main/graphql/serviceb")
3133
packageName.set("com.example.serviceb")
3234

35+
// Depend on the schema from service "service-b" in module "graphqlSchema".
36+
dependsOn(project(":graphqlSchema"))
37+
3338
/*
34-
* Depend on the schema from service "service-b" in module "graphqlSchema".
35-
*
36-
* The `bidirectional` parameter allows to reduce the size of the generated code by telling
39+
* Enable the bidirectional dependencies which allow to reduce the size of the generated code by telling
3740
* upstream modules to only generate the used types.
3841
*
3942
* See https://www.apollographql.com/docs/kotlin/advanced/multi-modules/#auto-detection-of-used-types
4043
*/
41-
dependsOn(project(":graphqlSchema"), bidirectional = true)
44+
isADependencyOf(project(":feature1"))
45+
isADependencyOf(project(":feature2"))
4246
}
4347
}

0 commit comments

Comments
 (0)