Skip to content
This repository has been archived by the owner on Feb 23, 2023. It is now read-only.

Reduce duplication of resources with basic regex cache #546

Merged
merged 1 commit into from Mar 3, 2021
Merged

Reduce duplication of resources with basic regex cache #546

merged 1 commit into from Mar 3, 2021

Conversation

leccelecce
Copy link
Contributor

Fixes #524

This is a fairly basic check to avoid resources being duplicated twice in resource-config.json - once through a generic regex such as "^templates/.*" and again through an individual entry for every file in src/main/resources. The approach is to build a compiled regex cache of any obvious patterns built in the initial contributor step, and test files against those. The logic to identify an actual regex pattern is fairly basic (patt.startsWith("^") && patt.endsWith(".*")) but worked well for my semi-complex project. It looks like only CommonWebInfos uses this approach at the moment but rather than just hardcode checks for templates/ and static/ I thought this approach might be a bit more future proof.

Happy to consider an alternative approach.

@aclement
Copy link
Contributor

aclement commented Mar 2, 2021

seems a reasonable change to me.

@sdeleuze sdeleuze added this to the 0.9.0 milestone Mar 3, 2021
@sdeleuze sdeleuze added the type: enhancement A general enhancement label Mar 3, 2021
@sdeleuze sdeleuze merged commit 07398c8 into spring-attic:master Mar 3, 2021
@leccelecce leccelecce deleted the fix_duplicate_resources branch March 3, 2021 09:19
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
type: enhancement A general enhancement
Development

Successfully merging this pull request may close these issues.

Duplicate entries in spring-aot generated resource-config.json
3 participants