facebook / screenshot-tests-for-android

Generate fast deterministic screenshots during Android instrumentation tests
http://facebook.github.io/screenshot-tests-for-android
Apache License 2.0
1.74k stars 229 forks source link

Recording screenshots fails with configuration cache enabled #286

Open lwasyl opened 3 years ago

lwasyl commented 3 years ago

steps to reproduce: Try to record screenshots with Gradle 7.1 and configuration cache enabled, e.g. ./gradlew views:record -Dorg.gradle.unsafe.configuration-cache=true

Expected result: screenshots are recorded Actual result: build fails with the errors below

481 problems were found storing the configuration cache, 14 of which seem unique.
- Task `:views:cleanDebugAndroidTestScreenshots` of type `com.facebook.testing.screenshot.build.CleanScreenshotsTask`: cannot serialize object of type 'org.gradle.api.internal.artifacts.configurations.DefaultConfiguration', a subtype of 'org.gradle.api.artifacts.Configuration', as these are not supported with the configuration cache.
  See https://docs.gradle.org/7.1/userguide/configuration_cache.html#config_cache:requirements:disallowed_types
- Task `:views:cleanDebugAndroidTestScreenshots` of type `com.facebook.testing.screenshot.build.CleanScreenshotsTask`: cannot serialize object of type 'org.gradle.api.internal.project.DefaultProject', a subtype of 'org.gradle.api.Project', as these are not supported with the configuration cache.
  See https://docs.gradle.org/7.1/userguide/configuration_cache.html#config_cache:requirements:disallowed_types
- Task `:views:cleanDebugAndroidTestScreenshots` of type `com.facebook.testing.screenshot.build.CleanScreenshotsTask`: value 'flatmap(provider(class com.android.build.gradle.internal.SdkComponentsBuildService))' failed to unpack provider
- Task `:views:cleanDebugAndroidTestScreenshots` of type `com.facebook.testing.screenshot.build.CleanScreenshotsTask`: cannot serialize object of type 'com.android.build.gradle.internal.profile.AnalyticsConfiguratorService', a subtype of 'org.gradle.api.services.BuildService', as these are not supported with the configuration cache.
  See https://docs.gradle.org/7.1/userguide/configuration_cache.html#config_cache:requirements:disallowed_types
- Task `:views:cleanDebugAndroidTestScreenshots` of type `com.facebook.testing.screenshot.build.CleanScreenshotsTask`: cannot serialize object of type 'org.gradle.api.internal.artifacts.configurations.DefaultConfigurationContainer', a subtype of 'org.gradle.api.artifacts.ConfigurationContainer', as these are not supported with the configuration cache.
  See https://docs.gradle.org/7.1/userguide/configuration_cache.html#config_cache:requirements:disallowed_types
- Task `:views:connectedDisableAnimations` of type `org.gradle.api.DefaultTask`: cannot serialize object of type 'java.io.FileDescriptor', a subtype of 'java.io.FileDescriptor', as these are not supported with the configuration cache.
  See https://docs.gradle.org/7.1/userguide/configuration_cache.html#config_cache:requirements:disallowed_types
- Task `:views:connectedDisableAnimations` of type `org.gradle.api.DefaultTask`: value '/127.0.0.1:54615' failed Java Object Serialization
  See https://docs.gradle.org/7.1/userguide/configuration_cache.html#config_cache:not_yet_implemented:java_serialization
- Task `:views:connectedDisableAnimations` of type `org.gradle.api.DefaultTask`: value '/127.0.0.1:5037' failed Java Object Serialization
  See https://docs.gradle.org/7.1/userguide/configuration_cache.html#config_cache:not_yet_implemented:java_serialization
- Task `:views:connectedDisableAnimations` of type `org.gradle.api.DefaultTask`: cannot serialize object of type 'sun.nio.ch.SocketAdaptor', a subtype of 'java.net.Socket', as these are not supported with the configuration cache.
  See https://docs.gradle.org/7.1/userguide/configuration_cache.html#config_cache:requirements:disallowed_types
