From 6d399b01a760670fa0d412aec65ab0d379f0bfa2 Mon Sep 17 00:00:00 2001 From: CHOIMINSEOK Date: Tue, 15 Oct 2024 17:56:55 +0900 Subject: [PATCH] Support custom firebase.json path --- packages/app/android/firebase-json.gradle | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/packages/app/android/firebase-json.gradle b/packages/app/android/firebase-json.gradle index 73593aaf72..436cbb9554 100644 --- a/packages/app/android/firebase-json.gradle +++ b/packages/app/android/firebase-json.gradle @@ -4,16 +4,22 @@ import groovy.json.JsonSlurper String fileName = 'firebase.json' String jsonRoot = 'react-native' +String customFirebaseJsonDir = rootProject.ext.get("react-native")["options"]["firebaseJsonDir"] File jsonFile = null -File parentDir = rootProject.projectDir -for (int i = 0; i <= 3; i++) { - if (parentDir == null) { break } - parentDir = parentDir.parentFile - if (parentDir != null) { - jsonFile = new File(parentDir, fileName) - if (jsonFile.exists()) { break } +if (customFirebaseJsonDir != null) { + jsonFile = new File(customFirebaseJsonDir, fileName) +} else { + File parentDir = rootProject.projectDir + + for (int i = 0; i <= 3; i++) { + if (parentDir == null) { break } + parentDir = parentDir.parentFile + if (parentDir != null) { + jsonFile = new File(parentDir, fileName) + if (jsonFile.exists()) { break } + } } }