-
Notifications
You must be signed in to change notification settings - Fork 82
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
add optional annotations artifact with SingleIn and ForScope #725
Conversation
(opinion): I think optional already has a meaning in Dagger world, which might make this naming a little confusing. |
I mostly went with the suggestion from the issue but don't really have a strong opinion on the artifact name. Happy to update the pr with something else |
It would be great to update the commit message with a better description. I'm okay with |
I think optional is a bad name because dagger has specialized support for an "optional" semantic via Also - does this need to be configurable via the DSL since it technically doesn't really have anything to do with anvil? 🤔 |
If it doesn't have anything to do with Anvil, then it shouldn't be part of the repository altogether. By allowing it to be configured through the DSL we don't have to deal with Maven coordinates and it's more discoverable IMO. |
I agree that having DSL support for configuring/adding this dependency would be nice. @gabrielittner up to you if you want to take a stab at that, if not I'm happy to add it separately. |
Hmm this is a fair point, although I feel there aren't a lot of other name options that still accurately capture it as being a set of optional annotations while still being simple. I think something like At the moment I'd lean more towards some potential initial confusion with Dagger's concept of |
These 2 optional annotations can be used to avoid having to manually define scope annotations for each component or qualifier annotations for each object that can clash with other. Instead all components can use SingleIn with the same scope marker as the corresponding MergeComponent/MergeSubcomponent/ContributesSubcomponent annotation uses. In the same way ForScope can be used with that scope marker to qualify bindings or provisions in a certain component.
@vRallev I've rebased and updated the commit message. The DSL now has |
@@ -94,6 +94,7 @@ subprojects { | |||
freeCompilerArgs.add("-opt-in=kotlin.RequiresOptIn") | |||
|
|||
boolean optInExperimental = project.name != "annotations" | |||
&& project.name != "annotations-optional" | |||
&& project.name != "scopes" | |||
&& project.name != "dagger-factories-only" | |||
if (optInExperimental) { |
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 think the dependency substitution rules below this should also be updated to include the new artifact
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.
Added it 6f175ec
gradle-plugin/src/main/java/com/squareup/anvil/plugin/AnvilExtension.kt
Outdated
Show resolved
Hide resolved
gradle-plugin/src/main/java/com/squareup/anvil/plugin/VariantFilter.kt
Outdated
Show resolved
Hide resolved
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.
Lgtm! Thanks for adding this
Could a mention of this be added to the |
Closes #692