Advertisement
Guest User

Untitled

a guest
Oct 24th, 2016
52
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.09 KB | None | 0 0
  1. flavorDimensions 'brand'
  2. productFlavors {
  3.  
  4. brand1 {
  5. dimension 'brand'
  6. ...
  7. buildConfigField "String", "BASE_URL", ""http://brand.one.api/""
  8. ...
  9. }
  10.  
  11. brand2 {
  12. dimension 'brand'
  13. ...
  14. buildConfigField "String", "BASE_URL", ""http://brand.two.api/""
  15. ...
  16. }
  17. }
  18.  
  19. android.applicationVariants.all { variant ->
  20. if (variant.getName() ==~ /brand1Api[0-9]{2}Staging.*/) {
  21. variant.buildConfigField "String", "BASE_URL", ""http://brand.one.staging.api//""
  22. } else if(variant.getName() ==~ /brand1Api[0-9]{2}Production.*/){
  23. variant.buildConfigField "String", "BASE_URL", ""http://brand.one.production.api/""
  24. } else if(variant.getName() ==~ /brand2Api[0-9]{2}Staging.*/) {
  25. variant.buildConfigField "String", "BASE_URL", ""http://brand.two.staging.api//""
  26. } else if(variant.getName() ==~ /brand2Api[0-9]{2}Production.*/){
  27. variant.buildConfigField "String", "BASE_URL", ""http://brand.two.production.api/""
  28. } else {
  29. throw new Exception("Unexpected variant name: " + variant.getName())
  30. }
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement