Skip to content

Add support for Gradle Configuration Cache #45154

Description

@pvdmde

Description

Using Gradle 8.2 or newer with stable config cache support, enabling it with org.gradle.configuration-cache=true I'm getting this error:

4 problems were found storing the configuration cache, 2 of which seem unique.
- Script '/Users/..../node_modules/@react-native-community/cli-platform-android/native_modules.gradle': external process started 'node -e try {console.log(require('@react-native-community/cli').bin);} catch (e) {console.log(require('react-native/cli').bin);}'
  See https://docs.gradle.org/8.2.1/userguide/configuration_cache.html#config_cache:requirements:external_processes
org.gradle.api.InvalidUserCodeException: Starting an external process 'node -e try {console.log(require('@react-native-community/cli').bin);} catch (e) {console.log(require('react-native/cli').bin);}' during configuration time is unsupported.
	at org.gradle.configurationcache.initialization.DefaultConfigurationCacheProblemsListener.onExternalProcessStarted(ConfigurationCacheProblemsListener.kt:117)
	at org.gradle.configurationcache.InstrumentedInputAccessListener.externalProcessStarted(InstrumentedInputAccessListener.kt:110)
	at org.gradle.internal.classpath.Instrumented.externalProcessStarted(Instrumented.java:501)

Currently we're wasting 30s to 1 minute on configuration step every time we build, also locally.
I reported it almost a year ago in react-native-community/cli#2058, now it being closed there I should recreate it here.

Steps to reproduce

Using Gradle 8.2 or newer with stable config cache support, enabling it with org.gradle.configuration-cache=true I'm getting this error:

React Native Version

0.74.0

Affected Platforms

Build - MacOS

Output of npx react-native info

irrelevant

Stacktrace or Logs

4 problems were found storing the configuration cache, 2 of which seem unique.
- Script '/Users/..../node_modules/@react-native-community/cli-platform-android/native_modules.gradle': external process started 'node -e try {console.log(require('@react-native-community/cli').bin);} catch (e) {console.log(require('react-native/cli').bin);}'
  See https://docs.gradle.org/8.2.1/userguide/configuration_cache.html#config_cache:requirements:external_processes
org.gradle.api.InvalidUserCodeException: Starting an external process 'node -e try {console.log(require('@react-native-community/cli').bin);} catch (e) {console.log(require('react-native/cli').bin);}' during configuration time is unsupported.
	at org.gradle.configurationcache.initialization.DefaultConfigurationCacheProblemsListener.onExternalProcessStarted(ConfigurationCacheProblemsListener.kt:117)
	at org.gradle.configurationcache.InstrumentedInputAccessListener.externalProcessStarted(InstrumentedInputAccessListener.kt:110)
	at org.gradle.internal.classpath.Instrumented.externalProcessStarted(Instrumented.java:501)


### Reproducer

irrelevant, issue is clear in the description

### Screenshots and Videos

_No response_

Metadata

Metadata

Assignees

Labels

Help Wanted :octocat:Issues ideal for external contributors.Never gets stalePrevent those issues and PRs from getting staleTool: GradleType: EnhancementA new feature or enhancement of an existing feature.

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions