Skip to content

Commit 71f53c3

Browse files
authored
[Android] build.gradle cleanup (#3741)
> [!NOTE] > Supersede #3335 # Description This PR contains cherry picked commits from #3335 as merging changes after migrating into monorepo became quite painful 😞 1. `appProject` seems to be left unused after #3091 2. adding `configureEach` allows for [lazy task initialization](https://docs.gradle.org/current/userguide/task_configuration_avoidance.html#sec:old_vs_new_configuration_api_overview) # Original description ## Description This PR optimises pre-build time of Gesture Handler android, taking it down from ~7s to ~0.6s, a 11x improvement. - baseline: - time 6.776s ([link](https://gradle.com/s/h5iselfgzhafi)) - time 7.391s ([link](https://scans.gradle.com/s/6sz4ssuepvema)) - optimised: - time 0.687s ([link](https://gradle.com/s/zwiujfjblp64s)) - time 0.560s ([link](https://gradle.com/s/i5xqega7pazja)) - time 0.596s ([link](https://gradle.com/s/ohcnspquhmau4)) fixes: #2865 Optimisation of the `example` app pre-build time will be done in a separate PR, so far i took it down from 13s to 0.1s (caching & on-demand building). ## Test plan - Run `./gradlew help --scan` to see pre-build performance - Build app to see everything still works
1 parent 21c4943 commit 71f53c3

1 file changed

Lines changed: 1 addition & 2 deletions

File tree

packages/react-native-gesture-handler/android/build.gradle

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,6 @@ android {
151151
buildConfigField "int", "REACT_NATIVE_MINOR_VERSION", REACT_NATIVE_MINOR_VERSION.toString()
152152

153153
if (isNewArchitectureEnabled()) {
154-
var appProject = rootProject.allprojects.find { it.plugins.hasPlugin('com.android.application') }
155154
externalNativeBuild {
156155
cmake {
157156
cppFlags "-O2", "-frtti", "-fexceptions", "-Wall", "-Werror", "-std=c++20", "-DANDROID"
@@ -215,7 +214,7 @@ android {
215214
}
216215

217216
if (isGHExampleApp()) {
218-
tasks.withType(ExternalNativeBuildJsonTask) {
217+
tasks.withType(ExternalNativeBuildJsonTask).configureEach {
219218
compileTask ->
220219
compileTask.doLast {
221220
def rootDir = new File("${project.projectDir}/..")

0 commit comments

Comments
 (0)