Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Qute: fix the NoRestartTemplatesDevModeTest on Windows #39434

Merged
merged 1 commit into from
Mar 14, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading