apply plugin: 'com.android.application' apply plugin: 'kotlin-android' apply plugin: 'kotlin-android-extensions' apply plugin: 'kotlin-kapt' apply plugin: 'app.cash.exhaustive' def debugKeyPath = new File(System.properties['user.home'], ".android/debug.keystore") android { compileSdkVersion 30 defaultConfig { applicationId "com.frostnerd.smokescreen" minSdkVersion 21 targetSdkVersion 30 versionCode 75 versionName "2.0.4" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" def sentryDSN = String.valueOf(getSystemVariableOrDefault("NEBULO_SENTRY_DSN", "dummy")) def sentryConfigServer = String.valueOf(getSystemVariableOrDefault("NEBULO_SENTRY_CONFIGSERVER", "dummy")) buildConfigField("Boolean", "FROM_CI", String.valueOf(getSystemVariableOrDefault("CI_COMMIT_SHORT_SHA", "") != "")) buildConfigField("String", "COMMIT_HASH", '"' + getGitCommitHash() + '"') buildConfigField("String", "SENTRY_DSN", '"' + sentryDSN+ '"') // A valid Sentry DSN, or "dummy" buildConfigField("String", "SENTRY_DSN_CONFIGSERVER", '"' + sentryConfigServer + '"') // A host which returns a valid Sentry DSN on GET, or "dummy". If both are dummy Sentry is disabled. buildConfigField("Boolean", "SHOW_DOQ", 'false') buildConfigField("Boolean", "SHOW_INTRO", 'false') buildConfigField("Boolean", "IN_APP_UPDATES", "false") kapt { arguments { arg("room.schemaLocation", "$projectDir/schemas".toString()) } } javaCompileOptions { annotationProcessorOptions { arguments = ["room.schemaLocation": "$projectDir/schemas".toString()] } } vectorDrawables { useSupportLibrary = true } } signingConfigs { fromVariablesOrDebug { storeFile new File(getSystemVariableOrDefault("KEYSTORE_FILE", debugKeyPath.path)) storePassword getSystemVariableOrDefault("KEYSTORE_PASSWORD", "android") keyAlias = getSystemVariableOrDefault("KEYSTORE_KEY_NAME", "androiddebugkey") keyPassword getSystemVariableOrDefault("KEYSTORE_KEY_PASSWORD", "android") } release { storeFile new File(getSystemVariableOrDefault("KEYSTORE_FILE", "")) storePassword getSystemVariableOrDefault("KEYSTORE_PASSWORD", "") keyAlias = getSystemVariableOrDefault("KEYSTORE_KEY_NAME", "") keyPassword getSystemVariableOrDefault("KEYSTORE_KEY_PASSWORD", "") } } sourceSets { androidTest.assets.srcDirs += files("$projectDir/schemas".toString()) debug.assets.srcDirs += files("$projectDir/schemas".toString()) } buildTypes { release { minifyEnabled true debuggable false shrinkResources true proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' signingConfig signingConfigs.release buildConfigField("Boolean", "LEAK_DETECTION", "false") buildConfigField("Boolean", "SHOW_ALL_SERVERS", "false") buildConfigField("Boolean", "IN_APP_UPDATES", "true") } debug { initWith buildTypes.debug buildConfigField("Boolean", "LEAK_DETECTION", "false") buildConfigField("Boolean", "SHOW_ALL_SERVERS", "true") } leakCanary { matchingFallbacks = ['debug'] initWith buildTypes.debug buildConfigField("Boolean", "LEAK_DETECTION", "true") buildConfigField("Boolean", "SHOW_ALL_SERVERS", "false") } fdroid { matchingFallbacks = ['release'] initWith release proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' buildConfigField("Boolean", "SHOW_ALL_SERVERS", "true") buildConfigField("Boolean", "IN_APP_UPDATES", "false") } unsignedRelease { minifyEnabled true debuggable false shrinkResources true proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' buildConfigField("Boolean", "LEAK_DETECTION", "false") buildConfigField("Boolean", "SHOW_ALL_SERVERS", "false") } } flavorDimensions "version" productFlavors { adblocker { matchingFallbacks = ['default'] dimension "version" versionNameSuffix "-adblock" versionCode 76 } normal { matchingFallbacks = ['default'] dimension "version" } } packagingOptions { exclude 'META-INF/library_release.kotlin_module' } testOptions { unitTests { includeAndroidResources = true } } compileOptions { sourceCompatibility JavaVersion.VERSION_1_8 targetCompatibility JavaVersion.VERSION_1_8 } lintOptions{ disable 'MissingTranslation' disable 'InvalidPeriodicWorkRequestInterval' } dependenciesInfo { includeInApk = false includeInBundle = false } kotlinOptions { jvmTarget = JavaVersion.VERSION_1_8.toString() } } // Uncomment to force a dependency version //configurations.all { // resolutionStrategy { // force 'com.example:example:1.2.3' // } //} dependencies { def room_version = "2.2.6" implementation fileTree(dir: 'libs', include: ['*.jar']) implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$KOTLIN_VERSION" implementation('org.jetbrains.kotlinx:kotlinx-coroutines-core:1.4.2') implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.4.2' implementation 'com.frostnerd.utilskt:lifecycle:1.2.1' implementation 'com.frostnerd.utilskt:preferences:1.5.30' // https://git.frostnerd.com/AndroidUtils/preferenceskt implementation 'com.frostnerd.utilskt:navigationdraweractivity:1.4.2' // https://git.frostnerd.com/AndroidUtils/navigationdraweractivity implementation 'com.frostnerd.utilskt:encrypteddnstunnelproxy:2.1.21' // https://git.frostnerd.com/AndroidUtils/encrypteddnstunnelproxy implementation 'com.frostnerd.utilskt:general:1.0.25' // https://git.frostnerd.com/AndroidUtils/generalkt implementation 'com.frostnerd.utilskt:adapters:1.2.0' // https://git.frostnerd.com/AndroidUtils/Adapters implementation 'androidx.work:work-runtime:2.4.0' implementation 'androidx.appcompat:appcompat:1.3.0-alpha02' implementation "androidx.preference:preference:1.1.1" implementation "com.google.android.material:material:1.3.0-beta01" implementation 'androidx.localbroadcastmanager:localbroadcastmanager:1.1.0-alpha01' implementation "androidx.core:core-ktx:1.3.2" implementation "androidx.room:room-runtime:$room_version" kapt "androidx.room:room-compiler:$room_version" implementation "androidx.room:room-coroutines:2.1.0-alpha04" testImplementation "androidx.room:room-testing:$room_version" implementation 'io.sentry:sentry-android:3.2.0' implementation 'com.github.jorgecastilloprz:fabprogresscircle:1.01@aar' leakCanaryImplementation 'com.squareup.leakcanary:leakcanary-android:2.6' implementation "com.squareup.okhttp3:okhttp:4.9.0" implementation 'com.github.AppIntro:AppIntro:6.0.0' implementation 'com.google.android.play:core:1.9.0' } def getGitCommitHash() { def stdout = new ByteArrayOutputStream() exec { commandLine 'git', 'rev-parse', '--short', 'HEAD' standardOutput = stdout } return stdout.toString().trim() }