allwpilib icon indicating copy to clipboard operation
allwpilib copied to clipboard

Use Jinja to generate HID classes

Open Gold856 opened this issue 1 year ago • 11 comments

Uses Jinja templating to autogenerate HID classes (with sim classes) from a JSON file.

How much do we care about reasonably good JavaDoc/doxygen? The JSON is less than DRY to cover the nuances of documentation form vs. code/CamelCase form. Making the JSON more DRY would mean either the template becomes more messy, or the documentation becomes a bit more clunky.

Gold856 avatar Jan 21 '24 00:01 Gold856

How much do we care about reasonably good JavaDoc/doxygen?

The HID classes are used often, so the docs for them should be good.

The generated files should pass all formattters and linters, since we include the generated source in the repo precisely so developers can read it. We haven't had to make exceptions in that regard so far except for Checkstyle.

calcmogul avatar Jan 21 '24 01:01 calcmogul

The generated files should pass all formattters and linters, since we include the generated source in the repo precisely so developers can read it. We haven't had to make exceptions in that regard so far except for Checkstyle.

We'll need to make an exception for wpilibc since the BooleanEvent methods in the .cpp files are right on the line length border, so we need to exclude them from formatting.

Gold856 avatar Jan 21 '24 04:01 Gold856

I turned the button names into an array so I can capitalize the individual parts and join them. Not sure if that's what you wanted, but it is less fields. (With a bigger JSON file because formatting)

Gold856 avatar Jan 21 '24 06:01 Gold856

Does this address all of #5039? (except for moving to a subdirectory or subpackage, which was already shot down)

KangarooKoala avatar Feb 02 '24 22:02 KangarooKoala

Idk what the wpiformat and clang-tidy include-what-you-use failures are from. We didn't change wpiformat, and this PR doesn't touch the files it's complaining about.

calcmogul avatar Feb 03 '24 02:02 calcmogul

Does this address all of #5039? (except for moving to a subdirectory or subpackage, which was already shot down)

Yes, all game controllers are codegenned. Joystick is not codegenned because I think it's different enough to maintain separately.

Gold856 avatar Feb 03 '24 03:02 Gold856

/format

Gold856 avatar Feb 03 '24 03:02 Gold856

Looks like you nuked your changes during a rebase. Use git reflog and git reset --hard to get them back.

calcmogul avatar Feb 03 '24 03:02 calcmogul

I have it saved on a local branch. Trying to make sure wpiformat works with "no" changes.

Gold856 avatar Feb 03 '24 03:02 Gold856

This should probably take consideration of #6296

Starlight220 avatar Feb 03 '24 18:02 Starlight220

Rebased on main to account for #6296.

Gold856 avatar May 25 '24 02:05 Gold856