1
1
plugins {
2
2
id ' com.android.application' version ' 8.5.0' apply false
3
3
id ' org.jetbrains.kotlin.android' version ' 2.0.0' apply false
4
- id ' org.hidetake.swagger.generator' version ' 2.14.0'
5
- }
6
-
7
- ext {
8
- gotifyVersion = ' master'
9
- specLocation = " $layout . buildDirectory /gotify.spec.json"
4
+ id ' org.hidetake.swagger.generator' version ' 2.19.2'
10
5
}
11
6
12
7
tasks. register(' clean' , Delete ) {
13
8
delete rootProject. layout. buildDirectory
14
9
}
15
10
16
11
static def download (String url , String filename ) {
17
- new URL ( url ). openConnection(). with { conn ->
18
- new File ( filename ). withOutputStream { out ->
12
+ new URI ( url) . toURL( ). openConnection(). with { conn ->
13
+ new File (filename). withOutputStream { out ->
19
14
conn. inputStream. with { inp ->
20
15
out << inp
21
16
inp. close()
@@ -25,16 +20,19 @@ static def download(String url, String filename ) {
25
20
}
26
21
27
22
tasks. register(' downloadSpec' ) {
28
- inputs. property ' version' , gotifyVersion
23
+ def gotifyVersion = ' master'
24
+ def url = " https://raw.githubusercontent.com/gotify/server/$gotifyVersion /docs/spec.json"
25
+ def buildDir = project. layout. buildDirectory. get()
26
+ def specLocation = buildDir. file(' gotify.spec.json' ). asFile. absolutePath
29
27
doFirst {
30
- layout . buildDirectory . mkdirs()
31
- download(" https://raw.githubusercontent.com/gotify/server/ ${ gotifyVersion } /docs/spec.json " , specLocation)
28
+ buildDir . asFile . mkdirs()
29
+ download(url , specLocation)
32
30
}
33
31
}
34
32
35
33
swaggerSources {
36
34
gotify {
37
- inputFile = specLocation as File
35
+ inputFile = " $p rojectDir /build/gotify.spec.json " as File
38
36
code {
39
37
configFile = " $projectDir /swagger.config.json" as File
40
38
language = ' java'
@@ -44,7 +42,7 @@ swaggerSources {
44
42
}
45
43
46
44
dependencies {
47
- swaggerCodegen ' io.swagger:swagger-codegen-cli:2.3.1 '
45
+ swaggerCodegen ' io.swagger.codegen.v3 :swagger-codegen-cli:3.0.63 '
48
46
}
49
47
50
48
generateSwaggerCode. dependsOn downloadSpec
0 commit comments