ndtp / android-testify

Add screenshots to your Android tests
Other
99 stars 5 forks source link

ISSUE-79: Support Gradle Configuration Cache #198

Closed DanielJette closed 1 month ago

DanielJette commented 6 months ago

What does this change accomplish?

Fixes #79

How have you achieved it?

The Testify Gradle Plugin now supports Gradle Configuration Cache.

This required two main changes:

  1. Mark variables calculated that use project values as @Input values and defer their initialization until the tasks are registered. This is required since the Project can not be accessed directly during configuration.
  2. Defer initialization and usage of the ADB commands until task execution. Previously we would initialize ADB when the tasks were registered and this would cause an execution of adb devices to initialize the target list. This has been deferred until the task is actually executed.

Also, added new tests using the Gradle TestKit

Scope of Impact and Testing instructions

Use --configuration-cache with your gradle command to enable the Configuration Cache. Run the command multiple times to confirm that the cache is correctly used for subsequent calls.

You can run rm -rf .gradle/configuration-cache/ to clear the cache and start fresh.

$> ./gradlew FlixSample:testifyVersion --configuration-cache

  Configuration cache is an incubating feature.
  Calculating task graph as no configuration cache is available for tasks: FlixSample:testifyVersion

  > Task :FlixSample:testifyVersion

  ------------------------------------------------------------
  Displays the Testify plugin version
  ------------------------------------------------------------

    Vendor               = ndtp
    Title                = Testify
    Version              = local

  0 problems were found storing the configuration cache.

  BUILD SUCCESSFUL in 915ms
  1 actionable task: 1 executed
  Configuration cache entry stored.

$> ./gradlew FlixSample:testifyVersion --configuration-cache

  Configuration cache is an incubating feature.
  Reusing configuration cache.

  > Task :FlixSample:testifyVersion

  ------------------------------------------------------------
  Displays the Testify plugin version
  ------------------------------------------------------------

    Vendor               = ndtp
    Title                = Testify
    Version              = local

  BUILD SUCCESSFUL in 424ms
  1 actionable task: 1 executed
  Configuration cache entry reused.

Notice

[!WARNING] This change must keep main in a shippable state; it may be shipped without further notice.

AndroidTestifyBot commented 6 months ago

:white_check_mark: Success! - Legacy Sample screenshot test results

View build for commit bfe8c9128d2f4238951e6578fdec755124fe6ef8
AndroidTestifyBot commented 6 months ago

:white_check_mark: Success! - Flix Sample screenshot test results

View build for commit bfe8c9128d2f4238951e6578fdec755124fe6ef8
AndroidTestifyBot commented 6 months ago

:white_check_mark: Success! - Flix Library screenshot test results

View build for commit bfe8c9128d2f4238951e6578fdec755124fe6ef8