Skip to content
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

Closed
wants to merge 8 commits into from

Conversation

Rodsevich
Copy link

@Rodsevich Rodsevich commented Dec 6, 2024

Now multiple @envied annotations generate multiples classes

@techouse techouse changed the title Fix #122 fix: multiple generations for same class Dec 10, 2024
.gitignore Outdated
@@ -1,7 +1,7 @@
.idea
.vscode
melos_envied.iml
pubspec_overrides.yaml
# pubspec_overrides.yaml
Copy link
Collaborator

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.

dependencies:
envied: ^1.0.0
build_runner: ^2.4.13
envied_generator:
Copy link
Collaborator

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.

envied_generator:
path: ../../packages/envied_generator

dependency_overrides:
Copy link
Collaborator

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
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why?

Copy link
Author

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):
image

But thats bc it was deprecated in version 3.0.0 in this issue

@@ -1,3 +1,8 @@
## 1.0.1
Copy link
Collaborator

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
Copy link
Collaborator

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:
Copy link
Collaborator

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.

@techouse
Copy link
Collaborator

Hey, I left some comments.

Please do NOT update the version in this PR.

@Rodsevich
Copy link
Author

With regards to the rest of the comments:

  • pubspec_overrides are necessary for a correct local development. For us, that we don't have them, in order to run them we have to lose time fixing dependencies before being productive. I don't find why to don't commit them.
  • As a package maintainer myself, I appreciate more the guys that help me with the chores of a package maintenance. Several times I delayed the publish because of lack of time to doing that shit myself (instead of just running git pull && pub publish). If you don't like that, you can kindly thank the extra job done and say not to worry afterwards to the guys that loose their time trying to help.
    With that said, and due to

Please do NOT update the version in this PR.

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?
With regards to the pubspec_overrides, I think they are better present that absent, and like I left them the project is just working. Why don't you remoe mines but add yours and leave the project functional for future contributors?

@techouse
Copy link
Collaborator

techouse commented Dec 10, 2024

pubspec_overrides are necessary for a correct local development. For us, that we don't have them, in order to run them we have to lose time fixing dependencies before being productive. I don't find why to don't commit them.

Correct, for local development. Melos creates them anyway when bootstrapping the project.

As a package maintainer myself, I appreciate more the guys that help me with the chores of a package maintenance. Several times I delayed the publish because of lack of time to doing that shit myself (instead of just running git pull && pub publish). If you don't like that, you can kindly thank the extra job done and say not to worry afterwards to the guys that loose their time trying to help.

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.

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, 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.

With regards to the pubspec_overrides, I think they are better present that absent, and like I left them the project is just working. Why don't you remoe mines but add yours and leave the project functional for future contributors?

I disagree. It creates unnecessary clutter.

final enviedAnnotations = element.metadata
.where((a) => a.element?.displayName == 'Envied')
.map((e) => ConstantReader(e.computeConstantValue()));
var generatedClassesAltogether = StringBuffer();
Copy link
Collaborator

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
Copy link
Collaborator

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) {
Copy link
Collaborator

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.

@techouse techouse self-assigned this Dec 10, 2024
@techouse techouse added the enhancement New feature or request label Dec 10, 2024
@Rodsevich
Copy link
Author

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

@techouse
Copy link
Collaborator

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Multiple generations for same class
2 participants