-
Notifications
You must be signed in to change notification settings - Fork 36
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
fix: multiple generations for same class #123
Conversation
.gitignore
Outdated
@@ -1,7 +1,7 @@ | |||
.idea | |||
.vscode | |||
melos_envied.iml | |||
pubspec_overrides.yaml | |||
# pubspec_overrides.yaml |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please remove this, as the overrides should not be tracked.
examples/envied_example/pubspec.yaml
Outdated
dependencies: | ||
envied: ^1.0.0 | ||
build_runner: ^2.4.13 | ||
envied_generator: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure why this is necessary. This is an example and should not really be run from the package itself. If desired, one can still create a pubspec_overrides.yaml file.
examples/envied_example/pubspec.yaml
Outdated
envied_generator: | ||
path: ../../packages/envied_generator | ||
|
||
dependency_overrides: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be solved with pubspec_overrides.yaml
@@ -3,10 +3,6 @@ name: envied | |||
packages: | |||
- "**" | |||
|
|||
command: | |||
bootstrap: | |||
usePubspecOverrides: true |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I found this error in my IDE (check the melos VSCode extension):
But thats bc it was deprecated in version 3.0.0 in this issue
@@ -1,3 +1,8 @@ | |||
## 1.0.1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please do NOT create a new version unless you are the package maintainer.
@@ -1,6 +1,6 @@ | |||
name: envied_generator | |||
description: Generator for the Envied package. See https://pub.dev/packages/envied. | |||
version: 1.0.0 | |||
version: 1.0.1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please do NOT create a new version unless you are the package maintainer.
@@ -0,0 +1,3 @@ | |||
dependency_overrides: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This file should not be included.
Hey, I left some comments. Please do NOT update the version in this PR. |
With regards to the rest of the comments:
I'm not sure what to do... Do I remove the pubspec version upgrade and changelog (update 'em) or left them like they are in this PR? |
Correct, for local development. Melos creates them anyway when bootstrapping the project.
Don't take this the wrong way, I'm very grateful for any contribution, however, this PR is supposed to add a feature, not create a new release. The release itself is done via a Github action.
Correct, remove any changes to the pubspec.yaml and changelog because it interferes with the release process. I will do that in a release PR. There is another PR waiting to be reviewed / merged which could go into a hypothetical v1.0.1.
I disagree. It creates unnecessary clutter. |
This reverts commit 22a2820.
final enviedAnnotations = element.metadata | ||
.where((a) => a.element?.displayName == 'Envied') | ||
.map((e) => ConstantReader(e.computeConstantValue())); | ||
var generatedClassesAltogether = StringBuffer(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please make this final
instead of using a var
and declare it with an explicit type.
@@ -31,6 +31,23 @@ final class EnviedGenerator extends GeneratorForAnnotation<Envied> { | |||
ConstantReader annotation, | |||
BuildStep buildStep, | |||
) async { | |||
final enviedAnnotations = element.metadata |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you please add explicit type definitions?
.where((a) => a.element?.displayName == 'Envied') | ||
.map((e) => ConstantReader(e.computeConstantValue())); | ||
var generatedClassesAltogether = StringBuffer(); | ||
for (final a in enviedAnnotations) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you please more descriptive variable names and also explicitly type them as it makes code easier to review.
Sorry, dude. I think we are not compatible in our work of working and I'm not willing to continue with this. I push the changes I have already done and when I have the time I'll continue with my own implementation of this package |
Yeah, fine. |
Now multiple @envied annotations generate multiples classes