-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathbuild.gradle
96 lines (84 loc) · 2.79 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
plugins {
id 'org.springframework.boot' version '2.3.1.RELEASE'
id 'io.spring.dependency-management' version '1.0.9.RELEASE'
id "org.springframework.cloud.contract" version "2.2.3.RELEASE"
id "org.openapi.generator" version "4.3.1"
id 'java'
id 'jacoco'
id "org.asciidoctor.jvm.convert" version "3.2.0"
id 'ru.uip.contract.specs' version '0.1'
}
group = 'ru.uip'
version = '0.0.1-SNAPSHOT'
sourceCompatibility = '11'
repositories {
mavenCentral()
mavenLocal()
}
dependencies {
compileOnly 'org.projectlombok:lombok:1.18.12'
implementation 'org.springframework.boot:spring-boot-starter-web'
implementation 'org.springframework.boot:spring-boot-starter-validation'
implementation "ru.uip:model:1.0-SNAPSHOT"
compile group: 'com.sun.xml.bind', name: 'jaxb-impl', version: '2.3.2'
compile group: 'com.sun.xml.bind', name: 'jaxb-core', version: '2.3.0.1'
testImplementation('org.springframework.boot:spring-boot-starter-test') {
exclude group: 'org.junit.vintage', module: 'junit-vintage-engine'
}
testImplementation 'org.springframework.cloud:spring-cloud-starter-contract-verifier'
testImplementation 'org.springframework.cloud:spring-cloud-starter-contract-stub-runner'
testImplementation "io.rest-assured:spring-web-test-client:4.3.0"
testImplementation "io.rest-assured:rest-assured-all:4.3.0"
testImplementation "org.springframework.restdocs:spring-restdocs-restassured"
}
dependencyManagement {
imports {
mavenBom "org.springframework.cloud:spring-cloud-contract-dependencies:2.1.3.RELEASE"
}
}
openApiGenerate {
generatorName = "asciidoc"
inputSpec = "$projectDir/src/main/api/api.yaml".toString()
templateDir = "$projectDir/src/main/api/template".toString()
outputDir = "$buildDir/generated-docs".toString()
configOptions = [
specDir: "${buildDir}/generated-snippets/specs".toString(),
snippetDir: "$projectDir/src/main/api/template".toString()
]
}
asciidoctor {
sourceDir file("${buildDir}")
outputDir file('build/docs')
}
contracts {
baseClassForTests = 'ru.uip.BaseTest'
testMode = 'EXPLICIT'
testFramework = 'JUNIT5'
}
test {
useJUnitPlatform()
finalizedBy jacocoTestReport
}
jacocoTestReport {
dependsOn test
afterEvaluate {
classDirectories.setFrom(files(classDirectories.files.collect {
fileTree(dir: it, exclude: 'ru/uip/RestConsumerApplication.class')
}))
}
}
apiContractSpec {
apiSpec = "$projectDir/src/main/api/api.yaml"
operationContracts = [
'moneyTransfer': files(
"${projectDir}/src/test/resources/contracts/moneyTransfer.yml"
)
]
template = "${projectDir}/src/main/api/template/spec.mustache"
snippetsDir = "${buildDir}/generated-snippets/contract"
outputDir = "${buildDir}/generated-snippets/specs"
}
build.dependsOn("asciidoctor")
asciidoctor.dependsOn("generate-api-spec")
asciidoctor.dependsOn("openApiGenerate")
asciidoctor.mustRunAfter('test')