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 "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_006_000".replaceAll("_", ""), 10) versionName "0.6.0" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" vectorDrawables { useSupportLibrary true } resourceConfigurations += ["en", "de", "fr", "id", "b+es+419", "bn", "ca", "es", "gl", "in", "pt-rBR", "pt", "ru", "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')}\"" buildConfigField "Boolean", "ANALYSIS_ENABLED", "${buildproperty('analysis.enabled', 'RVX_ANALYSIS_ENABLED')}" buildConfigField "String", "ANALYSIS_BASEURL", "\"${buildproperty('analysis.base_url', 'RVX_ANALYSIS_BASEURL')}\"" } 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')}\"" buildConfigField "Boolean", "ANALYSIS_ENABLED", "${buildproperty('analysis.enabled', 'RVX_ANALYSIS_ENABLED')}" buildConfigField "String", "ANALYSIS_BASEURL", "\"${buildproperty('analysis.base_url', 'RVX_ANALYSIS_BASEURL')}\"" } } 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.10.1' // Kotlinx - various first-party extensions for Kotlin implementation "org.jetbrains.kotlinx:kotlinx-serialization-json:1.5.1" 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.1' implementation 'androidx.lifecycle:lifecycle-viewmodel-compose:2.6.1' implementation 'androidx.activity:activity-compose:1.7.2' // Accompanist - Jetpack Compose Extensions implementation "com.google.accompanist:accompanist-systemuicontroller:$accompanist_version" implementation "com.google.accompanist:accompanist-permissions:$accompanist_version" implementation "com.google.accompanist:accompanist-flowlayout:$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-alpha01" 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.6.0" implementation "androidx.webkit:webkit:1.7.0" implementation "androidx.datastore:datastore-preferences:1.1.0-alpha04" implementation "androidx.datastore:datastore:1.1.0-alpha04" // Libraries used for legacy View-based UI implementation "androidx.constraintlayout:constraintlayout:2.2.0-alpha12" implementation 'com.github.MikeOrtiz:TouchImageView:3.3' implementation "androidx.appcompat:appcompat:1.7.0-alpha03" implementation 'com.google.android.material:material:1.9.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.3' // Markdown implementation "com.github.discord:SimpleAST:2.7.0" // 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" // Debug-only dependencies // LeakCanary - memory leak detection debugImplementation 'com.squareup.leakcanary:leakcanary-android:2.11' } kapt { correctErrorTypes true }