#166 Adjust outdated make command pattern

as with #147 a new unset command part is introduced.

Also add a regression e2e test that would have caught this issue.
This commit is contained in:
Maximilian Paß
2022-06-16 09:39:56 +02:00
parent 3afe8ddb66
commit b0916a2485
3 changed files with 61 additions and 21 deletions

View File

@ -22,7 +22,7 @@ class InvalidMakefileException extends Exception {}
class SimpleMakefile {
// This pattern validates if a command is a make command.
private static final Pattern isMakeCommand = Pattern.compile("^make(?:\\s+(?<startRule>\\w*))?(?<assignments>(?:.*?=.*?)+)?$");
private static final Pattern isMakeCommand = Pattern.compile("^(?:.* && )?make(?:\\s+(?<startRule>\\w*))?(?<assignments>(?:.*?=.*?)+)?(?: && .*)?$");
// This pattern identifies the rules in a makefile.
private static final Pattern makeRules = Pattern.compile("(?<name>.*):\\r?\\n(?<commands>(?:\\t.+\\r?\\n?)*)");