Created
February 14, 2024 13:57
-
-
Save sud007/e1ee9ceef3c8c08b1f79e2d8fcc4ad1e to your computer and use it in GitHub Desktop.
Sonarqube Gradle sample
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
apply(from = "../buildSrc/jacoco.gradle") | |
apply(from = "../buildSrc/sonarqube.gradle") | |
plugins { | |
id("org.sonarqube") version "3.3" | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
apply plugin: 'org.sonarqube' | |
sonarqube { | |
properties { | |
property("sonar.host.url", "https://sonarcloud.io") | |
property("sonar.projectKey", "project_key") | |
property("sonar.projectName", "project_name") | |
property("sonar.login", System.getenv("SONAR_LOGIN")) | |
property("sonar.organization", "org_name") | |
property("sonar.projectBaseDir", "${project.rootDir}") | |
property("sonar.scm.exclusions.disabled", "true") | |
property("sonar.sourceEncoding", "UTF-8") | |
property("sonar.tests", "shared/src/androidTest/kotlin, shared/src/test/java, shared/src/test/kotlin") | |
property "sonar.test.inclusions", "**/*Test*/**" | |
property("sonar.sources", "shared/src/commonMain/kotlin, shared/src/androidMain/kotlin") | |
property( | |
"sonar.coverage.exclusions", | |
"**/src/main/res/**, " + | |
"**/R.class, " + | |
"**/*Util*," + | |
"**/*Adapter*," + | |
"**/*Binder.kt," + | |
"**/WebClient.kt," + | |
"**/FirebaseService.kt," + | |
"**/widgets/**," + | |
"**/analytics/**," + | |
"**/arch/**," + | |
"**/util/**," + | |
"**/event/**," + | |
"**/*StringFactory*" + | |
",**/*ImageFactory*," + | |
// "**/R$*.class," + | |
"**/*\$InjectAdapter.*," + | |
"**/*\$ModuleAdapter.*," + | |
"**/Dao*.*," + | |
"**/*\$ViewInjector*.*," + | |
"**/*\$ViewBinder*.*," + | |
"**/*MembersInjector*.*," + | |
"**/BuildConfig.*," + | |
"**/Manifest*.*," + | |
"**/*Companion*.*," + | |
// "**/*\$Lambda$*.," + | |
"**/*Factory*.," + | |
"**/*\$Builder*," + | |
"**/*\$Parcelable*.*," + | |
"**/*Test*.*," + | |
"**/android/databinding/**," + | |
"**/androidx/databinding/*," + | |
"**/dasdigital/android/generated/callback/*, " + | |
"**/widgets/*," + | |
"**/me/**/*.*, " + | |
"**/org/**/*.*, " + | |
"**/*\$Result.*, " + | |
// "**/*\$Result$*.*," + | |
"**/AndroidMain/**/PlatformAndroid*," + | |
"**/AndroidMain/**/DateTimeAndroid*," + | |
"**/commonMain/**/models/**," + | |
"**/commonMain/**/sqldelight/**, " + | |
"**/commonMain/**/api/**" + | |
"**/commonMain/**/impl/**" + | |
"**/commonMain/**/ktor/api/**" + | |
"**/commonMain/**/ktor/api/**/impl/**" + | |
"**/commonMain/**/ktor/arch/**" + | |
"**/commonMain/**/ktor/model/**" + | |
"**/commonMain/**/ktor/repository/**" + | |
"**/commonMain/**/ktor/request/**" + | |
"**/commonMain/**/ktor/response/**" + | |
"**/*StringFactory*," + | |
"**/*ImageFactory*," + | |
"**/KtorClientProvider*" + | |
"**/commonMain/**/request/**," + | |
" **/commonMain/**/response/**," + | |
" **/commonMain/**/analytics/**," + | |
" **/commonMain/**/di/**," + | |
" **/commonMain/**/factory/**," + | |
" **/commonMain/**/arch/**," + | |
" **/commonMain/**/validation/**," + | |
" **/commonMain/**/repository/**" + | |
" **/commonMain/**/ErrorCodes*" + | |
" **/commonMain/**/FailureHandler*" + | |
" **/commonMain/**/NetworkHelper*" + | |
" **/commonMain/**/ApiConstants*" + | |
" **/commonMain/**/Headers*" + | |
" **/commonMain/**/Params*" + | |
" **/commonMain/**/Constants*" + | |
" **/commonMain/**/LoginValidator*" + | |
" **/commonMain/**/KtorClientProvider*" + | |
" **/commonMain/**/Koin*" + | |
" **/commonMain/**/NationalIds*" + | |
" **/commonMain/**/SettingsConstants*" + | |
" **/commonMain/**/DisbursementModeTypes*" + | |
" **/commonMain/**/ECollectionMode*" + | |
" **/commonMain/**/IncomeSourceType*" + | |
" **/commonMain/**/IndustryType*" + | |
" **/commonMain/**/InstantLoanDataProvider*" + | |
" **/commonMain/**/InstantLoanEcType*" + | |
" **/commonMain/**/InstantLoanEligibilityCheckStates*" + | |
" **/commonMain/**/InstantLoanScreens*" + | |
" **/commonMain/**/InstantLoanSubmitStates*" + | |
" **/commonMain/**/InstantLoanType*" + | |
" **/commonMain/**/QualificationType*" + | |
" **/commonMain/**/EnumExtensions*" + | |
" **/commonMain/**/DateTimeUtil*" + | |
" **/commonMain/**/DataUtil*" + | |
" **/commonMain/**/AppInfo*" + | |
"**/*Dto*," + | |
" **/commonMain/**/Constants*" | |
) | |
property("sonar.java.coveragePlugin", "jacoco") | |
property("sonar.junit.reportPaths", "${project.buildDir}/test-results/testDebugUnitTest/TEST-*.xml") | |
property("sonar.coverage.jacoco.xmlReportPaths", "${project.buildDir}/reports/jacocoTestReport/jacocoTestReport.xml") | |
property "sonar.coverage.exclusions", "${coverageExclusions.join(', ')}" | |
if (project.hasProperty("pullRequest")) { | |
property("sonar.pullrequest.key", System.getenv("PULL_REQUEST_KEY")) | |
property("sonar.pullrequest.branch", System.getenv("PULL_REQUEST_BRANCH")) | |
property("sonar.pullrequest.base", System.getenv("PULL_REQUEST_TARGET")) | |
} else { | |
property("sonar.branch.name", System.getenv("BRANCH_NAME")) | |
if ("release" != System.getenv("BRANCH_NAME")) { | |
property( | |
"sonar.branch.target", | |
System.getenv("TARGET_BRANCH_NAME") ?: System.getenv("BRANCH_NAME") | |
) | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment