Skip to content

Commit 44026ec

Browse files
mkoubagsmet
authored andcommitted
Qute: use the relative resource path for NativeImageResourceBuildItem
- previously, we used incorrectly an OS-specific relative path (cherry picked from commit 202ea6e)
1 parent 559f617 commit 44026ec

File tree

2 files changed

+8
-13
lines changed

2 files changed

+8
-13
lines changed

extensions/qute/deployment/src/main/java/io/quarkus/qute/deployment/QuteProcessor.java

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3355,31 +3355,29 @@ public static String getName(InjectionPointInfo injectionPoint) {
33553355
* @param templatePaths
33563356
* @param watchedPaths
33573357
* @param nativeImageResources
3358-
* @param osSpecificResourcePath The OS-specific resource path, i.e. templates\nested\foo.html
3358+
* @param resourcePath The relative resource path, including the template root
33593359
* @param templatePath The path relative to the template root; using the {@code /} path separator
33603360
* @param originalPath
33613361
* @param config
33623362
*/
33633363
private static void produceTemplateBuildItems(BuildProducer<TemplatePathBuildItem> templatePaths,
33643364
BuildProducer<HotDeploymentWatchedFileBuildItem> watchedPaths,
3365-
BuildProducer<NativeImageResourceBuildItem> nativeImageResources, String osSpecificResourcePath,
3365+
BuildProducer<NativeImageResourceBuildItem> nativeImageResources, String resourcePath,
33663366
String templatePath,
33673367
Path originalPath, QuteConfig config) {
33683368
if (templatePath.isEmpty()) {
33693369
return;
33703370
}
3371-
// OS-agnostic full path, i.e. templates/foo.html
3372-
String osAgnosticResourcePath = toOsAgnosticPath(osSpecificResourcePath, originalPath.getFileSystem());
33733371
LOGGER.debugf("Produce template build items [templatePath: %s, osSpecificResourcePath: %s, originalPath: %s",
33743372
templatePath,
3375-
osSpecificResourcePath,
3373+
resourcePath,
33763374
originalPath);
33773375
boolean restartNeeded = true;
33783376
if (config.devMode.noRestartTemplates.isPresent()) {
3379-
restartNeeded = !config.devMode.noRestartTemplates.get().matcher(osAgnosticResourcePath).matches();
3377+
restartNeeded = !config.devMode.noRestartTemplates.get().matcher(resourcePath).matches();
33803378
}
3381-
watchedPaths.produce(new HotDeploymentWatchedFileBuildItem(osAgnosticResourcePath, restartNeeded));
3382-
nativeImageResources.produce(new NativeImageResourceBuildItem(osSpecificResourcePath));
3379+
watchedPaths.produce(new HotDeploymentWatchedFileBuildItem(resourcePath, restartNeeded));
3380+
nativeImageResources.produce(new NativeImageResourceBuildItem(resourcePath));
33833381
templatePaths.produce(
33843382
new TemplatePathBuildItem(templatePath, originalPath,
33853383
readTemplateContent(originalPath, config.defaultCharset)));
@@ -3399,7 +3397,7 @@ private void scanTemplateRootSubtree(PathTree pathTree, Path templateRoot,
33993397
return;
34003398
}
34013399
produceTemplateBuildItems(templatePaths, watchedPaths, nativeImageResources,
3402-
visit.getRelativePath(visit.getPath().getFileSystem().getSeparator()),
3400+
visit.getRelativePath("/"),
34033401
templatePath, visit.getPath(), config);
34043402
}
34053403
});

extensions/qute/deployment/src/test/java/io/quarkus/qute/deployment/templateroot/AdditionalTemplateRootTest.java

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,11 +51,8 @@ public void execute(BuildContext context) {
5151
List<NativeImageResourceBuildItem> items = context.consumeMulti(NativeImageResourceBuildItem.class);
5252
for (NativeImageResourceBuildItem item : items) {
5353
if (item.getResources().contains("web/public/hello.txt")
54-
|| item.getResources().contains("web\\public\\hello.txt")
5554
|| item.getResources().contains("templates/hi.txt")
56-
|| item.getResources().contains("templates\\hi.txt")
57-
|| item.getResources().contains("templates/nested/hoho.txt")
58-
|| item.getResources().contains("templates\\nested\\hoho.txt")) {
55+
|| item.getResources().contains("templates/nested/hoho.txt")) {
5956
found++;
6057
}
6158
}

0 commit comments

Comments
 (0)