-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathbuild.gradle
100 lines (89 loc) · 4.13 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
plugins {
id 'java-library'
id 'com.graphql-java-generator.graphql-gradle-plugin'
id 'org.springframework.boot' version "${springBootVersion}"
id 'io.spring.dependency-management' version "${springDependencyManagementPluginVersion}"
}
// The two configurations below are mandatory, as there is no main class in this module
bootJar {
enabled = false
}
jar {
enabled = true
}
repositories {
mavenCentral()
// The plugin depends on the graphql-maven-plugin, whose snapshot versions are on the local maven repository.
// So, for development reason, we need to access to the local maven repository. It's useless for standard use of the plugin
mavenLocal()
}
dependencies {
// And the Jackson annotations
implementation "com.fasterxml.jackson.core:jackson-databind"
// This project uses some custom scalars from the graphql-java-extended-scalars module
implementation "com.graphql-java:graphql-java-extended-scalars:${graphqlJavaExtendedScalarsVersion}"
// Dependencies for tests
testImplementation "org.springframework.boot:spring-boot-starter-test"
}
// Let's configure the GraphQL Gradle Plugin, for the code generation, for both the client and the server pojo
// (the plugin will automatically add it as a dependency to compileJava and processResources)
tasks.register('generateClientPojo', com.graphql_java_generator.gradleplugin.GeneratePojoTask) {
copyRuntimeSources = true
mode = 'client'
generateJacksonAnnotations = false
packageName = 'org.allGraphQLCases.client.pojo'
schemaFileFolder = '../graphql-gradle-plugin-samples-allGraphQLCases-client/src/graphqls/allGraphQLCases'
targetSourceFolder = "build/generated/sources/generatePojo-client"
targetResourceFolder = "build/generated/resources/generatePojo-client"
// The war packaging is useless here. But it allows to check that packaging is actually a valid plugin parameter
packaging = 'war'
customScalars = [ [
graphQLTypeName: "Base64String",
javaType: "byte[]",
graphQLScalarTypeStaticField: "com.graphql_java_generator.customscalars.GraphQLScalarTypeBase64String.GraphQLBase64String"
], [
graphQLTypeName: "CustomId",
javaType: "com.generated.graphql.samples.customscalar.CustomId",
graphQLScalarTypeStaticField: "com.generated.graphql.samples.customscalar.GraphQLScalarTypeCustomId.CustomIdScalarType"
], [
graphQLTypeName: "MyCustomScalarForADate",
javaType: "java.util.Date",
graphQLScalarTypeStaticField: "com.graphql_java_generator.customscalars.GraphQLScalarTypeDate.Date"
], [
graphQLTypeName: "MyCustomScalarForADateTime",
javaType: "java.time.OffsetDateTime",
graphQLScalarTypeStaticField: "graphql.scalars.ExtendedScalars.DateTime"
], [
graphQLTypeName: "else",
javaType: "java.lang.String",
graphQLScalarTypeGetter: "org.allGraphQLCases.GraphQLScalarTypeElse.getElseScalar()"
], [
graphQLTypeName: "JSON",
javaType: "com.fasterxml.jackson.databind.node.ObjectNode",
graphQLScalarTypeStaticField: "graphql.scalars.ExtendedScalars.Json"
], [
graphQLTypeName: "MyBoolean",
javaType: "java.lang.Boolean",
graphQLScalarTypeGetter: "com.generated.graphql.samples.customscalar.GraphQLScalarTypeMyBoolean.MyBooleanScalarType"
], [
graphQLTypeName: "Long",
javaType: "java.lang.Long",
graphQLScalarTypeStaticField: "graphql.Scalars.GraphQLLong"
], [
graphQLTypeName: "NonNegativeInt",
javaType: "java.lang.Integer",
graphQLScalarTypeStaticField: "graphql.scalars.ExtendedScalars.NonNegativeInt"
], [
graphQLTypeName: "Object",
javaType: "java.lang.Object",
graphQLScalarTypeStaticField: "graphql.scalars.ExtendedScalars.Object"
] ]
}
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
////// NEXT LINES ARE HERE ONLY TO ALLOW THE INTEGRATION TESTS AGAINST THE SERVER GENERATED BY GraphQL Generator ////////
////// That is: this project is both a sample, and an integration test ////////
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
test {
// enable JUnit Platform (a.k.a. JUnit 5) support
useJUnitPlatform()
}