Meshtastic-Android/build-logic/convention/src/main/kotlin/AndroidApplicationDatadogConventionPlugin.kt
James Rich e3dd4325fd
fix(build): apply Datadog and Firebase plugins _only_ to google flavor (#3240)
Signed-off-by: James Rich <2199651+jamesarich@users.noreply.github.com>
2025-09-29 16:51:07 +00:00

42 lines
1.6 KiB
Kotlin

/*
* Copyright (c) 2025 Meshtastic LLC
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
import com.android.build.api.dsl.ApplicationExtension
import com.geeksville.mesh.buildlogic.libs
import org.gradle.api.Plugin
import org.gradle.api.Project
import org.gradle.kotlin.dsl.apply
import org.gradle.kotlin.dsl.configure
import org.gradle.kotlin.dsl.dependencies
/**
* Convention plugin to apply and configure Datadog for Android applications.
* This plugin should only be applied to variants that require Datadog integration (e.g., 'google' flavor).
*/
class AndroidApplicationDatadogConventionPlugin : Plugin<Project> {
override fun apply(target: Project) {
with(target) {
extensions.configure<ApplicationExtension> {
apply(plugin = libs.findPlugin("datadog").get().get().pluginId)
dependencies {
"googleImplementation"(libs.findBundle("datadog").get())
}
}
}
}
}