Skip to content

Commit

Permalink
Adds flavors and GMD, and fixes snippet
Browse files Browse the repository at this point in the history
  • Loading branch information
JoseAlcerreca committed Apr 15, 2024
1 parent 482df6c commit d58ee5d
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 2 deletions.
39 changes: 38 additions & 1 deletion CodeCoverage/app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -52,13 +52,40 @@ android {
)
}
}

flavorDimensions += "version"
productFlavors {
create("flavor1") {
dimension = "version"
}
create("flavor2") {
dimension = "version"
}
}
compileOptions {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
}
kotlinOptions {
jvmTarget = "1.8"
}

testOptions {
managedDevices {
localDevices {
// run with ../gradlew pixel2api30DebugAndroidTest
create("pixel2api30") {
// Use device profiles you typically see in Android Studio.
device = "Pixel 2"
// Use only API levels 27 and higher.
apiLevel = 30
// To include Google services, use "google".
systemImageSource = "aosp"
}
}
}
}

setupCombinedReportTestCoverage()
}

Expand Down Expand Up @@ -115,11 +142,21 @@ fun setupCombinedReportTestCoverage() {

// TODO: Use a proper API when https://issuetracker.google.com/332830826 is fixed
executionData.setFrom(
// Local tests
project.fileTree("$buildDir/outputs/unit_test_code_coverage/${variant.name}UnitTest")
.matching { include("**/*.exec") },

// Instrumented tests
project.fileTree("$buildDir/outputs/code_coverage/${variant.name}AndroidTest")
.matching { include("**/*.ec") }
.matching { include("**/*.ec") },

// Instrumented tests with GMD
project.fileTree("$buildDir/outputs/managed_device_code_coverage/${variant.name}")
.matching { include("**/*.ec") },

// Instrumented tests with GMD and flavors
project.fileTree("$buildDir/outputs/managed_device_code_coverage/${variant.buildType}/flavors/${variant.flavorName}/")
.matching { include("**/*.ec") },
)
}

Expand Down
2 changes: 1 addition & 1 deletion CodeCoverage/gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[versions]
agp = "8.4.0-beta02"
agp = "8.4.0-rc02"
kotlin = "1.9.0"
coreKtx = "1.12.0"
junit = "4.13.2"
Expand Down

0 comments on commit d58ee5d

Please sign in to comment.