Remove skipping of spring-boot-* projects from DevTools restart triggers
Closes gh-23158
This commit is contained in:
@@ -17,9 +17,6 @@
|
||||
package org.springframework.boot.devtools.restart.server;
|
||||
|
||||
import java.net.URL;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
@@ -40,9 +37,6 @@ public class DefaultSourceDirectoryUrlFilter implements SourceDirectoryUrlFilter
|
||||
|
||||
private static final Pattern VERSION_PATTERN = Pattern.compile("^-\\d+(?:\\.\\d+)*(?:[.-].+)?$");
|
||||
|
||||
private static final Set<String> SKIPPED_PROJECTS = new HashSet<>(Arrays.asList("spring-boot",
|
||||
"spring-boot-devtools", "spring-boot-autoconfigure", "spring-boot-actuator", "spring-boot-starter"));
|
||||
|
||||
@Override
|
||||
public boolean isMatch(String sourceDirectory, URL url) {
|
||||
String jarName = getJarName(url);
|
||||
@@ -73,10 +67,13 @@ public class DefaultSourceDirectoryUrlFilter implements SourceDirectoryUrlFilter
|
||||
}
|
||||
|
||||
private boolean isDirectoryMatch(String directory, String jarName) {
|
||||
if (!jarName.startsWith(directory) || SKIPPED_PROJECTS.contains(directory)) {
|
||||
if (!jarName.startsWith(directory)) {
|
||||
System.out.println(jarName + " does not start with " + directory);
|
||||
return false;
|
||||
}
|
||||
System.out.println(jarName + " starts with " + directory);
|
||||
String version = jarName.substring(directory.length());
|
||||
System.out.println("Checking version: " + version);
|
||||
return version.isEmpty() || VERSION_PATTERN.matcher(version).matches();
|
||||
}
|
||||
|
||||
|
||||
@@ -69,18 +69,6 @@ class DefaultSourceDirectoryUrlFilterTests {
|
||||
doTest("my-module/something/quite/quite/mad/");
|
||||
}
|
||||
|
||||
@Test
|
||||
void skippedProjects() throws Exception {
|
||||
String sourceDirectory = "/Users/me/code/spring-boot-samples/spring-boot-sample-devtools";
|
||||
URL jarUrl = new URL("jar:file:/Users/me/tmp/spring-boot-sample-devtools-1.3.0.BUILD-SNAPSHOT.jar!/");
|
||||
assertThat(this.filter.isMatch(sourceDirectory, jarUrl)).isTrue();
|
||||
URL nestedJarUrl = new URL("jar:file:/Users/me/tmp/spring-boot-sample-devtools-1.3.0.BUILD-SNAPSHOT.jar!/"
|
||||
+ "lib/spring-boot-1.3.0.BUILD-SNAPSHOT.jar!/");
|
||||
assertThat(this.filter.isMatch(sourceDirectory, nestedJarUrl)).isFalse();
|
||||
URL fileUrl = new URL("file:/Users/me/tmp/spring-boot-sample-devtools-1.3.0.BUILD-SNAPSHOT.jar");
|
||||
assertThat(this.filter.isMatch(sourceDirectory, fileUrl)).isTrue();
|
||||
}
|
||||
|
||||
private void doTest(String sourcePostfix) throws MalformedURLException {
|
||||
doTest(sourcePostfix, "my-module", true);
|
||||
doTest(sourcePostfix, "my-module-other", false);
|
||||
|
||||
Reference in New Issue
Block a user