build.gradle 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. plugins {
  2. id "com.android.application"
  3. id "kotlin-android"
  4. id "kotlin-parcelize"
  5. }
  6. def keystorePwd = null
  7. def alias = null
  8. def pwd = null
  9. Properties properties
  10. def base64 = System.getenv("LOCAL_PROPERTIES")
  11. if (base64 != null && !base64.isBlank()) {
  12. properties = new Properties()
  13. properties.load(new ByteArrayInputStream(Base64.decoder.decode(base64)))
  14. } else if (project.rootProject.file("local.properties").exists()) {
  15. properties = new Properties()
  16. properties.load(project.rootProject.file("local.properties").newDataInputStream())
  17. }
  18. if (properties != null) {
  19. keystorePwd = properties.getProperty("KEYSTORE_PASS")
  20. alias = properties.getProperty("ALIAS_NAME")
  21. pwd = properties.getProperty("ALIAS_PASS")
  22. }
  23. keystorePwd = keystorePwd ?: System.getenv("KEYSTORE_PASS")
  24. alias = alias ?: System.getenv("ALIAS_NAME")
  25. pwd = pwd ?: System.getenv("ALIAS_PASS")
  26. android {
  27. compileSdkVersion 30
  28. buildToolsVersion "30.0.3"
  29. defaultConfig {
  30. applicationId "io.nekohasekai.sagernet.plugin.relaybaton"
  31. minSdkVersion 21
  32. targetSdkVersion 30
  33. versionCode 2
  34. versionName "0.6.0-ech-1"
  35. }
  36. signingConfigs {
  37. release {
  38. storeFile rootProject.file("release.keystore")
  39. storePassword keystorePwd
  40. keyAlias alias
  41. keyPassword pwd
  42. }
  43. }
  44. buildTypes {
  45. release {
  46. minifyEnabled true
  47. shrinkResources true
  48. proguardFiles getDefaultProguardFile("proguard-android-optimize.txt"), "../plugin/proguard-rules.pro"
  49. signingConfig keystorePwd == null ? signingConfigs.debug : signingConfigs.release
  50. }
  51. }
  52. compileOptions {
  53. sourceCompatibility JavaVersion.VERSION_1_8
  54. targetCompatibility JavaVersion.VERSION_1_8
  55. coreLibraryDesugaringEnabled true
  56. }
  57. kotlinOptions {
  58. jvmTarget = "1.8"
  59. }
  60. packagingOptions {
  61. exclude "/META-INF/*.version"
  62. exclude "/META-INF/*.kotlin_module"
  63. exclude "/META-INF/native-image/**"
  64. exclude "/META-INF/INDEX.LIST"
  65. exclude "DebugProbesKt.bin"
  66. exclude "/kotlin/**"
  67. }
  68. splits {
  69. abi {
  70. enable true
  71. universalApk false
  72. }
  73. }
  74. applicationVariants.all { variant ->
  75. variant.outputs.all { output ->
  76. outputFileName = outputFileName
  77. .replace("rb-", "relaybaton-")
  78. .replace("plugin", "plugin-" + variant.versionName)
  79. .replace("-release", "")
  80. }
  81. }
  82. }
  83. dependencies {
  84. implementation project(":plugin")
  85. coreLibraryDesugaring "com.android.tools:desugar_jdk_libs:1.1.5"
  86. }