196 lines
7.6 KiB
Groovy
196 lines
7.6 KiB
Groovy
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 "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
|
|
}
|
|
}
|
|
|
|
android {
|
|
compileSdk 33
|
|
|
|
defaultConfig {
|
|
applicationId "chat.revolt"
|
|
minSdk 24
|
|
targetSdk 33
|
|
versionCode Integer.parseInt("000_002_000".replaceAll("_", ""), 10)
|
|
versionName "0.2.0"
|
|
|
|
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
|
vectorDrawables {
|
|
useSupportLibrary true
|
|
}
|
|
}
|
|
|
|
buildTypes {
|
|
release {
|
|
minifyEnabled true
|
|
shrinkResources true
|
|
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
|
|
buildConfigField "String", "SENTRY_DSN", "\"${property('revoltbuild.properties', 'sentry.dsn', 'RVX_SENTRY_DSN')}\""
|
|
buildConfigField "Boolean", "ANALYSIS_ENABLED", "${property('revoltbuild.properties', 'analysis.enabled', 'RVX_ANALYSIS_ENABLED')}"
|
|
buildConfigField "String", "ANALYSIS_BASEURL", "\"${property('revoltbuild.properties', 'analysis.base_url', 'RVX_ANALYSIS_BASEURL')}\""
|
|
}
|
|
|
|
debug {
|
|
buildConfigField "String", "SENTRY_DSN", "\"${property('revoltbuild.properties', 'sentry.dsn', 'RVX_SENTRY_DSN')}\""
|
|
buildConfigField "Boolean", "ANALYSIS_ENABLED", "${property('revoltbuild.properties', 'analysis.enabled', 'RVX_ANALYSIS_ENABLED')}"
|
|
buildConfigField "String", "ANALYSIS_BASEURL", "\"${property('revoltbuild.properties', '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
|
|
}
|
|
namespace 'chat.revolt'
|
|
}
|
|
|
|
sentry {
|
|
autoUploadProguardMapping = property('revoltbuild.properties', 'sentry.upload_mappings', 'RVX_SENTRY_UPLOAD_MAPPINGS') == 'true'
|
|
}
|
|
|
|
dependencies {
|
|
// Android/Kotlin Core
|
|
implementation 'androidx.core:core-ktx:1.10.0'
|
|
|
|
// Kotlinx - various first-party extensions for Kotlin
|
|
implementation "org.jetbrains.kotlinx:kotlinx-serialization-json:1.4.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.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.1'
|
|
|
|
// 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-navigation-animation:$accompanist_version"
|
|
implementation "com.google.accompanist:accompanist-navigation-material:$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-alpha.4-SNAPSHOT"
|
|
|
|
// 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.5.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-alpha09"
|
|
implementation 'com.github.MikeOrtiz:TouchImageView:3.3'
|
|
implementation "androidx.appcompat:appcompat:1.7.0-alpha02"
|
|
|
|
// 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:1.0.1"
|
|
}
|
|
|
|
kapt {
|
|
correctErrorTypes true
|
|
} |