gen-device: only generate device files for supported devices#5456
gen-device: only generate device files for supported devices#5456niaow wants to merge 2 commits into
Conversation
This changes the make gen-device command such that it only converts relevant device files. This saves a lot of build time. The process of determining which files to convert is now handled by make. Incremental builds are now supported. Appropriate parallel building is now done for all device generation (previously it was only handled properly for AVR). The generated file names were updated to match their source name formatting. I could probbably lowercase everything when converting them, but this would complicate the makefile. I don't really think this is worth it.
|
Before: After: This is much faster and it reduces the storage used by device files by 86%. |
| } | ||
|
|
||
| func formatText(text string) string { | ||
| text = regexp.MustCompile(`[ \t\n]+`).ReplaceAllString(text, " ") // Collapse whitespace (like in HTML) |
There was a problem hiding this comment.
Might not be in scope of this actual PR but I stumbled across this some time ago - this regex is unnecessarily compiled multiple times
dgryski
left a comment
There was a problem hiding this comment.
Seems reasonable, although I'll leave it to someone who actually deals with this files for the final word.
I think we should probably preserve the lowercase file names if we can to avoid case issues on OS like Windows. |
I am not entirely sure what you mean by this. I understand that Windows is case-insensitive, but we are just matching the source case here? |
|
I made a patch that changes them back to lowercase. It is much more complicated in the makefile since we cannot just use pattern rules (which expect the source and destination name stems to match). I had to shell out to |
|
I was testing a little and now I see what you meant. I also am not sure if the case thing is worth it, since all of the real work happens due to either build tags or the target JSON file anyhow. Good that you made it a separate commit, let me consider my opinion now. BTW the speed of it is fantastic. We will also have to think about how to modify the instructions for adding a new board, since you will have to add to the makefile to get it generated. |
This changes the make gen-device command such that it only converts relevant device files. This saves a lot of build time.
The process of determining which files to convert is now handled by make. Incremental builds are now supported.
Appropriate parallel building is now done for all device generation (previously it was only handled properly for AVR).
The generated file names were updated to match their source name formatting. I could probbably lowercase everything when converting them, but this would complicate the makefile. I don't really think this is worth it.