dependency-analysis-gradle-plugin icon indicating copy to clipboard operation
dependency-analysis-gradle-plugin copied to clipboard

Gradle deprecation warning: Antlr plugin

Open boris-petrov opened this issue 3 years ago • 13 comments
trafficstars

Plugin version 1.4.0

Gradle version 7.4.2

Describe the bug Running buildHealth on my project leads to the following deprecation warning in the explodeCodeSourceMain and explodeCodeSourceTest tasks:

> Task :subproj:explodeCodeSourceMain
Execution optimizations have been disabled for task ':subproj:explodeCodeSourceMain' to ensure correctness due to the following reasons:
  - Gradle detected a problem with the following location: '/home/project/subproj/build/generated-src/antlr/main'. Reason: Task ':subproj:explodeCodeSourceMain' uses this output of task ':subproj:generateGrammarSource' without declaring an explicit or implicit dependency. This can lead to incorrect results being produced, depending on what order the tasks are executed. Please refer to https://docs.gradle.org/7.4.2/userguide/validation_problems.html#implicit_dependency for more details about this problem.
Gradle detected a problem with the following location: '/home/project/subproj/build/generated-src/antlr/main'. Reason: Task ':subproj:explodeCodeSourceMain' uses this output of task ':subproj:generateGrammarSource' without declaring an explicit or implicit dependency. This can lead to incorrect results being produced, depending on what order the tasks are executed. Please refer to https://docs.gradle.org/7.4.2/userguide/validation_problems.html#implicit_dependency for more details about this problem. This behaviour has been deprecated and is scheduled to be removed in Gradle 8.0. Execution optimizations are disabled to ensure correctness. See https://docs.gradle.org/7.4.2/userguide/more_about_tasks.html#sec:up_to_date_checks for more details.

To Reproduce I guess the issue is because I'm using the antlr built-in Gradle plugin:

plugins {
	id 'antlr'
}

It should be simple enough to reproduce the issue by just adding the plugin to the build-script. If you have troubles reproducing, I'll try creating a repo.

Expected behavior No deprecation warning

boris-petrov avatar May 30 '22 08:05 boris-petrov

Thanks for the issue.

autonomousapps avatar May 30 '22 17:05 autonomousapps

I just saw a new one (using Gradle 7.5.1):

> Task :subproj:explodeJarMain
Build service 'inMemoryCache' is being used by task ':subproj:explodeJarMain' without the corresponding declaration via 'Task#usesService'. This will fail with an error in Gradle 8.0. Declare the association between the task and the build service using 'Task#usesService'. Consult the upgrading guide for further information: https://docs.gradle.org/7.5.1/userguide/upgrading_version_7.html#undeclared_build_service_usage

I see a similar one for findInlineMembers and findDeclaredProcs.

boris-petrov avatar Sep 27 '22 12:09 boris-petrov

I just saw a new one (using Gradle 7.5.1):

> Task :subproj:explodeJarMain
Build service 'inMemoryCache' is being used by task ':subproj:explodeJarMain' without the corresponding declaration via 'Task#usesService'. This will fail with an error in Gradle 8.0. Declare the association between the task and the build service using 'Task#usesService'. Consult the upgrading guide for further information: https://docs.gradle.org/7.5.1/userguide/upgrading_version_7.html#undeclared_build_service_usage

I see a similar one for findInlineMembers and findDeclaredProcs.

Could you file this as a separate issue, please?

autonomousapps avatar Sep 27 '22 18:09 autonomousapps

Sure, here you go. :)

boris-petrov avatar Sep 28 '22 04:09 boris-petrov

A workaround for this:

// Workaround for https://github.com/gradle/gradle/issues/25885
// Technically it should be `explodeCodeSourceMain dependsOn generateGrammarSource` and
// `explodeCodeSourceTest dependsOn generateTestGrammarSource`, but this module is so
// small it isn't worth fine-tuning it.
tasks.withType(com.autonomousapps.tasks.CodeSourceExploderTask) {
  dependsOn('generateGrammarSource', 'generateTestGrammarSource')
}

autonomousapps avatar Jul 25 '23 18:07 autonomousapps