-
Notifications
You must be signed in to change notification settings - Fork 211
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Question: how to configure build.yaml
to "disable" provided/inherited builder?
#3595
base: master
Are you sure you want to change the base?
Question: how to configure build.yaml
to "disable" provided/inherited builder?
#3595
Conversation
…ve the "not_enabled_builder" show up in the generated `build.dart` file?
build.yaml
to "disable" provided builder?build.yaml
to "disable" provided/inherited builder?
There isn't a way to enable/disable a builder for packages other than the current package, except by overriding individual packages build files as you have done in your example. |
Thanks for the quick response! Unfortunately, I'm not completely sure on what I should put inside the I've been trying out some things, but for now, no matter what I put inside it (even nothing at all), it seems that just adding the I still feel it would be a good addition to the package to provide a test case where the (expected) result of a "individual package override file" is showcased. So any pointers on what to put inside the file are more than welcome. |
Yes it is all or nothing when overriding a build.yaml file - you would have to copy everything they have and then alter the parts you want to alter. If you just want to disable a given builder for your package, or that package, you can do that like this: targets:
$default:
builders:
some_package:some_builder:
enabled: false |
b879dfb
to
9a52350
Compare
I've been looking into this, but I somehow cannot get the Could you please check out my branch and show me what I'm doing wrong? I've made the following adjustments to the setup:
So I'm still getting something wrong, but can't seem to figure it out by myself what I'm missing here... Edit: I'm running |
The Any builder which is defined will end up in the What is your use case for wanting the import to be removed entirely? |
I seem to be struggling with a couple of things at the same time. A little background on my setup:
Now, I ran into the following issues:
I'll try to get to a minimal example by next week. In the mean time, any pointers on how to get a better look at the asset graph or other potential debugging tips are always welcome. |
This is why you are running into difficulties for sure. It isn't a supported use case to use code generation in the same package as your builders (or at least not within libraries imported by your builders), since we put them all into a single program, so all code for builders needs to already be generated. The easiest solution to this is to create a separate package for the code in your package wich requires codegen, and then depend on that package. That package will have a separate build script so it will work fine, and your package can just depend on that package.
Yeah, this is another sort of workaround but you will run into issues whenever those files are invalidated. You can make it work (manually restoring the files when they get deleted then running a build again), but it is painful. We do this in some of our packages though. |
If your package does not actually use its own builders though, then an even easier workaround would be to just simply not include your own builders in the script, as you were trying to do. That sounds to me like a valid use case and probably a common enough pattern that it would be worth supporting. |
Okay, so would it be useful if I try to come up with a PR to exclude disabled builders from the In the meantime I'll also try to split up the packages as you suggested. |
Sure, I would definitely review a contribution like that, as long as it doesn't make generating the build script significantly slower for some reason (but I don't think it should). |
I'm using this PR as a way to ask a question, but it might result in some extra addition to the golden test to show this functionality (if it actually exists).
So, my question is this: given the extra
not_enabled_builder
, is there a way to have it not show up in the resultingbuild.dart
file?The test that's failing now, is
generated_script_integration_test.dart
.I've been trying various things to keep this builder from ending in the
build.dart
file, but to no avail so far.One thing that helps a little, is the addition of
provides_builder.build.yaml
with the following contents:The only problem is that it will omit all builders from the
provides_builder
package.Is there a way to disable a builder in such a granulary way?