generated from MEITREX/template_microservice
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
144 lines (126 loc) · 5.85 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
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
import io.github.kobylynskyi.graphql.codegen.gradle.GraphQLCodegenGradleTask
plugins {
id 'java'
id 'org.springframework.boot' version '3.+'
id 'io.spring.dependency-management' version '1.+'
id "io.github.kobylynskyi.graphql.codegen" version "5.+"
id "org.sonarqube" version "5.+"
id "jacoco"
}
group = 'de.unistuttgart.iste.meitrex'
version = '0.0.1-SNAPSHOT'
sourceCompatibility = '21'
def jacocoEnabled = System.properties.getProperty("jacocoEnabled") ?: "true"
// Apply JaCoCo settings only if jacaco is enable
if (jacocoEnabled.toBoolean()) {
project.logger.lifecycle('Applying jacoco settings from jacoco.gradle')
apply from: rootProject.file("jacoco.gradle")
}
sonarqube {
properties {
property("sonar.projectKey", "MEITREX_scrum_game_service")
property("sonar.organization", "meitrex")
property("sonar.host.url", "https://sonarcloud.io")
}
}
def fetchFilesFromRepo(String repository, List<String> files) {
def baseurl = "https://raw.githubusercontent.com/MEITREX/"
def fileUrl = "${baseurl}${repository}/main/src/main/resources/graphql/"
def outputDir = "src/main/resources/graphql"
files.each { file ->
tasks.register("fetchExternalSchema-${file.capitalize()}", Exec) {
commandLine 'curl', "${fileUrl}${file}", '-o', "${outputDir}/${repository}/${file}"
}
}
}
fetchFilesFromRepo("common", ["directives.graphqls", "scalars.graphqls", "sortFilterPagination.graphqls"])
fetchFilesFromRepo("scrum-game-ims-api", ["issue.graphqls"])
fetchFilesFromRepo("gamification_engine", ["event.graphqls"])
// run this task to fetch the latest schema files from the external github repositories
tasks.register("fetchAllExternalSchemas", Task) {
dependsOn tasks.matching { it.name.startsWith("fetchExternalSchema-") }
}
// Automatically generate DTOs from GraphQL schema:
tasks.register('generateDtos', GraphQLCodegenGradleTask) {
graphqlSchemas {
rootDir = file("src/main/resources/graphql/service")
}
// all config options:
// https://github.com/kobylynskyi/graphql-java-codegen/blob/main/docs/codegen-options.md
outputDir = new File("$buildDir/generated/scrum-game")
packageName = "de.unistuttgart.iste.meitrex.generated.dto"
generatedAnnotation = "jakarta.annotation.Generated"
modelValidationAnnotation = "jakarta.validation.constraints.NotNull"
generateApis = false // set to false as the generator does not support spring boot graphQL
customTypesMapping = [
"DateTime" : "java.time.OffsetDateTime",
"Date" : "java.time.LocalDate",
"Time" : "java.time.OffsetTime",
"LocalTime": "java.time.LocalTime",
"UUID" : "java.util.UUID",
"Url" : "java.net.URL",
]
generateEqualsAndHashCode = true
generateToString = true
fieldsWithResolvers = ["@OnDemand"]
}
// Automatically generate GraphQL code on project build:
compileJava.dependsOn 'generateDtos'
// Add generated sources to your project source sets:
sourceSets.main.java.srcDir "$buildDir/generated/scrum-game"
tasks.register('generateApiDocs', Exec) {
commandLine 'cmd', '/c', 'generate_api_doc.bat'
}
tasks.named('assemble') {
finalizedBy('generateApiDocs')
}
configurations {
compileOnly {
extendsFrom annotationProcessor
}
}
repositories {
mavenCentral()
}
dependencies {
implementation 'de.unistuttgart.iste.meitrex:meitrex-common:1.2'
implementation 'de.unistuttgart.iste.meitrex:dinodev_common:1.2'
implementation 'de.unistuttgart.iste.meitrex:gamification_engine:1.2'
implementation 'de.unistuttgart.iste.meitrex:gropius_adapter:1.2'
implementation 'de.unistuttgart.iste.meitrex:github_adapter:1.2'
implementation 'org.springframework.boot:spring-boot-starter-data-jpa'
implementation 'org.springframework.boot:spring-boot-starter-graphql'
implementation 'org.springframework.boot:spring-boot-starter-validation'
implementation 'org.springframework.boot:spring-boot-starter-web'
implementation 'org.springframework.boot:spring-boot-starter-cache'
implementation 'com.github.ben-manes.caffeine:caffeine:3.+'
implementation 'org.springframework.boot:spring-boot-starter-actuator'
implementation 'org.springframework.boot:spring-boot-starter-webflux'
implementation 'org.springframework.boot:spring-boot-starter-websocket'
implementation 'org.springframework.boot:spring-boot-starter-security'
implementation 'org.modelmapper:modelmapper:3.+'
implementation 'com.graphql-java:graphql-java-extended-scalars:22.0'
implementation 'com.graphql-java:graphql-java-extended-validation:22.0'
implementation 'org.springframework.security:spring-security-oauth2-resource-server'
implementation 'org.springframework.security:spring-security-oauth2-jose'
implementation "io.github.kobylynskyi:graphql-java-codegen:5.+"
implementation 'org.apache.commons:commons-text:1.12.+'
compileOnly 'org.projectlombok:lombok'
developmentOnly 'org.springframework.boot:spring-boot-devtools'
runtimeOnly 'org.postgresql:postgresql'
annotationProcessor 'org.springframework.boot:spring-boot-configuration-processor'
annotationProcessor 'org.projectlombok:lombok'
testImplementation 'de.unistuttgart.iste.meitrex:meitrex-common-test:1.2'
testImplementation 'org.springframework.boot:spring-boot-starter-test'
testImplementation 'org.springframework:spring-webflux'
testImplementation 'org.springframework.graphql:spring-graphql-test'
testImplementation "org.mockito:mockito-core:5.+"
testImplementation 'org.hamcrest:hamcrest:2.+'
testImplementation "org.testcontainers:postgresql:1.+"
testImplementation "org.testcontainers:junit-jupiter:1.+"
testImplementation 'org.exparity:hamcrest-date:2.0.8'
testImplementation 'io.projectreactor:reactor-test:3.6.0'
}
tasks.named('test') {
useJUnitPlatform()
}