Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add basic watching ability to v2 cli #734

Merged
merged 3 commits into from
Mar 20, 2021

Conversation

jeffa5
Copy link
Contributor

@jeffa5 jeffa5 commented Jan 12, 2021

Fixes #719

This adds the watch subcommand, based off of cargo-watch. This design should allow for future addition of subcommands such as check or format which may run after or before a build stage or in place of one. It is very dumb at the moment and just watches all files in the current directory, besides the output build dir.

Tested that it works for me on a setup from tectonic -X new.

Haven't really got a good idea of how to go about testing this kind of thing but most of the work is done by the watchexec crate anyway.

@codecov
Copy link

codecov bot commented Jan 12, 2021

Codecov Report

Merging #734 (499b7e6) into master (d703749) will decrease coverage by 0.04%.
The diff coverage is 5.97%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #734      +/-   ##
==========================================
- Coverage   46.75%   46.70%   -0.05%     
==========================================
  Files         125      126       +1     
  Lines       54903    54970      +67     
==========================================
+ Hits        25672    25676       +4     
- Misses      29231    29294      +63     
Impacted Files Coverage Δ
src/bin/tectonic/main.rs 78.57% <ø> (ø)
src/bin/tectonic/watch.rs 0.00% <0.00%> (ø)
src/bin/tectonic/v2cli.rs 54.40% <9.30%> (-23.65%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update d703749...fd10d86. Read the comment docs.

@pkgw
Copy link
Collaborator

pkgw commented Jan 14, 2021

Thanks for submitting this! I am a little wary about using watchexec for this functionality, since it adds some potential failure points (needing to be able to re-execute the program under the name tectonic, for instance), and we can in principle do a much better job — for instance, the "makefile rules" functionality yields a precise list of the files that need to be watched to know when to rebuild.

I'm a bit tied up for the rest of this week but I'll try to review this in more depth soon. watchexec might be a fine choice in terms of getting the functionality without needing to put in a lot of effort.

@jeffa5
Copy link
Contributor Author

jeffa5 commented Jan 25, 2021

I've updated this to use the current executable name (prettified) for the command now so it also works when not running tectonic.

I think watchexec is pretty useful for this as it allows the flexibility of using multiple commands, adhering to ignore files and provides this cross-platform.

I'd expect that the list of files to watch from the Makefile rules would be able to be used as included paths to watchexec later.

@pkgw
Copy link
Collaborator

pkgw commented Feb 17, 2021

Hi, I just wanted to apologize for the slow follow-up here — I've had a lot going on preventing me from spending time on Tectonic lately. But I haven't forgotten about this!

@pkgw pkgw merged commit a16b46e into tectonic-typesetting:master Mar 20, 2021
@pkgw
Copy link
Collaborator

pkgw commented Mar 20, 2021

I'd be interested in a fancier implementation that avoids re-execing the Tectonic executable, but let's merge this now and get the functionality it. The implementation can always be reworked later if/when needed.

@jeffa5 jeffa5 deleted the add-watch-subcommand branch March 20, 2021 23:56
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.

Add a watch mode
2 participants