-
-
Notifications
You must be signed in to change notification settings - Fork 153
/
build.gradle
48 lines (42 loc) · 1.33 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
plugins {
id 'com.android.application' version '8.5.0' apply false
id 'org.jetbrains.kotlin.android' version '2.0.0' apply false
id 'org.hidetake.swagger.generator' version '2.19.2'
}
tasks.register('clean', Delete) {
delete rootProject.layout.buildDirectory
}
static def download(String url, String filename ) {
new URI(url).toURL().openConnection().with { conn ->
new File(filename).withOutputStream { out ->
conn.inputStream.with { inp ->
out << inp
inp.close()
}
}
}
}
tasks.register('downloadSpec') {
def gotifyVersion = 'master'
def url = "https://raw.githubusercontent.com/gotify/server/$gotifyVersion/docs/spec.json"
def buildDir = project.layout.buildDirectory.get()
def specLocation = buildDir.file('gotify.spec.json').asFile.absolutePath
doFirst {
buildDir.asFile.mkdirs()
download(url, specLocation)
}
}
swaggerSources {
gotify {
inputFile = "$projectDir/build/gotify.spec.json" as File
code {
configFile = "$projectDir/swagger.config.json" as File
language = 'java'
outputDir = "$projectDir/client" as File
}
}
}
dependencies {
swaggerCodegen 'io.swagger.codegen.v3:swagger-codegen-cli:3.0.63'
}
generateSwaggerCode.dependsOn downloadSpec