Skip to content

Commit 192f380

Browse files
Firebase Auth, Firestore, Realtime DB, and Storage support
1 parent e1a42a1 commit 192f380

28 files changed

+1550
-0
lines changed

.gitattributes

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# Auto detect text files and perform LF normalization
2+
* text=auto

.gitignore

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# Gradle files
2+
.gradle/
3+
build/
4+
5+
# Local configuration file (sdk path, etc)
6+
local.properties
7+
8+
# Log/OS Files
9+
*.log
10+
11+
# Android Studio generated files and folders
12+
captures/
13+
.externalNativeBuild/
14+
.cxx/
15+
*.apk
16+
output.json
17+
18+
# IntelliJ
19+
*.iml
20+
.idea/
21+
misc.xml
22+
deploymentTargetDropDown.xml
23+
render.experimental.xml
24+
25+
# Keystore files
26+
*.jks
27+
*.keystore
28+
29+
# Google Services (e.g. APIs or Firebase)
30+
google-services.json
31+
32+
# Android Profiling
33+
*.hprof

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2025 Anish Mishra (syntaxerror247)
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

build.gradle.kts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
// Top-level build file where you can add configuration options common to all sub-projects/modules.
2+
plugins {
3+
id("com.android.library") version "8.2.2" apply false
4+
id("org.jetbrains.kotlin.android") version "2.1.20" apply false
5+
id("com.google.gms.google-services") version "4.4.2" apply false
6+
}

demo/.gitattributes

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# Normalize EOL for all files that Git considers text files.
2+
* text=auto eol=lf

demo/.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# Godot 4+ specific ignores
2+
.godot/
3+
*.import
4+
/android/

demo/addons/.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
*
2+
!.gitignore

firebase/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/build

firebase/build.gradle.kts

Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
import com.android.build.gradle.internal.tasks.factory.dependsOn
2+
3+
plugins {
4+
id("com.android.library")
5+
id("org.jetbrains.kotlin.android")
6+
}
7+
8+
val pluginName = "GodotFirebaseAndroid"
9+
10+
val pluginPackageName = "org.godotengine.plugin.firebase"
11+
12+
android {
13+
namespace = pluginPackageName
14+
compileSdk = 34
15+
16+
buildFeatures {
17+
buildConfig = true
18+
}
19+
20+
defaultConfig {
21+
minSdk = 21
22+
23+
manifestPlaceholders["godotPluginName"] = pluginName
24+
manifestPlaceholders["godotPluginPackageName"] = pluginPackageName
25+
buildConfigField("String", "GODOT_PLUGIN_NAME", "\"${pluginName}\"")
26+
setProperty("archivesBaseName", pluginName)
27+
}
28+
29+
compileOptions {
30+
sourceCompatibility = JavaVersion.VERSION_17
31+
targetCompatibility = JavaVersion.VERSION_17
32+
}
33+
kotlinOptions {
34+
jvmTarget = "17"
35+
}
36+
}
37+
38+
dependencies {
39+
implementation("org.godotengine:godot:4.4.1.stable")
40+
implementation("com.google.firebase:firebase-auth:23.2.0")
41+
implementation("com.google.android.gms:play-services-auth:21.3.0")
42+
implementation("com.google.firebase:firebase-firestore:25.1.4")
43+
implementation("com.google.firebase:firebase-database:21.0.0")
44+
implementation("com.google.firebase:firebase-storage:21.0.1")
45+
}
46+
47+
// BUILD TASKS DEFINITION
48+
val copyDebugAARToDemoAddons by tasks.registering(Copy::class) {
49+
description = "Copies the generated debug AAR binary to the plugin's addons directory"
50+
from("build/outputs/aar")
51+
include("$pluginName-debug.aar")
52+
into("../demo/addons/$pluginName/bin/debug")
53+
}
54+
55+
val copyReleaseAARToDemoAddons by tasks.registering(Copy::class) {
56+
description = "Copies the generated release AAR binary to the plugin's addons directory"
57+
from("build/outputs/aar")
58+
include("$pluginName-release.aar")
59+
into("../demo/addons/$pluginName/bin/release")
60+
}
61+
62+
val cleanDemoAddons by tasks.registering(Delete::class) {
63+
delete("../demo/addons/$pluginName")
64+
}
65+
66+
val copyAddonsToDemo by tasks.registering(Copy::class) {
67+
description = "Copies the export scripts templates to the plugin's addons directory"
68+
69+
dependsOn(cleanDemoAddons)
70+
finalizedBy(copyDebugAARToDemoAddons)
71+
finalizedBy(copyReleaseAARToDemoAddons)
72+
73+
from("export_scripts_template")
74+
into("../demo/addons/$pluginName")
75+
}
76+
77+
tasks.named("assemble").configure {
78+
finalizedBy(copyAddonsToDemo)
79+
}
80+
81+
tasks.named<Delete>("clean").apply {
82+
dependsOn(cleanDemoAddons)
83+
}
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
extends Node
2+
3+
var auth = preload("res://addons/GodotFirebaseAndroid/modules/Auth.gd").new()
4+
var firestore = preload("res://addons/GodotFirebaseAndroid/modules/Firestore.gd").new()
5+
var realtimeDB = preload("res://addons/GodotFirebaseAndroid/modules/RealtimeDB.gd").new()
6+
var storage = preload("res://addons/GodotFirebaseAndroid/modules/Storage.gd").new()
7+
8+
func _ready() -> void:
9+
if Engine.has_singleton("GodotFirebaseAndroid"):
10+
var _plugin_singleton = Engine.get_singleton("GodotFirebaseAndroid")
11+
12+
auth._plugin_singleton = _plugin_singleton
13+
auth._connect_signals()
14+
15+
firestore._plugin_singleton = _plugin_singleton
16+
firestore._connect_signals()
17+
18+
realtimeDB._plugin_singleton = _plugin_singleton
19+
realtimeDB._connect_signals()
20+
21+
storage._plugin_singleton = _plugin_singleton
22+
storage._connect_signals()
23+
else:
24+
if not OS.has_feature("editor"):
25+
printerr("GodotFirebaseAndroid singleton not found!")
26+
return
27+

0 commit comments

Comments
 (0)