configs.gradle 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. ext {
  2. // 测试服
  3. def SERVER_TYPE_TEST = "test"
  4. // 预发布服
  5. def SERVER_TYPE_PREVIEW = "pre"
  6. // 正式服
  7. def SERVER_TYPE_PRODUCT = "product"
  8. def taskName = project.gradle.startParameter.taskNames[0]
  9. if (taskName == null) {
  10. taskName = ""
  11. }
  12. // 打印当前执行的任务名称
  13. println "GradleLog TaskNameOutput " + taskName
  14. def serverType = SERVER_TYPE_PRODUCT
  15. if (taskName.endsWith("Debug")) {
  16. serverType = SERVER_TYPE_TEST
  17. } else if (taskName.endsWith("Preview")) {
  18. serverType = SERVER_TYPE_PREVIEW
  19. }
  20. // 从 Gradle 命令中读取参数配置,例如:./gradlew assembleRelease -P ServerType="test"
  21. if (project.hasProperty("ServerType")) {
  22. serverType = project.properties["ServerType"]
  23. }
  24. // 打印当前服务器配置
  25. println "GradleLog ServerTypeOutput " + serverType
  26. // 友盟 AppKey
  27. UMENG_APP_KEY = "5cb16d93570df399fd0014e2"
  28. // QQ AppId
  29. QQ_APP_ID = "101828096"
  30. // QQ Secret
  31. QQ_APP_SECRET = "9dfd3300c3aa3c4596a07796c64914b2"
  32. // 微信 AppId
  33. WX_APP_ID = "wxd35706cc9f46114c"
  34. // 微信 Secret
  35. WX_APP_SECRET = "0c8c7cf831dd135a32b3e395ea459b5a"
  36. switch (serverType) {
  37. case SERVER_TYPE_TEST:
  38. case SERVER_TYPE_PREVIEW:
  39. LOG_ENABLE = true
  40. BUGLY_ID = "请自行替换 Bugly 上面的 AppID"
  41. if (serverType == SERVER_TYPE_PREVIEW) {
  42. HOST_URL = "https://weiliao.woaidakele.cn"
  43. } else {
  44. HOST_URL = "https://weiliao.woaidakele.cn"
  45. }
  46. break
  47. case SERVER_TYPE_PRODUCT:
  48. LOG_ENABLE = false
  49. BUGLY_ID = "请自行替换 Bugly 上面的 AppID"
  50. HOST_URL = "https://weiliao.woaidakele.cn"
  51. break
  52. }
  53. }