Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Add annotations for compatibility with Gradle 7.0 #283

Closed
wants to merge 1 commit into from

Conversation

lwasyl
Copy link
Contributor

@lwasyl lwasyl commented Apr 11, 2021

(This PR won't compile until #282 or similar is merged)

Gradle 7.0 verifies that all the task properties are either inputs or outputs (https://docs.gradle.org/current/userguide/upgrading_version_6.html#task_validation_problems_are_now_errors). From looking at the plugin code I figured all the properties are inputs, although I'm not certain this is 100% correct. For example from what I see variant: TestVariant is actually both an input and output, depending on the task, but since the property is declared on the base class it's not a straightforward change to have this accurately annotated.

I decided to just add @Input annotations everywhere because this will at least make the plugin work again. However, it's only because no task declares outputs, and so up-to-date checks are off. This is desired behavior, because Android's connected check tasks are never up-to-date themselves, so screenshot tasks never being up-to-date makes sense too. But please note this would have to be explicitly declared (e.g. with outputs.upToDateWhen { false } or by linking the up-to-date check to connected test task) if any task has an @Output declared in the future.

I verified the fix with ./gradlew validatePlugins task and by running record and verify tasks on my own project with a locally published snapshot (sample doesn't seem to work with Gradle 7 either).

Fixes #281

@jgavris
Copy link

jgavris commented Apr 20, 2021

@xiphirx could we get this one too to complement #282 ?

@facebook-github-bot
Copy link

@xiphirx has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.

@facebook-github-bot
Copy link

@xiphirx merged this pull request in 081522d.

@lwasyl lwasyl deleted the inputs branch May 5, 2021 17:12
technoir42 pushed a commit to badoo/screenshot-tests-for-android that referenced this pull request Nov 1, 2021
Summary:
(This PR won't compile until facebook#282 or similar is merged)

Gradle 7.0 verifies that all the task properties are either inputs or outputs (https://docs.gradle.org/current/userguide/upgrading_version_6.html#task_validation_problems_are_now_errors). From looking at the plugin code I figured all the properties are inputs, although I'm not certain this is 100% correct. For example from what I see `variant: TestVariant` is actually both an input and output, depending on the task, but since the property is declared on the base class it's not a straightforward change to have this accurately annotated.

I decided to just add `Input` annotations everywhere because this will at least make the plugin work again. However, it's only because no task declares outputs, and so up-to-date checks are off. This is desired behavior, because Android's connected check tasks are never up-to-date themselves, so screenshot tasks never being up-to-date makes sense too. But please note this would have to be explicitly declared (e.g. with `outputs.upToDateWhen { false }` or by linking the up-to-date check to connected test task) if any task has an `Output` declared in the future.

I verified the fix with `./gradlew validatePlugins` task and by running `record` and `verify` tasks on my own project with a locally published snapshot (sample doesn't seem to work with Gradle 7 either).

Fixes facebook#281

Pull Request resolved: facebook#283

Reviewed By: sjkirby

Differential Revision: D27873668

Pulled By: xiphirx

fbshipit-source-id: 783de2ef0e00ce92672921a12a74087a32685e6a
# for free to join this conversation on GitHub. Already have an account? # to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Plugin is not compatible with Gradle 7
3 participants