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

Generating report for multi-module project with flavors #314

Closed
IlyaPavlik opened this issue Mar 3, 2023 · 5 comments
Closed

Generating report for multi-module project with flavors #314

IlyaPavlik opened this issue Mar 3, 2023 · 5 comments
Assignees
Labels
Bug Bug issue type S: in progress Status: implementing or design in process

Comments

@IlyaPavlik
Copy link

Describe the bug
Build failed when I try to generate html report for multi module project with flavors.
./gradlew clean :app:koverHtmlReportDemoDebug

Errors

Could not determine the dependencies of task ':app:koverHtmlReportDemoDebug'.
> Could not resolve all task dependencies for configuration ':app:koverAggregatedSetupDemoDebug'.
   > Could not resolve project :libModule.
     Required by:
         project :app
      > The consumer was configured to find attribute 'kotlinx.kover.setup.name' with value 'demoDebug'. However we cannot choose between the following variants of project :libModule:
          - debugApiElements
          - debugRuntimeElements
          - releaseApiElements
          - releaseRuntimeElements
        All of them match the consumer attributes:
          - Variant 'debugApiElements' capability JaCoCoExample:libModule:unspecified:
              - Unmatched attributes:
                  - Provides com.android.build.api.attributes.AgpVersionAttr '7.4.2' but the consumer didn't ask for it
                  - Provides com.android.build.api.attributes.BuildTypeAttr 'debug' but the consumer didn't ask for it
                  - Provides com.android.build.gradle.internal.attributes.VariantAttr 'debug' but the consumer didn't ask for it
                  - Doesn't say anything about kotlinx.kover.setup.name (required 'demoDebug')
                  - Provides org.gradle.category 'library' but the consumer didn't ask for it
                  - Provides org.gradle.jvm.environment 'android' but the consumer didn't ask for it
                  - Provides org.gradle.usage 'java-api' but the consumer didn't ask for it
                  - Provides org.jetbrains.kotlin.platform.type 'androidJvm' but the consumer didn't ask for it
          - Variant 'debugRuntimeElements' capability JaCoCoExample:libModule:unspecified:
              - Unmatched attributes:
                  - Provides com.android.build.api.attributes.AgpVersionAttr '7.4.2' but the consumer didn't ask for it
                  - Provides com.android.build.api.attributes.BuildTypeAttr 'debug' but the consumer didn't ask for it
                  - Provides com.android.build.gradle.internal.attributes.VariantAttr 'debug' but the consumer didn't ask for it
                  - Doesn't say anything about kotlinx.kover.setup.name (required 'demoDebug')
                  - Provides org.gradle.category 'library' but the consumer didn't ask for it
                  - Provides org.gradle.jvm.environment 'android' but the consumer didn't ask for it
                  - Provides org.gradle.usage 'java-runtime' but the consumer didn't ask for it
                  - Provides org.jetbrains.kotlin.platform.type 'androidJvm' but the consumer didn't ask for it
          - Variant 'releaseApiElements' capability JaCoCoExample:libModule:unspecified:
              - Unmatched attributes:
                  - Provides com.android.build.api.attributes.AgpVersionAttr '7.4.2' but the consumer didn't ask for it
                  - Provides com.android.build.api.attributes.BuildTypeAttr 'release' but the consumer didn't ask for it
                  - Provides com.android.build.gradle.internal.attributes.VariantAttr 'release' but the consumer didn't ask for it
                  - Doesn't say anything about kotlinx.kover.setup.name (required 'demoDebug')
                  - Provides org.gradle.category 'library' but the consumer didn't ask for it
                  - Provides org.gradle.jvm.environment 'android' but the consumer didn't ask for it
                  - Provides org.gradle.usage 'java-api' but the consumer didn't ask for it
                  - Provides org.jetbrains.kotlin.platform.type 'androidJvm' but the consumer didn't ask for it
          - Variant 'releaseRuntimeElements' capability JaCoCoExample:libModule:unspecified:
              - Unmatched attributes:
                  - Provides com.android.build.api.attributes.AgpVersionAttr '7.4.2' but the consumer didn't ask for it
                  - Provides com.android.build.api.attributes.BuildTypeAttr 'release' but the consumer didn't ask for it
                  - Provides com.android.build.gradle.internal.attributes.VariantAttr 'release' but the consumer didn't ask for it
                  - Doesn't say anything about kotlinx.kover.setup.name (required 'demoDebug')
                  - Provides org.gradle.category 'library' but the consumer didn't ask for it
                  - Provides org.gradle.jvm.environment 'android' but the consumer didn't ask for it
                  - Provides org.gradle.usage 'java-runtime' but the consumer didn't ask for it
                  - Provides org.jetbrains.kotlin.platform.type 'androidJvm' but the consumer didn't ask for it
        The following variants were also considered but didn't match the requested attributes:
          - Variant 'koverSetupDebug' capability JaCoCoExample:libModule:unspecified:
              - Incompatible because this component declares attribute 'kotlinx.kover.setup.name' with value 'debug' and the consumer needed attribute 'kotlinx.kover.setup.name' with value 'demoDebug'
          - Variant 'koverSetupRelease' capability JaCoCoExample:libModule:unspecified:
              - Incompatible because this component declares attribute 'kotlinx.kover.setup.name' with value 'release' and the consumer needed attribute 'kotlinx.kover.setup.name' with value 'demoDebug'

