mirror of
https://github.com/d4rken-org/capod.git
synced 2026-09-14 18:26:11 -04:00
Remove bugsnag
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
import com.android.build.api.dsl.Packaging
|
||||
import com.android.build.gradle.LibraryExtension
|
||||
import org.gradle.api.Action
|
||||
import org.gradle.api.JavaVersion
|
||||
@@ -83,7 +84,7 @@ fun LibraryExtension.setupLibraryDefaults() {
|
||||
)
|
||||
}
|
||||
|
||||
packagingOptions {
|
||||
fun Packaging.() {
|
||||
resources.excludes += "DebugProbesKt.bin"
|
||||
}
|
||||
}
|
||||
@@ -116,39 +117,3 @@ fun com.android.build.api.dsl.SigningConfig.setupCredentials(
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fun getBugSnagApiKey(
|
||||
propertiesPath: File?
|
||||
): String? {
|
||||
val bugsnagProps = Properties().apply {
|
||||
propertiesPath?.takeIf { it.canRead() }?.let { load(FileInputStream(it)) }
|
||||
}
|
||||
|
||||
return System.getenv("BUGSNAG_API_KEY") ?: bugsnagProps.getProperty("bugsnag.apikey")
|
||||
}
|
||||
|
||||
/**
|
||||
* Use extra["useBugsnag"] = true per flavor to enable
|
||||
*/
|
||||
fun <T> T.setupBugsnagPlugin() where T : Project {
|
||||
fun Project.`android`(configure: Action<com.android.build.gradle.internal.dsl.BaseAppModuleExtension>): Unit =
|
||||
(this as org.gradle.api.plugins.ExtensionAware).extensions.configure("android", configure)
|
||||
|
||||
val key = "useBugsnag"
|
||||
|
||||
android {
|
||||
productFlavors {
|
||||
forEach {
|
||||
val paramString = gradle.startParameter.taskRequests.toString().toLowerCase(Locale.ROOT)
|
||||
val useBugsnag = if (it.extra.has(key)) it.extra[key] as Boolean else false
|
||||
|
||||
if (paramString.contains(it.name) && useBugsnag) {
|
||||
println("Bugsnag plugin (com.bugsnag.android.gradle) applied to ${it.name} ($paramString)")
|
||||
apply(plugin = "com.bugsnag.android.gradle")
|
||||
} else {
|
||||
println("Bugsnag plugin (com.bugsnag.android.gradle) NOT applied to ${it.name} ($paramString)")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user