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