Skip to content

Commit

Permalink
Merge pull request #214 from worstell/worstell/20231109-allow-multipl…
Browse files Browse the repository at this point in the history
…e-input-paths-with-type-resolution

allow for multiple comma-separated inputs in check-with-type-resolution
  • Loading branch information
Ozsie authored Nov 10, 2023
2 parents b565ba1 + f604eee commit d5e0039
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions src/main/java/com/github/ozsie/CheckWithTypeResolutionMojo.kt
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,15 @@ open class CheckWithTypeResolutionMojo : DetektMojo() {
log.debug("Applying $it")
}
this.cliArgs = parseArguments(getCliSting().log().toTypedArray())

val foundInputDir = Files.isDirectory(Paths.get(input))
if (!skip && foundInputDir) {
val invalidInputs = input.split(",").filter {
val path = Paths.get(it)
!Files.isDirectory(Paths.get(it)) && !Files.exists(path)
}
if (!skip && invalidInputs.isEmpty()) {
setDefaultClasspathIfNotSet(cliArgs)
failBuildIfNeeded { Runner(cliArgs, System.out, System.err).execute() }
} else
inputSkipLog(skip)
inputSkipLog(skip, invalidInputs)
}

private fun setDefaultClasspathIfNotSet(cliArgs: CliArgs) {
Expand All @@ -50,8 +52,12 @@ open class CheckWithTypeResolutionMojo : DetektMojo() {
}
}

private fun inputSkipLog(skip: Boolean) {
if (skip) log.info("Skipping execution") else log.info("Input directory '$input' not found, skipping module")
private fun inputSkipLog(skip: Boolean, invalidInputDirs: List<String>) {
if (skip) {
log.info("Skipping execution")
} else {
log.info("Failed to resolve input directories '${invalidInputDirs.joinToString()}', skipping module")
}
}
}

Expand Down

0 comments on commit d5e0039

Please sign in to comment.