[native_assets_cli] Make the InputBuilder
API less error-prone
#2059
Labels
Milestone
InputBuilder
API less error-prone
#2059
In the following code one of the setup calls is missing.
native/pkgs/native_toolchain_c/test/cbuilder/cbuilder_cross_macos_host_test.dart
Lines 58 to 78 in 6cec710
This doesn't lead to any errors, as the field in particular isn't used in the hook.
However, in general, we should try to structure the API in a way that helps developers are less likely to forget to setup a part of the input.
Instead of having separate setup methods for each individual part, only extensions should have a separate call. Something along the lines of:
It would also be better to be explicit about what extensions can add to the config. Possibly along the lines of passing a
void Function(BuildConfigBuilder config)
for populating the extension data instead of giving generic access to theBuildInputBuilder
and a.config
.(This would make the
API
not symmetric between base and extensions, the extension setup has to happen in a callback.)Once we remove the non-shared
outputDirectory
(#2058) there is also no need in our own code to setup parts of theinput.json
before setting up other parts.The text was updated successfully, but these errors were encountered: