|
| 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 | +} |
0 commit comments