Skip to content

Commit e67de0a

Browse files
authored
Add support for Android Build Tools 7.2-alpha06 (#43)
In Android Gradle Plugin 7.0 a bug was introduced causing instrumented coverage for Android library projects to fail (https://issuetracker.google.com/issues/195860510). This bug has been fixed in AGP 7.2.0-alpha06. This contains the necessary changes to make this plugin work with AGP 7.2 and some general dependency upgrades: - Increased the target and compile SDK version to API level 31 for the test fixtures. This also requires the build to use Java 11. - Upgraded several test related dependencies (AppCompat, Google Truth, Robolectric etc.). - Upgraded to Kotlin 1.5 Fixes: #36
1 parent 20f892c commit e67de0a

File tree

11 files changed

+147
-123
lines changed

11 files changed

+147
-123
lines changed

Diff for: .github/workflows/build.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ jobs:
1111
uses: actions/checkout@v2
1212
- uses: actions/setup-java@v1
1313
with:
14-
# Robolectric requires Java 9 to emulate Android API level 30
15-
java-version: '9'
14+
# Robolectric requires Java 11 to compile at Android API level 31
15+
java-version: '11'
1616
- name: test
1717
uses: reactivecircus/android-emulator-runner@v2
1818
with:

Diff for: gradle/dependencies.gradle

+16-16
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,38 @@
11
ext {
22
projectVersion = [
33
minSdk : 19,
4-
targetSdk : 30,
5-
compileSdk: 30,
6-
kotlin : "1.4.31",
4+
targetSdk : 31,
5+
compileSdk: 31,
6+
kotlin : "1.5.20",
77
]
88
projectDependency = [
99

1010
// Gradle Plugins
1111
kotlinPlugin : "org.jetbrains.kotlin:kotlin-gradle-plugin:${projectVersion.kotlin}",
12-
androidGradlePlugin: "com.android.tools.build:gradle:4.1.2",
12+
androidGradlePlugin: "com.android.tools.build:gradle:7.2.0-alpha06",
1313

1414
// Dependencies
1515
kotlinStdlibJdk8 : "org.jetbrains.kotlin:kotlin-stdlib-jdk8:${projectVersion.kotlin}",
16-
appCompat : "androidx.appcompat:appcompat:1.2.0",
16+
kotlinReflect : "org.jetbrains.kotlin:kotlin-reflect:${projectVersion.kotlin}",
17+
appCompat : "androidx.appcompat:appcompat:1.4.0",
1718

1819
// Test dependencies
1920
junit : "junit:junit:4.13.2",
20-
truth : "com.google.truth:truth:1.1.2",
21-
supportTestRunner : "androidx.test:runner:1.2.0",
22-
espressoCore : "androidx.test.espresso:espresso-core:3.3.0",
23-
androidJUnit : "androidx.test.ext:junit:1.1.2",
21+
truth : "com.google.truth:truth:1.1.3",
22+
supportTestRunner : "androidx.test:runner:1.4.0",
23+
espressoCore : "androidx.test.espresso:espresso-core:3.4.0",
24+
androidJUnit : "androidx.test.ext:junit:1.1.3",
2425
commonsCsv : "org.apache.commons:commons-csv:1.8",
2526
kotlinTest : "org.jetbrains.kotlin:kotlin-test:${projectVersion.kotlin}",
26-
robolectric : "org.robolectric:robolectric:4.5.1",
27+
robolectric : "org.robolectric:robolectric:4.7.3",
2728
]
2829

2930
// Used by the plugin-version-handler.gradle
3031
pluginVersions = [
31-
"org.jetbrains.kotlin.android" : "${projectVersion.kotlin}",
32-
"org.jetbrains.kotlin.jvm" : "${projectVersion.kotlin}",
33-
"com.github.dcendents.android-maven": "2.1",
34-
"com.gradle.plugin-publish" : "0.13.0",
35-
"org.jetbrains.dokka" : "1.4.30",
36-
"com.vanniktech.maven.publish" : "0.14.2",
32+
"org.jetbrains.kotlin.android": "${projectVersion.kotlin}",
33+
"org.jetbrains.kotlin.jvm" : "${projectVersion.kotlin}",
34+
"com.gradle.plugin-publish" : "0.15.0",
35+
"org.jetbrains.dokka" : "1.5.0",
36+
"com.vanniktech.maven.publish": "0.14.2",
3737
]
3838
}

Diff for: gradle/plugin-version-handler.gradle

+1
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ apply from: "dependencies.gradle"
3434

3535
resolutionStrategy {
3636
eachPlugin {
37+
// pluginVersions must be added in dependencies.gradle as extension to this project.
3738
def version = pluginVersions[requested.id.id]
3839
if (requested.version == null && version != null) {
3940
useVersion version

Diff for: gradle/wrapper/gradle-wrapper.properties

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
distributionBase=GRADLE_USER_HOME
22
distributionPath=wrapper/dists
3-
distributionUrl=https\://services.gradle.org/distributions/gradle-6.8.3-all.zip
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.3-all.zip
44
zipStoreBase=GRADLE_USER_HOME
55
zipStorePath=wrapper/dists

Diff for: plugin/build.gradle

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ plugins {
44

55
// For publishing to Plugin Portal & Maven Central
66
id "com.gradle.plugin-publish"
7-
id "com.github.dcendents.android-maven"
87
id "org.jetbrains.dokka"
98
id "com.vanniktech.maven.publish" apply false
109
}
@@ -89,6 +88,7 @@ dependencies {
8988
compileOnly gradleApi()
9089
implementation projectDependency.androidGradlePlugin
9190
implementation projectDependency.kotlinStdlibJdk8
91+
implementation projectDependency.kotlinReflect
9292

9393
testImplementation projectDependency.kotlinStdlibJdk8
9494
testImplementation projectDependency.kotlinTest

Diff for: plugin/gradle.properties

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
POM_ARTIFACT_ID=android-root-coverage-plugin
2-
VERSION_NAME=1.4.0
2+
VERSION_NAME=1.5.0-SNAPSHOT
33
POM_NAME=Android Root Coverage Plugin
44
POM_DESCRIPTION=A Gradle plugin for easy generation of combined code coverage reports for Android projects with multiple modules.

0 commit comments

Comments
 (0)