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

Jacoco Report Aggregation Plugin creates dependency on included build test tasks #24303

Open
muellerml opened this issue Mar 13, 2023 · 3 comments
Labels
a:bug has:reproducer Indicates the issue has a confirmed reproducer in:composite-builds including BuildIdentifier in:jacoco-plugin in:java-plugins java-library, java, java-base, java-platform, java-test-fixtures

Comments

@muellerml
Copy link

muellerml commented Mar 13, 2023

Expected Behavior

I would expect a behavior that is intuitively the same as the behavior observed on other task types and as described in the documentation ("As well as consuming outputs via project dependencies, a composite build can directly declare task dependencies on included builds. "). This means the test tasks of an included build are explicitly referenced to be considered by the plugin.

Current Behavior

When executing the test task on the main project, test tasks of an included build are not executed, only if an explicit task dependency is declared. For the Jacoco Reports Aggreation this behavior diverges from the behavior of test tasks, which leads to the case that if both tasks are executed sequentially (e.g. in a CI/CD pipeline) the execution of the Jacoco Reports Aggreation task leads to further executions of the test tasks of an included build.

Context

Included builds tasks of type Test are not executed when the test task of the main project is executed. This behavior seems to change as soon as the Jacoco Report Aggregation is applied.

Steps to Reproduce:

https://github.com/muellerml/jacoco-report-aggregation-bug-reproducer

Excecuting test task leads to following tasks being executed:

> Task :compileKotlin NO-SOURCE
> Task :project2:dependency:compileKotlin NO-SOURCE
> Task :project2:dependency:compileJava NO-SOURCE
> Task :compileJava NO-SOURCE
> Task :processResources NO-SOURCE
> Task :project2:dependency:processResources NO-SOURCE
> Task :classes UP-TO-DATE
> Task :project2:dependency:classes UP-TO-DATE
> Task :project2:dependency:jar UP-TO-DATE
> Task :jar UP-TO-DATE
> Task :inspectClassesForKotlinIC UP-TO-DATE
> Task :project2:dependency:inspectClassesForKotlinIC UP-TO-DATE
> Task :compileTestKotlin NO-SOURCE
> Task :compileTestJava NO-SOURCE
> Task :processTestResources NO-SOURCE
> Task :testClasses UP-TO-DATE
> Task :test NO-SOURCE
> Task :application:compileKotlin NO-SOURCE
> Task :application:compileJava NO-SOURCE
> Task :application:processResources NO-SOURCE
> Task :application:classes UP-TO-DATE
> Task :application:jar UP-TO-DATE
> Task :application:inspectClassesForKotlinIC UP-TO-DATE
> Task :application:compileTestKotlin NO-SOURCE
> Task :application:compileTestJava NO-SOURCE
> Task :application:processTestResources NO-SOURCE
> Task :application:testClasses UP-TO-DATE
> Task :application:test NO-SOURCE
> Task :boot:compileKotlin UP-TO-DATE
> Task :boot:compileJava NO-SOURCE
> Task :boot:processResources NO-SOURCE
> Task :boot:classes UP-TO-DATE
> Task :boot:jar UP-TO-DATE
> Task :boot:inspectClassesForKotlinIC UP-TO-DATE
> Task :boot:compileTestKotlin UP-TO-DATE
> Task :boot:compileTestJava NO-SOURCE
> Task :boot:processTestResources NO-SOURCE
> Task :boot:testClasses UP-TO-DATE
> Task :boot:test

Executing testCodeCoverageReport leads to following tasks being executed (where the execution of task project2:dependency:test is unexpected from my point of view):

> Task :project2:dependency:compileKotlin NO-SOURCE
> Task :compileKotlin NO-SOURCE
> Task :project2:dependency:compileJava NO-SOURCE
> Task :compileJava NO-SOURCE
> Task :project2:dependency:processResources NO-SOURCE
> Task :processResources NO-SOURCE
> Task :project2:dependency:classes UP-TO-DATE
> Task :classes UP-TO-DATE
> Task :jar
> Task :project2:dependency:jar
> Task :project2:dependency:inspectClassesForKotlinIC
> Task :inspectClassesForKotlinIC
> Task :compileTestKotlin NO-SOURCE
> Task :compileTestJava NO-SOURCE
> Task :processTestResources NO-SOURCE
> Task :testClasses UP-TO-DATE
> Task :test NO-SOURCE
> Task :application:compileKotlin NO-SOURCE
> Task :application:compileJava NO-SOURCE
> Task :application:processResources NO-SOURCE
> Task :application:classes UP-TO-DATE
> Task :application:jar
> Task :application:inspectClassesForKotlinIC
> Task :application:compileTestKotlin NO-SOURCE
> Task :application:compileTestJava NO-SOURCE
> Task :application:processTestResources NO-SOURCE
> Task :application:testClasses UP-TO-DATE
> Task :application:test NO-SOURCE
> Task :project2:dependency:processTestResources NO-SOURCE
> Task :boot:processResources NO-SOURCE
> Task :boot:processTestResources NO-SOURCE
> Task :boot:compileKotlin
> Task :boot:compileJava NO-SOURCE
> Task :boot:classes UP-TO-DATE
> Task :project2:dependency:compileTestKotlin
> Task :project2:dependency:compileTestJava NO-SOURCE
> Task :project2:dependency:testClasses UP-TO-DATE
> Task :boot:jar
> Task :boot:inspectClassesForKotlinIC
> Task :boot:compileTestKotlin
> Task :boot:compileTestJava NO-SOURCE
> Task :boot:testClasses UP-TO-DATE
> Task :project2:dependency:test
> Task :boot:test
> Task :testCodeCoverageReport
@ov7a
Copy link
Member

ov7a commented Mar 17, 2023

Sorry that you're having trouble with Gradle!

Your issue lacks information about how to reproduce the problem you're having. A minimal reproducible example can really help us track down and fix your problem. We may also be able to suggest workarounds or ways to avoid the problem if we can reproduce it.

We request you to provide a reproducer because we need to be sure we are looking at the exact problem you are facing.

The ideal way to provide a reproducer is to leverage our reproducer template.

This issue will be closed after 7 days unless you can provide more information.

@ov7a ov7a added the pending:reproducer Indicates that the issue requires a reproducer or will be closed after 7 days label Mar 17, 2023
@muellerml
Copy link
Author

Added an example reproducer to the initial issue description

@github-actions github-actions bot removed the pending:reproducer Indicates that the issue requires a reproducer or will be closed after 7 days label Mar 18, 2023
@ov7a ov7a added in:composite-builds including BuildIdentifier in:jacoco-plugin in:java-plugins java-library, java, java-base, java-platform, java-test-fixtures has:reproducer Indicates the issue has a confirmed reproducer and removed to-triage labels Mar 20, 2023
@ov7a
Copy link
Member

ov7a commented Mar 20, 2023

Thank you for providing a valid reproducer.

The issue is in the backlog of the relevant team but this area of Gradle is currently not a focus one so it might take a while before a fix is made.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
a:bug has:reproducer Indicates the issue has a confirmed reproducer in:composite-builds including BuildIdentifier in:jacoco-plugin in:java-plugins java-library, java, java-base, java-platform, java-test-fixtures
Projects
None yet
Development

No branches or pull requests

2 participants