Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- final File fabricFile = file("fabric.properties")
- afterEvaluate {
- android.applicationVariants.all { variant ->
- final String variantName = variant.getName().capitalize()
- final Task targetTask = tasks["process${variantName}Manifest"]
- if (fabricTask != null) {
- final Task generateFabricFile = task("generateFabricFile$variantName") {
- doLast {
- String fabricApiSecret = 'verySecretApiSecretForEveryoneGuessItsNotThatSecret'
- String fabricApiKey = 'veryKeyApiKeyForEveryone'
- if (variantName.equalsIgnoreCase("DifferentClientDebug") || variantName.equalsIgnoreCase("DifferentClientRelease")) {
- fabricApiSecret = 'verySecretApiSecretForDifferentClient'
- fabricApiKey = 'veryKeyApiKeyForDifferentClient'
- }
- if (fabricFile.exists()) {
- println "Deleting previous configuration File for Fabric (variant: $variantName)"
- fabricFile.delete()
- }
- println '*** FABRIC DATA ***'
- println "apiSecret=$fabricApiSecret"
- println "apiKey=$fabricApiKey"
- println '*******************'
- def commentMessage = "Autogenerated Fabric properties for Crashlytics"
- ant.propertyfile(file: fabricFile, comment: commentMessage) {
- entry(key: "apiSecret", value: fabricApiSecret)
- entry(key: "apiKey", value: fabricApiKey)
- }
- }
- }
- targetTask.dependsOn generateFabricFile
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement