Skip post-book actions if we can - #673
Conversation
Skips some of the actions that we take after building all branches of a book if we can get away with skipping them and reworks some of the logging. This should marginally speed up the `--all` build and and make it *much* easier to spot which books are rebuilt in which build by suppressing a lot of the logging noise.
|
I'm labelling this WIP because I'd like to add some integration testing that uses the infrastructure from #659. |
|
I've added some more tests around building multi-branched books. This is nice because multi-branched books are actually the most common type and we didn't have an integration tests for them. @Jarpy, could you have this a look when you get a chance? |
|
I think I could build on this to do a few other neat things like only changing the parts of the sitemap for changed books. |
| ls $$(dirname $(2)); \ | ||
| false; \ | ||
| } | ||
| grep -v $(1) $(2) > /dev/null || { \ |
There was a problem hiding this comment.
grep -q saves you redirecting stdout and is a potentially an optimization because it short-circuits.
| define GREP_V= | ||
| # grep for a string in a file, outputting the whole file if there *is* | ||
| # a match. | ||
| [ -e $(2) ] || { \ |
There was a problem hiding this comment.
Is the false return the most important factor here, or the text output?
To put it another way, is this function assert_not_in_file or print_file_if_unmatched?
There was a problem hiding this comment.
assert_not_in_file. But I need to print the file so I can figure out what is going on.
There was a problem hiding this comment.
Do you think assert_not_in_file is a better name for this? I'm so used to thinking about grep -v but the output on failure is different.
There was a problem hiding this comment.
I don't think it's a big deal, but after reading the function name and the comment, I still wasn't sure which part of the function was the core and which was the side-effect. It's not a big public API, so just tweaking the comment a bit would probably be fine, too.
I don't love the name GREP_V, because it reveals the implementation, but again, this a Makefile, not some hallowed, live-with-it-forever public API.
My question was mostly to satisfy my curiosity, rather than to demand changes.
|
Thanks for reviewing @Jarpy! |
Skips some of the actions that we take after building all branches of a
book if we can get away with skipping them and reworks some of the
logging. This should marginally speed up the
--allbuild and and makeit much easier to spot which books are rebuilt in which build by
suppressing a lot of the logging noise.