- Task `:views:connectedDisableAnimations` of type `org.gradle.api.DefaultTask`: value '/127.0.0.1:54614' failed Java Object Serialization
  See https://docs.gradle.org/7.1/userguide/configuration_cache.html#config_cache:not_yet_implemented:java_serialization
- Task `:views:connectedDisableAnimations` of type `org.gradle.api.DefaultTask`: value 'localhost/127.0.0.1:8599' failed Java Object Serialization
  See https://docs.gradle.org/7.1/userguide/configuration_cache.html#config_cache:not_yet_implemented:java_serialization
- Task `:views:connectedDisableAnimations` of type `org.gradle.api.DefaultTask`: cannot serialize object of type 'sun.nio.ch.ServerSocketAdaptor', a subtype of 'java.net.ServerSocket', as these are not supported with the configuration cache.
  See https://docs.gradle.org/7.1/userguide/configuration_cache.html#config_cache:requirements:disallowed_types
- Task `:views:connectedDisableAnimations` of type `org.gradle.api.DefaultTask`: cannot serialize object of type 'java.lang.Thread', a subtype of 'java.lang.Thread', as these are not supported with the configuration cache.
  See https://docs.gradle.org/7.1/userguide/configuration_cache.html#config_cache:requirements:disallowed_types
- Task `:views:connectedDisableAnimations` of type `org.gradle.api.DefaultTask`: cannot serialize object of type 'org.gradle.api.internal.project.DefaultProject', a subtype of 'org.gradle.api.Project', as these are not supported with the configuration cache.
  See https://docs.gradle.org/7.1/userguide/configuration_cache.html#config_cache:requirements:disallowed_types

FAILURE: Build failed with an exception.

