1
1
import com.expediagroup.graphql.plugin.gradle.graphql
2
+ import com.expediagroup.graphql.plugin.generator.GraphQLClientType
3
+ import com.expediagroup.graphql.plugin.gradle.tasks.GraphQLDownloadSDLTask
4
+ import com.expediagroup.graphql.plugin.gradle.tasks.GraphQLGenerateClientTask
2
5
3
6
plugins {
4
7
application
5
8
id(" org.jetbrains.kotlin.jvm" ) version " 1.3.72"
6
- id(" com.expediagroup.graphql" ) version " 4.0.0-alpha.1 "
9
+ id(" com.expediagroup.graphql" ) version " 4.0.0-alpha.7 "
7
10
}
8
11
9
12
repositories {
@@ -14,7 +17,7 @@ repositories {
14
17
dependencies {
15
18
implementation(" org.jetbrains.kotlin:kotlin-stdlib:1.3.72" )
16
19
implementation(" org.jetbrains.kotlin:kotlin-reflect:1.3.72" )
17
- implementation(" com.expediagroup:graphql-kotlin-spring-client:4.0.0-alpha.1 " )
20
+ implementation(" com.expediagroup:graphql-kotlin-spring-client:4.0.0-alpha.7 " )
18
21
}
19
22
20
23
application {
@@ -29,8 +32,42 @@ tasks {
29
32
30
33
graphql {
31
34
client {
32
- endpoint = " http://localhost:8080/graphql"
33
- packageName = " com.expediagroup.graphql.generated"
34
- clientType = com.expediagroup.graphql.plugin.generator.GraphQLClientType .WEBCLIENT
35
+ sdlEndpoint = " http://localhost:8080/sdl"
36
+ packageName = " com.example.generated"
37
+ clientType = GraphQLClientType .WEBCLIENT
38
+ queryFileDirectory = " ${project.projectDir.absolutePath} /src/main/resources/first"
39
+ }
40
+ }
41
+
42
+ // above graphql extension configuration is equivalent to the below
43
+ // val graphqlDownloadSDL by tasks.getting(GraphQLDownloadSDLTask::class) {
44
+ // endpoint.set("http://localhost:8080/sdl")
45
+ // }
46
+ //
47
+ // val graphqlGenerateClient by tasks.getting(GraphQLGenerateClientTask::class) {
48
+ // clientType.set(GraphQLClientType.WEBCLIENT)
49
+ // packageName.set("com.example.generated")
50
+ // schemaFile.set(graphqlDownloadSDL.outputFile)
51
+ // queryFileDirectory.set("${project.projectDir.absolutePath}/src/main/resources/first")
52
+ // dependsOn("graphqlDownloadSDL")
53
+ // }
54
+
55
+ val graphqlDownloadOtherSDL by tasks.registering(GraphQLDownloadSDLTask ::class ) {
56
+ endpoint.set(" http://localhost:8081/sdl" )
57
+ dependsOn(" graphqlGenerateClient" )
58
+ }
59
+
60
+ val graphqlGenerateOtherClient by tasks.registering(GraphQLGenerateClientTask ::class ) {
61
+ clientType.set(GraphQLClientType .WEBCLIENT )
62
+ packageName.set(" com.example.generated2" )
63
+ schemaFile.set(graphqlDownloadOtherSDL.get().outputFile)
64
+ queryFileDirectory.set(" ${project.projectDir.absolutePath} /src/main/resources/second" )
65
+ outputDirectory.set(project.layout.buildDirectory.dir(" generated/source/graphql/main" ))
66
+ dependsOn(" graphqlDownloadOtherSDL" )
67
+ }
68
+
69
+ tasks {
70
+ compileKotlin {
71
+ dependsOn(" graphqlGenerateOtherClient" )
35
72
}
36
73
}
0 commit comments