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

Secondary variants of resolvable configuration aren't displayed in outgoingVariants report #28812

Open
aSemy opened this issue Apr 14, 2024 · 3 comments
Labels
a:bug in:dependency-declarations variant notation attributes capability substitution in:reporting-tasks help dependencyInsight dependencies re:comprehensibility reasonable errors and warnings, clear dsl, mental overload

Comments

@aSemy
Copy link
Contributor

aSemy commented Apr 14, 2024

Current Behavior

Secondary variants of resolvable configuration aren't displayed in outgoingVariants report.

Expected Behavior

Either:

  1. Secondary variants of resolvable configuration are displayed in outgoingVariants report.
  2. If secondary variants of resolvable configurations are not valid, it should not be possible to create them.

Context (optional)

Related: #28149

Steps to Reproduce

// build.gradle.kts

group = "x.y.z"
version = "1.2.3"

val fooFiles: Configuration by configurations.creating {
  isCanBeDeclared = false
  isCanBeResolved = true
  isCanBeConsumed = false
}

val fooFilesVariant1: ConfigurationVariant by fooFiles.outgoing.variants.creating {}

val barFiles: ResolvableConfiguration = configurations.resolvable("barFiles") {}.get()

val barFilesVariant1: ConfigurationVariant by barFiles.outgoing.variants.creating {}

Run gradle outgoingVariants -q

--------------------------------------------------
Variant archives
--------------------------------------------------
Configuration for archive artifacts.

Capabilities
    - x.y.z:demo:1.2.3 (default capability)

--------------------------------------------------
Variant default
--------------------------------------------------
Configuration for default artifacts.

Capabilities
    - x.y.z:demo:1.2.3 (default capability)

Gradle version

8.7

Build scan URL (optional)

No response

Your Environment (optional)

No response

@ov7a ov7a added in:dependency-declarations variant notation attributes capability substitution in:reporting-tasks help dependencyInsight dependencies re:comprehensibility reasonable errors and warnings, clear dsl, mental overload and removed to-triage labels Apr 16, 2024
@ov7a
Copy link
Member

ov7a commented Apr 16, 2024

The issue is in the backlog of the relevant team and is prioritized by them.

@abstratt
Copy link
Member

abstratt commented Apr 25, 2024

Note that if you mark a configuration as isCanBeConsumed = false, outgoing should not be called on it:

Usage: This method should only be called on consumable configurations, but will not warn if used otherwise.

Maybe not silently accepting outgoing to be accessed in a non-consumable configuration is exactly what is being asked for here.

Also, if you do leave it as consumable (the default), but also leave it as resolvable, that makes it a legacy configuration (see table in this section), and then it is not shown by default, only when --all is specified.

@abstratt
Copy link
Member

Also note that even for the project as-is, if you specify the configuration name explicitly, it will show the variant:

gradle outgoingVariants --variant fooFiles 

> Task :outgoingVariants
--------------------------------------------------
Variant fooFiles
--------------------------------------------------

Capabilities
    - x.y.z:configurations:1.2.3 (default capability)

Secondary Variants (*)

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

BUILD SUCCESSFUL in 645ms
1 actionable task: 1 executed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
a:bug in:dependency-declarations variant notation attributes capability substitution in:reporting-tasks help dependencyInsight dependencies re:comprehensibility reasonable errors and warnings, clear dsl, mental overload
Projects
None yet
Development

No branches or pull requests

3 participants