Skip to content

Commit 662ddba

Browse files
committed
Make generateSwaggerCode method functional again
1 parent ac2cd91 commit 662ddba

File tree

2 files changed

+11
-14
lines changed

2 files changed

+11
-14
lines changed

build.gradle

+11-13
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,16 @@
11
plugins {
22
id 'com.android.application' version '8.5.0' apply false
33
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'
105
}
116

127
tasks.register('clean', Delete) {
138
delete rootProject.layout.buildDirectory
149
}
1510

1611
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 ->
1914
conn.inputStream.with { inp ->
2015
out << inp
2116
inp.close()
@@ -25,16 +20,19 @@ static def download(String url, String filename ) {
2520
}
2621

2722
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
2927
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)
3230
}
3331
}
3432

3533
swaggerSources {
3634
gotify {
37-
inputFile = specLocation as File
35+
inputFile = "$projectDir/build/gotify.spec.json" as File
3836
code {
3937
configFile = "$projectDir/swagger.config.json" as File
4038
language = 'java'
@@ -44,7 +42,7 @@ swaggerSources {
4442
}
4543

4644
dependencies {
47-
swaggerCodegen 'io.swagger:swagger-codegen-cli:2.3.1'
45+
swaggerCodegen 'io.swagger.codegen.v3:swagger-codegen-cli:3.0.63'
4846
}
4947

5048
generateSwaggerCode.dependsOn downloadSpec

gradle.properties

-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ android.nonFinalResIds=true
1111
android.nonTransitiveRClass=true
1212
android.useAndroidX=true
1313
org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8
14-
org.gradle.unsafe.configuration-cache=true
1514
# When configured, Gradle will run in incubating parallel mode.
1615
# This option should only be used with decoupled projects. More details, visit
1716
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects

0 commit comments

Comments
 (0)