-
-
Notifications
You must be signed in to change notification settings - Fork 7k
Pre- & Post- Build Hooks #2738
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
Pre- & Post- Build Hooks #2738
Conversation
Sounds like a great change to me that adds flexibility for people that need it. Any chance you could also add a preupload and postupload hook? I'm using an external serial monitor, and those would allow me to automatically kill my serial monitor before upload instead of having the upload fail. Finally, if you put "Closes #2732" and/or "References #2732" in the commit messages, the issue will be autoclosed when merged (or just referenced). You can interactively rebase your branch to reword the commit messages and then force push to replace the commits here, if you want. |
@matthijskooijman -- Adding additional hooks is a good idea. Unfortunately, the obvious place to add the hook that you suggested does not have the preferences context available. Perhaps you can help me find the appropriate place to add this. |
Lovely |
@ArduinoBot build this please |
The MacOSX versions work for my purpose as I had intended. The example that I am using is:
You can also have multiple actions
Is there a preferable syntax? |
Yes. In boards.txt we used a dot notation for multiple values. See https://github.com/arduino/Arduino/blob/master/hardware/arduino/avr/boards.txt#L10-L13 They should become
This makes it easier to parse the properties: |
@ffissore - Thanks for your input. Having copied the code fragment from another part of the code dealing with recipe patterns, the matcher will handle either case. It does a prefix- match on "recipe.hooks.postbuild" and postfix- match on ".action". It executes the patterns in sorted order. My bigger concern is the advisability of using those particular strings rather than some other. For example, I used "action" rather than "pattern". Also should this be in the "recipe" namespace? etc. Also, in order to access the git repository of the source, I added "build.source.path" to the context. |
This pull request contains a lot of unnecessary changes related to white space. While cleaning up stray white space may be nice, merging such a pull request will needlessly break other pending pull requests and patches. |
@PaulStoffregen -- So, is it your position that we should continue to perpetuate unnecessary whitespace and thereby cause, in perpetuity, chronic conflicts which affect everyone subsequently editing the file? In the review process, differences caused by failure to conform to a precise coding standard simply obscure the substantive changes. For decades, it has been a "Best Practice" to have automated tools to verify that all submissions meet formatting standards before they are accepted in a permanent repository. Decent modern editors also have functions to assist in formatting to such standards. |
@Wackerbarth I agree
I agree with @PaulStoffregen about unnecessary modifications, and it's our fault since we don't provide a formatter configuration. Hence, the rule of thumb is to modify as few lines as possible, leaving the others, for ugly they may look, untouched. However I understand editors such as Eclipse may be hard to stop at formatting code. |
@Wackerbarth - Yes, I suppose when you put it that way, I am saying we should continue to perpetuate unnecessary whitespace. But really, what I'm saying is patches that fix stray white space outside the area they actually modify cause other patches to break unnecessarily. From the tone of your message, it seems you bitterly hate stray whitespace. I don't like it either. But I believe stray whitespace is much less harmful that breaking other pull requests and patches. |
"action" changed to "pattern" Yes, I really think that you should revisit the issue of canonical formatting, trailing whitespace in particular. Since non-fast-forward-able merges create really difficult-to-audit code, I suggest that they be minimized. Then, as the last part of tagging, One system-wide cosmetic cleanup commit can be made. Eventually, you can migrate to a pre-commit hook in git that enforces canonical formatting. |
Thank you @Wackerbarth for your patch and understanding |
This provides hooks to allow automation of build version numbers and other actions based on recipes in the platform(.local) files