plugins { id 'com.android.application' id 'org.jetbrains.kotlin.android' id 'org.jetbrains.kotlin.plugin.serialization' id 'com.mikepenz.aboutlibraries.plugin' id 'com.google.dagger.hilt.android' id 'com.google.devtools.ksp' id 'org.jmailen.kotlinter' id "io.sentry.android.gradle" version "3.4.2" id 'kotlin-kapt' id 'kotlin-parcelize' } def property(String fileName, String propertyName, String fallbackEnv = null) { def propsFile = rootProject.file(fileName) if (propsFile.exists()) { def props = new Properties() props.load(new FileInputStream(propsFile)) if (props[propertyName] != null) { return props[propertyName] } else { logger.warn("Property '$propertyName' not found in '$fileName'. Attempting to use environment variable '$fallbackEnv'") if (fallbackEnv != null) { def env = System.getenv(fallbackEnv) if (env != null) { return env } else { logger.warn("Environment variable '$fallbackEnv' not found either. Returning null") } } return null } } else { logger.warn("Properties file '$fileName' not found. Attempting to use environment variable '$fallbackEnv'") if (fallbackEnv != null) { def env = System.getenv(fallbackEnv) if (env != null) { return env } else { logger.warn("Environment variable '$fallbackEnv' not found either. Returning null") } } return null } } // Calls property but with revoltbuild.properties as the first argument def buildproperty(String propertyName, String fallbackEnv = null) { return property('revoltbuild.properties', propertyName, fallbackEnv) } android { compileSdk 34 defaultConfig { applicationId "chat.revolt" minSdk 24 targetSdk 34 versionCode Integer.parseInt("000_007_000".replaceAll("_", ""), 10) versionName "0.7.0" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" vectorDrawables { useSupportLibrary true } // Please keep this list sorted alphabetically. resourceConfigurations += ['ar', 'b+es+419', 'be', 'bg', 'bn', 'ca', 'ckb', 'cs', 'de', 'el', 'en', 'es', 'fi', 'fil', 'fr', 'gl', 'hi', 'hr', 'hu', 'id', 'in', 'ja', 'mwl', 'nb-rNO', 'nl', 'pl', 'pt', 'pt-rBR', 'ro', 'ru', 'si', 'tr', 'uk', 'zh-rCN'] externalNativeBuild { cmake { cppFlags '' } } } buildTypes { release { minifyEnabled true shrinkResources true proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' buildConfigField "String", "SENTRY_DSN", "\"${buildproperty('sentry.dsn', 'RVX_SENTRY_DSN')}\"" } debug { pseudoLocalesEnabled true applicationIdSuffix ".debug" versionNameSuffix '+debug' resValue "string", "app_name", buildproperty('build.debug.app_name', 'RVX_DEBUG_APP_NAME') buildConfigField "String", "SENTRY_DSN", "\"${buildproperty('sentry.dsn', 'RVX_SENTRY_DSN')}\"" } } compileOptions { coreLibraryDesugaringEnabled true sourceCompatibility JavaVersion.VERSION_17 targetCompatibility JavaVersion.VERSION_17 } kotlinOptions { jvmTarget = '17' } buildFeatures { viewBinding true compose true } composeOptions { kotlinCompilerExtensionVersion compose_version } packagingOptions { resources { excludes += '/META-INF/{AL2.0,LGPL2.1}' } } lintOptions { abortOnError false disable 'MissingTranslation' } namespace 'chat.revolt' externalNativeBuild { cmake { path file('src/main/cpp/CMakeLists.txt') version '3.22.1' } } } sentry { autoUploadProguardMapping = buildproperty('sentry.upload_mappings', 'RVX_SENTRY_UPLOAD_MAPPINGS') == 'true' } dependencies { // Android/Kotlin Core implementation 'androidx.core:core-ktx:1.12.0' implementation "org.jetbrains.kotlin:kotlin-reflect:1.9.10" // Kotlinx - various first-party extensions for Kotlin implementation "org.jetbrains.kotlinx:kotlinx-serialization-json:1.6.0" implementation "org.jetbrains.kotlinx:kotlinx-serialization-cbor:1.6.0" implementation "org.jetbrains.kotlinx:kotlinx-datetime:0.4.0" // Compose BOM implementation platform("androidx.compose:compose-bom:$compose_bom_version") // Jetpack Compose implementation "androidx.compose.ui:ui" implementation "androidx.compose.ui:ui-util" implementation 'androidx.compose.material:material' implementation 'androidx.compose.material3:material3' implementation 'androidx.compose.material3:material3-window-size-class' implementation "androidx.compose.ui:ui-tooling-preview" implementation "androidx.compose.runtime:runtime-livedata" implementation 'androidx.lifecycle:lifecycle-runtime-ktx:2.6.2' implementation 'androidx.lifecycle:lifecycle-viewmodel-compose:2.6.2' implementation 'androidx.activity:activity-compose:1.8.1' // Accompanist - Jetpack Compose Extensions implementation "com.google.accompanist:accompanist-systemuicontroller:$accompanist_version" implementation "com.google.accompanist:accompanist-permissions:$accompanist_version" // KTOR - HTTP+WebSocket Library implementation "io.ktor:ktor-client-core:$ktor_version" implementation "io.ktor:ktor-client-logging:$ktor_version" implementation "io.ktor:ktor-client-content-negotiation:$ktor_version" implementation "io.ktor:ktor-serialization-kotlinx-json:$ktor_version" implementation "io.ktor:ktor-client-okhttp:$ktor_version" // Screen Navigation implementation "androidx.navigation:navigation-compose:$nav_version" // Jetpack Compose Tooling debugImplementation "androidx.compose.ui:ui-tooling" debugImplementation "androidx.compose.ui:ui-test-manifest" // Hilt - Dependency Injection implementation "com.google.dagger:hilt-android:$hilt_version" implementation "androidx.hilt:hilt-navigation-compose:1.1.0" kapt "com.google.dagger:hilt-compiler:$hilt_version" // Glide - Image Loading implementation "com.github.bumptech.glide:glide:$glide_version" implementation "com.github.bumptech.glide:compose:1.0.0-beta1-SNAPSHOT" ksp "com.github.bumptech.glide:ksp:$glide_version" // AboutLibraries - automated OSS library attribution implementation "com.mikepenz:aboutlibraries-compose:$aboutlibraries_version" // Lottie - animated vector graphics implementation "com.airbnb.android:lottie-compose:6.0.0" // Sentry - crash reporting implementation 'io.sentry:sentry-android:6.15.0' implementation 'io.sentry:sentry-compose-android:6.15.0' // Other AndroidX libraries - used for various things and never seem to have a consistent version implementation 'androidx.documentfile:documentfile:1.0.1' implementation "androidx.browser:browser:1.7.0" implementation "androidx.webkit:webkit:1.9.0" implementation "androidx.datastore:datastore-preferences:1.1.0-alpha07" implementation "androidx.datastore:datastore:1.1.0-alpha07" implementation "androidx.core:core-splashscreen:1.0.1" // Libraries used for legacy View-based UI implementation "androidx.constraintlayout:constraintlayout:2.2.0-alpha13" implementation "androidx.appcompat:appcompat:1.7.0-alpha03" implementation 'com.google.android.material:material:1.10.0' // hCaptcha - captcha provider implementation "com.github.hcaptcha:hcaptcha-android-sdk:3.8.1" // JDK Desugaring - polyfill for new Java APIs coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:2.0.4' // AndroidX Media3 w/ ExoPlayer implementation "androidx.media3:media3-exoplayer:$media3_version" implementation "androidx.media3:media3-exoplayer-hls:$media3_version" implementation "androidx.media3:media3-datasource-okhttp:$media3_version" implementation "androidx.media3:media3-ui:$media3_version" // Compose libraries implementation "com.github.skydoves:colorpicker-compose:1.0.5" implementation "me.saket.telephoto:zoomable-image:1.0.0-alpha02" implementation "me.saket.telephoto:zoomable-image-glide:1.0.0-alpha02" }