build.gradle.kts 2.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. import java.util.Properties
  2. plugins {
  3. id("com.android.application")
  4. id("kotlin-android")
  5. // The Flutter Gradle Plugin must be applied after the Android and Kotlin Gradle plugins.
  6. id("dev.flutter.flutter-gradle-plugin")
  7. }
  8. val releaseSigningPropertiesPath = System.getenv("RACKPEEK_ANDROID_SIGNING_PROPERTIES")
  9. val releaseSigningProperties = Properties()
  10. if (releaseSigningPropertiesPath != null) {
  11. val releaseSigningPropertiesFile = file(releaseSigningPropertiesPath)
  12. require(releaseSigningPropertiesFile.isFile) {
  13. "RACKPEEK_ANDROID_SIGNING_PROPERTIES must point to an existing properties file."
  14. }
  15. releaseSigningPropertiesFile.inputStream().use(releaseSigningProperties::load)
  16. }
  17. android {
  18. namespace = "com.rackpeek.rackpeekMobile"
  19. compileSdk = flutter.compileSdkVersion
  20. ndkVersion = flutter.ndkVersion
  21. compileOptions {
  22. sourceCompatibility = JavaVersion.VERSION_17
  23. targetCompatibility = JavaVersion.VERSION_17
  24. }
  25. kotlinOptions {
  26. jvmTarget = JavaVersion.VERSION_17.toString()
  27. }
  28. defaultConfig {
  29. // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
  30. applicationId = "com.rackpeek.rackpeekMobile"
  31. // You can update the following values to match your application needs.
  32. // For more information, see: https://flutter.dev/to/review-gradle-config.
  33. minSdk = flutter.minSdkVersion
  34. targetSdk = flutter.targetSdkVersion
  35. versionCode = flutter.versionCode
  36. versionName = flutter.versionName
  37. }
  38. signingConfigs {
  39. if (releaseSigningPropertiesPath != null) {
  40. create("release") {
  41. keyAlias = releaseSigningProperties.getProperty("keyAlias")
  42. ?: error("Missing keyAlias in Android signing properties.")
  43. keyPassword = releaseSigningProperties.getProperty("keyPassword")
  44. ?: error("Missing keyPassword in Android signing properties.")
  45. storeFile = file(
  46. releaseSigningProperties.getProperty("storeFile")
  47. ?: error("Missing storeFile in Android signing properties.")
  48. )
  49. storePassword = releaseSigningProperties.getProperty("storePassword")
  50. ?: error("Missing storePassword in Android signing properties.")
  51. }
  52. }
  53. }
  54. buildTypes {
  55. release {
  56. signingConfig = if (releaseSigningPropertiesPath == null) {
  57. signingConfigs.getByName("debug")
  58. } else {
  59. signingConfigs.getByName("release")
  60. }
  61. }
  62. }
  63. }
  64. flutter {
  65. source = "../.."
  66. }