apply plugin: 'com.android.application'
apply plugin: "org.sonarqube"

sonarqube {
    properties {
        property "sonar.projectName", "Port Authority"
        property "sonar.projectKey", "portauthority"
        property "sonar.host.url", "http://192.168.1.3:9000"
        property "sonar.sourceEncoding", "UTF-8"
        property "sonar.exclusions", "build/**,**/*.png,**/*.psd"
        property "sonar.import_unknown_files", true
        property "sonar.android.lint.report", "./build/reports/lint-results.xml"
    }
}

android {
    viewBinding.enabled = true
    compileSdkVersion 31
    buildToolsVersion '30.0.3'

    defaultConfig {
        minSdkVersion 19
        targetSdkVersion 31
        versionCode 67
        versionName "2.4.5"
        applicationId "com.aaronjwood.portauthority"
        setProperty("archivesBaseName", "PortAuthority-$versionName")
        externalNativeBuild {
            ndkBuild {
                cppFlags ''
            }
        }
    }

    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }

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

    flavorDimensions "main"

    productFlavors {
        free {
            applicationIdSuffix ".free"
            versionNameSuffix "-free"
            dimension "main"
        }
        donate {
            applicationIdSuffix ".donate"
            versionNameSuffix "-donate"
            dimension "main"
        }
    }
    lint {
        abortOnError false
    }
    externalNativeBuild {
        ndkBuild {
            path file('src/main/c/Android.mk')
        }
    }

}

dependencies {
    implementation 'androidx.legacy:legacy-support-v4:1.0.0'
    implementation 'androidx.appcompat:appcompat:1.4.2'
    implementation 'com.squareup.okhttp3:okhttp:3.14.9' // Anything past 3.12.x will break our Android 4 support!
    implementation 'org.minidns:minidns-hla:1.0.2'
    debugImplementation 'com.squareup.leakcanary:leakcanary-android:2.9.1'
    testImplementation 'junit:junit:4.13'
    testImplementation 'org.mockito:mockito-core:1.10.19'
}
