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

Gradle tasks are using outputs without declaring an explicit or implicit dependency #4739

Closed
romainbsl opened this issue Apr 30, 2024 · 3 comments · Fixed by #4784
Closed
Assignees
Labels
bug Something isn't working reproduced resources

Comments

@romainbsl
Copy link

romainbsl commented Apr 30, 2024

Describe the bug

Migrating from Kotlin 1.9.2x and Compose 1.6.0-alpha01 👉 Kotlin 2.0.0-RC2 + Compose Compiler + Compose Multiplatrform 1.6.10-beta03 and running ./gradlew check I get multiple errors about tasks that are using outputs from generateResourceAccessorsForAndroidUnitTest without declaring explicit dependency.

Example:

Reason: Task ':framework:compose:kodein-di-framework-compose:generateDebugLintReportModel' uses this output of task ':framework:compose:kodein-di-framework-compose:generateResourceAccessorsForAndroidUnitTest' without declaring an explicit or implicit dependency. This can lead to incorrect results being produced, depending on what order the tasks are executed.

Using the following workaround helps remove warnings:

tasks.withType<LintModelWriterTask> {
    dependsOn("generateResourceAccessorsForAndroidUnitTest")
}
tasks.withType<LintModelMetadataTask> {
    dependsOn("generateResourceAccessorsForAndroidUnitTest")
}
tasks.withType<AndroidLintAnalysisTask> {
    dependsOn("generateResourceAccessorsForAndroidUnitTest")
}

Affected platforms

  • Probably linked to how Compose Multiplatform handles resources with the Android target?

Versions

  • Kotlin version*: 2.0.0-RC2
  • Compose Multiplatform version*: 1.6.10-beta03

To Reproduce
Steps and/or the code snippet to reproduce the behavior:

  1. Go to Kodein's repo and clone kotlin-2 branch
  2. Comment lines from 28 to 33 include
  3. Run gradle task check
  4. See Gradle warning/error

Expected behavior

Not having to use workaround.

@romainbsl romainbsl added bug Something isn't working submitted labels Apr 30, 2024
@igordmn
Copy link
Collaborator

igordmn commented May 3, 2024

Reproduced with these steps:

  1. Go to Kodein's repo and clone kotlin-2 branch
  2. Comment lines from 28 to 33 include
  3. ./gradlew framework:compose:kodein-di-framework-compose:check
  4. See Gradle warning/error

After commenting the Compose plugin, it is successful:

plugins {
    kodein.library.mppWithAndroid
    alias(libs.plugins.compose.compiler)
    //alias(libs.plugins.compose)
}

kotlin.kodein {
    jsEnv()
    allComposeUi()

    common.mainDependencies {
        implementation("org.jetbrains.compose.runtime:runtime:1.6.10-beta03")
        api(projects.kodeinDi)
    }

    android {
        sources.mainDependencies {
            api(projects.framework.android.kodeinDiFrameworkAndroidX)
            implementation(libs.android.x.lifecycle.viewmodel.compose)
        }
    }
}

@terrakok
Copy link
Member

terrakok commented May 8, 2024

Google issue: https://issuetracker.google.com/issues/333831734

terrakok added a commit that referenced this issue May 8, 2024
We had a fix for the AGP lint tasks applied only for the old Compose
resources behavior (non multimodule). The PR applies the logic for both
cases.

AGP issue: https://issuetracker.google.com/issues/333831734

Fixes #4739

## Release Notes
### Fixes - Resources
- _(prerelease fix)_ Fix AGP lint tasks dependency issues
terrakok added a commit that referenced this issue May 8, 2024
We had a fix for the AGP lint tasks applied only for the old Compose
resources behavior (non multimodule). The PR applies the logic for both
cases.

AGP issue: https://issuetracker.google.com/issues/333831734

Fixes #4739

## Release Notes
### Fixes - Resources
- _(prerelease fix)_ Fix AGP lint tasks dependency issues

(cherry picked from commit 4cbc7a7)
@okushnikov
Copy link
Collaborator

Please check the following ticket on YouTrack for follow-ups to this issue. GitHub issues will be closed in the coming weeks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working reproduced resources
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants