Stylianos Gakis
11/07/2024, 12:19 AMcom.apollographql.apollo.gradle.api.ApolloExtension
in there../gradlew download[Service]ApolloSchemaFromIntrospection
I get a crash and the download does not happen.Stylianos Gakis
11/07/2024, 12:19 AMStylianos Gakis
11/07/2024, 12:19 AM42 problems were found storing the configuration cache, 8 of which seem unique.
- Task `:apollo-octopus-public:downloadOctopusApolloSchemaFromIntrospection` of type `com.apollographql.apollo.gradle.internal.ApolloDownloadSchemaTask`: 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/8.10.2/userguide/configuration_cache.html#config_cache:requirements:disallowed_types>
- Task `:apollo-octopus-public:downloadOctopusApolloSchemaFromIntrospection` of type `com.apollographql.apollo.gradle.internal.ApolloDownloadSchemaTask`: cannot serialize object of type 'org.gradle.groovy.scripts.internal.DefaultScriptCompilationHandler$ScriptClassLoader', a subtype of 'java.lang.ClassLoader', as these are not supported with the configuration cache.
See <https://docs.gradle.org/8.10.2/userguide/configuration_cache.html#config_cache:requirements:disallowed_types>
- Task `:apollo-octopus-public:downloadOctopusApolloSchemaFromIntrospection` of type `com.apollographql.apollo.gradle.internal.ApolloDownloadSchemaTask`: cannot serialize object of type 'org.gradle.initialization.MixInLegacyTypesClassLoader', a subtype of 'java.lang.ClassLoader', as these are not supported with the configuration cache.
See <https://docs.gradle.org/8.10.2/userguide/configuration_cache.html#config_cache:requirements:disallowed_types>
- Task `:apollo-octopus-public:downloadOctopusApolloSchemaFromIntrospection` of type `com.apollographql.apollo.gradle.internal.ApolloDownloadSchemaTask`: cannot serialize object of type 'org.gradle.internal.classloader.CachingClassLoader', a subtype of 'java.lang.ClassLoader', as these are not supported with the configuration cache.
See <https://docs.gradle.org/8.10.2/userguide/configuration_cache.html#config_cache:requirements:disallowed_types>
- Task `:apollo-octopus-public:downloadOctopusApolloSchemaFromIntrospection` of type `com.apollographql.apollo.gradle.internal.ApolloDownloadSchemaTask`: cannot serialize object of type 'org.gradle.internal.classloader.FilteringClassLoader', a subtype of 'java.lang.ClassLoader', as these are not supported with the configuration cache.
See <https://docs.gradle.org/8.10.2/userguide/configuration_cache.html#config_cache:requirements:disallowed_types>
- Task `:apollo-octopus-public:downloadOctopusApolloSchemaFromIntrospection` of type `com.apollographql.apollo.gradle.internal.ApolloDownloadSchemaTask`: cannot serialize object of type 'org.gradle.internal.classloader.VisitableURLClassLoader$InstrumentingVisitableURLClassLoader', a subtype of 'java.lang.ClassLoader', as these are not supported with the configuration cache.
See <https://docs.gradle.org/8.10.2/userguide/configuration_cache.html#config_cache:requirements:disallowed_types>
- Task `:apollo-octopus-public:downloadOctopusApolloSchemaFromIntrospection` of type `com.apollographql.apollo.gradle.internal.ApolloDownloadSchemaTask`: cannot serialize object of type 'org.gradle.internal.classloader.VisitableURLClassLoader', a subtype of 'java.lang.ClassLoader', as these are not supported with the configuration cache.
See <https://docs.gradle.org/8.10.2/userguide/configuration_cache.html#config_cache:requirements:disallowed_types>
- Task `:apollo-octopus-public:downloadOctopusApolloSchemaFromIntrospection` of type `com.apollographql.apollo.gradle.internal.ApolloDownloadSchemaTask`: cannot serialize object of type 'org.gradle.internal.event.AnonymousListenerBroadcast', a subtype of 'org.gradle.internal.event.ListenerBroadcast', as these are not supported with the configuration cache.
See <https://docs.gradle.org/8.10.2/userguide/configuration_cache.html#config_cache:requirements:disallowed_types>
Then the exception:
FAILURE: Build failed with an exception.
* What went wrong:
Configuration cache state could not be cached: field `external` of `com.autonomousapps.internal.artifacts.Publisher` bean found in field `storage` of `org.gradle.internal.extensibility.DefaultExtraPropertiesExtension` bean found in field `extension` of `org.gradle.internal.extensibility.ExtensionsStorage$ExtensionHolder` bean found in field `extensions` of `org.gradle.internal.extensibility.ExtensionsStorage` bean found in field `extensionsStorage` of `org.gradle.internal.extensibility.DefaultConvention` bean found in field `extensions` of `org.jetbrains.kotlin.gradle.dsl.DefaultToolchainSupport` bean found in field `this$0` of `org.jetbrains.kotlin.gradle.dsl.DefaultToolchainSupport$wireToolchainToTasks$1` bean found in field `val$action` of `org.gradle.api.internal.plugins.DefaultPluginContainer$2` bean found in field `this$1` of `org.gradle.api.internal.plugins.DefaultPluginContainer$2$1` bean found in field `val$spec` of `org.gradle.api.internal.DefaultCollectionCallbackActionDecorator$1` bean found in field `spec` of `org.gradle.api.internal.collections.CollectionFilter` bean found in field `this$0` of `org.gradle.api.internal.collections.CollectionFilter$1` bean found in field `multipleActions` of `org.gradle.internal.ImmutableActionSet$SetWithManyActions` bean found in field `addActions` of `org.gradle.api.internal.collections.DefaultCollectionEventRegister` bean found in field `eventRegister` of `org.gradle.api.internal.plugins.DefaultPluginContainer` bean found in field `this$0` of `org.gradle.api.internal.plugins.DefaultPluginContainer$2` bean found in field `val$action` of `org.gradle.internal.code.DefaultUserCodeApplicationContext$CurrentApplication$1` bean found in field `delegate` of `org.gradle.api.internal.DefaultCollectionCallbackActionDecorator$BuildOperationEmittingAction` bean found in field `actions` of `org.gradle.internal.ImmutableActionSet$SetWithFewActions` bean found in field `addActions` of `org.gradle.api.internal.collections.DefaultCollectionEventRegister` bean found in field `eventRegister` of `org.gradle.api.internal.DefaultDomainObjectSet` bean found in field `idMappings` of `org.gradle.api.internal.plugins.DefaultPluginManager` bean found in field `pluginManager` of `com.hedvig.android.ApolloSchemaHandler` bean found in field `this$0` of `com.hedvig.android.ApolloSchemaHandler$configure$2$1` bean found in field `action` of `org.gradle.api.internal.AbstractTask$TaskActionWrapper` bean found in field `actions` of task `:apollo-octopus-public:downloadOctopusApolloSchemaFromIntrospection` of type `com.apollographql.apollo.gradle.internal.ApolloDownloadSchemaTask`: error writing value of type 'org.gradle.api.internal.artifacts.configurations.DefaultConfigurationContainer$NamedDomainObjectCreatingProvider'
> Resolving dependency configuration 'projectHealthElements' is not allowed as it is defined as 'canBeResolved=false'.
Instead, a resolvable ('canBeResolved=true') dependency configuration that extends 'projectHealthElements' should be resolved.
Now, the weird part is that this only happens to me when I run that task, when I run other tasks like building the app, or even ./gradlew buildHealth
which comes from that plugin, it works just fine.
Anything that stands out from a first glance?Stylianos Gakis
11/07/2024, 12:21 AM./gradlew download[Service]ApolloSchemaFromIntrospection
just runs everything smoothly, not even giving me any warnings about CC ๐Stylianos Gakis
11/07/2024, 1:05 AMapolloSchema()
calls is:
pluginManager.apply(libs.plugins.apollo.get().pluginId)
project.tasks.withType<com.apollographql.apollo.gradle.internal.ApolloDownloadSchemaTask>().configureEach {
doLast {
val schemaFile = outputFile.get().asFile
val schemaText = schemaFile.readText()
val convertedSchema = schemaText.performClientSideChanges()
schemaFile.writeText(convertedSchema)
}
}
So I apply the apollo plugin and just configure a task.Stylianos Gakis
11/07/2024, 1:06 AMproject.tasks.withType<com.apollographql.apollo.gradle.internal.ApolloDownloadSchemaTask>().configureEach {
doLast {
val schemaFile = outputFile.get().asFile
val schemaText = schemaFile.readText()
val convertedSchema = schemaText.performClientSideChanges()
schemaFile.writeText(convertedSchema)
}
}
part also fixes this! Hmmmm what could this be then ๐Stylianos Gakis
11/07/2024, 2:11 AMinternal abstract class ApolloSchemaHandler @Inject constructor(
private val project: Project,
private val pluginManager: PluginManager,
private val libs: LibrariesForLibs,
) {
fun configure() {
...
With just
internal abstract class ApolloSchemaHandler {
fun configure(project: Project) {
val libs = project...
val pluginManager = project.pluginManager
...
Where I pass the project
myself in this function instead of through the `newInstance<ApolloSchemaHandler>(...here)
Then it also just works without any problems.
So looks like I should not be passing my project like that. I think I saw other people do it and I thought it'd be fine ๐คทmbonnin
11/07/2024, 9:34 AMmbonnin
11/07/2024, 9:34 AMmbonnin
11/07/2024, 9:35 AMmbonnin
11/07/2024, 9:36 AMproject.tasks.withType<com.apollographql.apollo.gradle.internal.ApolloDownloadSchemaTask>().configureEach {
doLast {
val schemaFile = outputFile.get().asFile
val schemaText = schemaFile.readText()
val convertedSchema = schemaText.performClientSideChanges()
schemaFile.writeText(convertedSchema)
}
}
mbonnin
11/07/2024, 9:38 AMdoLast {}
lambda is capturing a reference to something that cannot be serialized to the CC. It's very easy to end up in situation like this with doLast {}
lambdasmbonnin
11/07/2024, 9:39 AMPatchSchema
task and connect the apolloDownloadTask.output
to your PatchSchema.input
and PatchSchema.output
to ApolloService.schemaFiles
mbonnin
11/07/2024, 9:40 AM