realm-java icon indicating copy to clipboard operation
realm-java copied to clipboard

Incompatibility issue with Gradle configuration cache

Open sanogueralorenzo opened this issue 4 years ago • 15 comments

The configuration cache is a feature that significantly improves build performance by caching the result of the configuration phase and reusing this for subsequent builds.

Implementing support for the configuration cache in this plugin would improve users experience by dramatically reducing build times.

See https://docs.gradle.org/current/userguide/configuration_cache.html

The configuration cache is already available since Gradle 6.6.

When I run ./gradlew app:assembleRelease, and the configuration doesn't come from the cache, Gradle reports this error:

Task `:app:transformClassesWithRealmTransformerForDebug` of type
`com.android.build.gradle.internal.pipeline.TransformTask`: 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/6.8.1/userguide/configuration_cache.html#config_cache:requirements:disallowed_types

Are there any plans to support configuration cache?

sanogueralorenzo avatar Feb 05 '21 11:02 sanogueralorenzo

Thanks for the heads up on configuration cache, we are going to evaluate supporting it.

clementetb avatar Feb 12 '21 09:02 clementetb

In Android Studio 7.0.0 there is a warning in the Build Analyzer, that configuration cache could be enabled. Unfortunately Realm is not yet compatible.

Jeff11 avatar Jul 30 '21 08:07 Jeff11

Looking a bit into this. It requires us to move to Gradle 7.0 as well, which contains a few breaking changes for us. I'm currently looking into how difficult it would be to upgrade.

cmelchior avatar Aug 04 '21 09:08 cmelchior

Hmm, this also requires Java 11 it seems, so also ties into #7533

cmelchior avatar Aug 04 '21 09:08 cmelchior

We will address this as part of https://github.com/realm/realm-java/pull/7535

cmelchior avatar Aug 04 '21 11:08 cmelchior

@Jeff11 @sanogueralorenzo I'm trying to reproduce this, but cannot. Can you try to describe the exact versions of Gradle, Android Studio and Android Gradle plugin you are using?

cmelchior avatar Aug 30 '21 13:08 cmelchior

I have also the same issue, that the configuration cache is not working. My used versions are:

  • Android Studio Arctic Fox | 2020.3.1 Patch 1 Build #AI-203.7717.56.2031.7621141, built on August 7, 2021
  • Gradle JDK: Android Studio Default JDK 11.0.10
  • Android Gradle Plugin Version 7.0.1
  • Gradle Verson 7.1
  • io.realm:realm-gradle-plugin:10.8.0

mrfaa avatar Sep 01 '21 11:09 mrfaa

I believe its not yet merged with 10.10.1, when can we expect it to be available in stable release?

jayesh83 avatar Apr 22 '22 12:04 jayesh83

The configuration cache is still not working. My used versions are:

  • Android Studio Electric Eel | 2022.1.1 Beta 1
  • Gradle JDK: Android Studio Default JDK 11.
  • Android Gradle Plugin Version 7.2.2
  • Gradle Version 7.3.3
  • io.realm:realm-gradle-plugin:10.10.1

@cmelchior

pavan-byjus avatar Oct 06 '22 17:10 pavan-byjus

The latest realm gradle plugin 10.11.1 is shown as incompatible with Gradle Configuraton cache feature. Using Android Studio Flamingo 2022.2.1 Canary 6

funkyidol avatar Nov 01 '22 16:11 funkyidol

Can I have some eyes on this PR please: https://github.com/realm/realm-java/pull/7750 It adds support for Configuration Cache for -transformer-api versions. @cmelchior

pstavytskyi-turo avatar Dec 20 '22 20:12 pstavytskyi-turo

Still get the warning for the 10.13.2-transformer-api version

0neel avatar Feb 07 '23 12:02 0neel

Is there any update on this, on 10.5.1 and the configuration cache seems to be incompatible.

mcgirr5799 avatar Dec 15 '23 01:12 mcgirr5799

I am seeing the same issue. This is what is reported when building the application

realm-android: not compatible You could save about 2.2s by turning Configuration cache on. With Configuration cache, Gradle can skip the configuration phase entirely when nothing that affects the build configuration has changed. The version of this plugin used in this build is not compatible with Configuration cache and we don’t know the version when it becomes compatible. Plugin version: 10.18.0 Plugin dependency: io.realm:realm-gradle-plugin

My environment is defined as: Android Studio Iguana | 2023.2.1 Patch 2 Gradle JDK: Azul Zulu v21.0.3 Android Gradle Plugin Version 8.3..2 Gradle Version 8.7 io.realm:realm-gradle-plugin:10.18.0

Note that the sample is reported if changing Gradle JDK: to Azul Zulu v17.0.9

renault-the-dog avatar May 15 '24 18:05 renault-the-dog