@@ -427,7 +427,7 @@ && isNotLocatedByCustomTemplateLocator(locatorPatternsBuildItem.getLocationPatte
427
427
continue ;
428
428
}
429
429
MethodInfo canonicalConstructor = recordClass .method (MethodDescriptor .INIT ,
430
- recordClass .unsortedRecordComponents ().stream ().map (RecordComponentInfo ::type )
430
+ recordClass .recordComponentsInDeclarationOrder ().stream ().map (RecordComponentInfo ::type )
431
431
.toArray (Type []::new ));
432
432
433
433
AnnotationInstance checkedTemplateAnnotation = recordClass .declaredAnnotation (Names .CHECKED_TEMPLATE );
@@ -2185,6 +2185,7 @@ private String toKey(MethodInfo extensionMethod) {
2185
2185
@ BuildStep
2186
2186
void collectTemplates (ApplicationArchivesBuildItem applicationArchives ,
2187
2187
CurateOutcomeBuildItem curateOutcome ,
2188
+ List <TemplatePathExcludeBuildItem > templatePathExcludes ,
2188
2189
BuildProducer <HotDeploymentWatchedFileBuildItem > watchedPaths ,
2189
2190
BuildProducer <TemplatePathBuildItem > templatePaths ,
2190
2191
BuildProducer <NativeImageResourceBuildItem > nativeImageResources ,
@@ -2205,6 +2206,12 @@ public boolean test(String path) {
2205
2206
}
2206
2207
}).build ());
2207
2208
2209
+ List <Pattern > excludePatterns = new ArrayList <>(templatePathExcludes .size () + 1 );
2210
+ excludePatterns .add (config .templatePathExclude ());
2211
+ for (TemplatePathExcludeBuildItem exclude : templatePathExcludes ) {
2212
+ excludePatterns .add (Pattern .compile (exclude .getRegexPattern ()));
2213
+ }
2214
+
2208
2215
final Set <ApplicationArchive > allApplicationArchives = applicationArchives .getAllApplicationArchives ();
2209
2216
final Set <ArtifactKey > appArtifactKeys = new HashSet <>(allApplicationArchives .size ());
2210
2217
for (var archive : allApplicationArchives ) {
@@ -2215,20 +2222,21 @@ public boolean test(String path) {
2215
2222
// Skip extension archives that are also application archives
2216
2223
if (!appArtifactKeys .contains (artifact .getKey ())) {
2217
2224
scanPathTree (artifact .getContentTree (), templateRoots , watchedPaths , templatePaths , nativeImageResources ,
2218
- config );
2225
+ config , excludePatterns );
2219
2226
}
2220
2227
}
2221
2228
for (ApplicationArchive archive : allApplicationArchives ) {
2222
2229
archive .accept (
2223
- tree -> scanPathTree (tree , templateRoots , watchedPaths , templatePaths , nativeImageResources , config ));
2230
+ tree -> scanPathTree (tree , templateRoots , watchedPaths , templatePaths , nativeImageResources , config ,
2231
+ excludePatterns ));
2224
2232
}
2225
2233
}
2226
2234
2227
2235
private void scanPathTree (PathTree pathTree , TemplateRootsBuildItem templateRoots ,
2228
2236
BuildProducer <HotDeploymentWatchedFileBuildItem > watchedPaths ,
2229
2237
BuildProducer <TemplatePathBuildItem > templatePaths ,
2230
2238
BuildProducer <NativeImageResourceBuildItem > nativeImageResources ,
2231
- QuteConfig config ) {
2239
+ QuteConfig config , List < Pattern > excludePatterns ) {
2232
2240
for (String templateRoot : templateRoots ) {
2233
2241
if (PathTreeUtils .containsCaseSensitivePath (pathTree , templateRoot )) {
2234
2242
pathTree .walkIfContains (templateRoot , visit -> {
@@ -2241,9 +2249,11 @@ private void scanPathTree(PathTree pathTree, TemplateRootsBuildItem templateRoot
2241
2249
// remove templateRoot + /
2242
2250
final String relativePath = visit .getRelativePath ();
2243
2251
String templatePath = relativePath .substring (templateRoot .length () + 1 );
2244
- if (config .templatePathExclude ().matcher (templatePath ).matches ()) {
2245
- LOGGER .debugf ("Template file excluded: %s" , visit .getPath ());
2246
- return ;
2252
+ for (Pattern p : excludePatterns ) {
2253
+ if (p .matcher (templatePath ).matches ()) {
2254
+ LOGGER .debugf ("Template file excluded: %s" , visit .getPath ());
2255
+ return ;
2256
+ }
2247
2257
}
2248
2258
produceTemplateBuildItems (templatePaths , watchedPaths , nativeImageResources ,
2249
2259
relativePath , templatePath , visit .getPath (), config );
@@ -2568,7 +2578,7 @@ void collecTemplateContents(BeanArchiveIndexBuildItem index, List<CheckedTemplat
2568
2578
@ Record (value = STATIC_INIT )
2569
2579
void initialize (BuildProducer <SyntheticBeanBuildItem > syntheticBeans , QuteRecorder recorder ,
2570
2580
List <TemplatePathBuildItem > templatePaths , Optional <TemplateVariantsBuildItem > templateVariants ,
2571
- TemplateRootsBuildItem templateRoots ) {
2581
+ TemplateRootsBuildItem templateRoots , List < TemplatePathExcludeBuildItem > templatePathExcludes ) {
2572
2582
2573
2583
List <String > templates = new ArrayList <>();
2574
2584
List <String > tags = new ArrayList <>();
@@ -2592,11 +2602,17 @@ void initialize(BuildProducer<SyntheticBeanBuildItem> syntheticBeans, QuteRecord
2592
2602
variants = Collections .emptyMap ();
2593
2603
}
2594
2604
2605
+ List <String > excludePatterns = new ArrayList <>(templatePathExcludes .size ());
2606
+ for (TemplatePathExcludeBuildItem exclude : templatePathExcludes ) {
2607
+ excludePatterns .add (exclude .getRegexPattern ());
2608
+ }
2609
+
2595
2610
syntheticBeans .produce (SyntheticBeanBuildItem .configure (QuteContext .class )
2596
2611
.scope (BuiltinScope .SINGLETON .getInfo ())
2597
2612
.supplier (recorder .createContext (templates ,
2598
2613
tags , variants ,
2599
- templateRoots .getPaths ().stream ().map (p -> p + "/" ).collect (Collectors .toSet ()), templateContents ))
2614
+ templateRoots .getPaths ().stream ().map (p -> p + "/" ).collect (Collectors .toSet ()), templateContents ,
2615
+ excludePatterns ))
2600
2616
.done ());
2601
2617
}
2602
2618
@@ -3529,8 +3545,7 @@ public static String getName(InjectionPointInfo injectionPoint) {
3529
3545
private static void produceTemplateBuildItems (BuildProducer <TemplatePathBuildItem > templatePaths ,
3530
3546
BuildProducer <HotDeploymentWatchedFileBuildItem > watchedPaths ,
3531
3547
BuildProducer <NativeImageResourceBuildItem > nativeImageResources , String resourcePath ,
3532
- String templatePath ,
3533
- Path originalPath , QuteConfig config ) {
3548
+ String templatePath , Path originalPath , QuteConfig config ) {
3534
3549
if (templatePath .isEmpty ()) {
3535
3550
return ;
3536
3551
}
@@ -3544,9 +3559,10 @@ private static void produceTemplateBuildItems(BuildProducer<TemplatePathBuildIte
3544
3559
}
3545
3560
watchedPaths .produce (new HotDeploymentWatchedFileBuildItem (resourcePath , restartNeeded ));
3546
3561
nativeImageResources .produce (new NativeImageResourceBuildItem (resourcePath ));
3547
- templatePaths .produce (
3548
- new TemplatePathBuildItem (templatePath , originalPath ,
3549
- readTemplateContent (originalPath , config .defaultCharset ())));
3562
+ templatePaths .produce (TemplatePathBuildItem .builder ()
3563
+ .path (templatePath )
3564
+ .fullPath (originalPath )
3565
+ .content (readTemplateContent (originalPath , config .defaultCharset ())).build ());
3550
3566
}
3551
3567
3552
3568
private static boolean isExcluded (TypeCheck check , Iterable <Predicate <TypeCheck >> excludes ) {
0 commit comments