2023-08-14 10:48:12 +01:00
|
|
|
plugins {
|
2024-08-24 09:06:54 +01:00
|
|
|
id 'com.android.application' version '8.2.2'
|
|
|
|
id 'org.jetbrains.kotlin.android' version '2.0.0'
|
|
|
|
id 'org.jetbrains.kotlin.plugin.compose' version '2.0.0'
|
|
|
|
id 'org.jetbrains.kotlin.plugin.serialization' version '2.0.0'
|
|
|
|
id 'com.android.library' version '8.2.2' apply false
|
2018-07-26 02:08:28 +01:00
|
|
|
}
|
|
|
|
|
2024-03-22 20:55:59 +00:00
|
|
|
def getVersionCode = { ->
|
|
|
|
try {
|
|
|
|
def stdout = new ByteArrayOutputStream()
|
|
|
|
exec {
|
|
|
|
commandLine 'git', 'rev-list', '--first-parent', '--count', 'master'
|
|
|
|
standardOutput = stdout
|
|
|
|
}
|
|
|
|
return Integer.parseInt(stdout.toString().trim())
|
|
|
|
} catch (ignored) {
|
|
|
|
project.logger.lifecycle("Failed to get rev-list count from git!")
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
def getVersionName = { ->
|
|
|
|
try {
|
|
|
|
def stdout = new ByteArrayOutputStream()
|
|
|
|
exec {
|
|
|
|
commandLine 'git', 'describe', '--tags', '--dirty'
|
|
|
|
standardOutput = stdout
|
|
|
|
}
|
|
|
|
return stdout.toString().trim()
|
|
|
|
} catch (ignored) {
|
|
|
|
project.logger.lifecycle("Failed to get version name tag from git!")
|
|
|
|
return "0.0.0";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2024-08-24 09:06:54 +01:00
|
|
|
// TODO: Remove
|
|
|
|
tasks.register('updateLocales', Exec) {
|
|
|
|
commandLine 'bash', '-c', 'cd tools/make-keyboard-text-py && python3 src/generate.py'
|
|
|
|
}
|
|
|
|
|
|
|
|
preBuild.dependsOn updateLocales
|
|
|
|
|
2018-07-26 02:08:28 +01:00
|
|
|
android {
|
2023-07-06 19:57:49 +01:00
|
|
|
namespace 'org.futo.inputmethod.latin'
|
|
|
|
|
2024-01-11 20:26:38 +00:00
|
|
|
compileSdk 34
|
2018-07-26 02:08:28 +01:00
|
|
|
|
|
|
|
// Required if using classes in android.test.runner
|
|
|
|
useLibrary 'android.test.runner'
|
|
|
|
|
|
|
|
// Required if using classes in android.test.base
|
|
|
|
useLibrary 'android.test.base'
|
|
|
|
|
|
|
|
// Required if using classes in android.test.mock
|
|
|
|
useLibrary 'android.test.mock'
|
|
|
|
|
|
|
|
defaultConfig {
|
2023-07-06 19:57:49 +01:00
|
|
|
minSdk 24
|
2024-01-11 20:26:38 +00:00
|
|
|
targetSdk 34
|
2024-03-22 20:55:59 +00:00
|
|
|
versionName getVersionName()
|
|
|
|
versionCode getVersionCode()
|
2018-07-26 02:08:28 +01:00
|
|
|
|
2023-07-06 19:57:49 +01:00
|
|
|
applicationId 'org.futo.inputmethod.latin'
|
|
|
|
testApplicationId 'org.futo.inputmethod.latin.tests'
|
2018-12-14 03:06:42 +00:00
|
|
|
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
2018-07-26 02:08:28 +01:00
|
|
|
vectorDrawables.useSupportLibrary = false
|
2018-07-26 02:08:35 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
signingConfigs {
|
|
|
|
debug {
|
|
|
|
storeFile file("java/shared.keystore")
|
|
|
|
}
|
2018-07-26 02:08:28 +01:00
|
|
|
}
|
|
|
|
|
2023-08-11 21:03:20 +01:00
|
|
|
final def keystorePropertiesFile = rootProject.file("keystore.properties")
|
|
|
|
def releaseSigning = signingConfigs.debug
|
|
|
|
if (keystorePropertiesFile.exists()) {
|
|
|
|
final def keystoreProperties = new Properties()
|
|
|
|
keystoreProperties.load(new FileInputStream(keystorePropertiesFile))
|
|
|
|
releaseSigning = signingConfigs.create("release") {
|
|
|
|
keyAlias keystoreProperties['keyAlias']
|
|
|
|
keyPassword keystoreProperties['keyPassword']
|
|
|
|
storeFile rootProject.file(keystoreProperties['storeFile'])
|
|
|
|
storePassword keystoreProperties['storePassword']
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
project.logger.lifecycle('keystore.properties not found, APK may not be signed')
|
|
|
|
}
|
|
|
|
|
2023-08-31 20:45:11 +01:00
|
|
|
|
|
|
|
final def crashReportPropertiesFile = rootProject.file("crashreporting.properties")
|
|
|
|
final def crashReportProperties = new Properties()
|
|
|
|
if (crashReportPropertiesFile.exists()) {
|
|
|
|
crashReportProperties.load(new FileInputStream(crashReportPropertiesFile))
|
|
|
|
} else {
|
|
|
|
project.logger.lifecycle('crashreporting.properties not found, crash reporting will be disabled')
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2018-07-26 02:08:28 +01:00
|
|
|
buildTypes {
|
|
|
|
debug {
|
|
|
|
minifyEnabled false
|
2024-01-24 00:09:19 +00:00
|
|
|
shrinkResources false
|
2023-08-11 21:03:20 +01:00
|
|
|
signingConfig signingConfigs.debug
|
2018-07-26 02:08:28 +01:00
|
|
|
}
|
|
|
|
release {
|
2023-12-05 17:21:14 +00:00
|
|
|
minifyEnabled true
|
2024-01-24 00:09:19 +00:00
|
|
|
shrinkResources false
|
2023-12-05 17:21:14 +00:00
|
|
|
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
|
2023-08-11 21:03:20 +01:00
|
|
|
signingConfig releaseSigning
|
2018-07-26 02:08:28 +01:00
|
|
|
}
|
2023-08-31 20:45:11 +01:00
|
|
|
|
|
|
|
buildTypes.each {
|
|
|
|
if (crashReportPropertiesFile.exists()) {
|
|
|
|
it.buildConfigField "boolean", "ENABLE_ACRA", crashReportProperties['acraEnabled']
|
|
|
|
it.buildConfigField "String", "ACRA_URL", crashReportProperties['acraUrl']
|
|
|
|
it.buildConfigField "String", "ACRA_USER", crashReportProperties['acraUser']
|
|
|
|
it.buildConfigField "String", "ACRA_PASSWORD", crashReportProperties['acraPassword']
|
|
|
|
} else {
|
|
|
|
it.buildConfigField "boolean", "ENABLE_ACRA", "false"
|
2023-11-25 07:12:31 +00:00
|
|
|
it.buildConfigField "String", "ACRA_URL", "\"\""
|
|
|
|
it.buildConfigField "String", "ACRA_USER", "\"\""
|
|
|
|
it.buildConfigField "String", "ACRA_PASSWORD", "\"\""
|
2023-08-31 20:45:11 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2024-04-12 00:00:49 +01:00
|
|
|
flavorDimensions = ["buildType"]
|
|
|
|
|
|
|
|
productFlavors {
|
|
|
|
stable {
|
|
|
|
dimension "buildType"
|
|
|
|
buildConfigField "boolean", "IS_PLAYSTORE_BUILD", "false"
|
|
|
|
buildConfigField "boolean", "UPDATE_CHECKING", "true"
|
2024-04-12 03:47:24 +01:00
|
|
|
getIsDefault().set(true)
|
2024-04-29 20:19:43 +01:00
|
|
|
|
2024-05-15 00:55:14 +01:00
|
|
|
buildConfigField "String", "PAYMENT_URL", "\"https://pay.futo.org/api/PaymentPortal?product=voiceinput&success=futo-keyboard%3a%2f%2flicense%2factivate\""
|
2024-07-05 18:17:37 +01:00
|
|
|
buildConfigField "String", "PAYMENT_PRICE", "\"~\$6.99\""
|
2024-04-12 00:00:49 +01:00
|
|
|
}
|
|
|
|
playstore {
|
|
|
|
dimension "buildType"
|
|
|
|
applicationIdSuffix ".playstore"
|
|
|
|
versionNameSuffix "-playstore"
|
|
|
|
|
|
|
|
buildConfigField "boolean", "IS_PLAYSTORE_BUILD", "true"
|
|
|
|
buildConfigField "boolean", "UPDATE_CHECKING", "false"
|
2024-04-29 20:19:43 +01:00
|
|
|
|
2024-07-05 18:17:37 +01:00
|
|
|
buildConfigField "String", "PAYMENT_URL", "\"https://play.google.com/store/apps/details?id=org.futo.keyboardpayment\""
|
|
|
|
buildConfigField "String", "PAYMENT_PRICE", "\"~\$11.99\""
|
2024-04-12 00:00:49 +01:00
|
|
|
}
|
2018-07-26 02:08:28 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
compileOptions {
|
|
|
|
sourceCompatibility JavaVersion.VERSION_1_8
|
|
|
|
targetCompatibility JavaVersion.VERSION_1_8
|
|
|
|
}
|
|
|
|
|
|
|
|
sourceSets {
|
|
|
|
main {
|
|
|
|
res.srcDirs = ['java/res']
|
|
|
|
java.srcDirs = ['common/src', 'java/src']
|
|
|
|
manifest.srcFile 'java/AndroidManifest.xml'
|
2024-08-24 09:06:54 +01:00
|
|
|
assets.srcDirs = ['java/assets']
|
2018-07-26 02:08:28 +01:00
|
|
|
}
|
|
|
|
|
2024-04-12 04:40:11 +01:00
|
|
|
playstore {
|
|
|
|
java.srcDirs = ['common/src', 'java/src', 'java/playstore/java']
|
|
|
|
manifest.srcFile 'java/playstore/AndroidManifest.xml'
|
|
|
|
}
|
|
|
|
|
|
|
|
stable {
|
|
|
|
java.srcDirs = ['common/src', 'java/src', 'java/stable/java']
|
|
|
|
manifest.srcFile 'java/stable/AndroidManifest.xml'
|
|
|
|
}
|
|
|
|
|
2018-07-26 02:08:28 +01:00
|
|
|
androidTest {
|
|
|
|
res.srcDirs = ['tests/res']
|
|
|
|
java.srcDirs = ['tests/src']
|
|
|
|
manifest.srcFile "tests/AndroidManifest.xml"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
lintOptions {
|
|
|
|
checkReleaseBuilds false
|
|
|
|
}
|
|
|
|
|
|
|
|
aaptOptions {
|
|
|
|
noCompress 'dict'
|
|
|
|
}
|
|
|
|
|
|
|
|
externalNativeBuild {
|
|
|
|
ndkBuild {
|
|
|
|
path 'native/jni/Android.mk'
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-08-14 10:48:12 +01:00
|
|
|
kotlinOptions {
|
|
|
|
jvmTarget = '1.8'
|
|
|
|
}
|
|
|
|
buildFeatures {
|
|
|
|
compose true
|
|
|
|
viewBinding true
|
|
|
|
mlModelBinding true
|
2024-04-12 00:00:49 +01:00
|
|
|
buildConfig true
|
2023-08-14 10:48:12 +01:00
|
|
|
}
|
2018-07-26 02:08:28 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
dependencies {
|
2024-08-24 09:06:54 +01:00
|
|
|
implementation 'androidx.core:core-ktx:1.13.1'
|
|
|
|
implementation 'androidx.lifecycle:lifecycle-runtime-ktx:2.8.4'
|
|
|
|
implementation 'androidx.lifecycle:lifecycle-runtime:2.8.4'
|
|
|
|
implementation 'androidx.lifecycle:lifecycle-runtime-compose:2.8.4'
|
|
|
|
implementation 'androidx.lifecycle:lifecycle-viewmodel-compose:2.8.4'
|
|
|
|
implementation 'androidx.activity:activity-compose:1.9.1'
|
|
|
|
implementation platform('androidx.compose:compose-bom:2024.06.00')
|
2023-08-14 10:48:12 +01:00
|
|
|
implementation 'androidx.compose.ui:ui'
|
|
|
|
implementation 'androidx.compose.ui:ui-graphics'
|
|
|
|
implementation 'androidx.compose.ui:ui-tooling-preview'
|
|
|
|
implementation 'androidx.compose.material3:material3'
|
2024-08-24 09:06:54 +01:00
|
|
|
implementation 'com.google.android.material:material:1.12.0'
|
|
|
|
implementation 'androidx.appcompat:appcompat:1.7.0'
|
2023-08-14 10:48:12 +01:00
|
|
|
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
|
2024-03-13 20:26:23 +00:00
|
|
|
implementation 'androidx.navigation:navigation-compose:2.7.7'
|
2023-08-14 10:48:12 +01:00
|
|
|
|
2018-07-26 02:08:28 +01:00
|
|
|
implementation 'com.google.code.findbugs:jsr305:3.0.2'
|
|
|
|
|
2024-08-24 09:06:54 +01:00
|
|
|
implementation 'androidx.datastore:datastore-preferences:1.1.1'
|
2023-08-26 18:04:56 +01:00
|
|
|
implementation 'androidx.autofill:autofill:1.1.0'
|
2024-09-21 17:31:34 +01:00
|
|
|
implementation 'androidx.window:window:1.3.0'
|
2023-08-22 18:37:51 +01:00
|
|
|
|
2024-04-12 03:47:24 +01:00
|
|
|
stableImplementation 'ch.acra:acra-mail:5.11.1'
|
|
|
|
stableImplementation 'ch.acra:acra-dialog:5.11.1'
|
2023-08-31 20:45:11 +01:00
|
|
|
|
2024-07-20 20:49:10 +01:00
|
|
|
implementation 'sh.calvin.reorderable:reorderable:2.2.0'
|
|
|
|
|
2023-09-04 15:30:18 +01:00
|
|
|
implementation 'com.squareup.okhttp3:okhttp:4.11.0'
|
2024-08-24 09:06:54 +01:00
|
|
|
implementation 'org.jetbrains.kotlinx:kotlinx-serialization-json:1.7.1'
|
|
|
|
implementation 'org.jetbrains.kotlinx:kotlinx-serialization-json-jvm:1.7.1'
|
2023-09-04 15:30:18 +01:00
|
|
|
|
2024-01-11 20:26:38 +00:00
|
|
|
def work_version = "2.9.0"
|
2023-11-14 15:23:08 +00:00
|
|
|
implementation "androidx.work:work-runtime-ktx:$work_version"
|
|
|
|
implementation "androidx.work:work-runtime:$work_version"
|
|
|
|
|
2023-08-27 17:08:44 +01:00
|
|
|
implementation project(":voiceinput-shared")
|
|
|
|
|
2024-08-24 09:06:54 +01:00
|
|
|
implementation "com.charleskorn.kaml:kaml:0.61.0"
|
|
|
|
|
2023-08-15 17:48:27 +01:00
|
|
|
debugImplementation 'androidx.compose.ui:ui-tooling'
|
|
|
|
debugImplementation 'androidx.compose.ui:ui-test-manifest'
|
|
|
|
|
2023-07-06 19:57:49 +01:00
|
|
|
testImplementation 'junit:junit:4.13.2'
|
2018-07-26 02:08:28 +01:00
|
|
|
androidTestImplementation "org.mockito:mockito-core:1.9.5"
|
|
|
|
androidTestImplementation 'com.google.dexmaker:dexmaker:1.2'
|
|
|
|
androidTestImplementation 'com.google.dexmaker:dexmaker-mockito:1.2'
|
2024-01-11 20:26:38 +00:00
|
|
|
androidTestImplementation 'androidx.test.ext:junit:1.1.5'
|
|
|
|
androidTestImplementation 'androidx.test:rules:1.5.0'
|
2023-07-06 19:57:49 +01:00
|
|
|
androidTestImplementation 'androidx.test.uiautomator:uiautomator:2.2.0'
|
|
|
|
androidTestImplementation 'androidx.annotation:annotation:1.0.0'
|
2018-07-26 02:08:28 +01:00
|
|
|
}
|
2024-03-22 20:55:59 +00:00
|
|
|
|
|
|
|
project.logger.lifecycle("versionCode = ${android.defaultConfig.versionCode}")
|
|
|
|
project.logger.lifecycle("versionName = ${android.defaultConfig.versionName}")
|