-
Notifications
You must be signed in to change notification settings - Fork 39
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
feat: Avoid ignoring generated files in libraries #233
Conversation
Sorry, but no. The generated files are compile time artifacts and I have no intention of including them. The pipeline that builds and publishes ensures they are built fresh and published to pub.dev. I do wish to have a conflict between generated files that made it to GitHub and the ones generated at publish time. |
No they are not build at compile time (they are not used for compilation only). They are also necessary for code analysis in the IDE. They are just generated code which is part of the source code, and should be treated like that in my opinion. For that reason Flutter also checks in all the generated dart files:
You DO wish or you DON'T? Currently it is not possible to use betas like
So what I have to do in order for this to work is to check in the source files, like i did in this PR + the regular changes: main...Gustl22:flutter_json_theme:flutter-3.27.x I ask you to reconsider your descision and to might conform with the way how Flutter / Dart is proposing it to do. Thank you. |
Still not committing generated files. They are published, but not committed. That said, your request can be met by creating a beta version with both a pubspec version and a changelog that explains the beta. Hopefully you can find a solution to your problem via that, and if not, TBH, I'd like to hear why not and maybe that might get me to reconsider. Even if I checked in the generated files, you'd have the same exact problem. They'd be generated against a flutter version that differs (and doesn't allow) what was generated. Checking in the generated files solves nothing. However, creating a beta with an updated workflow that builds, publishes, and generates against said beta, would. |
Thank you for your repsonse.
Would be nice to also object my other arguments, I made before.
No my request can't be met like that. Imagine you have the main branch and two feature branches and need a feature or fix from the one branch, but not the other. One can't simply use your package (or more precise the patch of your package from a contributor) unless they are checking them out locally (which is unnecessarily hard in an app pipeline). Also in rapid edge development one can't wait two months until they can continue like it was the case in #229. One needs to be able to use the package immediately via a git dependency, also a pre-release doesn't help there, as the maintainer might not be available in that urgency or refuses to apply a change (also for good reasons). Your package should work regardless!! of which dependeny method you choose, either locally, via pub or via git.
You are right, that solves nothing if one doesn't update the generated files also. Otherwise it wouldn't make sense: checking in files, but not updating them -> not working. If someone provides a fix, they must regenerate the files of course in order to make them work, and these are checked in, so it is guaranteed to work regardless of the build_runner version etc. which can also differ locally. One can double check in the publish pipeline of course, if they were generated correctly. From your other post:
But that's an architectural problem of your build pipeline(?). And it's also not directly interferring with my problem. You can still generate these additionally in your publish pipeline and e.g. check potential differences to the checked in files. A published package on
That's understanable to keep the git as small as possible, I see that. I also like that idea. But Flutter build_runner wasn't meant for this as I showed in the proposed
That's not true per se. Referencing a git package is pretty common, e.g. for private packages, where it's not worth and also overcomplicating to set up its own pub.dev server. It is also "strongly" discouraged to publish package resources (on pub.dev), which aren't checked into git:
|
Description
In contrast to apps, it is usually mandatory to include used
.g.dart
files in git versioning as they are part of the library (and they are in fact included in the package inpub.dev
).Right now any fork cannot be used remotely (via overriding pubspec dependencies) unless they include the generated files themselves into git.
The files are not generated by the build_runner and also shouldn't, as the app developer may doesn't even use build_runner.
Refs:
https://dart.dev/guides/libraries/private-files#details
https://stackoverflow.com/a/55177035/5164462
Build_runner / Dart is not proposing to ignore these:
https://github.com/dart-lang/build/blob/master/.gitignore
Checklist
Before you create this PR confirm that it meets all requirements listed below by checking the relevant checkboxes (
[x]
). This will ensure a smooth and quick review process.///
).flutter analyze
ordart analyze
) does not report any problems on my PR.pubspec.yaml
with an appropriate new version according to the pub versioning philosophy.CHANGELOG.md
to add a description of the change.UI Change
Does your PR affect any UI screens?