-
-
Notifications
You must be signed in to change notification settings - Fork 110
/
Copy pathbuild.gradle
104 lines (87 loc) · 3.77 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
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 "5.10.1-SNAPSHOT"
}
mainClassName = "io.github.kobylynskyi.order.Application"
dependencies {
implementation "org.springframework.boot:spring-boot-starter-web:2.7.10"
implementation "org.springframework.boot:spring-boot-starter-data-mongodb:2.7.18"
implementation "com.graphql-java-kickstart:graphql-spring-boot-starter:11.1.0"
implementation "com.graphql-java-kickstart:graphiql-spring-boot-starter:11.1.0"
implementation "com.graphql-java:graphql-java-extended-scalars:20.2"
// use the latest available version:
// https://search.maven.org/artifact/io.github.kobylynskyi/graphql-java-codegen
implementation "io.github.kobylynskyi:graphql-java-codegen:5.10.1-SNAPSHOT"
implementation "org.apache.httpcomponents:httpclient:4.5.14"
implementation "javax.validation:validation-api:2.0.1.Final"
implementation "org.mapstruct:mapstruct:1.5.5.Final"
annotationProcessor "org.mapstruct:mapstruct-processor:1.5.5.Final"
compileOnly "org.projectlombok:lombok:1.18.30"
annotationProcessor "org.projectlombok:lombok:1.18.30"
testImplementation "io.rest-assured:rest-assured:5.3.2"
testImplementation "org.junit.jupiter:junit-jupiter-api:5.10.2"
testRuntimeOnly "org.junit.jupiter:junit-jupiter-engine:5.10.2"
}
/**
* 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 = true
generateToString = true
generateParameterizedFieldsResolvers = false
}
repositories {
jcenter()
mavenCentral()
mavenLocal()
}