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
Dart SDK Version (dart --version) Dart SDK version: 3.0.7 (stable) (Mon Jul 24 13:17:56 2023 +0000) on "linux_x64"
What package(s) from this repo you are using, and the version (i.e. build_runner 0.7.12) 2.4.6
What builder(s) you are using (or writing yourself).
We have a builder wrapped around the OpenAPI generator (see this PR) and we are looking to be able to run the generator when there is a change to the underlying spec. While the Dart defined configuration isn't being changed the underlying spec is. This would be akin to the node wrapper for the Openapi-generator, but for those who are used to using a dart based environment.
Whether you are using Windows, MacOSX, or Linux (if applicable)
Linux
Whether you are using Chrome, Safari, Firefox, Edge (if applicable)
N/A
Any other packages or constraints we should know about
The user shouldn't need to leave the ecosystem they are already in. Also the openapi-generator-cli does the actual generation for us. We are effectively looking to be able to allow for a rerun when the asset graph hasn't changed.
My thoughts to solve this would be to be able to add a build option like build_to: cache but it be alwaysRun: <true|false> or something similar.
If this is already achievable would you mind pointing me to the documentation? I have not been able to find any in this vain.
The text was updated successfully, but these errors were encountered:
Currently to work around this issue I need to run: rm .dart_tool/build/**/asset_graph.json && flutter|dart pub run build_runner build which feels risky to do as this could cause issues where multiple builders are present. The other solution we chose, but is definitely a workaround, is to inject a comment after the generation is complete to invalidate the build cache; which feels really hacky.
I understand why you want this, but it generally isn't compatible with how this build system works. Any sort of builder which would always require re-running, must be violating a fundamental contract of builders (ie: using dart:io directly to reach outside the package directory or maybe to the internet instead of using the BuildStep apis).
My suggestion would be to create a separate tool that you run which will copy whatever external resources you need into an actual file on disk in some location which you can read through the BuildStep APIs. That tool might also kick off a build right after doing that if you want to always only run a single command.
So for example you could have a script at tool/build.dart which does some resource copy and then uses Process.run to run a build_runner command (possibly forwarding all arguments from the current process).
We have discussed in the past some more formal API for "external resources" which could simplify/formalize some of this, but we don't have one for now.
Dart SDK Version (
dart --version
)Dart SDK version: 3.0.7 (stable) (Mon Jul 24 13:17:56 2023 +0000) on "linux_x64"
What package(s) from this repo you are using, and the version (i.e.
build_runner 0.7.12
)2.4.6
What builder(s) you are using (or writing yourself).
We have a builder wrapped around the OpenAPI generator (see this PR) and we are looking to be able to run the generator when there is a change to the underlying spec. While the Dart defined configuration isn't being changed the underlying spec is. This would be akin to the node wrapper for the Openapi-generator, but for those who are used to using a dart based environment.
Linux
N/A
The user shouldn't need to leave the ecosystem they are already in. Also the openapi-generator-cli does the actual generation for us. We are effectively looking to be able to allow for a rerun when the asset graph hasn't changed.
My thoughts to solve this would be to be able to add a build option like
build_to: cache
but it bealwaysRun: <true|false>
or something similar.If this is already achievable would you mind pointing me to the documentation? I have not been able to find any in this vain.
The text was updated successfully, but these errors were encountered: