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

Misleading description of secondary variants #29295

Open
lukebemish opened this issue May 24, 2024 · 2 comments
Open

Misleading description of secondary variants #29295

lukebemish opened this issue May 24, 2024 · 2 comments
Labels
a:documentation Documentation content in:dependency-declarations variant notation attributes capability substitution

Comments

@lukebemish
Copy link

Issue type

Wrong or misleading information

Problem description

The page on understanding variant selection is about the only place secondary variants seem to be documented, and has the following to say about them:

It also shows secondary variants, which are exclusive to Gradle projects and not published. For example, the secondary variant classes from apiElements is what allows Gradle to skip the JAR creation when compiling against a java-library project.

Additionally, the output from the outgoingVariants task has the following:

(*) Secondary variants are variants created via the Configuration#getOutgoing(): ConfigurationPublications API which also participate in selection, in addition to the configuration itself.

Between the two of these, I inferred that one can make a secondary variants through configurations.myConfiguration.outgoing.variants and that it will not be published; however, this is not the case. Secondary variants created that way appear to be published by default -- for a very simple case reproducing this, see https://gist.github.com/lukebemish/5b79f393c6a44e31311a8b8f18844c9c

Context (optional)

No response

Page with the problem

https://docs.gradle.org/current/userguide/variant_model.html

@lukebemish lukebemish added a:documentation Documentation content to-triage labels May 24, 2024
@ljacomet ljacomet added the in:dependency-declarations variant notation attributes capability substitution label May 30, 2024
@ljacomet
Copy link
Member

This is a valid documentation issue.


One way to think about secondary variants: they are pre-computed artifact transforms. They obey the same rules as artifact transform selection.

Related:

@lukebemish
Copy link
Author

Thank you; That was my understanding of them too -- the specific issue with the docs is that they imply that secondary variants are not published, when in fact secondary variants are, without extra logic to exclude them, published alongside the "normal" variant.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
a:documentation Documentation content in:dependency-declarations variant notation attributes capability substitution
Projects
None yet
Development

No branches or pull requests

2 participants