build.gradle 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129
  1. import java.text.SimpleDateFormat
  2. import java.time.LocalDateTime
  3. plugins {
  4. id 'com.android.application'
  5. id 'kotlin-android'
  6. id 'kotlin-kapt'
  7. }
  8. static int formatTime() {
  9. LocalDateTime now = LocalDateTime.now()
  10. int year = now.year % 100 // 取年份的最后两位
  11. int month = now.monthValue
  12. int day = now.dayOfMonth
  13. int hour = now.hour
  14. int randomNumber = new Random().nextInt(10) // 生成0到9之间的随机数
  15. return Integer.parseInt(String.format("%02d%02d%02d%02d%d", year, month, day, hour, randomNumber))
  16. }
  17. ext{
  18. versionCode=Integer.parseInt(new SimpleDateFormat("yyMMddHH").format(new Date()) + 1)
  19. brandCode="034A"
  20. brandVersionCode=versionCode
  21. model="3015"
  22. }
  23. android {
  24. compileSdk 31
  25. defaultConfig {
  26. applicationId "com.develop.foodcooking"
  27. minSdk 21
  28. targetSdk 26
  29. versionCode project.ext.versionCode
  30. versionName "${project.ext.model}.${project.ext.brandCode}.${project.ext.versionCode}"
  31. archivesBaseName = "cofar-cooking_${versionName}"
  32. testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
  33. javaCompileOptions {
  34. annotationProcessorOptions {
  35. arguments = ["room.schemaLocation": "$projectDir/schemas".toString()]
  36. }
  37. }
  38. kapt {
  39. arguments {
  40. arg("AROUTER_MODULE_NAME", project.getName())
  41. arg("room.schemaLocation", "$projectDir/schemas".toString())
  42. }
  43. }
  44. }
  45. flavorDimensions "platform"
  46. productFlavors {
  47. brandDefault {
  48. dimension "platform"
  49. applicationId "com.develop.foodcooking"
  50. buildConfigField("String", "UpdatePlatform", "\"normal\"")
  51. resValue("string", "app_theme", "@style/SplashTheme")
  52. }
  53. brand034 {
  54. dimension "platform"
  55. applicationId "com.develop.foodcooking"
  56. buildConfigField("String", "UpdatePlatform", "\"night\"")
  57. resValue("string", "app_theme", "@style/Splash034Theme")
  58. }
  59. }
  60. signingConfigs {
  61. debug {
  62. storeFile file('..\\signature\\rk.jks')
  63. storePassword '123456'
  64. keyAlias 'rk'
  65. keyPassword '123456'
  66. }
  67. foodCooking {
  68. storeFile file("..\\signature\\rk.jks")
  69. storePassword '123456'
  70. keyAlias 'rk'
  71. keyPassword '123456'
  72. }
  73. release {
  74. storeFile file('..\\signature\\rk.jks')
  75. storePassword '123456'
  76. keyAlias 'rk'
  77. keyPassword '123456'
  78. }
  79. }
  80. buildTypes {
  81. release {
  82. minifyEnabled false
  83. productFlavors.brand034.signingConfig signingConfigs.release
  84. productFlavors.brandDefault.signingConfig signingConfigs.release
  85. proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
  86. }
  87. }
  88. compileOptions {
  89. sourceCompatibility JavaVersion.VERSION_1_8
  90. targetCompatibility JavaVersion.VERSION_1_8
  91. }
  92. kotlinOptions {
  93. jvmTarget = '1.8'
  94. }
  95. viewBinding {
  96. enabled = true
  97. }
  98. }
  99. dependencies {
  100. implementation project(path: ':libBase')
  101. implementation project(path: ':BusinessRouter')
  102. implementation project(path: ':BusinessAuth')
  103. implementation project(path: ':BusinessSetting')
  104. implementation project(path: ':BusinessMain')
  105. implementation project(path: ':BusinessStep')
  106. kapt 'com.alibaba:arouter-compiler:1.5.1'
  107. }