-
Notifications
You must be signed in to change notification settings - Fork 2
/
build.gradle
84 lines (69 loc) · 1.87 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
import org.yaml.snakeyaml.Yaml
buildscript {
repositories {
mavenCentral()
}
dependencies {
}
}
plugins {
id 'org.openapi.generator' version '7.10.0'
id 'java-library'
id 'maven-publish'
id 'net.researchgate.release' version '3.0.2'
}
project.ext {
name = 'Passende FinanzierungsVorschläge API'
artifactId = 'baufi-passende-vorschlaege-api'
groupId = 'de.europace'
version = "${version}"
}
group = 'de.europace'
repositories {
mavenCentral()
}
java {
toolchain {
languageVersion = JavaLanguageVersion.of(17)
}
}
publishing {
publications {
mavenJava(MavenPublication) {
version = "${property("version")}".toString()
artifact "$rootDir/api/baufi-passende-vorschlaege-api.yaml"
}
}
}
def apiFileName = "$rootDir/api/${property("baufi.passende.vorschlaege.api.file.name")}"
def apiConfig = new Yaml().load( new File(apiFileName).newInputStream() )
tasks.register('assertVersions') {
doLast {
def openApiConfigVersion = apiConfig.info.version
def releaseArtifactVersion = "${version}"
if (openApiConfigVersion != releaseArtifactVersion) {
throw new BuildCancelledException("Mismatching API and artifact versions. API version: '$openApiConfigVersion' gradle artifact version: '$releaseArtifactVersion'")
}
}
}
openApiValidate {
inputSpec.set apiFileName
recommend.set true
}
openApiGenerate {
generatorName.set 'javascript'
inputSpec.set 'api/baufi-passende-vorschlaege-api.yaml'
outputDir.set "$buildDir/generated".toString()
apiPackage.set 'de.europace.baufi.passende.vorschlaege.api'
modelPackage.set 'de.hypoport.ep2.baufismart.passende.vorschlaege.model'
}
release {
failOnCommitNeeded = false
git {
requireBranch.set('main')
pushToRemote.set('origin')
}
}
tasks.openApiValidate.dependsOn tasks.assertVersions
publish.dependsOn tasks.openApiValidate
afterReleaseBuild.dependsOn publish