apply plugin: "org.sonarqube"

ext.sonar = [
        ignoreModules : [
                'stream-feeds-android-network',
                'stream-feeds-android-sample',
                'buildSrc'
        ],
        excludeFilter : [
                '**/test/**',
                '**/androidTest/**',
                '**/R.class',
                '**/R2.class',
                '**/R$*.class',
                '**/BuildConfig.*',
                '**/Manifest*.*',
                '**/*Test*.*'
        ]
]

ext.sonar.ignoreModules.each {
    ext.sonar.excludeFilter << "**/${it}/**"
}

sonarqube {
    properties {
        property("sonar.host.url", "https://sonarcloud.io")
        property("sonar.token", "${System.getenv("SONAR_TOKEN")}")
        property("sonar.organization", "getstream")
        property("sonar.projectKey", "GetStream_stream-feeds-android")
        property("sonar.projectName", "stream-feeds-android")
        property "sonar.java.coveragePlugin", "jacoco"
        property "sonar.sourceEncoding", "UTF-8"
        property "sonar.java.binaries", "${rootDir}/**/build/tmp/kotlin-classes/debug"
        property "sonar.coverage.exclusions", rootProject.ext.sonar.excludeFilter
    }
}
