Skip to content

Invocation of Task.project at execution time has been deprecated. #327

@syslogic

Description

@syslogic

When building with Gradle 9.0, there is a deprecation warning:

Task :ossLicensesTask
Invocation of Task.project at execution time has been deprecated. This will fail with an error in Gradle 10. This API is incompatible with the configuration cache, which will become the only mode supported by Gradle in a future release. Consult the upgrading guide for further information: https://docs.gradle.org/9.0.0/userguide/upgrading_version_7.html#task_project

Likely due to incompatibility with configuration cache enabled:
https://docs.gradle.org/9.0.0/userguide/configuration_cache_requirements.html#config_cache:requirements:use_project_during_execution

OssLicensesPlugin.groovy explains the problem: Without the list we cannot enumerate POM files during configuration., which raises the question, if the timing could be changed, or if these two tasks could be merged? It appearently stems from this one line:

it.dependenciesJson.set(dependencyTask.flatMap { it.dependenciesJson })

com.android.tools.build.libraries.metadata.AppDependencies should eventually be an @Input.

I'd assume, that the task should read protocol buffers, instead of that pregenerated JSON string input.

So when do these AGP protocol buffers even come into existence?


With version 0.10.8 now there'd further problems, besides the CleanUp task unable to locate these directories.
I'd still wonder why/if one needs that JSON as step in between, when one could as well do both with one task?

A problem was found with the configuration of task ':mobile:googleDebugOssDependencyTask' (type 'DependencyTask').
  - Gradle detected a problem with the following location: '\mobile\build\generated\third_party_licenses\googleDebug\dependencies.json'.
    
    Reason: Task ':mobile:googleDebugOssLicensesCleanUp' uses this output of task ':mobile:googleDebugOssDependencyTask' without declaring an explicit or implicit dependency. This can lead to incorrect results being produced, depending on what order the tasks are executed.
    
    Possible solutions:
      1. Declare task ':mobile:googleDebugOssDependencyTask' as an input of ':mobile:googleDebugOssLicensesCleanUp'.
      2. Declare an explicit dependency on ':mobile:googleDebugOssDependencyTask' from ':mobile:googleDebugOssLicensesCleanUp' using Task#dependsOn.
      3. Declare an explicit dependency on ':mobile:googleDebugOssDependencyTask' from ':mobile:googleDebugOssLicensesCleanUp' using Task#mustRunAfter.
    
    For more information, please refer to https://docs.gradle.org/9.0.0/userguide/validation_problems.html#implicit_dependency in the Gradle documentation.

* Try:
> Declare task ':mobile:googleDebugOssDependencyTask' as an input of ':mobile:googleDebugOssLicensesCleanUp'
> Declare an explicit dependency on ':mobile:googleDebugOssDependencyTask' from ':mobile:googleDebugOssLicensesCleanUp' using Task#dependsOn
> Declare an explicit dependency on ':mobile:googleDebugOssDependencyTask' from ':mobile:googleDebugOssLicensesCleanUp' using Task#mustRunAfter

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions