Skip to content

Commit

Permalink
Qute: fix the NoRestartTemplatesDevModeTest on Windows
Browse files Browse the repository at this point in the history
- follows up on #39294
  • Loading branch information
mkouba committed Mar 14, 2024
1 parent 1f0e5c4 commit 9874cf0
Showing 1 changed file with 14 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2194,7 +2194,9 @@ private void scanPath(Path rootPath, Path path, QuteConfig config, TemplateRoots
Path relativePath = rootPath.relativize(file);
if (templateRoots.isRoot(relativePath)) {
LOGGER.debugf("Found templates dir: %s", file);
scan(file, file, relativePath.toString() + File.separatorChar, watchedPaths, templatePaths,
// The base path is an OS-specific path relative to the template root
String basePath = relativePath.toString() + File.separatorChar;
scan(file, file, basePath, watchedPaths, templatePaths,
nativeImageResources,
config);
} else if (templateRoots.maybeRoot(relativePath)) {
Expand Down Expand Up @@ -3389,15 +3391,21 @@ private static void produceTemplateBuildItems(BuildProducer<TemplatePathBuildIte
if (filePath.isEmpty()) {
return;
}
String fullPath = basePath + filePath;
LOGGER.debugf("Produce template build items [filePath: %s, fullPath: %s, originalPath: %s", filePath, fullPath,
// OS-specific full path, i.e. templates\foo.html
String osSpecificPath = basePath + filePath;
// OS-agnostic full path, i.e. templates/foo.html
String osAgnosticPath = osSpecificPath;
if (File.separatorChar != '/') {
osAgnosticPath = osAgnosticPath.replace(File.separatorChar, '/');
}
LOGGER.debugf("Produce template build items [filePath: %s, fullPath: %s, originalPath: %s", filePath, osSpecificPath,
originalPath);
boolean restartNeeded = true;
if (config.devMode.noRestartTemplates.isPresent()) {
restartNeeded = !config.devMode.noRestartTemplates.get().matcher(fullPath).matches();
restartNeeded = !config.devMode.noRestartTemplates.get().matcher(osAgnosticPath).matches();
}
watchedPaths.produce(new HotDeploymentWatchedFileBuildItem(fullPath, restartNeeded));
nativeImageResources.produce(new NativeImageResourceBuildItem(fullPath));
watchedPaths.produce(new HotDeploymentWatchedFileBuildItem(osAgnosticPath, restartNeeded));
nativeImageResources.produce(new NativeImageResourceBuildItem(osSpecificPath));
templatePaths.produce(
new TemplatePathBuildItem(filePath, originalPath, readTemplateContent(originalPath, config.defaultCharset)));
}
Expand Down

0 comments on commit 9874cf0

Please sign in to comment.