This message was deleted.
# configuration-cache
s
This message was deleted.
m
How can I make this compatible with the configuration cache?
a
Copy code
copy = p.copy();
Is
p
a Project instance?
m
no, it's a
ProjectDependency
(as returned by
projects.micronautServiceSpec
a
the docs say
Some types, such as Publication or Dependency are not serializable, but could be. We may, if necessary, allow these to be used as task inputs directly.
which is not so helpful...
a
What happens if you do something like:
Copy code
val specGroup = serviceApiExtension.getSpecGroup()
val specName = serviceApiExtension.getSpecName()
openApiExtension.getSpecificationFile().fileProvider(
            specConsumer.getIncoming()
                .getArtifacts()
                .getArtifactFiles()
                .getElements()
                .map(fileSystemLocations -> {
                    var specsDir = fileSystemLocations.iterator().next().getAsFile();
                    return new File(specsDir, specGroup.get() + "/" + specName.get() + ".yaml");
                }));
?
m
mmm, avoiding the serialization of the extension in the lambda, right. It seems to get further, now it blows up later.
Thanks I'll see where it leads me.
the new error is for a different task, but not super helpful either:
Copy code
Could not load the value of field `provider` of `org.gradle.configurationcache.serialization.codecs.ProviderBackedFileCollectionSpec` bean found in field `__specs__` of task `:micronaut-service-spec:preprocessSpecs` of type `xxxxxxx.specs.tasks.SpecPreprocessorTask`.
> java.lang.reflect.InvocationTargetException (no error message)
this is caused by an input which has:
Copy code
private static Provider<List<RegularFile>> lazySpecsProvider(OciSpecsExtension extension) {
        var specNames = extension.getSpecNames();
        var specsDir = extension.getSpecsDir();
        return specsDir.zip(specNames, (dir, names) -> names.stream()
                .map(dir::file)
                .toList()
        );
    }
where there's nothing magic in there.
specNames
is a
SetProperty<String>
and
specsDir
is a
DirectoryProperty
the best error I get is:
Copy code
Caused by: java.io.InvalidObjectException: null array
        at java.base/java.util.CollSer.readResolve(ImmutableCollections.java:1491)
        ... 184 more
working with the config cache is really a frustrating experience 😞
plus1 1
a
I'd like it if the configuration cache report contained more useful diagnostic information. It would helpful if it showed which file the error originates from, because usually it's not at all related to what the 'node graph' (whatever that is?) shows https://github.com/gradle/gradle/issues/24030