habitica-android/wearos/build.gradle
2024-03-05 18:42:29 +01:00

223 lines
7.7 KiB
Groovy

plugins {
id 'com.android.application'
id 'org.jetbrains.kotlin.android'
id 'kotlin-kapt'
id 'dagger.hilt.android.plugin'
id 'com.google.gms.google-services'
id 'com.google.firebase.crashlytics'
}
apply plugin: 'kotlin-android'
android {
compileSdk target_sdk
testOptions {
unitTests {
includeAndroidResources = true
}
animationsDisabled = true
}
defaultConfig {
applicationId "com.habitrpg.android.habitica"
minSdk 26
targetSdk target_sdk
compileSdk 34
versionCode app_version_code + 1
versionName "${app_version_name}w"
buildConfigField "String", "TESTING_LEVEL", "\"production\""
def formattedDate = new Date().format('yyMMdd')
archivesBaseName = "Habitica-WearOS-${formattedDate}${versionCode}"
}
signingConfigs {
release
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_11
targetCompatibility JavaVersion.VERSION_11
}
kotlinOptions {
jvmTarget = JavaVersion.VERSION_11.toString()
}
buildTypes {
debug {
minifyEnabled false
debuggable true
ext.enableCrashlytics = false
ext.alwaysUpdateBuildId = false
resValue "string", "app_name", "Habitica Debug"
}
release {
signingConfig signingConfigs.release
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
resValue "string", "app_name", "Habitica"
}
}
bundle {
language {
// Specifies that the app bundle should not support
// configuration APKs for language resources. These
// resources are instead packaged with each base and
// dynamic feature APK.
enableSplit = false
}
}
flavorDimensions.add("buildType")
productFlavors {
dev {
dimension "buildType"
}
staff {
dimension "buildType"
buildConfigField "String", "TESTING_LEVEL", "\"staff\""
resValue "string", "app_name", "Habitica Staff"
versionCode app_version_code + 9
}
partners {
dimension "buildType"
buildConfigField "String", "TESTING_LEVEL", "\"partners\""
resValue "string", "app_name", "Habitica"
versionCode app_version_code + 7
}
alpha {
dimension "buildType"
buildConfigField "String", "TESTING_LEVEL", "\"alpha\""
resValue "string", "app_name", "Habitica Alpha"
versionCode app_version_code + 5
}
beta {
buildConfigField "String", "TESTING_LEVEL", "\"beta\""
dimension "buildType"
versionCode app_version_code + 3
}
prod {
buildConfigField "String", "TESTING_LEVEL", "\"production\""
dimension "buildType"
versionCode app_version_code + 1
}
}
buildFeatures {
viewBinding true
}
namespace 'com.habitrpg.android.habitica'
}
dependencies {
implementation fileTree(include: ['*.jar'], dir: '../common/libs')
implementation "androidx.core:core-ktx:$core_ktx_version"
implementation "com.google.android.gms:play-services-wearable:$play_wearables_version"
implementation "androidx.recyclerview:recyclerview:$recyclerview_version"
implementation 'androidx.wear:wear:1.3.0'
implementation "androidx.wear:wear-input:1.1.0"
//Networking
implementation "com.squareup.okhttp3:okhttp:$okhttp_version"
implementation "com.squareup.okhttp3:logging-interceptor:$okhttp_version"
//REST API handling
implementation("com.squareup.retrofit2:retrofit:$retrofit_version") {
exclude module: 'okhttp'
}
implementation("com.squareup.retrofit2:converter-moshi:$retrofit_version")
implementation("com.squareup.moshi:moshi-kotlin:$moshi_version")
implementation 'androidx.coordinatorlayout:coordinatorlayout:1.2.0'
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
kapt("com.squareup.moshi:moshi-kotlin-codegen:$moshi_version")
implementation platform("com.google.firebase:firebase-bom:$firebase_bom")
implementation 'com.google.firebase:firebase-crashlytics-ktx'
implementation 'com.google.firebase:firebase-analytics-ktx'
implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:$lifecycle_version"
implementation "androidx.lifecycle:lifecycle-livedata-ktx:$lifecycle_version"
implementation "androidx.lifecycle:lifecycle-runtime-ktx:$lifecycle_version"
implementation "androidx.lifecycle:lifecycle-common-java8:$lifecycle_version"
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:$coroutines_version"
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:$coroutines_version"
implementation "androidx.preference:preference-ktx:$preferences_version"
implementation "androidx.navigation:navigation-fragment-ktx:2.7.7"
implementation "com.google.android.gms:play-services-auth:$play_auth_version"
implementation project(':common')
implementation project(':shared')
implementation "androidx.appcompat:appcompat:$appcompat_version"
implementation "com.google.dagger:hilt-android:$daggerhilt_version"
kapt "com.google.dagger:hilt-compiler:$daggerhilt_version"
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation "org.jetbrains.kotlin:kotlin-reflect:$kotlin_version"
implementation "androidx.core:core-splashscreen:1.1.0-alpha02"
testImplementation "io.mockk:mockk:$mockk_version"
testImplementation "io.mockk:mockk-android:$mockk_version"
testImplementation "io.kotest:kotest-runner-junit5:$kotest_version"
testImplementation "io.kotest:kotest-assertions-core:$kotest_version"
testImplementation "io.kotest:kotest-framework-datatest:$kotest_version"
testImplementation "org.jetbrains.kotlinx:kotlinx-coroutines-test:$coroutines_version"
testImplementation 'app.cash.turbine:turbine:0.12.1'
}
repositories {
mavenCentral()
}
android.testOptions {
unitTests.all {
it.useJUnitPlatform()
}
}
final File HRPG_PROPS_FILE = new File(projectDir.absolutePath + '/../habitica.properties')
if (HRPG_PROPS_FILE.canRead()) {
Properties HRPG_PROPS = new Properties()
HRPG_PROPS.load(new FileInputStream(HRPG_PROPS_FILE))
if (HRPG_PROPS != null) {
android.buildTypes.configureEach { buildType ->
HRPG_PROPS.any { property ->
buildType.buildConfigField "String", property.key, "\"${property.value}\""
}
}
} else {
throw new MissingResourceException('habitica.properties found but some entries are missing')
}
} else {
throw new MissingResourceException('habitica.properties not found')
}
Properties props = new Properties()
def propFile = new File('signingrelease.properties')
if (propFile.canRead()) {
props.load(new FileInputStream(propFile))
if (props != null && props.containsKey('STORE_FILE') && props.containsKey('STORE_PASSWORD') &&
props.containsKey('KEY_ALIAS') && props.containsKey('KEY_PASSWORD')) {
android.signingConfigs.release.storeFile = file(props['STORE_FILE'])
android.signingConfigs.release.storePassword = props['STORE_PASSWORD']
android.signingConfigs.release.keyAlias = props['KEY_ALIAS']
android.signingConfigs.release.keyPassword = props['KEY_PASSWORD']
} else {
println 'signing.properties found but some entries are missing'
android.buildTypes.release.signingConfig = null
}
} else {
println 'signing.properties not found'
android.buildTypes.release.signingConfig = null
}