How to update jacocoTestReport.executionData property only if exec file is generated

Hello,
I have a gradle build with additional configuration added to run integration tests.
I want to include test coverage data generated while running integration tests into generated jacoco report. When I define it like this everything works:

jacocoTestReport {
// include integration test coverage in the Jacoco report
executionData “$buildDir/jacoco/integrationTest.exec”
}

The problem is if I don’t want to run integration tests the integrationTest.exec file is not generated and the build fails properly saying that the file is not found. How can I avoid this error and add update executionData property only if the file is generated ?

I tried to make it like this:

jacocoTestReport {
// include integration test coverage in the Jacoco report
if (file("$buildDir/jacoco/integrationTest.exec").exists()) {
executionData “$buildDir/jacoco/integrationTest.exec”
}
}

But, apparently this evaluation happens during configuration phase when the file does not exist yet. Hence, it is never included. Is it possible to perform this evaluation just before the jacocoTestReport task is about to get executed?

Thank you,
Sergei