plugins {
  id "com.android.application"
  id "com.github.triplet.play" version "3.4.0"
}

description = """
"${project.name}" implements the accessibility service for "${rootProject.name}" on Android.
"""

apply from: "brltty-config.gradle"
apply from: "brltty-assets.gradle"

dependencies {
  implementation project(":core")
  implementation "androidx.core:core:1.5.0"
}

android {
  compileSdkVersion "android-34"
  buildToolsVersion "29.0.3"

//ndkVersion "21.4.7075529" // r21e - LTS
//ndkVersion "22.1.7171670" // r22b - stable

  compileOptions {
    sourceCompatibility JavaVersion.VERSION_1_7
    targetCompatibility JavaVersion.VERSION_1_7
  }

  lintOptions {
    warning "MissingTranslation"
    error "Untranslatable"
  }

  defaultConfig {
    targetSdkVersion 34
    minSdkVersion 16

    versionName brltty.config.versionName
    versionCode brltty.config.versionCode as int

    ndk {
      splits {
        abi {
          enable true
          universalApk true
          reset()

          brltty.native.abiList.each { abi ->
            include abi
          }
        }
      }
    }
  }

  signingConfigs {
    release {
      def signingProperties = brltty.loadProperties("credentials/sign-gradle.properties")
      storeFile     signingProperties.storeFile
      storePassword signingProperties.storePassword
      keyAlias      signingProperties.keyAlias
      keyPassword   signingProperties.keyPassword
    }
  }

  buildTypes {
    debug {
      ndk {
        abiFilters "armeabi-v7a"
      }
    }

    release {
      signingConfig signingConfigs.release

      minifyEnabled false
      proguardFile getDefaultProguardFile("proguard-android.txt")

      ndk {
        debugSymbolLevel "FULL" // FULL, SYMBOL_TABLE
      }
    }
  }

  play {
    track = "production" // internal, alpha, beta, production
    defaultToAppBundles = true
    serviceAccountCredentials = rootProject.file("credentials/publish-play.json")
  }
}
