Browse Source

Fix glob pattern in CheckstyleConventions to be Windows-compatible

On windows, the `*` character is not allowed in a directory's name.
When trying to append a glob pattern to a `Path` (`path.resolve("**")`),
if the underlying `Path.getFileSystem()` is windows then an
`InvalidPathException` is thrown.

The NoHttp plugin doesn't really need a `Path` but a glob `String`, so
this commit uses a simple String concatenation in order to append the
wildcard part (with the canonical path separator for good measure).

Closes gh-30355
pull/30364/head
Simon Baslé 3 years ago
parent
commit
33b4995547
  1. 4
      buildSrc/src/main/java/org/springframework/build/CheckstyleConventions.java

4
buildSrc/src/main/java/org/springframework/build/CheckstyleConventions.java

@ -27,6 +27,7 @@ import org.gradle.api.plugins.quality.Checkstyle; @@ -27,6 +27,7 @@ import org.gradle.api.plugins.quality.Checkstyle;
import org.gradle.api.plugins.quality.CheckstyleExtension;
import org.gradle.api.plugins.quality.CheckstylePlugin;
import java.io.File;
import java.nio.file.Path;
import java.util.List;
@ -68,7 +69,8 @@ public class CheckstyleConventions { @@ -68,7 +69,8 @@ public class CheckstyleConventions {
Path rootPath = project.getRootDir().toPath();
Path projectPath = rootPath.relativize(subproject.getProjectDir().toPath());
for (String buildFolder : buildFolders) {
noHttp.getSource().exclude(projectPath.resolve(buildFolder).resolve("**").toString());
Path innerBuildDir = projectPath.resolve(buildFolder);
noHttp.getSource().exclude(innerBuildDir + File.separator + "**");
}
});
}

Loading…
Cancel
Save