grgit
grgit copied to clipboard
Adds samples
Hi there, I picked one of your issues as an example for me to familiarize myself with the Github pull requests workflow, perhaps these samples can be useful for someone. Thanks for the library - I've used if a fair bit and it is very nice. Cheers - Stefan
Again, sorry for the delay and thanks for the interest in contributing. I'm still pondering this one, since I'm not sure how I want to support samples. Main issue being ensuring they still work as changes are made to the library. As a manual step, there's a likelihood I'll forget to run them again.
Hi, yes, understood, I have the same problem in my projects - I tend to like samples as the quickest way to pick up a new tool, so I've dealt with this by extending my builds to finalize the test task by running the samples. I don't know if that would work for you but, I do it roughly like so:
- Master build includes a statement similar to
test.finalizedBy(':samples:runAll') - Samples directory contains
build.gradlewith individualGradleBuildtasks for the samples - The samples build file also defines the
runAlltask with dependencies on the individual sample tasks
I also tend to like to have self-checks in each sample, this can serve as a way to document what exactly the sample is trying to do. Once those are included, the master build effectively checks that the samples still work.
This is only a few lines of code, let me know if you'd like me to add that to the PR. The pattern is a little bit pedestrian maybe, but very simple, and has worked out alright for me.
@stebbi poke :)