Advertisement
Guest User

Untitled

a guest
Jul 4th, 2015
246
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.71 KB | None | 0 0
  1. final File fabricFile = file("fabric.properties")
  2.  
  3. afterEvaluate {
  4. android.applicationVariants.all { variant ->
  5. final String variantName = variant.getName().capitalize()
  6. final Task targetTask = tasks["process${variantName}Manifest"]
  7. if (fabricTask != null) {
  8. final Task generateFabricFile = task("generateFabricFile$variantName") {
  9. doLast {
  10. String fabricApiSecret = 'verySecretApiSecretForEveryoneGuessItsNotThatSecret'
  11. String fabricApiKey = 'veryKeyApiKeyForEveryone'
  12.  
  13. if (variantName.equalsIgnoreCase("DifferentClientDebug") || variantName.equalsIgnoreCase("DifferentClientRelease")) {
  14. fabricApiSecret = 'verySecretApiSecretForDifferentClient'
  15. fabricApiKey = 'veryKeyApiKeyForDifferentClient'
  16. }
  17.  
  18. if (fabricFile.exists()) {
  19. println "Deleting previous configuration File for Fabric (variant: $variantName)"
  20. fabricFile.delete()
  21. }
  22.  
  23. println '*** FABRIC DATA ***'
  24. println "apiSecret=$fabricApiSecret"
  25. println "apiKey=$fabricApiKey"
  26. println '*******************'
  27.  
  28. def commentMessage = "Autogenerated Fabric properties for Crashlytics"
  29.  
  30. ant.propertyfile(file: fabricFile, comment: commentMessage) {
  31. entry(key: "apiSecret", value: fabricApiSecret)
  32. entry(key: "apiKey", value: fabricApiKey)
  33. }
  34. }
  35. }
  36. targetTask.dependsOn generateFabricFile
  37. }
  38. }
  39. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement