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

Enhance Ginjector generation #77

Merged
merged 11 commits into from
Dec 30, 2012
Merged

Conversation

kuhnroyal
Copy link
Contributor

Added the ability to use Gatekeepers with ApplicationController generation.

You can now add an additional interface to the generated Ginjector that allows for example the declaration of a default gatekeeper.

Fixed the use of ProviderBundles in the generated Ginjector and added a generator that generates all ProviderBundles. No more manually keeping the presenter id's and bundle size in order.

Please review :)

@buildhive
Copy link

ArcBees » GWTP #100 FAILURE
Looks like there's a problem with this pull request
(what's this?)

@buildhive
Copy link

ArcBees » GWTP #101 SUCCESS
This pull request looks good
(what's this?)

@branflake2267
Copy link
Contributor

Could you format to <120 characters. I noticed a few lines overshoot :)

public void setPresenters(Set<JClassType> presenters) {
this.presenters = presenters;
}
} No newline at end of file
Copy link
Contributor

Choose a reason for hiding this comment

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

add new line

@branflake2267
Copy link
Contributor

Nice job. Other than my formatting nits, this looks good to me :)

@branflake2267
Copy link
Contributor

Do you think a unit test could be used on this?

@kuhnroyal
Copy link
Contributor Author

I will fix the formatting tomorrow.
Not sure about a TestCase, will see.

* providers[ID_Object2] = object2Provider;
* }
* }</pre>
* ProviderBundles are automatically generated by GWTP.
Copy link
Member

Choose a reason for hiding this comment

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

Bring back the old documentation please, it's still an option to use the generated generators.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ok, how to you want to handle the ProxyCodeSplitBundle annotation, should it be extended with a third parameter or should there be a new annotation for generated bundles.

Copy link
Member

Choose a reason for hiding this comment

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

What do you mean? Is your change backward compatible?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

At the moment not, that is why I ask.

Copy link
Member

Choose a reason for hiding this comment

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

It should be backward compatible, we don't want to brake other users :D So yes, we have to look at what we can do to make this happen. I don't remember, why a third parameter was needed?

Copy link
Member

Choose a reason for hiding this comment

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

Ok, maybe it's my brain that is forgetting how to use ProviderBundle since it's something I never had to use until now... but the goal is only to write the ginjector, what would usually be in the ginjector when there's a provider bundle in the application?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Well usually you create your bundle class and create id's for all the presenters that are supposed to be in the bundle, this is a really piece of work to keep up-to-date.

The injector only has one line per bundle with an AsyncProvider.

My implementation generates all the bundles that are necessary with out the need for the developer to worry about things like indexes and bundles sizes. Maybe my bad cause I mixed this with the ClientGinjector generation issue but I really see it as one problem.

Copy link
Member

Choose a reason for hiding this comment

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

So true!

That's a bonus then 💃

Well, I think the only thing now is to make sure that it's backward compatible, aside of that, it's a really great feature that you added!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yea, i'd see we just extend the current annotation with a string value that identifies the bundle.
You can then use either bundeClass and id or just the value, other combinations need to be prevented by the PresenterInspector.

 public @interface ProxyCodeSplitBundle {

     Class<? extends ProviderBundle> bundleClass();

     int id();

    String value();
 }

Copy link
Member

Choose a reason for hiding this comment

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

alright, let's go with that, can you write some documentation about it? It will at least need to be documented in the javadoc, but If you can write a little something for users that just started to use the framework, it will help them a lot

@christiangoudreau
Copy link
Member

Need integration test in fact. One of the sample should be updated to make sure that it's still running and at some point we should fully test team using cucumber

@christiangoudreau
Copy link
Member

Good job! I'll take on the task for the Gatekeepers as well as to introduce a Bootrapper sequence

@christiangoudreau
Copy link
Member

Don't worry for the test, I want all sample to use cucumber's test at some point, we'll take that part on. If you have time, in a different PR, please add your work to one sample that has bundles and/or gatekeepers.

Thanks!

