Open
Conversation
Otherwise we get in a loop when building, oops
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
I had heard of picotool's build functionality and hoped it had this feature. No dice, but I was glad to see it was on the list (#25). So, I went ahead and threw together a basic implementation.
This could be polished further, but I think it's pretty functional already. It adds two flags to the
buildcommand.--watch[=dir]will causepicotoolto sit and watch the given directory (default current directory) for changes.--watch-globallows specifying what files to watch - by default, it watches*.lua,*.p8,*.png. An obvious improvement would be to watch the files specified, but this was simpler to implement and does the trick for now.When any change to a watched file happens, it just runs
do_buildwith whatever other arguments are provided, then goes back to watching.It's mostly a thin wrapper around watchdog, which I found after a brief search. It met my criteria of cross-platform and seeming mature/supported enough, and using it was actually super nice. I made the include optional - so if it is not there, the rest of picotool will work, but
--watchwill give a nice message saying to install watchdog to enable it. The stub classes to squelch errors in the code that requires it is my design, I don't know if there's some more standard way of doing that.I'm certainly open to feedback, on substance or style - for one, I still need to add a couple tests for it. Give it a whirl and let me know what you think. After using it for a bit, it does the job but seems a bit overeager...I'll keep tweaking.