build.gradle 2.8 KB

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