Skip to content

cmake: fix generate-examples/check-examples#2545

Merged
blueyed merged 5 commits intoawesomeWM:masterfrom
blueyed:cmake-examples
Feb 18, 2019
Merged

cmake: fix generate-examples/check-examples#2545
blueyed merged 5 commits intoawesomeWM:masterfrom
blueyed:cmake-examples

Conversation

@blueyed
Copy link
Copy Markdown
Member

@blueyed blueyed commented Jan 4, 2019

Those do not generate files, but only run the tests in there, and should
not be triggered with make ldoc.

Move them to check-examples instead.

TODO:

@blueyed blueyed requested a review from Elv13 January 4, 2019 13:47
@codecov
Copy link
Copy Markdown

codecov bot commented Jan 4, 2019

Codecov Report

Merging #2545 into master will increase coverage by 0.01%.
The diff coverage is n/a.

@@            Coverage Diff             @@
##           master    #2545      +/-   ##
==========================================
+ Coverage   86.12%   86.13%   +0.01%     
==========================================
  Files         526      526              
  Lines       36003    35977      -26     
==========================================
- Hits        31007    30989      -18     
+ Misses       4996     4988       -8
Flag Coverage Δ
#gcov 75.06% <ø> (+0.02%) ⬆️
#luacov 88.97% <ø> (ø) ⬆️
Impacted Files Coverage Δ
root.c 84.76% <0%> (+2.28%) ⬆️

@actionless
Copy link
Copy Markdown
Member

what about renaming EXAMPLE_DOC_EXTRA_TARGETS to EXAMPLE_DOC_TEST_TARGETS?

@blueyed blueyed changed the title cmake: generate-examples: remove EXAMPLE_DOC_EXTRA_TARGETS [WIP] cmake: generate-examples: remove EXAMPLE_DOC_EXTRA_TARGETS Jan 4, 2019
@blueyed
Copy link
Copy Markdown
Member Author

blueyed commented Jan 4, 2019

what about renaming EXAMPLE_DOC_EXTRA_TARGETS to EXAMPLE_DOC_TEST_TARGETS?

Both/all of them also run tests, it is just that some produce output (images), while others do not.
With produced output CMake will not re-run them, but the others are added as explicit targets that get used with make ldoc.
I will rebase / fix this further after #2548.

@blueyed
Copy link
Copy Markdown
Member Author

blueyed commented Jan 9, 2019

Reworked it:

  • make check-examples runs the tests now always.
  • make will generate output files only once, and does not run the examples that do not generate any output. The output from check-examples is used/valid for it, i.e. after make check-examples output files are not regenerated.

@blueyed blueyed changed the title [WIP] cmake: generate-examples: remove EXAMPLE_DOC_EXTRA_TARGETS cmake: fix generate-examples/check-examples Jan 9, 2019
travis_fold_end
else
# TODO: does not run check-examples. Should it?
travis_run_in_fold "make.check-unit" make check-unit
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we want to run check-examples also with non-coverage builds?

@blueyed
Copy link
Copy Markdown
Member Author

blueyed commented Jan 11, 2019

@Elv13 on IRC:

the example do modify the doc, they need to be executed

You mean the ones not generating images still need to run when generating docs? Makes sense.
Then we need some stamp file to not run this always. Couldn't/shouldn't that be the changed doc file then?

@Elv13
Copy link
Copy Markdown
Member

Elv13 commented Jan 11, 2019

@blueyed I think we need to add check-examples to the DEPENDS of ldoc if we are to make this change? I don't have time to test right now

@blueyed
Copy link
Copy Markdown
Member Author

blueyed commented Jan 11, 2019

@Elv13
check-examples is meant to test it only (but generates output also).
ldoc depends (or should if not) on generate-examples.

@Elv13
Copy link
Copy Markdown
Member

Elv13 commented Jan 14, 2019

There is 3 steps, I think.

  • Check what the documentation example provides (text, image, etc)
  • Execute those files and generate the artifacts
  • Integrate/inject those artifacts in the ldoc input

The images are simple because they are statically deterministic, but the generated text may change when step2 is performed, so it must be executed before CMake configure_file is executed.

This could be mitigated by moving ldoc and the configure_file to a custom_target instead of directly in the configuration step. That way most targets would use the raw .lua files from awful/wibox/gears instead of the post-processed output of configure_file. By doing that the weird circular target dependency would be gone.

Those do not generate files, but only run the tests in there, and should
not be triggered with `make ldoc`.

Move them to `check-examples` instead.
The default comment is verbose enough in general:

> Generating doc/images/AUTOGEN_awful_mouse_coords.svg
@blueyed
Copy link
Copy Markdown
Member Author

blueyed commented Feb 18, 2019

make ldoc on master runs e.g. tests/examples/text/awful/keygrabber/root_keybindings.lua always.
But changing the file does not change any documentation.

So while it gets run always, it does not update lib/awful/keygrabber.lua for
ldoc (which replaces the
@DOC_text_awful_keygrabber_root_keybindings_EXAMPLE@).

Therefore I think this PR does not cause any regression in this regard.

@blueyed
Copy link
Copy Markdown
Member Author

blueyed commented Feb 18, 2019

Would like to get this in for #2672, to ease handling the examples tests therein / from there.

@Elv13
Copy link
Copy Markdown
Member

Elv13 commented Feb 18, 2019

make ldoc on master runs e.g. tests/examples/text/awful/keygrabber/root_keybindings.lua always.
But changing the file does not change any documentation.

That's a bug, the keygrabbing.lua target should DEPENDS on tests/example/text/awful/keygrabber/* and tests/example/awful/keygrabber/* (if, of course, they exist). That in turn should re-run ldoc. But right, this is not a bug in this pull request.

Copy link
Copy Markdown
Member

@Elv13 Elv13 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This isn't 100% perfect, but it wasn't perfect before either, so this is ok. Eventually it will be necessary to re-run the check when the file is edited and then trigger generate-examples (for that file) if that's the case and that would affect the output of make ldoc. So the premise of this pull request is still looking a bit wrong to me. check-examples can affect the ldoc larget. But again, this is currently not the case and havn't been ever since this was moved out of the "configure" step.

@blueyed blueyed merged commit ddf422d into awesomeWM:master Feb 18, 2019
@blueyed blueyed deleted the cmake-examples branch February 18, 2019 23:15
petoju pushed a commit to petoju/awesome that referenced this pull request Jun 8, 2019
actionless pushed a commit to actionless/awesome that referenced this pull request Mar 24, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants