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

Make compileProtoPath variant selection criteria tighter #489

Merged

Conversation

voidzcy
Copy link
Collaborator

@voidzcy voidzcy commented Apr 21, 2021

Fixes #391

The existing compileProtoPath, which is used to resolve dependencies inherited from compileOnly and implementation, accept dependencies with any Usage attribute. This could lead to ambiguous variant selection problem if the dependency exposes more than one variants with the same LibraryElements compatible with "resources" (specified by compileProtoPath) but with different Usages. It doesn't matter which variant is selected, as long as the variant has "resources" element. Since compileProtoPath inherits from compileOnly and implementation, it won't go wrong if we just select what compileOnly/implementation would select.

This doesn't seem to be a unbeatable solution that completely prevents ambiguous variant selection problem, as there are still other attributes (e.g., dependency with variants targeting on different JVM version/environment may still cause problem). Extracting protos from dependencies resolved by compileClasspath may improve it, if that doesn't have unknown consequences that make this Java-specific.

… usage attribute to CompileProtoPath configuration. This can reduce the chance of getting ambiguous variant selection error.
@voidzcy voidzcy marked this pull request as ready for review April 22, 2021 03:01
@voidzcy voidzcy merged commit 44309a2 into google:master Apr 22, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants