config.gradle 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  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. switch(serverType) {
  27. case SERVER_TYPE_TEST:
  28. case SERVER_TYPE_PREVIEW:
  29. LOG_DEBUG = true
  30. BUGLY_ID = "c27876500b"
  31. if (serverType == SERVER_TYPE_PREVIEW) {
  32. SERVER_HOST = "https://wx.hzliuzhi.com:4433"
  33. } else {
  34. SERVER_HOST = "https://wx.hzliuzhi.com:4433"
  35. }
  36. break
  37. case SERVER_TYPE_PRODUCT:
  38. LOG_DEBUG = false
  39. BUGLY_ID = "c27876500b"
  40. SERVER_HOST = "http://8.139.252.178:8001"
  41. break
  42. }
  43. build = [
  44. //签名信息
  45. signingConfig : {
  46. storeFile file('./decoct.jks')
  47. storePassword 'decoct2024'
  48. keyAlias 'decoct.keystore'
  49. keyPassword 'decoct2024'
  50. v1SigningEnabled true
  51. v2SigningEnabled true
  52. }
  53. ]
  54. android = [
  55. compileSdkVersion: 31,
  56. buildToolsVersion: "30.0.3",
  57. minSdkVersion : 21,
  58. targetSdkVersion : 31,
  59. versionCode : 1,
  60. versionName : "1.0.0",
  61. ]
  62. version = [
  63. androidXSdkVersion : "1.3.0",
  64. constraintlayoutVersion: "2.0.3",
  65. retrofitSdkVersion : "2.4.0",
  66. okhttpSdkVersion : "3.12.0",
  67. rxandroid2SdkVersion : "2.1.1",
  68. rxjava2SdkVersion : "2.2.19",
  69. rxpermissionsSdkVersion: "0.10.2",
  70. eventbusSdkVersion : "3.1.1",
  71. butterknifeSdkVersion : "10.1.0",
  72. glideSdkVersion : "4.12.0",
  73. multidexSdkVersion : "2.0.1",
  74. rxlifecycleSdkVersion : "3.1.0",
  75. testEspressoSdkVersion : "3.3.0",
  76. testExtSdkVersion : "1.1.2"
  77. ]
  78. dependencies = [
  79. //androidx
  80. "appcompat" : "androidx.appcompat:appcompat:${version["androidXSdkVersion"]}",
  81. "design" : "com.google.android.material:material:${version["androidXSdkVersion"]}",
  82. "legacy-support-v4" : "androidx.legacy:legacy-support-v4:1.0.0",
  83. "cardview" : "androidx.cardview:cardview:1.0.0",
  84. "annotations" : "androidx.annotation:annotation:${version["androidXSdkVersion"]}",
  85. "recyclerview" : "androidx.recyclerview:recyclerview:${version["androidXSdkVersion"]}",
  86. "constraintlayout" : "androidx.constraintlayout:constraintlayout:${version["constraintlayoutVersion"]}",
  87. //network
  88. "retrofit" : "com.squareup.retrofit2:retrofit:${version["retrofitSdkVersion"]}",
  89. "retrofit-converter-gson" : "com.squareup.retrofit2:converter-gson:${version["retrofitSdkVersion"]}",
  90. "retrofit-adapter-rxjava2" : "com.squareup.retrofit2:adapter-rxjava2:${version["retrofitSdkVersion"]}",
  91. "okhttp3" : "com.squareup.okhttp3:okhttp:${version["okhttpSdkVersion"]}",
  92. "okhttp3-logging-interceptor": "com.squareup.okhttp3:logging-interceptor:${version["okhttpSdkVersion"]}",
  93. "glide" : "com.github.bumptech.glide:glide:${version["glideSdkVersion"]}",
  94. "glide-compiler" : "com.github.bumptech.glide:compiler:${version["glideSdkVersion"]}",
  95. "glide-loader-okhttp3" : "com.github.bumptech.glide:okhttp3-integration:${version["glideSdkVersion"]}",
  96. //view
  97. "butterknife" : "com.jakewharton:butterknife:${version["butterknifeSdkVersion"]}",
  98. "butterknife-compiler" : "com.jakewharton:butterknife-compiler:${version["butterknifeSdkVersion"]}",
  99. "vlayout" : "com.alibaba.android:vlayout:1.2.6@aar",
  100. "autosize" : "me.jessyan:autosize:1.2.1",
  101. "multidex" : "androidx.multidex:multidex:${version["multidexSdkVersion"]}",
  102. //rx2
  103. "rxandroid2" : "io.reactivex.rxjava2:rxandroid:${version["rxandroidSdkVersion"]}",
  104. "rxjava2" : "io.reactivex.rxjava2:rxjava:${version["rxjavaSdkVersion"]}",
  105. "rxpermissions" : "com.github.tbruyelle:rxpermissions:${version["rxpermissionsSdkVersion"]}",
  106. "rxlifecycle" : "com.trello.rxlifecycle3:rxlifecycle:${version["rxlifecycleSdkVersion"]}",
  107. "rxlifecycle-android" : "com.trello.rxlifecycle3:rxlifecycle-android:${version["rxlifecycleSdkVersion"]}",
  108. "rxlifecycle-components" : "com.trello.rxlifecycle3:rxlifecycle-components:${version["rxlifecycleSdkVersion"]}",
  109. "eventbus" : "org.greenrobot:eventbus:${version["eventbusSdkVersion"]}",
  110. "eventbus-compiler" : "org.greenrobot:eventbus-annotation-processor:${version["eventbusSdkVersion"]}",
  111. "arouter" : "com.alibaba:arouter-api:1.3.1",
  112. "arouter-compiler" : "com.alibaba:arouter-compiler:1.1.4",
  113. "progressmanager" : "me.jessyan:progressmanager:1.5.0",
  114. "retrofit-url-manager" : "me.jessyan:retrofit-url-manager:1.4.0",
  115. "junit" : "junit:junit:4.12",
  116. "androidTestExt" : "androidx.test.ext:junit:${version["testExtSdkVersion"]}",
  117. "androidTestEspresso" : "androidx.test.espresso:espresso-core:${version["testEspressoSdkVersion"]}"
  118. ]
  119. }