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
Generate code in another folder? #272
Comments
Seems reasonable, I think we probably would want to keep outputs in the same top level directory (lib/web/etc) as the original inputs, and then mirror the rest of the path under the generated files directory. So if you had a file at What do you think? The main issue I see is that the part statements would be pretty long/ugly. However we need to mirror the directory structure to make sure we don't have conflicts.... |
LGTM I don't think the part import path is actually a problem. To me it is preferably compared to having generated files mixed with original one. |
This won't be easy but should be feasible. Do we need it to be configurable or should it be a boolean flag on Is this a property of the code generator, or of the usage? If you're using |
Ah ya I guess this is more challenging than I realized at first because of the migration away from |
Also fwiw we are moving more towards not outputting files in the main source directory any more, but instead outputting them to a hidden directory and then materializing a merged view in some output folder. This is because we are adding support for generating files in other packages so we have to create our own view of the world to prevent ourselves from polluting the users pub cache. Once we are fully migrated over to this model then that probably closes this issue as well? |
I think there could still be a use case for generating files to a side directory and committing those files and uploading them to pub, though I'd also be happy to hear that just building to a cache solves the issue. |
ouch! I couldn't imagine this was so complicated. I thought there was no such a difference where the generated file was. Why having it beside the original file should be so different than having it in a different path ? |
@natebosch I prefer committing generated files. |
@zoechi we do plan to support that model as well, but it hasn't turned out to be as useful as we originally hoped. I think we will probably end up with some sort of mixed mode where certain Builders are outputting to a cache dir and others output directly in your source dir like happens today. |
@jakemac53 that sounds fine. I also find both cases useful. |
Can we close this since |
Ya, lets close this as not planned/obsolete based on new changes |
This adds support for custom output locations, including outputs in different directories, to the combining builder. - Make output extensions configurable through builder options. The options are validated to ensure the combining builder is running on Dart files and emits Dart files - Move the check ensuring we have a `part` statement from the `SharedPartBuilder` to the `CombiningBuilder`. The former can't know the correct output location anymore. This is related to #272, where the implementation in `build` requires cooperation from builders. Given that most generated files come from shared part generators in practice, this would enable generating to different folders for most users.
I think it could be interesting to group all the generated code in different folder from the original sources.
this makes simple to distinguish main source files from generated one (that one should not edit by hand).
Is it possible to add some options to
PartBuilder
andLibraryBuilder
in order to specify a different folder (even restricted tolib
) where to put generated files ?The text was updated successfully, but these errors were encountered: