build.gradle 2.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. plugins {
  2. id 'com.android.application'
  3. id 'org.jetbrains.kotlin.android'
  4. }
  5. def getVersionCode = { ->
  6. try {
  7. def stdout = new ByteArrayOutputStream()
  8. exec {
  9. commandLine 'git', 'rev-list', '--first-parent', '--count', 'master'
  10. standardOutput = stdout
  11. }
  12. return Integer.parseInt(stdout.toString().trim())
  13. }
  14. catch (ignored) {
  15. return -1;
  16. }
  17. }
  18. def getVersionName = { ->
  19. try {
  20. def stdout = new ByteArrayOutputStream()
  21. exec {
  22. commandLine 'git', 'describe', '--always', '--tags', '--dirty'
  23. standardOutput = stdout
  24. }
  25. return stdout.toString().trim()
  26. }
  27. catch (ignored) {
  28. return null;
  29. }
  30. }
  31. // Signing config, mainly intended for debug builds
  32. def keystorePropertiesFile = rootProject.file("keystore.properties");
  33. def keystoreProperties = new Properties()
  34. keystoreProperties.load(new FileInputStream(keystorePropertiesFile))
  35. android {
  36. compileSdk 34
  37. defaultConfig {
  38. applicationId "im.angry.openeuicc"
  39. minSdk 30
  40. targetSdk 31
  41. versionCode getVersionCode()
  42. versionName getVersionName()
  43. testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
  44. }
  45. signingConfigs {
  46. config {
  47. storeFile file(keystoreProperties['storeFile'])
  48. storePassword keystoreProperties['storePassword']
  49. keyAlias keystoreProperties['keyAlias']
  50. keyPassword keystoreProperties['keyPassword']
  51. }
  52. }
  53. buildTypes {
  54. release {
  55. minifyEnabled false
  56. proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
  57. signingConfig signingConfigs.config
  58. }
  59. debug {
  60. signingConfig signingConfigs.config
  61. }
  62. }
  63. applicationVariants.all { variant ->
  64. if (variant.name == "debug") {
  65. variant.outputs.each { o -> o.versionCodeOverride = System.currentTimeSeconds() }
  66. }
  67. }
  68. compileOptions {
  69. sourceCompatibility JavaVersion.VERSION_1_8
  70. targetCompatibility JavaVersion.VERSION_1_8
  71. }
  72. kotlinOptions {
  73. jvmTarget = '1.8'
  74. }
  75. namespace 'im.angry.openeuicc'
  76. }
  77. dependencies {
  78. compileOnly project(':libs:hidden-apis-stub')
  79. implementation project(':libs:hidden-apis-shim')
  80. implementation project(':libs:lpac-jni')
  81. implementation project(":app-common")
  82. implementation 'androidx.appcompat:appcompat:1.6.1'
  83. testImplementation 'junit:junit:4.13.2'
  84. androidTestImplementation 'androidx.test.ext:junit:1.1.3'
  85. androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
  86. }