build.gradle 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150
  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. packagingOptions {
  45. pickFirst 'lib/armeabi-v7a/libc++_shared.so'
  46. }
  47. }
  48. flavorDimensions "platform"
  49. productFlavors {
  50. brandDefault {
  51. dimension "platform"
  52. applicationId "com.develop.foodcooking"
  53. buildConfigField("String", "UpdatePlatform", "\"normal\"")
  54. resValue("string", "app_theme", "@style/SplashTheme")
  55. }
  56. brand000ATuya {
  57. dimension "platform"
  58. applicationId "com.develop.foodcooking"
  59. buildConfigField("String", "UpdatePlatform", "\"normal\"")
  60. resValue("string", "app_theme", "@style/SplashTheme")
  61. }
  62. brand034 {
  63. dimension "platform"
  64. applicationId "com.develop.foodcooking"
  65. buildConfigField("String", "UpdatePlatform", "\"night\"")
  66. resValue("string", "app_theme", "@style/Splash034Theme")
  67. }
  68. brand012ATuya {
  69. dimension "platform"
  70. applicationId "com.develop.foodcooking"
  71. buildConfigField("String", "UpdatePlatform", "\"normal\"")
  72. resValue("string", "app_theme", "@style/SplashTheme")
  73. }
  74. }
  75. signingConfigs {
  76. debug {
  77. storeFile file('..\\signature\\rk.jks')
  78. storePassword '123456'
  79. keyAlias 'rk'
  80. keyPassword '123456'
  81. }
  82. foodCooking {
  83. storeFile file("..\\signature\\rk.jks")
  84. storePassword '123456'
  85. keyAlias 'rk'
  86. keyPassword '123456'
  87. }
  88. release {
  89. storeFile file('..\\signature\\rk.jks')
  90. storePassword '123456'
  91. keyAlias 'rk'
  92. keyPassword '123456'
  93. }
  94. }
  95. buildTypes {
  96. release {
  97. debuggable true
  98. minifyEnabled false
  99. productFlavors.brand034.signingConfig signingConfigs.release
  100. productFlavors.brand000ATuya.signingConfig signingConfigs.release
  101. productFlavors.brand012ATuya.signingConfig signingConfigs.release
  102. productFlavors.brandDefault.signingConfig signingConfigs.release
  103. proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
  104. }
  105. }
  106. compileOptions {
  107. sourceCompatibility JavaVersion.VERSION_1_8
  108. targetCompatibility JavaVersion.VERSION_1_8
  109. }
  110. kotlinOptions {
  111. jvmTarget = '1.8'
  112. }
  113. viewBinding {
  114. enabled = true
  115. }
  116. }
  117. dependencies {
  118. implementation project(path: ':libBase')
  119. implementation project(path: ':BusinessRouter')
  120. implementation project(path: ':BusinessAuth')
  121. implementation project(path: ':BusinessSetting')
  122. implementation project(path: ':BusinessMain')
  123. implementation project(path: ':BusinessStep')
  124. kapt 'com.alibaba:arouter-compiler:1.5.1'
  125. }