@kuhnroyal
Copy link
Contributor Author

I have this running in a pretty big app so it works, I will update a sample in the next few days.

@buildhive
Copy link

ArcBees » GWTP #102 SUCCESS
This pull request looks good
(what's this?)

ClassSourceFileComposerFactory composer = initComposer();
SourceWriter sourceWriter = composer.createSourceWriter(generatorContext, printWriter);

writeInit(sourceWriter);
writeInit(sourceWriter,
new GinjectorGenerator().generate(getTreeLogger(), generatorContext, GinjectorGenerator.DEFAULT_FQ_NAME));
Copy link
Member

Choose a reason for hiding this comment

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

Extract GinjectorGenerator().generate to a variable for better readability

@christiangoudreau
Copy link
Member

Two small last nits :D Then LGTM!

@kuhnroyal
Copy link
Contributor Author

Will fix the final stuff tomorrow and maybe add a complex sample with Gatekeepers.

One thing that I noticed in our project was the TabInfo annotation. Can not really provide the Ginjector as parameter any more. Any idea on how to solve this?

@christiangoudreau
Copy link
Member

Uhm this one is tricky, but it could become an optional parameter so that if none is found, it use the generated generator which always have the same name.

@kuhnroyal
Copy link
Contributor Author

Well it always has the same name but you don't really have access to it's methods. Maybe we can allow an arbitrary parameter list of any gin-bound classes like gatekeepers and clientbundles somehow?

@christiangoudreau
Copy link
Member

Yeah, well seems like the ginjector interface that you added at first will still be needed in some cases. But I would rather have the ClientGinjector extends the user ginjector defined accessors.

What I don't like is that we will have to check every type to make sure that we don't double bind anything.

@kuhnroyal
Copy link
Contributor Author

@TabInfo now accepts multiple parameters either of a custom ginjector type or any type that is provided through the ginjector, this allows for parameters such as gatekeepers or message resources.

@buildhive
Copy link

ArcBees » GWTP #105 SUCCESS
This pull request looks good
(what's this?)

@buildhive
Copy link

ArcBees » GWTP #106 SUCCESS
This pull request looks good
(what's this?)

@branflake2267
Copy link
Contributor

Ready to merge?

@branflake2267
Copy link
Contributor

I heard its not so we can wait till your back after holidays Peter. Thanks. :)

@kuhnroyal
Copy link
Contributor Author

Afaik it is ready. I can rebase tomorrow if that is ok.
Am 24.12.2012 16:38 schrieb "Brandon Donnelson" notifications@github.com:

I heard its not so we can wait till your back after holidays Peter.
Thanks. :)


Reply to this email directly or view it on GitHub.

@branflake2267
Copy link
Contributor

No problem take your time :)

@christiangoudreau
Copy link
Member

LGTM! :D

@kuhnroyal
Copy link
Contributor Author

Ok.... the rebase messed up the commit count, file changes are still the same. Probably should have merged :(

@kuhnroyal
Copy link
Contributor Author

I messed this one up...

@kuhnroyal
Copy link
Contributor Author

Ok now it is ready.

@buildhive
Copy link

ArcBees » GWTP #135 SUCCESS
This pull request looks good
(what's this?)

@christiangoudreau
Copy link
Member

Good, next step will be to update the sample! Good job!

I'll try to release an alpha 2 in a few days.

Thanks again and merry Christmas!

@kuhnroyal
Copy link
Contributor Author

Two of the samples are updated in ArcBees/GWTP-Samples#9

Merry Christmas to you as well!

@branflake2267
Copy link
Contributor

Merry Christmas. Thanks for everything. :)

branflake2267 added a commit that referenced this pull request Dec 30, 2012
@branflake2267 branflake2267 merged commit 2e22349 into ArcBees:master Dec 30, 2012
branflake2267 added a commit that referenced this pull request Apr 4, 2014
hpehl pushed a commit to hpehl/GWTP that referenced this pull request Dec 9, 2014
Enhance Ginjector generation


Former-commit-id: 0b9b65d
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants