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

Android build fails with Gradle Configuration Cache #2449

Closed
pvegh opened this issue Mar 31, 2023 · 5 comments · Fixed by #2453
Closed

Android build fails with Gradle Configuration Cache #2449

pvegh opened this issue Mar 31, 2023 · 5 comments · Fixed by #2453
Labels
Missing repro Platform: Android This issue is specific to Android

Comments

@pvegh
Copy link
Contributor

pvegh commented Mar 31, 2023

Description

Using Configuration Cache our build seems to fail with this error:

Could not evaluate onlyIf predicate for task ':react-native-gesture-handler:assertNoMultipleInstances'.
> Could not evaluate spec for 'Task satisfies onlyIf closure'.

The problem seems to be something in Gesture Handler not being correctly defined around here:

tasks.preBuild {
// dependsOn assertionTask // this fixes the problem so it must be with assertionTask not being compatible
}

Steps to reproduce

  1. enable CC with:
    org.gradle.unsafe.configuration-cache=true
  2. Run app in Android Studio

And the first launch seems to work, but the second launch throws above exception. So when the config cache would be used the problem occures.

Snack or a link to a repository

cant

Gesture Handler version

2.9.0

React Native version

0.71.4

Platforms

Android

JavaScript runtime

None

Workflow

None

Architecture

None

Build type

None

Device

None

Device model

No response

Acknowledgements

Yes

@github-actions
Copy link

Hey! 👋

The issue doesn't seem to contain a minimal reproduction.

Could you provide a snack or a link to a GitHub repository under your username that reproduces the problem?

@github-actions github-actions bot added the Platform: Android This issue is specific to Android label Mar 31, 2023
@pvegh
Copy link
Contributor Author

pvegh commented Mar 31, 2023

Sorry I can't build a reproducer. It is as simple as enable build cache and keep using a project with RNGH in Android Studio.
Also using Gradle 7.6, it might help.

@sdeff
Copy link

sdeff commented Mar 31, 2023

I'm experiencing the same issue!

@artemis-prime
Copy link

The workaround is just to delete the cache. I'm not sure what a fix would mean.

@pvegh
Copy link
Contributor Author

pvegh commented Apr 17, 2023

Deleting the config cache defies the purpose of enabling it, so it's not an option.

The fix will be a mix of using APIs that supported in that environment, supporting the caching logic decide what can be reused and what needs to be re-run, and to stop using things that completely break the build when CC is enabled.

As a first step changes should be made to simply not break the whole build (by the looks of it it's what #2453 is doing).
Later some actual caching could be implemented, if applicable, to save time for every execution.

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

j-piasecki added a commit that referenced this issue Apr 26, 2023
…2453)

## Description

Makes `assertNoMultipleInstances` task not break when [Gradle
Configuration
Cache](https://docs.gradle.org/current/userguide/configuration_cache.html#config_cache:intro)
is enabled.

Fixes
#2449.

## Test plan

Enable configuration cache by adding
`org.gradle.unsafe.configuration-cache=true` in `gradle.properties` file
and build the app twice. Do it once without this patch and once with it.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Missing repro Platform: Android This issue is specific to Android
Projects
None yet
3 participants