Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -35,17 +35,30 @@ class PipelineJacocoConventionPlugin : Plugin<Project> {
reports.xml.required.set(true)
reports.html.required.set(false) // Disable html reports to decrease report upload/download time in github pipeline

val javaTree = fileTree("${project.buildDir}/intermediates/javac/debug/classes") { exclude(fileFilter) }
val kotlinTree = fileTree("${project.buildDir}/tmp/kotlin-classes/debug") { exclude(fileFilter) }
val javaTree = fileTree("${project.buildDir}/intermediates/javac/debug") {
include("**/classes/**")
exclude(fileFilter)
}
val kotlinTree = fileTree("${project.buildDir}") {
include("tmp/kotlin-classes/debug/**", "classes/kotlin/debug/**", "classes/kotlin/main/**")
exclude(fileFilter)
}
classDirectories.setFrom(files(javaTree, kotlinTree))

sourceDirectories.setFrom(files("${project.projectDir}/src/main/java"))
sourceDirectories.setFrom(
files(
"${project.projectDir}/src/main/java",
"${project.projectDir}/src/main/kotlin",
),
)

executionData.setFrom(
fileTree("$buildDir") {
fileTree(buildDir) {
include(
"jacoco/testDebugUnitTest.exec",
"outputs/code-coverage/connected/*coverage.ec",
"jacoco/testDebugUnitTest.exec", // Standard Gradle / Old AGP
"outputs/unit_test_code_coverage/debugUnitTest/testDebugUnitTest.exec", // Modern AGP Unit Tests
"outputs/code-coverage/connected/*coverage.ec", // Old AGP Instrumented Tests
"outputs/code_coverage/debugAndroidTest/connected/**/*.ec", // Modern AGP Instrumented Tests
)
},
)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,40 +0,0 @@
import org.gradle.api.Plugin
import org.gradle.api.Project
import org.gradle.kotlin.dsl.configure
import org.sonarqube.gradle.SonarExtension
import java.io.File

class PipelineSonarConventionPlugin : Plugin<Project> {
override fun apply(target: Project) {
with(target) {
with(pluginManager) {
apply("org.sonarqube")
}

extensions.configure<SonarExtension> {
properties {
property("sonar.projectName", "Simprints ID")
property("sonar.c.file.suffixes", "-")
property("sonar.java.coveragePlugin", "jacoco")
}
}

subprojects {
extensions.configure<SonarExtension> {
properties {
// Fix for https://community.sonarsource.com/t/random-sub-projects-fail-analysis-in-gradle-multi-projects-build/49777
property("sonar.userHome", "$projectDir$cacheDir")
property("sonar.coverage.jacoco.xmlReportPaths", listOf("$projectDir$jacocoDir"))
}
}
}
}
}

companion object {
private val cacheDir = "${File.separator}build${File.separator}.sonar"
private val jacocoDir = "${File.separator}build${File.separator}reports${File.separator}jacoco${File.separator}jacocoTestReport${File.separator}jacocoTestReport.xml"
private val sourceDir = "${File.separator}src${File.separator}main${File.separator}java${File.separator}com${File.separator}simprints"
private val binariesDir = "${File.separator}build${File.separator}"
}
}
2 changes: 1 addition & 1 deletion build-logic/sonarqube.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ sonarqube {
property "sonar.java.coveragePlugin", "jacoco"
}
}

subprojects {
sonarqube {
androidVariant = "debug"
properties {
property "sonar.java.binaries", "$projectDir$binariesDir"
property "sonar.coverage.jacoco.xmlReportPaths", [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class LastCallingPackageStore @Inject constructor(
var lastCallingPackageName: String?
get() = prefs.getString(
KEY_LAST_CALLING_PACKAGE_NAME,
context.getString(com.simprints.infra.resources.R.string.default_commcare_package_name)
context.getString(com.simprints.infra.resources.R.string.default_commcare_package_name),
)
set(value) {
prefs.edit {
Expand All @@ -33,4 +33,4 @@ class LastCallingPackageStore @Inject constructor(
private const val PREF_FILE_NAME = "last_calling_package_store"
private const val KEY_LAST_CALLING_PACKAGE_NAME = "last_calling_package_name"
}
}
}
8 changes: 0 additions & 8 deletions infra/resources/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,6 @@ plugins {
id("simprints.android.library")
}

sonarqube {
/*
* We skip the infraresources module because it has no source code to analyse. This should be
* removed if that ever changes
*/
isSkipProject = true
}

android {
namespace = "com.simprints.infra.resources"
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ import dagger.assisted.AssistedFactory
import dagger.assisted.AssistedInject
import dagger.hilt.android.qualifiers.ApplicationContext
import java.util.concurrent.Executors
import javax.inject.Inject

@ExcludedFromGeneratedTestCoverageReports(
reason = "This is an injectable wrapper around cameraX and ML kit APIs. There is no business logic.",
Expand Down
Loading