apply plugin: 'com.android.application' apply plugin: 'com.github.triplet.play' apply plugin: 'kotlin-android' apply plugin: 'kotlin-parcelize' def repoRootPath = rootProject.projectDir.absoluteFile.parentFile.absolutePath def extraAssetsDirectory = "$project.buildDir/extraAssets" def extraJniDirectory = "$project.buildDir/extraJni" def keystorePropertiesFile = file('keystore.properties') def keystoreProperties = new Properties() if (keystorePropertiesFile.exists()) { keystoreProperties.load(new FileInputStream(keystorePropertiesFile)) } android { compileSdkVersion 30 buildToolsVersion '30.0.3' defaultConfig { applicationId "net.mullvad.mullvadvpn" minSdkVersion 26 targetSdkVersion 30 versionCode 21010099 versionName "2021.1" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" } if (keystorePropertiesFile.exists()) { signingConfigs { release { keyAlias keystoreProperties['keyAlias'] keyPassword keystoreProperties['keyPassword'] storeFile file(keystoreProperties['storeFile']) storePassword keystoreProperties['storePassword'] } } buildTypes { release { minifyEnabled false signingConfig signingConfigs.release } } } buildTypes { fdroid { initWith release minifyEnabled false signingConfig null } } sourceSets { main { assets { srcDirs = files(extraAssetsDirectory) } jniLibs { srcDirs = files(extraJniDirectory) } java { srcDirs += 'src/main/kotlin/' } } test { java { srcDirs += 'src/test/kotlin/' } } androidTest { java { srcDirs += 'src/androidTest/kotlin/' } } } compileOptions { sourceCompatibility JavaVersion.VERSION_1_8 targetCompatibility JavaVersion.VERSION_1_8 } kotlinOptions { jvmTarget = '1.8' freeCompilerArgs += "-Xopt-in=kotlin.RequiresOptIn" // Opt-in option for Koin annotation of KoinComponent. } applicationVariants.all { variant -> variant.mergeAssetsProvider.configure { dependsOn copyExtraAssets } } testOptions { unitTests.all { testLogging { outputs.upToDateWhen { false } events "passed", "skipped", "failed", "standardOut", "standardError" showCauses true showExceptions true } } } } dependencyCheck { // Skip the lintClassPath configuration, which relies on many dependencies that has been flagged // to have CVEs, as it's related to the lint tooling rather than the project's compilation class // path. The alternative would be to suppress specific CVEs, however that could potentially // result in suppressed CVEs in project compilation class path. skipConfigurations += 'lintClassPath' } tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).all { kotlinOptions { allWarningsAsErrors = false kotlinOptions.freeCompilerArgs += [ "-Xuse-experimental=kotlinx.coroutines.ExperimentalCoroutinesApi", "-Xuse-experimental=kotlinx.coroutines.ObsoleteCoroutinesApi", ] } } task copyExtraAssets(type: Copy) { from "$repoRootPath/dist-assets" include "relays.json" include "api-ip-address.txt" into extraAssetsDirectory } play { serviceAccountCredentials = file("play-api-key.json") } dependencies { implementation "androidx.appcompat:appcompat:1.3.1" implementation "androidx.constraintlayout:constraintlayout:2.1.0" implementation "androidx.coordinatorlayout:coordinatorlayout:1.1.0" implementation "androidx.core:core-ktx:1.6.0" implementation "androidx.fragment:fragment-ktx:$fragmentVersion" implementation "androidx.lifecycle:lifecycle-runtime-ktx:2.3.1" implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:2.3.1" implementation "androidx.recyclerview:recyclerview:1.2.1" implementation "com.google.android.material:material:1.4.0" implementation "commons-validator:commons-validator:1.7" implementation "io.insert-koin:koin-core:$koinVersion" implementation "io.insert-koin:koin-core-ext:$koinVersion" implementation "io.insert-koin:koin-androidx-fragment:$koinVersion" implementation "io.insert-koin:koin-androidx-scope:$koinVersion" implementation "io.insert-koin:koin-androidx-viewmodel:$koinVersion" implementation "joda-time:joda-time:2.10.2" implementation "org.jetbrains.kotlin:kotlin-reflect:$kotlinVersion" implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlinVersion" implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:1.5.1" /* Test dependencies */ testImplementation "io.insert-koin:koin-test:$koinVersion" testImplementation "io.mockk:mockk:$mockkVersion" testImplementation "junit:junit:4.13" testImplementation "org.jetbrains.kotlin:kotlin-test:$kotlinVersion" testImplementation "org.jetbrains.kotlinx:kotlinx-coroutines-test:1.5.1" /* UI test dependencies */ debugImplementation "androidx.fragment:fragment-testing:$fragmentVersion" androidTestImplementation "androidx.test.espresso:espresso-core:$espressoVersion" androidTestImplementation "androidx.test.espresso:espresso-contrib:$espressoVersion" androidTestImplementation "androidx.test.ext:junit:1.1.3" androidTestImplementation "io.mockk:mockk-android:$mockkVersion" androidTestImplementation "io.insert-koin:koin-test:$koinVersion" androidTestImplementation "org.jetbrains.kotlin:kotlin-test:$kotlinVersion" }