MarathonLabs / marathon

Cross-platform test runner
https://docs.marathonlabs.io
GNU General Public License v2.0
579 stars 121 forks source link

Gradle plugin error with gradle 8.0 (including workaround) #827

Open simonpoole opened 1 year ago

simonpoole commented 1 year ago

Describe the bug With gradle 8.0 the task (marathon*AndroidTestGenerateMarathonfile) that generates the marathon file will fail.

Marathon version 0.8.4, AGP 8.1

To Reproduce Upgrade to gradle 8.0

Expected behavior I believe Gradle 8.0 isn't supported yet so no expectation that the plugin would work :-)

Logs and reports

> Task :marathonCurrentDebugAndroidTestGenerateMarathonfile FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':marathonCurrentDebugAndroidTestGenerateMarathonfile'.
> Cannot access input property 'sdk' of task ':marathonCurrentDebugAndroidTestGenerateMarathonfile'. Accessing unreadable inputs or outputs is not supported. Declare the task as untracked by using Task.doNotTrackState(). See https://docs.gradle.org/8.0/userguide/incremental_build.html#disable-state-tracking for more details.

Devices (please complete the following information): Not relevant

Additional context

A workaround is to add

afterEvaluate{
   tasks.named('marathonCurrentDebugAndroidTestGenerateMarathonfile') { 
        doNotTrackState('Gradle 8 compatibility hack') 
    }
}

to the build script, replace the task name with the one from your configuration.

Note: outside of this issue, things seem to work just fine on both Linux and WIndows systems.

Malinskiy commented 1 year ago

Thanks for raising this,

I'll work on a fix and add another test case for this here https://github.com/MarathonLabs/marathon/blob/develop/marathon-gradle-plugin/src/test/kotlin/com/malinskiy/marathon/gradle/task/CachingTest.kt#L16

No promises on when it's going to be released though, for now, anyone with this issue should use provided workaround.

Sidenote: I sincerely hope that a fix for this issue will not break existing v7 setups

simonpoole commented 1 year ago

Because of googles minimum SKD/API requirements for the play store essentially all maintained Android apps are going to migrate to AGP 8.1 and as a consequence gradle 8, so v7 is likely going away in any case as a mainstream version.