Expected behavior
Should generate merged html report

Reproducer
app module

plugins {
    id 'org.jetbrains.kotlinx.kover' version '0.7.0-Alpha'
}

flavorDimensions "version"
    productFlavors {
        demo {
            dimension "version"
        }
        full {
            dimension "version"
        }
    }

dependencies {
    kover project(":libModule")
}

libModule

plugins {
    id 'org.jetbrains.kotlinx.kover' version '0.7.0-Alpha'
}

Environment

  • Kover Gradle Plugin version: 0.7.0-Alpha
  • Gradle version: gradle-7.5
  • Kotlin project type: Kotlin/Android
  • Coverage Engine version (if customized in build script): DefaultJacocoEngine
  • Other context important for this bug: -
@IlyaPavlik IlyaPavlik added Bug Bug issue type S: untriaged Status: issue reported but unprocessed labels Mar 3, 2023
@wezley98
Copy link

wezley98 commented Mar 3, 2023

We are also seeing this for our project in 0.7.0-Alpha, Most of modules just use debug and release but one module has productFlavours for uat,staging,prod

This one module :config with flavours can't be merged with the others modules.

I've also tried missingDimensionStrategy("environment", listOf("uat", "staging", "prod")) in the module where we are setting up kover dependencies but still get the following error:

Could not resolve all task dependencies for configuration ':kover:koverAggregatedSetupDebug'.
   > Could not resolve project :config.
     Required by:
         project :kover
      > The consumer was configured to find attribute 'kotlinx.kover.setup.name' with value 'debug'. However we cannot choose between the following variants of project :config:
          - prodDebugApiElements
          - prodDebugRuntimeElements
          - prodReleaseApiElements
          - prodReleaseRuntimeElements
          - stagingDebugApiElements
          - stagingDebugRuntimeElements
          - stagingReleaseApiElements
          - stagingReleaseRuntimeElements
          - uatDebugApiElements
          - uatDebugRuntimeElements
          - uatReleaseApiElements
          - uatReleaseRuntimeElements

@shanshin shanshin added S: confirmed Status: bug is reproduced or present and removed S: untriaged Status: issue reported but unprocessed labels Mar 3, 2023
@shanshin
Copy link
Collaborator

shanshin commented Mar 3, 2023

Hi,
unfortunately, the alpha version supports only multi-module projects that have completely identical build variants.

@wezley98
Copy link

wezley98 commented Mar 3, 2023

@shanshin That's fine, will this be a future feature?

@shanshin
Copy link
Collaborator

shanshin commented Mar 3, 2023

I think it will be possible to implement this.

Now we are collecting feedback and the most common use cases.

@shanshin shanshin added S: in progress Status: implementing or design in process and removed S: confirmed Status: bug is reproduced or present labels Apr 11, 2023
@shanshin
Copy link
Collaborator

Fixed in 0.7.0-Beta
Please note that the DSL has been modified compared to Alpha version.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Bug issue type S: in progress Status: implementing or design in process
Projects
None yet
Development

No branches or pull requests

3 participants