fixed bug with outputFile property handling

This commit is contained in:
2020-10-27 13:01:27 +01:00
parent 4941481ad9
commit b38dd1f12c

View File

@@ -156,16 +156,19 @@ class JPMSCheckPlugin implements Plugin<Project> {
boolean recursive = project.properties["jpms-check.recursive"]?.with(Boolean.&parseBoolean) ?: false boolean recursive = project.properties["jpms-check.recursive"]?.with(Boolean.&parseBoolean) ?: false
String cfgName = project.properties["jpms-check.configurationName"] ?: "default" String cfgName = project.properties["jpms-check.configurationName"] ?: "default"
String outputFormat = project.properties["jpms-check.outputFormat"] ?: "html" String outputFormat = project.properties["jpms-check.outputFormat"] ?: "html"
Path outputFile Path outputFile = project.properties["jpms-check.outputFile"]?.with {
switch(outputFormat) { Paths.get(it as String)
case "html": } ?: with {
outputFile = Paths.get(project.properties["jpms-check.outputFile"]) ?: Paths.get(project.buildDir.path, "jpms-report.html") switch(outputFormat) {
break case "html":
case "json": Paths.get(project.buildDir.path, "jpms-report.html")
outputFile = Paths.get(project.properties["jpms-check.outputFile"]) ?: Paths.get(project.buildDir.path, "jpms-report.json") break
break case "json":
default: Paths.get(project.buildDir.path, "jpms-report.json")
throw new IllegalArgumentException("Unsupported output format: $outputFormat") break
default:
throw new IllegalArgumentException("Unsupported output format: $outputFormat")
}
} }
doLast { doLast {
Set<CheckResult> results = (recursive ? project.subprojects.stream() : Stream.of(project)).flatMap { Set<CheckResult> results = (recursive ? project.subprojects.stream() : Stream.of(project)).flatMap {