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

(cherry picked from commit 9874cf0)
  • Loading branch information
mkouba authored and gsmet committed Mar 15, 2024
1 parent 0835729 commit cdc10b5
Showing 1 changed file with 14 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2177,7 +2177,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 @@ -3372,15 +3374,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 cdc10b5

Please sign in to comment.