Skip to content

Check %include files' modified times for rebuild too#693

Merged
lsf37 merged 1 commit intojflex-de:masterfrom
idodeclare:feature/mtimes_inclusions
Dec 27, 2019
Merged

Check %include files' modified times for rebuild too#693
lsf37 merged 1 commit intojflex-de:masterfrom
idodeclare:feature/mtimes_inclusions

Conversation

@idodeclare
Copy link
Contributor

Hello,

Please consider for integration this patch for the jflex-maven-plugin to check also last-modified times for %include files in a JFlex file when possibly short-circuiting a rebuild. (It had been suggested in #217 that the jflex-maven-plugin supported this already, but I did not find that to be the case.)

Only %include files directly referenced by a lexFile would be checked by this patch and not any nested %include statements.

Thank you.

@idodeclare idodeclare requested a review from regisd as a code owner December 22, 2019 03:31
@lsf37
Copy link
Member

lsf37 commented Dec 22, 2019

Thanks for your contribution! I’ll give @regisd some time to review, but this looks good from my side. We should probably add nested include files afterwards in a separate commit.

@lsf37 lsf37 added this to the 1.8.0 milestone Dec 22, 2019
@lsf37 lsf37 added the enhancement Feature requests label Dec 22, 2019
Only checking files for %include statements in
a JFlex file and not any nested %include files.
@idodeclare
Copy link
Contributor Author

idodeclare commented Dec 22, 2019

Thank you for the review, @lsf37. I'm going to push a tweak to more exactly align the plugin's "guessing" regex matching with the LexScan.flex syntax for %include:

^ {WSP}* "%include" {WSP}+ .*  { includeFile(yytext().trim().substring(9).trim()); }

and to fix a typo.

(Would you like me to create an issue for considering nested includes for last-modifed checking?)

@idodeclare idodeclare force-pushed the feature/mtimes_inclusions branch from 8e4a033 to e4dd356 Compare December 22, 2019 18:48
@lsf37
Copy link
Member

lsf37 commented Dec 22, 2019

Thanks for the tweak, you're right that's closer to the expression in JFlex.

(Would you like me to create an issue for considering nested includes for last-modifed checking?)

Yes, please. I was going to do it right after the merge, but better to make sure I don't forget.

Looking through the code again, one question: is there a deeper reason for ignoring the include files in equals and hash? My instinct would be to add them here as well.

@idodeclare
Copy link
Contributor Author

Looking through the code again, one question: is there a deeper reason for ignoring the include files in equals and hash? My instinct would be to add them here as well.

Oh my thinking was that the existing className and packageName were fundamental to the identity of ClassInfo as their natural key — and so part of the hash — but that the new tagalong data of includedFiles was not.

@lsf37
Copy link
Member

lsf37 commented Dec 27, 2019

Oh my thinking was that the existing className and packageName were fundamental to the identity of ClassInfo as their natural key — and so part of the hash — but that the new tagalong data of includedFiles was not.

Got it. The class is currently only used to determine the output file name, but it makes sense the store the include file data here as well. I might rename it to SpecInfo later, but will merge as is for now.

@regisd is probably enjoying the holidays, so I'll merge now and we can address any changes later when he returns.

@lsf37 lsf37 merged commit b68b357 into jflex-de:master Dec 27, 2019
@lsf37
Copy link
Member

lsf37 commented Dec 27, 2019

Thanks again for the contribution!

@idodeclare
Copy link
Contributor Author

My pleasure! Thank you for the collaboration

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement Feature requests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants