mirror of
https://github.com/sudoxnym/habitica-android.git
synced 2026-04-14 19:56:32 +00:00
381 lines
14 KiB
Groovy
381 lines
14 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'
|
|
id 'androidx.navigation.safeargs'
|
|
id 'com.google.firebase.firebase-perf'
|
|
|
|
id 'jacoco-report-aggregation'
|
|
}
|
|
|
|
apply plugin: 'kotlin-android'
|
|
apply plugin: "realm-android"
|
|
|
|
repositories {
|
|
mavenLocal()
|
|
mavenCentral()
|
|
google()
|
|
|
|
maven { url "https://jitpack.io" }
|
|
}
|
|
|
|
dependencies {
|
|
implementation fileTree(include: ['*.jar'], dir: '../common/libs')
|
|
//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-gson:$retrofit_version"
|
|
|
|
//Dependency Injection
|
|
implementation "com.google.dagger:hilt-android:$daggerhilt_version"
|
|
kapt "com.google.dagger:hilt-compiler:$daggerhilt_version"
|
|
compileOnly 'javax.annotation:javax.annotation-api:1.3.2'
|
|
//App Compatibility and Material Design
|
|
implementation "androidx.appcompat:appcompat:$appcompat_version"
|
|
implementation 'com.google.android.material:material:1.9.0'
|
|
implementation "androidx.recyclerview:recyclerview:$recyclerview_version"
|
|
implementation "androidx.preference:preference-ktx:$preferences_version"
|
|
implementation "androidx.swiperefreshlayout:swiperefreshlayout:1.1.0"
|
|
|
|
//Desugaring
|
|
coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:2.0.3'
|
|
|
|
implementation('com.jaredrummler:android-device-names:2.1.1')
|
|
|
|
// IAP Handling / Verification
|
|
implementation "com.android.billingclient:billing-ktx:6.0.1"
|
|
implementation 'fr.avianey.com.viewpagerindicator:library:2.4.1@aar'
|
|
|
|
implementation("io.coil-kt:coil-compose:$coil_version")
|
|
|
|
//Analytics
|
|
implementation "com.amplitude:analytics-android:$amplitude_version"
|
|
|
|
//Tests
|
|
testImplementation 'androidx.test:core:1.5.0'
|
|
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"
|
|
androidTestImplementation ('com.kaspersky.android-components:kaspresso:1.5.1') {
|
|
exclude module: "protobuf-lite"
|
|
}
|
|
androidTestImplementation "com.kaspersky.android-components:kaspresso-compose-support:1.5.1"
|
|
|
|
androidTestImplementation 'androidx.test:runner:1.5.2'
|
|
androidTestImplementation 'androidx.test:rules:1.5.0'
|
|
debugImplementation 'androidx.fragment:fragment-testing:1.6.1'
|
|
androidTestImplementation 'androidx.test:core-ktx:1.5.0'
|
|
debugImplementation "androidx.test:monitor:1.6.1"
|
|
androidTestImplementation 'androidx.test.ext:junit-ktx:1.1.5'
|
|
androidTestImplementation "io.mockk:mockk-android:$mockk_version"
|
|
androidTestImplementation "io.mockk:mockk-agent:$mockk_version"
|
|
androidTestImplementation "io.kotest:kotest-assertions-core:$kotest_version"
|
|
androidTestImplementation "org.jetbrains.kotlin:kotlin-reflect:$kotlin_version"
|
|
|
|
androidTestUtil("androidx.test:orchestrator:1.4.2")
|
|
|
|
implementation 'com.facebook.shimmer:shimmer:0.5.0'
|
|
|
|
//Leak Detection
|
|
debugImplementation 'com.squareup.leakcanary:leakcanary-android:2.10'
|
|
//Push Notifications
|
|
implementation platform("com.google.firebase:firebase-bom:$firebase_bom")
|
|
implementation 'com.google.firebase:firebase-analytics-ktx'
|
|
implementation 'com.google.firebase:firebase-crashlytics-ktx'
|
|
implementation 'com.google.firebase:firebase-messaging-ktx'
|
|
implementation 'com.google.firebase:firebase-config-ktx'
|
|
implementation 'com.google.firebase:firebase-perf-ktx'
|
|
implementation 'com.google.android.gms:play-services-ads:22.4.0'
|
|
implementation "com.google.android.gms:play-services-auth:$play_auth_version"
|
|
implementation 'com.google.android.flexbox:flexbox:3.0.0'
|
|
implementation "com.google.android.gms:play-services-wearable:$play_wearables_version"
|
|
|
|
implementation "androidx.core:core-ktx:$core_ktx_version"
|
|
implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:$lifecycle_version"
|
|
implementation "androidx.lifecycle:lifecycle-livedata-ktx:$lifecycle_version"
|
|
implementation "androidx.lifecycle:lifecycle-common-java8:$lifecycle_version"
|
|
implementation "androidx.navigation:navigation-fragment-ktx:$navigation_version"
|
|
implementation "androidx.navigation:navigation-ui-ktx:$navigation_version"
|
|
implementation "androidx.fragment:fragment-ktx:1.6.1"
|
|
implementation "androidx.paging:paging-runtime-ktx:$paging_version"
|
|
implementation "androidx.paging:paging-compose:$paging_version"
|
|
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:$coroutines_version"
|
|
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:$coroutines_version"
|
|
implementation "com.google.accompanist:accompanist-themeadapter-material:$accompanist_version"
|
|
implementation "androidx.compose.material3:material3:1.1.2"
|
|
implementation "com.google.accompanist:accompanist-systemuicontroller:$accompanist_version"
|
|
implementation 'com.google.android.play:core:1.10.3'
|
|
|
|
implementation 'androidx.activity:activity-compose:1.8.0'
|
|
implementation "androidx.compose.runtime:runtime-livedata:$compose_version"
|
|
implementation "androidx.compose.material:material:$compose_version"
|
|
implementation "androidx.compose.animation:animation:$compose_version"
|
|
implementation "androidx.compose.ui:ui-text-google-fonts:$compose_version"
|
|
implementation "androidx.compose.ui:ui-tooling:$compose_version"
|
|
implementation "androidx.lifecycle:lifecycle-viewmodel-compose:$lifecycle_version"
|
|
|
|
implementation project(':common')
|
|
implementation project(':shared')
|
|
|
|
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
|
|
}
|
|
|
|
android {
|
|
compileSdk target_sdk
|
|
testOptions {
|
|
unitTests {
|
|
includeAndroidResources = true
|
|
}
|
|
animationsDisabled = true
|
|
}
|
|
|
|
namespace "com.habitrpg.android.habitica"
|
|
|
|
defaultConfig {
|
|
minSdkVersion min_sdk
|
|
compileSdk 34
|
|
applicationId "com.habitrpg.android.habitica"
|
|
vectorDrawables.useSupportLibrary = true
|
|
buildConfigField "String", "STORE", "\"google\""
|
|
buildConfigField "String", "TESTING_LEVEL", "\"production\""
|
|
resourceConfigurations += ['en', 'bg', 'de', 'en-rGB', 'es', 'fr', 'hr-rHR', 'in', 'it', 'iw', 'ja', 'ko', 'lt', 'nl', 'pl', 'pt-rBR', 'pt-rPT', 'ru', 'tr', 'uk', 'zh', 'zh-rTW']
|
|
|
|
versionCode app_version_code
|
|
versionName app_version_name
|
|
|
|
targetSdkVersion target_sdk
|
|
|
|
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
|
testInstrumentationRunnerArguments clearPackageData: 'true'
|
|
|
|
def formattedDate = new Date().format('yyMMdd')
|
|
archivesBaseName = "Habitica-${formattedDate}${versionCode}"
|
|
}
|
|
|
|
buildFeatures {
|
|
viewBinding true
|
|
compose true
|
|
renderScript true
|
|
aidl true
|
|
}
|
|
|
|
composeOptions {
|
|
kotlinCompilerExtensionVersion = "1.5.3"
|
|
}
|
|
|
|
signingConfigs {
|
|
release
|
|
}
|
|
flavorDimensions.add("buildType")
|
|
|
|
buildTypes {
|
|
debug {
|
|
//applicationIdSuffix ".debug"
|
|
debuggable true
|
|
minifyEnabled false
|
|
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
|
|
// Disable fabric build ID generation for debug builds
|
|
ext.enableCrashlytics = false
|
|
ext.alwaysUpdateBuildId = false
|
|
testCoverageEnabled = false
|
|
//resValue "string", "content_provider", "com.habitrpg.android.habitica.debug.fileprovider"
|
|
resValue "string", "content_provider", "com.habitrpg.android.habitica.fileprovider"
|
|
resValue "string", "app_name", "Habitica Debug"
|
|
}
|
|
debugIAP {
|
|
signingConfig signingConfigs.release
|
|
debuggable true
|
|
minifyEnabled false
|
|
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
|
|
// Disable fabric build ID generation for debug builds
|
|
ext.enableCrashlytics = false
|
|
ext.alwaysUpdateBuildId = false
|
|
resValue "string", "content_provider", "com.habitrpg.android.habitica.fileprovider"
|
|
resValue "string", "app_name", "Habitica Debug"
|
|
}
|
|
release {
|
|
signingConfig signingConfigs.release
|
|
debuggable false
|
|
minifyEnabled true
|
|
shrinkResources true
|
|
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
|
|
resValue "string", "content_provider", "com.habitrpg.android.habitica.fileprovider"
|
|
resValue "string", "app_name", "Habitica"
|
|
}
|
|
}
|
|
|
|
productFlavors {
|
|
dev {
|
|
dimension "buildType"
|
|
}
|
|
|
|
staff {
|
|
dimension "buildType"
|
|
buildConfigField "String", "TESTING_LEVEL", "\"staff\""
|
|
resValue "string", "app_name", "Habitica Staff"
|
|
versionCode app_version_code + 8
|
|
}
|
|
|
|
partners {
|
|
dimension "buildType"
|
|
buildConfigField "String", "TESTING_LEVEL", "\"partners\""
|
|
resValue "string", "app_name", "Habitica"
|
|
versionCode app_version_code + 6
|
|
}
|
|
|
|
alpha {
|
|
dimension "buildType"
|
|
buildConfigField "String", "TESTING_LEVEL", "\"alpha\""
|
|
resValue "string", "app_name", "Habitica Alpha"
|
|
versionCode app_version_code + 4
|
|
}
|
|
|
|
beta {
|
|
buildConfigField "String", "TESTING_LEVEL", "\"beta\""
|
|
dimension "buildType"
|
|
versionCode app_version_code + 2
|
|
}
|
|
|
|
prod {
|
|
buildConfigField "String", "TESTING_LEVEL", "\"production\""
|
|
dimension "buildType"
|
|
versionCode app_version_code
|
|
}
|
|
}
|
|
|
|
sourceSets {
|
|
main {
|
|
manifest.srcFile 'AndroidManifest.xml'
|
|
java.srcDirs = ['src/main/java']
|
|
resources.srcDirs = ['src/main/java']
|
|
aidl.srcDirs = ['src/main/java']
|
|
renderscript.srcDirs = ['src/main/java']
|
|
res.srcDirs = ['res']
|
|
assets.srcDirs = ['assets']
|
|
}
|
|
test {
|
|
java.srcDir("src/test/java")
|
|
}
|
|
debugIAP { java.srcDirs = ['src/debug/java'] }
|
|
release { java.srcDirs = ['src/release/java'] }
|
|
}
|
|
|
|
compileOptions {
|
|
coreLibraryDesugaringEnabled true
|
|
|
|
sourceCompatibility JavaVersion.VERSION_11
|
|
targetCompatibility JavaVersion.VERSION_11
|
|
}
|
|
|
|
kotlinOptions {
|
|
jvmTarget = JavaVersion.VERSION_11.toString()
|
|
}
|
|
|
|
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
|
|
}
|
|
}
|
|
lint {
|
|
abortOnError false
|
|
disable 'MissingTranslation', 'InvalidPackage'
|
|
enable 'LogConditional', 'IconExpectedSize', 'MissingRegistered', 'TypographyQuotes'
|
|
}
|
|
|
|
packagingOptions {
|
|
resources.excludes.add("META-INF/*")
|
|
}
|
|
}
|
|
|
|
android.testOptions {
|
|
unitTests.all {
|
|
useJUnitPlatform()
|
|
}
|
|
unitTests.returnDefaultValues = true
|
|
}
|
|
|
|
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
|
|
}
|
|
|
|
// Add Habitica Properties to buildConfigField
|
|
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')
|
|
}
|
|
|
|
// Add Habitica Resources to resources
|
|
final File HRPG_RES_FILE = new File(projectDir.absolutePath + '/../habitica.resources')
|
|
if (HRPG_RES_FILE.canRead()) {
|
|
Properties HRPG_RES = new Properties()
|
|
HRPG_RES.load(new FileInputStream(HRPG_RES_FILE))
|
|
|
|
if (HRPG_RES != null) {
|
|
android.buildTypes.configureEach { buildType ->
|
|
HRPG_RES.any { property ->
|
|
buildType.resValue "string", property.key, "\"${property.value}\""
|
|
}
|
|
}
|
|
} else {
|
|
throw new MissingResourceException('habitica.resources found but some entries are missing')
|
|
}
|
|
} else {
|
|
throw new MissingResourceException('habitica.resources not found')
|
|
}
|
|
|
|
tasks.configureEach { task ->
|
|
if (task.name == "lint") {
|
|
task.enabled = false
|
|
}
|
|
}
|
|
|
|
gradle.projectsEvaluated {
|
|
tasks.withType(JavaCompile).configureEach {
|
|
options.compilerArgs << "-Xmaxerrs" << "500"
|
|
}
|
|
}
|
|
|
|
apply plugin: 'com.google.gms.google-services'
|