forked from kobylynskyi/graphql-java-codegen
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
105 lines (87 loc) · 3.78 KB
/
build.gradle
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
import io.github.kobylynskyi.graphql.codegen.gradle.GraphQLCodegenGradleTask
plugins {
id "java"
id "idea"
id "application"
// use the latest available version:
// https://plugins.gradle.org/plugin/io.github.kobylynskyi.graphql.codegen
id "io.github.kobylynskyi.graphql.codegen" version "gio-3.1.4-SNAPSHOT"
}
mainClassName = "io.github.kobylynskyi.order.Application"
dependencies {
implementation "org.springframework.boot:spring-boot-starter-web:2.3.4.RELEASE"
implementation "org.springframework.boot:spring-boot-starter-data-mongodb:2.3.4.RELEASE"
implementation "com.graphql-java-kickstart:graphql-spring-boot-starter:8.0.0"
implementation "com.graphql-java-kickstart:graphiql-spring-boot-starter:8.0.0"
implementation "com.graphql-java:graphql-java-extended-scalars:1.1.0"
// use the latest available version:
// https://search.maven.org/artifact/io.github.kobylynskyi/graphql-java-codegen
implementation "io.growing:graphql-java-codegen:gio-3.1.4-SNAPSHOT"
implementation "org.apache.httpcomponents:httpclient:4.5.13"
implementation "javax.validation:validation-api:2.0.1.Final"
implementation "org.mapstruct:mapstruct:1.4.1.Final"
annotationProcessor "org.mapstruct:mapstruct-processor:1.4.1.Final"
compileOnly "org.projectlombok:lombok:1.18.12"
annotationProcessor "org.projectlombok:lombok:1.18.12"
testImplementation "io.rest-assured:rest-assured:4.3.1"
testImplementation "org.junit.jupiter:junit-jupiter-api:5.7.0"
testRuntimeOnly "org.junit.jupiter:junit-jupiter-engine:5.7.0"
}
/**
* Generate requests and model from external service
*/
compileJava.dependsOn "graphqlCodegenProductService"
sourceSets.main.java.srcDir "$buildDir/generated-client"
task graphqlCodegenProductService(type: GraphQLCodegenGradleTask) {
graphqlSchemas.includePattern = "schema-product-service\\.graphqls"
outputDir = new File("$buildDir/generated-client")
modelPackageName = "io.github.kobylynskyi.product.graphql.model"
customTypesMapping = [
DateTime: "java.util.Date"
]
modelNameSuffix = "TO"
generateApis = false
generateClient = true
generateParameterizedFieldsResolvers = false
}
/**
* Generate apis and model
*/
compileJava.dependsOn "graphqlCodegenOrderService"
sourceSets.main.java.srcDir "$buildDir/generated-server"
task graphqlCodegenOrderService(type: GraphQLCodegenGradleTask) {
graphqlSchemas.includePattern = "schema\\.graphqls"
outputDir = new File("$buildDir/generated-server")
apiPackageName = "io.github.kobylynskyi.order.graphql.api"
modelPackageName = "io.github.kobylynskyi.order.graphql.model"
customTypesMapping = [
DateTime: "java.util.Date"
]
modelNameSuffix = "TO"
}
/**
* Generate requests and model from another external service
*/
compileJava.dependsOn "graphqlCodegenStarwarsService"
sourceSets.main.java.srcDir "$buildDir/generated-client-starwars"
task graphqlCodegenStarwarsService(type: GraphQLCodegenGradleTask) {
graphqlSchemas.includePattern = "schema-starwars-service\\.graphqls"
outputDir = new File("$buildDir/generated-client-starwars")
packageName = "io.github.kobylynskyi.starwars.graphql"
customAnnotationsMapping = [
"Character": [
"@com.fasterxml.jackson.annotation.JsonTypeInfo(use = com.fasterxml.jackson.annotation.JsonTypeInfo.Id.NAME, property = \"__typename\")",
"@com.fasterxml.jackson.databind.annotation.JsonTypeIdResolver(io.github.kobylynskyi.order.external.starwars.CharacterTypeResolver.class)"
]
]
generateClient = true
generateApis = false
generateBuilder = false
generateToString = true
generateParameterizedFieldsResolvers = false
}
repositories {
jcenter()
mavenCentral()
mavenLocal()
}