Skip to content

Commit

Permalink
feat: support custom firebase.json path
Browse files Browse the repository at this point in the history
  • Loading branch information
CHOIMINSEOK committed Oct 15, 2024
1 parent 9c94085 commit 48d56af
Showing 1 changed file with 13 additions and 7 deletions.
20 changes: 13 additions & 7 deletions packages/app/android/firebase-json.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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 }
}
}
}

Expand Down

0 comments on commit 48d56af

Please sign in to comment.