Skip to content
Snippets Groups Projects
build.gradle 7.98 KiB
Newer Older
/******************************************************************************
 * Corona-Warn-App                                                            *
 *                                                                            *
 * SAP SE and all other contributors /                                        *
 * copyright owners license this file to you under the Apache                 *
 * License, Version 2.0 (the "License"); you may not use this                 *
 * file except in compliance with the License.                                *
 * You may obtain a copy of the License at                                    *
 *                                                                            *
 * http://www.apache.org/licenses/LICENSE-2.0                                 *
 *                                                                            *
 * Unless required by applicable law or agreed to in writing,                 *
 * software distributed under the License is distributed on an                *
 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY                     *
 * KIND, either express or implied.  See the License for the                  *
 * specific language governing permissions and limitations                    *
 * under the License.                                                         *
 ******************************************************************************/

apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'kotlin-kapt'
apply plugin: "androidx.navigation.safeargs.kotlin"
apply plugin: 'jacoco'
    ndkVersion "21.2.6472646"
    compileSdkVersion 29
    buildToolsVersion "29.0.3"

    defaultConfig {
        applicationId 'de.rki.coronawarnapp'
        minSdkVersion 23
        targetSdkVersion 29
oemerb's avatar
oemerb committed
        versionCode 9
        versionName "0.8.2"
        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"

        buildConfigField "String", "DOWNLOAD_CDN_URL", "\"$DOWNLOAD_CDN_URL\""
        buildConfigField "String", "SUBMISSION_CDN_URL", "\"$SUBMISSION_CDN_URL\""
        buildConfigField "String", "VERIFICATION_CDN_URL", "\"$VERIFICATION_CDN_URL\""

        //override URLs with local variables
        Properties properties = new Properties()
        def propertiesFile = project.rootProject.file('local.properties')
        if (propertiesFile.exists()) {
            properties.load(propertiesFile.newDataInputStream())

            def DOWNLOAD_CDN_URL = properties.getProperty('DOWNLOAD_CDN_URL')
            if (DOWNLOAD_CDN_URL)
                buildConfigField "String", "DOWNLOAD_CDN_URL", "\"$DOWNLOAD_CDN_URL\""

            def SUBMISSION_CDN_URL = properties.getProperty('SUBMISSION_CDN_URL')
            if (SUBMISSION_CDN_URL)
                buildConfigField "String", "SUBMISSION_CDN_URL", "\"$SUBMISSION_CDN_URL\""

            def VERIFICATION_CDN_URL = properties.getProperty('VERIFICATION_CDN_URL')
            if (VERIFICATION_CDN_URL)
                buildConfigField "String", "VERIFICATION_CDN_URL", "\"$VERIFICATION_CDN_URL\""
        }
    }

    buildTypes {
        release {
            minifyEnabled true
            shrinkResources true
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
        }
        releaseForTest {
            applicationIdSuffix '.dev'
            minifyEnabled true
            shrinkResources true
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
        }
    }

    // https://developer.android.com/studio/build/build-variants
    // We use flavors to build different versions of the app. One version which uses
    // the mock ExposureNotification API and one for the real Google API
    flavorDimensions "version"
    productFlavors {
        device {
            dimension "version"
            buildConfigField "String", "BUILD_VARIANT", "\"device\""
            resValue "string", "app_name", "Corona-Warn"
        }
    }

    buildFeatures {
        dataBinding {
            enabled true
        }
        viewBinding {
            enabled true
        }
    }

    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }
    kotlinOptions {
        jvmTarget = "1.8"
    }

    lintOptions {
        checkAllWarnings = true
    }

    testOptions {
        unitTests {
            includeAndroidResources = true
            returnDefaultValues = true
        }
    }

    kapt {
        useBuildCache true
        includeCompileClasspath = false
    }
    dexOptions {
        preDexLibraries true
    }
    packagingOptions {
        exclude "**/module-info.class"
        exclude 'NOTICE'
        exclude 'LICENSE'
        exclude 'CODEOWNERS'
        exclude 'README.md'
        exclude 'CODE_OF_CONDUCT.md'
    }

}

task jacocoTestReport(type: JacocoReport, dependsOn: ['testDeviceReleaseUnitTest']) {
    reports {
        xml.enabled = true
        html.enabled = true
    }
}

dependencies {
    api fileTree(dir: 'libs', include: ['play-services-nearby-18.0.2-eap.aar'])
    implementation project(":Server-Protocol-Buffer")


    implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:1.3.7"
    implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
    implementation 'androidx.appcompat:appcompat:1.1.0'
    implementation 'androidx.core:core-ktx:1.3.0'
    implementation 'com.google.android.material:material:1.1.0'
    implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
    implementation 'androidx.navigation:navigation-fragment-ktx:2.2.2'
    implementation 'androidx.navigation:navigation-ui-ktx:2.2.2'
    implementation 'androidx.legacy:legacy-support-v4:1.0.0'
    implementation 'androidx.preference:preference:1.1.1'
    implementation 'androidx.work:work-runtime-ktx:2.3.4'
    implementation 'android.arch.lifecycle:extensions:1.1.1'
    implementation 'com.android.volley:volley:1.1.1'
    implementation 'com.squareup.okhttp3:okhttp:4.7.2'
    implementation 'com.google.android.play:core:1.7.3'
    implementation 'com.google.code.gson:gson:2.8.6'
    implementation 'com.google.guava:guava:29.0-android'
    implementation('com.journeyapps:zxing-android-embedded:4.1.0') { transitive = false }
    // noinspection GradleDependency - needed for SDK 23 compatibility, in combination with com.journeyapps:zxing-android-embedded:4.1.0
    implementation 'com.google.zxing:core:3.3.0'
    // implementation 'com.google.android.gms:play-services-nearby:18.0.2-eap'
    testImplementation 'junit:junit:4.13'
    testImplementation "org.mockito:mockito-core:3.3.3"
    testImplementation('org.robolectric:robolectric:4.3.1') {
        exclude group: 'com.google.protobuf'
    }
    testImplementation "io.mockk:mockk:1.10.0"
    testImplementation 'org.hamcrest:hamcrest-library:2.2'
    androidTestImplementation 'androidx.test:runner:1.2.0'
    androidTestImplementation 'androidx.test.ext:junit:1.1.1'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
    androidTestImplementation 'androidx.test:rules:1.2.0'
    androidTestImplementation 'androidx.test.ext:truth:1.2.0'
    androidTestImplementation 'androidx.test.ext:junit:1.1.1'

    implementation 'joda-time:joda-time:2.10.6'

    implementation 'com.google.android.gms:play-services-base:17.2.1'
    implementation 'com.google.android.gms:play-services-basement:17.2.1'
    implementation 'com.google.android.gms:play-services-safetynet:17.0.0'
    implementation 'com.google.android.gms:play-services-tasks:17.0.2'

    def room_version = "2.2.5"

    implementation "androidx.room:room-runtime:$room_version"
    implementation "androidx.room:room-ktx:$room_version"
    implementation "androidx.room:room-guava:$room_version"
    kapt "androidx.room:room-compiler:$room_version"

    implementation "androidx.security:security-crypto:1.0.0-rc02"

    implementation 'net.zetetic:android-database-sqlcipher:4.4.0'
    implementation "androidx.sqlite:sqlite:2.0.1"