You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is the RFC following up #515.
To solve the issue I encountered, it would be beneficial to have some way to inject additional build commands into the generated build script.
I propose that this is done by adding properties named command_templates_override, required_tools_override, and file_templates_override to TemplatedPlatform that are initialized to None. If they are not None, TemplatedPlatform should use them instead of their siblings without _override.
If the user desires to e.g. inject additional commands into the build script (as I do), they can copy the command_templates list of the platform to command_templates_override and add their commands.
There are some Pros / Cons of this approach vs. other approaches:
Pro: compared to an approach with an extra_command_templates list, this is more flexible: The user can even inject commands in the middle of the build script (to e.g. patch the netlist).
Con: rather cumbersome to use and rather easy to misuse: Just add an empty command_templates_override list and your build silently does nothing.
Enlarges the nMigen API surface in a not too clean way.
I am happy for any comments and / or other propositions to solve the stated problem. I am also happy to implement this RFC.
The text was updated successfully, but these errors were encountered:
anuejn
changed the title
RFC: Add extra_command_templates API
[RFC] Add extra_command_templates API
Jun 8, 2021
I propose that this is done by adding properties named command_templates_override, required_tools_override, and file_templates_override to TemplatedPlatform that are initialized to None. If they are not None, TemplatedPlatform should use them instead of their siblings without _override.
I don't understand why this mechanism is necessary. If you want to override command_templates, you define a property named command_templates that calls back to the superclass:
I am not wrapping the platform but rather want to inject the additional commands to any platform.
However, your comment lead to a hack that works good enough for me. Thanks a lot :).
This is the RFC following up #515.
To solve the issue I encountered, it would be beneficial to have some way to inject additional build commands into the generated build script.
I propose that this is done by adding properties named
command_templates_override
,required_tools_override
, andfile_templates_override
toTemplatedPlatform
that are initialized toNone
. If they are notNone
,TemplatedPlatform
should use them instead of their siblings without_override
.If the user desires to e.g. inject additional commands into the build script (as I do), they can copy the
command_templates
list of the platform tocommand_templates_override
and add their commands.There are some Pros / Cons of this approach vs. other approaches:
extra_command_templates
list, this is more flexible: The user can even inject commands in the middle of the build script (to e.g. patch the netlist).command_templates_override
list and your build silently does nothing.I am happy for any comments and / or other propositions to solve the stated problem. I am also happy to implement this RFC.
The text was updated successfully, but these errors were encountered: