configuration-cache
  • tony

    tony

    09/25/2022, 5:01 PM
    looked for this issue but couldn't find one, so I created it. Apologies if it's a known thing. tl;dr
    gradle init --configuration-cache
    doesn't work in 7.5.1. https://github.com/gradle/gradle/issues/22188
  • z

    Zak Taccardi

    09/26/2022, 8:20 AM
    I need to take a
    String
    input (parameter, it’s a file path) from within a
    ValueSource
    and output a
    RegularFile
    from that
    String
    . Is this possible with the
    ValueSource
    API? If I try to
    @get:Inject
    a
    ProjectLayout
    , I get the following error:
    Cannot fingerprint input file property 'rootSpec$1': No service of type ProjectLayout available in DefaultServiceRegistry.
    > No service of type ProjectLayout available in DefaultServiceRegistry.
  • Eug

    Eug

    09/28/2022, 2:26 PM
    We have some old hand written task and I’m trying to rewrite it with configuration cache support. I don’t see any errors. However, first run of this task works. The second run says it can not find some groovy methods defined in this file. Any good resources of dealing/writing groovy gradle task code and support configuration cache?
  • z

    Zak Taccardi

    09/28/2022, 7:16 PM
    Is it possible to convert the output of a
    TaskProvider<Sync>
    into a
    Provider<FileSystemLocation>
    and support the config cache? With:
    fun TaskProvider<Sync>.asFileSystemLocationSingleFile(): Provider<FileSystemLocation> {
        return map {
            it.outputs.files.asFileTree.elements.get()
        }
            .map {
                // seeing `> Collection is empty.` error with config cache on
                it.first()
            }
    }
    I’m seeing this error:
    1 problem was found storing the configuration cache.
    - Task `:jenkinsfile:jenkinsfile-shared:modifySharedGroovy` of type `Build_gradle$ModifySharedGroovy`: value 'map(org.gradle.api.file.FileSystemLocation map(map(provider(task 'syncOriginalSharedGroovy', class org.gradle.api.tasks.Sync))) check-type())' failed to unpack provider
  • c

    Clayton Walker

    10/03/2022, 8:01 PM
    Has anybody seen issues around with build cache around what appears to be captured variables/closures?
    > Cannot cast object 'java.lang.Object@56ee54b7' with class 'java.lang.Object' to class 'org.gradle.api.DefaultTask'
    From what I can tell it happens when you capture a local variable/function in an upToDateWhen closure
  • c

    Chris Lee

    10/04/2022, 1:51 AM
    Configuration cache niggly:
    Instead, the value of the
    ValueSource
    is recomputed each time the build runs and only if the value changes the configuration cache is invalidated.
  • m

    Markus Maier

    10/05/2022, 1:49 PM
    What's the correct way of declaring the outputs of one task as a generic input for another task in a way that's compatible with configutation-cache? I have a task that uses the output of
    processResources
    and I want to declare that properly 🧵
  • Fleshgrinder

    Fleshgrinder

    10/05/2022, 2:56 PM
    It seems that a
    fileTree
    created in a
    settings.gradle.kts
    script (either via
    settings.fileTree
    or
    gradle.serviceOf<ObjectFactory>().fileTree()
    ) is entirely ignored by the configuration cache. Changes on the file system are never picked up, and the cache is always considered up-to-date. 🤔
  • c

    Chris Lee

    10/06/2022, 5:50 PM
    Stumbled across another cc bug. Unable to store ValueSource-backed providers in MapProperty (serialization error reloading cc). e.g. this fails:
    mapProp.put("foo", providers.systemProperty("user.name"))
    workaround:
    mapProp.put("foo", provider { System.getProperty("user.name") })
  • Tapchicoma

    Tapchicoma

    10/14/2022, 9:55 AM
    Is it correct that
    ValueSource
    providers are compatible with configuration cache only since Gradle 7.5?
  • j

    Jakub Chrzanowski

    10/14/2022, 11:14 AM
    Hi! Isn’t it possible to use
    flatMap
    on task provider, like:
    val downloadDirProvider = runPluginVerifierTaskProvider.flatMap { runPluginVerifierTask ->
        runPluginVerifierTask.downloadDir
    }
    in older Gradle, i.e. 6.9.2? It fails with:
    1 problem was found storing the configuration cache.
    - Task `:verifyPluginConfiguration` of type `org.jetbrains.intellij.tasks.VerifyPluginConfigurationTask`: cannot serialize object of type 'org.jetbrains.intellij.tasks.RunPluginVerifierTask', a subtype of 'org.gradle.api.Task', as these are not supported with the configuration cache.
      See <https://docs.gradle.org/6.9.2/userguide/configuration_cache.html#config_cache:requirements:task_access>
    This one works, but I doubt it’s valid enough:
    val downloadDirProvider = runPluginVerifierTaskProvider.map { runPluginVerifierTask ->
        runPluginVerifierTask.downloadDir.get()
    }
  • El Zhang

    El Zhang

    10/17/2022, 9:12 AM
    Does the configuration cache can be partially enabled if some unsupported plugins are still running every time by a declaration somehow? I forget where I saw a relevant discussion before…would like to get more advice from you folks~
  • m

    melix

    10/17/2022, 2:09 PM
    I'm pulling what's left of my hair to fix compatibility with the configuration cache. I'm getting this error:
    * What went wrong:
    Configuration cache state could not be cached: field '__options__' from type 'org.graalvm.buildtools.gradle.tasks.GenerateResourcesConfigFile': error writing value of type 'org.gradle.api.internal.provider.DefaultProperty'
    > Configuration cache state could not be cached: field '_gr_owner_' from type 'org.graalvm.buildtools.gradle.dsl.NativeResourcesOptions': error writing value of type 'org.graalvm.buildtools.gradle.internal.BaseNativeImageOptions'
       > Configuration cache state could not be cached: field '__configurationFileDirectories__' from type 'org.graalvm.buildtools.gradle.internal.BaseNativeImageOptions': error writing value of type 'org.gradle.api.internal.file.collections.DefaultConfigurableFileCollection'
          > Configuration cache state could not be cached: field 'provider' from type 'org.gradle.configurationcache.serialization.codecs.ProviderBackedFileCollectionSpec': error writing value of type 'org.gradle.api.internal.provider.FlatMapProvider'
             > Configuration cache state could not be cached: field 'transformer' from type 'org.gradle.api.internal.provider.TransformBackedProvider': error writing value of type 'org.graalvm.buildtools.gradle.NativeImagePlugin$$Lambda$2296/0x0000000801660f08'
                > Configuration cache state could not be cached: field 'capturedArgs' from type 'java.lang.invoke.SerializedLambda': error writing value of type '[Ljava.lang.Object;'
                   > Unable to make field private final java.util.function.BiConsumer java.util.stream.Collectors$CollectorImpl.accumulator accessible: module java.base does not "opens java.util.stream" to unnamed module @3b11025d
  • m

    melix

    10/17/2022, 2:10 PM
    Note that I'm using serializable lambdas, but the last error looks like a Gradle bug, isn't it?
  • c

    Clayton Walker

    10/20/2022, 8:27 PM
    I’m trying to fix a bug when using the configuration cache, not sure if it’s a bug in gradle or if the project is relying on some subtle behavior. In the gradle-docker-plugin, there’s an
    @Internal
    property called
    imageId
    that’s set when the imageIdFile is set during the task action. https://github.com/bmuschko/gradle-docker-plugin/blob/master/src/main/groovy/com/bmuschko/gradle/docker/tasks/image/DockerBuildImage.groovy#L214 When using configurationCache the value ends up being unset, which causes an exception
    Caused by: org.gradle.api.GradleException: The imageId property was not set from task buildImage
    Is there a better way to handle an “output” of a task that isn’t a file, but a string in this case?
  • m

    Marek

    11/04/2022, 7:48 AM
    Anyone successfully managed to enable configuration cache in an Android project including dynamic feature modules? I ended up with an error when running
    checkDebugLibrarires
    task when configuration cache is applied.
    [:hype_integration, :hype_integration] all package the same library [com.google.firebase:firebase-auth;capability group='com.google.firebase', name='firebase-auth', version='21.0.8'].
    
    Multiple APKs packaging the same library can cause runtime errors. Placing each of the above libraries in its own dynamic feature and adding that feature as a dependency of modules requiring it will resolve this issue. Libraries that are always used together can be combined into a single feature module to be imported by their dependents. If a library is required by all feature modules it can be added to the base module instead.
    https://issuetracker.google.com/u/0/issues/256891007
  • Martin

    Martin

    11/06/2022, 9:47 AM
    If I have a plugin that does
    project.rootProject.allProjects {}
    , how do I make this project isolation compatible? Do I have to tell my users to apply the plugin in all projects manually?
  • m

    Marek

    11/07/2022, 6:51 AM
    Are there plans for the
    cpp-library
    and
    cpp-application
    plugins to support gradle configuration cache anytime soon? Also if do use mentioned plugins, does it mean I can forget about enabling configuration cache for now?
  • c

    Chris Lee

    11/08/2022, 3:41 PM
    fyi, 7.6rc2 fails to publish where publish tasks have an onlyIf spec. Deets: https://github.com/gradle/gradle/issues/22641
  • CristianGM

    CristianGM

    11/09/2022, 9:47 AM
    Is it possible to configure Junit includeCategories in a CC compatible way? We run different subsets of our tests (manual sharding) so we use either a projectProperty or systemProperty to set the included categories, but the issue is
    includeCategories
    is not lazy, so if I use a systemProperty (so Gradle will reuse CC) the property will be ignored.
  • CristianGM

    CristianGM

    11/09/2022, 2:42 PM
    Trying to use ConfigurationCache in TeamCity: • I have a build that runs the task with
    --dry-run
    stores
    .gradle/configuration-cache
    in a zip • there is another build that unzips configuration cache into it's folder and runs the same task When running the task it doesn't reuse CC:
    in directory: /mnt/agent/work/7aa5674c7cf6c365
    Starting a Gradle Daemon (subsequent builds will be faster)
    Configuration cache is an incubating feature.
    Configuration on demand is an incubating feature.
    Calculating task graph as configuration cache cannot be reused because file '../5dc226c250a4ec20/gradle.properties' has changed.
    7aa...365 is the folder where the build is cloned when running 5dc...c20 is the folder where it was cloned for the dry-run (it may not exist now) The CC report on the dry run doesn't show gradle.properties file as tracked.
  • tony

    tony

    11/09/2022, 8:21 PM
  • Tapchicoma

    Tapchicoma

    11/11/2022, 10:56 AM
    Hi, any hints how to debug/fix following message on Gradle 7.3?
    Calculating task graph as configuration cache cannot be reused because Gradle property 'property.name' has changed.
    I've rerun the build with the same parameters and this property is in
    gradle.properties
  • Javi

    Javi

    11/17/2022, 12:56 PM
    Is it possible to know if there is a task (or a plugin) which would fail without manually executing it? Or in other words, is there a way to execute all tasks in order to enumerate them if any fails with cc enabled?
  • m

    Markus Maier

    11/18/2022, 7:47 AM
    What's the correct way to register a custom build cache implementation so it will be compatible with configuration-cache?
  • t

    thadhouse

    11/25/2022, 7:25 AM
    Playing around with making our plugins partially configuration cache compatible. I'll be able to get some things working, but there is a workflow I can basically guarantee will never work with the configuration cache. I just want to double check that running without the configuration cache will be supported long into the future, even after its made the default.
  • Martin

    Martin

    11/28/2022, 12:21 PM
    With project isolation, is there such a thing as "partial project isolation"? Where a subgraph of my project graph needs to be configured together but some other are perfectly standalone? Not sure if that makes sense?
  • r

    rrva

    11/28/2022, 4:37 PM
    for a kotlin/jvm project, using gradle 7.6, how unsafe/unstable is configuration cache really considered to be ?
  • d

    Doni

    12/01/2022, 4:40 AM
    TaskGraph.afterTask is not supported for configuration cache, any alternative for this ? I used this method for counting task executed. I want to have something like this similar to what we have after build completed: 451 actionable tasks: 5 executed, 446 up-to-date Is there any way to get that number from gradle script ?
  • El Zhang

    El Zhang

    12/03/2022, 8:18 AM
    Hi everyone, I’m working on
    OperationCompletionListener
    to replace afterTask for configuration cache compliance. I’m trying to get more information from the
    TaskFinishEvent.Descriptor
    , however the code below throws exceptions:
    val desc: TaskOperationDescriptor = event.descriptor
    Lifecycle.afterTask("${desc.taskPath} belongs to ${desc.originPlugin ?: "Unknown"}")
    Unsupported method: TaskOperationDescriptor.getOriginPlugin().
    The version of Gradle you connect to does not support that method.
    To resolve the problem you can change/upgrade the target version of Gradle you connect to.
    Alternatively, you can ignore this exception and read other information from the model.
    The doc denotes
    originPlugin
    should work since Gradle 5.1, I have tried the latest Gradle 7.6 it still throws the Unsupported method exception. Updates:
    dependencies
    is not working (same error).