Skip to content
This repository was archived by the owner on Nov 23, 2024. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ swaggerSources {
language = 'spring'
components = ['models', 'apis']
configFile = file('v2-config.json')
configuration = configurations.swaggerCodegenV2
configuration.from(configurations.swaggerCodegenV2)
}
}
petstoreV3 {
Expand All @@ -33,7 +33,7 @@ swaggerSources {
language = 'spring'
components = ['models', 'apis']
configFile = file('v3-config.json')
configuration = configurations.swaggerCodegenV3
configuration.from(configurations.swaggerCodegenV3)
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ swaggerSources {
language = 'spring'
components = ['models', 'apis']
configFile = file('v2-config.json')
configuration = configurations.swaggerCodegenV2
configuration.from(configurations.swaggerCodegenV2)
}
}
petstoreV3 {
Expand All @@ -33,7 +33,7 @@ swaggerSources {
language = 'spring'
components = ['models', 'apis']
configFile = file('v3-config.json')
configuration = configurations.openApiGen
configuration.from(configurations.openApiGen)
}
}
}
Expand Down
6 changes: 3 additions & 3 deletions acceptance-test/projects/ui-v2/basic/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ swaggerSources {
ui {
doLast {
// overwrite index.html for Swagger UI 2.x
copy {
from 'index.html'
into outputDir
files.copy {
it.from 'index.html'
it.into outputDir
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class GradleProject {
GradleRunner.create()
.withProjectDir(new File('projects'))
.withPluginClasspath()
.withArguments('-s', "$path:$taskName")
.withArguments('-s', '--configuration-cache', "$path:$taskName")
.build()
} catch (UnexpectedBuildFailure e) {
throw new BuildFailureException(e)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import spock.lang.Specification
import spock.lang.Unroll

import static org.gradle.testkit.runner.TaskOutcome.NO_SOURCE
import static org.gradle.testkit.runner.TaskOutcome.SKIPPED
import static org.gradle.testkit.runner.TaskOutcome.SUCCESS

class DefaultTasksSpec extends Specification {

Expand All @@ -22,7 +22,7 @@ class DefaultTasksSpec extends Specification {
where:
taskName | status
'generateSwaggerCode' | NO_SOURCE
'generateSwaggerCodeHelp' | SKIPPED
'generateSwaggerCodeHelp' | SUCCESS
'generateSwaggerUI' | NO_SOURCE
'validateSwagger' | NO_SOURCE
}
Expand Down
17 changes: 8 additions & 9 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
plugins {
id 'groovy-gradle-plugin'
id 'com.gradle.plugin-publish' version '0.20.0'
id 'com.gradle.plugin-publish' version '1.2.1'
}

sourceCompatibility = '1.8'
targetCompatibility = '1.8'
java {
sourceCompatibility = '1.8'
targetCompatibility = '1.8'
}

repositories {
mavenCentral()
Expand All @@ -28,19 +30,16 @@ test {
group = 'org.hidetake'
version = System.getenv('GITHUB_REF')?.split('/')?.last() ?: 'SNAPSHOT'

pluginBundle {
website = 'https://github.com/int128/gradle-swagger-generator-plugin'
vcsUrl = 'https://github.com/int128/gradle-swagger-generator-plugin'
tags = ['swagger', 'api', 'generator']
}

gradlePlugin {
plugins {
swaggerPlugin {
id = 'org.hidetake.swagger.generator'
displayName = 'Gradle Swagger Generator Plugin'
description = 'Gradle plugin for OpenAPI YAML validation, code generation and API document publishing'
implementationClass = 'org.hidetake.gradle.swagger.generator.SwaggerGeneratorPlugin'
website = 'https://github.com/int128/gradle-swagger-generator-plugin'
vcsUrl = 'https://github.com/int128/gradle-swagger-generator-plugin'
tags = ['swagger', 'api', 'generator']
}
}
}
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
4 changes: 3 additions & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.3-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
41 changes: 28 additions & 13 deletions gradlew

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 9 additions & 6 deletions gradlew.bat

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,19 @@ package org.hidetake.gradle.swagger.generator

import groovy.xml.XmlUtil
import org.gradle.api.DefaultTask
import org.gradle.api.internal.file.FileOperations
import org.gradle.api.tasks.*
import org.hidetake.gradle.swagger.generator.util.Resources

import javax.inject.Inject

/**
* A task to generate ReDoc.
*
* @author Hidetake Iwata
*/
@CacheableTask
class GenerateReDoc extends DefaultTask {
abstract class GenerateReDoc extends DefaultTask {

@SkipWhenEmpty @InputFile @PathSensitive(PathSensitivity.NAME_ONLY)
File inputFile
Expand All @@ -31,6 +34,9 @@ class GenerateReDoc extends DefaultTask {
@Optional @Input
Map<String, String> options = [:]

@Inject
abstract FileOperations getFiles()

GenerateReDoc() {
outputDir = new File(project.buildDir, 'redoc')
}
Expand All @@ -51,17 +57,16 @@ class GenerateReDoc extends DefaultTask {
html.body.first().script.first().attributes().src = scriptSrc

if (wipeOutputDir) {
assert outputDir != project.projectDir, 'Prevent wiping the project directory'
project.delete(outputDir)
files.delete(outputDir)
}
outputDir.mkdirs()

new File(outputDir, 'index.html').withWriter('UTF-8') { writer ->
XmlUtil.serialize(html, writer)
}
project.copy {
from inputFile
into outputDir
files.copy {
it.from inputFile
it.into outputDir
}
}

Expand Down
Loading