forked from loafle/openapi-generator-original
Minor improvements to Gradle plugin (#14097)
* minor improvements to gradle plugin, test * update gradle plugin doc * fix out
This commit is contained in:
parent
d74cefba83
commit
743d2cde7f
@ -378,6 +378,11 @@ apply plugin: 'org.openapi.generator'
|
|||||||
|String
|
|String
|
||||||
|mustache
|
|mustache
|
||||||
|Templating engine: "mustache" (default) or "handlebars" (beta)
|
|Templating engine: "mustache" (default) or "handlebars" (beta)
|
||||||
|
|
||||||
|
|cleanupOutput
|
||||||
|
|Boolean
|
||||||
|
|false
|
||||||
|
|Defines whether the output directory should be cleaned up before generating the output.
|
||||||
|===
|
|===
|
||||||
|
|
||||||
[NOTE]
|
[NOTE]
|
||||||
|
@ -523,6 +523,9 @@ open class GenerateTask : DefaultTask() {
|
|||||||
cleanupOutput.ifNotEmpty { cleanup ->
|
cleanupOutput.ifNotEmpty { cleanup ->
|
||||||
if (cleanup) {
|
if (cleanup) {
|
||||||
project.delete(outputDir)
|
project.delete(outputDir)
|
||||||
|
val out = services.get(StyledTextOutputFactory::class.java).create("openapi")
|
||||||
|
out.withStyle(StyledTextOutput.Style.Success)
|
||||||
|
out.println("Cleaned up output directory ${outputDir.get()} before code generation (cleanupOutput set to true).")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -136,7 +136,7 @@ class GenerateTaskDslTest : TestBase() {
|
|||||||
)
|
)
|
||||||
withProject(defaultBuildGradle, projectFiles)
|
withProject(defaultBuildGradle, projectFiles)
|
||||||
|
|
||||||
val oldFile = File(temp, "build/kotlin/should-be-removed")
|
val oldFile = File(temp, "build/kotlin/should-not-be-removed")
|
||||||
oldFile.mkdirs()
|
oldFile.mkdirs()
|
||||||
oldFile.createNewFile()
|
oldFile.createNewFile()
|
||||||
|
|
||||||
@ -153,7 +153,7 @@ class GenerateTaskDslTest : TestBase() {
|
|||||||
"User friendly generate notice is missing."
|
"User friendly generate notice is missing."
|
||||||
)
|
)
|
||||||
|
|
||||||
assertTrue(oldFile.exists(), "Old files should have been removed")
|
assertTrue(oldFile.exists(), "Old files should NOT have been removed")
|
||||||
|
|
||||||
assertEquals(
|
assertEquals(
|
||||||
TaskOutcome.SUCCESS, result.task(":openApiGenerate")?.outcome,
|
TaskOutcome.SUCCESS, result.task(":openApiGenerate")?.outcome,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user