Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Coverage tests do not work with Realm plugin and 7.2.0 of Gradle #6142

Closed
michaelkaye opened this issue May 24, 2022 · 3 comments
Closed

Coverage tests do not work with Realm plugin and 7.2.0 of Gradle #6142

michaelkaye opened this issue May 24, 2022 · 3 comments

Comments

@michaelkaye
Copy link
Contributor

We should downgrade gradle to 7.1.3 to handle this.

@michaelkaye
Copy link
Contributor Author

(record of conversation where we came to this conclusion)
Michael>

So realm and jacoco both put in transformers; i there's some specific statements in the realm docs that say "this plugin must come after this other one", i'm wondering if that's because of some ordering and we are a bit weird by dynamically adding jacoco (so
presumably it goes in at the end); i wonder if statically adding it at the start would do better.

adam>

in our case it's the android plugin which instruments the code when testCoverageEnable true is applied
(or it appears that way as jacoco has no effect when applied by itself)

Michael>

> Configure project :matrix-sdk-android
Evaluating project ':matrix-sdk-android' using build file '/work/element-android/matrix-sdk-android/build.gradle'.
WARNING:API 'android.registerTransform' is obsolete.
It will be removed in version 8.0 of the Android Gradle plugin.
The Transform API is removed to improve build performance. Projects that use the
Transform API force the Android Gradle plugin to use a less optimized flow for the
build that can result in large regressions in build times. It’s also difficult to
use the Transform API and combine it with other Gradle features; the replacement
APIs aim to make it easier to extend the build without introducing performance or
correctness issues.

There is no single replacement for the Transform API—there are new, targeted
APIs for each use case. All the replacement APIs are in the
`androidComponents {}` block.
For more information, see https://developer.android.com/studio/releases/gradle-plugin-api-updates#transform-api.
REASON: Called from: /work/element-android/matrix-sdk-android/build.gradle:5
WARNING: Debugging obsolete API calls can take time during configuration. It's recommended to not keep it on at all times.
java.lang.RuntimeException: Configuration '_agp_internal_javaPreCompileDebugAndroidTest_kaptClasspath' was resolved during configuration time.
This is a build performance and scalability issue.
See https://github.com/gradle/gradle/issues/2298

The line mentioned, matrix-sdk-android/build.gradle:5 is importing the realm plugin.

Got the above message via: ./gradlew clean -Pandroid.debug.obsoleteApi=true theCodeCoverageReport -i.

Not sure if it's a cause but it does point at the realm plugin, and the realm plugin does use the API (see https://www.mongodb.com/docs/realm/sdk/java/troubleshooting/#customize-dependecies-defined-by-the-realm-gradle-plugin . Not sure what that means though; perhaps some selective downgrading might help, as it used to work.

adam>

it's strange that this ends up ignoring/overriding the instrumented classes https://github.com/realm/realm-java/blob/master/realm-transformer/src/main/kotlin/io/realm/transformer/RealmTransformer.kt#L116 ; even stranger that it changes non realm classes 🤔

Michael>

If i downgrade to 7.1.3 and keep using Realm, I get coverage reports

@michaelkaye
Copy link
Contributor Author

realm/realm-java#7685 may also be an issue for us ; adam also reported we've had difficulties upgrading the Realm plugin (lack of upgrade might be the cause of the code coverage issues; or the gradle version might the cause of the realm plugin upgrade issues)

@ouchadam
Copy link
Contributor

downgrade included as part of #6141

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants