星火管控
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

build.gradle.kts 5.0KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156
  1. @file:Suppress("CAST_NEVER_SUCCEEDS")
  2. import java.text.SimpleDateFormat
  3. import java.util.Date
  4. @Suppress("DSL_SCOPE_VIOLATION") // TODO: Remove once KTIJ-19369 is fixed
  5. plugins {
  6. alias(libs.plugins.androidApplication)
  7. alias(libs.plugins.kotlinAndroid)
  8. }
  9. android {
  10. namespace = "com.xhkjedu.manageapp"
  11. compileSdk = 34
  12. defaultConfig {
  13. applicationId = "com.xhkjedu.manageapp"
  14. minSdk = 24
  15. targetSdk = 30
  16. versionCode = 7
  17. versionName = "1.0.6"
  18. testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
  19. vectorDrawables {
  20. useSupportLibrary = true
  21. }
  22. ndk{
  23. abiFilters += listOf("armeabi","armeabi-v7a","arm64-v8a","x86","x86_64")
  24. }
  25. }
  26. viewBinding{
  27. enable=true
  28. }
  29. signingConfigs {
  30. create("keystore") {
  31. keyAlias = "xinghuo"
  32. keyPassword = "xhkjedu"
  33. storeFile = file("xinghuo.keystore")
  34. storePassword = "xhkjedu"
  35. }
  36. }
  37. buildTypes {
  38. /* release {
  39. isMinifyEnabled = false
  40. proguardFiles(
  41. getDefaultProguardFile("proguard-android-optimize.txt"),
  42. "proguard-rules.pro"
  43. )
  44. }*/
  45. val signConfig=signingConfigs.getByName("keystore")
  46. getByName("release") {
  47. isMinifyEnabled = false
  48. proguardFiles(
  49. getDefaultProguardFile("proguard-android-optimize.txt"),
  50. "proguard-rules.pro"
  51. )
  52. signingConfig=signConfig
  53. }
  54. getByName("debug") {
  55. isMinifyEnabled = false
  56. proguardFiles(
  57. getDefaultProguardFile("proguard-android-optimize.txt"),
  58. "proguard-rules.pro"
  59. )
  60. signingConfig=signConfig
  61. }
  62. }
  63. compileOptions {
  64. sourceCompatibility = JavaVersion.VERSION_1_8
  65. targetCompatibility = JavaVersion.VERSION_1_8
  66. }
  67. kotlinOptions {
  68. jvmTarget = "1.8"
  69. }
  70. buildFeatures {
  71. compose = true
  72. }
  73. composeOptions {
  74. kotlinCompilerExtensionVersion = "1.4.3"
  75. }
  76. packaging {
  77. resources {
  78. excludes += "/META-INF/{AL2.0,LGPL2.1}"
  79. }
  80. }
  81. lint {
  82. abortOnError=false
  83. }
  84. fun releaseTime(): String {
  85. val dateFormat = SimpleDateFormat("yyyyMMdd")
  86. return dateFormat.format(Date())
  87. }
  88. /* android.applicationVariants.all {variant->
  89. variant.outputs.all {output->
  90. val versionName = variant.versionName
  91. val versionCode = variant.versionCode
  92. val variantName = variant.name
  93. val apkName = "Manage_App-$variantName-$versionName-$versionCode-${releaseTime()}.apk"
  94. *//* output.outputFile.renameTo(File(output.outputFile.parentFile,apkName))*//*
  95. val outputImpl = output as com.android.build.gradle.internal.api.BaseVariantOutputImpl
  96. outputImpl.outputFileName=apkName
  97. true
  98. }
  99. }*/
  100. applicationVariants.all(
  101. object : Action<com.android.build.gradle.api.ApplicationVariant> {
  102. override fun execute(variant: com.android.build.gradle.api.ApplicationVariant) {
  103. println("variant: $variant")
  104. variant.outputs.all(
  105. object : Action<com.android.build.gradle.api.BaseVariantOutput> {
  106. override fun execute(
  107. output: com.android.build.gradle.api.BaseVariantOutput
  108. ) {
  109. val versionName = variant.versionName
  110. val versionCode = variant.versionCode
  111. val variantName = variant.name
  112. val outputImpl = output as com.android.build.gradle.internal.api.BaseVariantOutputImpl
  113. val fileName = "Manage_App-$variantName-$versionName-$versionCode-${releaseTime()}.apk"
  114. println("output file name: $fileName")
  115. outputImpl.outputFileName = fileName
  116. }
  117. }
  118. )
  119. }
  120. }
  121. )
  122. }
  123. dependencies {
  124. implementation(libs.core.ktx)
  125. implementation(libs.lifecycle.runtime.ktx)
  126. implementation(libs.activity.compose)
  127. implementation(platform(libs.compose.bom))
  128. implementation(libs.ui)
  129. implementation(libs.ui.graphics)
  130. implementation(libs.ui.tooling.preview)
  131. implementation(libs.material3)
  132. implementation(libs.appcompat)
  133. implementation(libs.androidx.recyclerview)
  134. implementation(project(mapOf("path" to ":websocket")))
  135. implementation(libs.androidx.cardview)
  136. testImplementation(libs.junit)
  137. implementation("com.baidu.lbsyun:BaiduMapSDK_Location_All:9.3.7")
  138. androidTestImplementation(libs.androidx.test.ext.junit)
  139. androidTestImplementation(libs.espresso.core)
  140. androidTestImplementation(platform(libs.compose.bom))
  141. androidTestImplementation(libs.ui.test.junit4)
  142. debugImplementation(libs.ui.tooling)
  143. debugImplementation(libs.ui.test.manifest)
  144. }