* What went wrong:
Configuration cache state could not be cached: field 'variant' from type 'com.facebook.testing.screenshot.build.CleanScreenshotsTask': error writing value of type 'com.android.build.gradle.internal.api.TestVariantImpl'
> Configuration cache state could not be cached: field 'testedVariantData' from type 'com.android.build.gradle.internal.api.TestVariantImpl': error writing value of type 'com.android.build.gradle.internal.api.LibraryVariantImpl'
   > Configuration cache state could not be cached: field 'unitTestVariant' from type 'com.android.build.gradle.internal.api.LibraryVariantImpl': error writing value of type 'com.android.build.gradle.internal.api.UnitTestVariantImpl'
      > Configuration cache state could not be cached: field 'variantData' from type 'com.android.build.gradle.internal.api.UnitTestVariantImpl': error writing value of type 'com.android.build.gradle.internal.variant.TestVariantData'
         > Configuration cache state could not be cached: field 'testedVariantData' from type 'com.android.build.gradle.internal.variant.TestVariantData': error writing value of type 'com.android.build.gradle.internal.variant.LibraryVariantData'
            > Configuration cache state could not be cached: field 'globalScope' from type 'com.android.build.gradle.internal.variant.LibraryVariantData': error writing value of type 'com.android.build.gradle.internal.scope.GlobalScope'
               > Configuration cache state could not be cached: field 'avdComponents' from type 'com.android.build.gradle.internal.scope.GlobalScope': error writing value of type 'org.gradle.api.services.internal.BuildServiceProvider'
                  > Configuration cache state could not be cached: field '__versionedSdkLoader__' from type 'com.android.build.gradle.internal.AvdComponentsBuildService$Parameters': error writing value of type 'org.gradle.api.internal.provider.DefaultProperty'
                     > Configuration cache state could not be cached: field 'provider' from type 'org.gradle.api.internal.provider.MappingProvider': error writing value of type 'org.gradle.api.internal.provider.TransformBackedProvider'
                        > Configuration cache state could not be cached: field 'transformer' from type 'org.gradle.api.internal.provider.TransformBackedProvider': error writing value of type 'com.android.build.gradle.internal.plugins.BasePlugin$$Lambda$1213/0x0000000800b8dc40'
                           > Configuration cache state could not be cached: field 'arg$1' from type 'com.android.build.gradle.internal.plugins.BasePlugin$$Lambda$1213/0x0000000800b8dc40': error writing value of type 'com.android.build.gradle.internal.plugins.AppPlugin'
                              > Configuration cache state could not be cached: field 'extension' from type 'com.android.build.gradle.internal.plugins.AppPlugin': error writing value of type 'com.android.build.gradle.internal.dsl.BaseAppModuleExtension'
                                 > Configuration cache state could not be cached: field 'publicExtensionImpl' from type 'com.android.build.gradle.internal.dsl.BaseAppModuleExtension': error writing value of type 'com.android.build.gradle.internal.dsl.ApplicationExtensionImpl'
                                    > Configuration cache state could not be cached: field 'buildTypes' from type 'com.android.build.gradle.internal.dsl.ApplicationExtensionImpl': error writing value of type 'org.gradle.api.internal.FactoryNamedDomainObjectContainer'
                                       > Configuration cache state could not be cached: field 'eventRegister' from type 'org.gradle.api.internal.FactoryNamedDomainObjectContainer': error writing value of type 'org.gradle.api.internal.collections.DefaultCollectionEventRegister'
                                          > Configuration cache state could not be cached: field 'addActions' from type 'org.gradle.api.internal.collections.DefaultCollectionEventRegister': error writing value of type 'org.gradle.internal.ImmutableActionSet$SetWithFewActions'
                                             > Configuration cache state could not be cached: field 'actions' from type 'org.gradle.internal.ImmutableActionSet$SetWithFewActions': error writing value of type '[Lorg.gradle.api.Action;'
                                                > Configuration cache state could not be cached: field 'delegate' from type 'org.gradle.api.internal.DefaultCollectionCallbackActionDecorator$BuildOperationEmittingAction': error writing value of type 'org.gradle.configuration.internal.DefaultUserCodeApplicationContext$CurrentApplication$1'
                                                   > Configuration cache state could not be cached: field 'val$action' from type 'org.gradle.configuration.internal.DefaultUserCodeApplicationContext$CurrentApplication$1': error writing value of type 'com.android.build.gradle.internal.variant.LegacyVariantInputManager$sam$org_gradle_api_Action$0'
                                                      > Configuration cache state could not be cached: field 'function' from type 'com.android.build.gradle.internal.variant.LegacyVariantInputManager$sam$org_gradle_api_Action$0': error writing value of type 'com.android.build.gradle.internal.variant.LegacyVariantInputManager$3'
                                                         > Configuration cache state could not be cached: field 'receiver' from type 'com.android.build.gradle.internal.variant.LegacyVariantInputManager$3': error writing value of type 'com.android.build.gradle.internal.variant.LegacyVariantInputManager'
                                                            > Configuration cache state could not be cached: field 'sourceSetManager' from type 'com.android.build.gradle.internal.variant.LegacyVariantInputManager': error writing value of type 'com.android.build.gradle.internal.dependency.SourceSetManager'
                                                               > Configuration cache state could not be cached: field 'sourceSetsContainer' from type 'com.android.build.gradle.internal.dependency.SourceSetManager': error writing value of type 'org.gradle.api.internal.FactoryNamedDomainObjectContainer'
                                                                  > Configuration cache state could not be cached: field 'eventRegister' from type 'org.gradle.api.internal.FactoryNamedDomainObjectContainer': error writing value of type 'org.gradle.api.internal.collections.DefaultCollectionEventRegister'
                                                                     > Configuration cache state could not be cached: field 'addActions' from type 'org.gradle.api.internal.collections.DefaultCollectionEventRegister': error writing value of type 'org.gradle.internal.ImmutableActionSet$SetWithFewActions'
                                                                        > Configuration cache state could not be cached: field 'actions' from type 'org.gradle.internal.ImmutableActionSet$SetWithFewActions': error writing value of type '[Lorg.gradle.api.Action;'
                                                                           > Configuration cache state could not be cached: field 'delegate' from type 'org.gradle.api.internal.DefaultCollectionCallbackActionDecorator$BuildOperationEmittingAction': error writing value of type 'org.gradle.configuration.internal.DefaultUserCodeApplicationContext$CurrentApplication$1'
                                                                              > Configuration cache state could not be cached: field 'val$action' from type 'org.gradle.configuration.internal.DefaultUserCodeApplicationContext$CurrentApplication$1': error writing value of type 'org.jetbrains.kotlin.gradle.plugin.mpp.SyncKotlinAndAndroidSourceSetsKt$syncKotlinAndAndroidSourceSets$1'
                                                                                 > Configuration cache state could not be cached: field '$target' from type 'org.jetbrains.kotlin.gradle.plugin.mpp.SyncKotlinAndAndroidSourceSetsKt$syncKotlinAndAndroidSourceSets$1': error writing value of type 'org.jetbrains.kotlin.gradle.plugin.mpp.KotlinAndroidTarget'
                                                                                    > Configuration cache state could not be cached: field 'compilations' from type 'org.jetbrains.kotlin.gradle.plugin.mpp.KotlinAndroidTarget': error writing value of type 'org.gradle.api.internal.FactoryNamedDomainObjectContainer'
                                                                                       > Configuration cache state could not be cached: field 'index' from type 'org.gradle.api.internal.FactoryNamedDomainObjectContainer': error writing value of type 'org.gradle.api.internal.DefaultNamedDomainObjectCollection$UnfilteredIndex'
                                                                                          > Configuration cache state could not be cached: field 'map' from type 'org.gradle.api.internal.DefaultNamedDomainObjectCollection$UnfilteredIndex': error writing value of type 'java.util.TreeMap'
                                                                                             > Configuration cache state could not be cached: field 'androidVariant' from type 'org.jetbrains.kotlin.gradle.plugin.mpp.KotlinJvmAndroidCompilation': error writing value of type 'com.android.build.gradle.internal.api.ApplicationVariantImpl'
                                                                                                > Configuration cache state could not be cached: field 'testVariant' from type 'com.android.build.gradle.internal.api.ApplicationVariantImpl': error writing value of type 'com.android.build.gradle.internal.api.TestVariantImpl'
                                                                                                   > Configuration cache state could not be cached: field 'variantData' from type 'com.android.build.gradle.internal.api.TestVariantImpl': error writing value of type 'com.android.build.gradle.internal.variant.TestVariantData'
                                                                                                      > Configuration cache state could not be cached: field 'testedVariantData' from type 'com.android.build.gradle.internal.variant.TestVariantData': error writing value of type 'com.android.build.gradle.internal.variant.ApplicationVariantData'
                                                                                                         > Configuration cache state could not be cached: field 'artifacts' from type 'com.android.build.gradle.internal.variant.ApplicationVariantData': error writing value of type 'com.android.build.api.artifact.impl.ArtifactsImpl'
                                                                                                            > Configuration cache state could not be cached: field 'storageProvider' from type 'com.android.build.api.artifact.impl.ArtifactsImpl': error writing value of type 'com.android.build.api.artifact.impl.StorageProviderImpl'
                                                                                                               > Configuration cache state could not be cached: field 'directory' from type 'com.android.build.api.artifact.impl.StorageProviderImpl': error writing value of type 'com.android.build.api.artifact.impl.TypedStorageProvider'
                                                                                                                  > Configuration cache state could not be cached: field 'singleStorage' from type 'com.android.build.api.artifact.impl.TypedStorageProvider': error writing value of type 'java.util.LinkedHashMap'
                                                                                                                     > java.util.ConcurrentModificationException (no error message)